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