[patch 1/3] Refactor/simplify (+fix) svr4_current_sos

Pedro Alves pedro@codesourcery.com
Thu Oct 6 18:30:00 GMT 2011


On Monday 03 October 2011 22:54:24, Jan Kratochvil wrote:
> gdb/
> 2011-10-03  Jan Kratochvil  <jan.kratochvil@redhat.com>
>             Paul Pluzhnikov  <ppluzhnikov@google.com>
> 
>         * defs.h (struct so_list): New forward declaration.
>         (make_cleanup_free_so): New declaration.
>         * solib-svr4.c (ignore_first_link_map_entry): Remove.
>         (svr4_free_so): Move here.  Handle NULL so->lm_info.

Move what here?  Looks like a stale comment.

> @@ -1029,58 +1028,93 @@ svr4_current_sos (void)
>           SVR4, it has no name.  For others (Solaris 2.3 for example), it
>           does have a name, so we can no longer use a missing name to
>           decide when to ignore it.  */
> -      else if (ignore_first_link_map_entry (new) && ldsomap == 0)
> +      if (ignore_first && lm_prev (new) == 0)
>         {
> +         struct svr4_info *info = get_svr4_info ();
> +
>           info->main_lm_addr = new->lm_info->lm_addr;

A shame that this is still hidden here IMO, and dependent on
how you call the function, though not documented in the function
header.  An alternative would be to move this "ignore first" logic to
the caller, making the caller itself delete the first entry in the list
if it wanted to, and setting main_lm_addr.  We already have to allocate/free
this so_list, so nothing seems be to lost that way.

> -         free_so (new);
> +         do_cleanups (old_chain);
> +         continue;

Otherwise, looks great to me.

-- 
Pedro Alves



More information about the Gdb-patches mailing list