Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/gnu/dist/toolchain/gdb Print thread name, if any.



details:   https://anonhg.NetBSD.org/src/rev/d8086d5aa493
branches:  trunk
changeset: 543534:d8086d5aa493
user:      nathanw <nathanw%NetBSD.org@localhost>
date:      Thu Feb 27 00:55:43 2003 +0000

description:
Print thread name, if any.

diffstat:

 gnu/dist/toolchain/gdb/nbsd-thread.c |  16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diffs (41 lines):

diff -r 1c1271b1ae71 -r d8086d5aa493 gnu/dist/toolchain/gdb/nbsd-thread.c
--- a/gnu/dist/toolchain/gdb/nbsd-thread.c      Thu Feb 27 00:54:07 2003 +0000
+++ b/gnu/dist/toolchain/gdb/nbsd-thread.c      Thu Feb 27 00:55:43 2003 +0000
@@ -494,9 +494,18 @@
      int pid;
 {
   static char buf[100];
+  td_thread_t *th;
+  int retval;
+  char name[32];
 
   if (IS_THREAD (pid))
-    sprintf (buf, "Thread %d", GET_THREAD (pid));
+    {
+      if ((td_map_id2thr (main_ta, GET_THREAD(pid), &th) == 0) &&
+         (td_thr_getname (th, name, 32) == 0))
+       sprintf (buf, "Thread %d (%s)", GET_THREAD (pid), name);
+      else
+       sprintf (buf, "Thread %d", GET_THREAD (pid));
+    }
   else
     sprintf (buf, "LWP %d", GET_LWP (pid));
 
@@ -761,12 +770,17 @@
   td_thread_info_t ti, ti2;
   td_sync_t *ts;
   td_sync_info_t tsi;
+  char name[32];
 
   if ((ret = td_thr_info (th, &ti)) == 0)
     {
       if (ti.thread_type != TD_TYPE_USER)
        return 0;
+      td_thr_getname(th, name, 32);
       printf_filtered ("%p: thread %4d ", ti.thread_addr, ti.thread_id);
+      if (name[0] != '\0')
+             printf_filtered("(%s) ", name);
+
       switch (ti.thread_state)
        {
        default:



Home | Main Index | Thread Index | Old Index