Subject: Re: Building with debug symbols
To: Andreas Gustafsson <gson@gson.org>
From: Lubomir Kundrak <lkundrak@redhat.com>
List: current-users
Date: 03/19/2007 18:59:16
Hello Andreas,

On Mon, 2007-03-19 at 19:36 +0200, Andreas Gustafsson wrote:
> Lubomir Kundrak wrote:
> > > What is the correct way to build NetBSD-current with debug symbols?
> > > Is "build.sh -V DBG=-g release" supposed to work?
> > 
> > Maybe it is. Try yourself.
> 
> By trying it myself I will only find out whether it works or not, not
> whether it is _supposed_ to work or not.
> 
> As a matter of fact I have already tried it and found that it doesn't
> work.  The question is, is this a bug in NetBSD that I should file
> a PR about, or am I using the wrong method?

I really don't know, but an error log could say more maybe.

> > I used to build with COPTS=-g, now I use
> > separate debugging packages with debugging symbols that you can enable
> > with MKDEBUG=Yes.
> 
> I tried this ("build.sh -V MKDEBUG=Yes release").  The build completed
> successfully (including the boot floppies), I was able to install the
> resulting release, and the /usr/libdata/debug directory was populated
> with .debug files.  But how do I make gdb use them?  I tried
> 
>   gdb --symbols /usr/libdata/debug/bin/sh.debug /bin/sh
> 
> but gdb still said "no debugging symbols found".

Not sure again, as I only tested it in Fedora, but... try adding
something like this to your ~/.gdbinit:

set debug-file-directory /usr/libdata/debug

Cheers,
-- 
Lubomir Kundrak (Red Hat Security Response Team)