From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27415 invoked by alias); 5 Jul 2007 23:06:39 -0000 Received: (qmail 27406 invoked by uid 22791); 5 Jul 2007 23:06:39 -0000 X-Spam-Check-By: sourceware.org Received: from b.mail.sonic.net (HELO b.mail.sonic.net) (64.142.19.5) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 05 Jul 2007 23:06:34 +0000 Received: from webmail.sonic.net (b.webmail.sonic.net [64.142.100.148]) by b.mail.sonic.net (8.13.8.Beta0-Sonic/8.13.7) with ESMTP id l65N6VIX015808 for ; Thu, 5 Jul 2007 16:06:32 -0700 Received: from 12.7.175.2 (SquirrelMail authenticated user msnyder) by webmail.sonic.net with HTTP; Thu, 5 Jul 2007 16:06:31 -0700 (PDT) Message-ID: <24899.12.7.175.2.1183676791.squirrel@webmail.sonic.net> Date: Thu, 05 Jul 2007 23:06:00 -0000 Subject: [patch] stack.c, check return value of lookup_symbol From: msnyder@sonic.net To: gdb-patches@sourceware.org User-Agent: SquirrelMail/1.4.9a MIME-Version: 1.0 Content-Type: multipart/mixed;boundary="----=_20070705160631_74254" 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: 2007-07/txt/msg00103.txt.bz2 ------=_20070705160631_74254 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Content-length: 282 Since it's known that lookup_symbol can return NULL, my first impulse was to call gdb_assert. That still might be the right thing to do, since it indicates some sort of internal fault -- but it seems to me that it isn't necessarily fatal, and simply doing nothing is an option... ------=_20070705160631_74254 Content-Type: text/plain; name="nsym2.txt" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="nsym2.txt" Content-length: 1207 2007-07-05 Michael Snyder * stack.c (print_frame_args): Check return value of lookup_symbol (Coverity). Index: stack.c =================================================================== RCS file: /cvs/src/src/gdb/stack.c,v retrieving revision 1.149 diff -p -r1.149 stack.c *** stack.c 18 Jun 2007 18:28:29 -0000 1.149 --- stack.c 5 Jul 2007 23:04:35 -0000 *************** print_frame_args (struct symbol *func, s *** 247,253 **** struct symbol *nsym; nsym = lookup_symbol (DEPRECATED_SYMBOL_NAME (sym), b, VAR_DOMAIN, NULL, NULL); ! if (SYMBOL_CLASS (nsym) == LOC_REGISTER) { /* There is a LOC_ARG/LOC_REGISTER pair. This means that it was passed on the stack and loaded into a --- 247,257 ---- struct symbol *nsym; nsym = lookup_symbol (DEPRECATED_SYMBOL_NAME (sym), b, VAR_DOMAIN, NULL, NULL); ! if (nsym == NULL) ! /* Not sure what to do here, but doing nothing ! should be safe... */ ! ; ! else if (SYMBOL_CLASS (nsym) == LOC_REGISTER) { /* There is a LOC_ARG/LOC_REGISTER pair. This means that it was passed on the stack and loaded into a ------=_20070705160631_74254--