mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-01-08 21:47:59 -05:00
Merge remote-tracking branch
'origin/GP-5723_ghidra1_DefaultPointerLabels' into Ghidra_11.4 (Closes #8200)
This commit is contained in:
@@ -38,6 +38,7 @@ public class PointerDataType extends BuiltIn implements Pointer {
|
||||
|
||||
public static final String POINTER_NAME = "pointer";
|
||||
public static final String POINTER_LABEL_PREFIX = "PTR";
|
||||
public static final String POINTER_LABEL_PREFIX_U = POINTER_LABEL_PREFIX + "_";
|
||||
public static final String POINTER_LOOP_LABEL_PREFIX = "PTR_LOOP";
|
||||
public static final String NOT_A_POINTER = "NaP";
|
||||
|
||||
@@ -203,16 +204,6 @@ public class PointerDataType extends BuiltIn implements Pointer {
|
||||
return POINTER_LABEL_PREFIX;
|
||||
}
|
||||
|
||||
PointerReferenceClassification pointerClassification =
|
||||
getPointerClassification(program, ref);
|
||||
if (pointerClassification == PointerReferenceClassification.DEEP) {
|
||||
// pointer exceed depth limit of 2
|
||||
return POINTER_LABEL_PREFIX + "_" + POINTER_LABEL_PREFIX;
|
||||
}
|
||||
if (pointerClassification == PointerReferenceClassification.LOOP) {
|
||||
return POINTER_LOOP_LABEL_PREFIX;// pointer is self referencing
|
||||
}
|
||||
|
||||
Symbol symbol = program.getSymbolTable().getSymbol(ref);
|
||||
if (symbol == null) {
|
||||
// unexpected
|
||||
@@ -222,7 +213,21 @@ public class PointerDataType extends BuiltIn implements Pointer {
|
||||
String symName = symbol.getName();
|
||||
symName = SymbolUtilities.getCleanSymbolName(symName, ref.getToAddress());
|
||||
symName = symName.replace(Namespace.DELIMITER, "_");
|
||||
return POINTER_LABEL_PREFIX + "_" + symName;
|
||||
|
||||
if (!symName.startsWith(POINTER_LABEL_PREFIX_U)) {
|
||||
return POINTER_LABEL_PREFIX_U + symName;
|
||||
}
|
||||
|
||||
PointerReferenceClassification pointerClassification =
|
||||
getPointerClassification(program, ref);
|
||||
if (pointerClassification == PointerReferenceClassification.DEEP) {
|
||||
// pointer exceed depth limit of 2
|
||||
return POINTER_LABEL_PREFIX_U + POINTER_LABEL_PREFIX;
|
||||
}
|
||||
if (pointerClassification == PointerReferenceClassification.LOOP) {
|
||||
return POINTER_LOOP_LABEL_PREFIX;// pointer is self referencing
|
||||
}
|
||||
return POINTER_LABEL_PREFIX_U + symName;
|
||||
}
|
||||
|
||||
private enum PointerReferenceClassification {
|
||||
|
||||
Reference in New Issue
Block a user