aboutsummaryrefslogtreecommitdiff
path: root/gdb/infcmd.c
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2022-04-21 15:09:17 +0100
committerAndrew Burgess <aburgess@redhat.com>2022-05-03 14:46:14 +0100
commit1f9d9e321ca0416d970a8a4ae94df69de0e22d14 (patch)
tree97f083809e104306876d399ee7c46f40117fb6d3 /gdb/infcmd.c
parentba951afb99912da01a6e8434126b8fac7aa75107 (diff)
downloadgdb-1f9d9e321ca0416d970a8a4ae94df69de0e22d14.zip
gdb-1f9d9e321ca0416d970a8a4ae94df69de0e22d14.tar.gz
gdb-1f9d9e321ca0416d970a8a4ae94df69de0e22d14.tar.bz2
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.
Diffstat (limited to 'gdb/infcmd.c')
-rw-r--r--gdb/infcmd.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 53c9e3d..e909d4d 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -238,6 +238,9 @@ post_create_inferior (int from_tty)
/* Be sure we own the terminal in case write operations are performed. */
target_terminal::ours_for_output ();
+ infrun_debug_show_threads ("threads in the newly created inferior",
+ current_inferior ()->non_exited_threads ());
+
/* If the target hasn't taken care of this already, do it now.
Targets which need to access registers during to_open,
to_create_inferior, or to_attach should do it earlier; but many
@@ -454,6 +457,9 @@ run_command_1 (const char *args, int from_tty, enum run_how run_how)
shouldn't refer to run_target again. */
run_target = NULL;
+ infrun_debug_show_threads ("immediately after create_process",
+ current_inferior ()->non_exited_threads ());
+
/* We're starting off a new process. When we get out of here, in
non-stop mode, finish the state of all threads of that process,
but leave other threads alone, as they may be stopped in internal
@@ -2589,17 +2595,8 @@ attach_command (const char *args, int from_tty)
shouldn't refer to attach_target again. */
attach_target = NULL;
- if (debug_infrun)
- {
- infrun_debug_printf ("immediately after attach:");
- for (thread_info *thread : inferior->non_exited_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));
- }
+ infrun_debug_show_threads ("immediately after attach",
+ current_inferior ()->non_exited_threads ());
/* Enable async mode if it is supported by the target. */
if (target_can_async_p ())