NetBSD Problem Report #46068
From gson@gson.org Tue Feb 21 20:19:32 2012
Return-Path: <gson@gson.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
by www.NetBSD.org (Postfix) with ESMTP id 7732263BCEF
for <gnats-bugs@gnats.NetBSD.org>; Tue, 21 Feb 2012 20:19:32 +0000 (UTC)
Message-Id: <20120221201932.2509275E3F@guava.gson.org>
Date: Tue, 21 Feb 2012 22:19:31 +0200 (EET)
From: gson@gson.org (Andreas Gustafsson)
Reply-To: gson@gson.org (Andreas Gustafsson)
To: gnats-bugs@gnats.NetBSD.org
Subject: GDB can no longer display kernel addresses symbolically on i386
X-Send-Pr-Version: 3.95
>Number: 46068
>Category: bin
>Synopsis: GDB can no longer display kernel addresses symbolically on i386
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bin-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Feb 21 20:20:00 +0000 2012
>Closed-Date: Sat Feb 25 16:55:09 +0000 2012
>Last-Modified: Sat Feb 25 16:55:09 +0000 2012
>Originator: Andreas Gustafsson
>Release: NetBSD-current >= 2011.10.10.14.07.16
>Organization:
>Environment:
System: NetBSD
Architecture: i386
Machine: i386
>Description:
GDB seems to have lost the ability to display function addresses
symbolically when debugging a kernel on i386.
Specifically, it fails when debugging an actual kernel file, such as
/netbsd. It works when debugging a "fake" kernel image saved by
savecore, such as /var/crash/netbsd.0.
For example, if you follow the instructions in PR 45677 that tell you
to download
http://www.gson.org/netbsd/bugs/45677/wd0.img
boot it with
qemu -snapshot -nographic -hda wd0.img
and type
cd /var/crash
gunzip netbsd*
gdb netbsd.0
target kvm netbsd.0.core
where
gdb will complain about a lack of debug symbols:
Reading symbols from /var/crash/netbsd.0...(no debugging symbols found)...done.
but you will still get a fairly readable stack trace:
#0 0xc05d62e3 in cpu_reboot ()
#1 0xc07d16aa in vpanic ()
#2 0xc07d174f in panic ()
#3 0xc07cd9cc in pool_get ()
#4 0xc07cf4a9 in pool_cache_put_slow ()
#5 0xc07cfec0 in pool_cache_put_paddr ()
#6 0xc07c8391 in kmem_intr_free ()
#7 0xc086ffed in ufs_readdir ()
#8 0xc09123d8 in VOP_READDIR ()
#9 0xc08e1a35 in getcwd_common ()
#10 0xc08e1d4b in sys___getcwd ()
#11 0xc07f5d8d in syscall ()
#12 0xc01005d6 in Xsyscall ()
No function arguments are displayed, but at least we have the function
names. However, if instead of /var/crash/netbsd.0 you point gdb at
the actual kernel, /netbsd:
gdb /netbsd
target kvm netbsd.0.core
GDB no longer complains about a lack of debug symbols:
Reading symbols from /netbsd...done.
But instead of being improved, the stack trace is now completely
unreadable:
#0 0xc05d62e3 in ?? ()
#1 0xc07d16aa in ?? ()
#2 0xc07d174f in ?? ()
#3 0xc07cd9cc in ?? ()
#4 0xc07cf4a9 in ?? ()
#5 0xc07cfec0 in ?? ()
#6 0xc07c8391 in ?? ()
#7 0xc086ffed in ?? ()
#8 0xc09123d8 in ?? ()
#9 0xc08e1a35 in ?? ()
#10 0xc08e1d4b in ?? ()
#11 0xc07f5d8d in ?? ()
#12 0xc01005d6 in ?? ()
>How-To-Repeat:
Here is a minimal test case that doesn't require downloading a large
disk image like the above example. Simply type, on any -current/i386 system,
gdb /netbsd
print cpu_reboot
You will see something like this:
$1 = {<text variable, no debug info>} 0xc05a2b56
On an older system, you will see something like this:
$1 = {<text variable, no debug info>} 0xc05a2b56 <cpu_reboot>
Note that the <cpu_reboot> at the end of the line is missing in -current.
Using automated binary search based on the presence of the <cpu_reboot>
in the above test case, I have narrowed down the regression to between
CVS dates 2011.10.08.19.16.08 and 2011.10.10.14.07.16. A number of gdb
changes were committed in this interval.
The problem does not affect -current/amd64 nor -current/sparc, nor
the debugging of userland programs.
>Fix:
>Release-Note:
>Audit-Trail:
From: christos@zoulas.com (Christos Zoulas)
To: gnats-bugs@NetBSD.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Cc:
Subject: Re: bin/46068: GDB can no longer display kernel addresses symbolically on i386
Date: Thu, 23 Feb 2012 22:51:18 -0500
On Feb 21, 8:20pm, gson@gson.org (Andreas Gustafsson) wrote:
-- Subject: bin/46068: GDB can no longer display kernel addresses symbolicall
How was that netbsd kernel created? It has:
(gdb) maintenance info psymtabs
{ objfile /net/shiny/u-6/christos/crash/netbsd ((struct objfile *) 0xbb9e2000)
{ psymtab /tmp/bracket/i386/work/2012.02.05.17.34.34/src/sys/conf/debugsyms.c
((struct partial_symtab *) 0xbb307b44)
readin no
fullname (null)
text addresses 0xc0296db4 -- 0xc0296dc5
globals (* (struct partial_symbol **) 0xbb98e500 @ 1)
statics (* (struct partial_symbol **) 0xbb907000 @ 213)
dependencies (none)
}
}
Which is really strange to me, because my netbsd.gdb has a whole bunch of
them, and my netbsd has none...
christos
From: Andreas Gustafsson <gson@gson.org>
To: christos@zoulas.com (Christos Zoulas)
Cc: gnats-bugs@NetBSD.org
Subject: Re: bin/46068: GDB can no longer display kernel addresses symbolically on i386
Date: Fri, 24 Feb 2012 08:32:40 +0200
Christos Zoulas wrote:
> How was that netbsd kernel created?
"build.sh release" followed by a sysinst install.
> It has:
>
> (gdb) maintenance info psymtabs
> { objfile /net/shiny/u-6/christos/crash/netbsd ((struct objfile *) 0xbb9e2000)
> { psymtab /tmp/bracket/i386/work/2012.02.05.17.34.34/src/sys/conf/debugsyms.c
> ((struct partial_symtab *) 0xbb307b44)
> readin no
> fullname (null)
> text addresses 0xc0296db4 -- 0xc0296dc5
> globals (* (struct partial_symbol **) 0xbb98e500 @ 1)
> statics (* (struct partial_symbol **) 0xbb907000 @ 213)
> dependencies (none)
> }
> }
>
> Which is really strange to me, because my netbsd.gdb has a whole bunch of
> them, and my netbsd has none...
A kernel from a releng snapshot yields similar output:
# ftp http://nyftp.netbsd.org/pub/NetBSD-daily/HEAD/201202221120Z/i386/binary/sets/kern-GENERIC.tgz
# zcat kern-GENERIC.tgz | tar xf -
# gdb ./netbsd
GNU gdb (GDB) 7.3.1
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486--netbsdelf".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /tmp/netbsd...done.
(gdb) maintenance info psymtabs
{ objfile /tmp/netbsd ((struct objfile *) 0xbb9e4000)
{ psymtab /home/builds/ab/HEAD/src/sys/conf/debugsyms.c
((struct partial_symtab *) 0xbb308b34)
readin no
fullname (null)
text addresses 0xc0292ae4 -- 0xc0292af5
globals (* (struct partial_symbol **) 0xbb982500 @ 1)
statics (* (struct partial_symbol **) 0xbb907000 @ 215)
dependencies (none)
}
}
--
Andreas Gustafsson, gson@gson.org
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/46068 CVS commit: src/external/gpl3/gdb/dist/gdb
Date: Fri, 24 Feb 2012 17:41:12 -0500
Module Name: src
Committed By: christos
Date: Fri Feb 24 22:41:12 UTC 2012
Modified Files:
src/external/gpl3/gdb/dist/gdb: objfiles.c
Log Message:
PR/46068: Fix symbol loading on i386 kernels. On i386 lma != vma and gdb7
depends on them being != to detect overlays and avoid loading them. I've
disabled the test for now.
To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/objfiles.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: gson@NetBSD.org
State-Changed-When: Sat, 25 Feb 2012 16:55:09 +0000
State-Changed-Why:
Confirmed fixed.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.