From owner-freebsd-current@freebsd.org Fri Oct 2 06:19:54 2015 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 16DEBA0D1A4 for ; Fri, 2 Oct 2015 06:19:54 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 2E29D15DC; Fri, 2 Oct 2015 06:19:52 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id JAA04551; Fri, 02 Oct 2015 09:19:50 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1Zhth8-000PUE-16; Fri, 02 Oct 2015 09:19:50 +0300 Subject: Re: kgdb ported to devel/gdb To: John Baldwin , freebsd-current@FreeBSD.org References: <2662739.EWKL7pkiRb@ralph.baldwin.cx> From: Andriy Gapon X-Enigmail-Draft-Status: N1110 Message-ID: <560E21E1.6010002@FreeBSD.org> Date: Fri, 2 Oct 2015 09:19:13 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <2662739.EWKL7pkiRb@ralph.baldwin.cx> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 06:19:54 -0000 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 0xffffffff8063453f 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 0xffffffff80634ba4 in vpanic (fmt=, ap=) at /usr/src/sys/kern/kern_shutdown.c:635 Python Exception Installation error: gdb.execute_unwinders function is missing: #3 0xffffffff806348a3 in panic (fmt=) at /usr/src/sys/kern/kern_shutdown.c:568 Python Exception Installation error: gdb.execute_unwinders function is missing: #4 0xffffffff8041bba7 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 0xffffffff8041b67b in db_command (last_cmdp=, cmd_table=0x0, dopager=) 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 Installation error: gdb.execute_unwinders function is missing: #7 0xffffffff8041de0b 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 0xffffffff80669de8 in kdb_trap (type=19, code=0, tf=0xffffffff80f976d0 ) at /usr/src/sys/kern/subr_kdb.c:653 Python Exception Installation error: gdb.execute_unwinders function is missing: #9 0xffffffff80820d26 in trap (frame=0xffffffff80f976d0 ) 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 Installation error: gdb.execute_unwinders function is missing: #11 0xffffffff80619e1f 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