gdb: add some additional thread status debug output
While working on this patch: https://sourceware.org/pipermail/gdb-patches/2022-January/185109.html I found it really useful to print the executing/resumed status of all threads (or all threads in a particular inferior) at various places (e.g. when a new inferior is started, when GDB attaches, etc). This debug was originally part of the above patch, but I wanted to rewrite this as a separate patch and move the code into a new function in infrun.h, which is what this patch does. Unless 'set debug infrun on' is in effect, then there should be no user visible changes after this commit.
This commit is contained in:
parent
ba951afb99
commit
1f9d9e321c
3 changed files with 37 additions and 11 deletions
26
gdb/infrun.h
26
gdb/infrun.h
|
@ -48,6 +48,32 @@ extern bool debug_infrun;
|
|||
#define INFRUN_SCOPED_DEBUG_ENTER_EXIT \
|
||||
scoped_debug_enter_exit (debug_infrun, "infrun")
|
||||
|
||||
/* A infrun debug helper routine to print out all the threads in the set
|
||||
THREADS (which should be a range type that returns thread_info*
|
||||
objects).
|
||||
|
||||
The TITLE is a string that is printed before the list of threads.
|
||||
|
||||
Output is only produced when 'set debug infrun on'. */
|
||||
|
||||
template<typename ThreadRange>
|
||||
static inline void
|
||||
infrun_debug_show_threads (const char *title, ThreadRange threads)
|
||||
{
|
||||
if (debug_infrun)
|
||||
{
|
||||
infrun_debug_printf ("%s:", title);
|
||||
for (thread_info *thread : threads)
|
||||
infrun_debug_printf (" thread %s, executing = %d, resumed = %d, "
|
||||
"state = %s",
|
||||
thread->ptid.to_string ().c_str (),
|
||||
thread->executing (),
|
||||
thread->resumed (),
|
||||
thread_state_string (thread->state));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* 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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue