diff options
author | Tom Tromey <tom@tromey.com> | 2017-09-10 14:48:30 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2017-09-11 15:46:14 -0600 |
commit | cb791d59489576280e416262eb61ab59765a0baf (patch) | |
tree | 16a968a28a8926f82e69990be93b5f86dec81ae3 /gdb/break-catch-sig.c | |
parent | 2039bd9f0ce667f3f0ee99c18e25de1ea18a2288 (diff) | |
download | binutils-gdb-cb791d59489576280e416262eb61ab59765a0baf.tar.gz |
Make extract_arg return a std::string
Change extract_arg to return a std::string and fix up all the users.
I think string is mildly better than unique_xmalloc_ptr<char>, when
possible, because it provides a more robust API.
I changed the error messages emitted from find_location_by_number to
avoid either writing to a string or an extra allocation; this can be
changed but I thought that the new message was not any less clear.
You can see an example in the testsuite patch.
ChangeLog
2017-09-11 Tom Tromey <tom@tromey.com>
* demangle.c (demangle_command): Update.
* breakpoint.c (disable_command): Update.
(enable_command): Update.
(find_location_by_number): Make "number" const. Use
get_number_trailer.
* cli/cli-utils.c (extract_arg): Return std::string.
* probe.c (parse_probe_linespec): Update. Change types.
(collect_probes): Take string arguments.
(parse_probe_linespec): Likewise.
(info_probes_for_ops): Update.
(enable_probes_command): Update.
(disable_probes_command): Update.
* break-catch-sig.c (catch_signal_split_args): Update.
* mi/mi-parse.c (mi_parse): Update.
testsuite/ChangeLog
2017-09-11 Tom Tromey <tom@tromey.com>
* gdb.base/ena-dis-br.exp (test_ena_dis_br): Update test.
Diffstat (limited to 'gdb/break-catch-sig.c')
-rw-r--r-- | gdb/break-catch-sig.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/gdb/break-catch-sig.c b/gdb/break-catch-sig.c index 805084fda1f..5bc3aed09d7 100644 --- a/gdb/break-catch-sig.c +++ b/gdb/break-catch-sig.c @@ -343,12 +343,12 @@ catch_signal_split_args (char *arg, bool *catch_all) gdb_signal signal_number; char *endptr; - gdb::unique_xmalloc_ptr<char> one_arg (extract_arg (&arg)); - if (one_arg == NULL) + std::string one_arg = extract_arg (&arg); + if (one_arg.empty ()) break; /* Check for the special flag "all". */ - if (strcmp (one_arg.get (), "all") == 0) + if (one_arg == "all") { arg = skip_spaces (arg); if (*arg != '\0' || !first) @@ -361,14 +361,14 @@ catch_signal_split_args (char *arg, bool *catch_all) first = false; /* Check if the user provided a signal name or a number. */ - num = (int) strtol (one_arg.get (), &endptr, 0); + num = (int) strtol (one_arg.c_str (), &endptr, 0); if (*endptr == '\0') signal_number = gdb_signal_from_command (num); else { - signal_number = gdb_signal_from_name (one_arg.get ()); + signal_number = gdb_signal_from_name (one_arg.c_str ()); if (signal_number == GDB_SIGNAL_UNKNOWN) - error (_("Unknown signal name '%s'."), one_arg.get ()); + error (_("Unknown signal name '%s'."), one_arg.c_str ()); } result.push_back (signal_number); |