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: [PATCH] Fix up msymbol type of dll trampoline to mst_solib_trampoline


>>>>> "Yao" == Yao Qi <yao@codesourcery.com> writes:

Yao> +      for (ix = 0;
Yao> +	   VEC_iterate (msymbolp, name_prefix_imp, ix, msym_dll);
Yao> +	   ix++)
Yao> +	{
Yao> +	  const char *sname = SYMBOL_LINKAGE_NAME (msym_dll);
Yao> +	  const char *name = (sname[1] == '_' ? &sname[7] : &sname[6]);
Yao> +	  struct minimal_symbol *found
Yao> +	    = prim_find_minimal_symbol (name);
Yao> +
Yao> +	  /* If found, there are symbols named "_imp_foo" and "foo"
Yao> +	     respectively read in from the current objfile.  Set the type
Yao> +	     of symbol "foo" as 'mst_solib_trampoline'.  */
Yao> +	  if (found != NULL && MSYMBOL_TYPE (found) == mst_text)
Yao> +	    MSYMBOL_TYPE (found) = mst_solib_trampoline;

It seems to me that it would be more efficient to keep a hash table of
minsyms under construction, and then do this lookup when entering a new
minsym.  This would avoid repeated loops over all minsyms being defined.

That is, if the new symbol is _imp_x, look up x.  If the symbol is x,
look up _imp_x.  Then modify a symbol if needed.

Tom


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