* remote.c (remote_get_threadinfo) : Support for remote
multithread debugging. (remote_get_threadlist) : get a partial list of threads (remote_threadlist_iterator) : Step through all the threads (init_remote_threadtests) : Optional builtin unit test commands. * thread.c (bind_target_thread_vector) : Implementa a more dynamic way of accessing target specific thread info functions than FIND_NEW_THREADS. (target_thread_info) : Function to get extended thread information. * gdbthread.h : Export internal data structures corresponding to external detailed thread info response. This is more like a 'ps' command than what might be expected of host based threads. This is for embedded systems.
This commit is contained in:
parent
b91e1ec1e4
commit
9ee5984468
|
@ -1,3 +1,21 @@
|
||||||
|
Thu Nov 12 17:19:43 1998 John Metzler <jmetzler@cygnus.com>
|
||||||
|
|
||||||
|
* remote.c (remote_get_threadinfo) : Support for remote
|
||||||
|
multithread debugging.
|
||||||
|
(remote_get_threadlist) : get a partial list of threads
|
||||||
|
(remote_threadlist_iterator) : Step through all the threads
|
||||||
|
(init_remote_threadtests) : Optional builtin unit test commands.
|
||||||
|
|
||||||
|
* thread.c (bind_target_thread_vector) : Implementa a more dynamic
|
||||||
|
way of accessing target specific thread info functions than
|
||||||
|
FIND_NEW_THREADS.
|
||||||
|
(target_thread_info) : Function to get extended thread information.
|
||||||
|
|
||||||
|
* gdbthread.h : Export internal data structures corresponding to
|
||||||
|
external detailed thread info response. This is more like a 'ps'
|
||||||
|
command than what might be expected of host based threads. This
|
||||||
|
is for embedded systems.
|
||||||
|
|
||||||
Mon Nov 9 12:00:36 1998 Dave Brolley <brolley@cygnus.com>
|
Mon Nov 9 12:00:36 1998 Dave Brolley <brolley@cygnus.com>
|
||||||
|
|
||||||
* config/fr30/fr30.mt: New file.
|
* config/fr30/fr30.mt: New file.
|
||||||
|
|
|
@ -50,4 +50,67 @@ extern void save_infrun_state PARAMS ((int, CORE_ADDR, CORE_ADDR, char *,
|
||||||
/* Commands with a prefix of `thread'. */
|
/* Commands with a prefix of `thread'. */
|
||||||
extern struct cmd_list_element *thread_cmd_list;
|
extern struct cmd_list_element *thread_cmd_list;
|
||||||
|
|
||||||
|
/* Support for external (remote) systems with threads (processes) */
|
||||||
|
/* For example real time operating systems */
|
||||||
|
|
||||||
|
#define OPAQUETHREADBYTES 8
|
||||||
|
/* a 64 bit opaque identifier */
|
||||||
|
typedef unsigned char threadref[OPAQUETHREADBYTES] ;
|
||||||
|
/* WARNING: This threadref data structure comes from the remote O.S., libstub
|
||||||
|
protocol encoding, and remote.c. it is not particularly changable */
|
||||||
|
|
||||||
|
/* Right now, the internal structure is int. We want it to be bigger.
|
||||||
|
Plan to fix this.
|
||||||
|
*/
|
||||||
|
typedef int gdb_threadref ; /* internal GDB thread reference */
|
||||||
|
|
||||||
|
/* gdb_ext_thread_info is an internal GDB data structure which is
|
||||||
|
equivalint to the reply of the remote threadinfo packet */
|
||||||
|
|
||||||
|
struct gdb_ext_thread_info
|
||||||
|
{
|
||||||
|
threadref threadid ; /* External form of thread reference */
|
||||||
|
int active ; /* Has state interesting to GDB? , regs, stack */
|
||||||
|
char display[256] ; /* Brief state display, name, blocked/syspended */
|
||||||
|
char shortname[32] ; /* To be used to name threads */
|
||||||
|
char more_display[256] ; /* Long info, statistics, queue depth, whatever */
|
||||||
|
} ;
|
||||||
|
|
||||||
|
/* The volume of remote transfers can be limited by submitting
|
||||||
|
a mask containing bits specifying the desired information.
|
||||||
|
Use a union of these values as the 'selection' parameter to
|
||||||
|
get_thread_info. FIXME: Make these TAG names more thread specific.
|
||||||
|
*/
|
||||||
|
#define TAG_THREADID 1
|
||||||
|
#define TAG_EXISTS 2
|
||||||
|
#define TAG_DISPLAY 4
|
||||||
|
#define TAG_THREADNAME 8
|
||||||
|
#define TAG_MOREDISPLAY 16
|
||||||
|
|
||||||
|
/* Always initialize an instance of this structure using run time assignments */
|
||||||
|
/* Because we are likely to add entrtries to it. */
|
||||||
|
/* Alternatly, WE COULD ADD THESE TO THE TARGET VECTOR */
|
||||||
|
|
||||||
|
struct target_thread_vector
|
||||||
|
{
|
||||||
|
int (*find_new_threads)PARAMS((void)) ;
|
||||||
|
int (*get_thread_info) PARAMS((
|
||||||
|
gdb_threadref * ref,
|
||||||
|
int selection,
|
||||||
|
struct gdb_ext_thread_info * info
|
||||||
|
)) ;
|
||||||
|
/* to_thread_alive - Already in the target vector */
|
||||||
|
/* to_switch_thread - Done via select frame */
|
||||||
|
} ;
|
||||||
|
|
||||||
|
extern void bind_target_thread_vector PARAMS((struct target_thread_vector * vec)) ;
|
||||||
|
|
||||||
|
extern struct target_thread_vector * unbind_target_thread_vector(void) ;
|
||||||
|
|
||||||
|
extern int target_get_thread_info PARAMS((
|
||||||
|
gdb_threadref * ref,
|
||||||
|
int selection,
|
||||||
|
struct gdb_ext_thread_info * info)) ;
|
||||||
|
|
||||||
|
|
||||||
#endif /* GDBTHREAD_H */
|
#endif /* GDBTHREAD_H */
|
||||||
|
|
94
gdb/thread.c
94
gdb/thread.c
|
@ -55,22 +55,104 @@ struct thread_info
|
||||||
int another_trap;
|
int another_trap;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct thread_info *thread_list = NULL;
|
|
||||||
static int highest_thread_num;
|
|
||||||
|
|
||||||
|
|
||||||
|
static struct target_thread_vector *target_thread_functions;
|
||||||
|
|
||||||
|
int
|
||||||
|
target_find_new_threads ()
|
||||||
|
{
|
||||||
|
int retval = 0;
|
||||||
|
if (target_thread_functions &&
|
||||||
|
target_thread_functions->find_new_threads)
|
||||||
|
retval = (*(target_thread_functions->find_new_threads)) ();
|
||||||
|
return retval; /* no support */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
target_get_thread_info PARAMS ((
|
||||||
|
gdb_threadref * ref,
|
||||||
|
int selection, /* FIXME: Selection */
|
||||||
|
struct gdb_ext_thread_info * info));
|
||||||
|
|
||||||
|
int
|
||||||
|
target_get_thread_info (ref, selection, info)
|
||||||
|
|
||||||
|
gdb_threadref *ref;
|
||||||
|
int selection;
|
||||||
|
/* FIXME: Selection */
|
||||||
|
struct gdb_ext_thread_info *info;
|
||||||
|
|
||||||
|
{
|
||||||
|
int retval = 0;
|
||||||
|
if (target_thread_functions
|
||||||
|
&& target_thread_functions->get_thread_info)
|
||||||
|
retval = (*(target_thread_functions->get_thread_info)) (ref, selection, info);
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* It is possible that these bind and unbinf functions implement a
|
||||||
|
stack the interface allows it, but its not implemented that way
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
bind_target_thread_vector (vec)
|
||||||
|
struct target_thread_vector *vec;
|
||||||
|
{
|
||||||
|
target_thread_functions = vec;
|
||||||
|
}
|
||||||
/* Prototypes for exported functions. */
|
/* Prototypes for exported functions. */
|
||||||
|
|
||||||
|
struct target_thread_vector *
|
||||||
|
unbind_target_thread_vector ()
|
||||||
|
{
|
||||||
|
struct target_thread_vector *retval;
|
||||||
|
retval = target_thread_functions;
|
||||||
|
target_thread_functions = 0;
|
||||||
|
return retval;
|
||||||
|
} /* unbind_target_thread-vector */
|
||||||
|
|
||||||
void _initialize_thread PARAMS ((void));
|
void _initialize_thread PARAMS ((void));
|
||||||
|
|
||||||
|
|
||||||
/* Prototypes for local functions. */
|
/* Prototypes for local functions. */
|
||||||
|
/* If the host has threads, the host machine definition may
|
||||||
|
set this macro. But, for remote thread debugging, it gets more
|
||||||
|
complex and setting macros does not bind to the various target
|
||||||
|
dependent methods well. So, we use the vector target_thread_functions
|
||||||
|
*/
|
||||||
|
#if !defined(FIND_NEW_THREADS)
|
||||||
|
#define FIND_NEW_THREADS target_find_new_threads
|
||||||
|
#endif
|
||||||
|
|
||||||
static void thread_command PARAMS ((char * tidstr, int from_tty));
|
static struct thread_info *thread_list = NULL;
|
||||||
|
static int highest_thread_num;
|
||||||
|
|
||||||
static void prune_threads PARAMS ((void));
|
static void
|
||||||
|
thread_command PARAMS ((char * tidstr, int from_tty));
|
||||||
|
static void
|
||||||
|
prune_threads PARAMS ((void));
|
||||||
|
|
||||||
static void switch_to_thread PARAMS ((int pid));
|
static void
|
||||||
|
switch_to_thread PARAMS ((int pid));
|
||||||
|
|
||||||
static struct thread_info *find_thread_id PARAMS ((int num));
|
static struct thread_info *
|
||||||
|
find_thread_id PARAMS ((int num));
|
||||||
|
|
||||||
|
static void
|
||||||
|
info_threads_command PARAMS ((char *, int));
|
||||||
|
|
||||||
|
static void
|
||||||
|
restore_current_thread PARAMS ((int));
|
||||||
|
|
||||||
|
static void
|
||||||
|
thread_apply_all_command PARAMS ((char *, int));
|
||||||
|
|
||||||
|
static void
|
||||||
|
thread_apply_command PARAMS ((char *, int));
|
||||||
|
|
||||||
static void info_threads_command PARAMS ((char *, int));
|
static void info_threads_command PARAMS ((char *, int));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue