aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-05-03 17:13:04 -0600
committerTom Tromey <tom@tromey.com>2017-09-29 21:12:10 -0600
commita9bc57b97840a874ad2802e29a44fbf557668808 (patch)
treec451edf69a05fe9cc51d876b9be12353cc16bd78
parent9754d8c4c48209eaefb044d03dc25f14dca8a263 (diff)
downloadgdb-a9bc57b97840a874ad2802e29a44fbf557668808.zip
gdb-a9bc57b97840a874ad2802e29a44fbf557668808.tar.gz
gdb-a9bc57b97840a874ad2802e29a44fbf557668808.tar.bz2
Remove make_cleanup_defer_target_commit_resume
This removes make_cleanup_defer_target_commit_resume in favor of using scoped_restore. gdb/ChangeLog 2017-09-29 Tom Tromey <tom@tromey.com> * target.h (make_scoped_defer_target_commit_resume): Update. * target.c (make_scoped_defer_target_commit_resume): Rename from make_cleanup_defer_target_commit_resume. Return a scoped_restore. * infrun.c (proceed): Use make_scoped_defer_target_commit_resume.
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/infrun.c60
-rw-r--r--gdb/target.c10
-rw-r--r--gdb/target.h6
4 files changed, 44 insertions, 40 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 4fa2d49..5d68fb1 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,13 @@
2017-09-29 Tom Tromey <tom@tromey.com>
+ * target.h (make_scoped_defer_target_commit_resume): Update.
+ * target.c (make_scoped_defer_target_commit_resume): Rename from
+ make_cleanup_defer_target_commit_resume. Return a
+ scoped_restore.
+ * infrun.c (proceed): Use make_scoped_defer_target_commit_resume.
+
+2017-09-29 Tom Tromey <tom@tromey.com>
+
* main.c (captured_main_1): Remove unused declaration.
* spu-multiarch.c (parse_spufs_run): Remove unused declaration.
diff --git a/gdb/infrun.c b/gdb/infrun.c
index f44ca91..fba0079 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -2990,7 +2990,6 @@ proceed (CORE_ADDR addr, enum gdb_signal siggnal)
struct execution_control_state ecss;
struct execution_control_state *ecs = &ecss;
struct cleanup *old_chain;
- struct cleanup *defer_resume_cleanup;
int started;
/* If we're stopped at a fork/vfork, follow the branch set by the
@@ -3132,26 +3131,27 @@ proceed (CORE_ADDR addr, enum gdb_signal siggnal)
until the target stops again. */
tp->prev_pc = regcache_read_pc (regcache);
- defer_resume_cleanup = make_cleanup_defer_target_commit_resume ();
+ {
+ scoped_restore save_defer_tc = make_scoped_defer_target_commit_resume ();
- started = start_step_over ();
+ started = start_step_over ();
- if (step_over_info_valid_p ())
- {
- /* Either this thread started a new in-line step over, or some
- other thread was already doing one. In either case, don't
- resume anything else until the step-over is finished. */
- }
- else if (started && !target_is_non_stop_p ())
- {
- /* A new displaced stepping sequence was started. In all-stop,
- we can't talk to the target anymore until it next stops. */
- }
- else if (!non_stop && target_is_non_stop_p ())
- {
- /* In all-stop, but the target is always in non-stop mode.
- Start all other threads that are implicitly resumed too. */
- ALL_NON_EXITED_THREADS (tp)
+ if (step_over_info_valid_p ())
+ {
+ /* Either this thread started a new in-line step over, or some
+ other thread was already doing one. In either case, don't
+ resume anything else until the step-over is finished. */
+ }
+ else if (started && !target_is_non_stop_p ())
+ {
+ /* A new displaced stepping sequence was started. In all-stop,
+ we can't talk to the target anymore until it next stops. */
+ }
+ else if (!non_stop && target_is_non_stop_p ())
+ {
+ /* In all-stop, but the target is always in non-stop mode.
+ Start all other threads that are implicitly resumed too. */
+ ALL_NON_EXITED_THREADS (tp)
{
/* Ignore threads of processes we're not resuming. */
if (!ptid_match (tp->ptid, resume_ptid))
@@ -3187,18 +3187,18 @@ proceed (CORE_ADDR addr, enum gdb_signal siggnal)
if (!ecs->wait_some_more)
error (_("Command aborted."));
}
- }
- else if (!tp->resumed && !thread_is_in_step_over_chain (tp))
- {
- /* The thread wasn't started, and isn't queued, run it now. */
- reset_ecs (ecs, tp);
- switch_to_thread (tp->ptid);
- keep_going_pass_signal (ecs);
- if (!ecs->wait_some_more)
- error (_("Command aborted."));
- }
+ }
+ else if (!tp->resumed && !thread_is_in_step_over_chain (tp))
+ {
+ /* The thread wasn't started, and isn't queued, run it now. */
+ reset_ecs (ecs, tp);
+ switch_to_thread (tp->ptid);
+ keep_going_pass_signal (ecs);
+ if (!ecs->wait_some_more)
+ error (_("Command aborted."));
+ }
+ }
- do_cleanups (defer_resume_cleanup);
target_commit_resume ();
discard_cleanups (old_chain);
diff --git a/gdb/target.c b/gdb/target.c
index 4f574f6..9abaa58 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -2285,14 +2285,10 @@ target_commit_resume (void)
/* See target.h. */
-struct cleanup *
-make_cleanup_defer_target_commit_resume (void)
+scoped_restore_tmpl<int>
+make_scoped_defer_target_commit_resume ()
{
- struct cleanup *old_chain;
-
- old_chain = make_cleanup_restore_integer (&defer_target_commit_resume);
- defer_target_commit_resume = 1;
- return old_chain;
+ return make_scoped_restore (&defer_target_commit_resume, 1);
}
void
diff --git a/gdb/target.h b/gdb/target.h
index d5a5312..87482dc 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -1376,10 +1376,10 @@ extern void target_resume (ptid_t ptid, int step, enum gdb_signal signal);
coalesce multiple resumption requests in a single vCont packet. */
extern void target_commit_resume ();
-/* Setup to defer target_commit_resume calls, and return a cleanup
- that reactivates target_commit_resume, if it was previously
+/* Setup to defer target_commit_resume calls, and reactivate
+ target_commit_resume on destruction, if it was previously
active. */
-struct cleanup *make_cleanup_defer_target_commit_resume ();
+extern scoped_restore_tmpl<int> make_scoped_defer_target_commit_resume ();
/* For target_read_memory see target/target.h. */