2011-12-14 Yao Qi <yao@codesourcery.com>
[deliverable/binutils-gdb.git] / gdb / gdbserver / i386-low.c
CommitLineData
e6f9de87
DE
1/* Debug register code for the i386.
2
7b6bb8da 3 Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
e6f9de87
DE
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20#include "server.h"
21#include "target.h"
22#include "i386-low.h"
23
24/* Support for 8-byte wide hw watchpoints. */
25#ifndef TARGET_HAS_DR_LEN_8
26/* NOTE: sizeof (long) == 4 on win64. */
27#define TARGET_HAS_DR_LEN_8 (sizeof (void *) == 8)
28#endif
29
30enum target_hw_bp_type
31 {
32 hw_write = 0, /* Common HW watchpoint */
33 hw_read = 1, /* Read HW watchpoint */
34 hw_access = 2, /* Access HW watchpoint */
35 hw_execute = 3 /* Execute HW breakpoint */
36 };
37
38/* DR7 Debug Control register fields. */
39
40/* How many bits to skip in DR7 to get to R/W and LEN fields. */
41#define DR_CONTROL_SHIFT 16
42/* How many bits in DR7 per R/W and LEN field for each watchpoint. */
43#define DR_CONTROL_SIZE 4
44
45/* Watchpoint/breakpoint read/write fields in DR7. */
46#define DR_RW_EXECUTE (0x0) /* Break on instruction execution. */
47#define DR_RW_WRITE (0x1) /* Break on data writes. */
48#define DR_RW_READ (0x3) /* Break on data reads or writes. */
49
50/* This is here for completeness. No platform supports this
51 functionality yet (as of March 2001). Note that the DE flag in the
52 CR4 register needs to be set to support this. */
53#ifndef DR_RW_IORW
54#define DR_RW_IORW (0x2) /* Break on I/O reads or writes. */
55#endif
56
57/* Watchpoint/breakpoint length fields in DR7. The 2-bit left shift
58 is so we could OR this with the read/write field defined above. */
59#define DR_LEN_1 (0x0 << 2) /* 1-byte region watch or breakpoint. */
60#define DR_LEN_2 (0x1 << 2) /* 2-byte region watch. */
61#define DR_LEN_4 (0x3 << 2) /* 4-byte region watch. */
62#define DR_LEN_8 (0x2 << 2) /* 8-byte region watch (AMD64). */
63
64/* Local and Global Enable flags in DR7.
65
66 When the Local Enable flag is set, the breakpoint/watchpoint is
67 enabled only for the current task; the processor automatically
68 clears this flag on every task switch. When the Global Enable flag
69 is set, the breakpoint/watchpoint is enabled for all tasks; the
70 processor never clears this flag.
71
72 Currently, all watchpoint are locally enabled. If you need to
73 enable them globally, read the comment which pertains to this in
74 i386_insert_aligned_watchpoint below. */
75#define DR_LOCAL_ENABLE_SHIFT 0 /* Extra shift to the local enable bit. */
76#define DR_GLOBAL_ENABLE_SHIFT 1 /* Extra shift to the global enable bit. */
77#define DR_ENABLE_SIZE 2 /* Two enable bits per debug register. */
78
79/* Local and global exact breakpoint enable flags (a.k.a. slowdown
80 flags). These are only required on i386, to allow detection of the
81 exact instruction which caused a watchpoint to break; i486 and
82 later processors do that automatically. We set these flags for
83 backwards compatibility. */
84#define DR_LOCAL_SLOWDOWN (0x100)
85#define DR_GLOBAL_SLOWDOWN (0x200)
86
87/* Fields reserved by Intel. This includes the GD (General Detect
88 Enable) flag, which causes a debug exception to be generated when a
89 MOV instruction accesses one of the debug registers.
90
91 FIXME: My Intel manual says we should use 0xF800, not 0xFC00. */
92#define DR_CONTROL_RESERVED (0xFC00)
93
94/* Auxiliary helper macros. */
95
96/* A value that masks all fields in DR7 that are reserved by Intel. */
97#define I386_DR_CONTROL_MASK (~DR_CONTROL_RESERVED)
98
99/* The I'th debug register is vacant if its Local and Global Enable
100 bits are reset in the Debug Control register. */
101#define I386_DR_VACANT(state, i) \
102 (((state)->dr_control_mirror & (3 << (DR_ENABLE_SIZE * (i)))) == 0)
103
104/* Locally enable the break/watchpoint in the I'th debug register. */
105#define I386_DR_LOCAL_ENABLE(state, i) \
106 do { \
107 (state)->dr_control_mirror |= \
108 (1 << (DR_LOCAL_ENABLE_SHIFT + DR_ENABLE_SIZE * (i))); \
109 } while (0)
110
111/* Globally enable the break/watchpoint in the I'th debug register. */
112#define I386_DR_GLOBAL_ENABLE(state, i) \
113 do { \
114 (state)->dr_control_mirror |= \
115 (1 << (DR_GLOBAL_ENABLE_SHIFT + DR_ENABLE_SIZE * (i))); \
116 } while (0)
117
118/* Disable the break/watchpoint in the I'th debug register. */
119#define I386_DR_DISABLE(state, i) \
120 do { \
121 (state)->dr_control_mirror &= \
122 ~(3 << (DR_ENABLE_SIZE * (i))); \
123 } while (0)
124
125/* Set in DR7 the RW and LEN fields for the I'th debug register. */
126#define I386_DR_SET_RW_LEN(state, i,rwlen) \
127 do { \
128 (state)->dr_control_mirror &= \
129 ~(0x0f << (DR_CONTROL_SHIFT + DR_CONTROL_SIZE * (i))); \
130 (state)->dr_control_mirror |= \
131 ((rwlen) << (DR_CONTROL_SHIFT + DR_CONTROL_SIZE * (i))); \
132 } while (0)
133
134/* Get from DR7 the RW and LEN fields for the I'th debug register. */
964e4306
PA
135#define I386_DR_GET_RW_LEN(dr7, i) \
136 (((dr7) \
e6f9de87
DE
137 >> (DR_CONTROL_SHIFT + DR_CONTROL_SIZE * (i))) & 0x0f)
138
139/* Did the watchpoint whose address is in the I'th register break? */
964e4306 140#define I386_DR_WATCH_HIT(dr6, i) ((dr6) & (1 << (i)))
e6f9de87
DE
141
142/* A macro to loop over all debug registers. */
143#define ALL_DEBUG_REGISTERS(i) for (i = 0; i < DR_NADDR; i++)
144
145/* Types of operations supported by i386_handle_nonaligned_watchpoint. */
146typedef enum { WP_INSERT, WP_REMOVE, WP_COUNT } i386_wp_op_t;
147\f
148/* Implementation. */
149
150/* Clear the reference counts and forget everything we knew about the
151 debug registers. */
152
153void
154i386_low_init_dregs (struct i386_debug_reg_state *state)
155{
156 int i;
157
158 ALL_DEBUG_REGISTERS (i)
159 {
160 state->dr_mirror[i] = 0;
161 state->dr_ref_count[i] = 0;
162 }
163 state->dr_control_mirror = 0;
164 state->dr_status_mirror = 0;
165}
166
167/* Print the values of the mirrored debug registers. This is enabled via
168 the "set debug-hw-points 1" monitor command. */
169
170static void
171i386_show_dr (struct i386_debug_reg_state *state,
172 const char *func, CORE_ADDR addr,
173 int len, enum target_hw_bp_type type)
174{
175 int i;
176
177 fprintf (stderr, "%s", func);
178 if (addr || len)
179 fprintf (stderr, " (addr=%lx, len=%d, type=%s)",
180 (unsigned long) addr, len,
181 type == hw_write ? "data-write"
182 : (type == hw_read ? "data-read"
183 : (type == hw_access ? "data-read/write"
184 : (type == hw_execute ? "instruction-execute"
185 /* FIXME: if/when I/O read/write
186 watchpoints are supported, add them
187 here. */
188 : "??unknown??"))));
189 fprintf (stderr, ":\n");
190 fprintf (stderr, "\tCONTROL (DR7): %08x STATUS (DR6): %08x\n",
191 state->dr_control_mirror, state->dr_status_mirror);
192 ALL_DEBUG_REGISTERS (i)
193 {
194 fprintf (stderr, "\
195\tDR%d: addr=0x%s, ref.count=%d DR%d: addr=0x%s, ref.count=%d\n",
196 i, paddress (state->dr_mirror[i]),
197 state->dr_ref_count[i],
198 i + 1, paddress (state->dr_mirror[i + 1]),
199 state->dr_ref_count[i + 1]);
200 i++;
201 }
202}
203
204/* Return the value of a 4-bit field for DR7 suitable for watching a
205 region of LEN bytes for accesses of type TYPE. LEN is assumed to
206 have the value of 1, 2, or 4. */
207
208static unsigned
209i386_length_and_rw_bits (int len, enum target_hw_bp_type type)
210{
211 unsigned rw;
212
213 switch (type)
214 {
215 case hw_execute:
216 rw = DR_RW_EXECUTE;
217 break;
218 case hw_write:
219 rw = DR_RW_WRITE;
220 break;
221 case hw_read:
85d721b8 222 fatal ("The i386 doesn't support data-read watchpoints.\n");
e6f9de87
DE
223 case hw_access:
224 rw = DR_RW_READ;
225 break;
226#if 0
227 /* Not yet supported. */
228 case hw_io_access:
229 rw = DR_RW_IORW;
230 break;
231#endif
232 default:
233 error ("\
234Invalid hardware breakpoint type %d in i386_length_and_rw_bits.\n",
235 (int) type);
236 }
237
238 switch (len)
239 {
240 case 1:
241 return (DR_LEN_1 | rw);
242 case 2:
243 return (DR_LEN_2 | rw);
244 case 4:
245 return (DR_LEN_4 | rw);
2a589cef 246 /* ELSE FALL THROUGH */
e6f9de87
DE
247 case 8:
248 if (TARGET_HAS_DR_LEN_8)
249 return (DR_LEN_8 | rw);
250 default:
251 error ("\
252Invalid hardware breakpoint length %d in i386_length_and_rw_bits.\n", len);
253 }
254}
255
256/* Insert a watchpoint at address ADDR, which is assumed to be aligned
257 according to the length of the region to watch. LEN_RW_BITS is the
258 value of the bits from DR7 which describes the length and access
259 type of the region to be watched by this watchpoint. Return 0 on
260 success, -1 on failure. */
261
262static int
263i386_insert_aligned_watchpoint (struct i386_debug_reg_state *state,
264 CORE_ADDR addr, unsigned len_rw_bits)
265{
266 int i;
267
268 /* First, look for an occupied debug register with the same address
269 and the same RW and LEN definitions. If we find one, we can
270 reuse it for this watchpoint as well (and save a register). */
271 ALL_DEBUG_REGISTERS (i)
272 {
273 if (!I386_DR_VACANT (state, i)
274 && state->dr_mirror[i] == addr
964e4306 275 && I386_DR_GET_RW_LEN (state->dr_control_mirror, i) == len_rw_bits)
e6f9de87
DE
276 {
277 state->dr_ref_count[i]++;
278 return 0;
279 }
280 }
281
282 /* Next, look for a vacant debug register. */
283 ALL_DEBUG_REGISTERS (i)
284 {
285 if (I386_DR_VACANT (state, i))
286 break;
287 }
288
289 /* No more debug registers! */
290 if (i >= DR_NADDR)
291 return -1;
292
293 /* Now set up the register I to watch our region. */
294
295 /* Record the info in our local mirrored array. */
296 state->dr_mirror[i] = addr;
297 state->dr_ref_count[i] = 1;
298 I386_DR_SET_RW_LEN (state, i, len_rw_bits);
299 /* Note: we only enable the watchpoint locally, i.e. in the current
300 task. Currently, no i386 target allows or supports global
301 watchpoints; however, if any target would want that in the
302 future, GDB should probably provide a command to control whether
303 to enable watchpoints globally or locally, and the code below
304 should use global or local enable and slow-down flags as
305 appropriate. */
306 I386_DR_LOCAL_ENABLE (state, i);
307 state->dr_control_mirror |= DR_LOCAL_SLOWDOWN;
308 state->dr_control_mirror &= I386_DR_CONTROL_MASK;
309
e6f9de87
DE
310 return 0;
311}
312
313/* Remove a watchpoint at address ADDR, which is assumed to be aligned
314 according to the length of the region to watch. LEN_RW_BITS is the
315 value of the bits from DR7 which describes the length and access
316 type of the region watched by this watchpoint. Return 0 on
317 success, -1 on failure. */
318
319static int
320i386_remove_aligned_watchpoint (struct i386_debug_reg_state *state,
321 CORE_ADDR addr, unsigned len_rw_bits)
322{
323 int i, retval = -1;
324
325 ALL_DEBUG_REGISTERS (i)
326 {
327 if (!I386_DR_VACANT (state, i)
328 && state->dr_mirror[i] == addr
964e4306 329 && I386_DR_GET_RW_LEN (state->dr_control_mirror, i) == len_rw_bits)
e6f9de87
DE
330 {
331 if (--state->dr_ref_count[i] == 0) /* No longer in use? */
332 {
333 /* Reset our mirror. */
334 state->dr_mirror[i] = 0;
335 I386_DR_DISABLE (state, i);
e6f9de87
DE
336 }
337 retval = 0;
338 }
339 }
340
341 return retval;
342}
343
344/* Insert or remove a (possibly non-aligned) watchpoint, or count the
345 number of debug registers required to watch a region at address
346 ADDR whose length is LEN for accesses of type TYPE. Return 0 on
347 successful insertion or removal, a positive number when queried
348 about the number of registers, or -1 on failure. If WHAT is not a
349 valid value, bombs through internal_error. */
350
351static int
352i386_handle_nonaligned_watchpoint (struct i386_debug_reg_state *state,
353 i386_wp_op_t what, CORE_ADDR addr, int len,
354 enum target_hw_bp_type type)
355{
1ced966e 356 int retval = 0;
e6f9de87
DE
357 int max_wp_len = TARGET_HAS_DR_LEN_8 ? 8 : 4;
358
359 static const int size_try_array[8][8] =
360 {
361 {1, 1, 1, 1, 1, 1, 1, 1}, /* Trying size one. */
362 {2, 1, 2, 1, 2, 1, 2, 1}, /* Trying size two. */
363 {2, 1, 2, 1, 2, 1, 2, 1}, /* Trying size three. */
364 {4, 1, 2, 1, 4, 1, 2, 1}, /* Trying size four. */
365 {4, 1, 2, 1, 4, 1, 2, 1}, /* Trying size five. */
366 {4, 1, 2, 1, 4, 1, 2, 1}, /* Trying size six. */
367 {4, 1, 2, 1, 4, 1, 2, 1}, /* Trying size seven. */
368 {8, 1, 2, 1, 4, 1, 2, 1}, /* Trying size eight. */
369 };
370
371 while (len > 0)
372 {
373 int align = addr % max_wp_len;
374 /* Four (eight on AMD64) is the maximum length a debug register
375 can watch. */
376 int try = (len > max_wp_len ? (max_wp_len - 1) : len - 1);
377 int size = size_try_array[try][align];
378
379 if (what == WP_COUNT)
380 {
381 /* size_try_array[] is defined such that each iteration
382 through the loop is guaranteed to produce an address and a
383 size that can be watched with a single debug register.
384 Thus, for counting the registers required to watch a
385 region, we simply need to increment the count on each
386 iteration. */
387 retval++;
388 }
389 else
390 {
391 unsigned len_rw = i386_length_and_rw_bits (size, type);
392
393 if (what == WP_INSERT)
1ced966e 394 retval = i386_insert_aligned_watchpoint (state, addr, len_rw);
e6f9de87 395 else if (what == WP_REMOVE)
1ced966e 396 retval = i386_remove_aligned_watchpoint (state, addr, len_rw);
e6f9de87
DE
397 else
398 fatal ("\
399Invalid value %d of operation in i386_handle_nonaligned_watchpoint.\n",
400 (int) what);
401
1ced966e
PA
402 if (retval)
403 break;
e6f9de87
DE
404 }
405
406 addr += size;
407 len -= size;
408 }
409
410 return retval;
411}
412
413#define Z_PACKET_WRITE_WP '2'
414#define Z_PACKET_READ_WP '3'
415#define Z_PACKET_ACCESS_WP '4'
416
417/* Map the protocol watchpoint type TYPE to enum target_hw_bp_type. */
418
419static enum target_hw_bp_type
420Z_packet_to_hw_type (char type)
421{
422 switch (type)
423 {
424 case Z_PACKET_WRITE_WP:
425 return hw_write;
426 case Z_PACKET_READ_WP:
427 return hw_read;
428 case Z_PACKET_ACCESS_WP:
429 return hw_access;
430 default:
431 fatal ("Z_packet_to_hw_type: bad watchpoint type %c", type);
432 }
433}
434
1ced966e
PA
435/* Update the inferior debug registers state, in INF_STATE, with the
436 new debug registers state, in NEW_STATE. */
437
438static void
439i386_update_inferior_debug_regs (struct i386_debug_reg_state *inf_state,
440 struct i386_debug_reg_state *new_state)
441{
442 int i;
443
444 ALL_DEBUG_REGISTERS (i)
445 {
446 if (I386_DR_VACANT (new_state, i) != I386_DR_VACANT (inf_state, i))
447 i386_dr_low_set_addr (new_state, i);
448 else
449 gdb_assert (new_state->dr_mirror[i] == inf_state->dr_mirror[i]);
450 }
451
452 if (new_state->dr_control_mirror != inf_state->dr_control_mirror)
453 i386_dr_low_set_control (new_state);
454
455 *inf_state = *new_state;
456}
457
e6f9de87
DE
458/* Insert a watchpoint to watch a memory region which starts at
459 address ADDR and whose length is LEN bytes. Watch memory accesses
460 of the type TYPE_FROM_PACKET. Return 0 on success, -1 on failure. */
461
462int
463i386_low_insert_watchpoint (struct i386_debug_reg_state *state,
464 char type_from_packet, CORE_ADDR addr, int len)
465{
466 int retval;
467 enum target_hw_bp_type type = Z_packet_to_hw_type (type_from_packet);
1ced966e
PA
468 /* Work on a local copy of the debug registers, and on success,
469 commit the change back to the inferior. */
470 struct i386_debug_reg_state local_state = *state;
e6f9de87 471
85d721b8
PA
472 if (type == hw_read)
473 return 1; /* unsupported */
474
e6f9de87
DE
475 if (((len != 1 && len != 2 && len != 4)
476 && !(TARGET_HAS_DR_LEN_8 && len == 8))
477 || addr % len != 0)
478 {
1ced966e 479 retval = i386_handle_nonaligned_watchpoint (&local_state, WP_INSERT,
e6f9de87
DE
480 addr, len, type);
481 }
482 else
483 {
484 unsigned len_rw = i386_length_and_rw_bits (len, type);
485
1ced966e 486 retval = i386_insert_aligned_watchpoint (&local_state, addr, len_rw);
e6f9de87
DE
487 }
488
1ced966e
PA
489 if (retval == 0)
490 i386_update_inferior_debug_regs (state, &local_state);
491
e6f9de87
DE
492 if (debug_hw_points)
493 i386_show_dr (state, "insert_watchpoint", addr, len, type);
494
495 return retval;
496}
497
498/* Remove a watchpoint that watched the memory region which starts at
499 address ADDR, whose length is LEN bytes, and for accesses of the
500 type TYPE_FROM_PACKET. Return 0 on success, -1 on failure. */
501
502int
503i386_low_remove_watchpoint (struct i386_debug_reg_state *state,
504 char type_from_packet, CORE_ADDR addr, int len)
505{
506 int retval;
507 enum target_hw_bp_type type = Z_packet_to_hw_type (type_from_packet);
1ced966e
PA
508 /* Work on a local copy of the debug registers, and on success,
509 commit the change back to the inferior. */
510 struct i386_debug_reg_state local_state = *state;
e6f9de87
DE
511
512 if (((len != 1 && len != 2 && len != 4)
513 && !(TARGET_HAS_DR_LEN_8 && len == 8))
514 || addr % len != 0)
515 {
1ced966e 516 retval = i386_handle_nonaligned_watchpoint (&local_state, WP_REMOVE,
e6f9de87
DE
517 addr, len, type);
518 }
519 else
520 {
521 unsigned len_rw = i386_length_and_rw_bits (len, type);
522
1ced966e 523 retval = i386_remove_aligned_watchpoint (&local_state, addr, len_rw);
e6f9de87
DE
524 }
525
1ced966e
PA
526 if (retval == 0)
527 i386_update_inferior_debug_regs (state, &local_state);
528
e6f9de87
DE
529 if (debug_hw_points)
530 i386_show_dr (state, "remove_watchpoint", addr, len, type);
531
532 return retval;
533}
534
535/* Return non-zero if we can watch a memory region that starts at
536 address ADDR and whose length is LEN bytes. */
537
538int
539i386_low_region_ok_for_watchpoint (struct i386_debug_reg_state *state,
540 CORE_ADDR addr, int len)
541{
542 int nregs;
543
544 /* Compute how many aligned watchpoints we would need to cover this
545 region. */
546 nregs = i386_handle_nonaligned_watchpoint (state, WP_COUNT,
547 addr, len, hw_write);
548 return nregs <= DR_NADDR ? 1 : 0;
549}
550
551/* If the inferior has some break/watchpoint that triggered, set the
552 address associated with that break/watchpoint and return true.
553 Otherwise, return false. */
554
555int
556i386_low_stopped_data_address (struct i386_debug_reg_state *state,
557 CORE_ADDR *addr_p)
558{
559 CORE_ADDR addr = 0;
560 int i;
561 int rc = 0;
6210a125
PA
562 /* The current thread's DR_STATUS. We always need to read this to
563 check whether some watchpoint caused the trap. */
964e4306 564 unsigned status;
6210a125
PA
565 /* We need DR_CONTROL as well, but only iff DR_STATUS indicates a
566 data breakpoint trap. Only fetch it when necessary, to avoid an
567 unnecessary extra syscall when no watchpoint triggered. */
568 int control_p = 0;
d54d1edf 569 unsigned control = 0;
e6f9de87 570
6210a125
PA
571 /* In non-stop/async, threads can be running while we change the
572 global dr_mirror (and friends). Say, we set a watchpoint, and
573 let threads resume. Now, say you delete the watchpoint, or
574 add/remove watchpoints such that dr_mirror changes while threads
575 are running. On targets that support non-stop,
576 inserting/deleting watchpoints updates the global dr_mirror only.
577 It does not update the real thread's debug registers; that's only
578 done prior to resume. Instead, if threads are running when the
579 mirror changes, a temporary and transparent stop on all threads
580 is forced so they can get their copy of the debug registers
581 updated on re-resume. Now, say, a thread hit a watchpoint before
582 having been updated with the new dr_mirror contents, and we
583 haven't yet handled the corresponding SIGTRAP. If we trusted
584 dr_mirror below, we'd mistake the real trapped address (from the
585 last time we had updated debug registers in the thread) with
586 whatever was currently in dr_mirror. So to fix this, dr_mirror
587 always represents intention, what we _want_ threads to have in
588 debug registers. To get at the address and cause of the trap, we
589 need to read the state the thread still has in its debug
590 registers.
591
592 In sum, always get the current debug register values the current
593 thread has, instead of trusting the global mirror. If the thread
594 was running when we last changed watchpoints, the mirror no
595 longer represents what was set in this thread's debug
596 registers. */
964e4306 597 status = i386_dr_low_get_status ();
e6f9de87
DE
598
599 ALL_DEBUG_REGISTERS (i)
600 {
6210a125
PA
601 if (!I386_DR_WATCH_HIT (status, i))
602 continue;
603
604 if (!control_p)
605 {
606 control = i386_dr_low_get_control ();
607 control_p = 1;
608 }
609
610 /* This second condition makes sure DRi is set up for a data
611 watchpoint, not a hardware breakpoint. The reason is that
612 GDB doesn't call the target_stopped_data_address method
613 except for data watchpoints. In other words, I'm being
614 paranoiac. */
615 if (I386_DR_GET_RW_LEN (control, i) != 0)
e6f9de87 616 {
964e4306 617 addr = i386_dr_low_get_addr (i);
e6f9de87
DE
618 rc = 1;
619 if (debug_hw_points)
620 i386_show_dr (state, "watchpoint_hit", addr, -1, hw_write);
621 }
622 }
623
624 if (debug_hw_points && addr == 0)
625 i386_show_dr (state, "stopped_data_addr", 0, 0, hw_write);
626
627 if (rc)
628 *addr_p = addr;
629 return rc;
630}
631
632/* Return true if the inferior has some watchpoint that triggered.
633 Otherwise return false. */
634
635int
636i386_low_stopped_by_watchpoint (struct i386_debug_reg_state *state)
637{
638 CORE_ADDR addr = 0;
639 return i386_low_stopped_data_address (state, &addr);
640}
This page took 0.253923 seconds and 4 git commands to generate.