forked from Imagelibrary/binutils-gdb
Change setup_breakpoint_reporting to return a scoped_restore
This changes setup_breakpoint_reporting to return a scoped_restore, allowing for some cleanup removal. ChangeLog 2017-09-11 Tom Tromey <tom@tromey.com> * mi/mi-cmd-catch.c (mi_cmd_catch_assert) (mi_cmd_catch_exception, mi_catch_load_unload): Update. * mi/mi-cmd-break.c (setup_breakpoint_reporting): Return a scoped_restore. (mi_cmd_break_insert_1): Update. * mi/mi-cmd-break.h (setup_breakpoint_reporting): Return a scoped_restore.
This commit is contained in:
@@ -1,3 +1,13 @@
|
|||||||
|
2017-09-11 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
|
* mi/mi-cmd-catch.c (mi_cmd_catch_assert)
|
||||||
|
(mi_cmd_catch_exception, mi_catch_load_unload): Update.
|
||||||
|
* mi/mi-cmd-break.c (setup_breakpoint_reporting): Return a
|
||||||
|
scoped_restore.
|
||||||
|
(mi_cmd_break_insert_1): Update.
|
||||||
|
* mi/mi-cmd-break.h (setup_breakpoint_reporting): Return a
|
||||||
|
scoped_restore.
|
||||||
|
|
||||||
2017-09-11 Tom Tromey <tom@tromey.com>
|
2017-09-11 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
* demangle.c (demangle_command): Update.
|
* demangle.c (demangle_command): Update.
|
||||||
|
|||||||
@@ -64,26 +64,22 @@ enum bp_type
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Arrange for all new breakpoints and catchpoints to be reported to
|
/* Arrange for all new breakpoints and catchpoints to be reported to
|
||||||
CURRENT_UIOUT until the cleanup returned by this function is run.
|
CURRENT_UIOUT until the destructor of the returned scoped_restore
|
||||||
|
is run.
|
||||||
|
|
||||||
Note that MI output will be probably invalid if more than one
|
Note that MI output will be probably invalid if more than one
|
||||||
breakpoint is created inside one MI command. */
|
breakpoint is created inside one MI command. */
|
||||||
|
|
||||||
struct cleanup *
|
scoped_restore_tmpl<int>
|
||||||
setup_breakpoint_reporting (void)
|
setup_breakpoint_reporting (void)
|
||||||
{
|
{
|
||||||
struct cleanup *rev_flag;
|
|
||||||
|
|
||||||
if (! mi_breakpoint_observers_installed)
|
if (! mi_breakpoint_observers_installed)
|
||||||
{
|
{
|
||||||
observer_attach_breakpoint_created (breakpoint_notify);
|
observer_attach_breakpoint_created (breakpoint_notify);
|
||||||
mi_breakpoint_observers_installed = 1;
|
mi_breakpoint_observers_installed = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
rev_flag = make_cleanup_restore_integer (&mi_can_breakpoint_notify);
|
return make_scoped_restore (&mi_can_breakpoint_notify, 1);
|
||||||
mi_can_breakpoint_notify = 1;
|
|
||||||
|
|
||||||
return rev_flag;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -301,7 +297,7 @@ mi_cmd_break_insert_1 (int dprintf, const char *command, char **argv, int argc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Now we have what we need, let's insert the breakpoint! */
|
/* Now we have what we need, let's insert the breakpoint! */
|
||||||
setup_breakpoint_reporting ();
|
scoped_restore restore_breakpoint_reporting = setup_breakpoint_reporting ();
|
||||||
|
|
||||||
if (tracepoint)
|
if (tracepoint)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,10 +21,11 @@
|
|||||||
#ifndef MI_CMD_BREAK_H
|
#ifndef MI_CMD_BREAK_H
|
||||||
#define MI_CMD_BREAK_H
|
#define MI_CMD_BREAK_H
|
||||||
|
|
||||||
|
#include "common/scoped_restore.h"
|
||||||
|
|
||||||
/* Setup the reporting of the insertion of a new breakpoint or
|
/* Setup the reporting of the insertion of a new breakpoint or
|
||||||
catchpoint. */
|
catchpoint. */
|
||||||
struct cleanup *setup_breakpoint_reporting (void);
|
scoped_restore_tmpl<int> setup_breakpoint_reporting (void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ mi_cmd_catch_assert (const char *cmd, char *argv[], int argc)
|
|||||||
if (oind != argc)
|
if (oind != argc)
|
||||||
error (_("Invalid argument: %s"), argv[oind]);
|
error (_("Invalid argument: %s"), argv[oind]);
|
||||||
|
|
||||||
setup_breakpoint_reporting ();
|
scoped_restore restore_breakpoint_reporting = setup_breakpoint_reporting ();
|
||||||
/* create_ada_exception_catchpoint needs CONDITION to be xstrdup'ed,
|
/* create_ada_exception_catchpoint needs CONDITION to be xstrdup'ed,
|
||||||
and will assume control of its lifetime. */
|
and will assume control of its lifetime. */
|
||||||
if (condition != NULL)
|
if (condition != NULL)
|
||||||
@@ -156,7 +156,7 @@ mi_cmd_catch_exception (const char *cmd, char *argv[], int argc)
|
|||||||
if (ex_kind == ada_catch_exception_unhandled && exception_name != NULL)
|
if (ex_kind == ada_catch_exception_unhandled && exception_name != NULL)
|
||||||
error (_("\"-e\" and \"-u\" are mutually exclusive"));
|
error (_("\"-e\" and \"-u\" are mutually exclusive"));
|
||||||
|
|
||||||
setup_breakpoint_reporting ();
|
scoped_restore restore_breakpoint_reporting = setup_breakpoint_reporting ();
|
||||||
/* create_ada_exception_catchpoint needs EXCEPTION_NAME and CONDITION
|
/* create_ada_exception_catchpoint needs EXCEPTION_NAME and CONDITION
|
||||||
to be xstrdup'ed, and will assume control of their lifetime. */
|
to be xstrdup'ed, and will assume control of their lifetime. */
|
||||||
if (exception_name != NULL)
|
if (exception_name != NULL)
|
||||||
@@ -173,7 +173,6 @@ mi_cmd_catch_exception (const char *cmd, char *argv[], int argc)
|
|||||||
static void
|
static void
|
||||||
mi_catch_load_unload (int load, char *argv[], int argc)
|
mi_catch_load_unload (int load, char *argv[], int argc)
|
||||||
{
|
{
|
||||||
struct cleanup *back_to;
|
|
||||||
const char *actual_cmd = load ? "-catch-load" : "-catch-unload";
|
const char *actual_cmd = load ? "-catch-load" : "-catch-unload";
|
||||||
int temp = 0;
|
int temp = 0;
|
||||||
int enabled = 1;
|
int enabled = 1;
|
||||||
@@ -215,11 +214,8 @@ mi_catch_load_unload (int load, char *argv[], int argc)
|
|||||||
if (oind < argc -1)
|
if (oind < argc -1)
|
||||||
error (_("-catch-load/unload: Garbage following the <library name>"));
|
error (_("-catch-load/unload: Garbage following the <library name>"));
|
||||||
|
|
||||||
back_to = setup_breakpoint_reporting ();
|
scoped_restore restore_breakpoint_reporting = setup_breakpoint_reporting ();
|
||||||
|
|
||||||
add_solib_catchpoint (argv[oind], load, temp, enabled);
|
add_solib_catchpoint (argv[oind], load, temp, enabled);
|
||||||
|
|
||||||
do_cleanups (back_to);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handler for the -catch-load. */
|
/* Handler for the -catch-load. */
|
||||||
|
|||||||
Reference in New Issue
Block a user