From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25025 invoked by alias); 23 Jul 2012 17:57:17 -0000 Received: (qmail 25017 invoked by uid 22791); 23 Jul 2012 17:57:16 -0000 X-SWARE-Spam-Status: No, hits=-6.1 required=5.0 tests=AWL,BAYES_00,KAM_STOCKGEN,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 23 Jul 2012 17:56:57 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q6NHuubp028332 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 23 Jul 2012 13:56:56 -0400 Received: from valrhona.uglyboxes.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q6NHusVO002880 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO) for ; Mon, 23 Jul 2012 13:56:55 -0400 Message-ID: <500D9065.3000805@redhat.com> Date: Mon, 23 Jul 2012 17:57:00 -0000 From: Keith Seitz User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120605 Thunderbird/13.0 MIME-Version: 1.0 To: "gdb-patches@sourceware.org ml" Subject: Re: [RFA 1/2] Linespec rewrite (update 2) References: <4F70F8F7.503@redhat.com> <87zkb0wj1x.fsf@fleche.redhat.com> <4F74B583.6090008@redhat.com> <87obrertls.fsf@fleche.redhat.com> <4F75D859.1010907@redhat.com> <87r4waqc38.fsf@fleche.redhat.com> <20120330170913.GT2701@adacore.com> <87fwcqq8gl.fsf@fleche.redhat.com> <4F75F5F5.8070105@redhat.com> <4F7B8610.9070302@redhat.com> In-Reply-To: Content-Type: multipart/mixed; boundary="------------000503000908000600070706" 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: 2012-07/txt/msg00460.txt.bz2 This is a multi-part message in MIME format. --------------000503000908000600070706 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 684 On 07/22/2012 12:32 PM, Andreas Schwab wrote: > Keith Seitz writes: > >> + for (i = 0; VEC_iterate (symbolp, ls->labels.label_symbols, i, sym); ++i) >> + { >> + symbol_to_sal (&sal, state->funfirstline, sym); >> + add_sal_to_sals (state, &sals, &sal, >> + SYMBOL_NATURAL_NAME (sym)); > > If symbol_to_sal returns 0 then sal is uninitialized. > Nice catch, Andreas. I propose the attached patch. I guess this should be considered for inclusion on 7.5. [What say ye?] Keith ChangeLog 2012-07-23 Keith Seitz * linespec.c (convert_linespec_to_sal): Don't add any symbols to the result vector if symbol_to_sal returns zero. --------------000503000908000600070706 Content-Type: text/x-patch; name="uninitialized_sal-from-symbol_to_sal.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="uninitialized_sal-from-symbol_to_sal.patch" Content-length: 1271 Index: linespec.c =================================================================== RCS file: /cvs/src/src/gdb/linespec.c,v retrieving revision 1.162 diff -u -p -r1.162 linespec.c --- linespec.c 18 Jul 2012 20:38:18 -0000 1.162 +++ linespec.c 23 Jul 2012 17:54:48 -0000 @@ -1860,9 +1860,9 @@ convert_linespec_to_sals (struct linespe for (i = 0; VEC_iterate (symbolp, ls->labels.label_symbols, i, sym); ++i) { - symbol_to_sal (&sal, state->funfirstline, sym); - add_sal_to_sals (state, &sals, &sal, - SYMBOL_NATURAL_NAME (sym), 0); + if (symbol_to_sal (&sal, state->funfirstline, sym)) + add_sal_to_sals (state, &sals, &sal, + SYMBOL_NATURAL_NAME (sym), 0); } } else if (ls->function_symbols != NULL || ls->minimal_symbols != NULL) @@ -1886,8 +1886,8 @@ convert_linespec_to_sals (struct linespe { pspace = SYMTAB_PSPACE (SYMBOL_SYMTAB (sym)); set_current_program_space (pspace); - symbol_to_sal (&sal, state->funfirstline, sym); - if (maybe_add_address (state->addr_set, pspace, sal.pc)) + if (symbol_to_sal (&sal, state->funfirstline, sym) + && maybe_add_address (state->addr_set, pspace, sal.pc)) add_sal_to_sals (state, &sals, &sal, SYMBOL_NATURAL_NAME (sym), 0); } --------------000503000908000600070706--