Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-1036 User new PointerTypedef for small method_t pointers, fixed chain pointer conflict with method structures

emteerea02efe9c4ceb
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/objc2/ObjectiveC2_Method.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/objc2/ObjectiveC2_Method.java
index d1bf43deb0..dfa60e6516 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/objc2/ObjectiveC2_Method.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/objc2/ObjectiveC2_Method.java
@@ -80,11 +80,20 @@ public class ObjectiveC2_Method extends ObjectiveC_Method {
public DataType toDataType() throws DuplicateNameException, IOException {
Structure struct = new StructureDataType("method" + (isSmall ? "_small" : "") + "_t", 0);
if (isSmall) {
- DataType sdw = SignedDWordDataType.dataType;
String comment = "offset from this address";
- struct.add(sdw, sdw.getLength(), "name", comment);
- struct.add(sdw, sdw.getLength(), "types", comment);
- struct.add(sdw, sdw.getLength(), "imp", comment);
+
+ PointerTypedef strPtrRefDt = new PointerTypedef(null, new PointerDataType(STRING), 4,
+ null, PointerType.RELATIVE);
+
+ PointerTypedef strRefDt =
+ new PointerTypedef(null, STRING, 4, null, PointerType.RELATIVE);
+
+ PointerTypedef voidRefDt =
+ new PointerTypedef(null, VOID, 4, null, PointerType.RELATIVE);
+
+ struct.add(strPtrRefDt, "name", comment);
+ struct.add(strRefDt, "types", comment);
+ struct.add(voidRefDt, "imp", comment);
}
else {
struct.add(new PointerDataType(STRING), _state.pointerSize, "name", null);