Fix library-list.dtd -> library-list-svr4.dtd
[deliverable/binutils-gdb.git] / gdb / nat / mips-linux-watch.h
1 /* Copyright (C) 2009-2014 Free Software Foundation, Inc.
2
3 This file is part of GDB.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17
18 #ifndef MIPS_LINUX_WATCH_H
19 #define MIPS_LINUX_WATCH_H 1
20
21 #include <asm/ptrace.h>
22 #include <stdint.h>
23
24 #include "break-common.h"
25
26 #define MAX_DEBUG_REGISTER 8
27
28 /* If macro PTRACE_GET_WATCH_REGS is not defined, kernel header doesn't
29 have hardware watchpoint-related structures. Define them below. */
30
31 #ifndef PTRACE_GET_WATCH_REGS
32 # define PTRACE_GET_WATCH_REGS 0xd0
33 # define PTRACE_SET_WATCH_REGS 0xd1
34
35 enum pt_watch_style {
36 pt_watch_style_mips32,
37 pt_watch_style_mips64
38 };
39
40 /* A value of zero in a watchlo indicates that it is available. */
41
42 struct mips32_watch_regs
43 {
44 uint32_t watchlo[MAX_DEBUG_REGISTER];
45 /* Lower 16 bits of watchhi. */
46 uint16_t watchhi[MAX_DEBUG_REGISTER];
47 /* Valid mask and I R W bits.
48 * bit 0 -- 1 if W bit is usable.
49 * bit 1 -- 1 if R bit is usable.
50 * bit 2 -- 1 if I bit is usable.
51 * bits 3 - 11 -- Valid watchhi mask bits.
52 */
53 uint16_t watch_masks[MAX_DEBUG_REGISTER];
54 /* The number of valid watch register pairs. */
55 uint32_t num_valid;
56 /* There is confusion across gcc versions about structure alignment,
57 so we force 8 byte alignment for these structures so they match
58 the kernel even if it was build with a different gcc version. */
59 } __attribute__ ((aligned (8)));
60
61 struct mips64_watch_regs
62 {
63 uint64_t watchlo[MAX_DEBUG_REGISTER];
64 uint16_t watchhi[MAX_DEBUG_REGISTER];
65 uint16_t watch_masks[MAX_DEBUG_REGISTER];
66 uint32_t num_valid;
67 } __attribute__ ((aligned (8)));
68
69 struct pt_watch_regs
70 {
71 enum pt_watch_style style;
72 union
73 {
74 struct mips32_watch_regs mips32;
75 struct mips64_watch_regs mips64;
76 };
77 };
78
79 #endif /* !PTRACE_GET_WATCH_REGS */
80
81 #define W_BIT 0
82 #define R_BIT 1
83 #define I_BIT 2
84
85 #define W_MASK (1 << W_BIT)
86 #define R_MASK (1 << R_BIT)
87 #define I_MASK (1 << I_BIT)
88
89 #define IRW_MASK (I_MASK | R_MASK | W_MASK)
90
91 /* We keep list of all watchpoints we should install and calculate the
92 watch register values each time the list changes. This allows for
93 easy sharing of watch registers for more than one watchpoint. */
94
95 struct mips_watchpoint
96 {
97 CORE_ADDR addr;
98 int len;
99 int type;
100 struct mips_watchpoint *next;
101 };
102
103 uint32_t mips_linux_watch_get_num_valid (struct pt_watch_regs *regs);
104 uint32_t mips_linux_watch_get_irw_mask (struct pt_watch_regs *regs, int n);
105 CORE_ADDR mips_linux_watch_get_watchlo (struct pt_watch_regs *regs, int n);
106 void mips_linux_watch_set_watchlo (struct pt_watch_regs *regs, int n,
107 CORE_ADDR value);
108 uint32_t mips_linux_watch_get_watchhi (struct pt_watch_regs *regs, int n);
109 void mips_linux_watch_set_watchhi (struct pt_watch_regs *regs, int n,
110 uint16_t value);
111 int mips_linux_watch_try_one_watch (struct pt_watch_regs *regs,
112 CORE_ADDR addr, int len, uint32_t irw);
113 void mips_linux_watch_populate_regs (struct mips_watchpoint *current_watches,
114 struct pt_watch_regs *regs);
115 uint32_t mips_linux_watch_type_to_irw (int type);
116
117 int mips_linux_read_watch_registers (long lwpid,
118 struct pt_watch_regs *watch_readback,
119 int *watch_readback_valid, int force);
120 #endif
This page took 0.045689 seconds and 4 git commands to generate.