summaryrefslogtreecommitdiffstats
path: root/sys/kern/imgact_elf.c
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2010-11-22 14:42:13 +0000
committerattilio <attilio@FreeBSD.org>2010-11-22 14:42:13 +0000
commit7718cbcbf47164ddaa66a748a050f670b3b37e1d (patch)
tree8831ac1227984e07e03c6ac1b5cf30bba847610f /sys/kern/imgact_elf.c
parent225a98d4466b7d72ce67e249a3976b499437e798 (diff)
downloadFreeBSD-src-7718cbcbf47164ddaa66a748a050f670b3b37e1d.zip
FreeBSD-src-7718cbcbf47164ddaa66a748a050f670b3b37e1d.tar.gz
Add the ability for GDB to printout the thread name along with other
thread specific informations. In order to do that, and in order to avoid KBI breakage with existing infrastructure the following semantic is implemented: - For live programs, a new member to the PT_LWPINFO is added (pl_tdname) - For cores, a new ELF note is added (NT_THRMISC) that can be used for storing thread specific, miscellaneous, informations. Right now it is just popluated with a thread name. GDB, then, retrieves the correct informations from the corefile via the BFD interface, as it groks the ELF notes and create appropriate pseudo-sections. Sponsored by: Sandvine Incorporated Tested by: gianni Discussed with: dim, kan, kib MFC after: 2 weeks
Diffstat (limited to 'sys/kern/imgact_elf.c')
-rw-r--r--sys/kern/imgact_elf.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c
index e29ddfa..42f5573 100644
--- a/sys/kern/imgact_elf.c
+++ b/sys/kern/imgact_elf.c
@@ -1316,12 +1316,14 @@ typedef struct prpsinfo32 elf_prpsinfo_t;
typedef struct fpreg32 elf_prfpregset_t;
typedef struct fpreg32 elf_fpregset_t;
typedef struct reg32 elf_gregset_t;
+typedef struct thrmisc32 elf_thrmisc_t;
#else
typedef prstatus_t elf_prstatus_t;
typedef prpsinfo_t elf_prpsinfo_t;
typedef prfpregset_t elf_prfpregset_t;
typedef prfpregset_t elf_fpregset_t;
typedef gregset_t elf_gregset_t;
+typedef thrmisc_t elf_thrmisc_t;
#endif
static void
@@ -1331,10 +1333,12 @@ __elfN(puthdr)(struct thread *td, void *dst, size_t *off, int numsegs)
elf_prstatus_t status;
elf_prfpregset_t fpregset;
elf_prpsinfo_t psinfo;
+ elf_thrmisc_t thrmisc;
} *tempdata;
elf_prstatus_t *status;
elf_prfpregset_t *fpregset;
elf_prpsinfo_t *psinfo;
+ elf_thrmisc_t *thrmisc;
struct proc *p;
struct thread *thr;
size_t ehoff, noteoff, notesz, phoff;
@@ -1357,11 +1361,13 @@ __elfN(puthdr)(struct thread *td, void *dst, size_t *off, int numsegs)
status = &tempdata->status;
fpregset = &tempdata->fpregset;
psinfo = &tempdata->psinfo;
+ thrmisc = &tempdata->thrmisc;
} else {
tempdata = NULL;
status = NULL;
fpregset = NULL;
psinfo = NULL;
+ thrmisc = NULL;
}
if (dst != NULL) {
@@ -1401,11 +1407,15 @@ __elfN(puthdr)(struct thread *td, void *dst, size_t *off, int numsegs)
fill_regs(thr, &status->pr_reg);
fill_fpregs(thr, fpregset);
#endif
+ memset(&thrmisc->_pad, 0, sizeof (thrmisc->_pad));
+ strcpy(thrmisc->pr_tname, thr->td_name);
}
__elfN(putnote)(dst, off, "FreeBSD", NT_PRSTATUS, status,
sizeof *status);
__elfN(putnote)(dst, off, "FreeBSD", NT_FPREGSET, fpregset,
sizeof *fpregset);
+ __elfN(putnote)(dst, off, "FreeBSD", NT_THRMISC, thrmisc,
+ sizeof *thrmisc);
/*
* Allow for MD specific notes, as well as any MD
* specific preparations for writing MI notes.
OpenPOWER on IntegriCloud