Bug 7737

Summary: g++ compiled struct structname structname; => can't eval structname.
Product: gdb Reporter: rbrown64
Component: c++Assignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED DUPLICATE    
Severity: normal CC: mgretton, sven.koehler
Priority: P3    
Version: HEAD   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed: 2010-10-23 00:00:00
Bug Depends on:    
Bug Blocks: 16106    

Description rbrown64 2002-08-06 09:18:00 UTC
[Converted from Gnats 632]

501 ~ % cat tmp.c  
#include <stdio.h>  

struct a {  
    int b;  
};  

struct a a;  

int main(int argc, char **argv)  
{  
    a.b = argc;  
    printf("%d %s\n", a.b, argv[0]);  
    exit(0);  
}  
502 ~ % gcc -v  
Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.2/specs  
gcc version 2.95.2 20000220 (Debian GNU/Linux)  
503 ~ % gcc -g -o tmp.bin tmp.c  
504 ~ % src/gdb-5.2.obj/gdb/gdb tmp.bin
GNU gdb 5.2  
Copyright 2002 Free Software Foundation, Inc.  
...
This GDB was configured as "i686-pc-linux-gnu"...  
(gdb) b 12
Breakpoint 1 at 0x804841e: file tmp.c, line 12.  
(gdb) r  
Starting program: /var/home/rdb/tmp.bin   

Breakpoint 1, main (argc=1, argv=0xbffff174) at tmp.c:12  
12        printf("%d %s\n", a.b, argv[0]);
(gdb) p a  
$1 = {b = 1}  
(gdb) c  
Continuing.  
1 /var/home/rdb/tmp.bin  

Program exited normally.  
(gdb) q  
505 ~ % g++ -g -o tmp.bin tmp.c
506 ~ % src/gdb-5.2.obj/gdb/gdb tmp.bin
GNU gdb 5.2
Copyright 2002 Free Software Foundation, Inc.
...
This GDB was configured as "i686-pc-linux-gnu"...
(gdb) b 12
Breakpoint 1 at 0x804853e: file tmp.c, line 12.
(gdb) r
Starting program: /var/home/rdb/tmp.bin

Breakpoint 1, main (argc=1, argv=0xbffff174) at tmp.c:12
12        printf("%d %s\n", a.b, argv[0]);
(gdb) p a
Attempt to use a type name as an expression
(gdb) ptype a
type = class a {
  public:
    int b; 

    a & operator=(a const &);
    a(a const &);
    a(void);
}
(gdb) c

Release:
gdb-5.2

Environment:
Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.2/specs  
gcc version 2.95.2 20000220 (Debian GNU/Linux)
Comment 1 Ben Longbons 2013-07-30 06:34:21 UTC
*** Bug 15111 has been marked as a duplicate of this bug. ***
Comment 2 Jason Merrill 2015-06-03 16:09:06 UTC
16253 has more information.

*** This bug has been marked as a duplicate of bug 16253 ***