From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Paul Pluzhnikov <ppluzhnikov@google.com>
Cc: Joel Brobecker <brobecker@adacore.com>, gdb@sourceware.org
Subject: Re: about PR gdb/10002 (extern optimized out symbols print: Address of symbol is unknown)
Date: Thu, 26 Mar 2009 14:15:00 -0000 [thread overview]
Message-ID: <20090326141433.GA7053@host0.dyn.jankratochvil.net> (raw)
In-Reply-To: <8ac60eac0903251600v5bfe0808nebdef71c5f45c6cf@mail.gmail.com>
On Thu, 26 Mar 2009 00:00:24 +0100, Paul Pluzhnikov wrote:
> depends on compiler's ability to optimize out reference to "missing". If the
> compiler couldn't do that, you'd get an unresolved symbol at link time.
The target of that code was to produce:
<1><55>: Abbrev Number: 4 (DW_TAG_variable)
<56> DW_AT_name : (indirect string, offset: 0x66): missing
<5c> DW_AT_type : <0x4e>
<60> DW_AT_external : 1
<61> DW_AT_declaration : 1
The real test case
http://sourceware.org/ml/gdb-patches/2009-03/msg00545.html
uses .S for DWARF. This C code was just an easy easy how to
arch-independently create a reproducer of the GDB problem for the reader.
> > The variable was not "optimized out", but was never linked in.
>
> Well, the reference to the variable was optimized out.
I see now in DWARF3 4.1 point 4:
# In a variable entry representing the definition of a variable (that is, with
# no DW_AT_declaration attribute) if no location attribute is present [...],
# the variable is assumed to exist in the source code but not in the executable
# program [...]
As there is present DW_AT_declaration the variable is not considered as
<optimized out> by DWARF. I overlooked this condition of DWARF so far.
Going to close this PR gdb/10002 as invalid I also find now GDB is correct
now.
Still it is questionable how to reprosent by ELF/DWARF if the other
compilation unit would have the variable "missing" optimized out if GCC LTO
would find no reference to it. But this is not an actual problem to solve.
Thanks,
Jan
prev parent reply other threads:[~2009-03-26 14:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-25 22:26 Joel Brobecker
2009-03-25 23:00 ` Paul Pluzhnikov
2009-03-26 14:15 ` Jan Kratochvil [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090326141433.GA7053@host0.dyn.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=brobecker@adacore.com \
--cc=gdb@sourceware.org \
--cc=ppluzhnikov@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox