mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 10:19:23 +02:00
Use correct namespace in LocalSymbolMap
This commit is contained in:
parent
0d9e25548a
commit
84e4b8c6fe
5 changed files with 27 additions and 24 deletions
|
@ -2479,7 +2479,7 @@ ProtoParameter *ProtoStoreSymbol::setInput(int4 i, const string &nm,const Parame
|
|||
}
|
||||
}
|
||||
if (res->sym == (Symbol *)0) {
|
||||
if (scope->discoverScope(pieces.addr,pieces.type->getSize(),usepoint) != scope)
|
||||
if (scope->discoverScope(pieces.addr,pieces.type->getSize(),usepoint) == (Scope *)0)
|
||||
usepoint = restricted_usepoint;
|
||||
res->sym = scope->addSymbol(nm,pieces.type,pieces.addr,usepoint)->getSymbol();
|
||||
scope->setCategory(res->sym,0,i);
|
||||
|
|
|
@ -1326,6 +1326,7 @@ void Funcdata::mapGlobals(void)
|
|||
vn = *iter++;
|
||||
if (vn->isFree()) continue;
|
||||
if (!vn->isPersist()) continue; // Could be a code ref
|
||||
if (vn->getSymbolEntry() != (SymbolEntry *)0) continue;
|
||||
maxvn = vn;
|
||||
Address addr = vn->getAddr();
|
||||
Address endaddr = addr + vn->getSize();
|
||||
|
|
|
@ -436,11 +436,12 @@ public class HighFunction extends PcodeSyntaxTree {
|
|||
* addresses near its entry point.
|
||||
*
|
||||
* @param id is the id associated with the function symbol
|
||||
* @param namespace is the namespace containing the function symbol
|
||||
* @param entryPoint pass null to use the function entryPoint, pass an address to force an entry point
|
||||
* @param size describes how many bytes the function occupies as code
|
||||
* @return the XML string
|
||||
*/
|
||||
public String buildFunctionXML(long id, Address entryPoint, int size) {
|
||||
public String buildFunctionXML(long id, Namespace namespace, Address entryPoint, int size) {
|
||||
// Functions aren't necessarily contiguous with the smallest address being the entry point
|
||||
// So size needs to be smaller than size of the contiguous chunk containing the entry point
|
||||
StringBuilder resBuf = new StringBuilder();
|
||||
|
@ -463,7 +464,7 @@ public class HighFunction extends PcodeSyntaxTree {
|
|||
else {
|
||||
resBuf.append(Varnode.buildXMLAddress(entryPoint)); // Address is forced on XML
|
||||
}
|
||||
resBuf.append(localSymbols.buildLocalDbXML());
|
||||
localSymbols.buildLocalDbXML(resBuf, namespace);
|
||||
proto.buildPrototypeXML(resBuf, getDataTypeManager());
|
||||
if ((jumpTables != null) && (jumpTables.size() > 0)) {
|
||||
resBuf.append("<jumptablelist>\n");
|
||||
|
|
|
@ -75,7 +75,8 @@ public class HighFunctionSymbol extends HighSymbol {
|
|||
public void saveXML(StringBuilder buf) {
|
||||
MappedEntry entry = (MappedEntry) getFirstWholeMap();
|
||||
String funcString =
|
||||
function.buildFunctionXML(getId(), entry.getStorage().getMinAddress(), entry.getSize());
|
||||
function.buildFunctionXML(getId(), getNamespace(), entry.getStorage().getMinAddress(),
|
||||
entry.getSize());
|
||||
buf.append(funcString);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -325,31 +325,31 @@ public class LocalSymbolMap {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return an XML document string representing this local variable map.
|
||||
* Output an XML document representing this local variable map.
|
||||
* @param resBuf is the buffer to write to
|
||||
* @param namespace if the namespace of the function
|
||||
*/
|
||||
public String buildLocalDbXML() { // Get memory mapped local variables
|
||||
StringBuilder res = new StringBuilder();
|
||||
res.append("<localdb");
|
||||
SpecXmlUtils.encodeBooleanAttribute(res, "lock", false);
|
||||
SpecXmlUtils.encodeStringAttribute(res, "main", spacename);
|
||||
res.append(">\n");
|
||||
res.append("<scope");
|
||||
SpecXmlUtils.xmlEscapeAttribute(res, "name", func.getFunction().getName());
|
||||
res.append(">\n");
|
||||
res.append("<parent>\n");
|
||||
HighFunction.createNamespaceTag(res, func.getFunction().getParentNamespace());
|
||||
res.append("</parent>\n");
|
||||
res.append("<rangelist/>\n"); // Empty address range
|
||||
res.append("<symbollist>\n");
|
||||
public void buildLocalDbXML(StringBuilder resBuf, Namespace namespace) { // Get memory mapped local variables
|
||||
resBuf.append("<localdb");
|
||||
SpecXmlUtils.encodeBooleanAttribute(resBuf, "lock", false);
|
||||
SpecXmlUtils.encodeStringAttribute(resBuf, "main", spacename);
|
||||
resBuf.append(">\n");
|
||||
resBuf.append("<scope");
|
||||
SpecXmlUtils.xmlEscapeAttribute(resBuf, "name", func.getFunction().getName());
|
||||
resBuf.append(">\n");
|
||||
resBuf.append("<parent>\n");
|
||||
HighFunction.createNamespaceTag(resBuf, namespace);
|
||||
resBuf.append("</parent>\n");
|
||||
resBuf.append("<rangelist/>\n"); // Empty address range
|
||||
resBuf.append("<symbollist>\n");
|
||||
Iterator<HighSymbol> iter = symbolMap.values().iterator();
|
||||
while (iter.hasNext()) {
|
||||
HighSymbol sym = iter.next();
|
||||
HighSymbol.buildMapSymXML(res, sym);
|
||||
HighSymbol.buildMapSymXML(resBuf, sym);
|
||||
}
|
||||
res.append("</symbollist>\n");
|
||||
res.append("</scope>\n");
|
||||
res.append("</localdb>\n");
|
||||
return res.toString();
|
||||
resBuf.append("</symbollist>\n");
|
||||
resBuf.append("</scope>\n");
|
||||
resBuf.append("</localdb>\n");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue