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