Rev 2921 | Rev 3431 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2921 | Rev 3424 | ||
|---|---|---|---|
| Line 104... | Line 104... | ||
| 104 | /** Print table of active breakpoints */ |
104 | /** Print table of active breakpoints */ |
| 105 | int cmd_print_breakpoints(cmd_arg_t *argv __attribute__((unused))) |
105 | int cmd_print_breakpoints(cmd_arg_t *argv __attribute__((unused))) |
| 106 | { |
106 | { |
| 107 | unsigned int i; |
107 | unsigned int i; |
| 108 | char *symbol; |
108 | char *symbol; |
| 109 | 109 | ||
| 110 | if (sizeof(void *) == 4) { |
110 | #ifdef __32_BITS__ |
| 111 | printf("# Count Address In symbol\n"); |
111 | printf("# Count Address In symbol\n"); |
| 112 | printf("-- ----- ---------- ---------\n"); |
112 | printf("-- ----- ---------- ---------\n"); |
| 113 | } else { |
113 | #endif |
| - | 114 | ||
| - | 115 | #ifdef __64_BITS__ |
|
| 114 | printf("# Count Address In symbol\n"); |
116 | printf("# Count Address In symbol\n"); |
| 115 | printf("-- ----- ------------------ ---------\n"); |
117 | printf("-- ----- ------------------ ---------\n"); |
| 116 | } |
118 | #endif |
| 117 | 119 | ||
| 118 | for (i = 0; i < BKPOINTS_MAX; i++) |
120 | for (i = 0; i < BKPOINTS_MAX; i++) |
| 119 | if (breakpoints[i].address) { |
121 | if (breakpoints[i].address) { |
| 120 | symbol = get_symtab_entry(breakpoints[i].address); |
122 | symbol = get_symtab_entry(breakpoints[i].address); |
| 121 | 123 | ||
| 122 | if (sizeof(void *) == 4) |
124 | #ifdef __32_BITS__ |
| 123 | printf("%-2u %-5d %#10zx %s\n", i, breakpoints[i].counter, |
125 | printf("%-2u %-5d %#10zx %s\n", i, |
| 124 | breakpoints[i].address, symbol); |
126 | breakpoints[i].counter, breakpoints[i].address, |
| - | 127 | symbol); |
|
| 125 | else |
128 | #endif |
| - | 129 | ||
| - | 130 | #ifdef __64_BITS__ |
|
| 126 | printf("%-2u %-5d %#18zx %s\n", i, breakpoints[i].counter, |
131 | printf("%-2u %-5d %#18zx %s\n", i, |
| 127 | breakpoints[i].address, symbol); |
132 | breakpoints[i].counter, breakpoints[i].address, |
| - | 133 | symbol); |
|
| - | 134 | #endif |
|
| - | 135 | ||
| 128 | } |
136 | } |
| 129 | return 1; |
137 | return 1; |
| 130 | } |
138 | } |
| 131 | 139 | ||
| 132 | /* Setup DR register according to table */ |
140 | /* Setup DR register according to table */ |
| Line 160... | Line 168... | ||
| 160 | dr7 &= ~ (0x3 << (16 + 4*curidx)); |
168 | dr7 &= ~ (0x3 << (16 + 4*curidx)); |
| 161 | dr7 &= ~ (0x3 << (18 + 4*curidx)); |
169 | dr7 &= ~ (0x3 << (18 + 4*curidx)); |
| 162 | if ((flags & BKPOINT_INSTR)) { |
170 | if ((flags & BKPOINT_INSTR)) { |
| 163 | ; |
171 | ; |
| 164 | } else { |
172 | } else { |
| - | 173 | ||
| 165 | if (sizeof(int) == 4) |
174 | #ifdef __32_BITS__ |
| 166 | dr7 |= ((unative_t) 0x3) << (18 + 4*curidx); |
175 | dr7 |= ((unative_t) 0x3) << (18 + 4 * curidx); |
| - | 176 | #endif |
|
| - | 177 | ||
| 167 | else /* 8 */ |
178 | #ifdef __64_BITS__ |
| 168 | dr7 |= ((unative_t) 0x2) << (18 + 4*curidx); |
179 | dr7 |= ((unative_t) 0x2) << (18 + 4 * curidx); |
| - | 180 | #endif |
|
| 169 | 181 | ||
| 170 | if ((flags & BKPOINT_WRITE)) |
182 | if ((flags & BKPOINT_WRITE)) |
| 171 | dr7 |= ((unative_t) 0x1) << (16 + 4*curidx); |
183 | dr7 |= ((unative_t) 0x1) << (16 + 4 * curidx); |
| 172 | else if ((flags & BKPOINT_READ_WRITE)) |
184 | else if ((flags & BKPOINT_READ_WRITE)) |
| 173 | dr7 |= ((unative_t) 0x3) << (16 + 4*curidx); |
185 | dr7 |= ((unative_t) 0x3) << (16 + 4 * curidx); |
| 174 | } |
186 | } |
| 175 | 187 | ||
| 176 | /* Enable global breakpoint */ |
188 | /* Enable global breakpoint */ |
| 177 | dr7 |= 0x2 << (curidx*2); |
189 | dr7 |= 0x2 << (curidx * 2); |
| 178 | 190 | ||
| 179 | write_dr7(dr7); |
191 | write_dr7(dr7); |
| 180 | 192 | ||
| 181 | } |
193 | } |
| 182 | } |
194 | } |
| Line 244... | Line 256... | ||
| 244 | /* Handle zero checker */ |
256 | /* Handle zero checker */ |
| 245 | if (! (breakpoints[slot].flags & BKPOINT_INSTR)) { |
257 | if (! (breakpoints[slot].flags & BKPOINT_INSTR)) { |
| 246 | if ((breakpoints[slot].flags & BKPOINT_CHECK_ZERO)) { |
258 | if ((breakpoints[slot].flags & BKPOINT_CHECK_ZERO)) { |
| 247 | if (*((unative_t *) breakpoints[slot].address) != 0) |
259 | if (*((unative_t *) breakpoints[slot].address) != 0) |
| 248 | return; |
260 | return; |
| 249 | printf("**** Found ZERO on address %lx (slot %d) ****\n", |
261 | printf("*** Found ZERO on address %lx (slot %d) ***\n", |
| 250 | breakpoints[slot].address, slot); |
262 | breakpoints[slot].address, slot); |
| 251 | } else { |
263 | } else { |
| 252 | printf("Data watchpoint - new data: %lx\n", |
264 | printf("Data watchpoint - new data: %lx\n", |
| 253 | *((unative_t *) breakpoints[slot].address)); |
265 | *((unative_t *) breakpoints[slot].address)); |
| 254 | } |
266 | } |
| 255 | } |
267 | } |
| 256 | printf("Reached breakpoint %d:%lx(%s)\n", slot, getip(istate), |
268 | printf("Reached breakpoint %d:%lx(%s)\n", slot, getip(istate), |
| 257 | get_symtab_entry(getip(istate))); |
269 | get_symtab_entry(getip(istate))); |
| 258 | printf("***Type 'exit' to exit kconsole.\n"); |
270 | printf("***Type 'exit' to exit kconsole.\n"); |
| 259 | atomic_set(&haltstate,1); |
271 | atomic_set(&haltstate,1); |
| 260 | kconsole((void *) "debug"); |
272 | kconsole((void *) "debug"); |
| 261 | atomic_set(&haltstate,0); |
273 | atomic_set(&haltstate,0); |
| 262 | } |
274 | } |
| Line 357... | Line 369... | ||
| 357 | } |
369 | } |
| 358 | } |
370 | } |
| 359 | } |
371 | } |
| 360 | 372 | ||
| 361 | #ifdef CONFIG_SMP |
373 | #ifdef CONFIG_SMP |
| - | 374 | static void |
|
| - | 375 | debug_ipi(int n __attribute__((unused)), |
|
| 362 | static void debug_ipi(int n __attribute__((unused)), istate_t *istate __attribute__((unused))) |
376 | istate_t *istate __attribute__((unused))) |
| 363 | { |
377 | { |
| 364 | int i; |
378 | int i; |
| 365 | 379 | ||
| 366 | spinlock_lock(&bkpoint_lock); |
380 | spinlock_lock(&bkpoint_lock); |
| 367 | for (i = 0; i < BKPOINTS_MAX; i++) |
381 | for (i = 0; i < BKPOINTS_MAX; i++) |
| Line 373... | Line 387... | ||
| 373 | /** Initialize debugger */ |
387 | /** Initialize debugger */ |
| 374 | void debugger_init() |
388 | void debugger_init() |
| 375 | { |
389 | { |
| 376 | int i; |
390 | int i; |
| 377 | 391 | ||
| 378 | for (i=0; i<BKPOINTS_MAX; i++) |
392 | for (i = 0; i < BKPOINTS_MAX; i++) |
| 379 | breakpoints[i].address = NULL; |
393 | breakpoints[i].address = NULL; |
| 380 | 394 | ||
| 381 | cmd_initialize(&bkpts_info); |
395 | cmd_initialize(&bkpts_info); |
| 382 | if (!cmd_register(&bkpts_info)) |
396 | if (!cmd_register(&bkpts_info)) |
| 383 | panic("could not register command %s\n", bkpts_info.name); |
397 | panic("could not register command %s\n", bkpts_info.name); |
| Line 394... | Line 408... | ||
| 394 | cmd_initialize(&addwatchp_info); |
408 | cmd_initialize(&addwatchp_info); |
| 395 | if (!cmd_register(&addwatchp_info)) |
409 | if (!cmd_register(&addwatchp_info)) |
| 396 | panic("could not register command %s\n", addwatchp_info.name); |
410 | panic("could not register command %s\n", addwatchp_info.name); |
| 397 | #endif |
411 | #endif |
| 398 | 412 | ||
| 399 | exc_register(VECTOR_DEBUG, "debugger", |
413 | exc_register(VECTOR_DEBUG, "debugger", debug_exception); |
| 400 | debug_exception); |
- | |
| 401 | #ifdef CONFIG_SMP |
414 | #ifdef CONFIG_SMP |
| 402 | exc_register(VECTOR_DEBUG_IPI, "debugger_smp", |
415 | exc_register(VECTOR_DEBUG_IPI, "debugger_smp", debug_ipi); |
| 403 | debug_ipi); |
- | |
| 404 | #endif |
416 | #endif |
| 405 | } |
417 | } |
| 406 | 418 | ||
| 407 | /** @} |
419 | /** @} |
| 408 | */ |
420 | */ |