Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Randolph Chung <randolph@tausq.org>
To: gdb@sources.redhat.com
Cc: dave@hiauly1.hia.nrc.ca
Subject: pc_requires_run_before_use
Date: Tue, 23 Nov 2004 21:43:00 -0000	[thread overview]
Message-ID: <20041123212126.GR9148@tausq.org> (raw)

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/


             reply	other threads:[~2004-11-23 21:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-23 21:43 Randolph Chung [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041123212126.GR9148@tausq.org \
    --to=randolph@tausq.org \
    --cc=dave@hiauly1.hia.nrc.ca \
    --cc=gdb@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox