Bug 133775 - [patch] gdb(1) debugscripts: fix proc address print in ps macros
Summary: [patch] gdb(1) debugscripts: fix proc address print in ps macros
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 8.0-CURRENT
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2009-04-16 12:50 UTC by citrin
Modified: 2022-10-17 12:36 UTC (History)
0 users

See Also:


Attachments
file.diff (978 bytes, patch)
2009-04-16 12:50 UTC, citrin
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description citrin 2009-04-16 12:50:01 UTC
ps macros from debugscripts print correct proc address on i386, but print only half of address on amd64

How-To-Repeat: on amd64 host:
# cd/usr/obj/usr/src/sys/GENERIC
# make gdbinit
# kgdb kernel.debug /dev/mem
(kgdb) ps
During symbol reading, Incomplete CFI data; unspecified registers at 0xffffffff805479c9.
  pid    proc   uid  ppid  pgrp   flag stat comm         wchan
76791 57d01000 1001 75925 31548  10004002  1  inkscape     
76789 042978b0    0 35574 76789  10004002  1  kgdb         
...
(kgdb) p *(struct proc*) 0x042978b0
Error accessing memory address 0x42978b0: Bad address.
Comment 1 Maxim Konovalov 2009-04-16 14:48:13 UTC
> >Fix:
> --- tools/debugscripts/gdbinit.kernel.orig	2009-04-16 14:09:42.000000000 +0400
> +++ tools/debugscripts/gdbinit.kernel	2009-04-16 15:33:52.000000000 +0400
> @@ -199,7 +199,7 @@
>      set $nproc = nprocs
>      set $aproc = allproc.lh_first
>      set $proc = allproc.lh_first
> -    printf "  pid    proc   uid  ppid  pgrp   flag stat comm         wchan\n"
> +    printf "  pid          proc       uid  ppid  pgrp   flag stat comm         wchan\n"
>      while (--$nproc >= 0)
>          set $pptr = $proc.p_pptr
>          if ($pptr == 0)
> @@ -208,7 +208,7 @@
>          if ($proc.p_state)
>              set $thread = $proc->p_threads.tqh_first
>              while ($thread)
> -                printf "%5d %08x %4d %5d %5d  %06x  %d  %-10s   ", \
> +                printf "%5d %18p %4d %5d %5d  %06x  %d  %-10s   ", \
>                         $proc.p_pid, $aproc, \
>                         $proc.p_ucred->cr_ruid, $pptr->p_pid, \
>                         $proc.p_pgrp->pg_id, $proc.p_flag, $proc.p_state, \

It makes kgdb output on i386 system looks ugly.  Is there a way to
make gdbinit platform aware?

-- 
Maxim Konovalov
Comment 2 citrin 2009-04-16 16:25:32 UTC
>  It makes kgdb output on i386 system looks ugly.  Is there a way to
>  make gdbinit platform aware?

Simplest way is to have 2 slightly different variants of ps macro -
in gdbinit.i386 and default in gdbinit.kernel

But copy-paste is not good way in this case.

-- 
  Anton Yuzhaninov
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:50 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 4 Graham Perrin freebsd_committer freebsd_triage 2022-10-17 12:36:06 UTC
Keyword: 

    patch
or  patch-ready

– in lieu of summary line prefix: 

    [patch]

* bulk change for the keyword
* summary lines may be edited manually (not in bulk). 

Keyword descriptions and search interface: 

    <https://bugs.freebsd.org/bugzilla/describekeywords.cgi>