aboutsummaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2008-01-18 18:57:27 +0000
committerEd Maste <emaste@FreeBSD.org>2008-01-18 18:57:27 +0000
commitb2f965152c37a46e465402789c79fd0c1f670ff0 (patch)
treebb3e5e54a510f7b7aff5909afaacf6b048eed806 /gnu
parent81aa963bc78a1b8275f73ab9ff7edefa50108109 (diff)
downloadsrc-b2f965152c37a46e465402789c79fd0c1f670ff0.tar.gz
src-b2f965152c37a46e465402789c79fd0c1f670ff0.zip
Include the thread name (in addition to the proc name) in "info threads."
Notes
Notes: svn path=/head/; revision=175452
Diffstat (limited to 'gnu')
-rw-r--r--gnu/usr.bin/gdb/kgdb/kthr.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/gnu/usr.bin/gdb/kgdb/kthr.c b/gnu/usr.bin/gdb/kgdb/kthr.c
index 4c7f55656d1a..c11451573806 100644
--- a/gnu/usr.bin/gdb/kgdb/kthr.c
+++ b/gnu/usr.bin/gdb/kgdb/kthr.c
@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
#include <kvm.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <defs.h>
#include <frame-unwind.h>
@@ -204,17 +205,26 @@ kgdb_thr_select(struct kthr *kt)
char *
kgdb_thr_extra_thread_info(int tid)
{
+ char comm[MAXCOMLEN + 1];
+ char td_name[MAXCOMLEN + 1];
struct kthr *kt;
struct proc *p;
- static char comm[MAXCOMLEN + 1];
+ struct thread *t;
+ static char info[MAXCOMLEN + 1 + MAXCOMLEN + 1];
kt = kgdb_thr_lookup_tid(tid);
if (kt == NULL)
return (NULL);
p = (struct proc *)kt->paddr;
+ t = (struct thread *)kt->kaddr;
if (kvm_read(kvm, (uintptr_t)&p->p_comm[0], &comm, sizeof(comm)) !=
sizeof(comm))
return (NULL);
-
- return (comm);
+ if (kvm_read(kvm, (uintptr_t)&t->td_name[0], &td_name,
+ sizeof(td_name)) == sizeof(td_name) &&
+ strcmp(comm, td_name) != 0)
+ snprintf(info, sizeof(info), "%s/%s", comm, td_name);
+ else
+ strlcpy(info, comm, sizeof(info));
+ return (info);
}