Follow-up to D7255, requested by jhb.
Details
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 4549 Build 4601: arc lint + arc unit
Event Timeline
Please ignore the tests/ changes. arc doesn't support independent diffs in the same SVN tree very well.
About that... maybe my world is out of date, but I can't even build gcore:
CURRENT.svn/usr.bin/gcore/elfcore.c:617:10: error: no member named 'pr_pid' in 'struct prpsinfo' psinfo->pr_pid = pid; ~~~~~~ ^
usr.bin/gcore/elfcore.c | ||
---|---|---|
484 | This doesn't seem correct in the new case as 'hdr' isn't updated. Probably the assignment of 'phdr' needs to move into the branches above? The 'if' can use this, and the 'else' would it put it after the end of the 'shdr'. Just hack your previous test program to add a 'getchar()' or some such so it pauses so you can run gcore against it to test it. (That's what I end up doing to test gcore). |
usr.bin/gcore/elfcore.c | ||
---|---|---|
484 | Not sure what you mean. hdr isn't updated in the kernel dump either. The segments are actually located before the sections in the dump (in both kernel and gcore). More correct would be phdr = hdr + ehdr->e_phoff but e_phoff is sizeof(Elf_Edhr) so that's fine. |
Just hack your previous test program to add a 'getchar()' or some such so it pauses so you can run gcore against it to test it. (That's what I end up doing to test gcore).
Or even better have the helper take a command-line argument to either abort itself, or wait.
Yes, pr_pid was added to gcore in HEAD this past week. It requires a newer /sys/sys/procfs.h. You can just copy that header to /usr/include/sys to build a gcore binary.
usr.bin/gcore/elfcore.c | ||
---|---|---|
484 | Ah, I inferred the relative location from the fact that you moved it. I guess it's fine to move it, but it is "noise" in the diff, per se. Changing it to 'e_phoff' is fine with me though if you wish. |
Thanks.
usr.bin/gcore/elfcore.c | ||
---|---|---|
484 | Right. I've changed it to e_phoff locally, but am waiting to push the new diff until I can test it. |
Minor change: replace hardcoded phdr offset with e_phoff (though e_phoff
remains unchanged).
I've tested this and confirmed gcore emits the special section when the number
of r/w segments exceeds 65535. Caveat, gcore appears to interpret whether or
not to dump a section differently from the kernel. So to repro, I doubled the
count in the helper program.
Hmm. They really should be dumping the same set of segments. What is the difference you see?