public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "fnf at specifixinc dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug debug/29614]  New: DWARF information for function static variable is missing after unrelated code addition
Date: Fri, 27 Oct 2006 12:43:00 -0000	[thread overview]
Message-ID: <bug-29614-9863@http.gcc.gnu.org/bugzilla/> (raw)

A bunch of tests in the gdb testsuite dealing with static variables inside
function scopes have started failing recently with the latest development gcc. 
I simplified the test case down to a small program that shows that simply
adding a small bit of unrelated code causes the DWARF information to disappear.
 Here is a typescript:

Script started on Tue 24 Oct 2006 08:58:44 PM MST
$ cat b.c
int bar ()
{
  static int funclocal = 4;     /* In data section */
  return funclocal;
}

int foo ()
{
  static int funclocal = 3;     /* In Data section */
  return funclocal;
}

#ifdef EXPOSEBUG
void bell ()
{
  static int usedval;
}
#endif

main ()
{
  extern void exit (int);
  exit (bar() + foo());
}
$ gcc -g -o b b.c
$ readelf --debug-dump b | grep funclocal
     DW_AT_name        : (indirect string, offset: 0x0): funclocal
     DW_AT_name        : (indirect string, offset: 0x0): funclocal
     DW_AT_name        : (indirect string, offset: 0x0): funclocal
  0x00000000 66756e63 6c6f6361 6c00              funclocal.
$ gcc -DEXPOSEBUG -g -o b b.c
$ readelf --debug-dump b | grep funclocal
     DW_AT_name        : funclocal
$ gdb b
GNU gdb 6.5.50.20060923-cvs
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) br foo
Breakpoint 1 at 0x8048361: file b.c, line 10.
(gdb) br bar
Breakpoint 2 at 0x8048357: file b.c, line 4.
(gdb) run
Starting program:
/media/backups/new/build/specifix/experimental/i686-pc-linux-gnu/gdb/gdb/testsuite/b

Breakpoint 2, bar () at b.c:4
4         return funclocal;
(gdb) p funclocal
No symbol "funclocal" in current context.
(gdb) c
Continuing.

Breakpoint 1, foo () at b.c:10
10        return funclocal;
(gdb) p funclocal
$1 = 3
(gdb) quit
The program is running.  Exit anyway? (y or n) y
$ exit

Script done on Tue 24 Oct 2006 08:59:51 PM MST


-- 
           Summary: DWARF information for function static variable is
                    missing after unrelated code addition
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fnf at specifixinc dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29614


             reply	other threads:[~2006-10-27 12:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-27 12:43 fnf at specifixinc dot com [this message]
2006-10-28 18:49 ` [Bug debug/29614] [4.2/4.3 Regression] " pinskia at gcc dot gnu dot org
2006-12-21 23:20 ` sje at cup dot hp dot com
2006-12-22  0:54 ` hubicka at ucw dot cz
2007-02-19 20:36 ` mmitchel at gcc dot gnu dot org
2007-02-20 21:40 ` patchapp at dberlin dot org
2007-02-24  0:11 ` sje at gcc dot gnu dot org
2007-03-05 23:52 ` [Bug debug/29614] [4.2 " sje at gcc dot gnu dot org
2007-03-05 23:56 ` pinskia at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-29614-9863@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).