This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Assuming types for PC
- From: Pedro Alves <palves at redhat dot com>
- To: Mark Kettenis <mark dot kettenis at xs4all dot nl>
- Cc: macro at codesourcery dot com, brobecker at adacore dot com, lgustavo at codesourcery dot com, gdb at sourceware dot org
- Date: Tue, 11 Jun 2013 10:21:35 +0100
- Subject: Re: Assuming types for PC
- References: <51B5E06A dot 8020807 at codesourcery dot com> <201306101431 dot r5AEVAfb007850 at glazunov dot sibelius dot xs4all dot nl> <51B5E3D4 dot 9010105 at codesourcery dot com> <201306101504 dot r5AF4pJJ010320 at glazunov dot sibelius dot xs4all dot nl> <alpine dot DEB dot 1 dot 10 dot 1306101838360 dot 16287 at tp dot orcam dot me dot uk> <201306101844 dot r5AIi8Ou017730 at glazunov dot sibelius dot xs4all dot nl>
On 06/10/2013 07:44 PM, Mark Kettenis wrote:
>> Date: Mon, 10 Jun 2013 19:04:08 +0100
>> From: "Maciej W. Rozycki" <macro@codesourcery.com>
>>
>> I think it is important to let the user access the full width of the PC
>> both for writes and -- more importantly -- for reads (as in: why did my
>> program crash, did it jump to an odd place?), as this lets the user do
>> with GDB what hardware permits. There is nothing in hardware that
>> prevents one from writing an out-of-valid ABI address space value to the
>> PC at a program's runtime (neither on Linux nor on bare iron) when
>> executing an n32 program. I think GDB should not stand in a user's way
>> and should allow the same to be done via ptrace(2) or RSP.
>
> Absolutely!
+1. Hmm, it'd be nice to have this spelled out in the internals manual
(or the wiki?). I while ago I pointed this out on a review of some
port. Can't recall which, but in the end I let it go. Maybe I should
have pushed back stronger.
>> 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.)
--
Pedro Alves