Bug 43373 - no symbol information when using nested function
no symbol information when using nested function
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Aaron Brown
Depends On:
  Show dependency treegraph
Reported: 2001-06-04 09:56 EDT by Alex Selby
Modified: 2007-04-18 12:33 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-10-01 18:15:56 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Alex Selby 2001-06-04 09:56:14 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.77 [en] (X11; U; Linux 2.2.16-22 i686)

Description of problem:
I don't know if gdb is meant to work with gcc extensions to C, but
it doesn't seem to understand nested functions. In this example, the
existence of a nested function seems to wipe out all the variable
information. I am using Redhat 7.0 and gdb-5.0-7.

How reproducible:

Steps to Reproduce:
Take following program fred.c

int main(int c,char **v){
  void zog(){}
  if(c>1)printf("Hi there %s\n",v[1]);

Compile with
gcc -o fred fred.c -g

Then follow this interactive session:

~/og$ gdb fred
GNU gdb 5.0
Copyright 2000 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
welcome to change it and/or distribute copies of it under certain
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
(gdb) l
1       int main(int c,char **v){
2         void zog(){}
3         if(c>1)printf("Hi there %s\n",v[1]);
4       }
(gdb) b 3
Breakpoint 1 at 0x8048472: file fred.c, line 3.
(gdb) r fred
Starting program: /home/alex/og/fred fred

Breakpoint 1, main () at fred.c:3
3         if(c>1)printf("Hi there %s\n",v[1]);
(gdb) p c
No symbol "c" in current context.
(gdb) bt
#0  main () at fred.c:3
#1  0x40041f31 in __libc_start_main (main=0x804846c <main>, argc=2,
    init=0x80482e4 <_init>, fini=0x80484dc <_fini>, rtld_fini=0x4000e274
    stack_end=0xbffff76c) at ../sysdeps/generic/libc-start.c:129
(gdb) c
Hi there fred

Program exited with code 016.

Actual Results:  (Actual results are contained in the above exchange.)

Expected Results:  The variable c should have been visible.
The backtrace should have shown something like
#0  main (c=2, v=0xbffff774) at fred.c:3
etc., showing the passed arguments.

Additional info:

The loss of debugging information occurs regardless of the position
of the nested function. E.g.

int main(int c,char **v){
  if(c>1)printf("Hi there %s\n",v[1]);
  {void zog(){}}

results in the same problem.
Comment 1 Trond Eivind Glomsrxd 2001-06-04 10:00:06 EDT
Still the case with Red Hat Linux 7.1 and the CVS snapshot from 2001-06-01
Comment 2 Trond Eivind Glomsrxd 2001-07-30 17:57:13 EDT
This seems to behave properly  with egcs... reassigning.
Comment 3 Richard Henderson 2004-10-01 18:15:56 EDT
Works at least with gcc-3.2.3-20.

Note You need to log in before you can comment on or make changes to this bug.