From: Ian Lance Taylor <ian@wasabisystems.com>
To: Baurjan Ismagulov <ibr@ata.cs.hun.edu.tr>
Cc: gdb@sources.redhat.com
Subject: Re: optind
Date: Wed, 10 Dec 2003 17:04:00 -0000 [thread overview]
Message-ID: <m37k14wqnd.fsf@gossamer.airs.com> (raw)
In-Reply-To: <20031210165318.GO23712@ata.cs.hacettepe.edu.tr>
Baurjan Ismagulov <ibr@ata.cs.hun.edu.tr> writes:
> On Wed, Dec 10, 2003 at 05:12:56PM +0100, Andreas Schwab wrote:
> > It also exists in the executable, due to a COPY relocation.
>
> Thanks much, I see it now!
>
> And how should gdb know which one to use?
gdb should always use the one in the executable. That is the one the
code in the shared library will also be using, because that is the
address will be in the GOT.
In principle, while debugging shared library code, gdb could observe
that there is a GOT relocation for optind, and look at the GOT table
in memory to decide which address to use.
Alternatively, gdb could guess that if there is a global variable in
the executable, that any reference to that global variable in the
shared library will refer to the one in the executable. This will
normally be true, but will fail in cases where the library is
controlling visibility in any of various different ways.
In practice I have no idea what gdb actually does.
Ian
next prev parent reply other threads:[~2003-12-10 17:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-10 14:20 optind Baurjan Ismagulov
2003-12-10 14:49 ` optind Daniel Jacobowitz
2003-12-10 16:09 ` optind Baurjan Ismagulov
2003-12-10 16:16 ` optind Andreas Schwab
2003-12-10 16:53 ` optind Baurjan Ismagulov
2003-12-10 17:04 ` Ian Lance Taylor [this message]
2003-12-10 17:17 ` optind Daniel Jacobowitz
2003-12-10 17:37 ` optind Baurjan Ismagulov
2003-12-11 14:10 ` optind Daniel Jacobowitz
2003-12-11 15:11 ` optind Baurjan Ismagulov
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=m37k14wqnd.fsf@gossamer.airs.com \
--to=ian@wasabisystems.com \
--cc=gdb@sources.redhat.com \
--cc=ibr@ata.cs.hun.edu.tr \
/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