From 8dcc53b37f4fe4797825c2a43bb1fb3df56b30d1 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 7 Jun 2018 15:34:36 -0600 Subject: Remove cleanups from btrace code This removes some cleanups from the btrace code by minorly C++-ifying struct btrace_data. gdb/ChangeLog 2018-06-08 Tom Tromey * common/btrace-common.h (struct btrace_data): Add constructor, destructor, move assignment operator. : New methods. : Initialize. (btrace_data_init, btrace_data_fini, btrace_data_clear) (btrace_data_empty): Don't declare. * common/btrace-common.c (btrace_data_init): Remove. (btrace_data::fini): Rename from btrace_data_fini. (btrace_data::empty): Rename from btrace_data_empty. (btrace_data::clear): Rename from btrace_data_clear. Return bool. * btrace.h (make_cleanup_btrace_data): Don't declare. * btrace.c (btrace_add_pc, btrace_stitch_trace, btrace_clear) (parse_xml_btrace): Update. (do_btrace_data_cleanup, make_cleanup_btrace_data): Remove. (maint_btrace_clear_packet_history_cmd): Update. gdb/gdbserver/ChangeLog 2018-06-08 Tom Tromey * linux-low.c (linux_low_read_btrace): Update. --- gdb/gdbserver/ChangeLog | 4 ++++ gdb/gdbserver/linux-low.c | 13 +++---------- 2 files changed, 7 insertions(+), 10 deletions(-) (limited to 'gdb/gdbserver') diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 3bd9a68..4e55c36 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,7 @@ +2018-06-08 Tom Tromey + + * linux-low.c (linux_low_read_btrace): Update. + 2018-06-04 Stan Cox * server.h (struct client_state): New. diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index f8507b7..1211944 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -7250,8 +7250,6 @@ linux_low_read_btrace (struct btrace_target_info *tinfo, struct buffer *buffer, enum btrace_error err; int i; - btrace_data_init (&btrace); - err = linux_read_btrace (&btrace, tinfo, type); if (err != BTRACE_ERR_NONE) { @@ -7260,14 +7258,14 @@ linux_low_read_btrace (struct btrace_target_info *tinfo, struct buffer *buffer, else buffer_grow_str0 (buffer, "E.Generic Error."); - goto err; + return -1; } switch (btrace.format) { case BTRACE_FORMAT_NONE: buffer_grow_str0 (buffer, "E.No Trace."); - goto err; + return -1; case BTRACE_FORMAT_BTS: buffer_grow_str (buffer, "\n"); @@ -7298,15 +7296,10 @@ linux_low_read_btrace (struct btrace_target_info *tinfo, struct buffer *buffer, default: buffer_grow_str0 (buffer, "E.Unsupported Trace Format."); - goto err; + return -1; } - btrace_data_fini (&btrace); return 0; - -err: - btrace_data_fini (&btrace); - return -1; } /* See to_btrace_conf target method. */ -- cgit v1.1