From 5d9310c4b88f807c1a3f1a0b4d7b6c10925dcaf7 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Thu, 22 Mar 2018 00:27:19 -0400 Subject: Get rid of VEC(static_tracepoint_marker_p) This patch replaces VEC(static_tracepoint_marker_p) with std::vector, and does some c++ification around that. I thought a new overload of hex2str was useful, so I added it as well as corresponding unit tests. I also added an overload of ui_out::field_string that takes an std::string directly. gdb/ChangeLog: * tracepoint.h (struct static_tracepoint_marker): Initialize fields, define default constructor, move constructor and move assignment, disable the rest. : Make std::string. (release_static_tracepoint_marker): Remove. (free_current_marker): Remove. * tracepoint.c (free_current_marker): Remove. (parse_static_tracepoint_marker_definition): Adjust to std::string, use new hex2str overload. (release_static_tracepoint_marker): Remove. (print_one_static_tracepoint_marker): Get marker by reference and adjust to std::string. (info_static_tracepoint_markers_command): Adjust to std::vector changes * target.h (static_tracepoint_marker_p): Remove typedef. (DEF_VEC_P(static_tracepoint_marker_p)): Remove. (struct target_ops) : Return bool. : Return std::vector. * target-debug.h (target_debug_print_VEC_static_tracepoint_marker_p_p): Remove. (target_debug_print_std_vector_static_tracepoint_marker): New. (target_debug_print_struct_static_tracepoint_marker_p): Rename to... (target_debug_print_static_tracepoint_marker_p): ... this. * target-delegates.c: Re-generate. * breakpoint.h (struct tracepoint) : Make std::string. * breakpoint.c (init_breakpoint_sal): Adjust to std::string. (decode_static_tracepoint_spec): Adjust to std::vector. (tracepoint_print_one_detail): Adjust to std::string. (strace_marker_decode_location): Adjust to std::string. (update_static_tracepoint): Adjust to std::string, remove call to release_static_tracepoint_marker. * linux-nat.c (linux_child_static_tracepoint_markers_by_strid): Adjust to std::vector. * remote.c (remote_static_tracepoint_marker_at): Return bool. (remote_static_tracepoint_markers_by_strid): Adjust to std::vector. * common/rsp-low.h (hex2str): New overload with explicit count of bytes. * common/rsp-low.c (hex2str): New overload with explicit count of bytes. * unittests/rsp-low-selftests.c (test_hex2str): New function. (_initialize_rsp_low_selftests): Add test_hex2str test. * unittests/tracepoint-selftests.c (test_parse_static_tracepoint_marker_definition): Adjust to std::string. --- gdb/tracepoint.h | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'gdb/tracepoint.h') diff --git a/gdb/tracepoint.h b/gdb/tracepoint.h index 9f4596e..c82b62a 100644 --- a/gdb/tracepoint.h +++ b/gdb/tracepoint.h @@ -214,14 +214,20 @@ struct uploaded_tsv struct static_tracepoint_marker { - struct gdbarch *gdbarch; - CORE_ADDR address; + DISABLE_COPY_AND_ASSIGN (static_tracepoint_marker); + + static_tracepoint_marker () = default; + static_tracepoint_marker (static_tracepoint_marker &&) = default; + static_tracepoint_marker &operator= (static_tracepoint_marker &&) = default; + + struct gdbarch *gdbarch = NULL; + CORE_ADDR address = 0; /* The string ID of the marker. */ - char *str_id; + std::string str_id; /* Extra target reported info associated with the marker. */ - char *extra; + std::string extra; }; struct memrange @@ -295,11 +301,9 @@ private: std::vector m_computed; }; -extern void parse_static_tracepoint_marker_definition - (const char *line, const char **pp, - struct static_tracepoint_marker *marker); -extern void release_static_tracepoint_marker (struct static_tracepoint_marker *); -extern void free_current_marker (void *arg); +extern void + parse_static_tracepoint_marker_definition (const char *line, const char **pp, + static_tracepoint_marker *marker); /* A hook used to notify the UI of tracepoint operations. */ -- cgit v1.1