public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* A quick question about high/low_pc and linkonce sections
@ 2005-07-01 10:13 Jie Zhang
  2005-07-01 10:52 ` Vladimir Prus
  0 siblings, 1 reply; 2+ messages in thread
From: Jie Zhang @ 2005-07-01 10:13 UTC (permalink / raw)
  To: gdb

Hi,

This is a piece of code from dwarf2read.c, near the end of
dwarf2_get_pc_bounds ().

  /* When using the GNU linker, .gnu.linkonce. sections are used to
     eliminate duplicate copies of functions and vtables and such.
     The linker will arbitrarily choose one and discard the others.
     The AT_*_pc values for such functions refer to local labels in
     these sections.  If the section from that file was discarded, the
     labels are not in the output, so the relocs get a value of 0.
     If this is a discarded function, mark the pc bounds as invalid,
     so that GDB will ignore it.  */
  if (low == 0 && (bfd_get_file_flags (obfd) & HAS_RELOC) == 0)
    return 0;


Isn't "high == 0" much better than "low == 0"? It's possible that a
valid DW_AT_low_pc is 0.

Thanks,
Jie

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

* Re: A quick question about high/low_pc and linkonce sections
  2005-07-01 10:13 A quick question about high/low_pc and linkonce sections Jie Zhang
@ 2005-07-01 10:52 ` Vladimir Prus
  0 siblings, 0 replies; 2+ messages in thread
From: Vladimir Prus @ 2005-07-01 10:52 UTC (permalink / raw)
  To: gdb

Jie Zhang wrote:

> Hi,
> 
> This is a piece of code from dwarf2read.c, near the end of
> dwarf2_get_pc_bounds ().
> 
>   /* When using the GNU linker, .gnu.linkonce. sections are used to
>      eliminate duplicate copies of functions and vtables and such.
>      The linker will arbitrarily choose one and discard the others.
>      The AT_*_pc values for such functions refer to local labels in
>      these sections.  If the section from that file was discarded, the
>      labels are not in the output, so the relocs get a value of 0.
>      If this is a discarded function, mark the pc bounds as invalid,
>      so that GDB will ignore it.  */
>   if (low == 0 && (bfd_get_file_flags (obfd) & HAS_RELOC) == 0)
>     return 0;
> 
> 
> Isn't "high == 0" much better than "low == 0"? It's possible that a
> valid DW_AT_low_pc is 0.

For the record, I've run into this problem myself and had to patch it
around. For my target, "lowpc" is always 0.

Also, the same logic is present at the end of the read_partial_die function.

- Volodya

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

end of thread, other threads:[~2005-07-01 10:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-01 10:13 A quick question about high/low_pc and linkonce sections Jie Zhang
2005-07-01 10:52 ` Vladimir Prus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).