mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-24 21:21:56 +00:00
Merge remote-tracking branch 'origin/caheckman_UndefinedFunction' into Ghidra_9.2
This commit is contained in:
commit
165a767365
@ -1584,13 +1584,20 @@ bool Funcdata::ancestorOpUse(int4 maxlevel,const Varnode *invn,
|
||||
// as an "only use"
|
||||
if (def->isIndirectCreation())
|
||||
return false;
|
||||
// fallthru
|
||||
return ancestorOpUse(maxlevel-1,def->getIn(0),op,trial);
|
||||
case CPUI_MULTIEQUAL:
|
||||
// Check if there is any ancestor whose only
|
||||
// use is in this op
|
||||
for(i=0;i<def->numInput();++i)
|
||||
if (ancestorOpUse(maxlevel-1,def->getIn(i),op,trial)) return true;
|
||||
|
||||
if (def->isMark()) return false; // Trim the loop
|
||||
def->setMark(); // Mark that this MULTIEQUAL is on the path
|
||||
// Note: onlyOpUse is using Varnode::setMark
|
||||
for(i=0;i<def->numInput();++i) {
|
||||
if (ancestorOpUse(maxlevel-1,def->getIn(i),op,trial)) {
|
||||
def->clearMark();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
def->clearMark();
|
||||
return false;
|
||||
case CPUI_COPY:
|
||||
if ((invn->getSpace()->getType()==IPTR_INTERNAL)||def->isIncidentalCopy()||def->getIn(0)->isIncidentalCopy()) {
|
||||
|
@ -757,8 +757,17 @@ public class DecompileCallback {
|
||||
if (extRef != null) {
|
||||
func = listing.getFunctionAt(extRef.getToAddress());
|
||||
if (func == null) {
|
||||
Symbol symbol = extRef.getExternalLocation().getSymbol();
|
||||
long extId;
|
||||
if (symbol != null) {
|
||||
extId = symbol.getID();
|
||||
}
|
||||
else {
|
||||
extId = program.getSymbolTable().getDynamicSymbolID(addr);
|
||||
|
||||
}
|
||||
HighSymbol shellSymbol =
|
||||
new HighFunctionShellSymbol(0, extRef.getLabel(), addr, dtmanage);
|
||||
new HighFunctionShellSymbol(extId, extRef.getLabel(), addr, dtmanage);
|
||||
return buildResult(shellSymbol, null);
|
||||
}
|
||||
}
|
||||
|
@ -79,14 +79,15 @@ public class HighFunction extends PcodeSyntaxTree {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the id with the associated function symbol, if it exists
|
||||
* @return the id or 0 otherwise
|
||||
* Get the id with the associated function symbol, if it exists.
|
||||
* Otherwise return a dynamic id based on the entry point.
|
||||
* @return the symbol id, or possibly a dynamic id
|
||||
*/
|
||||
public long getID() {
|
||||
if (func instanceof FunctionDB) {
|
||||
return func.getSymbol().getID();
|
||||
}
|
||||
return 0;
|
||||
return func.getProgram().getSymbolTable().getDynamicSymbolID(func.getEntryPoint());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -55,6 +55,7 @@ public class HighFunctionShellSymbol extends HighSymbol {
|
||||
@Override
|
||||
public void saveXML(StringBuilder buf) {
|
||||
buf.append("<function");
|
||||
SpecXmlUtils.encodeUnsignedIntegerAttribute(buf, "id", getId());
|
||||
SpecXmlUtils.xmlEscapeAttribute(buf, "name", name);
|
||||
SpecXmlUtils.encodeSignedIntegerAttribute(buf, "size", 1);
|
||||
buf.append(">\n");
|
||||
|
Loading…
Reference in New Issue
Block a user