Use correct namespace in LocalSymbolMap

This commit is contained in:
caheckman 2020-06-19 16:41:04 -04:00
parent 0d9e25548a
commit 84e4b8c6fe
5 changed files with 27 additions and 24 deletions

View file

@ -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");

View file

@ -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);
}
}

View file

@ -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");
}
/**