• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

修订版00f675ff65ff6f78712a46e9699856e935d86d86 (tree)
时间2017-09-12 07:15:07
作者Tom Tromey <tom@trom...>
CommiterTom Tromey

Log Message

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.

更改概述

差异

--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,15 @@
11 2017-09-11 Tom Tromey <tom@tromey.com>
22
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+
313 * demangle.c (demangle_command): Update.
414 * breakpoint.c (disable_command): Update.
515 (enable_command): Update.
--- a/gdb/mi/mi-cmd-break.c
+++ b/gdb/mi/mi-cmd-break.c
@@ -64,26 +64,22 @@ enum bp_type
6464 };
6565
6666 /* 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.
6869
6970 Note that MI output will be probably invalid if more than one
7071 breakpoint is created inside one MI command. */
7172
72-struct cleanup *
73+scoped_restore_tmpl<int>
7374 setup_breakpoint_reporting (void)
7475 {
75- struct cleanup *rev_flag;
76-
7776 if (! mi_breakpoint_observers_installed)
7877 {
7978 observer_attach_breakpoint_created (breakpoint_notify);
8079 mi_breakpoint_observers_installed = 1;
8180 }
8281
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);
8783 }
8884
8985
@@ -301,7 +297,7 @@ mi_cmd_break_insert_1 (int dprintf, const char *command, char **argv, int argc)
301297 }
302298
303299 /* Now we have what we need, let's insert the breakpoint! */
304- setup_breakpoint_reporting ();
300+ scoped_restore restore_breakpoint_reporting = setup_breakpoint_reporting ();
305301
306302 if (tracepoint)
307303 {
--- a/gdb/mi/mi-cmd-break.h
+++ b/gdb/mi/mi-cmd-break.h
@@ -21,10 +21,11 @@
2121 #ifndef MI_CMD_BREAK_H
2222 #define MI_CMD_BREAK_H
2323
24+#include "common/scoped_restore.h"
2425
2526 /* Setup the reporting of the insertion of a new breakpoint or
2627 catchpoint. */
27-struct cleanup *setup_breakpoint_reporting (void);
28+scoped_restore_tmpl<int> setup_breakpoint_reporting (void);
2829
2930 #endif
3031
--- a/gdb/mi/mi-cmd-catch.c
+++ b/gdb/mi/mi-cmd-catch.c
@@ -79,7 +79,7 @@ mi_cmd_catch_assert (const char *cmd, char *argv[], int argc)
7979 if (oind != argc)
8080 error (_("Invalid argument: %s"), argv[oind]);
8181
82- setup_breakpoint_reporting ();
82+ scoped_restore restore_breakpoint_reporting = setup_breakpoint_reporting ();
8383 /* create_ada_exception_catchpoint needs CONDITION to be xstrdup'ed,
8484 and will assume control of its lifetime. */
8585 if (condition != NULL)
@@ -156,7 +156,7 @@ mi_cmd_catch_exception (const char *cmd, char *argv[], int argc)
156156 if (ex_kind == ada_catch_exception_unhandled && exception_name != NULL)
157157 error (_("\"-e\" and \"-u\" are mutually exclusive"));
158158
159- setup_breakpoint_reporting ();
159+ scoped_restore restore_breakpoint_reporting = setup_breakpoint_reporting ();
160160 /* create_ada_exception_catchpoint needs EXCEPTION_NAME and CONDITION
161161 to be xstrdup'ed, and will assume control of their lifetime. */
162162 if (exception_name != NULL)
@@ -173,7 +173,6 @@ mi_cmd_catch_exception (const char *cmd, char *argv[], int argc)
173173 static void
174174 mi_catch_load_unload (int load, char *argv[], int argc)
175175 {
176- struct cleanup *back_to;
177176 const char *actual_cmd = load ? "-catch-load" : "-catch-unload";
178177 int temp = 0;
179178 int enabled = 1;
@@ -215,11 +214,8 @@ mi_catch_load_unload (int load, char *argv[], int argc)
215214 if (oind < argc -1)
216215 error (_("-catch-load/unload: Garbage following the <library name>"));
217216
218- back_to = setup_breakpoint_reporting ();
219-
217+ scoped_restore restore_breakpoint_reporting = setup_breakpoint_reporting ();
220218 add_solib_catchpoint (argv[oind], load, temp, enabled);
221-
222- do_cleanups (back_to);
223219 }
224220
225221 /* Handler for the -catch-load. */