From ade8f45eafa16fa00f3b47aeebedd8cb2b9deb23 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Sun, 13 Jan 2002 21:58:16 +0000 Subject: [PATCH] Rewrite target_signal_to_name(). --- gdb/ChangeLog | 5 +++++ gdb/signals.c | 11 +++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d18a67787eb..9ff1de23092 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2002-01-13 Andrew Cagney + + * signals.c (target_signal_to_name): Rewrite. Only use + signals[].name when in bounds and non-NULL. + 2002-01-13 Andrew Cagney From Petr Ledvina : diff --git a/gdb/signals.c b/gdb/signals.c index cf0078d94fc..d37ec06ee9a 100644 --- a/gdb/signals.c +++ b/gdb/signals.c @@ -210,14 +210,13 @@ target_signal_to_string (enum target_signal sig) 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)) + if ((sig >= TARGET_SIGNAL_FIRST) && (sig <= TARGET_SIGNAL_LAST) + && signals[sig].name != NULL) return signals[sig].name; else - return signals[sig].name; + /* 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. */ -- 2.30.2