From 814cf43a1f16157fcbe2c662f567d064393a0fcb Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 30 Apr 2019 23:47:54 -0600 Subject: Convert probes to type-safe registry API This changes the probes code in elfread.c to use the type-safe registry API. While doing this, I saw that the caller of get_probes owns the probes, so I went through the code and changed the vectors to store unique_ptrs, making the ownership relationship more clear. gdb/ChangeLog 2019-05-08 Tom Tromey * symfile.h (struct sym_probe_fns) : Change type. * symfile-debug.c (debug_sym_get_probes): Change type. * stap-probe.c (handle_stap_probe): (stap_static_probe_ops::get_probes): Change type. * probe.h (class static_probe_ops) : Change type. * probe.c (class any_static_probe_ops) : Change type. (parse_probes_in_pspace): Update. (find_probes_in_objfile, find_probe_by_pc, collect_probes): Update. (any_static_probe_ops::get_probes): Change type. * elfread.c (elfread_data): New typedef. (probe_key): Change type. (elf_get_probes): Likewise. Update. (probe_key_free): Remove. (_initialize_elfread): Update. * dtrace-probe.c (class dtrace_static_probe_ops) : Change type. (dtrace_process_dof_probe, dtrace_process_dof) (dtrace_static_probe_ops::get_probe): Change type. --- gdb/symfile-debug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gdb/symfile-debug.c') diff --git a/gdb/symfile-debug.c b/gdb/symfile-debug.c index 8266ecb..0f9da66 100644 --- a/gdb/symfile-debug.c +++ b/gdb/symfile-debug.c @@ -382,13 +382,13 @@ static const struct quick_symbol_functions debug_sym_quick_functions = /* Debugging version of struct sym_probe_fns. */ -static const std::vector & +static const std::vector> & debug_sym_get_probes (struct objfile *objfile) { const struct debug_sym_fns_data *debug_data = symfile_debug_objfile_data_key.get (objfile); - const std::vector &retval + const std::vector> &retval = debug_data->real_sf->sym_probe_fns->sym_get_probes (objfile); fprintf_filtered (gdb_stdlog, -- cgit v1.1