Re: kgdb ported to devel/gdb

2015-10-06 Thread John Baldwin
On Monday, August 31, 2015 02:32:04 PM 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.

FYI, this is now present in the devel/gdb port as an off-by-default KGDB
option (so you need to build the package yourself for now).  Eventually we
will turn it on by default.

I did manage to get powerpc64 running under qemu and both the old and new
kgdb do not work with it.  I have the new kgdb close, but it is not able
to unwind stacks after the first frame.  I have not been able to test
sparc64.

-- 
John Baldwin
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: kgdb ported to devel/gdb

2015-10-02 Thread John Baldwin
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.' 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  Installation error:
> gdb.execute_unwinders function is missing:
> Python Exception  No module named gdb.frames:
> #0  doadump (textdump=1) at /usr/src/sys/kern/kern_shutdown.c:291
> #1  0x8063453f in kern_reboot (howto=260) at
> /usr/src/sys/kern/kern_shutdown.c:359
> Python Exception  Installation error:
> gdb.execute_unwinders function is missing:
> Python Exception  Installation error:
> gdb.execute_unwinders function is missing:
> #2  0x80634ba4 in vpanic (fmt=, ap=) at
> /usr/src/sys/kern/kern_shutdown.c:635
> Python Exception  Installation error:
> gdb.execute_unwinders function is missing:
> #3  0x806348a3 in panic (fmt=) at
> /usr/src/sys/kern/kern_shutdown.c:568
> Python Exception  Installation error:
> gdb.execute_unwinders function is missing:
> #4  0x8041bba7 in db_panic (addr=,
> have_addr=, count=, modif=) at
> /usr/src/sys/ddb/db_command.c:473
> Python Exception  Installation error:
> gdb.execute_unwinders function is missing:
> #5  0x8041b67b in db_command (last_cmdp=, 
> cmd_table=0x0,
> dopager=) at /usr/src/sys/ddb/db_command.c:440
> #6  0x8041b524 in db_command_loop () at 
> /usr/src/sys/ddb/db_command.c:493
> Python Exception  Installation error:
> gdb.execute_unwinders function is missing:
> #7  0x8041de0b in db_trap (type=, code=) 
> at
> /usr/src/sys/ddb/db_main.c:251
> Python Exception  Installation error:
> gdb.execute_unwinders function is missing:
> Python Exception  Installation error:
> gdb.execute_unwinders function is missing:
> #8  0x80669de8 in kdb_trap (type=19, code=0, tf=0x80f976d0
> ) at /usr/src/sys/kern/subr_kdb.c:653
> Python Exception  Installation error:
> gdb.execute_unwinders function is missing:
> #9  0x80820d26 in trap (frame=0x80f976d0 ) at
> /usr/src/sys/amd64/amd64/trap.c:381
> #10 0x80809623 in nmi_calltrap () at
> /usr/src/sys/amd64/amd64/exception.S:514
> Python Exception  Installation error:
> gdb.execute_unwinders function is missing:
> #11 0x80619e1f in __mtx_assert (c=, what= out>,
> file=, line=) 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
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: kgdb ported to devel/gdb

2015-10-02 Thread Navdeep Parhar
On Fri, Oct 02, 2015 at 09:19:13AM +0300, 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.' 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:
> 
> ...

Andriy,

The patch is also available in D3727.  I downloaded the raw diff from there,
applied it to $PORTS/devel/gdb, and built it as a port (with the KGDB support
option enabled of course).  Everything works.  Can you try that?

https://reviews.freebsd.org/D3727

Regards,
Navdeep
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: kgdb ported to devel/gdb

2015-10-01 Thread Andriy Gapon
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.' 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  Installation error:
gdb.execute_unwinders function is missing:
Python Exception  No module named gdb.frames:
#0  doadump (textdump=1) at /usr/src/sys/kern/kern_shutdown.c:291
#1  0x8063453f in kern_reboot (howto=260) at
/usr/src/sys/kern/kern_shutdown.c:359
Python Exception  Installation error:
gdb.execute_unwinders function is missing:
Python Exception  Installation error:
gdb.execute_unwinders function is missing:
#2  0x80634ba4 in vpanic (fmt=, ap=) at
/usr/src/sys/kern/kern_shutdown.c:635
Python Exception  Installation error:
gdb.execute_unwinders function is missing:
#3  0x806348a3 in panic (fmt=) at
/usr/src/sys/kern/kern_shutdown.c:568
Python Exception  Installation error:
gdb.execute_unwinders function is missing:
#4  0x8041bba7 in db_panic (addr=,
have_addr=, count=, modif=) at
/usr/src/sys/ddb/db_command.c:473
Python Exception  Installation error:
gdb.execute_unwinders function is missing:
#5  0x8041b67b in db_command (last_cmdp=, cmd_table=0x0,
dopager=) at /usr/src/sys/ddb/db_command.c:440
#6  0x8041b524 in db_command_loop () at 
/usr/src/sys/ddb/db_command.c:493
Python Exception  Installation error:
gdb.execute_unwinders function is missing:
#7  0x8041de0b in db_trap (type=, code=) at
/usr/src/sys/ddb/db_main.c:251
Python Exception  Installation error:
gdb.execute_unwinders function is missing:
Python Exception  Installation error:
gdb.execute_unwinders function is missing:
#8  0x80669de8 in kdb_trap (type=19, code=0, tf=0x80f976d0
) at /usr/src/sys/kern/subr_kdb.c:653
Python Exception  Installation error:
gdb.execute_unwinders function is missing:
#9  0x80820d26 in trap (frame=0x80f976d0 ) at
/usr/src/sys/amd64/amd64/trap.c:381
#10 0x80809623 in nmi_calltrap () at
/usr/src/sys/amd64/amd64/exception.S:514
Python Exception  Installation error:
gdb.execute_unwinders function is missing:
#11 0x80619e1f in __mtx_assert (c=, what=,
file=, line=) at 
/usr/src/sys/kern/kern_mutex.c:842
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Did I miss something?
Thanks!

-- 
Andriy Gapon
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"