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