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