Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 May 2015 13:57:03 -0400
From:      Ryan Stone <rysto32@gmail.com>
To:        Sean Bruno <sbruno@freebsd.org>
Cc:        "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>
Subject:   Re: How to get anything useful out of kgdb?
Message-ID:  <CAFMmRNyM6Tc7P8rLJmMSVXOFkK4Tc0OCOtc=E9dLEtzKrEtjLg@mail.gmail.com>
In-Reply-To: <555627EC.2020007@ignoranthack.me>
References:  <554E41EE.2010202@ignoranthack.me> <2063489.pgabuk9nPJ@ralph.baldwin.cx> <55561803.9050102@ignoranthack.me> <19618854.y3EeXVtCGX@ralph.baldwin.cx> <55561D9A.30309@ignoranthack.me> <CAFMmRNydJdVm%2BDpptQY_LnRvMfUMmoLkLXZFd1zP3OxaMFHgxw@mail.gmail.com> <555627EC.2020007@ignoranthack.me>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, May 15, 2015 at 1:07 PM, Sean Bruno <sbruno@ignoranthack.me> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA512
>
> Hrm, when I look at them directly in the crashdump, I don't see
> anything useful.
>
> (kgdb) tid 100058
> [Switching to thread 54 (Thread 100058)]#0  cpustop_handler () at
> /home/sbruno/bsd/em_mq/sys/x86/x86/mp_x86.c:987
> 987             CPU_SET_ATOMIC(cpu, &stopped_cpus);
> Current language:  auto; currently minimal
> (kgdb) whe
> #0  cpustop_handler () at /home/sbruno/bsd/em_mq/sys/x86/x86/mp_x86.c:98
> 7
> #1  0xffffffff80f76f7a in ipi_nmi_handler () at
> /home/sbruno/bsd/em_mq/sys/x86/x86/mp_x86.c:969
> #2  0xffffffff80e3657a in trap (frame=0xffffffff817eb910) at
> /home/sbruno/bsd/em_mq/sys/amd64/amd64/trap.c:188
> #3  0xffffffff80e1b273 in nmi_calltrap () at
> /home/sbruno/bsd/em_mq/sys/amd64/amd64/exception.S:509
> #4  0x0000000800841841 in ?? ()
> Previous frame inner to this frame (corrupt stack?)
>

*Sigh*,  kgdb isn't unwinding the trap frame properly.  You can try this to
figure out where it was running:

frame 2
info line *frame->tf_rip

That gives you the top of the callstack at the time that the core was
taken.  To get the rest of it, try:

define trace_stack
  set $frame_ptr=$arg0
  set $iters=0
  while $frame_ptr != 0 && $iters < $arg1
    set $ret_addr=((char*)$frame_ptr) + sizeof(void*)
    printf "frameptr=%p, ret_addr=%p\n", (void*)$frame_ptr,
*(void**)$ret_addr
    printf "    "
    info line **(void***)$ret_addr
    set $frame_ptr=*(void**)$frame_ptr
    set $iters=$iters+1
  end
end

trace_stack frame->tf_rbp 20



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFMmRNyM6Tc7P8rLJmMSVXOFkK4Tc0OCOtc=E9dLEtzKrEtjLg>