]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/gdbserver/gdbthread.h
8290ec18795d889580acc9b8be0fa28675e53f8a
[thirdparty/binutils-gdb.git] / gdb / gdbserver / gdbthread.h
1 /* Multi-thread control defs for remote server for GDB.
2 Copyright (C) 1993-2014 Free Software Foundation, Inc.
3
4 This file is part of GDB.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
18
19 #ifndef GDB_THREAD_H
20 #define GDB_THREAD_H
21
22 #include "inferiors.h"
23
24 struct btrace_target_info;
25
26 struct thread_info
27 {
28 /* This must appear first. See inferiors.h.
29 The list iterator functions assume it. */
30 struct inferior_list_entry entry;
31
32 void *target_data;
33 void *regcache_data;
34
35 /* The last resume GDB requested on this thread. */
36 enum resume_kind last_resume_kind;
37
38 /* The last wait status reported for this thread. */
39 struct target_waitstatus last_status;
40
41 /* True if LAST_STATUS hasn't been reported to GDB yet. */
42 int status_pending_p;
43
44 /* Given `while-stepping', a thread may be collecting data for more
45 than one tracepoint simultaneously. E.g.:
46
47 ff0001 INSN1 <-- TP1, while-stepping 10 collect $regs
48 ff0002 INSN2
49 ff0003 INSN3 <-- TP2, collect $regs
50 ff0004 INSN4 <-- TP3, while-stepping 10 collect $regs
51 ff0005 INSN5
52
53 Notice that when instruction INSN5 is reached, the while-stepping
54 actions of both TP1 and TP3 are still being collected, and that TP2
55 had been collected meanwhile. The whole range of ff0001-ff0005
56 should be single-stepped, due to at least TP1's while-stepping
57 action covering the whole range.
58
59 On the other hand, the same tracepoint with a while-stepping action
60 may be hit by more than one thread simultaneously, hence we can't
61 keep the current step count in the tracepoint itself.
62
63 This is the head of the list of the states of `while-stepping'
64 tracepoint actions this thread is now collecting; NULL if empty.
65 Each item in the list holds the current step of the while-stepping
66 action. */
67 struct wstep_state *while_stepping;
68
69 /* Branch trace target information for this thread. */
70 struct btrace_target_info *btrace;
71 };
72
73 extern struct inferior_list all_threads;
74
75 void remove_thread (struct thread_info *thread);
76 struct thread_info *add_thread (ptid_t ptid, void *target_data);
77
78 struct thread_info *get_first_thread (void);
79
80 struct thread_info *find_thread_ptid (ptid_t ptid);
81
82 /* Get current thread ID (Linux task ID). */
83 #define current_ptid (current_thread->entry.id)
84
85 #endif /* GDB_THREAD_H */