Re: [patch/rfc] Recognize non-DW_AT_location symbols

Joel Brobecker
2009-03-26T00:29:56Z

Hi Jan,

> gdb/
> 2009-03-24 Joel Brobecker <brobecker@adacore.com>
> Jan Kratochvil <jan.kratochvil@redhat.com>
>
> Recognize missing DW_AT_location as <value optimized out>.
> * dwarf2read.c
> (new_symbol <DW_TAG_variable> <!DW_AT_location> <!DW_AT_external>):
> Call add_symbol_to_list.

I don't understand what you are trying to explain in your comment.
The way I came to the conclusion that we shouldn't create a symbol
for DIEs that have a non-zero DW_AT_declaration is that the DWARF
reference calls them as "incomplete, or non-defining" declarations.
As such, we don't have all the information about our variable yet,
and the absence of a DW_AT_location attribute can be normal. Normally,
the full definition should be provided elsewhere and this what we will
use to create the associated symbol.

In your comment, you are hinting at a C++ situation, so I'm guessing
that this situation is relevant to this thread and gave you a little bit
of trouble. Would you like to elaborate?

If you want to, we can commit the patch as is, with or without the
comment, and then work on a comment that we can both understand.
I would tend towards committing the patch without the comment. I'd
rather have no comment than a comment I don't understand.

> gdb/testsuite/
> 2009-03-25 Jan Kratochvil <jan.kratochvil@redhat.com>
>
> * gdb.dwarf2/dw2-noloc-main.c: New file.
> * gdb.dwarf2/dw2-noloc.S: New symbols matrix.
> (.text): Remove.
> (.data): New.
> (DW_AT_stmt_list, .debug_line, DW_AT_frame_base): Remove.
> (DW_AT_low_pc, DW_AT_high_pc): Reference `dw2-noloc-main.c'.
> (DW_TAG_subprogram func_cu1, noloc): Remove.
> (main): New.
> * gdb.dwarf2/dw2-noloc.exp: Use prepare_for_testing, compile also
> `dw2-noloc-main.c'. Test the new DIEs from `dw2-noloc.S'.
> (file_symbols): New procedure.

This part looks OK to me as well.

--
Joel