Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* RFC: fix PR gdb/15538
@ 2013-04-16  5:54 Tom Tromey
  2013-04-16  7:52 ` Pedro Alves
  2013-05-13 16:54 ` Tom Tromey
  0 siblings, 2 replies; 5+ messages in thread
From: Tom Tromey @ 2013-04-16  5:54 UTC (permalink / raw)
  To: gdb-patches

This fixes PR 15538, an assertion failure when reading a certain file.

The bug is that dwarf2_record_block_ranges asserts that the ranges
section has been read in -- but it can be called without this occurring.

The fix is to simply read in the section in dwarf2_record_block_ranges.

I didn't know how to make a test case, so I haven't provided one.
If this is an issue I will try harder to figure it out.

Built and regtested on x86-64 Fedora 18.
The bug reporter also tested it.

Tom

    	PR gdb/15538:
    	* dwarf2read.c (dwarf2_record_block_ranges): Ensure that the
    	ranges section has been read.

diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 8947f8f..64fc7da 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -10458,7 +10458,7 @@ dwarf2_record_block_ranges (struct die_info *die, struct block *block,
          address range list in the .debug_ranges section.  */
       unsigned long offset = (DW_UNSND (attr)
 			      + (need_ranges_base ? cu->ranges_base : 0));
-      const gdb_byte *buffer = dwarf2_per_objfile->ranges.buffer + offset;
+      const gdb_byte *buffer;
 
       /* For some target architectures, but not others, the
          read_address function sign-extends the addresses it returns.
@@ -10477,7 +10477,7 @@ dwarf2_record_block_ranges (struct die_info *die, struct block *block,
       CORE_ADDR base = cu->base_address;
       int base_known = cu->base_known;
 
-      gdb_assert (dwarf2_per_objfile->ranges.readin);
+      dwarf2_read_section (objfile, &dwarf2_per_objfile->ranges);
       if (offset >= dwarf2_per_objfile->ranges.size)
         {
           complaint (&symfile_complaints,
@@ -10485,6 +10485,7 @@ dwarf2_record_block_ranges (struct die_info *die, struct block *block,
                      offset);
           return;
         }
+      buffer = dwarf2_per_objfile->ranges.buffer + offset;
 
       for (;;)
         {


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

* Re: RFC: fix PR gdb/15538
  2013-04-16  5:54 RFC: fix PR gdb/15538 Tom Tromey
@ 2013-04-16  7:52 ` Pedro Alves
  2013-04-16  7:52   ` Tom Tromey
  2013-05-13 16:54 ` Tom Tromey
  1 sibling, 1 reply; 5+ messages in thread
From: Pedro Alves @ 2013-04-16  7:52 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On 04/15/2013 08:35 PM, Tom Tromey wrote:
> This fixes PR 15538, an assertion failure when reading a certain file.

Bugzilla says 15538 does not exist.

> 
> The bug is that dwarf2_record_block_ranges asserts that the ranges
> section has been read in -- but it can be called without this occurring.

Can you show the backtrace for the archives?

> 
> The fix is to simply read in the section in dwarf2_record_block_ranges.
> 
> I didn't know how to make a test case, so I haven't provided one.
> If this is an issue I will try harder to figure it out.
> 
> Built and regtested on x86-64 Fedora 18.
> The bug reporter also tested it.
> 
> Tom
> 
>     	PR gdb/15538:
>     	* dwarf2read.c (dwarf2_record_block_ranges): Ensure that the
>     	ranges section has been read.
> 
> diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
> index 8947f8f..64fc7da 100644
> --- a/gdb/dwarf2read.c
> +++ b/gdb/dwarf2read.c
> @@ -10458,7 +10458,7 @@ dwarf2_record_block_ranges (struct die_info *die, struct block *block,
>           address range list in the .debug_ranges section.  */
>        unsigned long offset = (DW_UNSND (attr)
>  			      + (need_ranges_base ? cu->ranges_base : 0));
> -      const gdb_byte *buffer = dwarf2_per_objfile->ranges.buffer + offset;
> +      const gdb_byte *buffer;
>  
>        /* For some target architectures, but not others, the
>           read_address function sign-extends the addresses it returns.
> @@ -10477,7 +10477,7 @@ dwarf2_record_block_ranges (struct die_info *die, struct block *block,
>        CORE_ADDR base = cu->base_address;
>        int base_known = cu->base_known;
>  
> -      gdb_assert (dwarf2_per_objfile->ranges.readin);
> +      dwarf2_read_section (objfile, &dwarf2_per_objfile->ranges);
>        if (offset >= dwarf2_per_objfile->ranges.size)
>          {
>            complaint (&symfile_complaints,
> @@ -10485,6 +10485,7 @@ dwarf2_record_block_ranges (struct die_info *die, struct block *block,
>                       offset);
>            return;
>          }
> +      buffer = dwarf2_per_objfile->ranges.buffer + offset;
>  
>        for (;;)
>          {
> 


-- 
Pedro Alves


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

* Re: RFC: fix PR gdb/15538
  2013-04-16  7:52 ` Pedro Alves
@ 2013-04-16  7:52   ` Tom Tromey
  2013-04-16 15:45     ` Tom Tromey
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2013-04-16  7:52 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> Bugzilla says 15538 does not exist.

Transcription error, it is
http://sourceware.org/bugzilla/show_bug.cgi?id=15338

>> The bug is that dwarf2_record_block_ranges asserts that the ranges
>> section has been read in -- but it can be called without this occurring.

Pedro> Can you show the backtrace for the archives?

There isn't one, but I can ask the reporter for it.
I didn't ask earlier since I thought the problem was obvious from the
assertion failure.

Tom


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

* Re: RFC: fix PR gdb/15538
  2013-04-16  7:52   ` Tom Tromey
@ 2013-04-16 15:45     ` Tom Tromey
  0 siblings, 0 replies; 5+ messages in thread
From: Tom Tromey @ 2013-04-16 15:45 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

Tom> There isn't one, but I can ask the reporter for it.
Tom> I didn't ask earlier since I thought the problem was obvious from the
Tom> assertion failure.

There's one in the PR now.

Tom


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

* Re: RFC: fix PR gdb/15538
  2013-04-16  5:54 RFC: fix PR gdb/15538 Tom Tromey
  2013-04-16  7:52 ` Pedro Alves
@ 2013-05-13 16:54 ` Tom Tromey
  1 sibling, 0 replies; 5+ messages in thread
From: Tom Tromey @ 2013-05-13 16:54 UTC (permalink / raw)
  To: gdb-patches

>>>>> "Tom" == Tom Tromey <tromey@redhat.com> writes:

Tom> This fixes PR 15538, an assertion failure when reading a certain file.

I'm checking this in.

Tom


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

end of thread, other threads:[~2013-05-13 16:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-16  5:54 RFC: fix PR gdb/15538 Tom Tromey
2013-04-16  7:52 ` Pedro Alves
2013-04-16  7:52   ` Tom Tromey
2013-04-16 15:45     ` Tom Tromey
2013-05-13 16:54 ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox