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/arm-linux-tdep.c | |
parent | aa2045e7fa41ea80a876421bca89443f7a2df92f (diff) | |
download | gdb-136821d9f6fdb7f457500d154166a1b4b41a0d1b.zip gdb-136821d9f6fdb7f457500d154166a1b4b41a0d1b.tar.gz gdb-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/arm-linux-tdep.c')
-rw-r--r-- | gdb/arm-linux-tdep.c | 44 |
1 files changed, 17 insertions, 27 deletions
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c index f60cb51..0435263 100644 --- a/gdb/arm-linux-tdep.c +++ b/gdb/arm-linux-tdep.c @@ -957,15 +957,11 @@ arm_linux_cleanup_svc (struct gdbarch *gdbarch, && apparent_pc < (dsc->scratch_base + ARM_DISPLACED_MODIFIED_INSNS * 4 + 4)); - if (debug_displaced) - { - fprintf_unfiltered (gdb_stdlog, "displaced: PC is apparently %.8lx after " - "SVC step ", (unsigned long) apparent_pc); - if (within_scratch) - fprintf_unfiltered (gdb_stdlog, "(within scratch space)\n"); - else - fprintf_unfiltered (gdb_stdlog, "(outside scratch space)\n"); - } + displaced_debug_printf ("PC is apparently %.8lx after SVC step %s", + (unsigned long) apparent_pc, + (within_scratch + ? "(within scratch space)" + : "(outside scratch space)")); if (within_scratch) displaced_write_reg (regs, dsc, ARM_PC_REGNUM, @@ -991,16 +987,12 @@ arm_linux_copy_svc (struct gdbarch *gdbarch, struct regcache *regs, { struct symtab_and_line sal; - if (debug_displaced) - fprintf_unfiltered (gdb_stdlog, "displaced: found " - "sigreturn/rt_sigreturn SVC call. PC in " - "frame = %lx\n", - (unsigned long) get_frame_pc (frame)); + displaced_debug_printf ("found sigreturn/rt_sigreturn SVC call. " + "PC in frame = %lx", + (unsigned long) get_frame_pc (frame)); - if (debug_displaced) - fprintf_unfiltered (gdb_stdlog, "displaced: unwind pc = %lx. " - "Setting momentary breakpoint.\n", - (unsigned long) return_to); + displaced_debug_printf ("unwind pc = %lx. Setting momentary breakpoint.", + (unsigned long) return_to); gdb_assert (inferior_thread ()->control.step_resume_breakpoint == NULL); @@ -1025,13 +1017,12 @@ arm_linux_copy_svc (struct gdbarch *gdbarch, struct regcache *regs, breakpoint set above. */ insert_breakpoints (); } - else if (debug_displaced) - fprintf_unfiltered (gdb_stderr, "displaced: couldn't find previous " - "frame to set momentary breakpoint for " - "sigreturn/rt_sigreturn\n"); + else + displaced_debug_printf ("couldn't find previous frame to set momentary " + "breakpoint for sigreturn/rt_sigreturn"); } - else if (debug_displaced) - fprintf_unfiltered (gdb_stdlog, "displaced: found SVC call\n"); + else + displaced_debug_printf ("found SVC call"); /* Preparation: If we detect sigreturn, set momentary breakpoint at resume location, else nothing. @@ -1115,9 +1106,8 @@ arm_linux_displaced_step_copy_insn (struct gdbarch *gdbarch, stop at the return location. */ if (from > 0xffff0000) { - if (debug_displaced) - fprintf_unfiltered (gdb_stdlog, "displaced: detected kernel helper " - "at %.8lx\n", (unsigned long) from); + displaced_debug_printf ("detected kernel helper at %.8lx", + (unsigned long) from); arm_catch_kernel_helper_return (gdbarch, from, to, regs, dsc.get ()); } |