GNU Binutils with patches for OS216
修订版 | 00f675ff65ff6f78712a46e9699856e935d86d86 (tree) |
---|---|
时间 | 2017-09-12 07:15:07 |
作者 | Tom Tromey <tom@trom...> |
Commiter | Tom Tromey |
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.
@@ -1,5 +1,15 @@ | ||
1 | 1 | 2017-09-11 Tom Tromey <tom@tromey.com> |
2 | 2 | |
3 | + * mi/mi-cmd-catch.c (mi_cmd_catch_assert) | |
4 | + (mi_cmd_catch_exception, mi_catch_load_unload): Update. | |
5 | + * mi/mi-cmd-break.c (setup_breakpoint_reporting): Return a | |
6 | + scoped_restore. | |
7 | + (mi_cmd_break_insert_1): Update. | |
8 | + * mi/mi-cmd-break.h (setup_breakpoint_reporting): Return a | |
9 | + scoped_restore. | |
10 | + | |
11 | +2017-09-11 Tom Tromey <tom@tromey.com> | |
12 | + | |
3 | 13 | * demangle.c (demangle_command): Update. |
4 | 14 | * breakpoint.c (disable_command): Update. |
5 | 15 | (enable_command): Update. |
@@ -64,26 +64,22 @@ enum bp_type | ||
64 | 64 | }; |
65 | 65 | |
66 | 66 | /* Arrange for all new breakpoints and catchpoints to be reported to |
67 | - CURRENT_UIOUT until the cleanup returned by this function is run. | |
67 | + CURRENT_UIOUT until the destructor of the returned scoped_restore | |
68 | + is run. | |
68 | 69 | |
69 | 70 | Note that MI output will be probably invalid if more than one |
70 | 71 | breakpoint is created inside one MI command. */ |
71 | 72 | |
72 | -struct cleanup * | |
73 | +scoped_restore_tmpl<int> | |
73 | 74 | setup_breakpoint_reporting (void) |
74 | 75 | { |
75 | - struct cleanup *rev_flag; | |
76 | - | |
77 | 76 | if (! mi_breakpoint_observers_installed) |
78 | 77 | { |
79 | 78 | observer_attach_breakpoint_created (breakpoint_notify); |
80 | 79 | mi_breakpoint_observers_installed = 1; |
81 | 80 | } |
82 | 81 | |
83 | - rev_flag = make_cleanup_restore_integer (&mi_can_breakpoint_notify); | |
84 | - mi_can_breakpoint_notify = 1; | |
85 | - | |
86 | - return rev_flag; | |
82 | + return make_scoped_restore (&mi_can_breakpoint_notify, 1); | |
87 | 83 | } |
88 | 84 | |
89 | 85 |
@@ -301,7 +297,7 @@ mi_cmd_break_insert_1 (int dprintf, const char *command, char **argv, int argc) | ||
301 | 297 | } |
302 | 298 | |
303 | 299 | /* Now we have what we need, let's insert the breakpoint! */ |
304 | - setup_breakpoint_reporting (); | |
300 | + scoped_restore restore_breakpoint_reporting = setup_breakpoint_reporting (); | |
305 | 301 | |
306 | 302 | if (tracepoint) |
307 | 303 | { |
@@ -21,10 +21,11 @@ | ||
21 | 21 | #ifndef MI_CMD_BREAK_H |
22 | 22 | #define MI_CMD_BREAK_H |
23 | 23 | |
24 | +#include "common/scoped_restore.h" | |
24 | 25 | |
25 | 26 | /* Setup the reporting of the insertion of a new breakpoint or |
26 | 27 | catchpoint. */ |
27 | -struct cleanup *setup_breakpoint_reporting (void); | |
28 | +scoped_restore_tmpl<int> setup_breakpoint_reporting (void); | |
28 | 29 | |
29 | 30 | #endif |
30 | 31 |
@@ -79,7 +79,7 @@ mi_cmd_catch_assert (const char *cmd, char *argv[], int argc) | ||
79 | 79 | if (oind != argc) |
80 | 80 | error (_("Invalid argument: %s"), argv[oind]); |
81 | 81 | |
82 | - setup_breakpoint_reporting (); | |
82 | + scoped_restore restore_breakpoint_reporting = setup_breakpoint_reporting (); | |
83 | 83 | /* create_ada_exception_catchpoint needs CONDITION to be xstrdup'ed, |
84 | 84 | and will assume control of its lifetime. */ |
85 | 85 | if (condition != NULL) |
@@ -156,7 +156,7 @@ mi_cmd_catch_exception (const char *cmd, char *argv[], int argc) | ||
156 | 156 | if (ex_kind == ada_catch_exception_unhandled && exception_name != NULL) |
157 | 157 | error (_("\"-e\" and \"-u\" are mutually exclusive")); |
158 | 158 | |
159 | - setup_breakpoint_reporting (); | |
159 | + scoped_restore restore_breakpoint_reporting = setup_breakpoint_reporting (); | |
160 | 160 | /* create_ada_exception_catchpoint needs EXCEPTION_NAME and CONDITION |
161 | 161 | to be xstrdup'ed, and will assume control of their lifetime. */ |
162 | 162 | if (exception_name != NULL) |
@@ -173,7 +173,6 @@ mi_cmd_catch_exception (const char *cmd, char *argv[], int argc) | ||
173 | 173 | static void |
174 | 174 | mi_catch_load_unload (int load, char *argv[], int argc) |
175 | 175 | { |
176 | - struct cleanup *back_to; | |
177 | 176 | const char *actual_cmd = load ? "-catch-load" : "-catch-unload"; |
178 | 177 | int temp = 0; |
179 | 178 | int enabled = 1; |
@@ -215,11 +214,8 @@ mi_catch_load_unload (int load, char *argv[], int argc) | ||
215 | 214 | if (oind < argc -1) |
216 | 215 | error (_("-catch-load/unload: Garbage following the <library name>")); |
217 | 216 | |
218 | - back_to = setup_breakpoint_reporting (); | |
219 | - | |
217 | + scoped_restore restore_breakpoint_reporting = setup_breakpoint_reporting (); | |
220 | 218 | add_solib_catchpoint (argv[oind], load, temp, enabled); |
221 | - | |
222 | - do_cleanups (back_to); | |
223 | 219 | } |
224 | 220 | |
225 | 221 | /* Handler for the -catch-load. */ |