1/*
2 * Copyright 2005-2011, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef KERNEL_ARCH_USER_DEBUGGER_H
6#define KERNEL_ARCH_USER_DEBUGGER_H
7
8
9#include "kernel_debug_config.h"
10
11#ifndef _ASSEMBLER
12
13#include <debugger.h>
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19struct arch_team_debug_info;
20struct arch_thread_debug_info;
21
22
23void arch_clear_team_debug_info(struct arch_team_debug_info *info);
24void arch_destroy_team_debug_info(struct arch_team_debug_info *info);
25void arch_clear_thread_debug_info(struct arch_thread_debug_info *info);
26void arch_destroy_thread_debug_info(struct arch_thread_debug_info *info);
27
28void arch_update_thread_single_step();
29
30void arch_set_debug_cpu_state(const debug_cpu_state *cpuState);
31void arch_get_debug_cpu_state(debug_cpu_state *cpuState);
32
33status_t arch_set_breakpoint(void *address);
34status_t arch_clear_breakpoint(void *address);
35status_t arch_set_watchpoint(void *address, uint32 type, int32 length);
36status_t arch_clear_watchpoint(void *address);
37bool arch_has_breakpoints(struct arch_team_debug_info *info);
38
39#if KERNEL_BREAKPOINTS
40status_t arch_set_kernel_breakpoint(void *address);
41status_t arch_clear_kernel_breakpoint(void *address);
42status_t arch_set_kernel_watchpoint(void *address, uint32 type, int32 length);
43status_t arch_clear_kernel_watchpoint(void *address);
44#endif
45
46#ifdef __cplusplus
47}
48#endif
49
50#include <arch_user_debugger.h>
51
52// Defaults for macros defined by the architecture specific header:
53
54// maximum number of instruction breakpoints
55#ifndef DEBUG_MAX_BREAKPOINTS
56#	define DEBUG_MAX_BREAKPOINTS 0
57#endif
58
59// maximum number of data watchpoints
60#ifndef DEBUG_MAX_WATCHPOINTS
61#	define DEBUG_MAX_WATCHPOINTS 0
62#endif
63
64// the software breakpoint instruction
65#if !defined(DEBUG_SOFTWARE_BREAKPOINT)	\
66	|| !defined(DEBUG_SOFTWARE_BREAKPOINT_SIZE)
67#	undef DEBUG_SOFTWARE_BREAKPOINT
68#	undef DEBUG_SOFTWARE_BREAKPOINT_SIZE
69#	define DEBUG_SOFTWARE_BREAKPOINT		NULL
70#	define DEBUG_SOFTWARE_BREAKPOINT_SIZE	0
71#endif
72
73// Boolean whether break- and watchpoints use the same registers. If != 0, then
74// DEBUG_MAX_BREAKPOINTS == DEBUG_MAX_WATCHPOINTS and either specifies the
75// total count of break- plus watchpoints.
76#ifndef DEBUG_SHARED_BREAK_AND_WATCHPOINTS
77#	define DEBUG_SHARED_BREAK_AND_WATCHPOINTS 0
78#endif
79
80#endif	// _ASSEMBLER
81
82#endif	// KERNEL_ARCH_USER_DEBUGGER_H
83