From 5436304513349c5447b61f8b5ed6c38d77c5f0d9 Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Thu, 15 Jan 2009 22:07:20 +0000 Subject: [PATCH] * target.h (target_signal_to_string): Make return type const char *. (target_signal_to_name): Ditto. (target_signal_from_name): Make arg const char *. * thread-db.c (thread_db_err_str): Make return type const char *. * utils.c (perror_with_name): Make arg const char *. * infrun.c (sig_print_info): Update. * signals/signals.c (signals): Make array and struct members const. (target_signal_to_string): Make return type const char *. (target_signal_to_name): Ditto. (target_signal_from_name): Make arg const char *. * gdbserver/gdbreplay.c (perror_with_name): Make arg const char *. * gdbserver/server.h (target_signal_to_name): Make return type const char *. --- gdb/ChangeLog | 14 ++++++++++++++ gdb/gdbserver/ChangeLog | 6 ++++++ gdb/gdbserver/gdbreplay.c | 2 +- gdb/gdbserver/server.h | 4 ++-- gdb/gdbserver/thread-db.c | 2 +- gdb/gdbserver/utils.c | 2 +- gdb/infrun.c | 2 +- gdb/signals/signals.c | 12 ++++++------ gdb/target.h | 6 +++--- 9 files changed, 35 insertions(+), 15 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 25da5e20882..d51cff3b0f0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,17 @@ +2009-01-15 Doug Evans + + * target.h (target_signal_to_string): Make return type const char *. + (target_signal_to_name): Ditto. + (target_signal_from_name): Make arg const char *. + * thread-db.c (thread_db_err_str): Make return type const char *. + * utils.c (perror_with_name): Make arg const char *. + * infrun.c (sig_print_info): Update. + + * signals/signals.c (signals): Make array and struct members const. + (target_signal_to_string): Make return type const char *. + (target_signal_to_name): Ditto. + (target_signal_from_name): Make arg const char *. + 2009-01-15 Ulrich Weigand Tristan Gingold diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 53030d94f38..0f73cae5b4f 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,9 @@ +2009-01-15 Doug Evans + + * gdbserver/gdbreplay.c (perror_with_name): Make arg const char *. + * gdbserver/server.h (target_signal_to_name): Make return type + const char *. + 2009-01-14 Pedro Alves * win32-low.c (get_child_debug_event): Issue a final DBG_CONTINUE diff --git a/gdb/gdbserver/gdbreplay.c b/gdb/gdbserver/gdbreplay.c index aec45a57765..99072b52fb9 100644 --- a/gdb/gdbserver/gdbreplay.c +++ b/gdb/gdbserver/gdbreplay.c @@ -131,7 +131,7 @@ strerror (DWORD error) Then return to command level. */ static void -perror_with_name (char *string) +perror_with_name (const char *string) { #ifndef STDC_HEADERS extern int errno; diff --git a/gdb/gdbserver/server.h b/gdb/gdbserver/server.h index 62901612940..5b02dbe32cc 100644 --- a/gdb/gdbserver/server.h +++ b/gdb/gdbserver/server.h @@ -269,14 +269,14 @@ void buffer_xml_printf (struct buffer *buffer, const char *format, ...) enum target_signal target_signal_from_host (int hostsig); int target_signal_to_host_p (enum target_signal oursig); int target_signal_to_host (enum target_signal oursig); -char *target_signal_to_name (enum target_signal); +const char *target_signal_to_name (enum target_signal); /* Functions from utils.c */ void *xmalloc (size_t) ATTR_MALLOC; void *xcalloc (size_t, size_t) ATTR_MALLOC; char *xstrdup (const char *) ATTR_MALLOC; -void perror_with_name (char *string); +void perror_with_name (const char *string); void error (const char *string,...) ATTR_NORETURN ATTR_FORMAT (printf, 1, 2); void fatal (const char *string,...) ATTR_NORETURN ATTR_FORMAT (printf, 1, 2); void warning (const char *string,...) ATTR_FORMAT (printf, 1, 2); diff --git a/gdb/gdbserver/thread-db.c b/gdb/gdbserver/thread-db.c index 659b9bf1f28..e36b0fbab12 100644 --- a/gdb/gdbserver/thread-db.c +++ b/gdb/gdbserver/thread-db.c @@ -45,7 +45,7 @@ static td_thragent_t *thread_agent; static int find_one_thread (int); static int find_new_threads_callback (const td_thrhandle_t *th_p, void *data); -static char * +static const char * thread_db_err_str (td_err_e err) { static char buf[64]; diff --git a/gdb/gdbserver/utils.c b/gdb/gdbserver/utils.c index 174afd0fc1f..7d309dd7295 100644 --- a/gdb/gdbserver/utils.c +++ b/gdb/gdbserver/utils.c @@ -92,7 +92,7 @@ xstrdup (const char *s) Then return to command level. */ void -perror_with_name (char *string) +perror_with_name (const char *string) { const char *err; char *combined; diff --git a/gdb/infrun.c b/gdb/infrun.c index 8dcc1bfaea5..09869394511 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -4464,7 +4464,7 @@ Signal Stop\tPrint\tPass to program\tDescription\n")); static void sig_print_info (enum target_signal oursig) { - char *name = target_signal_to_name (oursig); + const char *name = target_signal_to_name (oursig); int name_padding = 13 - strlen (name); if (name_padding <= 0) diff --git a/gdb/signals/signals.c b/gdb/signals/signals.c index 034e1c65592..af1b92ec169 100644 --- a/gdb/signals/signals.c +++ b/gdb/signals/signals.c @@ -50,9 +50,9 @@ struct gdbarch; /* This table must match in order and size the signals in enum target_signal in src/include/gdb/signals.h. */ /* *INDENT-OFF* */ -static struct { - char *name; - char *string; +static const struct { + const char *name; + const char *string; } signals [] = { {"0", "Signal 0"}, @@ -219,7 +219,7 @@ static struct { /* Return the string for a signal. */ -char * +const char * target_signal_to_string (enum target_signal sig) { if ((int) sig >= TARGET_SIGNAL_FIRST && (int) sig <= TARGET_SIGNAL_LAST) @@ -229,7 +229,7 @@ target_signal_to_string (enum target_signal sig) } /* Return the name for a signal. */ -char * +const char * target_signal_to_name (enum target_signal sig) { if ((int) sig >= TARGET_SIGNAL_FIRST && (int) sig <= TARGET_SIGNAL_LAST @@ -243,7 +243,7 @@ target_signal_to_name (enum target_signal sig) /* Given a name, return its signal. */ enum target_signal -target_signal_from_name (char *name) +target_signal_from_name (const char *name) { enum target_signal sig; diff --git a/gdb/target.h b/gdb/target.h index caf6384b5af..188c9a4f95c 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -174,13 +174,13 @@ enum inferior_event_type }; /* Return the string for a signal. */ -extern char *target_signal_to_string (enum target_signal); +extern const char *target_signal_to_string (enum target_signal); /* Return the name (SIGHUP, etc.) for a signal. */ -extern char *target_signal_to_name (enum target_signal); +extern const char *target_signal_to_name (enum target_signal); /* Given a name (SIGHUP, etc.), return its signal. */ -enum target_signal target_signal_from_name (char *); +enum target_signal target_signal_from_name (const char *); /* Target objects which can be transfered using target_read, target_write, et cetera. */ -- 2.30.2