diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2020-08-24 15:49:46 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2020-08-24 15:49:47 -0400 |
commit | 1eb8556f5a8b5712e765b9615f7c18ffb50253b6 (patch) | |
tree | d6e4f5f9ad743e848f7bcd4bf1e144fbf3bb72c9 /gdb/infrun.h | |
parent | 0f55320bc46869b87c54d3432fb344f785f07b33 (diff) | |
download | gdb-1eb8556f5a8b5712e765b9615f7c18ffb50253b6.zip gdb-1eb8556f5a8b5712e765b9615f7c18ffb50253b6.tar.gz gdb-1eb8556f5a8b5712e765b9615f7c18ffb50253b6.tar.bz2 |
gdb: add infrun_debug_printf macro
Introduce this macro to print debug statements in the infrun.c file,
same idea as what was done in 9327494e0eeb ("gdb: add
linux_nat_debug_printf macro").
Although in this case, there are places outside infrun.c that print
debug statements if debug_infrun is set. So the macro has to be
declared in the header file, so that it can be used in these other
files.
Note one special case. In stop_all_threads, I've used an explicit
if (debug_infrun)
infrun_debug_printf_1 ("stop_all_threads", "done");
for the message in the SCOPE_EXIT. Otherwise, the message appears like
this:
[infrun] operator(): done
Until we find a better solution for extracting a meaningful function
name for lambda functions, I think it's fine to handle these special
cases manually, they are quite rare.
Some tests need to be updated, because they rely on some infrun debug
statements.
gdb/ChangeLog:
* infrun.h (infrun_debug_printf_1): New function declaration.
(infrun_debug_printf): New macro.
* infrun.c (infrun_debug_printf_1): Use infrun_debug_printf
throughout.
(infrun_debug_printf): New function.
* breakpoint.c (should_be_inserted): Use infrun_debug_printf.
(handle_jit_event): Likewise.
gdb/testsuite/ChangeLog:
* gdb.base/gdb-sigterm.exp (do_test): Update expected regexp.
* gdb.threads/signal-while-stepping-over-bp-other-thread.exp:
Likewise.
* gdb.threads/stepi-random-signal.exp: Likewise.
Change-Id: I66433c8a9caa64c8525ab57c593022b9d1956d5c
Diffstat (limited to 'gdb/infrun.h')
-rw-r--r-- | gdb/infrun.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gdb/infrun.h b/gdb/infrun.h index 49b28f0..daf62a1 100644 --- a/gdb/infrun.h +++ b/gdb/infrun.h @@ -31,6 +31,17 @@ struct thread_info; /* True if we are debugging run control. */ extern unsigned int debug_infrun; +/* Print an "infrun" debug statement. Should be used through + infrun_debug_printf. */ +void ATTRIBUTE_PRINTF (2, 3) infrun_debug_printf_1 + (const char *func_name, const char *fmt, ...); + +#define infrun_debug_printf(fmt, ...) \ + do { \ + if (debug_infrun) \ + infrun_debug_printf_1 (__func__, fmt, ##__VA_ARGS__); \ + } while (0) + /* True if we are debugging displaced stepping. */ extern bool debug_displaced; |