From: Jim Blandy <jimb@zwingli.cygnus.com>
To: Andrew Cagney <ac131313@cygnus.com>
Cc: Michael Snyder <msnyder@cygnus.com>, Jim blandy <jimb@cygnus.com>,
gdb-patches@sources.redhat.com
Subject: Re: [RFC/RFA] gdb extension for Harvard architectures
Date: Wed, 03 Oct 2001 14:04:00 -0000 [thread overview]
Message-ID: <npn138o2me.fsf@zwingli.cygnus.com> (raw)
In-Reply-To: <3BBA7751.8070807@cygnus.com>
Andrew Cagney <ac131313@cygnus.com> writes:
> Hmm, that d10v example made me think ...
>
> The d10v has 16 bit code pointers. They are mapped onto a core addr using:
>
> ((code_ptr) << 2) | 0x01000000)
>
> The key thing being the code pointer has a granularity of 32 bits (aka 4
> bytes).
>
> Given the expression:
>
> ((int32 @code *) func)[1]
>
> I can guess what it does. However, what about:
>
> ((int16 @code *) func)[1]
>
> I suspect that the proposed model would result in ``[1]'' and ``[0]''
> being the same location.
Since GDB represents all pointers into code space the way it does
function pointers, that's right; value_subscript just calls value_add
and then value_ind --- the equivalent of computing *(a+i). Since
there's no representation for a pointer to the second word of an
instruction, the ADDRESS_TO_POINTER method ends up throwing away the
bits the subscript had affected.
Note that a similar problem occurs already:
(gdb) print main
$1 = {int ()} 0x101405c <main>
(gdb) print main + 1
$2 = (int (*)()) 0x101405c <main>
(gdb) print main + 2
$3 = (int (*)()) 0x101405c <main>
(gdb) print main + 3
$4 = (int (*)()) 0x101405c <main>
(gdb) print main + 4
$5 = (int (*)()) 0x1014060 <main+4>
(gdb)
Note that the first four values are all the same. If you handed that
expression to x/i, you'd be unhappy.
So this is simply another existing problem, which we don't solve.
Note, however, that our proposal makes it *possible* to solve this
problem in a coherent way. Since `int16 @code *' values never exist
on the target, GDB can represent them however it likes without
breaking the rule that `GDB always represents values in target form'.
We'd need to add some new logic for arch-dependent conversions between
pointer types, but at least it could be done.
prev parent reply other threads:[~2001-10-03 14:04 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-09-28 13:07 Michael Snyder
2001-09-28 13:50 ` Andrew Cagney
2001-10-03 10:41 ` Michael Snyder
2001-10-03 11:06 ` Daniel Jacobowitz
2001-10-03 11:12 ` Michael Snyder
2001-10-03 11:19 ` Andrew Cagney
2001-10-03 11:49 ` Michael Snyder
2001-10-03 14:38 ` Andrew Cagney
2001-10-03 14:14 ` Jim Blandy
2001-10-03 14:31 ` Andrew Cagney
2001-10-03 16:14 ` Jim Blandy
2001-10-04 11:44 ` Michael Snyder
2001-10-04 16:28 ` Jim Blandy
2001-09-28 17:15 ` Andrew Cagney
2001-09-28 17:44 ` Andrew Cagney
2001-10-02 12:59 ` Jim Blandy
2001-10-02 14:13 ` Andrew Cagney
2001-10-02 15:09 ` Michael Snyder
2001-10-02 16:58 ` Andrew Cagney
2001-10-03 10:10 ` Jim Blandy
2001-10-03 12:22 ` Andrew Cagney
2001-10-03 15:08 ` Jim Blandy
2001-10-10 0:56 ` Andrew Cagney
2001-10-09 23:34 ` Andrew Cagney
2001-10-10 10:53 ` Jim Blandy
2001-10-10 11:17 ` Andrew Cagney
2001-10-10 12:15 ` Jim Blandy
2001-10-10 12:31 ` Andrew Cagney
2001-10-10 0:16 ` Andrew Cagney
2001-10-03 11:11 ` Michael Snyder
2001-10-04 12:08 ` Michael Snyder
2001-10-04 13:13 ` Andrew Cagney
2001-10-08 10:36 ` Michael Snyder
2001-10-10 1:25 ` Andrew Cagney
2001-11-05 11:34 ` Michael Snyder
2001-10-02 16:14 ` Jim Blandy
2001-10-02 17:16 ` Andrew Cagney
2001-10-02 17:31 ` Michael Snyder
2001-10-02 19:09 ` Andrew Cagney
2001-10-03 12:41 ` Jim Blandy
2001-10-03 12:52 ` Andrew Cagney
2001-10-03 16:13 ` Jim Blandy
2001-10-03 16:51 ` Frank Ch. Eigler
2001-10-03 10:55 ` Michael Snyder
2001-10-03 11:06 ` Andrew Cagney
2001-10-03 11:51 ` Michael Snyder
2001-10-03 12:17 ` Andrew Cagney
2001-10-03 16:54 ` Michael Snyder
2001-10-03 14:33 ` Jim Blandy
2001-10-03 14:44 ` Andrew Cagney
2001-10-03 16:17 ` Jim Blandy
2001-10-04 13:16 ` Andrew Cagney
2001-10-10 0:45 ` Andrew Cagney
2001-10-10 10:56 ` Jim Blandy
2001-10-03 14:48 ` Andrew Cagney
2001-10-04 11:49 ` Michael Snyder
2001-10-03 10:49 ` Michael Snyder
2001-09-29 2:29 ` Eli Zaretskii
2001-10-02 19:27 ` Andrew Cagney
2001-10-03 14:04 ` Jim Blandy [this message]
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=npn138o2me.fsf@zwingli.cygnus.com \
--to=jimb@zwingli.cygnus.com \
--cc=ac131313@cygnus.com \
--cc=gdb-patches@sources.redhat.com \
--cc=jimb@cygnus.com \
--cc=msnyder@cygnus.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