|
0
|
1 #if !defined(DBG_THREADS_API_INCLUDED) |
|
|
2 #define DBG_THREADS_API_INCLUDED 1 |
|
|
3 /* These are the calls used to extract operating system specific information |
|
|
4 used in supporting thread aware debugging. |
|
|
5 The Operating Environment being debugged needs to supply these functions. |
|
|
6 */ |
|
|
7 |
|
|
8 /* |
|
2
|
9 * Copyright (c) 1998,1999 Cygnus Solutions |
|
0
|
10 * |
|
|
11 * The authors hereby grant permission to use, copy, modify, distribute, |
|
|
12 * and license this software and its documentation for any purpose, provided |
|
|
13 * that existing copyright notices are retained in all copies and that this |
|
|
14 * notice is included verbatim in any distributions. No written agreement, |
|
|
15 * license, or royalty fee is required for any of the authorized uses. |
|
|
16 * Modifications to this software may be copyrighted by their authors |
|
|
17 * and need not follow the licensing terms described here, provided that |
|
|
18 * the new terms are clearly indicated on the first page of each file where |
|
|
19 * they apply. |
|
|
20 */ |
|
|
21 |
|
2
|
22 #include <cyg/infra/cyg_type.h> /* externC */ |
|
|
23 |
|
0
|
24 #define has_thread_void 0 |
|
|
25 #define has_thread_current 1 |
|
|
26 #define has_thread_registers 2 |
|
|
27 #define has_thread_reg_change 4 |
|
|
28 #define has_thread_list 8 |
|
|
29 #define has_thread_info 16 |
|
|
30 |
|
|
31 typedef unsigned char threadref[8] ; |
|
|
32 |
|
|
33 struct dbg_capabilities |
|
|
34 { |
|
|
35 unsigned long mask1 ; |
|
|
36 } ; |
|
|
37 |
|
|
38 |
|
|
39 /* fill in the list of thread aware capabilities */ |
|
|
40 extern int dbg_thread_capabilities(struct dbg_capabilities * cbp) ; |
|
|
41 |
|
|
42 |
|
|
43 /* Fillin the identifier of the current thread */ |
|
|
44 /* return 1 if defined, 0 if not defined */ |
|
|
45 extern int dbg_currthread(threadref * varparm) ; |
|
|
46 |
|
|
47 /* Return the unique ID number of the current thread. */ |
|
|
48 extern int dbg_currthread_id(void); |
|
|
49 |
|
|
50 /* get the first or next member of the list of known threads */ |
|
|
51 extern int dbg_threadlist(int startflag, |
|
2
|
52 threadref * lastthreadid, |
|
|
53 threadref * next_thread |
|
|
54 ) ; |
|
0
|
55 |
|
|
56 /* return 1 if next_threadid has been filled in with a value */ |
|
|
57 /* return 0 if there are none or no more */ |
|
|
58 |
|
|
59 /* The O.S can fill in the following information about a thread when queried. |
|
|
60 The structure of thise strings is determined by the O.S. |
|
|
61 It is display oriented, so figure out what the users need to see. |
|
|
62 Nulls are OK but GDB will fill some not so meaningful data. |
|
|
63 These pointers may be in the calles private structures, the info will |
|
|
64 get copied immediatly after the call to retreive it. |
|
|
65 */ |
|
|
66 struct cygmon_thread_debug_info |
|
|
67 { |
|
|
68 threadref thread_id ; |
|
|
69 int context_exists ; /* To the point where examining its state, |
|
2
|
70 registers and stack makes sense to GDB */ |
|
0
|
71 char * thread_display ; /* As shown in thread status window, name, state */ |
|
|
72 char * unique_thread_name ; /* human readable identifier, window label */ |
|
|
73 char * more_display ; /* more detailed info about thread. |
|
2
|
74 priority, queuedepth, state, stack usage, statistics */ |
|
0
|
75 } ; |
|
|
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
|
80 extern int dbg_threadinfo( |
|
2
|
81 threadref * threadid, |
|
|
82 struct cygmon_thread_debug_info * info) ; |
|
0
|
83 |
|
|
84 /* Return 1 if threadid is defined and info copied, 0 otherwise */ |
|
|
85 |
|
|
86 /* The O.S should fillin the array of registers using values from the |
|
|
87 saves context. The array MUST be in GDB register save order even if |
|
|
88 the saved context is different or smaller. Do not alter the values of |
|
|
89 registers which are NOT in the O.S. thread context. Their default values |
|
|
90 have already been assigned. |
|
|
91 */ |
|
|
92 |
|
|
93 extern int dbg_getthreadreg( |
|
2
|
94 threadref * osthreadid, |
|
|
95 int regcount, /* count of registers in the array */ |
|
|
96 void * regval) ; /* fillin this array */ |
|
0
|
97 |
|
|
98 |
|
|
99 /* The O.S. should scan through this list of registers which are in |
|
|
100 GDB order and the O.S. should replace the values of all registers |
|
|
101 which are defined in the saved context of thread or process identified |
|
|
102 by osthreadid. Return 0 if the threadis does not map to a known |
|
|
103 process or other error. Return 1 if the setting is successful. */ |
|
|
104 |
|
|
105 extern int dbg_setthreadreg( |
|
2
|
106 threadref * osthreadid, |
|
|
107 int regcount , /* number of registers */ |
|
|
108 void * regval) ; |
|
|
109 |
|
|
110 /* Control over OS scheduler. With the scheduler locked it should not |
|
|
111 perform any rescheduling in response to interrupts. */ |
|
|
112 externC int dbg_scheduler( |
|
|
113 threadref * osthreadid, |
|
|
114 int lock, /* 0 == unlock, 1 == lock */ |
|
|
115 int mode); /* 0 == step, 1 == continue */ |
|
|
116 |
|
|
117 |
|
0
|
118 |
|
|
119 #endif /* DBG_THREADS_API_INCLUDED */ |