Escape overlay address space names

This commit is contained in:
caheckman 2021-07-06 16:51:23 -04:00
parent 79b9e9a6ec
commit 8be023ada9
4 changed files with 11 additions and 8 deletions

View File

@ -415,8 +415,9 @@ void PcodeOp::saveXml(ostream &s) const
else if (vn->getSpace()->getType()==IPTR_CONSTANT) {
if ((i==0)&&((code()==CPUI_STORE)||(code()==CPUI_LOAD))) {
AddrSpace *spc = Address::getSpaceFromConst(vn->getAddr());
s << "<spaceid name=\"";
s << spc->getName() << "\"/>\n";
s << "<spaceid";
a_v(s,"name",spc->getName());
s << "/>\n";
}
else
s << "<addr ref=\"0x" << hex << vn->getCreateIndex() << "\"/>\n";

View File

@ -259,8 +259,9 @@ void EmitXml::tagField(const char *ptr,syntax_highlight hl,const Datatype *ct,in
void EmitXml::tagComment(const char *ptr,syntax_highlight hl,
const AddrSpace *spc,uintb off) {
*s << "<comment " << highlight[(int4)hl];
*s << " space=\"" << spc->getName();
*s << "\" off=\"0x" << hex << off << "\">";
a_v(*s,"space",spc->getName());
a_v_u(*s,"off",off);
*s << '>';
xml_escape(*s,ptr);
*s << "</comment>";
}
@ -276,8 +277,9 @@ void EmitXml::tagComment(const char *ptr,syntax_highlight hl,
void EmitXml::tagLabel(const char *ptr,syntax_highlight hl,
const AddrSpace *spc,uintb off) {
*s << "<label " << highlight[(int4)hl];
*s << " space=\"" << spc->getName();
*s << "\" off=\"0x" << hex << off << "\">";
a_v(*s,"space",spc->getName());
a_v_u(*s,"off",off);
*s << '>';
xml_escape(*s,ptr);
*s << "</label>";
}

View File

@ -62,5 +62,5 @@ ffffffbfdff7ffffe811ffffffbf6100
<stringmatch name="Convert #14" min="1" max="1">recv_signed\(-0b1100110011001100\)</stringmatch>
<stringmatch name="Convert #15" min="1" max="1">recv_unsigned\(0b1110111011101110\)</stringmatch>
<stringmatch name="Convert #16" min="1" max="1">recv_unsigned\(0b11111111111111111111011111011111\)</stringmatch>
<stringmatch name="Convert #17" min="1" max="1">recv_signed\('a'\)</stringmatch>
<stringmatch name="Convert #17" min="1" max="1">recv_signed\(L'a'\)</stringmatch>
</decompilertest>

View File

@ -1433,7 +1433,7 @@ public class SleighLanguage implements Language {
if ((element instanceof OverlayAddressSpace)) {
OverlayAddressSpace ospace = (OverlayAddressSpace) element;
resBuf.append("<space_overlay");
SpecXmlUtils.encodeStringAttribute(resBuf, "name", ospace.getName());
SpecXmlUtils.xmlEscapeAttribute(resBuf, "name", ospace.getName());
SpecXmlUtils.encodeSignedIntegerAttribute(resBuf, "index", ospace.getUnique());
SpecXmlUtils.encodeStringAttribute(resBuf, "base",
ospace.getOverlayedSpace().getName());