forked from Imagelibrary/binutils-gdb
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
This commit is contained in:
18
gdb/infrun.h
18
gdb/infrun.h
@@ -47,6 +47,19 @@ void ATTRIBUTE_PRINTF (2, 3) infrun_debug_printf_1
|
||||
/* True if we are debugging displaced stepping. */
|
||||
extern bool debug_displaced;
|
||||
|
||||
/* Print a "displaced" debug statement. Should be used through
|
||||
displaced_debug_printf. */
|
||||
void ATTRIBUTE_PRINTF (2, 3) displaced_debug_printf_1
|
||||
(const char *func_name, const char *fmt, ...);
|
||||
|
||||
#define displaced_debug_printf(fmt, ...) \
|
||||
do \
|
||||
{ \
|
||||
if (debug_displaced) \
|
||||
displaced_debug_printf_1 (__func__, fmt, ##__VA_ARGS__); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* Nonzero if we want to give control to the user when we're notified
|
||||
of shared library events by the dynamic linker. */
|
||||
extern int stop_on_solib_events;
|
||||
@@ -229,9 +242,8 @@ extern void update_signals_program_target (void);
|
||||
$_exitsignal. */
|
||||
extern void clear_exit_convenience_vars (void);
|
||||
|
||||
/* Dump LEN bytes at BUF in hex to FILE, followed by a newline. */
|
||||
extern void displaced_step_dump_bytes (struct ui_file *file,
|
||||
const gdb_byte *buf, size_t len);
|
||||
/* Dump LEN bytes at BUF in hex to a string and return it. */
|
||||
extern std::string displaced_step_dump_bytes (const gdb_byte *buf, size_t len);
|
||||
|
||||
extern struct displaced_step_closure *get_displaced_step_closure_by_addr
|
||||
(CORE_ADDR addr);
|
||||
|
||||
Reference in New Issue
Block a user