]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - packages/hal/common/v2_0/include/dbg-threads-api.h
Initial revision
[karo-tx-redboot.git] / packages / hal / common / v2_0 / include / dbg-threads-api.h
1 //========================================================================
2 //
3 //      dbg-threads-api.h
4 //
5 //      Supports thread-aware debugging
6 //
7 //========================================================================
8 //####ECOSGPLCOPYRIGHTBEGIN####
9 // -------------------------------------------
10 // This file is part of eCos, the Embedded Configurable Operating System.
11 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
12 //
13 // eCos is free software; you can redistribute it and/or modify it under
14 // the terms of the GNU General Public License as published by the Free
15 // Software Foundation; either version 2 or (at your option) any later version.
16 //
17 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
18 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
20 // for more details.
21 //
22 // You should have received a copy of the GNU General Public License along
23 // with eCos; if not, write to the Free Software Foundation, Inc.,
24 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
25 //
26 // As a special exception, if other files instantiate templates or use macros
27 // or inline functions from this file, or you compile this file and link it
28 // with other works to produce a work based on this file, this file does not
29 // by itself cause the resulting work to be covered by the GNU General Public
30 // License. However the source code for this file must still be made available
31 // in accordance with section (3) of the GNU General Public License.
32 //
33 // This exception does not invalidate any other reasons why a work based on
34 // this file might be covered by the GNU General Public License.
35 //
36 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
37 // at http://sources.redhat.com/ecos/ecos-license/
38 // -------------------------------------------
39 //####ECOSGPLCOPYRIGHTEND####
40 //========================================================================
41 //#####DESCRIPTIONBEGIN####
42 //
43 // Author(s):     Red Hat, nickg
44 // Contributors:  Red Hat, nickg
45 // Date:          1998-08-25
46 // Purpose:       
47 // Description:   These are the calls used to extract operating system
48 //                specific information used in supporting thread aware
49 //                debugging. The Operating Environment being debugged
50 //                needs to supply these functions.
51 // Usage:         This header is not to be included by user code.
52 //
53 //####DESCRIPTIONEND####
54 //
55 //========================================================================
56
57 #if !defined(DBG_THREADS_API_INCLUDED)
58 #define DBG_THREADS_API_INCLUDED 1
59
60 #include <cyg/infra/cyg_type.h>         /* externC */
61
62 #define has_thread_void       0 
63 #define has_thread_current    1
64 #define has_thread_registers  2
65 #define has_thread_reg_change 4
66 #define has_thread_list       8
67 #define has_thread_info       16
68
69 typedef unsigned char threadref[8] ;
70
71 struct dbg_capabilities
72 {
73   unsigned long mask1  ;
74 } ;
75
76
77 /* fill in the list of thread aware capabilities */
78 externC int dbg_thread_capabilities(struct dbg_capabilities * cbp) ;
79
80
81 /* Fillin the identifier of the current thread */
82 /* return 1 if defined, 0 if not defined */
83 externC int dbg_currthread(threadref * varparm) ;
84
85 /* Return the unique ID number of a given thread. */
86 /* Return 0 if not valid. */
87 externC int dbg_thread_id(threadref *threadid);
88
89 /* Return the unique ID number of the current thread. */
90 externC int dbg_currthread_id(void);
91
92 /* get the first or next member of the list of known threads */
93 externC int dbg_threadlist(int startflag,
94                            threadref * lastthreadid,
95                            threadref * next_thread
96     ) ;
97
98 /* return 1 if next_threadid has been filled in with a value */
99 /* return 0 if there are none or no more */
100
101 /* The O.S can fill in the following information about a thread when queried.
102    The structure of thise strings is determined by the O.S.
103    It is display oriented, so figure out what the users need to see.
104    Nulls are OK but GDB will fill some not so meaningful data.
105    These pointers may be in the calles private structures, the info will
106    get copied immediatly after the call to retreive it.
107    */
108 struct cygmon_thread_debug_info
109 {
110   threadref thread_id ;
111   int context_exists ; /* To the point where examining its state,
112                          registers and stack makes sense to GDB */
113   char * thread_display ; /* As shown in thread status window, name, state */
114   char * unique_thread_name ; /* human readable identifier, window label */
115   char * more_display ;   /* more detailed info about thread.
116                           priority, queuedepth, state, stack usage, statistics */
117 } ;
118
119
120
121
122 externC int dbg_threadinfo(
123                           threadref * threadid,
124                           struct cygmon_thread_debug_info * info) ;
125
126 /* Return 1 if threadid is defined and info copied, 0 otherwise */
127
128 /* The O.S should fillin the array of registers using values from the
129 saves context. The array MUST be in GDB register save order even if
130 the saved context is different or smaller. Do not alter the values of
131 registers which are NOT in the O.S. thread context. Their default values
132 have already been assigned.
133 */
134
135 externC int dbg_getthreadreg(
136                             threadref * osthreadid, 
137                             int regcount, /* count of registers in the array */
138                             void * regval) ; /* fillin this array */
139
140
141 /* The O.S. should scan through this list of registers which are in
142 GDB order and the O.S. should replace the values of all registers
143 which are defined in the saved context of thread or process identified
144 by osthreadid. Return 0 if the threadis does not map to a known
145 process or other error. Return 1 if the setting is successful.  */
146
147 externC int dbg_setthreadreg(
148                             threadref * osthreadid, 
149                             int regcount , /* number of registers */
150                             void * regval) ;
151
152 /* Control over OS scheduler. With the scheduler locked it should not
153    perform any rescheduling in response to interrupts.  */
154 externC int dbg_scheduler(
155                           threadref * osthreadid,
156                           int lock,     /* 0 == unlock, 1 == lock */
157                           int mode);    /* 0 == step,   1 == continue */
158
159
160
161 #endif /* DBG_THREADS_API_INCLUDED */