Rev 2938 | Rev 2941 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2938 | Rev 2939 | ||
---|---|---|---|
Line 46... | Line 46... | ||
46 | #include "cmd.h" |
46 | #include "cmd.h" |
47 | 47 | ||
48 | static void cmd_break(int argc, char *argv[]); |
48 | static void cmd_break(int argc, char *argv[]); |
49 | static void cmd_ct(int argc, char *argv[]); |
49 | static void cmd_ct(int argc, char *argv[]); |
50 | static void cmd_go(int argc, char *argv[]); |
50 | static void cmd_go(int argc, char *argv[]); |
- | 51 | static void cmd_istep(int argc, char *argv[]); |
|
51 | void cmd_help(int argc, char *argv[]); |
52 | void cmd_help(int argc, char *argv[]); |
52 | static void cmd_pwt(int argc, char *argv[]); |
53 | static void cmd_pwt(int argc, char *argv[]); |
53 | static void cmd_read(int argc, char *argv[]); |
54 | static void cmd_read(int argc, char *argv[]); |
54 | static void cmd_step(int argc, char *argv[]); |
55 | static void cmd_stop(int argc, char *argv[]); |
55 | static void cmd_threads(int argc, char *argv[]); |
56 | static void cmd_threads(int argc, char *argv[]); |
56 | static void cmd_quit(int argc, char *argv[]); |
57 | static void cmd_quit(int argc, char *argv[]); |
57 | 58 | ||
58 | volatile bool quit = false; |
59 | volatile bool quit = false; |
59 | 60 | ||
Line 62... | Line 63... | ||
62 | { 1, "ct", cmd_ct }, |
63 | { 1, "ct", cmd_ct }, |
63 | { 0, "go", cmd_go }, |
64 | { 0, "go", cmd_go }, |
64 | { 0, "help", cmd_help }, |
65 | { 0, "help", cmd_help }, |
65 | { 0, "pwt", cmd_pwt }, |
66 | { 0, "pwt", cmd_pwt }, |
66 | { 2, "read", cmd_read }, |
67 | { 2, "read", cmd_read }, |
- | 68 | { 0 , "stop", cmd_stop }, |
|
- | 69 | { 0, "istep", cmd_istep }, |
|
67 | { 0, "threads", cmd_threads }, |
70 | { 0, "threads", cmd_threads }, |
68 | { 0, "quit", cmd_quit }, |
71 | { 0, "quit", cmd_quit }, |
69 | { -1, NULL, NULL } |
72 | { -1, NULL, NULL } |
70 | }; |
73 | }; |
71 | 74 | ||
Line 106... | Line 109... | ||
106 | } |
109 | } |
107 | 110 | ||
108 | 111 | ||
109 | void cmd_go(int argc, char *argv[]) |
112 | void cmd_go(int argc, char *argv[]) |
110 | { |
113 | { |
- | 114 | link_t *cur; |
|
- | 115 | dthread_t *dt; |
|
- | 116 | ||
- | 117 | (void)argc; (void)argv; |
|
- | 118 | ||
- | 119 | dt = NULL; |
|
- | 120 | for (cur = dthreads.next; cur != &dthreads; cur = cur->next) { |
|
- | 121 | dt = list_get_instance(cur, dthread_t, link); |
|
111 | fcv_broadcast(&go_cv); |
122 | dthread_resume(dt); |
- | 123 | } |
|
112 | } |
124 | } |
113 | 125 | ||
114 | void cmd_help(int argc, char *argv[]) |
126 | void cmd_help(int argc, char *argv[]) |
115 | { |
127 | { |
116 | int i; |
128 | int i; |
Line 121... | Line 133... | ||
121 | cons_printf("%s\n", cmd_table[i].name); |
133 | cons_printf("%s\n", cmd_table[i].name); |
122 | ++i; |
134 | ++i; |
123 | } |
135 | } |
124 | } |
136 | } |
125 | 137 | ||
- | 138 | void cmd_istep(int argc, char *argv[]) |
|
- | 139 | { |
|
- | 140 | (void)argc; (void)argv; |
|
- | 141 | /*TODO*/ |
|
- | 142 | } |
|
- | 143 | ||
- | 144 | void cmd_pwt(int argc, char *argv[]) |
|
- | 145 | { |
|
- | 146 | (void)argc; (void)argv; |
|
- | 147 | ||
- | 148 | cons_printf("working thread: %d [hash 0x%x]\n", cwt->id, cwt->hash); |
|
- | 149 | } |
|
- | 150 | ||
126 | #define BYTES_PER_LINE 16 |
151 | #define BYTES_PER_LINE 16 |
127 | 152 | ||
128 | static void cmd_read(int argc, char *argv[]) |
153 | static void cmd_read(int argc, char *argv[]) |
129 | { |
154 | { |
130 | uintptr_t addr; |
155 | uintptr_t addr; |
Line 167... | Line 192... | ||
167 | addr += to_read; |
192 | addr += to_read; |
168 | length -= to_read; |
193 | length -= to_read; |
169 | } |
194 | } |
170 | } |
195 | } |
171 | 196 | ||
172 | void cmd_step(int argc, char *argv[]) |
- | |
173 | { |
- | |
174 | fcv_broadcast(&go_cv); |
- | |
175 | } |
- | |
176 | 197 | ||
- | 198 | ||
177 | void cmd_pwt(int argc, char *argv[]) |
199 | void cmd_stop(int argc, char *argv[]) |
178 | { |
200 | { |
- | 201 | link_t *cur; |
|
- | 202 | dthread_t *dt; |
|
- | 203 | int rc; |
|
- | 204 | ||
179 | (void)argc; (void)argv; |
205 | (void)argc; (void)argv; |
180 | 206 | ||
- | 207 | dt = NULL; |
|
- | 208 | for (cur = dthreads.next; cur != &dthreads; cur = cur->next) { |
|
- | 209 | dt = list_get_instance(cur, dthread_t, link); |
|
- | 210 | if (!dt->stopped) { |
|
- | 211 | rc = udebug_stop(app_phone, dt->hash); |
|
- | 212 | if (rc < 0) { |
|
181 | cons_printf("working thread: %d [hash 0x%x]\n", cwt->id, cwt->hash); |
213 | printf("failed halting thread %d\n", dt->id); |
- | 214 | } |
|
- | 215 | } |
|
- | 216 | } |
|
182 | } |
217 | } |
183 | 218 | ||
- | 219 | ||
184 | void cmd_threads(int argc, char *argv[]) |
220 | void cmd_threads(int argc, char *argv[]) |
185 | { |
221 | { |
186 | link_t *cur; |
222 | link_t *cur; |
187 | dthread_t *dt; |
223 | dthread_t *dt; |
188 | 224 |