Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Martin Runge <martin.runge@web.de>
To: gdb-patches@sourceware.org
Subject: A fix for bug 13259 - gdb sometimes crashes with SIGSEGV when printing variables
Date: Wed, 05 Oct 2011 14:07:00 -0000	[thread overview]
Message-ID: <CAF4KFGogYaeRzr6_i8fcGhO-SPr3eSdyppxVha57R_sqo2s1ng@mail.gmail.com> (raw)

Hello together,
here is a possible fix for a gdb crash I just filed as bug 13259:


--- a/gdb/varobj.c      Wed Sep 28 12:36:27 2011 +0200
+++ b/gdb/varobj.c      Wed Oct 05 15:53:04 2011 +0200
@@ -2640,7 +2640,7 @@
   opts.raw = 1;
   if (thevalue)
     LA_PRINT_STRING (stb, type, thevalue, len, encoding, 0, &opts);
-  else if (string_print)
+  else if (string_print && type != NULL)
     val_print_string (type, encoding, str_addr, len, stb, &opts);
   else
     common_val_print (value, stb, 0, &opts, current_language);


I observed the "type" parameter beeing NULL _and_ "string_print" !=0
several times, which leads to a SIGSEGV inside val_print_string.

Maybe the cause is a few lines earlier in the same function
(value_get_print_value), where string_print is set to 1 without having
resolved "type".

best regards
Martin


             reply	other threads:[~2011-10-05 14:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-05 14:07 Martin Runge [this message]
2011-10-05 15:02 ` Joel Brobecker
2011-10-05 15:11   ` Martin Runge
2011-10-06 13:27     ` Martin Runge
2011-10-06 18:37       ` Joel Brobecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAF4KFGogYaeRzr6_i8fcGhO-SPr3eSdyppxVha57R_sqo2s1ng@mail.gmail.com \
    --to=martin.runge@web.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox