Re: sun compiler and gdb

Tomasz Grobelny
2012-05-10T16:38:05Z

On Thu, 10 May 2012 07:33:41 -0600, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Tomasz" == Tomasz Grobelny <tomasz@grobelny.oswiecenia.net>
writes:
>
> Tom> If you have a small test case, a dump of the DWARF information
might
> Tom> prove helpful. If you only have a large test case, then something
> more
> Tom> selective could help.
>
> Tomasz> A trivial test case attached. Compiled with:
> Tomasz> CC: Sun C++ 5.11 SunOS_sparc 2010/08/13
>
> I think it is a compiler bug. The DWARF (from your second posting)
> looks like:
>
> <1><13b39>: Abbrev Number: 115 (DW_TAG_imported_declaration)
> <13b3a> DW_AT_import : <0x0> [Abbrev Number: 0]
>
> I don't think this is a valid DW_AT_import.
>
Do you think that this portion can be just ignored by gdb?

> After that you'd have to try again and see what other bugs crop up.
>
Actually the behaviour on the two machines I have tested on is different.
Not yet sure whether this is a problem with compiler architecture (x86 vs
sparc) or gdb version (7.4.1 vs. 7.0.1), but it looks like this on
sparc/gdb 7.0.1:
> gdb -readnow ./a.out.sparc
GNU gdb (GDB) 7.0.1
(...)
This GDB was configured as "sparc-sun-solaris2.10".
Reading symbols from /login/sg209371/gdbtest/a.out.sparc...expanding to
full symbols...Die: DW_TAG_<unknown> (abbrev 9, offset 0x1bb)
parent at offset: 0x197
has children: TRUE
attributes:
DW_AT_name (DW_FORM_string) string: "basic_ostream" (is canonicalized)
DW_AT_<unknown> (DW_FORM_string) string: "nNbasic_ostream3CTACTB_"
(not canonicalized)
DW_AT_decl_file (DW_FORM_data1) constant: 2
DW_AT_decl_line (DW_FORM_data1) constant: 74
Dwarf Error: Cannot find type of die [in module
/login/sg209371/gdbtest/a.out.sparc]
(gdb) quit
>

With the relevant portion of dwarfdump looking like this:
<2>< 443> DW_TAG_SUN_class_template
DW_AT_name basic_ostream
DW_AT_SUN_part_link_name nNbasic_ostream3CTACTB_
DW_AT_decl_file 2
/opt/solstudio12.2/prod/include/CC/Cstd/ostream
DW_AT_decl_line 74

Shouldn't unknown tag just be ignored? To me it looks like some compiler
specific extension.
I searched for other tags that might be compiler specific and here is the
list:
DW_AT_SUN_cf_kind
DW_AT_SUN_comdat_function
DW_AT_SUN_command_line
DW_AT_SUN_compile_options
DW_AT_SUN_func_offsets
DW_AT_SUN_language
DW_AT_SUN_link_name
DW_AT_SUN_part_link_name
DW_AT_SUN_pass_with_const
DW_AT_SUN_return_with_const
DW_AT_SUN_template
DW_AT_SUN_vbase
DW_AT_SUN_vtable
DW_AT_SUN_vtable_abi

Are any of these supported or (at least) explicitly ignored by gdb?