This is the mail archive of the gdb@sources.redhat.com 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]

pc_requires_run_before_use


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:

  /* Sometimes we may pluck out a minimal symbol that has a negative address.

     An example of this occurs when an a.out is linked against a foo.sl.
     The foo.sl defines a global bar(), and the a.out declares a signature
     for bar().  However, the a.out doesn't directly call bar(), but passes
     its address in another call.

     If you have this scenario and attempt to "break bar" before running,
     gdb will find a minimal symbol for bar() in the a.out.  But that
     symbol's address will be negative.  What this appears to denote is
     an index backwards from the base of the procedure linkage table (PLT)
     into the data linkage table (DLT), the end of which is contiguous
     with the start of the PLT.  This is clearly not a valid address for
     us to set a breakpoint on.

     [...] */

what is the case that this code is trying to catch? i tried to duplicate
the problem described above using this test program:

#include <stdio.h>
#include <string.h>

static int foo(size_t (*func)(const char *), const char *arg)
{
    printf("func = %p\n", (void *)func);
    return func(arg);
}

int main(int argc, char **argv)
{
    return foo(strlen, argv[0]);
}

and putting a breakpoint on "strlen" before starting to run the program.

on hppa-linux and hppa1.1-hp-hpux11.11, we do not trigger the check
above, and breakpoints work fine.

on hppa64-hp-hpux11.11, we are not able to put a proper breakpoint on a
shared lib function before starting the executable:

(gdb) b strlen
Breakpoint 1 at 0x800000010000bc80
(gdb) run
Starting program: /home/tausq/foo
Warning:
Cannot insert breakpoint 1.
Error accessing memory address 0x800000010000bc80: I/O error.

in either case we are not getting the problem that this hook is trying
to catch...

randolph
-- 
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/


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