This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA 4/4 take 2] Improved linker-debugger interface


>>>>> "Gary" == Gary Benson <gbenson@redhat.com> writes:

Gary> 2012-07-30  Gary Benson  <gbenson@redhat.com>
Gary> 	* breakpoint.h (handle_solib_event): Moved function definition
Gary> 	to solib.h, and added a new parameter.
[...]

Gary> +static void
Gary> +free_probes (struct svr4_info *info)
Gary> +{
Gary> +  int i;
Gary> +
Gary> +  for (i = 0; i < NUM_PROBES; i++)
Gary> +    VEC_free (probe_p, info->probes[i]);
Gary> +
Gary> +  memset (info->probes, 0, sizeof (info->probes));

VEC_free sets the pointer to NULL, so this memset isn't needed.

Gary> +  val = evaluate_probe_argument (pi->probe, 0);
Gary> +  if (val == NULL)
Gary> +    goto error;

I don't see evaluate_probe_argument in the tree.
Maybe it was in another patch of yours?

Anyway, can it really return NULL?
I would expect it to throw an exception instead.

If it does throw an exception, and since the error case needs some work,
I think you will have to use cleanups here instead.

Gary> +/* Helper function for namespace_table_flatten.  */
Gary> +
Gary> +static int
Gary> +namespace_table_flatten_helper (void **slot, void *arg)
Gary> +{
Gary> +  struct namespace *ns = (struct namespace *) *slot;
Gary> +  struct so_list *src = ns->solist;
Gary> +  struct so_list **link = (struct so_list **) arg;
Gary> +
Gary> +  while (*link)
Gary> +    link = &(*link)->next;

I think this means we iterate over the entire linked list each time we
visit some element in the hash table.

It would not take much more effort to avoid this repeated iteration, by
changing 'arg' to an object that also holds the link pointer at the tail
of the list.

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]