mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-03 21:34:46 +08:00
Change ada_catchpoint::excep_string to be a std::string
This changes ada_catchpoint::excep_string to be a std::string and then fixes up all t he users. This found a memory leak in catch_ada_exception_command_split, where "cond" was copied but never freed. I changed the type of the "cond_string" argument to catch_ada_exception_command_split to follow the rule that out parameters should be pointers and not references. This patch enables the removal of some cleanups and also the function ada_get_next_arg. ChangeLog 2018-05-21 Tom Tromey <tom@tromey.com> * mi/mi-cmd-catch.c (mi_cmd_catch_assert) (mi_cmd_catch_exception, mi_cmd_catch_handlers): Update. * ada-lang.h (create_ada_exception_catchpoint): Update. * ada-lang.c (struct ada_catchpoint) <excep_string>: Now a std::string. (create_excep_cond_exprs, ~ada_catchpoint) (should_stop_exception, print_one_exception) (print_mention_exception, print_recreate_exception): Update. (ada_get_next_arg): Remove. (catch_ada_exception_command_split): Use std::string. Change type of "excep_string", "cond_string". (catch_ada_exception_command): Update. (create_ada_exception_catchpoint): Change type of excep_string. (ada_exception_sal): Remove excep_string parameter. (~ada_catchpoint): Remove.
This commit is contained in:
@ -1,3 +1,21 @@
|
|||||||
|
2018-05-21 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
|
* mi/mi-cmd-catch.c (mi_cmd_catch_assert)
|
||||||
|
(mi_cmd_catch_exception, mi_cmd_catch_handlers): Update.
|
||||||
|
* ada-lang.h (create_ada_exception_catchpoint): Update.
|
||||||
|
* ada-lang.c (struct ada_catchpoint) <excep_string>: Now a
|
||||||
|
std::string.
|
||||||
|
(create_excep_cond_exprs, ~ada_catchpoint)
|
||||||
|
(should_stop_exception, print_one_exception)
|
||||||
|
(print_mention_exception, print_recreate_exception): Update.
|
||||||
|
(ada_get_next_arg): Remove.
|
||||||
|
(catch_ada_exception_command_split): Use std::string. Change type
|
||||||
|
of "excep_string", "cond_string".
|
||||||
|
(catch_ada_exception_command): Update.
|
||||||
|
(create_ada_exception_catchpoint): Change type of excep_string.
|
||||||
|
(ada_exception_sal): Remove excep_string parameter.
|
||||||
|
(~ada_catchpoint): Remove.
|
||||||
|
|
||||||
2018-05-21 Tom Tromey <tom@tromey.com>
|
2018-05-21 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
* ada-lang.c (ada_collect_symbol_completion_matches): Remove
|
* ada-lang.c (ada_collect_symbol_completion_matches): Remove
|
||||||
|
132
gdb/ada-lang.c
132
gdb/ada-lang.c
@ -12476,10 +12476,8 @@ static const struct bp_location_ops ada_catchpoint_location_ops =
|
|||||||
|
|
||||||
struct ada_catchpoint : public breakpoint
|
struct ada_catchpoint : public breakpoint
|
||||||
{
|
{
|
||||||
~ada_catchpoint () override;
|
|
||||||
|
|
||||||
/* The name of the specific exception the user specified. */
|
/* The name of the specific exception the user specified. */
|
||||||
char *excep_string;
|
std::string excep_string;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Parse the exception condition string in the context of each of the
|
/* Parse the exception condition string in the context of each of the
|
||||||
@ -12492,7 +12490,7 @@ create_excep_cond_exprs (struct ada_catchpoint *c,
|
|||||||
struct bp_location *bl;
|
struct bp_location *bl;
|
||||||
|
|
||||||
/* Nothing to do if there's no specific exception to catch. */
|
/* Nothing to do if there's no specific exception to catch. */
|
||||||
if (c->excep_string == NULL)
|
if (c->excep_string.empty ())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Same if there are no locations... */
|
/* Same if there are no locations... */
|
||||||
@ -12502,7 +12500,7 @@ create_excep_cond_exprs (struct ada_catchpoint *c,
|
|||||||
/* Compute the condition expression in text form, from the specific
|
/* Compute the condition expression in text form, from the specific
|
||||||
expection we want to catch. */
|
expection we want to catch. */
|
||||||
std::string cond_string
|
std::string cond_string
|
||||||
= ada_exception_catchpoint_cond_string (c->excep_string, ex);
|
= ada_exception_catchpoint_cond_string (c->excep_string.c_str (), ex);
|
||||||
|
|
||||||
/* Iterate over all the catchpoint's locations, and parse an
|
/* Iterate over all the catchpoint's locations, and parse an
|
||||||
expression for each. */
|
expression for each. */
|
||||||
@ -12536,13 +12534,6 @@ create_excep_cond_exprs (struct ada_catchpoint *c,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ada_catchpoint destructor. */
|
|
||||||
|
|
||||||
ada_catchpoint::~ada_catchpoint ()
|
|
||||||
{
|
|
||||||
xfree (this->excep_string);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Implement the ALLOCATE_LOCATION method in the breakpoint_ops
|
/* Implement the ALLOCATE_LOCATION method in the breakpoint_ops
|
||||||
structure for all exception catchpoint kinds. */
|
structure for all exception catchpoint kinds. */
|
||||||
|
|
||||||
@ -12583,7 +12574,7 @@ should_stop_exception (const struct bp_location *bl)
|
|||||||
int stop;
|
int stop;
|
||||||
|
|
||||||
/* With no specific exception, should always stop. */
|
/* With no specific exception, should always stop. */
|
||||||
if (c->excep_string == NULL)
|
if (c->excep_string.empty ())
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (ada_loc->excep_cond_expr == NULL)
|
if (ada_loc->excep_cond_expr == NULL)
|
||||||
@ -12733,12 +12724,12 @@ print_one_exception (enum ada_exception_catchpoint_kind ex,
|
|||||||
switch (ex)
|
switch (ex)
|
||||||
{
|
{
|
||||||
case ada_catch_exception:
|
case ada_catch_exception:
|
||||||
if (c->excep_string != NULL)
|
if (!c->excep_string.empty ())
|
||||||
{
|
{
|
||||||
char *msg = xstrprintf (_("`%s' Ada exception"), c->excep_string);
|
std::string msg = string_printf (_("`%s' Ada exception"),
|
||||||
|
c->excep_string.c_str ());
|
||||||
|
|
||||||
uiout->field_string ("what", msg);
|
uiout->field_string ("what", msg);
|
||||||
xfree (msg);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
uiout->field_string ("what", "all Ada exceptions");
|
uiout->field_string ("what", "all Ada exceptions");
|
||||||
@ -12750,11 +12741,11 @@ print_one_exception (enum ada_exception_catchpoint_kind ex,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ada_catch_handlers:
|
case ada_catch_handlers:
|
||||||
if (c->excep_string != NULL)
|
if (!c->excep_string.empty ())
|
||||||
{
|
{
|
||||||
uiout->field_fmt ("what",
|
uiout->field_fmt ("what",
|
||||||
_("`%s' Ada exception handlers"),
|
_("`%s' Ada exception handlers"),
|
||||||
c->excep_string);
|
c->excep_string.c_str ());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
uiout->field_string ("what", "all Ada exceptions handlers");
|
uiout->field_string ("what", "all Ada exceptions handlers");
|
||||||
@ -12788,10 +12779,10 @@ print_mention_exception (enum ada_exception_catchpoint_kind ex,
|
|||||||
switch (ex)
|
switch (ex)
|
||||||
{
|
{
|
||||||
case ada_catch_exception:
|
case ada_catch_exception:
|
||||||
if (c->excep_string != NULL)
|
if (!c->excep_string.empty ())
|
||||||
{
|
{
|
||||||
std::string info = string_printf (_("`%s' Ada exception"),
|
std::string info = string_printf (_("`%s' Ada exception"),
|
||||||
c->excep_string);
|
c->excep_string.c_str ());
|
||||||
uiout->text (info.c_str ());
|
uiout->text (info.c_str ());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -12803,11 +12794,11 @@ print_mention_exception (enum ada_exception_catchpoint_kind ex,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ada_catch_handlers:
|
case ada_catch_handlers:
|
||||||
if (c->excep_string != NULL)
|
if (!c->excep_string.empty ())
|
||||||
{
|
{
|
||||||
std::string info
|
std::string info
|
||||||
= string_printf (_("`%s' Ada exception handlers"),
|
= string_printf (_("`%s' Ada exception handlers"),
|
||||||
c->excep_string);
|
c->excep_string.c_str ());
|
||||||
uiout->text (info.c_str ());
|
uiout->text (info.c_str ());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -12837,8 +12828,8 @@ print_recreate_exception (enum ada_exception_catchpoint_kind ex,
|
|||||||
{
|
{
|
||||||
case ada_catch_exception:
|
case ada_catch_exception:
|
||||||
fprintf_filtered (fp, "catch exception");
|
fprintf_filtered (fp, "catch exception");
|
||||||
if (c->excep_string != NULL)
|
if (!c->excep_string.empty ())
|
||||||
fprintf_filtered (fp, " %s", c->excep_string);
|
fprintf_filtered (fp, " %s", c->excep_string.c_str ());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ada_catch_exception_unhandled:
|
case ada_catch_exception_unhandled:
|
||||||
@ -13047,40 +13038,6 @@ print_recreate_catch_handlers (struct breakpoint *b,
|
|||||||
|
|
||||||
static struct breakpoint_ops catch_handlers_breakpoint_ops;
|
static struct breakpoint_ops catch_handlers_breakpoint_ops;
|
||||||
|
|
||||||
/* Return a newly allocated copy of the first space-separated token
|
|
||||||
in ARGSP, and then adjust ARGSP to point immediately after that
|
|
||||||
token.
|
|
||||||
|
|
||||||
Return NULL if ARGPS does not contain any more tokens. */
|
|
||||||
|
|
||||||
static char *
|
|
||||||
ada_get_next_arg (const char **argsp)
|
|
||||||
{
|
|
||||||
const char *args = *argsp;
|
|
||||||
const char *end;
|
|
||||||
char *result;
|
|
||||||
|
|
||||||
args = skip_spaces (args);
|
|
||||||
if (args[0] == '\0')
|
|
||||||
return NULL; /* No more arguments. */
|
|
||||||
|
|
||||||
/* Find the end of the current argument. */
|
|
||||||
|
|
||||||
end = skip_to_space (args);
|
|
||||||
|
|
||||||
/* Adjust ARGSP to point to the start of the next argument. */
|
|
||||||
|
|
||||||
*argsp = end;
|
|
||||||
|
|
||||||
/* Make a copy of the current argument and return it. */
|
|
||||||
|
|
||||||
result = (char *) xmalloc (end - args + 1);
|
|
||||||
strncpy (result, args, end - args);
|
|
||||||
result[end - args] = '\0';
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Split the arguments specified in a "catch exception" command.
|
/* Split the arguments specified in a "catch exception" command.
|
||||||
Set EX to the appropriate catchpoint type.
|
Set EX to the appropriate catchpoint type.
|
||||||
Set EXCEP_STRING to the name of the specific exception if
|
Set EXCEP_STRING to the name of the specific exception if
|
||||||
@ -13095,24 +13052,20 @@ static void
|
|||||||
catch_ada_exception_command_split (const char *args,
|
catch_ada_exception_command_split (const char *args,
|
||||||
bool is_catch_handlers_cmd,
|
bool is_catch_handlers_cmd,
|
||||||
enum ada_exception_catchpoint_kind *ex,
|
enum ada_exception_catchpoint_kind *ex,
|
||||||
char **excep_string,
|
std::string *excep_string,
|
||||||
std::string &cond_string)
|
std::string *cond_string)
|
||||||
{
|
{
|
||||||
struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
|
std::string exception_name;
|
||||||
char *exception_name;
|
|
||||||
char *cond = NULL;
|
|
||||||
|
|
||||||
exception_name = ada_get_next_arg (&args);
|
exception_name = extract_arg (&args);
|
||||||
if (exception_name != NULL && strcmp (exception_name, "if") == 0)
|
if (exception_name == "if")
|
||||||
{
|
{
|
||||||
/* This is not an exception name; this is the start of a condition
|
/* This is not an exception name; this is the start of a condition
|
||||||
expression for a catchpoint on all exceptions. So, "un-get"
|
expression for a catchpoint on all exceptions. So, "un-get"
|
||||||
this token, and set exception_name to NULL. */
|
this token, and set exception_name to NULL. */
|
||||||
xfree (exception_name);
|
exception_name.clear ();
|
||||||
exception_name = NULL;
|
|
||||||
args -= 2;
|
args -= 2;
|
||||||
}
|
}
|
||||||
make_cleanup (xfree, exception_name);
|
|
||||||
|
|
||||||
/* Check to see if we have a condition. */
|
/* Check to see if we have a condition. */
|
||||||
|
|
||||||
@ -13125,8 +13078,7 @@ catch_ada_exception_command_split (const char *args,
|
|||||||
|
|
||||||
if (args[0] == '\0')
|
if (args[0] == '\0')
|
||||||
error (_("Condition missing after `if' keyword"));
|
error (_("Condition missing after `if' keyword"));
|
||||||
cond = xstrdup (args);
|
*cond_string = args;
|
||||||
make_cleanup (xfree, cond);
|
|
||||||
|
|
||||||
args += strlen (args);
|
args += strlen (args);
|
||||||
}
|
}
|
||||||
@ -13137,25 +13089,23 @@ catch_ada_exception_command_split (const char *args,
|
|||||||
if (args[0] != '\0')
|
if (args[0] != '\0')
|
||||||
error (_("Junk at end of expression"));
|
error (_("Junk at end of expression"));
|
||||||
|
|
||||||
discard_cleanups (old_chain);
|
|
||||||
|
|
||||||
if (is_catch_handlers_cmd)
|
if (is_catch_handlers_cmd)
|
||||||
{
|
{
|
||||||
/* Catch handling of exceptions. */
|
/* Catch handling of exceptions. */
|
||||||
*ex = ada_catch_handlers;
|
*ex = ada_catch_handlers;
|
||||||
*excep_string = exception_name;
|
*excep_string = exception_name;
|
||||||
}
|
}
|
||||||
else if (exception_name == NULL)
|
else if (exception_name.empty ())
|
||||||
{
|
{
|
||||||
/* Catch all exceptions. */
|
/* Catch all exceptions. */
|
||||||
*ex = ada_catch_exception;
|
*ex = ada_catch_exception;
|
||||||
*excep_string = NULL;
|
excep_string->clear ();
|
||||||
}
|
}
|
||||||
else if (strcmp (exception_name, "unhandled") == 0)
|
else if (exception_name == "unhandled")
|
||||||
{
|
{
|
||||||
/* Catch unhandled exceptions. */
|
/* Catch unhandled exceptions. */
|
||||||
*ex = ada_catch_exception_unhandled;
|
*ex = ada_catch_exception_unhandled;
|
||||||
*excep_string = NULL;
|
excep_string->clear ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -13163,8 +13113,6 @@ catch_ada_exception_command_split (const char *args,
|
|||||||
*ex = ada_catch_exception;
|
*ex = ada_catch_exception;
|
||||||
*excep_string = exception_name;
|
*excep_string = exception_name;
|
||||||
}
|
}
|
||||||
if (cond != NULL)
|
|
||||||
cond_string.assign (cond);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the name of the symbol on which we should break in order to
|
/* Return the name of the symbol on which we should break in order to
|
||||||
@ -13288,15 +13236,12 @@ ada_exception_catchpoint_cond_string (const char *excep_string,
|
|||||||
/* Return the symtab_and_line that should be used to insert an exception
|
/* Return the symtab_and_line that should be used to insert an exception
|
||||||
catchpoint of the TYPE kind.
|
catchpoint of the TYPE kind.
|
||||||
|
|
||||||
EXCEP_STRING should contain the name of a specific exception that
|
|
||||||
the catchpoint should catch, or NULL otherwise.
|
|
||||||
|
|
||||||
ADDR_STRING returns the name of the function where the real
|
ADDR_STRING returns the name of the function where the real
|
||||||
breakpoint that implements the catchpoints is set, depending on the
|
breakpoint that implements the catchpoints is set, depending on the
|
||||||
type of catchpoint we need to create. */
|
type of catchpoint we need to create. */
|
||||||
|
|
||||||
static struct symtab_and_line
|
static struct symtab_and_line
|
||||||
ada_exception_sal (enum ada_exception_catchpoint_kind ex, char *excep_string,
|
ada_exception_sal (enum ada_exception_catchpoint_kind ex,
|
||||||
const char **addr_string, const struct breakpoint_ops **ops)
|
const char **addr_string, const struct breakpoint_ops **ops)
|
||||||
{
|
{
|
||||||
const char *sym_name;
|
const char *sym_name;
|
||||||
@ -13332,15 +13277,11 @@ ada_exception_sal (enum ada_exception_catchpoint_kind ex, char *excep_string,
|
|||||||
|
|
||||||
EX_KIND is the kind of exception catchpoint to be created.
|
EX_KIND is the kind of exception catchpoint to be created.
|
||||||
|
|
||||||
If EXCEPT_STRING is NULL, this catchpoint is expected to trigger
|
If EXCEPT_STRING is empty, this catchpoint is expected to trigger
|
||||||
for all exceptions. Otherwise, EXCEPT_STRING indicates the name
|
for all exceptions. Otherwise, EXCEPT_STRING indicates the name
|
||||||
of the exception to which this catchpoint applies. When not NULL,
|
of the exception to which this catchpoint applies.
|
||||||
the string must be allocated on the heap, and its deallocation
|
|
||||||
is no longer the responsibility of the caller.
|
|
||||||
|
|
||||||
COND_STRING, if not NULL, is the catchpoint condition. This string
|
COND_STRING, if not empty, is the catchpoint condition.
|
||||||
must be allocated on the heap, and its deallocation is no longer
|
|
||||||
the responsibility of the caller.
|
|
||||||
|
|
||||||
TEMPFLAG, if nonzero, means that the underlying breakpoint
|
TEMPFLAG, if nonzero, means that the underlying breakpoint
|
||||||
should be temporary.
|
should be temporary.
|
||||||
@ -13350,7 +13291,7 @@ ada_exception_sal (enum ada_exception_catchpoint_kind ex, char *excep_string,
|
|||||||
void
|
void
|
||||||
create_ada_exception_catchpoint (struct gdbarch *gdbarch,
|
create_ada_exception_catchpoint (struct gdbarch *gdbarch,
|
||||||
enum ada_exception_catchpoint_kind ex_kind,
|
enum ada_exception_catchpoint_kind ex_kind,
|
||||||
char *excep_string,
|
const std::string &excep_string,
|
||||||
const std::string &cond_string,
|
const std::string &cond_string,
|
||||||
int tempflag,
|
int tempflag,
|
||||||
int disabled,
|
int disabled,
|
||||||
@ -13358,8 +13299,7 @@ create_ada_exception_catchpoint (struct gdbarch *gdbarch,
|
|||||||
{
|
{
|
||||||
const char *addr_string = NULL;
|
const char *addr_string = NULL;
|
||||||
const struct breakpoint_ops *ops = NULL;
|
const struct breakpoint_ops *ops = NULL;
|
||||||
struct symtab_and_line sal
|
struct symtab_and_line sal = ada_exception_sal (ex_kind, &addr_string, &ops);
|
||||||
= ada_exception_sal (ex_kind, excep_string, &addr_string, &ops);
|
|
||||||
|
|
||||||
std::unique_ptr<ada_catchpoint> c (new ada_catchpoint ());
|
std::unique_ptr<ada_catchpoint> c (new ada_catchpoint ());
|
||||||
init_ada_exception_breakpoint (c.get (), gdbarch, sal, addr_string,
|
init_ada_exception_breakpoint (c.get (), gdbarch, sal, addr_string,
|
||||||
@ -13381,7 +13321,7 @@ catch_ada_exception_command (const char *arg_entry, int from_tty,
|
|||||||
struct gdbarch *gdbarch = get_current_arch ();
|
struct gdbarch *gdbarch = get_current_arch ();
|
||||||
int tempflag;
|
int tempflag;
|
||||||
enum ada_exception_catchpoint_kind ex_kind;
|
enum ada_exception_catchpoint_kind ex_kind;
|
||||||
char *excep_string = NULL;
|
std::string excep_string;
|
||||||
std::string cond_string;
|
std::string cond_string;
|
||||||
|
|
||||||
tempflag = get_cmd_context (command) == CATCH_TEMPORARY;
|
tempflag = get_cmd_context (command) == CATCH_TEMPORARY;
|
||||||
@ -13389,7 +13329,7 @@ catch_ada_exception_command (const char *arg_entry, int from_tty,
|
|||||||
if (!arg)
|
if (!arg)
|
||||||
arg = "";
|
arg = "";
|
||||||
catch_ada_exception_command_split (arg, false, &ex_kind, &excep_string,
|
catch_ada_exception_command_split (arg, false, &ex_kind, &excep_string,
|
||||||
cond_string);
|
&cond_string);
|
||||||
create_ada_exception_catchpoint (gdbarch, ex_kind,
|
create_ada_exception_catchpoint (gdbarch, ex_kind,
|
||||||
excep_string, cond_string,
|
excep_string, cond_string,
|
||||||
tempflag, 1 /* enabled */,
|
tempflag, 1 /* enabled */,
|
||||||
@ -13406,7 +13346,7 @@ catch_ada_handlers_command (const char *arg_entry, int from_tty,
|
|||||||
struct gdbarch *gdbarch = get_current_arch ();
|
struct gdbarch *gdbarch = get_current_arch ();
|
||||||
int tempflag;
|
int tempflag;
|
||||||
enum ada_exception_catchpoint_kind ex_kind;
|
enum ada_exception_catchpoint_kind ex_kind;
|
||||||
char *excep_string = NULL;
|
std::string excep_string;
|
||||||
std::string cond_string;
|
std::string cond_string;
|
||||||
|
|
||||||
tempflag = get_cmd_context (command) == CATCH_TEMPORARY;
|
tempflag = get_cmd_context (command) == CATCH_TEMPORARY;
|
||||||
@ -13414,7 +13354,7 @@ catch_ada_handlers_command (const char *arg_entry, int from_tty,
|
|||||||
if (!arg)
|
if (!arg)
|
||||||
arg = "";
|
arg = "";
|
||||||
catch_ada_exception_command_split (arg, true, &ex_kind, &excep_string,
|
catch_ada_exception_command_split (arg, true, &ex_kind, &excep_string,
|
||||||
cond_string);
|
&cond_string);
|
||||||
create_ada_exception_catchpoint (gdbarch, ex_kind,
|
create_ada_exception_catchpoint (gdbarch, ex_kind,
|
||||||
excep_string, cond_string,
|
excep_string, cond_string,
|
||||||
tempflag, 1 /* enabled */,
|
tempflag, 1 /* enabled */,
|
||||||
|
@ -377,7 +377,7 @@ extern char *ada_main_name (void);
|
|||||||
|
|
||||||
extern void create_ada_exception_catchpoint
|
extern void create_ada_exception_catchpoint
|
||||||
(struct gdbarch *gdbarch, enum ada_exception_catchpoint_kind ex_kind,
|
(struct gdbarch *gdbarch, enum ada_exception_catchpoint_kind ex_kind,
|
||||||
char *excep_string, const std::string &cond_string, int tempflag,
|
const std::string &excep_string, const std::string &cond_string, int tempflag,
|
||||||
int disabled, int from_tty);
|
int disabled, int from_tty);
|
||||||
|
|
||||||
/* Some information about a given Ada exception. */
|
/* Some information about a given Ada exception. */
|
||||||
|
@ -79,8 +79,8 @@ mi_cmd_catch_assert (const char *cmd, char *argv[], int argc)
|
|||||||
error (_("Invalid argument: %s"), argv[oind]);
|
error (_("Invalid argument: %s"), argv[oind]);
|
||||||
|
|
||||||
scoped_restore restore_breakpoint_reporting = setup_breakpoint_reporting ();
|
scoped_restore restore_breakpoint_reporting = setup_breakpoint_reporting ();
|
||||||
create_ada_exception_catchpoint (gdbarch, ada_catch_assert,
|
create_ada_exception_catchpoint (gdbarch, ada_catch_assert, std::string (),
|
||||||
NULL, condition, temp, enabled, 0);
|
condition, temp, enabled, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handler for the -catch-exception command. */
|
/* Handler for the -catch-exception command. */
|
||||||
@ -91,7 +91,7 @@ mi_cmd_catch_exception (const char *cmd, char *argv[], int argc)
|
|||||||
struct gdbarch *gdbarch = get_current_arch();
|
struct gdbarch *gdbarch = get_current_arch();
|
||||||
std::string condition;
|
std::string condition;
|
||||||
int enabled = 1;
|
int enabled = 1;
|
||||||
char *exception_name = NULL;
|
std::string exception_name;
|
||||||
int temp = 0;
|
int temp = 0;
|
||||||
enum ada_exception_catchpoint_kind ex_kind = ada_catch_exception;
|
enum ada_exception_catchpoint_kind ex_kind = ada_catch_exception;
|
||||||
|
|
||||||
@ -148,14 +148,10 @@ mi_cmd_catch_exception (const char *cmd, char *argv[], int argc)
|
|||||||
|
|
||||||
/* Specifying an exception name does not make sense when requesting
|
/* Specifying an exception name does not make sense when requesting
|
||||||
an unhandled exception breakpoint. */
|
an unhandled exception breakpoint. */
|
||||||
if (ex_kind == ada_catch_exception_unhandled && exception_name != NULL)
|
if (ex_kind == ada_catch_exception_unhandled && !exception_name.empty ())
|
||||||
error (_("\"-e\" and \"-u\" are mutually exclusive"));
|
error (_("\"-e\" and \"-u\" are mutually exclusive"));
|
||||||
|
|
||||||
scoped_restore restore_breakpoint_reporting = setup_breakpoint_reporting ();
|
scoped_restore restore_breakpoint_reporting = setup_breakpoint_reporting ();
|
||||||
/* 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);
|
|
||||||
create_ada_exception_catchpoint (gdbarch, ex_kind,
|
create_ada_exception_catchpoint (gdbarch, ex_kind,
|
||||||
exception_name,
|
exception_name,
|
||||||
condition, temp, enabled, 0);
|
condition, temp, enabled, 0);
|
||||||
@ -169,7 +165,7 @@ mi_cmd_catch_handlers (const char *cmd, char *argv[], int argc)
|
|||||||
struct gdbarch *gdbarch = get_current_arch ();
|
struct gdbarch *gdbarch = get_current_arch ();
|
||||||
std::string condition;
|
std::string condition;
|
||||||
int enabled = 1;
|
int enabled = 1;
|
||||||
char *exception_name = NULL;
|
std::string exception_name;
|
||||||
int temp = 0;
|
int temp = 0;
|
||||||
|
|
||||||
int oind = 0;
|
int oind = 0;
|
||||||
@ -220,10 +216,6 @@ mi_cmd_catch_handlers (const char *cmd, char *argv[], int argc)
|
|||||||
|
|
||||||
scoped_restore restore_breakpoint_reporting
|
scoped_restore restore_breakpoint_reporting
|
||||||
= setup_breakpoint_reporting ();
|
= setup_breakpoint_reporting ();
|
||||||
/* 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);
|
|
||||||
create_ada_exception_catchpoint (gdbarch, ada_catch_handlers,
|
create_ada_exception_catchpoint (gdbarch, ada_catch_handlers,
|
||||||
exception_name,
|
exception_name,
|
||||||
condition, temp, enabled, 0);
|
condition, temp, enabled, 0);
|
||||||
|
Reference in New Issue
Block a user