This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Fix up msymbol type of dll trampoline to mst_solib_trampoline
- From: Tom Tromey <tromey at redhat dot com>
- To: Yao Qi <yao at codesourcery dot com>
- Cc: <gdb-patches at sourceware dot org>
- Date: Fri, 28 Jun 2013 09:43:08 -0600
- Subject: Re: [PATCH] Fix up msymbol type of dll trampoline to mst_solib_trampoline
- References: <1372043502-4618-1-git-send-email-yao at codesourcery dot com> <874ncjmgkl dot fsf at fleche dot redhat dot com> <51CD0054 dot 9040401 at codesourcery dot com>
>>>>> "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