Commit | Line | Data |
---|---|---|
c906108c | 1 | /* Multi-process/thread control defs for GDB, the GNU debugger. |
197e01b6 | 2 | Copyright (C) 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1997, 1998, 1999, |
b6ba6518 | 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 | |
197e01b6 EZ |
22 | Foundation, Inc., 51 Franklin Street, Fifth Floor, |
23 | Boston, MA 02110-1301, USA. */ | |
c906108c SS |
24 | |
25 | #ifndef GDBTHREAD_H | |
26 | #define GDBTHREAD_H | |
27 | ||
da3331ec AC |
28 | struct breakpoint; |
29 | struct frame_id; | |
30 | struct symtab; | |
31 | ||
c906108c SS |
32 | /* For bpstat */ |
33 | #include "breakpoint.h" | |
34 | ||
aa0cd9c1 AC |
35 | /* For struct frame_id. */ |
36 | #include "frame.h" | |
37 | ||
0d06e24b JM |
38 | struct thread_info |
39 | { | |
40 | struct thread_info *next; | |
39f77062 | 41 | ptid_t ptid; /* "Actual process id"; |
0d06e24b JM |
42 | In fact, this may be overloaded with |
43 | kernel thread id, etc. */ | |
44 | int num; /* Convenient handle (GDB thread id) */ | |
45 | /* State from wait_for_inferior */ | |
46 | CORE_ADDR prev_pc; | |
0d06e24b | 47 | struct breakpoint *step_resume_breakpoint; |
0d06e24b JM |
48 | CORE_ADDR step_range_start; |
49 | CORE_ADDR step_range_end; | |
aa0cd9c1 | 50 | struct frame_id step_frame_id; |
6c0d3f6a MS |
51 | int current_line; |
52 | struct symtab *current_symtab; | |
0d06e24b JM |
53 | int trap_expected; |
54 | int handling_longjmp; | |
55 | int another_trap; | |
56 | ||
57 | /* This is set TRUE when a catchpoint of a shared library event | |
58 | triggers. Since we don't wish to leave the inferior in the | |
59 | solib hook when we report the event, we step the inferior | |
60 | back to user code before stopping and reporting the event. */ | |
61 | int stepping_through_solib_after_catch; | |
62 | ||
63 | /* When stepping_through_solib_after_catch is TRUE, this is a | |
64 | list of the catchpoints that should be reported as triggering | |
65 | when we finally do stop stepping. */ | |
66 | bpstat stepping_through_solib_catchpoints; | |
67 | ||
0d06e24b JM |
68 | /* Private data used by the target vector implementation. */ |
69 | struct private_thread_info *private; | |
70 | }; | |
71 | ||
72 | /* Create an empty thread list, or empty the existing one. */ | |
73 | extern void init_thread_list (void); | |
74 | ||
75 | /* Add a thread to the thread list. | |
76 | Note that add_thread now returns the handle of the new thread, | |
77 | so that the caller may initialize the private thread data. */ | |
39f77062 | 78 | extern struct thread_info *add_thread (ptid_t ptid); |
0d06e24b JM |
79 | |
80 | /* Delete an existing thread list entry. */ | |
39f77062 | 81 | extern void delete_thread (ptid_t); |
0d06e24b | 82 | |
8601f500 MS |
83 | /* Delete a step_resume_breakpoint from the thread database. */ |
84 | extern void delete_step_resume_breakpoint (void *); | |
85 | ||
0d06e24b JM |
86 | /* Translate the integer thread id (GDB's homegrown id, not the system's) |
87 | into a "pid" (which may be overloaded with extra thread information). */ | |
39f77062 | 88 | extern ptid_t thread_id_to_pid (int); |
0d06e24b JM |
89 | |
90 | /* Translate a 'pid' (which may be overloaded with extra thread information) | |
91 | into the integer thread id (GDB's homegrown id, not the system's). */ | |
39f77062 | 92 | extern int pid_to_thread_id (ptid_t ptid); |
0d06e24b JM |
93 | |
94 | /* Boolean test for an already-known pid (which may be overloaded with | |
95 | extra thread information). */ | |
39f77062 | 96 | extern int in_thread_list (ptid_t ptid); |
0d06e24b JM |
97 | |
98 | /* Boolean test for an already-known thread id (GDB's homegrown id, | |
99 | not the system's). */ | |
100 | extern int valid_thread_id (int thread); | |
101 | ||
102 | /* Search function to lookup a thread by 'pid'. */ | |
39f77062 | 103 | extern struct thread_info *find_thread_pid (ptid_t ptid); |
0d06e24b JM |
104 | |
105 | /* Iterator function to call a user-provided callback function | |
106 | once for each known thread. */ | |
107 | typedef int (*thread_callback_func) (struct thread_info *, void *); | |
108 | extern struct thread_info *iterate_over_threads (thread_callback_func, void *); | |
109 | ||
110 | /* infrun context switch: save the debugger state for the given thread. */ | |
39f77062 | 111 | extern void save_infrun_state (ptid_t ptid, |
0d06e24b | 112 | CORE_ADDR prev_pc, |
0d06e24b JM |
113 | int trap_expected, |
114 | struct breakpoint *step_resume_breakpoint, | |
0d06e24b JM |
115 | CORE_ADDR step_range_start, |
116 | CORE_ADDR step_range_end, | |
aa0cd9c1 | 117 | const struct frame_id *step_frame_id, |
0d06e24b JM |
118 | int handling_longjmp, |
119 | int another_trap, | |
120 | int stepping_through_solib_after_catch, | |
121 | bpstat stepping_through_solib_catchpoints, | |
6c0d3f6a | 122 | int current_line, |
f2c9ca08 | 123 | struct symtab *current_symtab); |
0d06e24b JM |
124 | |
125 | /* infrun context switch: load the debugger state previously saved | |
126 | for the given thread. */ | |
39f77062 | 127 | extern void load_infrun_state (ptid_t ptid, |
0d06e24b | 128 | CORE_ADDR *prev_pc, |
0d06e24b JM |
129 | int *trap_expected, |
130 | struct breakpoint **step_resume_breakpoint, | |
0d06e24b JM |
131 | CORE_ADDR *step_range_start, |
132 | CORE_ADDR *step_range_end, | |
aa0cd9c1 | 133 | struct frame_id *step_frame_id, |
0d06e24b JM |
134 | int *handling_longjmp, |
135 | int *another_trap, | |
136 | int *stepping_through_solib_affter_catch, | |
137 | bpstat *stepping_through_solib_catchpoints, | |
6c0d3f6a | 138 | int *current_line, |
f2c9ca08 | 139 | struct symtab **current_symtab); |
c906108c SS |
140 | |
141 | /* Commands with a prefix of `thread'. */ | |
142 | extern struct cmd_list_element *thread_cmd_list; | |
143 | ||
c5aa993b | 144 | #endif /* GDBTHREAD_H */ |