diff options
author | marcel <marcel@FreeBSD.org> | 2004-07-18 20:28:07 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2004-07-18 20:28:07 +0000 |
commit | 36406aeaf385ec59d079801fe282cffe37b01ead (patch) | |
tree | 56398669dffa01d6dcae3b54f183d8ce272c8bc7 /sys/kern | |
parent | ca2f9ba7d2d8f9ebcf63adba3aa7596655c34c36 (diff) | |
download | FreeBSD-src-36406aeaf385ec59d079801fe282cffe37b01ead.zip FreeBSD-src-36406aeaf385ec59d079801fe282cffe37b01ead.tar.gz |
After maintaining previous behaviour in writing out the core notes, it's
time now to break with the past: do not write the PID in the first note.
Rationale:
1. [impact of the breakage] Process IDs in core files serve no immediate
purpose to the debugger itself. They are only useful to relate a core
file to a process. This can provide context to the person looking at
the core file, provided one keeps track of this. Overall, not having
the PID in the core file is only in very rare occasions unfortunate.
2. [reason of the breakage] Having one PRSTATUS note contain the PID,
while all others contain the LWPID of the corresponding kernel thread
creates an irregularity for the debugger that cannot easily be worked
around. This is caused by libthread_db correlating user thread IDs to
kernel thread (aka LWP) IDs and thus aware of the actual LWPIDs.
Update comments accordingly.
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/imgact_elf.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index 0b0788e..1c73b62 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -1171,13 +1171,10 @@ __elfN(puthdr)(struct thread *td, void *dst, size_t *off, int numsegs) sizeof *psinfo); /* - * For backward compatibility, we dump the registers of the current - * thread (as passed to us in td) first and set pr_pid to the PID of - * the process. We then dump the other threads, but with pr_pid set - * to the TID of the thread itself. This has two advantages: - * 1) We preserve the meaning of pr_pid for as much as is possible. - * 2) The debugger will select the current thread as its initial - * "thread", which is likely what we want. + * To have the debugger select the right thread (LWP) as the initial + * thread, we dump the state of the thread passed to us in td first. + * This is the thread that causes the core dump and thus likely to + * be the right thread one wants to have selected in the debugger. */ thr = td; while (thr != NULL) { @@ -1188,7 +1185,7 @@ __elfN(puthdr)(struct thread *td, void *dst, size_t *off, int numsegs) status->pr_fpregsetsz = sizeof(fpregset_t); status->pr_osreldate = osreldate; status->pr_cursig = p->p_sig; - status->pr_pid = (thr == td) ? p->p_pid : thr->td_tid; + status->pr_pid = thr->td_tid; fill_regs(thr, &status->pr_reg); fill_fpregs(thr, fpregset); } |