2017-04-28 Simon Marchi <simon.marchi@ericsson.com>
+ * solib-svr4.h (struct lm_info_svr4): Initialize fields.
+ <l_addr_p>: Change type to bool.
+ * solib-svr4.c (lm_info_read): Allocate lm_info_svr4 with new.
+ (svr4_free_so): Free lm_info_svr4 with delete.
+ (svr4_copy_library_list): Replace memcpy with call to copy
+ constructor.
+ (library_list_start_library, svr4_default_sos): Allocate
+ lm_info_svr4 with new.
+
+2017-04-28 Simon Marchi <simon.marchi@ericsson.com>
+
* solib-target.c (struct lm_info_target): Add destructor,
initialize fields.
<name>: Change type to std::string.
{
struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
- lm_info = XCNEW (lm_info_svr4);
+ lm_info = new lm_info_svr4;
lm_info->lm_addr = lm_addr;
lm_info->l_addr_inferior = extract_typed_address (&lm[lmo->l_addr_offset],
static void
svr4_free_so (struct so_list *so)
{
- xfree (so->lm_info);
+ lm_info_svr4 *li = (lm_info_svr4 *) so->lm_info;
+
+ delete li;
}
/* Implement target_so_ops.clear_so. */
newobj = XNEW (struct so_list);
memcpy (newobj, src, sizeof (struct so_list));
- newobj->lm_info = XNEW (lm_info_svr4);
- memcpy (newobj->lm_info, src->lm_info, sizeof (lm_info_svr4));
+ lm_info_svr4 *src_li = (lm_info_svr4 *) src->lm_info;
+ newobj->lm_info = new lm_info_svr4 (*src_li);
newobj->next = NULL;
*link = newobj;
struct so_list *new_elem;
new_elem = XCNEW (struct so_list);
- lm_info_svr4 *li = XCNEW (lm_info_svr4);
+ lm_info_svr4 *li = new lm_info_svr4;
new_elem->lm_info = li;
li->lm_addr = *lmp;
li->l_addr_inferior = *l_addrp;
return NULL;
newobj = XCNEW (struct so_list);
- lm_info_svr4 *li = XCNEW (lm_info_svr4);
+ lm_info_svr4 *li = new lm_info_svr4;
newobj->lm_info = li;
/* Nothing will ever check the other fields if we set l_addr_p. */
It is commonly the same value. It is cached as we want to warn about
the difference and compute it only once. L_ADDR is valid
iff L_ADDR_P. */
- CORE_ADDR l_addr, l_addr_inferior;
- unsigned int l_addr_p : 1;
+ CORE_ADDR l_addr = 0, l_addr_inferior = 0;
+ bool l_addr_p = false;
/* The target location of lm. */
- CORE_ADDR lm_addr;
+ CORE_ADDR lm_addr = 0;
/* Values read in from inferior's fields of the same name. */
- CORE_ADDR l_ld, l_next, l_prev, l_name;
+ CORE_ADDR l_ld = 0, l_next = 0, l_prev = 0, l_name = 0;
};
/* Critical offsets and sizes which describe struct r_debug and