Commit | Line | Data |
---|---|---|
623b6bdf | 1 | /* Multi-thread control defs for remote server for GDB. |
28e7fd62 | 2 | Copyright (C) 1993-2013 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 | ||
22 | #include "server.h" | |
23 | ||
9accd112 MM |
24 | struct btrace_target_info; |
25 | ||
623b6bdf YQ |
26 | struct thread_info |
27 | { | |
28 | struct inferior_list_entry entry; | |
29 | void *target_data; | |
30 | void *regcache_data; | |
31 | ||
32 | /* The last resume GDB requested on this thread. */ | |
33 | enum resume_kind last_resume_kind; | |
34 | ||
35 | /* The last wait status reported for this thread. */ | |
36 | struct target_waitstatus last_status; | |
37 | ||
38 | /* Given `while-stepping', a thread may be collecting data for more | |
39 | than one tracepoint simultaneously. E.g.: | |
40 | ||
41 | ff0001 INSN1 <-- TP1, while-stepping 10 collect $regs | |
42 | ff0002 INSN2 | |
43 | ff0003 INSN3 <-- TP2, collect $regs | |
44 | ff0004 INSN4 <-- TP3, while-stepping 10 collect $regs | |
45 | ff0005 INSN5 | |
46 | ||
47 | Notice that when instruction INSN5 is reached, the while-stepping | |
48 | actions of both TP1 and TP3 are still being collected, and that TP2 | |
49 | had been collected meanwhile. The whole range of ff0001-ff0005 | |
50 | should be single-stepped, due to at least TP1's while-stepping | |
51 | action covering the whole range. | |
52 | ||
53 | On the other hand, the same tracepoint with a while-stepping action | |
54 | may be hit by more than one thread simultaneously, hence we can't | |
55 | keep the current step count in the tracepoint itself. | |
56 | ||
57 | This is the head of the list of the states of `while-stepping' | |
58 | tracepoint actions this thread is now collecting; NULL if empty. | |
59 | Each item in the list holds the current step of the while-stepping | |
60 | action. */ | |
61 | struct wstep_state *while_stepping; | |
9accd112 MM |
62 | |
63 | /* Branch trace target information for this thread. */ | |
64 | struct btrace_target_info *btrace; | |
623b6bdf YQ |
65 | }; |
66 | ||
67 | extern struct inferior_list all_threads; | |
68 | ||
69 | void remove_thread (struct thread_info *thread); | |
70 | void add_thread (ptid_t ptid, void *target_data); | |
71 | ||
72 | struct thread_info *find_thread_ptid (ptid_t ptid); | |
73 | struct thread_info *gdb_id_to_thread (unsigned int); | |
74 | ||
fbd5db48 YQ |
75 | /* Get current thread ID (Linux task ID). */ |
76 | #define current_ptid ((struct inferior_list_entry *) current_inferior)->id | |
623b6bdf | 77 | #endif /* GDB_THREAD_H */ |