[arm] Alter disasm-arm to print a fixed size address

Change-Id: I7079a0460fcb8f9b818c97125ab11f6168c3a28d
Reviewed-on: https://chromium-review.googlesource.com/c/1323731
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57351}
This commit is contained in:
George Wort 2018-11-08 10:30:30 +00:00 committed by Commit Bot
parent 7412593920
commit 043acfaf12
2 changed files with 8 additions and 6 deletions

View File

@ -685,8 +685,9 @@ int Decoder::FormatOption(Instruction* instr, const char* format) {
return -1;
}
}
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "%p",
static_cast<void*>(addr));
out_buffer_pos_ +=
SNPrintF(out_buffer_ + out_buffer_pos_, "0x%08" PRIxPTR,
reinterpret_cast<uintptr_t>(addr));
return 1;
}
case 'S':

View File

@ -1511,12 +1511,13 @@ static void TestLoadLiteral(byte* buffer, Assembler* assm, bool* failure,
const char *expected_string_template =
(offset >= 0) ?
"e59f0%03x ldr r0, [pc, #+%d] (addr %p)" :
"e51f0%03x ldr r0, [pc, #%d] (addr %p)";
"e59f0%03x ldr r0, [pc, #+%d] (addr 0x%08" PRIxPTR ")" :
"e51f0%03x ldr r0, [pc, #%d] (addr 0x%08" PRIxPTR ")";
char expected_string[80];
snprintf(expected_string, sizeof(expected_string), expected_string_template,
abs(offset), offset,
progcounter + Instruction::kPcLoadDelta + offset);
abs(offset), offset,
reinterpret_cast<uintptr_t>(
progcounter + Instruction::kPcLoadDelta + offset));
if (!DisassembleAndCompare(progcounter, kRawString, expected_string)) {
*failure = true;
}