From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18582 invoked by alias); 5 Oct 2011 14:07:18 -0000 Received: (qmail 18569 invoked by uid 22791); 5 Oct 2011 14:07:16 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-ww0-f43.google.com (HELO mail-ww0-f43.google.com) (74.125.82.43) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 05 Oct 2011 14:06:42 +0000 Received: by wwf27 with SMTP id 27so2044749wwf.12 for ; Wed, 05 Oct 2011 07:06:41 -0700 (PDT) MIME-Version: 1.0 Received: by 10.227.10.136 with SMTP id p8mr3263285wbp.41.1317823600939; Wed, 05 Oct 2011 07:06:40 -0700 (PDT) Received: by 10.180.84.162 with HTTP; Wed, 5 Oct 2011 07:06:40 -0700 (PDT) Date: Wed, 05 Oct 2011 14:07:00 -0000 Message-ID: Subject: A fix for bug 13259 - gdb sometimes crashes with SIGSEGV when printing variables From: Martin Runge To: gdb-patches@sourceware.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-10/txt/msg00136.txt.bz2 Hello together, here is a possible fix for a gdb crash I just filed as bug 13259: --- a/gdb/varobj.c =C2=A0 =C2=A0 =C2=A0Wed Sep 28 12:36:27 2011 +0200 +++ b/gdb/varobj.c =C2=A0 =C2=A0 =C2=A0Wed Oct 05 15:53:04 2011 +0200 @@ -2640,7 +2640,7 @@ =C2=A0 =C2=A0opts.raw =3D 1; =C2=A0 =C2=A0if (thevalue) =C2=A0 =C2=A0 =C2=A0LA_PRINT_STRING (stb, type, thevalue, len, encoding, 0,= &opts); - =C2=A0else if (string_print) + =C2=A0else if (string_print && type !=3D NULL) =C2=A0 =C2=A0 =C2=A0val_print_string (type, encoding, str_addr, len, stb, &= opts); =C2=A0 =C2=A0else =C2=A0 =C2=A0 =C2=A0common_val_print (value, stb, 0, &opts, current_languag= e); I observed the "type" parameter beeing NULL _and_ "string_print" !=3D0 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