* [PATCH] Use `unsigned long' for Linux/x86 debug registers
@ 2001-04-01 3:59 Mark Kettenis
2001-04-01 4:06 ` Eli Zaretskii
0 siblings, 1 reply; 3+ messages in thread
From: Mark Kettenis @ 2001-04-01 3:59 UTC (permalink / raw)
To: gdb-patches
It just occurred to me that Linux/x86 should really be using `unsigned
long' instead of `long' as the type for debug register values.
Checked in.
Mark
Index: ChangeLog
from Mark Kettenis <kettenis@gnu.org>
* i386-linux-nat.c (i386_linux_dr_get): Change type of return
value to `unsigned long'. Change type of `value' to `unsigned
long'.
(i386_linux_dr_set): Change type of second argument to `unsigned
long'.
(i386_linux_dr_set_control): Change type of first argument to
`unsigned long'.
(i386_linux_dr_get_status): Change type of return value to
unsigned long.
* config/i386/nm-linux.h (i386_linux_dr_set_control,
i386_linux_dr_get_status): Adjust prototypes accordingly.
Index: i386-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-linux-nat.c,v
retrieving revision 1.25
diff -u -p -r1.25 i386-linux-nat.c
--- i386-linux-nat.c 2001/03/28 08:35:14 1.25
+++ i386-linux-nat.c 2001/04/01 10:47:28
@@ -701,11 +701,11 @@ store_inferior_registers (int regno)
}
\f
-static long
+static unsigned long
i386_linux_dr_get (int regnum)
{
int tid;
- long value;
+ unsigned long value;
/* FIXME: kettenis/2001-01-29: It's not clear what we should do with
multi-threaded processes here. For now, pretend there is just
@@ -731,7 +731,7 @@ i386_linux_dr_get (int regnum)
}
static void
-i386_linux_dr_set (int regnum, long value)
+i386_linux_dr_set (int regnum, unsigned long value)
{
int tid;
@@ -748,7 +748,7 @@ i386_linux_dr_set (int regnum, long valu
}
void
-i386_linux_dr_set_control (long control)
+i386_linux_dr_set_control (unsigned long control)
{
i386_linux_dr_set (DR_CONTROL, control);
}
@@ -769,7 +769,7 @@ i386_linux_dr_reset_addr (int regnum)
i386_linux_dr_set (DR_FIRSTADDR + regnum, 0L);
}
-long
+unsigned long
i386_linux_dr_get_status (void)
{
return i386_linux_dr_get (DR_STATUS);
@@ -916,7 +916,7 @@ child_resume (int pid, int step, enum ta
CORE_ADDR sp = read_register (SP_REGNUM);
CORE_ADDR addr = sp;
unsigned long int eflags;
-
+
if (syscall == SYS_rt_sigreturn)
addr = read_memory_integer (sp + 8, 4) + 20;
Index: config/i386/nm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nm-linux.h,v
retrieving revision 1.9
diff -u -p -r1.9 nm-linux.h
--- config/i386/nm-linux.h 2001/03/21 21:22:49 1.9
+++ config/i386/nm-linux.h 2001/04/01 10:47:29
@@ -43,7 +43,7 @@ extern CORE_ADDR register_u_addr (CORE_A
/* Provide access to the i386 hardware debugging registers. */
-extern void i386_linux_dr_set_control (long control);
+extern void i386_linux_dr_set_control (unsigned long control);
#define I386_DR_LOW_SET_CONTROL(control) \
i386_linux_dr_set_control (control)
@@ -55,7 +55,7 @@ extern void i386_linux_dr_reset_addr (in
#define I386_DR_LOW_RESET_ADDR(regnum) \
i386_linux_dr_reset_addr (regnum)
-extern long i386_linux_dr_get_status (void);
+extern unsigned long i386_linux_dr_get_status (void);
#define I386_DR_LOW_GET_STATUS() \
i386_linux_dr_get_status ()
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] Use `unsigned long' for Linux/x86 debug registers
2001-04-01 3:59 [PATCH] Use `unsigned long' for Linux/x86 debug registers Mark Kettenis
@ 2001-04-01 4:06 ` Eli Zaretskii
2001-04-01 8:04 ` Mark Kettenis
0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2001-04-01 4:06 UTC (permalink / raw)
To: Mark Kettenis; +Cc: gdb-patches
On Sun, 1 Apr 2001, Mark Kettenis wrote:
> It just occurred to me that Linux/x86 should really be using `unsigned
> long' instead of `long' as the type for debug register values.
They should indeed be unsigned, but why `unsigned long' instead of
`unsigned int'? i386-nat.c uses the latter, and ia32 debug registers
are 32-bit wide.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Use `unsigned long' for Linux/x86 debug registers
2001-04-01 4:06 ` Eli Zaretskii
@ 2001-04-01 8:04 ` Mark Kettenis
0 siblings, 0 replies; 3+ messages in thread
From: Mark Kettenis @ 2001-04-01 8:04 UTC (permalink / raw)
To: eliz; +Cc: gdb-patches
Date: Sun, 1 Apr 2001 13:04:44 +0200 (IST)
From: Eli Zaretskii <eliz@is.elta.co.il>
On Sun, 1 Apr 2001, Mark Kettenis wrote:
> It just occurred to me that Linux/x86 should really be using `unsigned
> long' instead of `long' as the type for debug register values.
They should indeed be unsigned, but why `unsigned long' instead of
`unsigned int'? i386-nat.c uses the latter, and ia32 debug registers
are 32-bit wide.
Well an `unsigned int' *might* be 16-bits, wheras ISO C guarantees
that `unsigned long' is at least 32-bits. All that matters, is that
the variables that we use to store ia32 debug registers are at least
32-bit wide. I was planning on changing i386-nat.c to use `unsigned
long' in the relevant places. This all doesn't really matter for
native stuff, but if we ever move this code to i386-tdep.c it might
matter. Better fix it now than be sorry later :-).
Mark
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2001-04-01 8:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-01 3:59 [PATCH] Use `unsigned long' for Linux/x86 debug registers Mark Kettenis
2001-04-01 4:06 ` Eli Zaretskii
2001-04-01 8:04 ` Mark Kettenis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox