Assorted tiny bug fixes

This commit is contained in:
caheckman 2021-07-19 14:41:48 -04:00
parent ddb0dd06d9
commit d3fec7a944
7 changed files with 665 additions and 642 deletions

View File

@ -278,8 +278,9 @@ void Range::restoreXml(const Element *el,const AddrSpaceManager *manage)
{
spc = (AddrSpace *)0;
bool seenLast = false;
first = 0;
last = ~((uintb)0);
last = 0;
for(int4 i=0;i<el->getNumAttributes();++i) {
if (el->getAttributeName(i) == "space") {
spc = manage->getSpaceByName(el->getAttributeValue(i));
@ -295,6 +296,7 @@ void Range::restoreXml(const Element *el,const AddrSpaceManager *manage)
istringstream s(el->getAttributeValue(i));
s.unsetf(ios::dec | ios::hex | ios::oct);
s >> last;
seenLast = true;
}
else if (el->getAttributeName(i) == "name") {
const Translate *trans = manage->getDefaultCodeSpace()->getTrans();
@ -302,12 +304,16 @@ void Range::restoreXml(const Element *el,const AddrSpaceManager *manage)
spc = point.space;
first = point.offset;
last = (first-1) + point.size;
break; // There should be no (space,first,last) attributes
return; // There should be no (space,first,last) attributes
}
}
if (spc == (AddrSpace *)0)
throw LowlevelError("No address space indicated in range tag");
last = spc->wrapOffset(last);
throw LowlevelError("No address space indicated in range tag");
if (!seenLast) {
last = spc->getHighest();
}
if (first > spc->getHighest() || last > spc->getHighest() || last < first)
throw LowlevelError("Illegal range tag");
}
/// Insert a new Range merging as appropriate to maintain the disjoint cover

View File

@ -98,7 +98,7 @@ void IfcLoadFile::execute(istream &s)
if (capa->getName() == "xml") // If file is xml
dcp->conf->readLoaderSymbols("::"); // Read in loader symbols
#ifdef OPACTION_DEBUG
dcp->conf->setDebugStream(status->optr);
dcp->conf->setDebugStream(status->fileoptr);
#endif
*status->optr << filename << " successfully loaded: " << dcp->conf->getDescription() << endl;
}
@ -160,7 +160,7 @@ void IfcRestore::execute(istream &s)
}
#ifdef OPACTION_DEBUG
dcp->conf->setDebugStream(status->optr);
dcp->conf->setDebugStream(status->fileoptr);
#endif
*status->optr << savefile << " successfully loaded: " << dcp->conf->getDescription() << endl;
}

File diff suppressed because it is too large Load Diff

View File

@ -545,7 +545,7 @@ with { BEGIN(pattern); withsection = 1; slgh->calcContextLayout(); return WITH
<defblock>[0-9]|[1-9][0-9]+ { return scan_number(yytext,&yylval,false); }
<defblock>0x[0-9a-fA-F]+ { return scan_number(yytext,&yylval,false); }
<defblock>0b[01]+ { return scan_number(yytext,&yylval,false); }
<defblock>\"([^\"]|\"\")*\" { yylval.str = new string(yytext+1,strlen(yytext)-2); return STRING; }
<defblock>\"([^\"[:cntrl:]]|\"\")*\" { yylval.str = new string(yytext+1,strlen(yytext)-2); return STRING; }
<defblock>[\r\ \t\v]+
<defblock>\n { slgh->nextLine(); }
<defblock>. { return yytext[0]; }
@ -557,7 +557,7 @@ with { BEGIN(pattern); withsection = 1; slgh->calcContextLayout(); return WITH
<print>\^ { yylval.ch = '^'; return '^'; }
<print>is { BEGIN(pattern); actionon=0; return IS_KEY; }
<print>[a-zA-Z_.][a-zA-Z0-9_.]* { yylval.str = new string(yytext); return SYMBOLSTRING; }
<print>\"([^\"]|\"\")*\" { yylval.str = new string(yytext+1,strlen(yytext)-2); return STRING; }
<print>\"([^\"[:cntrl:]]|\"\")*\" { yylval.str = new string(yytext+1,strlen(yytext)-2); return STRING; }
<print>[\r\ \t\v]+ { yylval.ch = ' '; return ' '; }
<print>\n { slgh->nextLine(); return ' '; }
<print>. { return yytext[0]; }

View File

@ -1058,13 +1058,13 @@ public class DecompileCallback {
Address last = range.getMaxAddress();
boolean readonly = true; // Treat function body as readonly
return buildHoleXML(first.getAddressSpace().getPhysicalSpace().getName(),
first.getOffset(), last.getOffset(), readonly, false);
first.getUnsignedOffset(), last.getUnsignedOffset(), readonly, false);
}
}
// There is probably some sort of error, just return a block
// containing the single queried address
return buildHoleXML(addr.getAddressSpace().getPhysicalSpace().getName(), addr.getOffset(),
addr.getOffset(), true, false);
return buildHoleXML(addr.getAddressSpace().getPhysicalSpace().getName(),
addr.getUnsignedOffset(), addr.getUnsignedOffset(), true, false);
}
private int getExtraPopOverride(Function func, Address addr) {
@ -1175,8 +1175,8 @@ public class DecompileCallback {
// after.getOffset(),readonly,isVolatile);
boolean readonly = isReadOnlyNoData(addr);
boolean isvolatile = isVolatileNoData(addr);
return buildHoleXML(addr.getAddressSpace().getPhysicalSpace().getName(), addr.getOffset(),
addr.getOffset(), readonly, isvolatile);
return buildHoleXML(addr.getAddressSpace().getPhysicalSpace().getName(),
addr.getUnsignedOffset(), addr.getUnsignedOffset(), readonly, isvolatile);
}
private String buildExternalRef(Address addr, ExternalReference ref) {

View File

@ -516,7 +516,8 @@ public class CppExporter extends Exporter {
Address entryPoint = function.getEntryPoint();
CodeUnit codeUnitAt = function.getProgram().getListing().getCodeUnitAt(entryPoint);
if (codeUnitAt == null || !(codeUnitAt instanceof Instruction)) {
return new CPPResult(entryPoint, function.getPrototypeString(false, false), null);
return new CPPResult(entryPoint, function.getPrototypeString(false, false) + ';',
null);
}
monitor.setMessage("Decompiling " + function.getName());

View File

@ -808,7 +808,7 @@ public class BasicCompilerSpec implements CompilerSpec {
seenLast = true;
}
if (!seenLast) {
last = addressSpace.getMaxAddress().getOffset();
last = addressSpace.getMaxAddress().getUnsignedOffset();
}
if (extraRanges == null) {
extraRanges = new ArrayList<>();