From 281d762b1a56317171e462666b98d50bfa31a08a Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 21 Feb 2018 16:53:56 -0700 Subject: Remove cleanups from check_fast_tracepoint_sals This changes the gdbarch fast_tracepoint_valid_at method to use a std::string as its out parameter, and then updates all the uses. This allows removing a cleanup from breakpoint.c. Regression tested by the buildbot. ChangeLog 2018-02-24 Tom Tromey * i386-tdep.c (i386_fast_tracepoint_valid_at): "msg" now a std::string. * gdbarch.sh (fast_tracepoint_valid_at): Change "msg" to a std::string*. * gdbarch.c: Rebuild. * gdbarch.h: Rebuild. * breakpoint.c (check_fast_tracepoint_sals): Use std::string. * arch-utils.h (default_fast_tracepoint_valid_at): Update. * arch-utils.c (default_fast_tracepoint_valid_at): "msg" now a std::string*. --- gdb/breakpoint.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'gdb/breakpoint.c') diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 91ecca6..c56084c 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -9177,10 +9177,6 @@ static void check_fast_tracepoint_sals (struct gdbarch *gdbarch, gdb::array_view sals) { - int rslt; - char *msg; - struct cleanup *old_chain; - for (const auto &sal : sals) { struct gdbarch *sarch; @@ -9190,14 +9186,10 @@ check_fast_tracepoint_sals (struct gdbarch *gdbarch, associated with SAL. */ if (sarch == NULL) sarch = gdbarch; - rslt = gdbarch_fast_tracepoint_valid_at (sarch, sal.pc, &msg); - old_chain = make_cleanup (xfree, msg); - - if (!rslt) + std::string msg; + if (!gdbarch_fast_tracepoint_valid_at (sarch, sal.pc, &msg)) error (_("May not have a fast tracepoint at %s%s"), - paddress (sarch, sal.pc), (msg ? msg : "")); - - do_cleanups (old_chain); + paddress (sarch, sal.pc), msg.c_str ()); } } -- cgit v1.1