Skip to content

Commit

Permalink
sometimes filename doesnt start with a slash
Browse files Browse the repository at this point in the history
  • Loading branch information
partouf committed Jan 22, 2022
1 parent 4fa51ab commit 20d7468
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/objdump/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,18 @@ void AsmParser::ObjDumpParser::opcodes()

void AsmParser::ObjDumpParser::actually_address()
{
bool maybeNotHexAfterall = false;

if (!this->state.ignoreUntilNextLabel)
{
int64_t addr = 0;
int8_t bitsdone = 0;
for (auto c = this->state.text.rbegin(); c != this->state.text.rend(); c++)
{
if (!is_hex(*c))
if (!is_hex(*c)) {
maybeNotHexAfterall = true;
break;
}

addr += hex2int(*c) << bitsdone;
bitsdone += 4;
Expand All @@ -167,8 +171,13 @@ void AsmParser::ObjDumpParser::actually_address()
this->state.currentLine.address = addr;
}

this->state.inAddress = false;
this->state.inOpcodes = true;
if (maybeNotHexAfterall) {
// then it must be a filename, right?
actually_filename();
} else {
this->state.inAddress = false;
this->state.inOpcodes = true;
}
}

void AsmParser::ObjDumpParser::actually_filename()
Expand Down

0 comments on commit 20d7468

Please sign in to comment.