mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 18:29:37 +02:00
Assorted tiny bug fixes
This commit is contained in:
parent
ddb0dd06d9
commit
d3fec7a944
7 changed files with 665 additions and 642 deletions
|
@ -278,8 +278,9 @@ void Range::restoreXml(const Element *el,const AddrSpaceManager *manage)
|
||||||
|
|
||||||
{
|
{
|
||||||
spc = (AddrSpace *)0;
|
spc = (AddrSpace *)0;
|
||||||
|
bool seenLast = false;
|
||||||
first = 0;
|
first = 0;
|
||||||
last = ~((uintb)0);
|
last = 0;
|
||||||
for(int4 i=0;i<el->getNumAttributes();++i) {
|
for(int4 i=0;i<el->getNumAttributes();++i) {
|
||||||
if (el->getAttributeName(i) == "space") {
|
if (el->getAttributeName(i) == "space") {
|
||||||
spc = manage->getSpaceByName(el->getAttributeValue(i));
|
spc = manage->getSpaceByName(el->getAttributeValue(i));
|
||||||
|
@ -295,6 +296,7 @@ void Range::restoreXml(const Element *el,const AddrSpaceManager *manage)
|
||||||
istringstream s(el->getAttributeValue(i));
|
istringstream s(el->getAttributeValue(i));
|
||||||
s.unsetf(ios::dec | ios::hex | ios::oct);
|
s.unsetf(ios::dec | ios::hex | ios::oct);
|
||||||
s >> last;
|
s >> last;
|
||||||
|
seenLast = true;
|
||||||
}
|
}
|
||||||
else if (el->getAttributeName(i) == "name") {
|
else if (el->getAttributeName(i) == "name") {
|
||||||
const Translate *trans = manage->getDefaultCodeSpace()->getTrans();
|
const Translate *trans = manage->getDefaultCodeSpace()->getTrans();
|
||||||
|
@ -302,12 +304,16 @@ void Range::restoreXml(const Element *el,const AddrSpaceManager *manage)
|
||||||
spc = point.space;
|
spc = point.space;
|
||||||
first = point.offset;
|
first = point.offset;
|
||||||
last = (first-1) + point.size;
|
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)
|
if (spc == (AddrSpace *)0)
|
||||||
throw LowlevelError("No address space indicated in range tag");
|
throw LowlevelError("No address space indicated in range tag");
|
||||||
last = spc->wrapOffset(last);
|
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
|
/// Insert a new Range merging as appropriate to maintain the disjoint cover
|
||||||
|
|
|
@ -98,7 +98,7 @@ void IfcLoadFile::execute(istream &s)
|
||||||
if (capa->getName() == "xml") // If file is xml
|
if (capa->getName() == "xml") // If file is xml
|
||||||
dcp->conf->readLoaderSymbols("::"); // Read in loader symbols
|
dcp->conf->readLoaderSymbols("::"); // Read in loader symbols
|
||||||
#ifdef OPACTION_DEBUG
|
#ifdef OPACTION_DEBUG
|
||||||
dcp->conf->setDebugStream(status->optr);
|
dcp->conf->setDebugStream(status->fileoptr);
|
||||||
#endif
|
#endif
|
||||||
*status->optr << filename << " successfully loaded: " << dcp->conf->getDescription() << endl;
|
*status->optr << filename << " successfully loaded: " << dcp->conf->getDescription() << endl;
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ void IfcRestore::execute(istream &s)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef OPACTION_DEBUG
|
#ifdef OPACTION_DEBUG
|
||||||
dcp->conf->setDebugStream(status->optr);
|
dcp->conf->setDebugStream(status->fileoptr);
|
||||||
#endif
|
#endif
|
||||||
*status->optr << savefile << " successfully loaded: " << dcp->conf->getDescription() << endl;
|
*status->optr << savefile << " successfully loaded: " << dcp->conf->getDescription() << endl;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -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>[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>0x[0-9a-fA-F]+ { return scan_number(yytext,&yylval,false); }
|
||||||
<defblock>0b[01]+ { 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>[\r\ \t\v]+
|
||||||
<defblock>\n { slgh->nextLine(); }
|
<defblock>\n { slgh->nextLine(); }
|
||||||
<defblock>. { return yytext[0]; }
|
<defblock>. { return yytext[0]; }
|
||||||
|
@ -557,7 +557,7 @@ with { BEGIN(pattern); withsection = 1; slgh->calcContextLayout(); return WITH
|
||||||
<print>\^ { yylval.ch = '^'; return '^'; }
|
<print>\^ { yylval.ch = '^'; return '^'; }
|
||||||
<print>is { BEGIN(pattern); actionon=0; return IS_KEY; }
|
<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>[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>[\r\ \t\v]+ { yylval.ch = ' '; return ' '; }
|
||||||
<print>\n { slgh->nextLine(); return ' '; }
|
<print>\n { slgh->nextLine(); return ' '; }
|
||||||
<print>. { return yytext[0]; }
|
<print>. { return yytext[0]; }
|
||||||
|
|
|
@ -1058,13 +1058,13 @@ public class DecompileCallback {
|
||||||
Address last = range.getMaxAddress();
|
Address last = range.getMaxAddress();
|
||||||
boolean readonly = true; // Treat function body as readonly
|
boolean readonly = true; // Treat function body as readonly
|
||||||
return buildHoleXML(first.getAddressSpace().getPhysicalSpace().getName(),
|
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
|
// There is probably some sort of error, just return a block
|
||||||
// containing the single queried address
|
// containing the single queried address
|
||||||
return buildHoleXML(addr.getAddressSpace().getPhysicalSpace().getName(), addr.getOffset(),
|
return buildHoleXML(addr.getAddressSpace().getPhysicalSpace().getName(),
|
||||||
addr.getOffset(), true, false);
|
addr.getUnsignedOffset(), addr.getUnsignedOffset(), true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getExtraPopOverride(Function func, Address addr) {
|
private int getExtraPopOverride(Function func, Address addr) {
|
||||||
|
@ -1175,8 +1175,8 @@ public class DecompileCallback {
|
||||||
// after.getOffset(),readonly,isVolatile);
|
// after.getOffset(),readonly,isVolatile);
|
||||||
boolean readonly = isReadOnlyNoData(addr);
|
boolean readonly = isReadOnlyNoData(addr);
|
||||||
boolean isvolatile = isVolatileNoData(addr);
|
boolean isvolatile = isVolatileNoData(addr);
|
||||||
return buildHoleXML(addr.getAddressSpace().getPhysicalSpace().getName(), addr.getOffset(),
|
return buildHoleXML(addr.getAddressSpace().getPhysicalSpace().getName(),
|
||||||
addr.getOffset(), readonly, isvolatile);
|
addr.getUnsignedOffset(), addr.getUnsignedOffset(), readonly, isvolatile);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String buildExternalRef(Address addr, ExternalReference ref) {
|
private String buildExternalRef(Address addr, ExternalReference ref) {
|
||||||
|
|
|
@ -516,7 +516,8 @@ public class CppExporter extends Exporter {
|
||||||
Address entryPoint = function.getEntryPoint();
|
Address entryPoint = function.getEntryPoint();
|
||||||
CodeUnit codeUnitAt = function.getProgram().getListing().getCodeUnitAt(entryPoint);
|
CodeUnit codeUnitAt = function.getProgram().getListing().getCodeUnitAt(entryPoint);
|
||||||
if (codeUnitAt == null || !(codeUnitAt instanceof Instruction)) {
|
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());
|
monitor.setMessage("Decompiling " + function.getName());
|
||||||
|
|
|
@ -808,7 +808,7 @@ public class BasicCompilerSpec implements CompilerSpec {
|
||||||
seenLast = true;
|
seenLast = true;
|
||||||
}
|
}
|
||||||
if (!seenLast) {
|
if (!seenLast) {
|
||||||
last = addressSpace.getMaxAddress().getOffset();
|
last = addressSpace.getMaxAddress().getUnsignedOffset();
|
||||||
}
|
}
|
||||||
if (extraRanges == null) {
|
if (extraRanges == null) {
|
||||||
extraRanges = new ArrayList<>();
|
extraRanges = new ArrayList<>();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue