From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3887 invoked by alias); 13 Jan 2002 21:55:03 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 3845 invoked from network); 13 Jan 2002 21:54:57 -0000 Received: from unknown (HELO localhost.cygnus.com) (24.114.42.213) by sources.redhat.com with SMTP; 13 Jan 2002 21:54:57 -0000 Received: from cygnus.com (localhost [127.0.0.1]) by localhost.cygnus.com (Postfix) with ESMTP id 6DFDE3D1F; Sun, 13 Jan 2002 16:54:57 -0500 (EST) Message-ID: <3C420231.9000300@cygnus.com> Date: Sun, 13 Jan 2002 13:55:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:0.9.7) Gecko/20020103 X-Accept-Language: en-us MIME-Version: 1.0 To: Daniel Jacobowitz Cc: Petr Ledvina , gdb-patches@sources.redhat.com Subject: Re: bug in gdb/target.c:target_signal_to_name References: <3C41F7AD.7040708@cygnus.com> <20020113161243.A1272@nevyn.them.org> Content-Type: multipart/mixed; boundary="------------050207020508030403000106" X-SW-Source: 2002-01/txt/msg00363.txt.bz2 This is a multi-part message in MIME format. --------------050207020508030403000106 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-length: 622 > On Sun, Jan 13, 2002 at 04:10:05PM -0500, Andrew Cagney wrote: > >> --- 214,223 ---- >> /* I think the code which prints this will always print it along with >> the string, so no need to be verbose. */ >> return "?"; >> ! else if ((sig >= TARGET_SIGNAL_FIRST) && (sig <= TARGET_SIGNAL_LAST)) >> ! return signals[sig].name; >> ! else >> ! return signals[sig].name; >> } >> > /* Given a name, return its signal. */ > > > That's probably not what you meant to commit, since both cases are the > same. Er, no. Lets try the attached. Turns out that signals[TARGET_SIGNAL_UNKNOWN].name is NULL. Andrew --------------050207020508030403000106 Content-Type: text/plain; name="diffs" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diffs" Content-length: 1352 2002-01-13 Andrew Cagney * signals.c (target_signal_to_name): Rewrite. Only use signals[].name when in bounds and non-NULL. Index: signals.c =================================================================== RCS file: /cvs/src/src/gdb/signals.c,v retrieving revision 1.2 diff -p -r1.2 signals.c *** signals.c 2002/01/13 21:11:38 1.2 --- signals.c 2002/01/13 21:51:26 *************** target_signal_to_string (enum target_sig *** 210,223 **** char * target_signal_to_name (enum target_signal sig) { ! if (sig == TARGET_SIGNAL_UNKNOWN) ! /* I think the code which prints this will always print it along with ! the string, so no need to be verbose. */ ! return "?"; ! else if ((sig >= TARGET_SIGNAL_FIRST) && (sig <= TARGET_SIGNAL_LAST)) return signals[sig].name; else ! return signals[sig].name; } /* Given a name, return its signal. */ --- 210,222 ---- char * target_signal_to_name (enum target_signal sig) { ! if ((sig >= TARGET_SIGNAL_FIRST) && (sig <= TARGET_SIGNAL_LAST) ! && signals[sig].name != NULL) return signals[sig].name; else ! /* I think the code which prints this will always print it along ! with the string, so no need to be verbose (very old comment). */ ! return "?"; } /* Given a name, return its signal. */ --------------050207020508030403000106--