Skip to content

Commit 078159d

Browse files
committed
Scope id fix for external references
1 parent e8b7a61 commit 078159d

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/DecompileCallback.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,8 +757,17 @@ public String getExternalRefXML(String addrstring) { // Return any external refe
757757
if (extRef != null) {
758758
func = listing.getFunctionAt(extRef.getToAddress());
759759
if (func == null) {
760+
Symbol symbol = extRef.getExternalLocation().getSymbol();
761+
long extId;
762+
if (symbol != null) {
763+
extId = symbol.getID();
764+
}
765+
else {
766+
extId = program.getSymbolTable().getDynamicSymbolID(addr);
767+
768+
}
760769
HighSymbol shellSymbol =
761-
new HighFunctionShellSymbol(0, extRef.getLabel(), addr, dtmanage);
770+
new HighFunctionShellSymbol(extId, extRef.getLabel(), addr, dtmanage);
762771
return buildResult(shellSymbol, null);
763772
}
764773
}

Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/pcode/HighFunctionShellSymbol.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public boolean isGlobal() {
5555
@Override
5656
public void saveXML(StringBuilder buf) {
5757
buf.append("<function");
58+
SpecXmlUtils.encodeUnsignedIntegerAttribute(buf, "id", getId());
5859
SpecXmlUtils.xmlEscapeAttribute(buf, "name", name);
5960
SpecXmlUtils.encodeSignedIntegerAttribute(buf, "size", 1);
6061
buf.append(">\n");

0 commit comments

Comments
 (0)