aboutsummaryrefslogtreecommitdiff
path: root/gdb/infrun.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2018-04-07 14:03:12 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2018-04-07 14:03:12 -0400
commit6f14adc55864818ec3754460f5df4150c2addf42 (patch)
tree5ed8e7dccc5aeb3cc905394943a56fb21dddfaf9 /gdb/infrun.c
parentb2bdb8cf395f491319264cda42e41538f55a86d9 (diff)
downloadgdb-6f14adc55864818ec3754460f5df4150c2addf42.zip
gdb-6f14adc55864818ec3754460f5df4150c2addf42.tar.gz
gdb-6f14adc55864818ec3754460f5df4150c2addf42.tar.bz2
Replace make_cleanup_restore_current_traceframe with RAII class
I put the constructor in tracepoint.c because it needs to read traceframe_number, and I prefer to do that than to expose traceframe_number. gdb/ChangeLog: * tracepoint.c (struct current_traceframe_cleanup): Remove. (do_restore_current_traceframe_cleanup): Remove. (restore_current_traceframe_cleanup_dtor): Remove. (make_cleanup_restore_current_traceframe): Remove. (scoped_restore_current_traceframe::scoped_restore_current_traceframe): New. * tracepoint.h (struct scoped_restore_current_traceframe): New. * infrun.c (fetch_inferior_event): Use scoped_restore_current_traceframe.
Diffstat (limited to 'gdb/infrun.c')
-rw-r--r--gdb/infrun.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 6648698..d89f813 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -3877,9 +3877,10 @@ fetch_inferior_event (void *client_data)
debugging. If we're looking at traceframes while the target is
running, we're going to need to get back to that mode after
handling the event. */
+ gdb::optional<scoped_restore_current_traceframe> maybe_restore_traceframe;
if (non_stop)
{
- make_cleanup_restore_current_traceframe ();
+ maybe_restore_traceframe.emplace ();
set_current_traceframe (-1);
}