mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-15 10:17:20 +00:00
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.
This commit is contained in:
parent
eab6e771a0
commit
1f7a1baa37
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=132364
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user