From: Mark Kettenis <kettenis@chello.nl>
To: Joel Brobecker <brobecker@gnat.com>
Cc: Michael Snyder <msnyder@redhat.com>, gdb-patches@sources.redhat.com
Subject: Re: native or target?
Date: Fri, 06 Sep 2002 12:48:00 -0000 [thread overview]
Message-ID: <863csmq4rp.fsf@elgar.kettenis.dyndns.org> (raw)
In-Reply-To: Joel Brobecker's message of "Thu, 5 Sep 2002 18:02:47 -0700"
Joel Brobecker <brobecker@gnat.com> writes:
> > A more accurate definition is that gdb is using the "native"
> > (ie. OS-provided) mechanism for controlling the target
> > program (eg. /proc or ptrace).
>
> Thank you. With your explainations and Daniel's message, I think it's
> much clearer in my head now.
>
> > > I would like to move the code in [b.] to the right place, and then
> > > remplace the #ifdef __INTERIX section by the proper runtime test.
> > > But I am confused as to where the right place for this code would
> > > be.
A compile-time test isn't necessarily wrong, although using
#ifdef SOME_DEFINE_THAT_INDICATES_A_PARTICULAR_OS
is generally frowned upon. It's better to use a autoconf test for the
feature you're actually using.
> > I would say this is target code. Correct me of I am wrong, but
> > I think you would use the same code regardless of how you were
> > debugging the target program (procfs or remote).
>
> This is where I am wondering whetherour approach is flawed or not. It
> seems very awkward at the very least: procfs is definitely native, but
> at the same time the procfinfo data contains these addresses that are
> useful for a method which is target dependent...
It's not that strange. The underlying OS has a certain influence on
how a program runs. In your case it's the location of the signal
trampoline that may vary between OS releases, machines, or the phase
of the moon. When running natively you can use a system call to
determine where it lives.
> BTW: Is it a requirement for a new port to be buildable as a target
> only, or can we provide a native-only port as a first step, and then
> eventually improve it to support "--host=--target=interix"? This is
> out-of-the-box thinking, I don't see how this would help the problem we
> have been discussing, but I think this is an interesting piece of
> information to know.
I'm inclined to say yes. If I can configure GDB with
--target=i386-interix on my i386-freebsd system, I can test the
target-dependent code, and you run a smaller risk of me accidentally
breaking your port when making changes to the common i386 code.
> > > What would you do?
> >
> > Move them out of procfs, and probably into interix-tdep.
>
> I thought about this. There were several issues that made me
> a bit cautious:
> 1. interix-tdep can not know about the procinfo structure, since
> this structure is used in native-only debugging. I can still
> get the information because I know the offset of these addresses
> in the procinfo structure. A bit crude, and probably hard to
> maintain as versions of interix evolve, but doable.
> 2. I still need somehow to call this function from procfs.c.
> Could it be a new architecture method?
>
> As I said above, I think it is best that I investigate a bit more with
> Donn Terry to see if there is no other way to implement PC_IN_SIGTRAMP
> in a completely target-oriented way before any of us spends more time on
> this.
Well, the current way seems to be a very reliable way to get the
necessary info. A completely target-oriented way, if it exists, would
probably be less reliable. It would be great if you could come up
with a solution such thet the info from /proc is used in the native
case. If you take a look at what I did for FreeBSD/i386 you'll see
that in i386bsd-tdep.c I initialize the variables
i386fbsd_sigtramp_{start|end} to some values that are known to work on
the majority of FreeBSD releases, whereas i386fbsd-nat.c overrides
these values with information from the kernel when running natively.
Perhaps you could do something similar?
Mark
next prev parent reply other threads:[~2002-09-06 19:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20020905232440.GV1169@gnat.com>
2002-09-05 16:29 ` Joel Brobecker
2002-09-05 16:35 ` Daniel Jacobowitz
2002-09-05 17:15 ` Michael Snyder
2002-09-05 18:02 ` Joel Brobecker
2002-09-06 11:00 ` Michael Snyder
2002-09-06 12:48 ` Mark Kettenis [this message]
2002-09-09 12:14 ` Andrew Cagney
2002-09-05 17:47 ` Kevin Buettner
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=863csmq4rp.fsf@elgar.kettenis.dyndns.org \
--to=kettenis@chello.nl \
--cc=brobecker@gnat.com \
--cc=gdb-patches@sources.redhat.com \
--cc=msnyder@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