From c80049d3b615691dc902762d5d97551aa9664442 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 1 Nov 2017 09:00:09 -0600 Subject: Replace start_rbreak_breakpoints and end_rbreak_breakpoints This replaces start_rbreak_breakpoints and end_rbreak_breakpoints with a new scoped class. This allows the removal of a cleanup. This also fixes an earlier memory leak regression, by changing "string" to be a std::string. gdb/ChangeLog 2017-11-04 Tom Tromey * breakpoint.c (scoped_rbreak_breakpoints::scoped_rbreak_breakpoints): Rename from start_rbreak_breakpoints. (scoped_rbreak_breakpoints): Rename from end_rbreak_breakpoints. * breakpoint.h (class scoped_rbreak_breakpoints): New. (start_rbreak_breakpoints, end_rbreak_breakpoints): Remove. * symtab.c (do_end_rbreak_breakpoints): Remove. (rbreak_command): Use scoped_rbreak_breakpoints, std::string. --- gdb/breakpoint.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'gdb/breakpoint.c') diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 0bf47d5..61e4128 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -644,8 +644,7 @@ static int rbreak_start_breakpoint_count; /* Called at the start an "rbreak" command to record the first breakpoint made. */ -void -start_rbreak_breakpoints (void) +scoped_rbreak_breakpoints::scoped_rbreak_breakpoints () { rbreak_start_breakpoint_count = breakpoint_count; } @@ -653,8 +652,7 @@ start_rbreak_breakpoints (void) /* Called at the end of an "rbreak" command to record the last breakpoint made. */ -void -end_rbreak_breakpoints (void) +scoped_rbreak_breakpoints::~scoped_rbreak_breakpoints () { prev_breakpoint_count = rbreak_start_breakpoint_count; } -- cgit v1.1