aboutsummaryrefslogtreecommitdiff
path: root/src/monkey/thread.c
blob: 51a333f5b0f1c9a037f2b4018087b5298986cf80 (plain) (blame)
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
/**[txh]********************************************************************

  Copyright (c) 2004 by Salvador E. Tropea.
  Covered by the GPL license.

  Module: Thread commands.
  Comments:
  GDB/MI commands for the "Thread Commands" section.@p

@<pre>
gdb command:              Implemented?
-thread-info              N.A.
-thread-list-all-threads  Yes, implemented as "info threads"
-thread-list-ids          Yes
-thread-select            Yes
@</pre>

***************************************************************************/

#include "mi_gdb.h"

/* Low level versions. */

void mi_thread_list_ids(mi_h *h)
{
 mi_send(h,"-thread-list-ids\n");
}

void mi_thread_select(mi_h *h, int id)
{
 mi_send(h,"-thread-select %d\n",id);
}

void mi_thread_list_all_threads(mi_h *h)
{
 mi_send(h,"info threads\n");
}

/* High level versions. */

/**[txh]********************************************************************

  Description:
  List available thread ids.

  Command: -thread-list-ids
  Return: !=0 OK
  
***************************************************************************/

int gmi_thread_list_ids(mi_h *h, int **list)
{
 mi_thread_list_ids(h);
 return mi_res_thread_ids(h,list);
}

/**[txh]********************************************************************

  Description:
  Select a thread.

  Command: -thread-select
  Return: A new mi_frames or NULL on error.
  
***************************************************************************/

mi_frames *gmi_thread_select(mi_h *h, int id)
{
 mi_thread_select(h,id);
 return mi_res_frame(h);
}

/**[txh]********************************************************************

  Description:
  Get a list of frames for each available thread. Implemented using "info
thread".

  Command: -thread-list-all-threads
  Return: A kist of frames, NULL on error
  
***************************************************************************/

mi_frames *gmi_thread_list_all_threads(mi_h *h)
{
 mi_thread_list_all_threads(h);
 return mi_res_frames_list(h);
}