Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* pc_requires_run_before_use
@ 2004-11-23 21:43 Randolph Chung
  2004-11-24  3:55 ` pc_requires_run_before_use John David Anglin
  0 siblings, 1 reply; 5+ messages in thread
From: Randolph Chung @ 2004-11-23 21:43 UTC (permalink / raw)
  To: gdb; +Cc: dave

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/


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-12-04  1:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-23 21:43 pc_requires_run_before_use Randolph Chung
2004-11-24  3:55 ` pc_requires_run_before_use John David Anglin
2004-11-24  6:47   ` pc_requires_run_before_use Randolph Chung
2004-12-04  0:38   ` pc_requires_run_before_use Randolph Chung
2004-12-04  1:01     ` pc_requires_run_before_use John David Anglin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox