Commit | Line | Data |
---|---|---|
623b6bdf | 1 | /* Multi-thread control defs for remote server for GDB. |
61baf725 | 2 | Copyright (C) 1993-2017 Free Software Foundation, Inc. |
623b6bdf YQ |
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 | ||
6a6bbd9d | 22 | #include "inferiors.h" |
623b6bdf | 23 | |
9accd112 | 24 | struct btrace_target_info; |
a44892be | 25 | struct regcache; |
9accd112 | 26 | |
623b6bdf YQ |
27 | struct thread_info |
28 | { | |
80894984 DE |
29 | /* This must appear first. See inferiors.h. |
30 | The list iterator functions assume it. */ | |
623b6bdf | 31 | struct inferior_list_entry entry; |
80894984 | 32 | |
623b6bdf | 33 | void *target_data; |
a44892be | 34 | struct regcache *regcache_data; |
623b6bdf YQ |
35 | |
36 | /* The last resume GDB requested on this thread. */ | |
37 | enum resume_kind last_resume_kind; | |
38 | ||
39 | /* The last wait status reported for this thread. */ | |
40 | struct target_waitstatus last_status; | |
41 | ||
b7ea362b PA |
42 | /* True if LAST_STATUS hasn't been reported to GDB yet. */ |
43 | int status_pending_p; | |
44 | ||
623b6bdf YQ |
45 | /* Given `while-stepping', a thread may be collecting data for more |
46 | than one tracepoint simultaneously. E.g.: | |
47 | ||
48 | ff0001 INSN1 <-- TP1, while-stepping 10 collect $regs | |
49 | ff0002 INSN2 | |
50 | ff0003 INSN3 <-- TP2, collect $regs | |
51 | ff0004 INSN4 <-- TP3, while-stepping 10 collect $regs | |
52 | ff0005 INSN5 | |
53 | ||
54 | Notice that when instruction INSN5 is reached, the while-stepping | |
55 | actions of both TP1 and TP3 are still being collected, and that TP2 | |
56 | had been collected meanwhile. The whole range of ff0001-ff0005 | |
57 | should be single-stepped, due to at least TP1's while-stepping | |
58 | action covering the whole range. | |
59 | ||
60 | On the other hand, the same tracepoint with a while-stepping action | |
61 | may be hit by more than one thread simultaneously, hence we can't | |
62 | keep the current step count in the tracepoint itself. | |
63 | ||
64 | This is the head of the list of the states of `while-stepping' | |
65 | tracepoint actions this thread is now collecting; NULL if empty. | |
66 | Each item in the list holds the current step of the while-stepping | |
67 | action. */ | |
68 | struct wstep_state *while_stepping; | |
9accd112 MM |
69 | |
70 | /* Branch trace target information for this thread. */ | |
71 | struct btrace_target_info *btrace; | |
623b6bdf YQ |
72 | }; |
73 | ||
74 | extern struct inferior_list all_threads; | |
75 | ||
76 | void remove_thread (struct thread_info *thread); | |
f7667f0d | 77 | struct thread_info *add_thread (ptid_t ptid, void *target_data); |
623b6bdf | 78 | |
649ebbca DE |
79 | struct thread_info *get_first_thread (void); |
80 | ||
623b6bdf | 81 | struct thread_info *find_thread_ptid (ptid_t ptid); |
623b6bdf | 82 | |
34c65914 PA |
83 | /* Find any thread of the PID process. Returns NULL if none is |
84 | found. */ | |
85 | struct thread_info *find_any_thread_of_pid (int pid); | |
86 | ||
fbd5db48 | 87 | /* Get current thread ID (Linux task ID). */ |
0bfdf32f | 88 | #define current_ptid (current_thread->entry.id) |
f5a02773 | 89 | |
984a2c04 YQ |
90 | /* Create a cleanup to restore current_thread. */ |
91 | struct cleanup *make_cleanup_restore_current_thread (void); | |
92 | ||
623b6bdf | 93 | #endif /* GDB_THREAD_H */ |