Bad struct name in gdb with g++ 4.1.2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I'm having some issues with debugging an application compiled with g++ 4.1.2 The type names for structures appear in gdb as ".0", ".1", etc.

Here is a simple testcase:

foo.h
----------------------------------------------
typedef struct {
    int bar;
    char br;
} foo_t;
----------------------------------------------

foo.c
----------------------------------------------
#include "foo.h"

foo_t * global_foo_ptr;

int main(void) {
  return 0;
}
----------------------------------------------

Compiled with 
>g++4 -g -m32 foo.c -o test

GDB trace:
----------------------------------------------
(gdb) whatis global_foo_ptr
type = ._0 *
(gdb) ptype foo_t
No symbol "foo_t" in current context.
----------------------------------------------

readelf -w test
----------------------------------------------
[...]
<1><66>: Abbrev Number: 2 (DW_TAG_structure_type)
     DW_AT_sibling     : <8e>
     DW_AT_name        : ._0
     DW_AT_byte_size   : 8
     DW_AT_decl_file   : 3
     DW_AT_decl_line   : 1
[...]
----------------------------------------------

>g++4 --version
g++4 (GCC) 4.1.2 20080704 (Red Hat 4.1.2-44)

>gdb --version
GNU gdb Red Hat Linux (6.3.0.0-1.162.el4rh)


A more recent version of gcc (4.5.1) gives the expected results.


Any idea?

Thanks for your help,

--
Michel Metzger



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux