* [PATCH] ia64-linux-nat.c: Make HW watchpoint support work again
@ 2001-03-31 14:30 Kevin Buettner
2001-04-01 0:46 ` Eli Zaretskii
0 siblings, 1 reply; 2+ messages in thread
From: Kevin Buettner @ 2001-03-31 14:30 UTC (permalink / raw)
To: gdb-patches
The patch below, which I have just committed, makes hardware
watchpoint support work again for Linux/IA-64. At some undetermined
point in the past, the TRAP_HWBKPT constant was changed, but
ia64-linux-nat.c had not been updated to reflect this change.
There *is* a header file, <asm/siginfo.h>, which defines this constant
and it would be nice to just include it so that we don't have to
hard code the value in GDB. I see two problems with this though:
1) It appears that struct siginfo doesn't exactly match between
<asm/siginfo.h> and <bits/siginfo.h>. This latter file is the
glibc version of things and if I try to include the kernel
version, the definitions will conflict. (There's probably a
lot of other stuff which would conflict too.)
To be very precise, the glibc version of struct siginfo
has a member __pad0 which comes immediately after si_code.
The Linux kernel version does not have this member, but rather
relies on the ABI's alignment requirements to implicitly insert
the padding.
There may be other differences too, but this is the one that
I noticed.
2) Even if I were able to somehow avoid the above problem, the
kernel header defines TRAP_HWBKPT differently depending upon
whether or not __KERNEL_ is defined. If __KERNEL__ is defined,
TRAP_HWBKPT will have the value 0x30004. If __KERNEL__ is
not defined, TRAP_HWBKPT will be 4. It doesn't seem like a
good idea to me to define __KERNEL__ in non-kernel code (i.e.
GDB).
I'll also note that the glibc header <bits/siginfo.h> will
define TRAP_HWBKPT to be 4 only when __USE_GNU is defined.
Clearly this won't match the kernel headers even if I were
to define __USE_GNU.
So, I conclude that it is easier (and safer) to just hard code this
constant in GDB. If someone has a better suggestion, I'm willing
to listen...
* ia64-linux-nat.c (ia64_linux_stopped_by_watchpoint): Change
TRAP_HWBKPT constant to match that in the kernel headers for
Linux/IA-64.
Index: ia64-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/ia64-linux-nat.c,v
retrieving revision 1.8
diff -u -p -r1.8 ia64-linux-nat.c
--- ia64-linux-nat.c 2001/03/01 01:39:21 1.8
+++ ia64-linux-nat.c 2001/03/31 21:48:28
@@ -630,7 +630,7 @@ ia64_linux_stopped_by_watchpoint (int pi
errno = 0;
ptrace (PTRACE_GETSIGINFO, tid, (PTRACE_ARG3_TYPE) 0, &siginfo);
- if (errno != 0 || siginfo.si_code != 4 /* TRAP_HWBKPT */)
+ if (errno != 0 || siginfo.si_code != 0x30004 /* TRAP_HWBKPT */)
return 0;
psr = read_register_pid (IA64_PSR_REGNUM, pid);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] ia64-linux-nat.c: Make HW watchpoint support work again
2001-03-31 14:30 [PATCH] ia64-linux-nat.c: Make HW watchpoint support work again Kevin Buettner
@ 2001-04-01 0:46 ` Eli Zaretskii
0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2001-04-01 0:46 UTC (permalink / raw)
To: Kevin Buettner; +Cc: gdb-patches
On Sat, 31 Mar 2001, Kevin Buettner wrote:
> So, I conclude that it is easier (and safer) to just hard code this
> constant in GDB. If someone has a better suggestion, I'm willing
> to listen...
>
> * ia64-linux-nat.c (ia64_linux_stopped_by_watchpoint): Change
> TRAP_HWBKPT constant to match that in the kernel headers for
> Linux/IA-64.
>
> Index: ia64-linux-nat.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/ia64-linux-nat.c,v
> retrieving revision 1.8
> diff -u -p -r1.8 ia64-linux-nat.c
> --- ia64-linux-nat.c 2001/03/01 01:39:21 1.8
> +++ ia64-linux-nat.c 2001/03/31 21:48:28
> @@ -630,7 +630,7 @@ ia64_linux_stopped_by_watchpoint (int pi
> errno = 0;
> ptrace (PTRACE_GETSIGINFO, tid, (PTRACE_ARG3_TYPE) 0, &siginfo);
>
> - if (errno != 0 || siginfo.si_code != 4 /* TRAP_HWBKPT */)
> + if (errno != 0 || siginfo.si_code != 0x30004 /* TRAP_HWBKPT */)
> return 0;
How about masking the high bits of si_code? Then it would work for
both cases, and will probably suffer less bitrot in the future.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-04-01 0:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-31 14:30 [PATCH] ia64-linux-nat.c: Make HW watchpoint support work again Kevin Buettner
2001-04-01 0:46 ` Eli Zaretskii
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox