blob: c630f3291ee4a2f616acd44c0b4e9fe228df70c8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
#include <rtthread.h>
#include <rthw.h>
#include <lwp.h>
int dbg_thread_in_debug(void)
{
int ret = 0;
struct rt_lwp *lwp = lwp_self();
if (lwp && lwp->debug)
{
ret = 1;
}
return ret;
}
struct dbg_ops_t *rt_dbg_ops = RT_NULL;
RTM_EXPORT(rt_dbg_ops);
void dbg_register(struct dbg_ops_t *dbg_ops)
{
rt_dbg_ops = dbg_ops;
}
RTM_EXPORT(dbg_register);
static int dbg(int argc, char **argv)
{
int ret = -1;
if (rt_dbg_ops)
{
ret = rt_dbg_ops->dbg(argc, argv);
}
else
{
rt_kprintf("Error: DBG command is not enabled!\n");
}
return ret;
}
MSH_CMD_EXPORT(dbg, dbg);
uint32_t dbg_get_ins(void)
{
uint32_t ins = 0;
if (rt_dbg_ops)
{
ins = rt_dbg_ops->arch_get_ins();
}
return ins;
}
void dbg_activate_step(void)
{
if (rt_dbg_ops)
{
rt_dbg_ops->arch_activate_step();
}
}
void dbg_deactivate_step(void)
{
if (rt_dbg_ops)
{
rt_dbg_ops->arch_deactivate_step();
}
}
int dbg_check_event(struct rt_hw_exp_stack *regs, unsigned long esr)
{
int ret = 0;
if (rt_dbg_ops)
{
ret = rt_dbg_ops->check_debug_event(regs, esr);
}
return ret;
}
rt_channel_t gdb_server_channel(void)
{
rt_channel_t ret = RT_NULL;
if (rt_dbg_ops)
{
ret = rt_dbg_ops->gdb_get_server_channel();
}
return ret;
}
int dbg_step_type(void)
{
int ret = 0;
if (rt_dbg_ops)
{
ret = rt_dbg_ops->gdb_get_step_type();
}
return ret;
}
void dbg_attach_req(void *pc)
{
if (rt_dbg_ops)
{
rt_dbg_ops->lwp_check_debug_attach_req(pc);
}
}
int dbg_check_suspend(void)
{
int ret = 0;
if (rt_dbg_ops)
{
ret = rt_dbg_ops->lwp_check_debug_suspend();
}
return ret;
}
|