mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-28 17:11:11 -09:00
Merge remote-tracking branch 'origin/GP-2620_dev747368_fix_dwarf_pack_empty_struct'
This commit is contained in:
@@ -16,12 +16,14 @@
|
|||||||
package ghidra.app.util.bin.format.dwarf4.next;
|
package ghidra.app.util.bin.format.dwarf4.next;
|
||||||
|
|
||||||
import static ghidra.app.util.bin.format.dwarf4.encoding.DWARFAttribute.*;
|
import static ghidra.app.util.bin.format.dwarf4.encoding.DWARFAttribute.*;
|
||||||
import static ghidra.app.util.bin.format.dwarf4.encoding.DWARFTag.*;
|
import static ghidra.app.util.bin.format.dwarf4.encoding.DWARFTag.DW_TAG_base_type;
|
||||||
|
import static ghidra.app.util.bin.format.dwarf4.encoding.DWARFTag.DW_TAG_subrange_type;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import ghidra.app.util.DataTypeNamingUtil;
|
import ghidra.app.util.DataTypeNamingUtil;
|
||||||
@@ -748,8 +750,11 @@ public class DWARFDataTypeImporter {
|
|||||||
|
|
||||||
private void packCompositeIfPossible(DWARFDataType ddt) {
|
private void packCompositeIfPossible(DWARFDataType ddt) {
|
||||||
Composite original = (Composite) ddt.dataType;
|
Composite original = (Composite) ddt.dataType;
|
||||||
if (original.isZeroLength()) {
|
if (original.isZeroLength() || original.getNumComponents() == 0) {
|
||||||
return; // don't try to pack empty structs, this would throw off conflicthandler logic
|
// don't try to pack empty structs, this would throw off conflicthandler logic.
|
||||||
|
// also don't pack sized structs with no fields because when packed down to 0 bytes they
|
||||||
|
// cause errors when used as a param type
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Composite copy = (Composite) original.copy(dataTypeManager);
|
Composite copy = (Composite) original.copy(dataTypeManager);
|
||||||
|
|||||||
Reference in New Issue
Block a user