bool is_catch_handlers_cmd,
enum ada_exception_catchpoint_kind *ex,
char **excep_string,
- char **cond_string)
+ std::string &cond_string)
{
struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
char *exception_name;
*ex = ada_catch_exception;
*excep_string = exception_name;
}
- *cond_string = cond;
+ if (cond != NULL)
+ cond_string.assign (cond);
}
/* Return the name of the symbol on which we should break in order to
create_ada_exception_catchpoint (struct gdbarch *gdbarch,
enum ada_exception_catchpoint_kind ex_kind,
char *excep_string,
- char *cond_string,
+ const std::string &cond_string,
int tempflag,
int disabled,
int from_tty)
ops, tempflag, disabled, from_tty);
c->excep_string = excep_string;
create_excep_cond_exprs (c.get (), ex_kind);
- if (cond_string != NULL)
- set_breakpoint_condition (c.get (), cond_string, from_tty);
+ if (!cond_string.empty ())
+ set_breakpoint_condition (c.get (), cond_string.c_str (), from_tty);
install_breakpoint (0, std::move (c), 1);
}
int tempflag;
enum ada_exception_catchpoint_kind ex_kind;
char *excep_string = NULL;
- char *cond_string = NULL;
+ std::string cond_string;
tempflag = get_cmd_context (command) == CATCH_TEMPORARY;
if (!arg)
arg = "";
catch_ada_exception_command_split (arg, false, &ex_kind, &excep_string,
- &cond_string);
+ cond_string);
create_ada_exception_catchpoint (gdbarch, ex_kind,
excep_string, cond_string,
tempflag, 1 /* enabled */,
int tempflag;
enum ada_exception_catchpoint_kind ex_kind;
char *excep_string = NULL;
- char *cond_string = NULL;
+ std::string cond_string;
tempflag = get_cmd_context (command) == CATCH_TEMPORARY;
if (!arg)
arg = "";
catch_ada_exception_command_split (arg, true, &ex_kind, &excep_string,
- &cond_string);
+ cond_string);
create_ada_exception_catchpoint (gdbarch, ex_kind,
excep_string, cond_string,
tempflag, 1 /* enabled */,
(the memory needs to be deallocated after use). */
static void
-catch_ada_assert_command_split (const char *args, char **cond_string)
+catch_ada_assert_command_split (const char *args, std::string &cond_string)
{
args = skip_spaces (args);
args = skip_spaces (args);
if (args[0] == '\0')
error (_("condition missing after `if' keyword"));
- *cond_string = xstrdup (args);
+ cond_string.assign (args);
}
/* Otherwise, there should be no other argument at the end of
const char *arg = arg_entry;
struct gdbarch *gdbarch = get_current_arch ();
int tempflag;
- char *cond_string = NULL;
+ std::string cond_string;
tempflag = get_cmd_context (command) == CATCH_TEMPORARY;
if (!arg)
arg = "";
- catch_ada_assert_command_split (arg, &cond_string);
+ catch_ada_assert_command_split (arg, cond_string);
create_ada_exception_catchpoint (gdbarch, ada_catch_assert,
NULL, cond_string,
tempflag, 1 /* enabled */,
mi_cmd_catch_assert (const char *cmd, char *argv[], int argc)
{
struct gdbarch *gdbarch = get_current_arch();
- char *condition = NULL;
+ std::string condition;
int enabled = 1;
int temp = 0;
switch ((enum opt) opt)
{
case OPT_CONDITION:
- condition = oarg;
+ condition.assign (oarg);
break;
case OPT_DISABLED:
enabled = 0;
error (_("Invalid argument: %s"), argv[oind]);
scoped_restore restore_breakpoint_reporting = setup_breakpoint_reporting ();
- /* create_ada_exception_catchpoint needs CONDITION to be xstrdup'ed,
- and will assume control of its lifetime. */
- if (condition != NULL)
- condition = xstrdup (condition);
create_ada_exception_catchpoint (gdbarch, ada_catch_assert,
NULL, condition, temp, enabled, 0);
}
mi_cmd_catch_exception (const char *cmd, char *argv[], int argc)
{
struct gdbarch *gdbarch = get_current_arch();
- char *condition = NULL;
+ std::string condition;
int enabled = 1;
char *exception_name = NULL;
int temp = 0;
switch ((enum opt) opt)
{
case OPT_CONDITION:
- condition = oarg;
+ condition.assign (oarg);
break;
case OPT_DISABLED:
enabled = 0;
error (_("\"-e\" and \"-u\" are mutually exclusive"));
scoped_restore restore_breakpoint_reporting = setup_breakpoint_reporting ();
- /* create_ada_exception_catchpoint needs EXCEPTION_NAME and CONDITION
- to be xstrdup'ed, and will assume control of their lifetime. */
+ /* create_ada_exception_catchpoint needs EXCEPTION_NAME to be
+ xstrdup'ed, and will assume control of its lifetime. */
if (exception_name != NULL)
exception_name = xstrdup (exception_name);
- if (condition != NULL)
- condition = xstrdup (condition);
create_ada_exception_catchpoint (gdbarch, ex_kind,
exception_name, condition,
temp, enabled, 0);