reg: Accept full names of the standard registry hives.
[wine] / programs / winedbg / be_arm.c
1 /*
2  * Debugger ARM specific functions
3  *
4  * Copyright 2000-2003 Marcus Meissner
5  *                2004 Eric Pouech
6  *                2010 AndrĂ© Hentschel
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21  */
22
23 #include "debugger.h"
24
25 #if defined(__arm__)
26
27 static unsigned be_arm_get_addr(HANDLE hThread, const CONTEXT* ctx,
28                                 enum be_cpu_addr bca, ADDRESS64* addr)
29 {
30     switch (bca)
31     {
32     case be_cpu_addr_pc:
33         return be_cpu_build_addr(hThread, ctx, addr, 0, ctx->Pc);
34     case be_cpu_addr_stack:
35         return be_cpu_build_addr(hThread, ctx, addr, 0, ctx->Sp);
36     case be_cpu_addr_frame:
37         return be_cpu_build_addr(hThread, ctx, addr, 0, ctx->Fp);
38     }
39     return FALSE;
40 }
41
42 static unsigned be_arm_get_register_info(int regno, enum be_cpu_addr* kind)
43 {
44     dbg_printf("not done\n");
45     return FALSE;
46 }
47
48 static void be_arm_single_step(CONTEXT* ctx, unsigned enable)
49 {
50     dbg_printf("not done\n");
51 }
52
53 static void be_arm_print_context(HANDLE hThread, const CONTEXT* ctx, int all_regs)
54 {
55     dbg_printf("Context printing for arm not done yet\n");
56 }
57
58 static void be_arm_print_segment_info(HANDLE hThread, const CONTEXT* ctx)
59 {
60 }
61
62 static struct dbg_internal_var be_arm_ctx[] =
63 {
64     {0,                 NULL,           0,                                      dbg_itype_none}
65 };
66
67 static unsigned be_arm_is_step_over_insn(const void* insn)
68 {
69     dbg_printf("not done\n");
70     return FALSE;
71 }
72
73 static unsigned be_arm_is_function_return(const void* insn)
74 {
75     dbg_printf("not done\n");
76     return FALSE;
77 }
78
79 static unsigned be_arm_is_break_insn(const void* insn)
80 {
81     dbg_printf("not done\n");
82     return FALSE;
83 }
84
85 static unsigned be_arm_is_func_call(const void* insn, ADDRESS64* callee)
86 {
87     return FALSE;
88 }
89
90 static void be_arm_disasm_one_insn(ADDRESS64* addr, int display)
91 {
92     dbg_printf("Disasm NIY\n");
93 }
94
95 static unsigned be_arm_insert_Xpoint(HANDLE hProcess, const struct be_process_io* pio,
96                                      CONTEXT* ctx, enum be_xpoint_type type,
97                                      void* addr, unsigned long* val, unsigned size)
98 {
99     SIZE_T              sz;
100
101     switch (type)
102     {
103     case be_xpoint_break:
104         if (!size) return 0;
105         if (!pio->read(hProcess, addr, val, 4, &sz) || sz != 4) return 0;
106     default:
107         dbg_printf("Unknown/unsupported bp type %c\n", type);
108         return 0;
109     }
110     return 1;
111 }
112
113 static unsigned be_arm_remove_Xpoint(HANDLE hProcess, const struct be_process_io* pio,
114                                      CONTEXT* ctx, enum be_xpoint_type type,
115                                      void* addr, unsigned long val, unsigned size)
116 {
117     SIZE_T              sz;
118
119     switch (type)
120     {
121     case be_xpoint_break:
122         if (!size) return 0;
123         if (!pio->write(hProcess, addr, &val, 4, &sz) || sz == 4) return 0;
124         break;
125     default:
126         dbg_printf("Unknown/unsupported bp type %c\n", type);
127         return 0;
128     }
129     return 1;
130 }
131
132 static unsigned be_arm_is_watchpoint_set(const CONTEXT* ctx, unsigned idx)
133 {
134     dbg_printf("not done\n");
135     return FALSE;
136 }
137
138 static void be_arm_clear_watchpoint(CONTEXT* ctx, unsigned idx)
139 {
140     dbg_printf("not done\n");
141 }
142
143 static int be_arm_adjust_pc_for_break(CONTEXT* ctx, BOOL way)
144 {
145     if (way)
146     {
147         ctx->Pc--;
148         return -1;
149     }
150     ctx->Pc++;
151     return 1;
152 }
153
154 static int be_arm_fetch_integer(const struct dbg_lvalue* lvalue, unsigned size,
155                                 unsigned ext_sign, LONGLONG* ret)
156 {
157     dbg_printf("not done\n");
158     return FALSE;
159 }
160
161 static int be_arm_fetch_float(const struct dbg_lvalue* lvalue, unsigned size,
162                               long double* ret)
163 {
164     dbg_printf("not done\n");
165     return FALSE;
166 }
167
168 struct backend_cpu be_arm =
169 {
170     IMAGE_FILE_MACHINE_ARM,
171     4,
172     be_cpu_linearize,
173     be_cpu_build_addr,
174     be_arm_get_addr,
175     be_arm_get_register_info,
176     be_arm_single_step,
177     be_arm_print_context,
178     be_arm_print_segment_info,
179     be_arm_ctx,
180     be_arm_is_step_over_insn,
181     be_arm_is_function_return,
182     be_arm_is_break_insn,
183     be_arm_is_func_call,
184     be_arm_disasm_one_insn,
185     be_arm_insert_Xpoint,
186     be_arm_remove_Xpoint,
187     be_arm_is_watchpoint_set,
188     be_arm_clear_watchpoint,
189     be_arm_adjust_pc_for_break,
190     be_arm_fetch_integer,
191     be_arm_fetch_float,
192 };
193 #endif