This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA 14/14] Changes to solib-svr4.c
- From: Tom Tromey <tromey at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Wed, 17 Jul 2013 13:27:39 -0600
- Subject: Re: [RFA 14/14] Changes to solib-svr4.c
- References: <20130711103144 dot GA5707 at blade dot nx> <20130711104549 dot GO5707 at blade dot nx>
>>>>> "Gary" == Gary Benson <gbenson@redhat.com> writes:
Gary> + if (so->lm_info)
For pointers now we write '!= NULL'.
There are several spots like this.
Gary> + /* If this library does not have a copy then create one. */
Gary> + if (so->lm_info->copy == NULL)
Gary> + {
Gary> + struct so_list *copy;
Gary> +
Gary> + copy = XZALLOC (struct so_list);
Gary> + memcpy (copy, so, sizeof (struct so_list));
XZALLOC calls memset to clear the memory (that's what the "Z" means).
But you don't want that if you are just going to overwrite it.
I think XDUP would be better:
copy = XDUP (struct so_list, so);
So many libiberty macros...
Gary> + copy->lm_info = xmalloc (sizeof (struct lm_info));
Gary> + memcpy (copy->lm_info, so->lm_info, sizeof (struct lm_info));
Ditto.
Tom