diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2020-10-30 15:10:08 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2020-10-30 15:10:58 -0400 |
commit | 136821d9f6fdb7f457500d154166a1b4b41a0d1b (patch) | |
tree | 8204382983b0abf241cd990e5731ae9ac3225e83 /gdb/aarch64-tdep.c | |
parent | aa2045e7fa41ea80a876421bca89443f7a2df92f (diff) | |
download | binutils-136821d9f6fdb7f457500d154166a1b4b41a0d1b.zip binutils-136821d9f6fdb7f457500d154166a1b4b41a0d1b.tar.gz binutils-136821d9f6fdb7f457500d154166a1b4b41a0d1b.tar.bz2 |
gdb: introduce displaced_debug_printf
Move all debug prints of the "displaced" category to use a new
displaced_debug_printf macro, like what was done for infrun and others
earlier.
The debug output for one displaced step one amd64 looks like:
[displaced] displaced_step_prepare_throw: stepping process 3367044 now
[displaced] displaced_step_prepare_throw: saved 0x555555555042: 1e fa 31 ed 49 89 d1 5e 48 89 e2 48 83 e4 f0 50
[displaced] amd64_displaced_step_copy_insn: copy 0x555555555131->0x555555555042: b8 00 00 00 00 5d c3 0f 1f 84 00 00 00 00 00 f3
[displaced] displaced_step_prepare_throw: displaced pc to 0x555555555042
[displaced] resume_1: run 0x555555555042: b8 00 00 00
[displaced] displaced_step_restore: restored process 3367044 0x555555555042
[displaced] amd64_displaced_step_fixup: fixup (0x555555555131, 0x555555555042), insn = 0xb8 0x00 ...
[displaced] amd64_displaced_step_fixup: relocated %rip from 0x555555555047 to 0x555555555136
On test case needed to be updated because it relied on the specific
formatting of the message.
gdb/ChangeLog:
* infrun.h (displaced_debug_printf): New macro. Replace
displaced debug prints throughout to use it.
(displaced_debug_printf_1): New declaration.
(displaced_step_dump_bytes): Return string, remove ui_file
parameter, update all callers.
* infrun.c (displaced_debug_printf_1): New function.
(displaced_step_dump_bytes): Return string, remove ui_file
parameter
gdb/testsuite/ChangeLog:
* gdb.arch/amd64-disp-step-avx.exp: Update displaced step debug
expected output.
Change-Id: Ie78837f56431f6f98378790ba1e6051337bf6533
Diffstat (limited to 'gdb/aarch64-tdep.c')
-rw-r--r-- | gdb/aarch64-tdep.c | 45 |
1 files changed, 17 insertions, 28 deletions
diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index 639fe59..4c1d545 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -3177,12 +3177,10 @@ aarch64_displaced_step_copy_insn (struct gdbarch *gdbarch, relocated instruction(s) there. */ for (i = 0; i < dsd.insn_count; i++) { - if (debug_displaced) - { - debug_printf ("displaced: writing insn "); - debug_printf ("%.8x", dsd.insn_buf[i]); - debug_printf (" at %s\n", paddress (gdbarch, to + i * 4)); - } + displaced_debug_printf ("writing insn %.8x at %s", + dsd.insn_buf[i], + paddress (gdbarch, to + i * 4)); + write_memory_unsigned_integer (to + i * 4, 4, byte_order_for_code, (ULONGEST) dsd.insn_buf[i]); } @@ -3210,15 +3208,13 @@ aarch64_displaced_step_fixup (struct gdbarch *gdbarch, regcache_cooked_read_unsigned (regs, AARCH64_PC_REGNUM, &pc); - if (debug_displaced) - debug_printf ("Displaced: PC after stepping: %s (was %s).\n", - paddress (gdbarch, pc), paddress (gdbarch, to)); + displaced_debug_printf ("PC after stepping: %s (was %s).", + paddress (gdbarch, pc), paddress (gdbarch, to)); if (dsc->cond) { - if (debug_displaced) - debug_printf ("Displaced: [Conditional] pc_adjust before: %d\n", - dsc->pc_adjust); + displaced_debug_printf ("[Conditional] pc_adjust before: %d", + dsc->pc_adjust); if (pc - to == 8) { @@ -3232,16 +3228,13 @@ aarch64_displaced_step_fixup (struct gdbarch *gdbarch, else gdb_assert_not_reached ("Unexpected PC value after displaced stepping"); - if (debug_displaced) - debug_printf ("Displaced: [Conditional] pc_adjust after: %d\n", - dsc->pc_adjust); + displaced_debug_printf ("[Conditional] pc_adjust after: %d", + dsc->pc_adjust); } - if (debug_displaced) - debug_printf ("Displaced: %s PC by %d\n", - dsc->pc_adjust? "adjusting" : "not adjusting", - dsc->pc_adjust); - + displaced_debug_printf ("%s PC by %d", + dsc->pc_adjust ? "adjusting" : "not adjusting", + dsc->pc_adjust); if (dsc->pc_adjust != 0) { @@ -3251,17 +3244,13 @@ aarch64_displaced_step_fixup (struct gdbarch *gdbarch, took place. */ if ((pc - to) == 0) { - if (debug_displaced) - debug_printf ("Displaced: PC did not move. Discarding PC " - "adjustment.\n"); + displaced_debug_printf ("PC did not move. Discarding PC adjustment."); dsc->pc_adjust = 0; } - if (debug_displaced) - { - debug_printf ("Displaced: fixup: set PC to %s:%d\n", - paddress (gdbarch, from), dsc->pc_adjust); - } + displaced_debug_printf ("fixup: set PC to %s:%d", + paddress (gdbarch, from), dsc->pc_adjust); + regcache_cooked_write_unsigned (regs, AARCH64_PC_REGNUM, from + dsc->pc_adjust); } |