]>
Commit | Line | Data |
---|---|---|
4efc6507 DE |
1 | /* JIT declarations for GDB, the GNU Debugger. |
2 | ||
b811d2c2 | 3 | Copyright (C) 2009-2020 Free Software Foundation, Inc. |
4efc6507 DE |
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 JIT_H | |
21 | #define JIT_H | |
22 | ||
32495661 | 23 | struct inferior; |
fe053b9e | 24 | struct objfile; |
238b5c9f | 25 | struct minimal_symbol; |
fe053b9e | 26 | |
1777feb0 MS |
27 | /* When the JIT breakpoint fires, the inferior wants us to take one of |
28 | these actions. These values are used by the inferior, so the | |
29 | values of these enums cannot be changed. */ | |
4efc6507 DE |
30 | |
31 | typedef enum | |
32 | { | |
33 | JIT_NOACTION = 0, | |
34 | JIT_REGISTER, | |
35 | JIT_UNREGISTER | |
36 | } jit_actions_t; | |
37 | ||
1777feb0 MS |
38 | /* This struct describes a single symbol file in a linked list of |
39 | symbol files describing generated code. As the inferior generates | |
40 | code, it adds these entries to the list, and when we attach to the | |
41 | inferior, we read them all. For the first element prev_entry | |
42 | should be NULL, and for the last element next_entry should be | |
43 | NULL. */ | |
4efc6507 DE |
44 | |
45 | struct jit_code_entry | |
46 | { | |
47 | CORE_ADDR next_entry; | |
48 | CORE_ADDR prev_entry; | |
49 | CORE_ADDR symfile_addr; | |
a255712f | 50 | ULONGEST symfile_size; |
4efc6507 DE |
51 | }; |
52 | ||
53 | /* This is the global descriptor that the inferior uses to communicate | |
1777feb0 MS |
54 | information to the debugger. To alert the debugger to take an |
55 | action, the inferior sets the action_flag to the appropriate enum | |
56 | value, updates relevant_entry to point to the relevant code entry, | |
57 | and calls the function at the well-known symbol with our | |
58 | breakpoint. We then read this descriptor from another global | |
59 | well-known symbol. */ | |
4efc6507 DE |
60 | |
61 | struct jit_descriptor | |
62 | { | |
63 | uint32_t version; | |
64 | /* This should be jit_actions_t, but we want to be specific about the | |
65 | bit-width. */ | |
66 | uint32_t action_flag; | |
67 | CORE_ADDR relevant_entry; | |
68 | CORE_ADDR first_entry; | |
69 | }; | |
70 | ||
0e74a041 SM |
71 | /* An objfile that defines the required symbols of the JIT interface has an |
72 | instance of this type attached to it. */ | |
238b5c9f | 73 | |
0e74a041 | 74 | struct jiter_objfile_data |
238b5c9f | 75 | { |
0e74a041 | 76 | ~jiter_objfile_data (); |
238b5c9f | 77 | |
238b5c9f SM |
78 | /* Symbol for __jit_debug_register_code. */ |
79 | minimal_symbol *register_code = nullptr; | |
80 | ||
81 | /* Symbol for __jit_debug_descriptor. */ | |
82 | minimal_symbol *descriptor = nullptr; | |
77208eb7 SM |
83 | |
84 | /* This is the relocated address of the __jit_debug_register_code function | |
85 | provided by this objfile. This is used to detect relocations changes | |
86 | requiring the breakpoint to be re-created. */ | |
87 | CORE_ADDR cached_code_address = 0; | |
88 | ||
89 | /* This is the JIT event breakpoint, or nullptr if it has been deleted. */ | |
90 | breakpoint *jit_breakpoint = nullptr; | |
0e74a041 SM |
91 | }; |
92 | ||
93 | /* An objfile that is the product of JIT compilation and was registered | |
94 | using the JIT interface has an instance of this type attached to it. */ | |
95 | ||
96 | struct jited_objfile_data | |
97 | { | |
98 | jited_objfile_data (CORE_ADDR addr) | |
99 | : addr (addr) | |
100 | {} | |
238b5c9f | 101 | |
0e74a041 SM |
102 | /* Address of struct jit_code_entry for this objfile. */ |
103 | CORE_ADDR addr; | |
238b5c9f SM |
104 | }; |
105 | ||
0756c555 DE |
106 | /* Re-establish the jit breakpoint(s). */ |
107 | ||
108 | extern void jit_breakpoint_re_set (void); | |
109 | ||
1777feb0 | 110 | /* This function is called by handle_inferior_event when it decides |
fe053b9e TBA |
111 | that the JIT event breakpoint has fired. JITER is the objfile |
112 | whose JIT event breakpoint has been hit. */ | |
4efc6507 | 113 | |
fe053b9e | 114 | extern void jit_event_handler (gdbarch *gdbarch, objfile *jiter); |
4efc6507 DE |
115 | |
116 | #endif /* JIT_H */ |