Randolph Chung randolph@tausq.org
Sat Dec 4 00:38:00 GMT 2004

In reference to a message from John David Anglin, dated Nov 23:
> > Does anybody understand what this comment means or what this code is
> > supposed to do?
> > 
> > hppa_pc_requires_run_before_use() in hppa-tdep.a says:

hrm, i found a testcase for this (gdb.base/so-indr-cl). It's

if we create one shared object that exports a function, and then use
that function from the main program via an indirect reference, then we
trip the check. there's a bit more explanation in the testcase:

# This program implicitly loads SOM shared libraries.  We wish to test
# whether a user can set breakpoints in a shlib before running the
# program, where the program doesn't directly call the shlib, but
# indirectly does via passing its address to another function.
# ??rehrauer: Currently, this doesn't work, but we do catch the case
# and explicitly disallow it.  The reason it fails appears to be that
#  [1] gdb consults only the linker symbol table in this scenario, and
#  [2] For a shlib function that is only indirectly called from the
#      main a.out, there is in the linker symbol table a stub whose
#      address is negative.  Possibly this is to be interpreted as
#      an index into the DLT??

interestingly, this only triggers when calling a function in a
user-defined shared object. in my original test program which calls a
function in libc.sl, the problem doesn't occur. i don't know why yet....
i wish there were a "readelf" equivalent for SOM... :)

using the same testcase on linux, the reference to the shared object
function is not picked up by gdb for the main program before the app is
started, so the problem doesn't exist. i guess this may be a problem
with the SOM reader where it records a symbol for the unresolved
reference to a shlib function....

Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports

More information about the Gdb mailing list