2002-12-05 Andrew Cagney <ac131313@redhat.com>
[deliverable/binutils-gdb.git] / gdb / gdbthread.h
1 /* Multi-process/thread control defs for GDB, the GNU debugger.
2 Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1997, 1998, 1999,
3 2000
4 Free Software Foundation, Inc.
5 Contributed by Lynx Real-Time Systems, Inc. Los Gatos, CA.
6
7
8 This file is part of GDB.
9
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.
14
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.
19
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. */
24
25 #ifndef GDBTHREAD_H
26 #define GDBTHREAD_H
27
28 /* For bpstat */
29 #include "breakpoint.h"
30
31 /* For struct frame_id. */
32 #include "frame.h"
33
34 struct thread_info
35 {
36 struct thread_info *next;
37 ptid_t ptid; /* "Actual process id";
38 In fact, this may be overloaded with
39 kernel thread id, etc. */
40 int num; /* Convenient handle (GDB thread id) */
41 /* State from wait_for_inferior */
42 CORE_ADDR prev_pc;
43 CORE_ADDR prev_func_start;
44 char *prev_func_name;
45 struct breakpoint *step_resume_breakpoint;
46 struct breakpoint *through_sigtramp_breakpoint;
47 CORE_ADDR step_range_start;
48 CORE_ADDR step_range_end;
49 struct frame_id step_frame_id;
50 CORE_ADDR step_sp;
51 int current_line;
52 struct symtab *current_symtab;
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
68 /* This is set to TRUE when this thread is in a signal handler
69 trampoline and we're single-stepping through it. */
70 int stepping_through_sigtramp;
71
72 /* Private data used by the target vector implementation. */
73 struct private_thread_info *private;
74 };
75
76 /* Create an empty thread list, or empty the existing one. */
77 extern void init_thread_list (void);
78
79 /* Add a thread to the thread list.
80 Note that add_thread now returns the handle of the new thread,
81 so that the caller may initialize the private thread data. */
82 extern struct thread_info *add_thread (ptid_t ptid);
83
84 /* Delete an existing thread list entry. */
85 extern void delete_thread (ptid_t);
86
87 /* Delete a step_resume_breakpoint from the thread database. */
88 extern void delete_step_resume_breakpoint (void *);
89
90 /* Translate the integer thread id (GDB's homegrown id, not the system's)
91 into a "pid" (which may be overloaded with extra thread information). */
92 extern ptid_t thread_id_to_pid (int);
93
94 /* Translate a 'pid' (which may be overloaded with extra thread information)
95 into the integer thread id (GDB's homegrown id, not the system's). */
96 extern int pid_to_thread_id (ptid_t ptid);
97
98 /* Boolean test for an already-known pid (which may be overloaded with
99 extra thread information). */
100 extern int in_thread_list (ptid_t ptid);
101
102 /* Boolean test for an already-known thread id (GDB's homegrown id,
103 not the system's). */
104 extern int valid_thread_id (int thread);
105
106 /* Search function to lookup a thread by 'pid'. */
107 extern struct thread_info *find_thread_pid (ptid_t ptid);
108
109 /* Iterator function to call a user-provided callback function
110 once for each known thread. */
111 typedef int (*thread_callback_func) (struct thread_info *, void *);
112 extern struct thread_info *iterate_over_threads (thread_callback_func, void *);
113
114 /* infrun context switch: save the debugger state for the given thread. */
115 extern void save_infrun_state (ptid_t ptid,
116 CORE_ADDR prev_pc,
117 CORE_ADDR prev_func_start,
118 char *prev_func_name,
119 int trap_expected,
120 struct breakpoint *step_resume_breakpoint,
121 struct breakpoint *through_sigtramp_breakpoint,
122 CORE_ADDR step_range_start,
123 CORE_ADDR step_range_end,
124 const struct frame_id *step_frame_id,
125 int handling_longjmp,
126 int another_trap,
127 int stepping_through_solib_after_catch,
128 bpstat stepping_through_solib_catchpoints,
129 int stepping_through_sigtramp,
130 int current_line,
131 struct symtab *current_symtab,
132 CORE_ADDR step_sp);
133
134 /* infrun context switch: load the debugger state previously saved
135 for the given thread. */
136 extern void load_infrun_state (ptid_t ptid,
137 CORE_ADDR *prev_pc,
138 CORE_ADDR *prev_func_start,
139 char **prev_func_name,
140 int *trap_expected,
141 struct breakpoint **step_resume_breakpoint,
142 struct breakpoint **through_sigtramp_breakpoint,
143 CORE_ADDR *step_range_start,
144 CORE_ADDR *step_range_end,
145 struct frame_id *step_frame_id,
146 int *handling_longjmp,
147 int *another_trap,
148 int *stepping_through_solib_affter_catch,
149 bpstat *stepping_through_solib_catchpoints,
150 int *stepping_through_sigtramp,
151 int *current_line,
152 struct symtab **current_symtab,
153 CORE_ADDR *step_sp);
154
155 /* Commands with a prefix of `thread'. */
156 extern struct cmd_list_element *thread_cmd_list;
157
158 #endif /* GDBTHREAD_H */
This page took 0.049358 seconds and 5 git commands to generate.