Page MenuHomeFreeBSD

Include command line arguments in core dump process info.
ClosedPublic

Authored by jhb on Jul 5 2016, 7:37 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Oct 27, 11:06 AM
Unknown Object (File)
Oct 17 2024, 2:27 AM
Unknown Object (File)
Oct 4 2024, 7:51 AM
Unknown Object (File)
Oct 2 2024, 6:41 PM
Unknown Object (File)
Oct 2 2024, 4:43 AM
Unknown Object (File)
Oct 1 2024, 11:28 PM
Unknown Object (File)
Oct 1 2024, 10:36 PM
Unknown Object (File)
Sep 30 2024, 10:05 AM
Subscribers

Details

Summary

Include command line arguments in core dump process info.

Fill in pr_psargs in the NT_PRSINFO ELF core dump note with command
line arguments.

Test Plan
  • generate core dumps with the change and open them in gdb
  • was not able to test lldb as lldb doesn't examine NT_PRSINFO on FreeBSD at all (and it uses the Linux PRSTATUS parser on FreeBSD cores which is wrong. Fixing lldb means writing ELF core note parsers for the FreeBSD core notes).

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jhb retitled this revision from to Include command line arguments in core dump process info..
jhb updated this object.
jhb edited the test plan for this revision. (Show Details)
jhb added reviewers: kib, emaste.
sys/kern/imgact_elf.c
1851 ↗(On Diff #18158)

I think this is too limiting. If p_args is NULL, you should use proc_getargv() to read the arguments from the process UVA directly. p_args is not guaranteed to exist.

sys/kern/imgact_elf.c
1851 ↗(On Diff #18158)

Humm, I guess I could do that. Note that pr_psargs is only 80 chars long. One thing that is annoying about proc_get_argv() is that I'll need to change it to take a maxlength, but I can do that. (I guess I had assumed that this is less useful if you have a really long command line and that any short command lines should have a valid p_args)

  • Use proc_getargv() if p_args is NULL.
  • Set len in the proc_getargv() case to avoid trashing random memory.
  • Fix 'len' when the sbuf overflows.
kib edited edge metadata.
This revision is now accepted and ready to land.Jul 9 2016, 3:20 PM
This revision was automatically updated to reflect the committed changes.