aboutsummaryrefslogtreecommitdiff
path: root/gdb/disasm.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/disasm.c')
-rw-r--r--gdb/disasm.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/gdb/disasm.c b/gdb/disasm.c
index 7f730f6..c788f5b 100644
--- a/gdb/disasm.c
+++ b/gdb/disasm.c
@@ -39,7 +39,7 @@
/* This variable is used to hold the prospective disassembler_options value
which is set by the "set disassembler_options" command. */
-static char *prospective_options = NULL;
+static std::string prospective_options;
/* This structure is used to store line number information for the
deprecated /m option.
@@ -928,13 +928,16 @@ get_disassembler_options (struct gdbarch *gdbarch)
}
void
-set_disassembler_options (char *prospective_options)
+set_disassembler_options (const char *prospective_options)
{
struct gdbarch *gdbarch = get_current_arch ();
char **disassembler_options = gdbarch_disassembler_options (gdbarch);
const disasm_options_and_args_t *valid_options_and_args;
const disasm_options_t *valid_options;
- char *options = remove_whitespace_and_extra_commas (prospective_options);
+ gdb::unique_xmalloc_ptr<char> prospective_options_local
+ = make_unique_xstrdup (prospective_options);
+ char *options = remove_whitespace_and_extra_commas
+ (prospective_options_local.get ());
const char *opt;
/* Allow all architectures, even ones that do not support 'set disassembler',
@@ -1003,7 +1006,7 @@ static void
set_disassembler_options_sfunc (const char *args, int from_tty,
struct cmd_list_element *c)
{
- set_disassembler_options (prospective_options);
+ set_disassembler_options (prospective_options.c_str ());
}
static void