* m68k_register_virtual_type
@ 2002-11-22 2:53 Andreas Schwab
2002-11-22 7:33 ` m68k_register_virtual_type Andrew Cagney
0 siblings, 1 reply; 7+ messages in thread
From: Andreas Schwab @ 2002-11-22 2:53 UTC (permalink / raw)
To: gdb-patches
[ Seems like this mail didn't come through although I'm sure it left my
notebook. ]
The m68k sr, fpcontrol and fpstatus registers don't contain addresses, so
they should be treated like any other integer register. Committed.
Andreas.
2002-11-22 Andreas Schwab <schwab@suse.de>
* m68k-tdep.c (m68k_register_virtual_type): Return int for SR, FPC
and FPS registers.
Index: gdb/m68k-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/m68k-tdep.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -p -a -u -p -a -r1.27 -r1.28
--- gdb/m68k-tdep.c 18 Nov 2002 22:19:28 -0000 1.27
+++ gdb/m68k-tdep.c 22 Nov 2002 00:02:03 -0000 1.28
@@ -148,20 +148,25 @@ m68k_register_virtual_size (int regnum)
return (((unsigned) (regnum) - FP0_REGNUM) < 8 ? 12 : 4);
}
-/* Return the GDB type object for the "standard" data type of data
- in register N. This should be int for D0-D7, long double for FP0-FP7,
- and void pointer for all others (A0-A7, PC, SR, FPCONTROL etc).
- Note, for registers which contain addresses return pointer to void,
- not pointer to char, because we don't want to attempt to print
- the string after printing the address. */
+/* Return the GDB type object for the "standard" data type of data in
+ register N. This should be int for D0-D7, SR, FPCONTROL and
+ FPSTATUS, long double for FP0-FP7, and void pointer for all others
+ (A0-A7, PC, FPIADDR). Note, for registers which contain
+ addresses return pointer to void, not pointer to char, because we
+ don't want to attempt to print the string after printing the
+ address. */
static struct type *
m68k_register_virtual_type (int regnum)
{
- if ((unsigned) regnum >= E_FPC_REGNUM)
+ if (regnum == E_FPI_REGNUM)
return lookup_pointer_type (builtin_type_void);
+ else if ((unsigned) regnum >= E_FPC_REGNUM)
+ return builtin_type_int;
else if ((unsigned) regnum >= FP0_REGNUM)
return builtin_type_long_double;
+ else if (regnum == PS_REGNUM)
+ return builtin_type_int;
else if ((unsigned) regnum >= A0_REGNUM)
return lookup_pointer_type (builtin_type_void);
else
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: m68k_register_virtual_type
2002-11-22 2:53 m68k_register_virtual_type Andreas Schwab
@ 2002-11-22 7:33 ` Andrew Cagney
2002-11-22 8:35 ` m68k_register_virtual_type Andreas Schwab
0 siblings, 1 reply; 7+ messages in thread
From: Andrew Cagney @ 2002-11-22 7:33 UTC (permalink / raw)
To: Andreas Schwab; +Cc: gdb-patches
Just FYI,
> static struct type *
> m68k_register_virtual_type (int regnum)
> {
> - if ((unsigned) regnum >= E_FPC_REGNUM)
> + if (regnum == E_FPI_REGNUM)
> return lookup_pointer_type (builtin_type_void);
There are now:
builtin_type_void_data_ptr
builtin_type_void_code_ptr
available.
> + else if ((unsigned) regnum >= E_FPC_REGNUM)
> + return builtin_type_int;
builtin_type_int32 is better
> else if ((unsigned) regnum >= FP0_REGNUM)
> return builtin_type_long_double;
> + else if (regnum == PS_REGNUM)
> + return builtin_type_int
Ditto.
> else if ((unsigned) regnum >= A0_REGNUM)
> return lookup_pointer_type (builtin_type_void);
> else
Andrew
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: m68k_register_virtual_type
2002-11-22 7:33 ` m68k_register_virtual_type Andrew Cagney
@ 2002-11-22 8:35 ` Andreas Schwab
2002-11-22 8:54 ` m68k_register_virtual_type Andrew Cagney
0 siblings, 1 reply; 7+ messages in thread
From: Andreas Schwab @ 2002-11-22 8:35 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
Andrew Cagney <ac131313@redhat.com> writes:
|> Just FYI,
|>
|> > static struct type *
|> > m68k_register_virtual_type (int regnum)
|> > {
|> > - if ((unsigned) regnum >= E_FPC_REGNUM)
|> > + if (regnum == E_FPI_REGNUM)
|> > return lookup_pointer_type (builtin_type_void);
|>
|> There are now:
|> builtin_type_void_data_ptr
|> builtin_type_void_code_ptr
|> available.
Thanks, I'll change that (it's actually builtin_type_void_func_ptr).
|> > + else if ((unsigned) regnum >= E_FPC_REGNUM)
|> > + return builtin_type_int;
|>
|> builtin_type_int32 is better
|>
|> > else if ((unsigned) regnum >= FP0_REGNUM)
|> > return builtin_type_long_double;
|> > + else if (regnum == PS_REGNUM)
|> > + return builtin_type_int
|>
|> Ditto.
What about the default case for the d0-d7 registers? Should it be changed
to builtin_type_int32 as well?
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: m68k_register_virtual_type
2002-11-22 8:35 ` m68k_register_virtual_type Andreas Schwab
@ 2002-11-22 8:54 ` Andrew Cagney
2002-11-22 9:05 ` m68k_register_virtual_type Andreas Schwab
2002-11-22 15:59 ` m68k_register_virtual_type Andreas Schwab
0 siblings, 2 replies; 7+ messages in thread
From: Andrew Cagney @ 2002-11-22 8:54 UTC (permalink / raw)
To: Andreas Schwab; +Cc: gdb-patches
> |> > + else if ((unsigned) regnum >= E_FPC_REGNUM)
> |> > + return builtin_type_int;
> |>
> |> builtin_type_int32 is better
> |>
> |> > else if ((unsigned) regnum >= FP0_REGNUM)
> |> > return builtin_type_long_double;
> |> > + else if (regnum == PS_REGNUM)
> |> > + return builtin_type_int
> |>
> |> Ditto.
>
> What about the default case for the d0-d7 registers? Should it be changed
> to builtin_type_int32 as well?
Er, yes. (And eventually long_double to builtin_type_m68881_ext but the
last one might have fallout related to register conversions).
Andrew
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: m68k_register_virtual_type
2002-11-22 8:54 ` m68k_register_virtual_type Andrew Cagney
@ 2002-11-22 9:05 ` Andreas Schwab
2002-11-22 15:59 ` m68k_register_virtual_type Andreas Schwab
1 sibling, 0 replies; 7+ messages in thread
From: Andreas Schwab @ 2002-11-22 9:05 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
Andrew Cagney <ac131313@redhat.com> writes:
|> > |> > + else if ((unsigned) regnum >= E_FPC_REGNUM)
|> > |> > + return builtin_type_int;
|> > |> |> builtin_type_int32 is better
|> > |> |> > else if ((unsigned) regnum >= FP0_REGNUM)
|> > |> > return builtin_type_long_double;
|> > |> > + else if (regnum == PS_REGNUM)
|> > |> > + return builtin_type_int
|> > |> |> Ditto.
|> > What about the default case for the d0-d7 registers? Should it be
|> > changed
|> > to builtin_type_int32 as well?
|>
|> Er, yes. (And eventually long_double to builtin_type_m68881_ext but the
|> last one might have fallout related to register conversions).
What kind of fallout could that be? Some quick tests didn't reveal
anything obvious.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: m68k_register_virtual_type
2002-11-22 8:54 ` m68k_register_virtual_type Andrew Cagney
2002-11-22 9:05 ` m68k_register_virtual_type Andreas Schwab
@ 2002-11-22 15:59 ` Andreas Schwab
2002-11-22 16:25 ` m68k_register_virtual_type Andrew Cagney
1 sibling, 1 reply; 7+ messages in thread
From: Andreas Schwab @ 2002-11-22 15:59 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
Andrew Cagney <ac131313@redhat.com> writes:
|> Er, yes. (And eventually long_double to builtin_type_m68881_ext but the
|> last one might have fallout related to register conversions).
I have now committed this patch.
Andreas.
2002-11-23 Andreas Schwab <schwab@suse.de>
* m68k-tdep.c (m68k_register_virtual_type): Use architecture
invariant return values.
--- m68k-tdep.c.~1.28.~ 2002-11-23 00:53:11.000000000 +0100
+++ m68k-tdep.c 2002-11-23 00:53:32.000000000 +0100
@@ -159,18 +159,19 @@ m68k_register_virtual_size (int regnum)
static struct type *
m68k_register_virtual_type (int regnum)
{
- if (regnum == E_FPI_REGNUM)
- return lookup_pointer_type (builtin_type_void);
- else if ((unsigned) regnum >= E_FPC_REGNUM)
- return builtin_type_int;
- else if ((unsigned) regnum >= FP0_REGNUM)
- return builtin_type_long_double;
- else if (regnum == PS_REGNUM)
- return builtin_type_int;
- else if ((unsigned) regnum >= A0_REGNUM)
- return lookup_pointer_type (builtin_type_void);
- else
- return builtin_type_int;
+ if (regnum >= FP0_REGNUM && regnum <= FP0_REGNUM + 7)
+ return builtin_type_m68881_ext;
+
+ if (regnum == E_FPI_REGNUM || regnum == PC_REGNUM)
+ return builtin_type_void_func_ptr;
+
+ if (regnum == E_FPC_REGNUM || regnum == E_FPS_REGNUM || regnum == PS_REGNUM)
+ return builtin_type_int32;
+
+ if (regnum >= A0_REGNUM && regnum <= A0_REGNUM + 7)
+ return builtin_type_void_data_ptr;
+
+ return builtin_type_int32;
}
/* Function: m68k_register_name
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: m68k_register_virtual_type
2002-11-22 15:59 ` m68k_register_virtual_type Andreas Schwab
@ 2002-11-22 16:25 ` Andrew Cagney
0 siblings, 0 replies; 7+ messages in thread
From: Andrew Cagney @ 2002-11-22 16:25 UTC (permalink / raw)
To: Andreas Schwab; +Cc: gdb-patches
> |> Er, yes. (And eventually long_double to builtin_type_m68881_ext but the
> |> last one might have fallout related to register conversions).
>
> I have now committed this patch.
Thanks!
To answer your question. The m68k shouldn't have any fallout because
it's eliminated the CONVERT_FROM and CONVERT_TO methods (just never know
until someone tests it :-).
On the other hand, a target like the MIPS, which uses the convert
methods, could have problems. Those functions try to cover up GDB's
inability to manipulate floating point registers that had a non-standard
type. Fortunatly that inability has been fixed, just need to flush the
old code.
Andrew
> Andreas.
>
> 2002-11-23 Andreas Schwab <schwab@suse.de>
>
> * m68k-tdep.c (m68k_register_virtual_type): Use architecture
> invariant return values.
>
> --- m68k-tdep.c.~1.28.~ 2002-11-23 00:53:11.000000000 +0100
> +++ m68k-tdep.c 2002-11-23 00:53:32.000000000 +0100
> @@ -159,18 +159,19 @@ m68k_register_virtual_size (int regnum)
> static struct type *
> m68k_register_virtual_type (int regnum)
> {
> - if (regnum == E_FPI_REGNUM)
> - return lookup_pointer_type (builtin_type_void);
> - else if ((unsigned) regnum >= E_FPC_REGNUM)
> - return builtin_type_int;
> - else if ((unsigned) regnum >= FP0_REGNUM)
> - return builtin_type_long_double;
> - else if (regnum == PS_REGNUM)
> - return builtin_type_int;
> - else if ((unsigned) regnum >= A0_REGNUM)
> - return lookup_pointer_type (builtin_type_void);
> - else
> - return builtin_type_int;
> + if (regnum >= FP0_REGNUM && regnum <= FP0_REGNUM + 7)
> + return builtin_type_m68881_ext;
> +
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2002-11-23 0:25 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-22 2:53 m68k_register_virtual_type Andreas Schwab
2002-11-22 7:33 ` m68k_register_virtual_type Andrew Cagney
2002-11-22 8:35 ` m68k_register_virtual_type Andreas Schwab
2002-11-22 8:54 ` m68k_register_virtual_type Andrew Cagney
2002-11-22 9:05 ` m68k_register_virtual_type Andreas Schwab
2002-11-22 15:59 ` m68k_register_virtual_type Andreas Schwab
2002-11-22 16:25 ` m68k_register_virtual_type Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox