svr4_current_sos_via_xfer_libraries (struct svr4_library_list *list,
const char *annex)
{
- char *svr4_library_document;
- int result;
- struct cleanup *back_to;
-
gdb_assert (annex == NULL || target_augmented_libraries_svr4_read ());
/* Fetch the list of shared libraries. */
- svr4_library_document = target_read_stralloc (¤t_target,
- TARGET_OBJECT_LIBRARIES_SVR4,
- annex);
+ gdb::unique_xmalloc_ptr<char> svr4_library_document
+ = target_read_stralloc (¤t_target, TARGET_OBJECT_LIBRARIES_SVR4,
+ annex);
if (svr4_library_document == NULL)
return 0;
- back_to = make_cleanup (xfree, svr4_library_document);
- result = svr4_parse_libraries (svr4_library_document, list);
- do_cleanups (back_to);
-
- return result;
+ return svr4_parse_libraries (svr4_library_document.get (), list);
}
#else
static void
svr4_create_probe_breakpoints (struct gdbarch *gdbarch,
- VEC (probe_p) **probes,
+ const std::vector<probe *> *probes,
struct objfile *objfile)
{
- int i;
-
- for (i = 0; i < NUM_PROBES; i++)
+ for (int i = 0; i < NUM_PROBES; i++)
{
enum probe_action action = probe_info[i].action;
- struct probe *probe;
- int ix;
- for (ix = 0;
- VEC_iterate (probe_p, probes[i], ix, probe);
- ++ix)
+ for (probe *p : probes[i])
{
- CORE_ADDR address = get_probe_address (probe, objfile);
+ CORE_ADDR address = get_probe_address (p, objfile);
create_solib_event_breakpoint (gdbarch, address);
- register_solib_event_probe (probe, address, action);
+ register_solib_event_probe (p, address, action);
}
}
for (with_prefix = 0; with_prefix <= 1; with_prefix++)
{
- VEC (probe_p) *probes[NUM_PROBES];
+ std::vector<probe *> probes[NUM_PROBES];
int all_probes_found = 1;
int checked_can_use_probe_arguments = 0;
- int i;
- memset (probes, 0, sizeof (probes));
- for (i = 0; i < NUM_PROBES; i++)
+ for (int i = 0; i < NUM_PROBES; i++)
{
const char *name = probe_info[i].name;
struct probe *p;
if (strcmp (name, "rtld_map_failed") == 0)
continue;
- if (VEC_empty (probe_p, probes[i]))
+ if (probes[i].empty ())
{
all_probes_found = 0;
break;
/* Ensure probe arguments can be evaluated. */
if (!checked_can_use_probe_arguments)
{
- p = VEC_index (probe_p, probes[i], 0);
+ p = probes[i][0];
if (!can_evaluate_probe_arguments (p))
{
all_probes_found = 0;
if (all_probes_found)
svr4_create_probe_breakpoints (gdbarch, probes, os->objfile);
- for (i = 0; i < NUM_PROBES; i++)
- VEC_free (probe_p, probes[i]);
-
if (all_probes_found)
return;
}