This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

A fix for bug 13259 - gdb sometimes crashes with SIGSEGV when printing variables


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]