Include the thread name (in addition to the proc name) in "info threads."
This commit is contained in:
parent
3628ae460c
commit
3ccc28b1ea
@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <kvm.h>
|
#include <kvm.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include <defs.h>
|
#include <defs.h>
|
||||||
#include <frame-unwind.h>
|
#include <frame-unwind.h>
|
||||||
@ -204,17 +205,26 @@ kgdb_thr_select(struct kthr *kt)
|
|||||||
char *
|
char *
|
||||||
kgdb_thr_extra_thread_info(int tid)
|
kgdb_thr_extra_thread_info(int tid)
|
||||||
{
|
{
|
||||||
|
char comm[MAXCOMLEN + 1];
|
||||||
|
char td_name[MAXCOMLEN + 1];
|
||||||
struct kthr *kt;
|
struct kthr *kt;
|
||||||
struct proc *p;
|
struct proc *p;
|
||||||
static char comm[MAXCOMLEN + 1];
|
struct thread *t;
|
||||||
|
static char info[MAXCOMLEN + 1 + MAXCOMLEN + 1];
|
||||||
|
|
||||||
kt = kgdb_thr_lookup_tid(tid);
|
kt = kgdb_thr_lookup_tid(tid);
|
||||||
if (kt == NULL)
|
if (kt == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
p = (struct proc *)kt->paddr;
|
p = (struct proc *)kt->paddr;
|
||||||
|
t = (struct thread *)kt->kaddr;
|
||||||
if (kvm_read(kvm, (uintptr_t)&p->p_comm[0], &comm, sizeof(comm)) !=
|
if (kvm_read(kvm, (uintptr_t)&p->p_comm[0], &comm, sizeof(comm)) !=
|
||||||
sizeof(comm))
|
sizeof(comm))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
if (kvm_read(kvm, (uintptr_t)&t->td_name[0], &td_name,
|
||||||
return (comm);
|
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);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user