2004-05-10 Andrew Cagney <cagney@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 struct breakpoint;
29 struct frame_id;
30 struct symtab;
31
32 /* For bpstat */
33 #include "breakpoint.h"
34
35 /* For struct frame_id. */
36 #include "frame.h"
37
38 struct thread_info
39 {
40 struct thread_info *next;
41 ptid_t ptid; /* "Actual process id";
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;
47 struct breakpoint *step_resume_breakpoint;
48 CORE_ADDR step_range_start;
49 CORE_ADDR step_range_end;
50 struct frame_id step_frame_id;
51 CORE_ADDR step_sp;
52 int current_line;
53 struct symtab *current_symtab;
54 int trap_expected;
55 int handling_longjmp;
56 int another_trap;
57
58 /* This is set TRUE when a catchpoint of a shared library event
59 triggers. Since we don't wish to leave the inferior in the
60 solib hook when we report the event, we step the inferior
61 back to user code before stopping and reporting the event. */
62 int stepping_through_solib_after_catch;
63
64 /* When stepping_through_solib_after_catch is TRUE, this is a
65 list of the catchpoints that should be reported as triggering
66 when we finally do stop stepping. */
67 bpstat stepping_through_solib_catchpoints;
68
69 /* This is set to TRUE when this thread is in a signal handler
70 trampoline and we're single-stepping through it. */
71 int stepping_through_sigtramp;
72
73 /* Private data used by the target vector implementation. */
74 struct private_thread_info *private;
75 };
76
77 /* Create an empty thread list, or empty the existing one. */
78 extern void init_thread_list (void);
79
80 /* Add a thread to the thread list.
81 Note that add_thread now returns the handle of the new thread,
82 so that the caller may initialize the private thread data. */
83 extern struct thread_info *add_thread (ptid_t ptid);
84
85 /* Delete an existing thread list entry. */
86 extern void delete_thread (ptid_t);
87
88 /* Delete a step_resume_breakpoint from the thread database. */
89 extern void delete_step_resume_breakpoint (void *);
90
91 /* Translate the integer thread id (GDB's homegrown id, not the system's)
92 into a "pid" (which may be overloaded with extra thread information). */
93 extern ptid_t thread_id_to_pid (int);
94
95 /* Translate a 'pid' (which may be overloaded with extra thread information)
96 into the integer thread id (GDB's homegrown id, not the system's). */
97 extern int pid_to_thread_id (ptid_t ptid);
98
99 /* Boolean test for an already-known pid (which may be overloaded with
100 extra thread information). */
101 extern int in_thread_list (ptid_t ptid);
102
103 /* Boolean test for an already-known thread id (GDB's homegrown id,
104 not the system's). */
105 extern int valid_thread_id (int thread);
106
107 /* Search function to lookup a thread by 'pid'. */
108 extern struct thread_info *find_thread_pid (ptid_t ptid);
109
110 /* Iterator function to call a user-provided callback function
111 once for each known thread. */
112 typedef int (*thread_callback_func) (struct thread_info *, void *);
113 extern struct thread_info *iterate_over_threads (thread_callback_func, void *);
114
115 /* infrun context switch: save the debugger state for the given thread. */
116 extern void save_infrun_state (ptid_t ptid,
117 CORE_ADDR prev_pc,
118 int trap_expected,
119 struct breakpoint *step_resume_breakpoint,
120 CORE_ADDR step_range_start,
121 CORE_ADDR step_range_end,
122 const struct frame_id *step_frame_id,
123 int handling_longjmp,
124 int another_trap,
125 int stepping_through_solib_after_catch,
126 bpstat stepping_through_solib_catchpoints,
127 int stepping_through_sigtramp,
128 int current_line,
129 struct symtab *current_symtab,
130 CORE_ADDR step_sp);
131
132 /* infrun context switch: load the debugger state previously saved
133 for the given thread. */
134 extern void load_infrun_state (ptid_t ptid,
135 CORE_ADDR *prev_pc,
136 int *trap_expected,
137 struct breakpoint **step_resume_breakpoint,
138 CORE_ADDR *step_range_start,
139 CORE_ADDR *step_range_end,
140 struct frame_id *step_frame_id,
141 int *handling_longjmp,
142 int *another_trap,
143 int *stepping_through_solib_affter_catch,
144 bpstat *stepping_through_solib_catchpoints,
145 int *stepping_through_sigtramp,
146 int *current_line,
147 struct symtab **current_symtab,
148 CORE_ADDR *step_sp);
149
150 /* Commands with a prefix of `thread'. */
151 extern struct cmd_list_element *thread_cmd_list;
152
153 #endif /* GDBTHREAD_H */
This page took 0.034257 seconds and 5 git commands to generate.