diff options
author | Ulrich Weigand <uweigand@de.ibm.com> | 2007-11-17 00:57:01 +0000 |
---|---|---|
committer | Ulrich Weigand <uweigand@de.ibm.com> | 2007-11-17 00:57:01 +0000 |
commit | f0704234779ecc2cae657adc91d615d08dd8fe24 (patch) | |
tree | 3d715678021493729b4ec96da1d68118d6cd0e4c | |
parent | c4ec0cc236efaa90607e43f0a9ead9cf42de8874 (diff) | |
download | gdb-f0704234779ecc2cae657adc91d615d08dd8fe24.zip gdb-f0704234779ecc2cae657adc91d615d08dd8fe24.tar.gz gdb-f0704234779ecc2cae657adc91d615d08dd8fe24.tar.bz2 |
* cli/cli-setshow.c (do_setshow_command): Use dynamically sized buffer
to construct error message if no argument was supplied.
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/cli/cli-setshow.c | 14 |
2 files changed, 15 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 90ca184..e7bd42d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2007-11-16 Ulrich Weigand <uweigand@de.ibm.com> + * cli/cli-setshow.c (do_setshow_command): Use dynamically sized buffer + to construct error message if no argument was supplied. + +2007-11-16 Ulrich Weigand <uweigand@de.ibm.com> + * i386nbsd-tdep.c (i386nbsd_aout_supply_regset): Remove. (i386nbsd_aout_regset_from_core_section): Likewise. (i386nbsd_aout_init_abi): Likewise. diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c index 54f2bd4..6d62a23 100644 --- a/gdb/cli/cli-setshow.c +++ b/gdb/cli/cli-setshow.c @@ -242,16 +242,22 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c) /* if no argument was supplied, print an informative error message */ if (arg == NULL) { - char msg[1024]; - strcpy (msg, "Requires an argument. Valid arguments are "); + char *msg; + int msg_len = 0; + for (i = 0; c->enums[i]; i++) + msg_len += strlen (c->enums[i]) + 2; + + msg = xmalloc (msg_len); + *msg = '\0'; + make_cleanup (xfree, msg); + for (i = 0; c->enums[i]; i++) { if (i != 0) strcat (msg, ", "); strcat (msg, c->enums[i]); } - strcat (msg, "."); - error (("%s"), msg); + error (_("Requires an argument. Valid arguments are %s."), msg); } p = strchr (arg, ' '); |