From 6f14adc55864818ec3754460f5df4150c2addf42 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Sat, 7 Apr 2018 14:03:12 -0400 Subject: 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. --- gdb/infrun.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gdb/infrun.c') 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 maybe_restore_traceframe; if (non_stop) { - make_cleanup_restore_current_traceframe (); + maybe_restore_traceframe.emplace (); set_current_traceframe (-1); } -- cgit v1.1