This is the mail archive of the
frysk@sourceware.org
mailing list for the frysk project.
dl symbol search path; Was: Corefile -arch 32 test failures with breakpoint and stacktrace tests
Andrew Cagney wrote:
+ static Symbol get(Dwfl dwfl, String name)
+ {
+ Symbol sym = new Symbol();
+ sym.name = name;
+ DwflModule[] modules = dwfl.getModules();
+ for (int i = 0; i < modules.length && ! sym.found; i++)
+ modules[i].getSymbolByName(name, sym);
+
PS:
The rules for looking up an elf symbol is, unfortunately, subtle and
complex. A brute force search through all the modules taking the first
returned isn't correct. For instance, consider a search for open. If
the current symbol scope has a local open function then that should be
returned, and not the one from a library like glibc. The man page for
dlsym(3) touches on the semantics.
I was hoping that there was a dwfl method for doing this, but none jump
out from libdwfl.h? I see DwflModule.getSymbolByName does the best it
can using dwfl_module_getsymtab.
Andrew