Re: kgdb ported to devel/gdb

From: John Baldwin <jhb_at_freebsd.org>
Date: Fri, 02 Oct 2015 09:01:35 -0700
On Friday, October 02, 2015 09:19:13 AM Andriy Gapon wrote:
> On 01/09/2015 00:32, John Baldwin wrote:
> > Over the past several months I have ported kgdb to the version of gdb in ports.
> > I have a pending patch to the gdb port to add fork following, but once that is
> > done (and possibly after updating to 7.10) I will try to add my existing work
> > as a KGDB option on the port.  Until such time, you can try the newer kgdb by
> > checking out my branch from git.
> > 
> > Here's my cheat sheet on how to build the newer kgdb.  Note that if you build
> > a world with my cross-libkvm patches you should get a kgdb that can debug
> > i386 cores on amd64 and vice versa.
> > 
> > All of the targets that the native devel/gdb support have their backends
> > ported (so x86, sparc64, powerpc and powerpc64).  I have not yet ported
> > arm or mips since those don't work for userland yet in upstream gdb.  I
> > have only compiled non-x86 backends.  Testing of the new kgdb on sparc64
> > and powerpc would be appreciated.
> > 
> > Steps:
> > 
> > % git clone https://github.com/bsdjhb/gdb.git
> > % git checkout freebsd-7.9.1-kgdb
> > % fetch http://www.freebsd.org/~jhb/gdb/build
> > % pkg install devel/gdb
> > 
> > # Having gdb installed will mean you get the python bindings in the right
> > # place.
> > 
> > % pkg install gmake
> > 
> > # I think this is the only build tool you need?
> > 
> > % ./build
> > % cd obj
> > 
> > # Replace 'obj' with 'obj.<arch>' for all but amd64
> > 
> > % gmake
> > 
> > # ... wait
> > 
> > You will now have a binary at 'obj/gdb/kgdb'.  I just run it from my obj
> > tree currently when testing.  Once it becomes part of the port it will get
> > installed as /usr/local/bin/kgdb791 or some such.
> 
> John,
> 
> first of all, thank you very much for this!
> 
> I followed your instructions substituting freebsd-7.10-kgdb for
> freebsd-7.9.1-kgdb branch (devel/gdb is also at version 7.10) and the build
> process worked just fine.
> However, when I try to use the new kgdb it works, but I get some annoying
> diagnostics:
> 
> (kgdb) bt
> Python Exception <type 'exceptions.NameError'> Installation error:
> gdb.execute_unwinders function is missing:
> Python Exception <type 'exceptions.ImportError'> No module named gdb.frames:
> #0  doadump (textdump=1) at /usr/src/sys/kern/kern_shutdown.c:291
> #1  0xffffffff8063453f in kern_reboot (howto=260) at
> /usr/src/sys/kern/kern_shutdown.c:359
> Python Exception <type 'exceptions.NameError'> Installation error:
> gdb.execute_unwinders function is missing:
> Python Exception <type 'exceptions.NameError'> Installation error:
> gdb.execute_unwinders function is missing:
> #2  0xffffffff80634ba4 in vpanic (fmt=<optimized out>, ap=<optimized out>) at
> /usr/src/sys/kern/kern_shutdown.c:635
> Python Exception <type 'exceptions.NameError'> Installation error:
> gdb.execute_unwinders function is missing:
> #3  0xffffffff806348a3 in panic (fmt=<unavailable>) at
> /usr/src/sys/kern/kern_shutdown.c:568
> Python Exception <type 'exceptions.NameError'> Installation error:
> gdb.execute_unwinders function is missing:
> #4  0xffffffff8041bba7 in db_panic (addr=<optimized out>,
> have_addr=<unavailable>, count=<unavailable>, modif=<unavailable>) at
> /usr/src/sys/ddb/db_command.c:473
> Python Exception <type 'exceptions.NameError'> Installation error:
> gdb.execute_unwinders function is missing:
> #5  0xffffffff8041b67b in db_command (last_cmdp=<optimized out>, cmd_table=0x0,
> dopager=<optimized out>) at /usr/src/sys/ddb/db_command.c:440
> #6  0xffffffff8041b524 in db_command_loop () at /usr/src/sys/ddb/db_command.c:493
> Python Exception <type 'exceptions.NameError'> Installation error:
> gdb.execute_unwinders function is missing:
> #7  0xffffffff8041de0b in db_trap (type=<optimized out>, code=<unavailable>) at
> /usr/src/sys/ddb/db_main.c:251
> Python Exception <type 'exceptions.NameError'> Installation error:
> gdb.execute_unwinders function is missing:
> Python Exception <type 'exceptions.NameError'> Installation error:
> gdb.execute_unwinders function is missing:
> #8  0xffffffff80669de8 in kdb_trap (type=19, code=0, tf=0xffffffff80f976d0
> <nmi0_stack+3888>) at /usr/src/sys/kern/subr_kdb.c:653
> Python Exception <type 'exceptions.NameError'> Installation error:
> gdb.execute_unwinders function is missing:
> #9  0xffffffff80820d26 in trap (frame=0xffffffff80f976d0 <nmi0_stack+3888>) at
> /usr/src/sys/amd64/amd64/trap.c:381
> #10 0xffffffff80809623 in nmi_calltrap () at
> /usr/src/sys/amd64/amd64/exception.S:514
> Python Exception <type 'exceptions.NameError'> Installation error:
> gdb.execute_unwinders function is missing:
> #11 0xffffffff80619e1f in __mtx_assert (c=<optimized out>, what=<optimized out>,
> file=<optimized out>, line=<optimized out>) at /usr/src/sys/kern/kern_mutex.c:842
> Backtrace stopped: previous frame inner to this frame (corrupt stack?)
> 
> Did I miss something?
> Thanks!

I've noticed this as well.  I've taken to building gdb without python support
for my testing when building out of git for now.

-- 
John Baldwin
Received on Fri Oct 02 2015 - 14:17:16 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:00 UTC