Commit | Line | Data |
---|---|---|
c906108c | 1 | /* Multi-process/thread control defs for GDB, the GNU debugger. |
b6ba6518 KB |
2 | Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1997, 1998, 1999, |
3 | 2000 | |
c906108c | 4 | Free Software Foundation, Inc. |
b6ba6518 KB |
5 | Contributed by Lynx Real-Time Systems, Inc. Los Gatos, CA. |
6 | ||
c906108c | 7 | |
c5aa993b | 8 | This file is part of GDB. |
c906108c | 9 | |
c5aa993b JM |
10 | This program is free software; you can redistribute it and/or modify |
11 | it under the terms of the GNU General Public License as published by | |
12 | the Free Software Foundation; either version 2 of the License, or | |
13 | (at your option) any later version. | |
c906108c | 14 | |
c5aa993b JM |
15 | This program is distributed in the hope that it will be useful, |
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | GNU General Public License for more details. | |
c906108c | 19 | |
c5aa993b JM |
20 | You should have received a copy of the GNU General Public License |
21 | along with this program; if not, write to the Free Software | |
22 | Foundation, Inc., 59 Temple Place - Suite 330, | |
23 | Boston, MA 02111-1307, USA. */ | |
c906108c SS |
24 | |
25 | #ifndef GDBTHREAD_H | |
26 | #define GDBTHREAD_H | |
27 | ||
28 | /* For bpstat */ | |
29 | #include "breakpoint.h" | |
30 | ||
0d06e24b JM |
31 | struct thread_info |
32 | { | |
33 | struct thread_info *next; | |
34 | int pid; /* "Actual process id"; | |
35 | In fact, this may be overloaded with | |
36 | kernel thread id, etc. */ | |
37 | int num; /* Convenient handle (GDB thread id) */ | |
38 | /* State from wait_for_inferior */ | |
39 | CORE_ADDR prev_pc; | |
40 | CORE_ADDR prev_func_start; | |
41 | char *prev_func_name; | |
42 | struct breakpoint *step_resume_breakpoint; | |
43 | struct breakpoint *through_sigtramp_breakpoint; | |
44 | CORE_ADDR step_range_start; | |
45 | CORE_ADDR step_range_end; | |
46 | CORE_ADDR step_frame_address; | |
47 | int trap_expected; | |
48 | int handling_longjmp; | |
49 | int another_trap; | |
50 | ||
51 | /* This is set TRUE when a catchpoint of a shared library event | |
52 | triggers. Since we don't wish to leave the inferior in the | |
53 | solib hook when we report the event, we step the inferior | |
54 | back to user code before stopping and reporting the event. */ | |
55 | int stepping_through_solib_after_catch; | |
56 | ||
57 | /* When stepping_through_solib_after_catch is TRUE, this is a | |
58 | list of the catchpoints that should be reported as triggering | |
59 | when we finally do stop stepping. */ | |
60 | bpstat stepping_through_solib_catchpoints; | |
61 | ||
62 | /* This is set to TRUE when this thread is in a signal handler | |
63 | trampoline and we're single-stepping through it. */ | |
64 | int stepping_through_sigtramp; | |
65 | ||
66 | /* Private data used by the target vector implementation. */ | |
67 | struct private_thread_info *private; | |
68 | }; | |
69 | ||
70 | /* Create an empty thread list, or empty the existing one. */ | |
71 | extern void init_thread_list (void); | |
72 | ||
73 | /* Add a thread to the thread list. | |
74 | Note that add_thread now returns the handle of the new thread, | |
75 | so that the caller may initialize the private thread data. */ | |
76 | extern struct thread_info *add_thread (int pid); | |
77 | ||
78 | /* Delete an existing thread list entry. */ | |
79 | extern void delete_thread (int); | |
80 | ||
81 | /* Translate the integer thread id (GDB's homegrown id, not the system's) | |
82 | into a "pid" (which may be overloaded with extra thread information). */ | |
83 | extern int thread_id_to_pid (int); | |
84 | ||
85 | /* Translate a 'pid' (which may be overloaded with extra thread information) | |
86 | into the integer thread id (GDB's homegrown id, not the system's). */ | |
87 | extern int pid_to_thread_id (int pid); | |
88 | ||
89 | /* Boolean test for an already-known pid (which may be overloaded with | |
90 | extra thread information). */ | |
91 | extern int in_thread_list (int pid); | |
92 | ||
93 | /* Boolean test for an already-known thread id (GDB's homegrown id, | |
94 | not the system's). */ | |
95 | extern int valid_thread_id (int thread); | |
96 | ||
97 | /* Search function to lookup a thread by 'pid'. */ | |
98 | extern struct thread_info *find_thread_pid (int pid); | |
99 | ||
100 | /* Iterator function to call a user-provided callback function | |
101 | once for each known thread. */ | |
102 | typedef int (*thread_callback_func) (struct thread_info *, void *); | |
103 | extern struct thread_info *iterate_over_threads (thread_callback_func, void *); | |
104 | ||
105 | /* infrun context switch: save the debugger state for the given thread. */ | |
106 | extern void save_infrun_state (int pid, | |
107 | CORE_ADDR prev_pc, | |
108 | CORE_ADDR prev_func_start, | |
109 | char *prev_func_name, | |
110 | int trap_expected, | |
111 | struct breakpoint *step_resume_breakpoint, | |
112 | struct breakpoint *through_sigtramp_breakpoint, | |
113 | CORE_ADDR step_range_start, | |
114 | CORE_ADDR step_range_end, | |
115 | CORE_ADDR step_frame_address, | |
116 | int handling_longjmp, | |
117 | int another_trap, | |
118 | int stepping_through_solib_after_catch, | |
119 | bpstat stepping_through_solib_catchpoints, | |
120 | int stepping_through_sigtramp); | |
121 | ||
122 | /* infrun context switch: load the debugger state previously saved | |
123 | for the given thread. */ | |
124 | extern void load_infrun_state (int pid, | |
125 | CORE_ADDR *prev_pc, | |
126 | CORE_ADDR *prev_func_start, | |
127 | char **prev_func_name, | |
128 | int *trap_expected, | |
129 | struct breakpoint **step_resume_breakpoint, | |
130 | struct breakpoint **through_sigtramp_breakpoint, | |
131 | CORE_ADDR *step_range_start, | |
132 | CORE_ADDR *step_range_end, | |
133 | CORE_ADDR *step_frame_address, | |
134 | int *handling_longjmp, | |
135 | int *another_trap, | |
136 | int *stepping_through_solib_affter_catch, | |
137 | bpstat *stepping_through_solib_catchpoints, | |
138 | int *stepping_through_sigtramp); | |
c906108c SS |
139 | |
140 | /* Commands with a prefix of `thread'. */ | |
141 | extern struct cmd_list_element *thread_cmd_list; | |
142 | ||
c5aa993b | 143 | #endif /* GDBTHREAD_H */ |