aboutsummaryrefslogtreecommitdiff
path: root/gdb/thread.c
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2022-01-11 17:31:16 +0000
committerAndrew Burgess <aburgess@redhat.com>2022-01-13 10:13:16 +0000
commit993248f4439271d7d5d3b504b851043af7495c25 (patch)
treea9876640edb51cd02e4ff247bf7777cbfa3dd5a5 /gdb/thread.c
parent1ffce3f87dc6e62d49b5aaa0bc29c6d4cfbc6db6 (diff)
downloadfsf-binutils-gdb-993248f4439271d7d5d3b504b851043af7495c25.zip
fsf-binutils-gdb-993248f4439271d7d5d3b504b851043af7495c25.tar.gz
fsf-binutils-gdb-993248f4439271d7d5d3b504b851043af7495c25.tar.bz2
gdb: add some extra debug information to attach_command
While working on another patch I wanted to add some extra debug information to the attach_command function. This required me to add a new function to convert the thread_info::state variable to a string. The new debug might be useful to others, and the state to string function might be useful in other locations, so I thought I'd merge it.
Diffstat (limited to 'gdb/thread.c')
-rw-r--r--gdb/thread.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/gdb/thread.c b/gdb/thread.c
index 8a7d142..c43f661 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -2050,6 +2050,26 @@ thread_name (thread_info *thread)
return target_thread_name (thread);
}
+/* See gdbthread.h. */
+
+const char *
+thread_state_string (enum thread_state state)
+{
+ switch (state)
+ {
+ case THREAD_STOPPED:
+ return "STOPPED";
+
+ case THREAD_RUNNING:
+ return "RUNNING";
+
+ case THREAD_EXITED:
+ return "EXITED";
+ }
+
+ gdb_assert_not_reached ("unknown thread state");
+}
+
/* Return a new value for the selected thread's id. Return a value of
0 if no thread is selected. If GLOBAL is true, return the thread's
global number. Otherwise return the per-inferior number. */