Bad struct name in gdb with g++ 4.1.2

Michel METZGER
2010-11-02T18:43:04Z

[-- Attachment #1: Type: text/plain, Size: 1103 bytes --]

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.
----------------------------------------------

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

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

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

Any idea?

Thanks for your help,

--
Michel Metzger.

[-- Attachment #2: gdb_struct_name.tar.gz --]
[-- Type: application/x-gzip, Size: 401 bytes --]