Skip to content

Commit

Permalink
GP-1963 handle default pointer replacement
Browse files Browse the repository at this point in the history
  • Loading branch information
ghidra1 committed Apr 27, 2022
1 parent 2a34f20 commit c38f202
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ else if (signChar != '+') {
}

DataType dt = data.getDataType();
boolean isDefaultTypeApplied = Undefined.isUndefined(dt);
boolean isDefaultTypeApplied = address.equals(data.getAddress()) &&
(Undefined.isUndefined(dt) || isDefaultPointer(dt));
int componentOffset = (int) address.subtract(data.getAddress());
if (!isDefaultTypeApplied &&
!canFixupStructure(dt, componentOffset, address.getPointerSize())) {
Expand Down Expand Up @@ -175,6 +176,14 @@ else if (signChar != '+') {
return true;
}

private boolean isDefaultPointer(DataType dt) {
if (dt instanceof Pointer) {
DataType refDt = ((Pointer) dt).getDataType();
return refDt == null || refDt == DataType.DEFAULT;
}
return false;
}

private boolean canFixupStructure(DataType dt, int componentOffset, int pointerLength) {
if (!(dt instanceof Structure)) {
return false;
Expand Down

0 comments on commit c38f202

Please sign in to comment.