* [patch/rfc] h8300 Change literal reg numbers to REGNUM macros
@ 2002-05-15 4:32 Andrew Volkov
2002-05-15 5:04 ` Richard Earnshaw
0 siblings, 1 reply; 12+ messages in thread
From: Andrew Volkov @ 2002-05-15 4:32 UTC (permalink / raw)
To: gdb-patches
Hi,
Attached is a patch to fix literal regnumbers in switches to appropriate
macros.
Andrey Volkov
2002-05-15 Andrey Volkov <avolkov@sources.redhat.com>
* gdb/h8300-tdep.c: Fix literal regnumbers to REGNUMS.
* sim/h8300/compile.c: Ditto.
* sim/h8300/compile.c: Fix instruction and cycles counting
Index: gdb/h8300-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/h8300-tdep.c,v
retrieving revision 1.7
diff -u -u -c -p -r1.7 h8300-tdep.c
*** gdb/h8300-tdep.c 16 Mar 2001 22:34:45 -0000 1.7
--- gdb/h8300-tdep.c 15 May 2002 11:13:30 -0000
*************** _initialize_h8300m (void)
*** 828,841 ****
void
h8300_print_register_hook (int regno)
{
! if (regno == 8)
{
/* CCR register */
int C, Z, N, V;
! unsigned char b[4];
unsigned char l;
read_relative_register_raw_bytes (regno, b);
! l = b[REGISTER_VIRTUAL_SIZE (8) - 1];
printf_unfiltered ("\t");
printf_unfiltered ("I-%d - ", (l & 0x80) != 0);
printf_unfiltered ("H-%d - ", (l & 0x20) != 0);
--- 828,841 ----
void
h8300_print_register_hook (int regno)
{
! if (regno == CCR_REGNUM)
{
/* CCR register */
int C, Z, N, V;
! unsigned char b[REGISTER_SIZE];
unsigned char l;
read_relative_register_raw_bytes (regno, b);
! l = b[REGISTER_VIRTUAL_SIZE (CCR_REGNUM) - 1];
printf_unfiltered ("\t");
printf_unfiltered ("I-%d - ", (l & 0x80) != 0);
printf_unfiltered ("H-%d - ", (l & 0x20) != 0);
Index: sim/h8300/compile.c
===================================================================
RCS file: /cvs/src/src/sim/h8300/compile.c,v
retrieving revision 1.8
diff -u -u -c -p -r1.8 compile.c
*** sim/h8300/compile.c 20 Dec 2001 17:36:23 -0000 1.8
--- sim/h8300/compile.c 15 May 2002 11:13:31 -0000
*************** static int memory_size;
*** 111,120 ****
static int
get_now ()
{
! #ifndef WIN32
! return time (0);
! #endif
! return 0;
}
static int
--- 111,117 ----
static int
get_now ()
{
! return time (0); //WinXX HAS UNIX like 'time', so why not using it?
}
static int
*************** lvalue (x, rn)
*** 155,161 ****
return X (OP_MEM, SP);
default:
! abort ();
}
}
--- 152,158 ----
return X (OP_MEM, SP);
default:
! abort (); //?? May be something more usefull?
}
}
*************** fetch (arg, n)
*** 608,614 ****
return t;
default:
! abort ();
}
}
--- 605,611 ----
return t;
default:
! abort (); //?? May be something more usefull?
}
}
*************** sim_resume (sd, step, siggnal)
*** 997,1004 ****
#endif
! cycles += code->cycles;
! insts++;
switch (code->opcode)
{
case 0:
--- 994,1005 ----
#endif
! if (code->opcode)
! {
! cycles += code->cycles;
! insts++;
! }
!
switch (code->opcode)
{
case 0:
*************** sim_fetch_register (sd, rn, buf, length)
*** 1860,1869 ****
{
default:
abort ();
! case 8:
v = cpu.ccr;
break;
! case 9:
v = cpu.pc;
break;
case R0_REGNUM:
--- 1861,1870 ----
{
default:
abort ();
! case CCR_REGNUM:
v = cpu.ccr;
break;
! case PC_REGNUM:
v = cpu.pc;
break;
case R0_REGNUM:
*************** sim_fetch_register (sd, rn, buf, length)
*** 1876,1890 ****
case R7_REGNUM:
v = cpu.regs[rn];
break;
! case 10:
v = cpu.cycles;
longreg = 1;
break;
! case 11:
v = cpu.ticks;
longreg = 1;
break;
! case 12:
v = cpu.insts;
longreg = 1;
break;
--- 1877,1891 ----
case R7_REGNUM:
v = cpu.regs[rn];
break;
! case CYCLE_REGNUM:
v = cpu.cycles;
longreg = 1;
break;
! case TICK_REGNUM:
v = cpu.ticks;
longreg = 1;
break;
! case INST_REGNUM:
v = cpu.insts;
longreg = 1;
break;
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch/rfc] h8300 Change literal reg numbers to REGNUM macros
2002-05-15 4:32 [patch/rfc] h8300 Change literal reg numbers to REGNUM macros Andrew Volkov
@ 2002-05-15 5:04 ` Richard Earnshaw
2002-05-15 5:33 ` Andreas Schwab
0 siblings, 1 reply; 12+ messages in thread
From: Richard Earnshaw @ 2002-05-15 5:04 UTC (permalink / raw)
To: Andrew Volkov; +Cc: gdb-patches, Richard.Earnshaw
! return time (0); //WinXX HAS UNIX like 'time', so why not using it?
C++ style comments are not legal ANSI C.
R.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch/rfc] h8300 Change literal reg numbers to REGNUM macros
2002-05-15 5:04 ` Richard Earnshaw
@ 2002-05-15 5:33 ` Andreas Schwab
2002-05-15 5:39 ` Richard Earnshaw
0 siblings, 1 reply; 12+ messages in thread
From: Andreas Schwab @ 2002-05-15 5:33 UTC (permalink / raw)
To: Richard.Earnshaw; +Cc: Andrew Volkov, gdb-patches
Richard Earnshaw <rearnsha@arm.com> writes:
|> ! return time (0); //WinXX HAS UNIX like 'time', so why not using it?
|>
|> C++ style comments are not legal ANSI C.
Hmm, which ANSI C do you mean? C++ style comments are surely valid in
ANSI C as we know it today.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE GmbH, 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] 12+ messages in thread
* Re: [patch/rfc] h8300 Change literal reg numbers to REGNUM macros
2002-05-15 5:33 ` Andreas Schwab
@ 2002-05-15 5:39 ` Richard Earnshaw
2002-05-15 5:49 ` Andreas Schwab
0 siblings, 1 reply; 12+ messages in thread
From: Richard Earnshaw @ 2002-05-15 5:39 UTC (permalink / raw)
To: Andreas Schwab; +Cc: Richard.Earnshaw, Andrew Volkov, gdb-patches
> Richard Earnshaw <rearnsha@arm.com> writes:
>
> |> ! return time (0); //WinXX HAS UNIX like 'time', so why not using it?
> |>
> |> C++ style comments are not legal ANSI C.
>
> Hmm, which ANSI C do you mean? C++ style comments are surely valid in
> ANSI C as we know it today.
>
> Andreas.
>
c89, the original (which, to the best of my knowledge is the standard GDB
is coded to). C++ style comments didn't become legal in C until c99.
R.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch/rfc] h8300 Change literal reg numbers to REGNUM macros
2002-05-15 5:39 ` Richard Earnshaw
@ 2002-05-15 5:49 ` Andreas Schwab
2002-05-15 5:57 ` Richard Earnshaw
0 siblings, 1 reply; 12+ messages in thread
From: Andreas Schwab @ 2002-05-15 5:49 UTC (permalink / raw)
To: Richard.Earnshaw; +Cc: Andrew Volkov, gdb-patches
Richard Earnshaw <rearnsha@arm.com> writes:
|> > Richard Earnshaw <rearnsha@arm.com> writes:
|> >
|> > |> ! return time (0); //WinXX HAS UNIX like 'time', so why not using it?
|> > |>
|> > |> C++ style comments are not legal ANSI C.
|> >
|> > Hmm, which ANSI C do you mean? C++ style comments are surely valid in
|> > ANSI C as we know it today.
|> >
|> > Andreas.
|> >
|>
|> c89, the original (which, to the best of my knowledge is the standard GDB
|> is coded to). C++ style comments didn't become legal in C until c99.
I know, but you should say that explicitly. Your original statement is
not correct in this form.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE GmbH, 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] 12+ messages in thread
* Re: [patch/rfc] h8300 Change literal reg numbers to REGNUM macros
2002-05-15 5:49 ` Andreas Schwab
@ 2002-05-15 5:57 ` Richard Earnshaw
2002-05-15 6:21 ` Andreas Schwab
0 siblings, 1 reply; 12+ messages in thread
From: Richard Earnshaw @ 2002-05-15 5:57 UTC (permalink / raw)
To: Andreas Schwab; +Cc: Richard.Earnshaw, gdb-patches
> |> > Hmm, which ANSI C do you mean? C++ style comments are surely valid in
> |> > ANSI C as we know it today.
> |>
> |> c89, the original (which, to the best of my knowledge is the standard GDB
> |> is coded to). C++ style comments didn't become legal in C until c99.
>
> I know, but you should say that explicitly. Your original statement is
> not correct in this form.
I dispute that, in the sense that since I didn't explicitly mention a
version I could have been talking about any sub-set up to or including the
entire set.
Further, it's general to talk about 'ISO' when referring to c99. I said
'ANSI', which is usually taken to refer to the original standard.
And anyway, the important point here is that GDB is not being coded to c99.
R.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch/rfc] h8300 Change literal reg numbers to REGNUM macros
2002-05-15 5:57 ` Richard Earnshaw
@ 2002-05-15 6:21 ` Andreas Schwab
2002-05-15 9:56 ` Andrew Cagney
0 siblings, 1 reply; 12+ messages in thread
From: Andreas Schwab @ 2002-05-15 6:21 UTC (permalink / raw)
To: Richard.Earnshaw; +Cc: gdb-patches
Richard Earnshaw <rearnsha@arm.com> writes:
|> Further, it's general to talk about 'ISO' when referring to c99. I said
|> 'ANSI', which is usually taken to refer to the original standard.
I'm pretty sure that ANSI has adopted C99 too. And C89 (well, C90
actually) was an ISO standard as well.
|> And anyway, the important point here is that GDB is not being coded to c99.
No sweat.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE GmbH, 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] 12+ messages in thread
* Re: [patch/rfc] h8300 Change literal reg numbers to REGNUM macros
2002-05-15 6:21 ` Andreas Schwab
@ 2002-05-15 9:56 ` Andrew Cagney
2002-05-15 10:05 ` Richard Earnshaw
0 siblings, 1 reply; 12+ messages in thread
From: Andrew Cagney @ 2002-05-15 9:56 UTC (permalink / raw)
To: Andreas Schwab; +Cc: Richard.Earnshaw, gdb-patches
> Richard Earnshaw <rearnsha@arm.com> writes:
>
> |> Further, it's general to talk about 'ISO' when referring to c99. I said
> |> 'ANSI', which is usually taken to refer to the original standard.
>
> I'm pretty sure that ANSI has adopted C99 too. And C89 (well, C90
> actually) was an ISO standard as well.
GDB requires ISO C, not ANSI C :-)
http://sources.redhat.com/gdb/onlinedocs/gdbint_13.html#SEC102
(Yes I need to fix the ``ISO-C'' typo, clarify which ISO C standard (in
case there are two), and yes ISO simply adopted the ANSI standard :-)
Any way, the MINIX compiler doesn't accept C++ style comments so I don't
think it can be used.... Hmmm, should see if GDB compiles on that
platform :-^
> |> And anyway, the important point here is that GDB is not being coded to c99.
>
> No sweat.
I think the important thing is to pressure GCC and BINUTILS to drop the
K&R C requirement :-)
enjoy,
Andrew
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch/rfc] h8300 Change literal reg numbers to REGNUM macros
2002-05-15 9:56 ` Andrew Cagney
@ 2002-05-15 10:05 ` Richard Earnshaw
2002-05-18 14:20 ` Andrew Cagney
0 siblings, 1 reply; 12+ messages in thread
From: Richard Earnshaw @ 2002-05-15 10:05 UTC (permalink / raw)
To: Andrew Cagney; +Cc: Andreas Schwab, Richard.Earnshaw, gdb-patches
> > Richard Earnshaw <rearnsha@arm.com> writes:
> >
> > |> Further, it's general to talk about 'ISO' when referring to c99. I said
> > |> 'ANSI', which is usually taken to refer to the original standard.
> >
> > I'm pretty sure that ANSI has adopted C99 too. And C89 (well, C90
> > actually) was an ISO standard as well.
>
> GDB requires ISO C, not ANSI C :-)
> http://sources.redhat.com/gdb/onlinedocs/gdbint_13.html#SEC102
I just built gdb on arm-netbsdelf with -std=c89 -Werror added to the build
options. Apart from needing to add -Wno-trigraphs to compile solib-svr4.c
('cos it includes elf/mips.h, which has '???' in coments), everything
worked fine.
Maybe we should work towards adding the 'std' option on builds. It should
help to clear out any accidental use of GCC-isms.
R.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [patch/rfc] h8300 Change literal reg numbers to REGNUM macros
2002-05-15 10:05 ` Richard Earnshaw
@ 2002-05-18 14:20 ` Andrew Cagney
0 siblings, 0 replies; 12+ messages in thread
From: Andrew Cagney @ 2002-05-18 14:20 UTC (permalink / raw)
To: Richard.Earnshaw; +Cc: Andreas Schwab, gdb-patches
> Maybe we should work towards adding the 'std' option on builds. It should
> help to clear out any accidental use of GCC-isms.
Sound good. (Probably time to stomp out another selected warning as well.)
Andrew
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [patch/rfc] h8300 Change literal reg numbers to REGNUM macros
@ 2002-05-15 6:59 Andrew Volkov
0 siblings, 0 replies; 12+ messages in thread
From: Andrew Volkov @ 2002-05-15 6:59 UTC (permalink / raw)
To: Andreas Schwab; +Cc: gdb-patches
Andreas,
I think difference of c99 and ANSI is offtopic here.
Are you have any suggestions about patch?
Andrey
> -----Original Message-----
> From: Andreas Schwab [mailto:schwab@suse.de]
> Sent: Wednesday, May 15, 2002 5:21 PM
> To: Richard.Earnshaw@arm.com
> Cc: gdb-patches@sources.redhat.com
> Subject: Re: [patch/rfc] h8300 Change literal reg numbers to
> REGNUM macros
>
>
> Richard Earnshaw <rearnsha@arm.com> writes:
>
> |> Further, it's general to talk about 'ISO' when referring
> to c99. I said
> |> 'ANSI', which is usually taken to refer to the original standard.
>
> I'm pretty sure that ANSI has adopted C99 too. And C89 (well, C90
> actually) was an ISO standard as well.
>
> |> And anyway, the important point here is that GDB is not
> being coded to c99.
>
> No sweat.
>
> Andreas.
>
> --
> Andreas Schwab, SuSE Labs, schwab@suse.de
> SuSE GmbH, 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] 12+ messages in thread
* RE: [patch/rfc] h8300 Change literal reg numbers to REGNUM macros
@ 2002-05-15 6:02 Andrew Volkov
0 siblings, 0 replies; 12+ messages in thread
From: Andrew Volkov @ 2002-05-15 6:02 UTC (permalink / raw)
To: gdb-patches
Corrected
Andrey
>
> > -----Original Message-----
> > From: Richard Earnshaw [mailto:rearnsha@arm.com]
> > Sent: Wednesday, May 15, 2002 4:04 PM
> > To: Andrew Volkov
> > Cc: gdb-patches@sources.redhat.com; Richard.Earnshaw@arm.com
> > Subject: [patch/rfc] h8300 Change literal reg numbers to
> REGNUM macros
> >
> >
> > ! return time (0); //WinXX HAS UNIX like 'time', so why
> > not using it?
> > C++ style comments are not legal ANSI C.
> >
> > R.
> >
> >
>
Index: gdb/h8300-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/h8300-tdep.c,v
retrieving revision 1.7
diff -u -u -c -p -r1.7 h8300-tdep.c
*** h8300-tdep.c 16 Mar 2001 22:34:45 -0000 1.7
--- h8300-tdep.c 15 May 2002 12:45:44 -0000
*************** _initialize_h8300m (void)
*** 828,841 ****
void
h8300_print_register_hook (int regno)
{
! if (regno == 8)
{
/* CCR register */
int C, Z, N, V;
! unsigned char b[4];
unsigned char l;
read_relative_register_raw_bytes (regno, b);
! l = b[REGISTER_VIRTUAL_SIZE (8) - 1];
printf_unfiltered ("\t");
printf_unfiltered ("I-%d - ", (l & 0x80) != 0);
printf_unfiltered ("H-%d - ", (l & 0x20) != 0);
--- 828,841 ----
void
h8300_print_register_hook (int regno)
{
! if (regno == CCR_REGNUM)
{
/* CCR register */
int C, Z, N, V;
! unsigned char b[REGISTER_SIZE];
unsigned char l;
read_relative_register_raw_bytes (regno, b);
! l = b[REGISTER_VIRTUAL_SIZE (CCR_REGNUM) - 1];
printf_unfiltered ("\t");
printf_unfiltered ("I-%d - ", (l & 0x80) != 0);
printf_unfiltered ("H-%d - ", (l & 0x20) != 0);
Index: sim/h8300/compile.c
===================================================================
RCS file: /cvs/src/src/sim/h8300/compile.c,v
retrieving revision 1.8
diff -u -r1.8 compile.c
--- h8300/compile.c 20 Dec 2001 17:36:23 -0000 1.8
+++ h8300/compile.c 15 May 2002 12:41:48 -0000
@@ -111,10 +111,7 @@
static int
get_now ()
{
-#ifndef WIN32
- return time (0);
-#endif
- return 0;
+ return time (0); /* WinXX HAS UNIX like 'time', so why not using it?
*/
}
static int
@@ -155,7 +152,7 @@
return X (OP_MEM, SP);
default:
- abort ();
+ abort (); /* ?? May be something more usefull? */
}
}
@@ -608,7 +605,7 @@
return t;
default:
- abort ();
+ abort (); /* ?? May be something more usefull? */
}
}
@@ -997,8 +994,12 @@
#endif
- cycles += code->cycles;
- insts++;
+ if (code->opcode)
+ {
+ cycles += code->cycles;
+ insts++;
+ }
+
switch (code->opcode)
{
case 0:
@@ -1860,10 +1861,10 @@
{
default:
abort ();
- case 8:
+ case CCR_REGNUM:
v = cpu.ccr;
break;
- case 9:
+ case PC_REGNUM:
v = cpu.pc;
break;
case R0_REGNUM:
@@ -1876,15 +1877,15 @@
case R7_REGNUM:
v = cpu.regs[rn];
break;
- case 10:
+ case CYCLE_REGNUM:
v = cpu.cycles;
longreg = 1;
break;
- case 11:
+ case TICK_REGNUM:
v = cpu.ticks;
longreg = 1;
break;
- case 12:
+ case INST_REGNUM:
v = cpu.insts;
longreg = 1;
break;
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2002-05-18 21:20 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-15 4:32 [patch/rfc] h8300 Change literal reg numbers to REGNUM macros Andrew Volkov
2002-05-15 5:04 ` Richard Earnshaw
2002-05-15 5:33 ` Andreas Schwab
2002-05-15 5:39 ` Richard Earnshaw
2002-05-15 5:49 ` Andreas Schwab
2002-05-15 5:57 ` Richard Earnshaw
2002-05-15 6:21 ` Andreas Schwab
2002-05-15 9:56 ` Andrew Cagney
2002-05-15 10:05 ` Richard Earnshaw
2002-05-18 14:20 ` Andrew Cagney
2002-05-15 6:02 Andrew Volkov
2002-05-15 6:59 Andrew Volkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox