* [RFA] Ignore DW_AT_ranges starting at zero if !has_section_at_zero
@ 2012-07-12 22:50 Doug Evans
2012-07-13 1:33 ` asmwarrior
2012-07-18 21:06 ` Tom Tromey
0 siblings, 2 replies; 3+ messages in thread
From: Doug Evans @ 2012-07-12 22:50 UTC (permalink / raw)
To: gdb-patches
Hi.
I was root-causing an instance of
"pc 0x2a in read in psymtab, but not in symtab"
and found that it was caused by an address range of 0-75 being
recorded in the psymtab addrmap but not the symtab addrmap.
The discrepancy between the two addrmaps is a separate patch,
as is whether we can just have one addrmap instead of two.
This patch ignores address ranges that begin at zero if there
is no section at zero to avoid populating the tables with bad data.
Ok to check in?
2012-07-12 Doug Evans <dje@google.com>
* dwarf2read.c (dwarf2_ranges_read): Ignore ranges starting at zero if
there's no section at address zero.
(dwarf2_record_block_ranges): Ditto.
Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.684
diff -u -p -r1.684 dwarf2read.c
--- dwarf2read.c 10 Jul 2012 20:28:32 -0000 1.684
+++ dwarf2read.c 12 Jul 2012 22:43:38 -0000
@@ -9051,6 +9051,17 @@ dwarf2_ranges_read (unsigned offset, COR
range_beginning += base;
range_end += base;
+ /* A not-uncommon case of bad debug info.
+ Don't pollute the addrmap with bad data. */
+ if (range_beginning + baseaddr == 0
+ && !dwarf2_per_objfile->has_section_at_zero)
+ {
+ complaint (&symfile_complaints,
+ _(".debug_ranges entry has start address of zero"
+ " [in module %s]"), objfile->name);
+ continue;
+ }
+
if (ranges_pst != NULL)
addrmap_set_empty (objfile->psymtabs_addrmap,
range_beginning + baseaddr,
@@ -9366,9 +9377,20 @@ dwarf2_record_block_ranges (struct die_i
if (start == end)
continue;
- record_block_range (block,
- baseaddr + base + start,
- baseaddr + base + end - 1);
+ start += base + baseaddr;
+ end += base + baseaddr;
+
+ /* A not-uncommon case of bad debug info.
+ Don't pollute the addrmap with bad data. */
+ if (start == 0 && !dwarf2_per_objfile->has_section_at_zero)
+ {
+ complaint (&symfile_complaints,
+ _(".debug_ranges entry has start address of zero"
+ " [in module %s]"), objfile->name);
+ continue;
+ }
+
+ record_block_range (block, start, end - 1);
}
}
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFA] Ignore DW_AT_ranges starting at zero if !has_section_at_zero
2012-07-12 22:50 [RFA] Ignore DW_AT_ranges starting at zero if !has_section_at_zero Doug Evans
@ 2012-07-13 1:33 ` asmwarrior
2012-07-18 21:06 ` Tom Tromey
1 sibling, 0 replies; 3+ messages in thread
From: asmwarrior @ 2012-07-13 1:33 UTC (permalink / raw)
To: gdb-patches; +Cc: Doug Evans
On 2012-7-13 6:50, Doug Evans wrote:
> Hi.
>
> I was root-causing an instance of
> "pc 0x2a in read in psymtab, but not in symtab"
> and found that it was caused by an address range of 0-75 being
> recorded in the psymtab addrmap but not the symtab addrmap.
>
> The discrepancy between the two addrmaps is a separate patch,
> as is whether we can just have one addrmap instead of two.
> This patch ignores address ranges that begin at zero if there
> is no section at zero to avoid populating the tables with bad data.
>
> Ok to check in?
>
> 2012-07-12 Doug Evans <dje@google.com>
>
> * dwarf2read.c (dwarf2_ranges_read): Ignore ranges starting at zero if
> there's no section at address zero.
> (dwarf2_record_block_ranges): Ditto.
>
I tested your patch, it looks like the problem I reported in this comment:
http://sourceware.org/bugzilla/show_bug.cgi?id=8863#c3
was solved by this patch. Thanks.
asmwarrior
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFA] Ignore DW_AT_ranges starting at zero if !has_section_at_zero
2012-07-12 22:50 [RFA] Ignore DW_AT_ranges starting at zero if !has_section_at_zero Doug Evans
2012-07-13 1:33 ` asmwarrior
@ 2012-07-18 21:06 ` Tom Tromey
1 sibling, 0 replies; 3+ messages in thread
From: Tom Tromey @ 2012-07-18 21:06 UTC (permalink / raw)
To: Doug Evans; +Cc: gdb-patches
>>>>> "Doug" == Doug Evans <dje@google.com> writes:
Doug> 2012-07-12 Doug Evans <dje@google.com>
Doug> * dwarf2read.c (dwarf2_ranges_read): Ignore ranges starting at zero if
Doug> there's no section at address zero.
Doug> (dwarf2_record_block_ranges): Ditto.
Looks reasonable to me.
Tom
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-07-18 21:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-12 22:50 [RFA] Ignore DW_AT_ranges starting at zero if !has_section_at_zero Doug Evans
2012-07-13 1:33 ` asmwarrior
2012-07-18 21:06 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox