* [PATCH]: i386 8-byte wide watchpoints
@ 2001-09-21 0:20 Jiri Smid
2001-09-21 9:06 ` Andrew Cagney
0 siblings, 1 reply; 2+ messages in thread
From: Jiri Smid @ 2001-09-21 0:20 UTC (permalink / raw)
To: gdb-patches
Index: ChangeLog
from Jiri Smid <smid@suse.cz>
* MAINTAINERS: Add myself to the write-after-approval list.
* i386-nat.c (TARGET_HAS_DR_LEN_8, DR_LEN_8): Declare.
(i386_length_and_rw_bits, i386_handle_nonaligned_watchpoint,
i386_insert_watchpoint, i386_remove_watchpoint): Add support for
8-byte wide watchpoints.
(i386_show_dr): Debug message format string change.
Index: MAINTAINERS
===================================================================
RCS file: /cvs/src/src/gdb/MAINTAINERS,v
retrieving revision 1.116
diff -c -3 -p -r1.116 MAINTAINERS
*** MAINTAINERS 2001/09/10 18:13:17 1.116
--- MAINTAINERS 2001/09/21 06:52:29
*************** Pierre Muller muller@sourceware.redh
*** 349,354 ****
--- 349,355 ----
Alexandre Oliva aoliva@redhat.com
Mark Salter msalter@redhat.com
Keith Seitz keiths@redhat.com
+ Jiri Smid smid@suse.cz
David Smith dsmith@redhat.com
Stephen P. Smith ischis2@home.com
Gary Thomas gthomas@redhat.com
Index: i386-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-nat.c,v
retrieving revision 1.3
diff -c -3 -p -r1.3 i386-nat.c
*** i386-nat.c 2001/04/18 00:37:49 1.3
--- i386-nat.c 2001/09/21 06:52:30
***************
*** 60,65 ****
--- 60,70 ----
#ifdef I386_USE_GENERIC_WATCHPOINTS
+ /* Support for 8-byte wide hw watchpoints. */
+ #ifndef TARGET_HAS_DR_LEN_8
+ #define TARGET_HAS_DR_LEN_8 0
+ #endif
+
/* Debug registers' indices. */
#define DR_NADDR 4 /* the number of debug address registers */
#define DR_STATUS 6 /* index of debug status register (DR6) */
***************
*** 89,94 ****
--- 94,100 ----
#define DR_LEN_1 (0x0 << 2) /* 1-byte region watch or breakpt */
#define DR_LEN_2 (0x1 << 2) /* 2-byte region watch */
#define DR_LEN_4 (0x3 << 2) /* 4-byte region watch */
+ #define DR_LEN_8 (0x2 << 2) /* 8-byte region watch (x86-64) */
/* Local and Global Enable flags in DR7.
*************** i386_show_dr (const char *func, CORE_ADD
*** 252,260 ****
dr_control_mirror, dr_status_mirror);
ALL_DEBUG_REGISTERS(i)
{
! printf_unfiltered ("\tDR%d: addr=%08lx, ref.count=%d DR%d: addr=%08lx, ref.count=%d\n",
! i, dr_mirror[i], dr_ref_count[i],
! i+1, dr_mirror[i+1], dr_ref_count[i+1]);
i++;
}
}
--- 258,266 ----
dr_control_mirror, dr_status_mirror);
ALL_DEBUG_REGISTERS(i)
{
! printf_unfiltered ("\tDR%d: addr=0x%s, ref.count=%d DR%d: addr=0x%s, ref.count=%d\n",
! i, paddr(dr_mirror[i]), dr_ref_count[i],
! i+1, paddr(dr_mirror[i+1]), dr_ref_count[i+1]);
i++;
}
}
*************** Invalid hw breakpoint type %d in i386_le
*** 291,302 ****
switch (len)
{
- case 4:
- return (DR_LEN_4 | rw);
- case 2:
- return (DR_LEN_2 | rw);
case 1:
return (DR_LEN_1 | rw);
default:
internal_error (__FILE__, __LINE__, "\
Invalid hw breakpoint length %d in i386_length_and_rw_bits.\n", len);
--- 297,311 ----
switch (len)
{
case 1:
return (DR_LEN_1 | rw);
+ case 2:
+ return (DR_LEN_2 | rw);
+ case 4:
+ return (DR_LEN_4 | rw);
+ case 8:
+ if (TARGET_HAS_DR_LEN_8)
+ return (DR_LEN_8 | rw);
default:
internal_error (__FILE__, __LINE__, "\
Invalid hw breakpoint length %d in i386_length_and_rw_bits.\n", len);
*************** i386_handle_nonaligned_watchpoint (i386_
*** 407,426 ****
int align;
int size;
int rv = 0, status = 0;
! static int size_try_array[4][4] =
{
! { 1, 1, 1, 1 }, /* trying size one */
! { 2, 1, 2, 1 }, /* trying size two */
! { 2, 1, 2, 1 }, /* trying size three */
! { 4, 1, 2, 1 } /* trying size four */
};
while (len > 0)
{
! align = addr % 4;
! /* Four is the maximum length an x86 debug register can watch. */
! size = size_try_array[len > 4 ? 3 : len - 1][align];
if (what == WP_COUNT)
/* size_try_array[] is defined so that each iteration through
the loop is guaranteed to produce an address and a size
--- 416,441 ----
int align;
int size;
int rv = 0, status = 0;
+ int max_wp_len = TARGET_HAS_DR_LEN_8 ? 8 : 4;
! static int size_try_array[8][8] =
{
! {1, 1, 1, 1, 1, 1, 1, 1}, /* trying size one */
! {2, 1, 2, 1, 2, 1, 2, 1}, /* trying size two */
! {2, 1, 2, 1, 2, 1, 2, 1}, /* trying size three */
! {4, 1, 2, 1, 4, 1, 2, 1}, /* trying size four */
! {4, 1, 2, 1, 4, 1, 2, 1}, /* trying size five */
! {4, 1, 2, 1, 4, 1, 2, 1}, /* trying size six */
! {4, 1, 2, 1, 4, 1, 2, 1}, /* trying size seven */
! {8, 1, 2, 1, 4, 1, 2, 1}, /* trying size eight */
};
while (len > 0)
{
! align = addr % max_wp_len;
! /* Four(eigth on x86_64) is the maximum length an x86 debug register
! can watch. */
! size = size_try_array[len > max_wp_len ? (max_wp_len - 1) : len - 1][align];
if (what == WP_COUNT)
/* size_try_array[] is defined so that each iteration through
the loop is guaranteed to produce an address and a size
*************** i386_insert_watchpoint (CORE_ADDR addr,
*** 466,472 ****
{
int retval;
! if (len == 3 || len > 4 || addr % len != 0)
retval = i386_handle_nonaligned_watchpoint (WP_INSERT, addr, len, type);
else
{
--- 481,488 ----
{
int retval;
! if (((len != 1 && len !=2 && len !=4) && !(TARGET_HAS_DR_LEN_8 && len == 8))
! || addr % len != 0)
retval = i386_handle_nonaligned_watchpoint (WP_INSERT, addr, len, type);
else
{
*************** i386_remove_watchpoint (CORE_ADDR addr,
*** 489,495 ****
{
int retval;
! if (len == 3 || len > 4 || addr % len != 0)
retval = i386_handle_nonaligned_watchpoint (WP_REMOVE, addr, len, type);
else
{
--- 505,512 ----
{
int retval;
! if (((len != 1 && len !=2 && len !=4) && !(TARGET_HAS_DR_LEN_8 && len == 8))
! || addr % len != 0)
retval = i386_handle_nonaligned_watchpoint (WP_REMOVE, addr, len, type);
else
{
--
Jiri Smid
---------------------------------------------------------------------
SuSE CR, s.r.o. e-mail: smid@suse.cz
Drahobejlova 27 tel:+420 2 83095 373
190 00 Praha 9 fax:+420 2 83095 374
Ceska republika http://www.suse.cz
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH]: i386 8-byte wide watchpoints
2001-09-21 0:20 [PATCH]: i386 8-byte wide watchpoints Jiri Smid
@ 2001-09-21 9:06 ` Andrew Cagney
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cagney @ 2001-09-21 9:06 UTC (permalink / raw)
To: Jiri Smid; +Cc: gdb-patches
>
> Index: ChangeLog
> from Jiri Smid <smid@suse.cz>
>
> * MAINTAINERS: Add myself to the write-after-approval list.
Jiri, just fyi. People try to keep un-related changes separate(1).
Additions/changes to the MAINTAINERS file are considered obvious (your
addition is very obvious and most welcome!) so they just go straight
in (another generalization is: commit a change, post a patch(2)).
If you're wondering, I personally keep track of this by having
multiple GDB source trees, one for each change I submit. Before going
on a hacking frenzy, I'll `tar cf - src | tar xpf -` a clean tree and
then hack away.
enjoy,
Andrew
(1) People also do things like: pick all the obvious bits of a change
out and then commit them separatly as they don't need approval; or get
approval in principal for not-so-obvious changes and thus make them
obvious :-)
(2) Unless it is a really embarising foobar to the ChangeLog file or
...
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-09-21 9:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-21 0:20 [PATCH]: i386 8-byte wide watchpoints Jiri Smid
2001-09-21 9:06 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox