public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [gdb patch] seg fault on missing dwarf
@ 2017-09-25 20:33 Nathan Sidwell
  2017-09-26 14:27 ` Pedro Alves
  0 siblings, 1 reply; 4+ messages in thread
From: Nathan Sidwell @ 2017-09-25 20:33 UTC (permalink / raw)
  To: gdb-patches; +Cc: palves, alexander.v.shaposhnikov

[-- Attachment #1: Type: text/plain, Size: 512 bytes --]

Pedro,
this is Alex's patch of 
https://sourceware.org/ml/gdb-patches/2017-09/msg00745.html cleaned up 
with changelog formatting.  Alex is a fellow FaceBooker.

The patch looks obvious to me, particularly as a few lines down we have:

       fprintf_unfiltered (gdb_stdlog,
			  "    %s CUs, %s TUs\n",
			  pulongest (dwp_file->cus ? dwp_file->cus->nr_units : 0),
			  pulongest (dwp_file->tus ? dwp_file->tus->nr_units : 0));

to protect dump output from exactly this problem.

ok?

nathan
-- 
Nathan Sidwell

[-- Attachment #2: gdb-null.diff --]
[-- Type: text/x-patch, Size: 1171 bytes --]

2017-09-25  Alexander Shaposhnikov <alexander.v.shaposhnikov@gmail.com>
	
	* dwarf2read.c (open_and_init_dwp_file): Protect against dwp_file
	having NULL cus or tus.

diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index b1914cf..547e3f0 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -11185,7 +11185,8 @@ open_and_init_dwp_file (void)
   dwp_file->tus = create_dwp_hash_table (dwp_file, 1);
 
   /* The DWP file version is stored in the hash table.  Oh well.  */
-  if (dwp_file->cus->version != dwp_file->tus->version)
+  if (dwp_file->cus && dwp_file->tus
+      && dwp_file->cus->version != dwp_file->tus->version)
     {
       /* Technically speaking, we should try to limp along, but this is
 	 pretty bizarre.  We use pulongest here because that's the established
@@ -11195,7 +11196,7 @@ open_and_init_dwp_file (void)
 	     pulongest (dwp_file->cus->version),
 	     pulongest (dwp_file->tus->version), dwp_name.c_str ());
     }
-  dwp_file->version = dwp_file->cus->version;
+  dwp_file->version = dwp_file->cus ? dwp_file->cus->version : 0;
 
   if (dwp_file->version == 2)
     bfd_map_over_sections (dwp_file->dbfd, dwarf2_locate_v2_dwp_sections,

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

* Re: [gdb patch] seg fault on missing dwarf
  2017-09-25 20:33 [gdb patch] seg fault on missing dwarf Nathan Sidwell
@ 2017-09-26 14:27 ` Pedro Alves
  2017-09-26 23:05   ` Nathan Sidwell
  0 siblings, 1 reply; 4+ messages in thread
From: Pedro Alves @ 2017-09-26 14:27 UTC (permalink / raw)
  To: Nathan Sidwell, gdb-patches; +Cc: alexander.v.shaposhnikov

Hi Nathan,

On 09/25/2017 09:33 PM, Nathan Sidwell wrote:
> Pedro,
> this is Alex's patch of
> https://sourceware.org/ml/gdb-patches/2017-09/msg00745.html cleaned up
> with changelog formatting.  Alex is a fellow FaceBooker.

FYI, Doug reviewed Alex's patch:
  https://sourceware.org/ml/gdb-patches/2017-09/msg00779.html

Thanks,
Pedro Alves

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

* Re: [gdb patch] seg fault on missing dwarf
  2017-09-26 14:27 ` Pedro Alves
@ 2017-09-26 23:05   ` Nathan Sidwell
  2017-09-26 23:12     ` Alexander Shaposhnikov
  0 siblings, 1 reply; 4+ messages in thread
From: Nathan Sidwell @ 2017-09-26 23:05 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches; +Cc: alexander.v.shaposhnikov

On 09/26/2017 07:27 AM, Pedro Alves wrote:
> Hi Nathan,
> 
> On 09/25/2017 09:33 PM, Nathan Sidwell wrote:
>> Pedro,
>> this is Alex's patch of
>> https://sourceware.org/ml/gdb-patches/2017-09/msg00745.html cleaned up
>> with changelog formatting.  Alex is a fellow FaceBooker.
> 
> FYI, Doug reviewed Alex's patch:
>    https://sourceware.org/ml/gdb-patches/2017-09/msg00779.html

Ah, I see the state changed between me checking and actually sending 
email :) Alex, do you need me to commit this on your behalf?

nathan

-- 
Nathan Sidwell

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

* Re: [gdb patch] seg fault on missing dwarf
  2017-09-26 23:05   ` Nathan Sidwell
@ 2017-09-26 23:12     ` Alexander Shaposhnikov
  0 siblings, 0 replies; 4+ messages in thread
From: Alexander Shaposhnikov @ 2017-09-26 23:12 UTC (permalink / raw)
  To: Nathan Sidwell, Doug Evans; +Cc: Pedro Alves, gdb-patches

Many thanks to everyone for looking at my patch,
i sent the final version (updated following Doug Evans suggestion) this
morning
https://sourceware.org/ml/gdb-patches/2017-09/msg00814.html
- so yeah, i would be very grateful if smb could commit this for me.

Regarding the separate issue with the dependence on the order of sections
(unrelated to this patch) - i'm currently preparing a bug report - will
file it to bugzilla soon.
Kind regards,
Alexander Shaposhnikov




On Tue, Sep 26, 2017 at 4:05 PM, Nathan Sidwell <nathan@acm.org> wrote:

> On 09/26/2017 07:27 AM, Pedro Alves wrote:
>
>> Hi Nathan,
>>
>> On 09/25/2017 09:33 PM, Nathan Sidwell wrote:
>>
>>> Pedro,
>>> this is Alex's patch of
>>> https://sourceware.org/ml/gdb-patches/2017-09/msg00745.html cleaned up
>>> with changelog formatting.  Alex is a fellow FaceBooker.
>>>
>>
>> FYI, Doug reviewed Alex's patch:
>>    https://sourceware.org/ml/gdb-patches/2017-09/msg00779.html
>>
>
> Ah, I see the state changed between me checking and actually sending email
> :) Alex, do you need me to commit this on your behalf?
>
> nathan
>
> --
> Nathan Sidwell
>

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

end of thread, other threads:[~2017-09-26 23:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-25 20:33 [gdb patch] seg fault on missing dwarf Nathan Sidwell
2017-09-26 14:27 ` Pedro Alves
2017-09-26 23:05   ` Nathan Sidwell
2017-09-26 23:12     ` Alexander Shaposhnikov

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).