7780 mdb could extract NT_PRPSINFO information from core files

Review Request #1478 - Created Feb. 15, 2019 and submitted

Information
carlos neira
illumos-gate
master
7780
49a5821...
Reviewers
general

This patch add this feature to mdb https://www.illumos.org/issues/7780
It extracts psinfo_t from xdata buffers to present relevant information, also it prints most info that belongs to a NT_PRPSINFO note from elfdump using psinfo_t data.

cneira@Trixie:...illumos-omnios/usr/src/cmd/mdb$   /build/illumos-omnios/proto/root_i386-nd/usr/bin/amd64/mdb  /home/cneira/core
Loading modules: [ libc.so.1 ld.so.1 ]
> ::psinfo
Usage: psinfo [sum: print summary of psinfo_t data | raw: print relevant information of NT_PRPSINFO ]
> ::psinfo raw
[ NT_PRPSINFO ]
        pr_state:   6                   pr_sname:   O
        pr_zomb:    0                   pr_nice:    20
        pr_uid:     100                 pr_gid:     1
        pr_pid:     383885              pr_ppid:    340440
        pr_pgid:    1                   pr_sid:     340440
        pr_addr:    0x00000000          pr_size:    0x6d0
        pr_rssize:  0x38c               pr_wchan:   0
        pr_start:
            tv_sec: 1549649231          tv_nsec:    683629550
        pr_time:
            tv_sec: 0                   tv_nsec:    1054142
        pr_pri:     59                  pr_oldpri:  40
        pr_cpu:     0
        pr_clname:  TS
        pr_fname:   test
        pr_psargs:  ./test
        pr_syscall: [ SYS#0 ]
        pr_ctime:
            tv_sec: 0                   tv_nsec:    0
        pr_argc:    1                   pr_argv:    0x08039654
        pr_envp:    0x0803965c          pr_wstat:   139
        pr_pctcpu:  0.0%                pr_pctmem:  0.0%
        pr_euid:    100                 pr_egid:    1
        pr_dmodel:  [PR_MODEL_ILP32]
> ::psinfo sum
PID:    383885  (process id)            UID:      100  (real user id)
PPID:   340440  (parent process id)     EUID:     100  (effective user id)
PGID:   383885  (process group id)      GID:        1  (real group id)
SID:    340440  (session id)            EGID:       1  (effective group id)
ZONEID:      0                          CONTRACT:  94
PROJECT:     3                          TASK:      87

START: 2019 Feb  8 15:07:11 (wall timestamp when the process started)
TIME:          0.000000001 seconds   (CPU time used by this process)
CTIME:         0.000000000 seconds   (CPU time used by child processes)
FNAME:  "test"                       (name of the program executed)
PSARGS: "./test"

>
cneira@Trixie:...illumos-omnios/usr/src/cmd/mdb$   /build/illumos-omnios/proto/root_i386-nd/usr/bin/amd64/mdb  /home/cneira/core.26853
Loading modules: [ libc.so.1 ld.so.1 ]
> ::psinfo sum
PID:     26853  (process id)            UID:      100  (real user id)
PPID:      891  (parent process id)     EUID:     100  (effective user id)
PGID:    26853  (process group id)      GID:        1  (real group id)
SID:       891  (session id)            EGID:       1  (effective group id)
ZONEID:      0                          CONTRACT:  78
PROJECT:     3                          TASK:      69

START: 2019 Jan 30 16:23:46 (wall timestamp when the process started)
TIME:          0.000000009 seconds   (CPU time used by this process)
CTIME:         0.000000000 seconds   (CPU time used by child processes)
FNAME:  "vim"                        (name of the program executed)
PSARGS: "vim t.txt"
> ::psinfo raw
[ NT_PRPSINFO ]
        pr_state:   4                   pr_sname:   T
        pr_zomb:    0                   pr_nice:    20
        pr_uid:     100                 pr_gid:     1
        pr_pid:     26853               pr_ppid:    891
        pr_pgid:    1                   pr_sid:     891
        pr_addr:    0xfffffe12cc0b0070  pr_size:    0x1b88
        pr_rssize:  0xf64               pr_wchan:   0
        pr_start:
            tv_sec: 1548876226          tv_nsec:    683326865
        pr_time:
            tv_sec: 0                   tv_nsec:    9875073
        pr_pri:     59                  pr_oldpri:  40
        pr_cpu:     0
        pr_clname:  TS
        pr_fname:   vim
        pr_psargs:  vim t.txt
        pr_syscall: [ pollsys ]
        pr_ctime:
            tv_sec: 0                   tv_nsec:    0
        pr_argc:    2                   pr_argv:    0xfffffc7fffdf5c48
        pr_envp:    0xfffffc7fffdf5c60  pr_wstat:   0
        pr_pctcpu:  0.0%                pr_pctmem:  0.0%
        pr_euid:    100                 pr_egid:    1
        pr_dmodel:  [PR_MODEL_LP64]

32 bit core test

cneira@Trixie:~$ file 15\-dlmgmtd\-44
15-dlmgmtd-44:  ELF 32-bit LSB core file 80386 Version 1, from 'dlmgmtd'

cneira@Trixie:~$ /build/illumos-omnios/proto/root_i386-nd/usr/bin/amd64/mdb  /home/cneira/15\-dlmgmtd\-44
Loading modules: [ libc.so.1 libavl.so.1 libnvpair.so.1 libsysevent.so.1 ld.so.1 ]
> ::psinfo
PID:        44  (process id)            UID:        0  (real user id)
PPID:        1  (parent process id)     EUID:      15  (effective user id)
PGID:       44  (process group id)      GID:        0  (real group id)
SID:        44  (session id)            EGID:      65  (effective group id)
ZONEID:      0                          CONTRACT:   8
PROJECT:     0                          TASK:       3

START: 2019 Feb  2 12:27:16   (wall timestamp when the process started)
TIME:  0.21 seconds           (CPU time used by this process)
CTIME: 0.0 seconds           (CPU time used by child processes)
FNAME: dlmgmtd                (name of the program executed)
PSARGS: "/sbin/dlmgmtd"
> ::psinfo -v
[ NT_PRPSINFO ]
        pr_state:   6                   pr_sname:   O
        pr_zomb:    0                   pr_nice:    20
        pr_uid:     0                   pr_gid:     0
        pr_pid:     44          pr_ppid:    1
        pr_pgid:    0                   pr_sid:     44
        pr_addr:    0x0                 pr_size:    0xbd0
        pr_rssize:  0x4fc               pr_wchan:   0
        pr_start:
            tv_sec: 1549121236          tv_nsec:    943744935
        pr_time:
            tv_sec: 0                   tv_nsec:    21095691
        pr_pri:     60                  pr_oldpri:  39
        pr_cpu:     0
        pr_clname:  TS
        pr_fname:   dlmgmtd
        pr_psargs:  /sbin/dlmgmtd
        pr_syscall: [ lwp_kill ]
        pr_ctime:
            tv_sec: 0                   tv_nsec:    0
        pr_argc:    1                   pr_argv:    0x8047e10
        pr_envp:    0x8047e18           pr_wstat:   134
        pr_pctcpu:  0.0%                pr_pctmem:  0.1%
        pr_euid:    15                  pr_egid:    65
        pr_dmodel:  [PR_MODEL_ILP32]

Issues

  • 0
  • 60
  • 0
  • 60
Description From Last Updated
Robert Mustacchi
carlos neira
carlos neira
Gergő Mihály Doma
Robert Mustacchi
carlos neira
carlos neira
carlos neira
carlos neira
Gergő Mihály Doma
Gergő Mihály Doma
Gergő Mihály Doma
carlos neira
Robert Mustacchi
carlos neira
carlos neira
Robert Mustacchi
Gergő Mihály Doma
carlos neira
Review request changed

Status: Closed (submitted)

Loading...