aboutsummaryrefslogtreecommitdiff
path: root/gdb/mi
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/mi')
-rw-r--r--gdb/mi/mi-cmd-break.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/gdb/mi/mi-cmd-break.c b/gdb/mi/mi-cmd-break.c
index dab0a47..408f582 100644
--- a/gdb/mi/mi-cmd-break.c
+++ b/gdb/mi/mi-cmd-break.c
@@ -182,7 +182,8 @@ mi_cmd_break_insert_1 (int dprintf, const char *command, char **argv, int argc)
location_spec_up locspec;
const struct breakpoint_ops *ops;
int is_explicit = 0;
- struct explicit_location explicit_loc;
+ std::unique_ptr<explicit_location_spec> explicit_loc
+ (new explicit_location_spec ());
std::string extra_string;
bool force_condition = false;
@@ -220,8 +221,6 @@ mi_cmd_break_insert_1 (int dprintf, const char *command, char **argv, int argc)
int oind = 0;
char *oarg;
- initialize_explicit_location (&explicit_loc);
-
while (1)
{
int opt = mi_getopt ("-break-insert", argc, argv,
@@ -259,19 +258,19 @@ mi_cmd_break_insert_1 (int dprintf, const char *command, char **argv, int argc)
break;
case EXPLICIT_SOURCE_OPT:
is_explicit = 1;
- explicit_loc.source_filename = oarg;
+ explicit_loc->source_filename = xstrdup (oarg);
break;
case EXPLICIT_FUNC_OPT:
is_explicit = 1;
- explicit_loc.function_name = oarg;
+ explicit_loc->function_name = xstrdup (oarg);
break;
case EXPLICIT_LABEL_OPT:
is_explicit = 1;
- explicit_loc.label_name = oarg;
+ explicit_loc->label_name = xstrdup (oarg);
break;
case EXPLICIT_LINE_OPT:
is_explicit = 1;
- explicit_loc.line_offset = linespec_parse_line_offset (oarg);
+ explicit_loc->line_offset = linespec_parse_line_offset (oarg);
break;
case FORCE_CONDITION_OPT:
force_condition = true;
@@ -339,16 +338,16 @@ mi_cmd_break_insert_1 (int dprintf, const char *command, char **argv, int argc)
{
/* Error check -- we must have one of the other
parameters specified. */
- if (explicit_loc.source_filename != NULL
- && explicit_loc.function_name == NULL
- && explicit_loc.label_name == NULL
- && explicit_loc.line_offset.sign == LINE_OFFSET_UNKNOWN)
+ if (explicit_loc->source_filename != NULL
+ && explicit_loc->function_name == NULL
+ && explicit_loc->label_name == NULL
+ && explicit_loc->line_offset.sign == LINE_OFFSET_UNKNOWN)
error (_("-%s-insert: --source option requires --function, --label,"
" or --line"), dprintf ? "dprintf" : "break");
- explicit_loc.func_name_match_type = match_type;
+ explicit_loc->func_name_match_type = match_type;
- locspec = new_explicit_location_spec (&explicit_loc);
+ locspec = std::move (explicit_loc);
}
else
{