sdb icon indicating copy to clipboard operation
sdb copied to clipboard

Enable way to print out command line arguments for threads/processes

Open prakashsurya opened this issue 5 years ago • 2 comments

I ran into a case where I was able to find the thread/process in question via threads, but wasn't able to determine the command line arguments used with that process.. For example:

sdb> threads ! grep zpool
0xffff991055628000 UNINTERRUPTIBLE 25216 120  zpool

Given that thread, I'd like to know what arguments were passed into zpool, but there doesn't appear to be an easy way to do this yet.

prakashsurya avatar Oct 12 '20 16:10 prakashsurya

This should not be hard to do as drgn provides such a helper: https://drgn.readthedocs.io/en/latest/helpers.html#drgn.helpers.linux.mm.cmdline

sdimitro avatar Oct 12 '20 16:10 sdimitro

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/sdb/commands/threads.py", line 31, in getcmdline
    return cmdline(obj)
  File "/usr/lib/python3/dist-packages/drgn/helpers/linux/mm.py", line 253, in cmdline
    return access_remote_vm(mm, arg_start, arg_end - arg_start).split(b"\0")[:-1]
  File "/usr/lib/python3/dist-packages/drgn/helpers/linux/mm.py", line 233, in access_remote_vm
    return _linux_helper_read_vm(mm.prog_, mm.pgd, address, size)
_drgn.FaultError: could not read memory from kdump: Excluded page: 0x1809dee8b

I tried to use that helper, but I'm getting an exception when I use it and pass in the task object.

prakashsurya avatar Oct 12 '20 16:10 prakashsurya