forked from Imagelibrary/binutils-gdb
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. <str_id, extra>: 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) <to_static_tracepoint_marker_at>: Return bool. <to_static_tracepoint_markers_by_strid>: 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) <static_trace_marker_id>: 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.
This commit is contained in:
committed by
Simon Marchi
parent
62c222b6d9
commit
5d9310c4b8
@@ -3315,23 +3315,23 @@ debug_set_permissions (struct target_ops *self)
|
||||
fputs_unfiltered (")\n", gdb_stdlog);
|
||||
}
|
||||
|
||||
static int
|
||||
delegate_static_tracepoint_marker_at (struct target_ops *self, CORE_ADDR arg1, struct static_tracepoint_marker *arg2)
|
||||
static bool
|
||||
delegate_static_tracepoint_marker_at (struct target_ops *self, CORE_ADDR arg1, static_tracepoint_marker *arg2)
|
||||
{
|
||||
self = self->beneath;
|
||||
return self->to_static_tracepoint_marker_at (self, arg1, arg2);
|
||||
}
|
||||
|
||||
static int
|
||||
tdefault_static_tracepoint_marker_at (struct target_ops *self, CORE_ADDR arg1, struct static_tracepoint_marker *arg2)
|
||||
static bool
|
||||
tdefault_static_tracepoint_marker_at (struct target_ops *self, CORE_ADDR arg1, static_tracepoint_marker *arg2)
|
||||
{
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
static int
|
||||
debug_static_tracepoint_marker_at (struct target_ops *self, CORE_ADDR arg1, struct static_tracepoint_marker *arg2)
|
||||
static bool
|
||||
debug_static_tracepoint_marker_at (struct target_ops *self, CORE_ADDR arg1, static_tracepoint_marker *arg2)
|
||||
{
|
||||
int result;
|
||||
bool result;
|
||||
fprintf_unfiltered (gdb_stdlog, "-> %s->to_static_tracepoint_marker_at (...)\n", debug_target.to_shortname);
|
||||
result = debug_target.to_static_tracepoint_marker_at (&debug_target, arg1, arg2);
|
||||
fprintf_unfiltered (gdb_stdlog, "<- %s->to_static_tracepoint_marker_at (", debug_target.to_shortname);
|
||||
@@ -3339,30 +3339,30 @@ debug_static_tracepoint_marker_at (struct target_ops *self, CORE_ADDR arg1, stru
|
||||
fputs_unfiltered (", ", gdb_stdlog);
|
||||
target_debug_print_CORE_ADDR (arg1);
|
||||
fputs_unfiltered (", ", gdb_stdlog);
|
||||
target_debug_print_struct_static_tracepoint_marker_p (arg2);
|
||||
target_debug_print_static_tracepoint_marker_p (arg2);
|
||||
fputs_unfiltered (") = ", gdb_stdlog);
|
||||
target_debug_print_int (result);
|
||||
target_debug_print_bool (result);
|
||||
fputs_unfiltered ("\n", gdb_stdlog);
|
||||
return result;
|
||||
}
|
||||
|
||||
static VEC(static_tracepoint_marker_p) *
|
||||
static std::vector<static_tracepoint_marker>
|
||||
delegate_static_tracepoint_markers_by_strid (struct target_ops *self, const char *arg1)
|
||||
{
|
||||
self = self->beneath;
|
||||
return self->to_static_tracepoint_markers_by_strid (self, arg1);
|
||||
}
|
||||
|
||||
static VEC(static_tracepoint_marker_p) *
|
||||
static std::vector<static_tracepoint_marker>
|
||||
tdefault_static_tracepoint_markers_by_strid (struct target_ops *self, const char *arg1)
|
||||
{
|
||||
tcomplain ();
|
||||
}
|
||||
|
||||
static VEC(static_tracepoint_marker_p) *
|
||||
static std::vector<static_tracepoint_marker>
|
||||
debug_static_tracepoint_markers_by_strid (struct target_ops *self, const char *arg1)
|
||||
{
|
||||
VEC(static_tracepoint_marker_p) * result;
|
||||
std::vector<static_tracepoint_marker> result;
|
||||
fprintf_unfiltered (gdb_stdlog, "-> %s->to_static_tracepoint_markers_by_strid (...)\n", debug_target.to_shortname);
|
||||
result = debug_target.to_static_tracepoint_markers_by_strid (&debug_target, arg1);
|
||||
fprintf_unfiltered (gdb_stdlog, "<- %s->to_static_tracepoint_markers_by_strid (", debug_target.to_shortname);
|
||||
@@ -3370,7 +3370,7 @@ debug_static_tracepoint_markers_by_strid (struct target_ops *self, const char *a
|
||||
fputs_unfiltered (", ", gdb_stdlog);
|
||||
target_debug_print_const_char_p (arg1);
|
||||
fputs_unfiltered (") = ", gdb_stdlog);
|
||||
target_debug_print_VEC_static_tracepoint_marker_p_p (result);
|
||||
target_debug_print_std_vector_static_tracepoint_marker (result);
|
||||
fputs_unfiltered ("\n", gdb_stdlog);
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user