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