Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Bad struct name in gdb with g++ 4.1.2
@ 2010-11-02 18:43 Michel METZGER
  2010-11-02 19:37 ` Tom Tromey
  0 siblings, 1 reply; 5+ messages in thread
From: Michel METZGER @ 2010-11-02 18:43 UTC (permalink / raw)
  To: gdb

[-- 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 --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Bad struct name in gdb with g++ 4.1.2
  2010-11-02 18:43 Bad struct name in gdb with g++ 4.1.2 Michel METZGER
@ 2010-11-02 19:37 ` Tom Tromey
  2010-11-02 19:53   ` Michel METZGER
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2010-11-02 19:37 UTC (permalink / raw)
  To: Michel METZGER; +Cc: gdb

>>>>> "Michel" == Michel METZGER <michel.metzger@st.com> writes:

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

[...]

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

Michel> Any idea?

I would suggest looking at the debuginfo.
You can do this with "readelf -wi".
If that shows the strange names, then it is a compiler bug.

Tom


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: Bad struct name in gdb with g++ 4.1.2
  2010-11-02 19:37 ` Tom Tromey
@ 2010-11-02 19:53   ` Michel METZGER
  2010-11-15 20:29     ` Dodji Seketeli
  0 siblings, 1 reply; 5+ messages in thread
From: Michel METZGER @ 2010-11-02 19:53 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb

readelf -wi gives me the following 

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

This is a compiler bug then.

Thanks,

Michel

-----Original Message-----
From: Tom Tromey [mailto:tromey@redhat.com] 
Sent: Tuesday, November 02, 2010 3:41 PM
To: Michel METZGER
Cc: gdb@sourceware.org
Subject: Re: Bad struct name in gdb with g++ 4.1.2

>>>>> "Michel" == Michel METZGER <michel.metzger@st.com> writes:

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

[...]

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

Michel> Any idea?

I would suggest looking at the debuginfo.
You can do this with "readelf -wi".
If that shows the strange names, then it is a compiler bug.

Tom


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Bad struct name in gdb with g++ 4.1.2
  2010-11-02 19:53   ` Michel METZGER
@ 2010-11-15 20:29     ` Dodji Seketeli
  2010-11-15 20:45       ` Michel METZGER
  0 siblings, 1 reply; 5+ messages in thread
From: Dodji Seketeli @ 2010-11-15 20:29 UTC (permalink / raw)
  To: Michel METZGER; +Cc: Tom Tromey, gdb

Michel METZGER <michel.metzger@st.com> a écrit:

> readelf -wi gives me the following 
>
> [...]
> <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
> [...]
>
> This is a compiler bug then.

Could you please check if you still have the problem with GCC 4.4 or
4.5? If yes, please file a bug to http://gcc.gnu.org/bugzilla with your
testcase. At least the information will not get lost. Who knows, someone
could even fix the problem ;-)

-- 
	Dodji


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: Bad struct name in gdb with g++ 4.1.2
  2010-11-15 20:29     ` Dodji Seketeli
@ 2010-11-15 20:45       ` Michel METZGER
  0 siblings, 0 replies; 5+ messages in thread
From: Michel METZGER @ 2010-11-15 20:45 UTC (permalink / raw)
  To: Dodji Seketeli; +Cc: Tom Tromey, gdb

I should have replied to my post earlier.
It is a know issue of gcc 4.1.2 and was fixed
In the later version.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35463

-- 
Michel.

-----Original Message-----
From: Dodji Seketeli [mailto:dodji@seketeli.org] 
Sent: Monday, November 15, 2010 3:29 PM
To: Michel METZGER
Cc: Tom Tromey; gdb@sourceware.org
Subject: Re: Bad struct name in gdb with g++ 4.1.2

Michel METZGER <michel.metzger@st.com> a écrit:

> readelf -wi gives me the following 
>
> [...]
> <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
> [...]
>
> This is a compiler bug then.

Could you please check if you still have the problem with GCC 4.4 or
4.5? If yes, please file a bug to http://gcc.gnu.org/bugzilla with your
testcase. At least the information will not get lost. Who knows, someone
could even fix the problem ;-)

-- 
	Dodji

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-11-15 20:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-02 18:43 Bad struct name in gdb with g++ 4.1.2 Michel METZGER
2010-11-02 19:37 ` Tom Tromey
2010-11-02 19:53   ` Michel METZGER
2010-11-15 20:29     ` Dodji Seketeli
2010-11-15 20:45       ` Michel METZGER

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox