Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 03 Dec 2015 07:54:41 -0800
From:      John Baldwin <jhb@freebsd.org>
To:        Craig Rodrigues <rodrigc@freebsd.org>
Cc:        Dag-Erling =?ISO-8859-1?Q?Sm=F8rgrav?= <des@des.no>, FreeBSD Toolchain <freebsd-toolchain@freebsd.org>, Pedro Giffuni <pfg@freebsd.org>, David Chisnall <theraven@freebsd.org>, Garrett Cooper <yaneurabeya@gmail.com>, Allan Jude <allanjude@freebsd.org>, Kurt Lidl <lidl@pix.net>, Dimitry Andric <dim@freebsd.org>
Subject:   Re: Can we have a toolchain that works?
Message-ID:  <22020101.bKcckG4jXT@ralph.baldwin.cx>
In-Reply-To: <CAG=rPVcY=mkKARtRGTNYVsxp2jiGzZdAdv3KPO4JpiMPm1vfQA@mail.gmail.com>
References:  <86egf5ckwa.fsf@desk.des.no> <86io4guekw.fsf@desk.des.no> <CAG=rPVcY=mkKARtRGTNYVsxp2jiGzZdAdv3KPO4JpiMPm1vfQA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday, December 03, 2015 01:15:00 AM Craig Rodrigues wrote:
> [Moving discussion to freebsd-toolchain]
> 
> Dag,
> 
> Regarding your question about a working debugger, due to your problems
> debugging
> code with the in-tree gdb on latest current, we have a few options:
> 
> (1)  Enable WITH_LLDB by default in the make infrastructure, and install
> lldb.
> 
>        We already have lldb in the tree:
>          https://svnweb.freebsd.org/base/head/contrib/llvm/tools/lldb/
>        but it is not built by default.
> 
>         lldb does not have kgdb support though.
> 
> (2)  Kick gdb out of the base system, and tell people to install the
> devel/gdb port.
>        This will install gdb 7.10 from ports.
>        This port also installs kgdb

As noted in a recent thread on arch@ it is not quite that simple.

lldb only supports amd64 and arm64 AFAIK (perhaps arm as well?).  It does
not support i386 yet, and it does not have meaningful support for kernel
debugging (there was an SoC project to add a subset of amd64-only kgdb
support that is a decent start).

devel/gdb only supports x86 and powerpc.  sparc64 is also supported
upstream, but not in the port IIRC.  It supports kgdb for x86 well, but
on powerpc64 (the only other arch I've been able to test under qemu),
kgdb isn't able to unwind the stack past the initial frame in
cpu_switch, though with some small patches to at least get the initial
frame more correct I can see all the threads in info threads and kld
symbols are loaded ok.  devel/gdb is also the only debugger (to my
knowledge) that handles some more exotic uses like fork following and
AVX (on x86).

The only debugger we have for mips (possibly arm?) and sparc64 and for
kgdb on mips, arm, sparc64 is in-tree gdb.  One limitation of this
debugger is it is native-only.  Both lldb and devel/gdb are cross
debuggers out of the box (e.g. devel/gdb should be able to examine a
process core and (after my libkvm commit) a kernel core from any
platform it supports on any platform where it runs).  I believe lldb
includes all supported platforms out of the box as well.

Somewhat in my spare time I want to fill in more of the gaps in devel/gdb
coverage (rewrite threads to use ptrace directly and be MI without
requiring hacks in each backend the way the current fbsd-threads.c
target does; other platforms like arm; kgdb on other platforms).

Realistically this means we can't axe gdb in base from all platforms today as
we'd have platforms with no debugger.

As I mentioned previously, there was a recent thread on arch@ on this
very topic.

-- 
John Baldwin



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