cvs commit: src/sys/bus/usb usb_ethersubr.c src/sys/kern kern_poll.c uipc_msg.c src/sys/net netisr.c netisr.h src/sys/net/ppp if_ppp.c src/sys/netgraph/netgraph ng_base.c src/sys/netinet if_ether.c ip_demux.c ip_input.c tcp_subr.c ...

Matthew Dillon dillon at
Tue Apr 13 12:35:09 PDT 2004

:By the way, is there a way to specify from which process to show the
:trace in gdb -k? For example, mpd had pid 36 in the above trace, but
:if I manually panic, savecore the dump and feed it to gdb -k, I don't
:know how to specify the pid in gdb. It's too late to simply set a
:breakpoint on lwkt_default_waitport after mpd got stuck because, but
:if I set the breakpoint BEFORE mpd hangs, maybe I have to skip too
:many false-positives before reaching the target.

    Yes, you should be able to specify the pid:

    gdb> proc 27
    gdb> back

    For pure threads, supply the address of the thread structure.

    gdb> proc 0x<address_of_thread_structure>
    gdb> back

    Here is a handy GDB macro procedure to generate a 'ps', put it in
    your ~/.gdbinit file.

					Matthew Dillon 
					<dillon at xxxxxxxxxxxxx>

set print pretty on
set print union
set history expansion on

set $maxargs = 0

define pst
    set $cpu = 0
    printf "cpu  pid    thread    flags comm       wchan wmesg\n"
    while ($cpu < ncpus)
	set $gd = (struct mdglobaldata *)&CPU_prvspace
	set $td = $gd->mi.gd_tdallq.tqh_first
	while ( $td != 0 )
	    if ( $td->td_proc != 0 )
		set $pid = $td->td_proc->p_pid
		set $pid = -1
	    if ( $td->td_wmesg != 0 )
		printf "%3d %5d %08x %08x %-10s %08x %s\n",	\
		    $cpu, $pid, $td, $td->td_flags, $td->td_comm, $td->td_wchan, \
		printf "%3d %5d %08x %08x %-10s %08x\n",	\
		    $cpu, $pid, $td, $td->td_flags, $td->td_comm, $td->td_wchan
	    set $td = $td->td_allq.tqe_next
	set $cpu = $cpu + 1
document ps
"ps" -- when kernel debugging, type out a ps-like listing of active processes.

define xbt
	set $xsp = (int *)$arg0
	set $count = 50

	while ($count > 0)
	    p/a *$xsp

	    set $xsp = $xsp + 1
	    set $count = $count - 1

printf "\n\n\"ps\" -- when kernel debugging, type out a ps-like listing of active processes.\n"

More information about the Commits mailing list