mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-19 09:14:14 +08:00
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.
This commit is contained in:
@ -321,7 +321,22 @@ extern int get_tracepoint_number (void);
|
||||
etc.). */
|
||||
extern void set_current_traceframe (int num);
|
||||
|
||||
struct cleanup *make_cleanup_restore_current_traceframe (void);
|
||||
struct scoped_restore_current_traceframe
|
||||
{
|
||||
scoped_restore_current_traceframe ();
|
||||
|
||||
~scoped_restore_current_traceframe ()
|
||||
{
|
||||
set_current_traceframe (m_traceframe_number);
|
||||
}
|
||||
|
||||
DISABLE_COPY_AND_ASSIGN (scoped_restore_current_traceframe);
|
||||
|
||||
private:
|
||||
|
||||
/* The traceframe we were inspecting. */
|
||||
int m_traceframe_number;
|
||||
};
|
||||
|
||||
void free_actions (struct breakpoint *);
|
||||
|
||||
|
Reference in New Issue
Block a user