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: RFC for: "Re: Regression for gdb.fortran/library-module.exp [Re: [RFA] choose symbol from given block's objfile first.]"


On Wed, 16 May 2012 21:57:18 +0200, Joel Brobecker wrote:
> --- a/gdb/objfiles.c
> +++ b/gdb/objfiles.c
[...]
> +void
> +iterate_over_objfiles_in_search_order
> +  (iterate_over_objfiles_in_search_order_cb cb,
> +   void *cb_data,
> +   struct objfile *context_objfile)
> +{
> +  int stop = 0;
> +  struct objfile *objfile;
> +
> +  if (context_objfile && context_objfile->flags & OBJF_MAINLINE)
> +    {
> +      stop = cb (context_objfile, cb_data);
> +      if (stop)
> +	return;
> +    }
> +
> +  ALL_OBJFILES (objfile)
> +    {
> +      if (objfile->flags & OBJF_MAINLINE && objfile != context_objfile)
> +	{
> +	  stop = cb (objfile, cb_data);
> +	  if (stop)
> +	    return;
> +	}
> +    }

I see a bit problem this function is objfile based and not solib based, as the
solib order from svr4_current_sos() is completely lost here.

That is if we have two shared libraries with global variable X ld.so defines
which one gets used depending on their dlopen order.

so_list_head already has wrong order due to update_solib_list.  Maybe
update_solib_list should be fixed to keep both so_list_head order and also
properly ensure matching objfiles order.

If someone does some add-symbol-file by hand the order gets lost anyway.

Maybe we could ensure just so_list_head order, place this "correct order
search" to elf_lookup_lib_symbol and fall back to the old unfixed objfiles
search in arbitrary order to keep add-symbol-file working.

Sure there should be some exceptions for hidden symbols but this should be
implementable on top of your CONTEXT_OBJFILE being there probably for this
purpose.  Plus weak symbols.


> +
> +  if (context_objfile && !(context_objfile->flags & OBJF_MAINLINE))
> +    {
> +      stop = cb (context_objfile, cb_data);
> +      if (stop)
> +	return;
> +    }
> +
> +  ALL_OBJFILES (objfile)
> +    {
> +      if (!(objfile->flags & OBJF_MAINLINE) && objfile != context_objfile)
> +	{
> +	  stop = cb (objfile, cb_data);
> +	  if (stop)
> +	    return;
> +	}
> +    }
> +}

I do not see why to use the OBJF_MAINLINE exceptions here.  I see the correct
order is just the most simple ALL_OBJFILES loop.

Maybe you could re-state the case you were trying to fix as your testcase
	gdb.base/print-file-var.exp false PASS [Re: [RFA] choose symbol from given block's objfile first.]
	http://sourceware.org/ml/gdb-patches/2012-05/msg00692.html
is wrong.

address_info ("info addr") function is wrong but it does not apply for
"print".


Thanks,
Jan


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