kern/133775: [patch] gdb debugscripts: fix proc address print in ps macros

Anton Yuzhaninov citrin at citrin.ru
Thu Apr 16 04:50:03 PDT 2009


>Number:         133775
>Category:       kern
>Synopsis:       [patch] gdb debugscripts: fix proc address print in ps macros
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Apr 16 11:50:01 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Anton Yuzhaninov
>Release:        FreeBSD 8.0-CURRENT amd64
>Organization:
Rambler
>Environment:
System: FreeBSD citrin.park.rambler.ru 8.0-CURRENT FreeBSD 8.0-CURRENT #0: Wed Apr 8 05:31:05 MSD 2009 citrin at citrin.park.rambler.ru:/usr/obj/usr/src/sys/GENERIC amd64
>Description:
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.
>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, \
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list