From 20d7468947ad0f070c5bd2a7a4bd74cfa673efdb Mon Sep 17 00:00:00 2001 From: partouf Date: Sat, 22 Jan 2022 15:26:03 +0100 Subject: [PATCH] sometimes filename doesnt start with a slash --- src/objdump/parser.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/objdump/parser.cpp b/src/objdump/parser.cpp index 47b1eac..a1c498a 100644 --- a/src/objdump/parser.cpp +++ b/src/objdump/parser.cpp @@ -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; @@ -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()