This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 2/3] Check data is GC'ed
- From: Yao Qi <yao at codesourcery dot com>
- To: Doug Evans <dje at google dot com>
- Cc: <gdb-patches at sourceware dot org>
- Date: Fri, 29 Aug 2014 21:28:19 +0800
- Subject: Re: [PATCH 2/3] Check data is GC'ed
- Authentication-results: sourceware.org; auth=none
- References: <53D8A264 dot 1050103 at codesourcery dot com> <1408609338-17561-1-git-send-email-yao at codesourcery dot com> <1408609338-17561-2-git-send-email-yao at codesourcery dot com> <21495 dot 34225 dot 60705 dot 175416 at ruffy2 dot mtv dot corp dot google dot com>
Doug Evans <dje@google.com> writes:
> > if (pdi->d.locdesc
> > && addr == 0
> > - && !dwarf2_per_objfile->has_section_at_zero)
> > + /* When the address is 0, if the object file doesn't have
> > + section at zero or the section at zero is executable,
> > + we think address 0 means the corresponding variable is
> > + removed by linker, instead of there is a data at address
> > + 0. */
> > + && (dwarf2_per_objfile->section_at_zero == NULL
> > + || dwarf2_per_objfile->section_at_zero->flags & SEC_CODE))
>
> Could there be a DW_TAG_variable in SEC_CODE?
> Someone might put one there for a particular reason.
I don't figure out a reason to do so, but it is possible via:
__attribute__((section(".text"))) int foo = 1;
I can't think of other heuristics, so if GDB has a section at address
zero, GDB can't tell address zero in debug information means the
corresponding variable is GC'ed by linker or the variable address is
zero.
How about open a PR about GDB is unable to know whether a variable is
GC'ed by linker if there is a section at address zero? and kfail
dw2-var-zero-addr.exp conditionally? Something like:
if [is_address_zero_readable] {
setup_kfail "gdb/PR" "*-*-*"
}
gdb_test "print &var" {No symbol "var" in current context\.}
What do you think?
--
Yao (éå)