Make program_space::deleted_solibs a vector of std::string
This allows removing a usage of free_char_ptr_vec. gdb/ChangeLog: * progspace.h (struct program_space) <deleted_solibs>: Change type to std::vector<std::string>. * progspace.c (clear_program_space_solib_cache): Adjust. * breakpoint.c (print_solib_event): Adjust. (check_status_catch_solib): Adjust. * solib.c (update_solib_list): Adjust. * ui-out.h (class ui_out) <field_string>: New overload. * ui-out.c (ui_out::field_string): New overload.
This commit is contained in:
parent
564b1e3f29
commit
6fb16ce6ea
7 changed files with 28 additions and 23 deletions
|
@ -1,3 +1,14 @@
|
||||||
|
2018-03-02 Simon Marchi <simon.marchi@polymtl.ca>
|
||||||
|
|
||||||
|
* progspace.h (struct program_space) <deleted_solibs>: Change
|
||||||
|
type to std::vector<std::string>.
|
||||||
|
* progspace.c (clear_program_space_solib_cache): Adjust.
|
||||||
|
* breakpoint.c (print_solib_event): Adjust.
|
||||||
|
(check_status_catch_solib): Adjust.
|
||||||
|
* solib.c (update_solib_list): Adjust.
|
||||||
|
* ui-out.h (class ui_out) <field_string>: New overload.
|
||||||
|
* ui-out.c (ui_out::field_string): New overload.
|
||||||
|
|
||||||
2018-03-02 Simon Marchi <simon.marchi@polymtl.ca>
|
2018-03-02 Simon Marchi <simon.marchi@polymtl.ca>
|
||||||
|
|
||||||
* progspace.h (struct program_space): Add constructor and
|
* progspace.h (struct program_space): Add constructor and
|
||||||
|
|
|
@ -4604,8 +4604,7 @@ print_bp_stop_message (bpstat bs)
|
||||||
static void
|
static void
|
||||||
print_solib_event (int is_catchpoint)
|
print_solib_event (int is_catchpoint)
|
||||||
{
|
{
|
||||||
int any_deleted
|
bool any_deleted = !current_program_space->deleted_solibs.empty ();
|
||||||
= !VEC_empty (char_ptr, current_program_space->deleted_solibs);
|
|
||||||
int any_added
|
int any_added
|
||||||
= !VEC_empty (so_list_ptr, current_program_space->added_solibs);
|
= !VEC_empty (so_list_ptr, current_program_space->added_solibs);
|
||||||
|
|
||||||
|
@ -4624,16 +4623,12 @@ print_solib_event (int is_catchpoint)
|
||||||
|
|
||||||
if (any_deleted)
|
if (any_deleted)
|
||||||
{
|
{
|
||||||
char *name;
|
|
||||||
int ix;
|
|
||||||
|
|
||||||
current_uiout->text (_(" Inferior unloaded "));
|
current_uiout->text (_(" Inferior unloaded "));
|
||||||
ui_out_emit_list list_emitter (current_uiout, "removed");
|
ui_out_emit_list list_emitter (current_uiout, "removed");
|
||||||
for (ix = 0;
|
for (int ix = 0; ix < current_program_space->deleted_solibs.size (); ix++)
|
||||||
VEC_iterate (char_ptr, current_program_space->deleted_solibs,
|
|
||||||
ix, name);
|
|
||||||
++ix)
|
|
||||||
{
|
{
|
||||||
|
const std::string &name = current_program_space->deleted_solibs[ix];
|
||||||
|
|
||||||
if (ix > 0)
|
if (ix > 0)
|
||||||
current_uiout->text (" ");
|
current_uiout->text (" ");
|
||||||
current_uiout->field_string ("library", name);
|
current_uiout->field_string ("library", name);
|
||||||
|
@ -8050,13 +8045,12 @@ check_status_catch_solib (struct bpstats *bs)
|
||||||
{
|
{
|
||||||
struct solib_catchpoint *self
|
struct solib_catchpoint *self
|
||||||
= (struct solib_catchpoint *) bs->breakpoint_at;
|
= (struct solib_catchpoint *) bs->breakpoint_at;
|
||||||
int ix;
|
|
||||||
|
|
||||||
if (self->is_load)
|
if (self->is_load)
|
||||||
{
|
{
|
||||||
struct so_list *iter;
|
struct so_list *iter;
|
||||||
|
|
||||||
for (ix = 0;
|
for (int ix = 0;
|
||||||
VEC_iterate (so_list_ptr, current_program_space->added_solibs,
|
VEC_iterate (so_list_ptr, current_program_space->added_solibs,
|
||||||
ix, iter);
|
ix, iter);
|
||||||
++ix)
|
++ix)
|
||||||
|
@ -8068,15 +8062,10 @@ check_status_catch_solib (struct bpstats *bs)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char *iter;
|
for (const std::string &iter : current_program_space->deleted_solibs)
|
||||||
|
|
||||||
for (ix = 0;
|
|
||||||
VEC_iterate (char_ptr, current_program_space->deleted_solibs,
|
|
||||||
ix, iter);
|
|
||||||
++ix)
|
|
||||||
{
|
{
|
||||||
if (!self->regex
|
if (!self->regex
|
||||||
|| self->compiled->exec (iter, 0, NULL, 0) == 0)
|
|| self->compiled->exec (iter.c_str (), 0, NULL, 0) == 0)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -401,8 +401,7 @@ clear_program_space_solib_cache (struct program_space *pspace)
|
||||||
{
|
{
|
||||||
VEC_free (so_list_ptr, pspace->added_solibs);
|
VEC_free (so_list_ptr, pspace->added_solibs);
|
||||||
|
|
||||||
free_char_ptr_vec (pspace->deleted_solibs);
|
pspace->deleted_solibs.clear ();
|
||||||
pspace->deleted_solibs = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -207,7 +207,7 @@ struct program_space
|
||||||
|
|
||||||
/* When an solib is removed, its name is added to this vector.
|
/* When an solib is removed, its name is added to this vector.
|
||||||
This is so we can properly report solib changes to the user. */
|
This is so we can properly report solib changes to the user. */
|
||||||
VEC (char_ptr) *deleted_solibs = NULL;
|
std::vector<std::string> deleted_solibs;
|
||||||
|
|
||||||
/* Per pspace data-pointers required by other GDB modules. */
|
/* Per pspace data-pointers required by other GDB modules. */
|
||||||
REGISTRY_FIELDS {};
|
REGISTRY_FIELDS {};
|
||||||
|
|
|
@ -828,8 +828,7 @@ update_solib_list (int from_tty)
|
||||||
unloaded before we remove it from GDB's tables. */
|
unloaded before we remove it from GDB's tables. */
|
||||||
observer_notify_solib_unloaded (gdb);
|
observer_notify_solib_unloaded (gdb);
|
||||||
|
|
||||||
VEC_safe_push (char_ptr, current_program_space->deleted_solibs,
|
current_program_space->deleted_solibs.push_back (gdb->so_name);
|
||||||
xstrdup (gdb->so_name));
|
|
||||||
|
|
||||||
*gdb_link = gdb->next;
|
*gdb_link = gdb->next;
|
||||||
|
|
||||||
|
|
|
@ -552,6 +552,12 @@ ui_out::field_string (const char *fldname, const char *string)
|
||||||
do_field_string (fldno, width, align, fldname, string);
|
do_field_string (fldno, width, align, fldname, string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ui_out::field_string (const char *fldname, const std::string &string)
|
||||||
|
{
|
||||||
|
field_string (fldname, string.c_str ());
|
||||||
|
}
|
||||||
|
|
||||||
/* VARARGS */
|
/* VARARGS */
|
||||||
void
|
void
|
||||||
ui_out::field_fmt (const char *fldname, const char *format, ...)
|
ui_out::field_fmt (const char *fldname, const char *format, ...)
|
||||||
|
|
|
@ -104,6 +104,7 @@ class ui_out
|
||||||
void field_core_addr (const char *fldname, struct gdbarch *gdbarch,
|
void field_core_addr (const char *fldname, struct gdbarch *gdbarch,
|
||||||
CORE_ADDR address);
|
CORE_ADDR address);
|
||||||
void field_string (const char *fldname, const char *string);
|
void field_string (const char *fldname, const char *string);
|
||||||
|
void field_string (const char *fldname, const std::string &string);
|
||||||
void field_stream (const char *fldname, string_file &stream);
|
void field_stream (const char *fldname, string_file &stream);
|
||||||
void field_skip (const char *fldname);
|
void field_skip (const char *fldname);
|
||||||
void field_fmt (const char *fldname, const char *format, ...)
|
void field_fmt (const char *fldname, const char *format, ...)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue