From: Pedro Alves <palves@redhat.com>
To: gdb@sourceware.org
Cc: Mark Kettenis <mark.kettenis@xs4all.nl>,
macro@codesourcery.com, brobecker@adacore.com,
lgustavo@codesourcery.com
Subject: Re: Assuming types for PC
Date: Tue, 11 Jun 2013 10:09:00 -0000 [thread overview]
Message-ID: <51B6F73F.3080505@redhat.com> (raw)
In-Reply-To: <51B6EC1F.3020401@redhat.com>
On 06/11/2013 10:21 AM, Pedro Alves wrote:
>>> Overall I think the test is too strict. If you think the use of "long
>>> long" is unfortunate for the PC, then an artificial type might be created
>>> internally within GDB specifically for the PC, similarly to what we do
>>> e.g. for IEEE 754 data types and floating-point registers in some cases.
>>
>> An artificial type like that probably is the way to go.
>
> I agree. Something like the GDB equivalent of:
>
> typedef void * ptr64 __attribute ((mode(DI)));
>
> (That worked last time I tried it on x32, probably works on MIPS too.)
>
BTW, this whole issue is really a special case of an ABI register name
colliding with a machine register name. A similar example came up when GDB
was made to expose whole set of x86 general purpose registers. Specifically
the $rsp/$rsp/$sp, where $sp (16-bit) collides with desire to use $sp
to refer to stack pointer. An alternative idea I thrown out back then,
would be to always leave $pc/$sp/$fp as the ABI version of the registers,
and in case the machine has real registers by that name, expose those with
an alternative naming, like e.g., $_pc/$_sp/$_fp. These would have the
machine's full width.
On i686, you'd get:
32-bit pointer $pc, 16-bit integer $ip, 32-bit pointer $eip.
32-bit pointer $sp, 16-bit integer $_sp, 32-bit pointer $esp.
32-bit pointer $fp, 16-bit integer $bp, 32-bit pointer $ebp.
On x32, you'd get:
32-bit pointer $pc, 16-bit integer $ip, 32-bit pointer $eip, 64-bit integer $rip.
32-bit pointer $sp, 16-bit integer $_sp, 32-bit pointer $esp, 64-bit integer $rsp.
32-bit pointer $fp, 16-bit integer $bp, 32-bit pointer $ebp, 64-bit integer $rbp.
On x86_64 (-m64), you'd get
64-bit pointer $pc, 16-bit integer $ip, 32-bit integer $eip, 64-bit pointer $rip.
64-bit pointer $sp, 16-bit integer $_sp, 32-bit integer $esp, 64-bit pointer $rsp.
64-bit pointer $fp, 16-bit integer $bp, 32-bit integer $ebp, 64-bit pointer $rbp.
On MIPS n32, you'd get:
32-bit pointer $pc, 64-bit integer $_pc/$rNN.
32-bit pointer $sp, 64-bit integer $_sp/$rNN.
32-bit pointer $fp, 64-bit integer $_fp/$rNN.
(the _ variants probably would be raw from any arch bit manipulation).
(I'm not really sure which solution I prefer.)
--
Pedro Alves
prev parent reply other threads:[~2013-06-11 10:09 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-10 14:19 Luis Machado
2013-06-10 14:31 ` Mark Kettenis
2013-06-10 14:34 ` Luis Machado
2013-06-10 14:45 ` Joel Brobecker
2013-06-10 14:49 ` Luis Machado
2013-06-10 14:56 ` Joel Brobecker
2013-06-10 15:04 ` Mark Kettenis
2013-06-10 15:18 ` Luis Machado
2013-06-10 18:04 ` Maciej W. Rozycki
2013-06-10 18:44 ` Mark Kettenis
2013-06-11 9:21 ` Pedro Alves
2013-06-11 10:09 ` Pedro Alves [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=51B6F73F.3080505@redhat.com \
--to=palves@redhat.com \
--cc=brobecker@adacore.com \
--cc=gdb@sourceware.org \
--cc=lgustavo@codesourcery.com \
--cc=macro@codesourcery.com \
--cc=mark.kettenis@xs4all.nl \
/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