| 1 | /* Multi-process/thread control defs for GDB, the GNU debugger. |
| 2 | Copyright 1987, 88, 89, 90, 91, 92, 1993, 1998 |
| 3 | |
| 4 | Contributed by Lynx Real-Time Systems, Inc. Los Gatos, CA. |
| 5 | Free Software Foundation, Inc. |
| 6 | |
| 7 | This file is part of GDB. |
| 8 | |
| 9 | This program is free software; you can redistribute it and/or modify |
| 10 | it under the terms of the GNU General Public License as published by |
| 11 | the Free Software Foundation; either version 2 of the License, or |
| 12 | (at your option) any later version. |
| 13 | |
| 14 | This program is distributed in the hope that it will be useful, |
| 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | GNU General Public License for more details. |
| 18 | |
| 19 | You should have received a copy of the GNU General Public License |
| 20 | along with this program; if not, write to the Free Software |
| 21 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
| 22 | |
| 23 | #ifndef GDBTHREAD_H |
| 24 | #define GDBTHREAD_H |
| 25 | |
| 26 | /* For bpstat */ |
| 27 | #include "breakpoint.h" |
| 28 | |
| 29 | extern void init_thread_list PARAMS ((void)); |
| 30 | |
| 31 | extern void add_thread PARAMS ((int pid)); |
| 32 | |
| 33 | extern void delete_thread PARAMS ((int)); |
| 34 | |
| 35 | extern int thread_id_to_pid PARAMS ((int)); |
| 36 | |
| 37 | extern int in_thread_list PARAMS ((int pid)); |
| 38 | |
| 39 | extern int pid_to_thread_id PARAMS ((int pid)); |
| 40 | |
| 41 | extern int valid_thread_id PARAMS ((int thread)); |
| 42 | |
| 43 | extern void load_infrun_state PARAMS ((int, CORE_ADDR *, CORE_ADDR *, char **, |
| 44 | int *, struct breakpoint **, |
| 45 | struct breakpoint **, CORE_ADDR *, |
| 46 | CORE_ADDR *, CORE_ADDR *, int *, int *, |
| 47 | int *, bpstat *, int *)); |
| 48 | |
| 49 | extern void save_infrun_state PARAMS ((int, CORE_ADDR, CORE_ADDR, char *, |
| 50 | int, struct breakpoint *, |
| 51 | struct breakpoint *, CORE_ADDR, |
| 52 | CORE_ADDR, CORE_ADDR, int, int, |
| 53 | int, bpstat, int)); |
| 54 | |
| 55 | /* Commands with a prefix of `thread'. */ |
| 56 | extern struct cmd_list_element *thread_cmd_list; |
| 57 | |
| 58 | /* Support for external (remote) systems with threads (processes) */ |
| 59 | /* For example real time operating systems */ |
| 60 | |
| 61 | #define OPAQUETHREADBYTES 8 |
| 62 | /* a 64 bit opaque identifier */ |
| 63 | typedef unsigned char threadref[OPAQUETHREADBYTES] ; |
| 64 | /* WARNING: This threadref data structure comes from the remote O.S., libstub |
| 65 | protocol encoding, and remote.c. it is not particularly changable */ |
| 66 | |
| 67 | /* Right now, the internal structure is int. We want it to be bigger. |
| 68 | Plan to fix this. |
| 69 | */ |
| 70 | typedef int gdb_threadref ; /* internal GDB thread reference */ |
| 71 | |
| 72 | /* gdb_ext_thread_info is an internal GDB data structure which is |
| 73 | equivalint to the reply of the remote threadinfo packet */ |
| 74 | |
| 75 | struct gdb_ext_thread_info |
| 76 | { |
| 77 | threadref threadid ; /* External form of thread reference */ |
| 78 | int active ; /* Has state interesting to GDB? , regs, stack */ |
| 79 | char display[256] ; /* Brief state display, name, blocked/syspended */ |
| 80 | char shortname[32] ; /* To be used to name threads */ |
| 81 | char more_display[256] ; /* Long info, statistics, queue depth, whatever */ |
| 82 | } ; |
| 83 | |
| 84 | /* The volume of remote transfers can be limited by submitting |
| 85 | a mask containing bits specifying the desired information. |
| 86 | Use a union of these values as the 'selection' parameter to |
| 87 | get_thread_info. FIXME: Make these TAG names more thread specific. |
| 88 | */ |
| 89 | #define TAG_THREADID 1 |
| 90 | #define TAG_EXISTS 2 |
| 91 | #define TAG_DISPLAY 4 |
| 92 | #define TAG_THREADNAME 8 |
| 93 | #define TAG_MOREDISPLAY 16 |
| 94 | |
| 95 | /* Always initialize an instance of this structure using run time assignments */ |
| 96 | /* Because we are likely to add entrtries to it. */ |
| 97 | /* Alternatly, WE COULD ADD THESE TO THE TARGET VECTOR */ |
| 98 | |
| 99 | struct target_thread_vector |
| 100 | { |
| 101 | int (*find_new_threads)PARAMS((void)) ; |
| 102 | int (*get_thread_info) PARAMS(( |
| 103 | gdb_threadref * ref, |
| 104 | int selection, |
| 105 | struct gdb_ext_thread_info * info |
| 106 | )) ; |
| 107 | /* to_thread_alive - Already in the target vector */ |
| 108 | /* to_switch_thread - Done via select frame */ |
| 109 | } ; |
| 110 | |
| 111 | extern void bind_target_thread_vector PARAMS((struct target_thread_vector * vec)) ; |
| 112 | |
| 113 | extern struct target_thread_vector * unbind_target_thread_vector PARAMS ((void)) ; |
| 114 | |
| 115 | extern int target_get_thread_info PARAMS(( |
| 116 | gdb_threadref * ref, |
| 117 | int selection, |
| 118 | struct gdb_ext_thread_info * info)) ; |
| 119 | |
| 120 | |
| 121 | #endif /* GDBTHREAD_H */ |