diff options
Diffstat (limited to 'src/monkey/thread.c')
-rw-r--r-- | src/monkey/thread.c | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/src/monkey/thread.c b/src/monkey/thread.c new file mode 100644 index 000000000..51a333f5b --- /dev/null +++ b/src/monkey/thread.c | |||
@@ -0,0 +1,89 @@ | |||
1 | /**[txh]******************************************************************** | ||
2 | |||
3 | Copyright (c) 2004 by Salvador E. Tropea. | ||
4 | Covered by the GPL license. | ||
5 | |||
6 | Module: Thread commands. | ||
7 | Comments: | ||
8 | GDB/MI commands for the "Thread Commands" section.@p | ||
9 | |||
10 | @<pre> | ||
11 | gdb command: Implemented? | ||
12 | -thread-info N.A. | ||
13 | -thread-list-all-threads Yes, implemented as "info threads" | ||
14 | -thread-list-ids Yes | ||
15 | -thread-select Yes | ||
16 | @</pre> | ||
17 | |||
18 | ***************************************************************************/ | ||
19 | |||
20 | #include "mi_gdb.h" | ||
21 | |||
22 | /* Low level versions. */ | ||
23 | |||
24 | void mi_thread_list_ids(mi_h *h) | ||
25 | { | ||
26 | mi_send(h,"-thread-list-ids\n"); | ||
27 | } | ||
28 | |||
29 | void mi_thread_select(mi_h *h, int id) | ||
30 | { | ||
31 | mi_send(h,"-thread-select %d\n",id); | ||
32 | } | ||
33 | |||
34 | void mi_thread_list_all_threads(mi_h *h) | ||
35 | { | ||
36 | mi_send(h,"info threads\n"); | ||
37 | } | ||
38 | |||
39 | /* High level versions. */ | ||
40 | |||
41 | /**[txh]******************************************************************** | ||
42 | |||
43 | Description: | ||
44 | List available thread ids. | ||
45 | |||
46 | Command: -thread-list-ids | ||
47 | Return: !=0 OK | ||
48 | |||
49 | ***************************************************************************/ | ||
50 | |||
51 | int gmi_thread_list_ids(mi_h *h, int **list) | ||
52 | { | ||
53 | mi_thread_list_ids(h); | ||
54 | return mi_res_thread_ids(h,list); | ||
55 | } | ||
56 | |||
57 | /**[txh]******************************************************************** | ||
58 | |||
59 | Description: | ||
60 | Select a thread. | ||
61 | |||
62 | Command: -thread-select | ||
63 | Return: A new mi_frames or NULL on error. | ||
64 | |||
65 | ***************************************************************************/ | ||
66 | |||
67 | mi_frames *gmi_thread_select(mi_h *h, int id) | ||
68 | { | ||
69 | mi_thread_select(h,id); | ||
70 | return mi_res_frame(h); | ||
71 | } | ||
72 | |||
73 | /**[txh]******************************************************************** | ||
74 | |||
75 | Description: | ||
76 | Get a list of frames for each available thread. Implemented using "info | ||
77 | thread". | ||
78 | |||
79 | Command: -thread-list-all-threads | ||
80 | Return: A kist of frames, NULL on error | ||
81 | |||
82 | ***************************************************************************/ | ||
83 | |||
84 | mi_frames *gmi_thread_list_all_threads(mi_h *h) | ||
85 | { | ||
86 | mi_thread_list_all_threads(h); | ||
87 | return mi_res_frames_list(h); | ||
88 | } | ||
89 | |||