1 #if USE_DEBUGGER
2 /*
3  * kmp_omp.h -- OpenMP definition for kmp_omp_struct_info_t.
4  *              This is for information about runtime library structures.
5  */
6 
7 //===----------------------------------------------------------------------===//
8 //
9 //                     The LLVM Compiler Infrastructure
10 //
11 // This file is dual licensed under the MIT and the University of Illinois Open
12 // Source Licenses. See LICENSE.txt for details.
13 //
14 //===----------------------------------------------------------------------===//
15 
16 /* THIS FILE SHOULD NOT BE MODIFIED IN IDB INTERFACE LIBRARY CODE
17    It should instead be modified in the OpenMP runtime and copied to the
18    interface library code.  This way we can minimize the problems that this is
19    sure to cause having two copies of the same file.
20 
21    Files live in libomp and libomp_db/src/include  */
22 
23 /* CHANGE THIS WHEN STRUCTURES BELOW CHANGE
24    Before we release this to a customer, please don't change this value.  After
25    it is released and stable, then any new updates to the structures or data
26    structure traversal algorithms need to change this value. */
27 #define KMP_OMP_VERSION 9
28 
29 typedef struct {
30   kmp_int32 offset;
31   kmp_int32 size;
32 } offset_and_size_t;
33 
34 typedef struct {
35   kmp_uint64 addr;
36   kmp_int32 size;
37   kmp_int32 padding;
38 } addr_and_size_t;
39 
40 typedef struct {
41   kmp_uint64 flags; // Flags for future extensions.
42   kmp_uint64
43       file; // Pointer to name of source file where the parallel region is.
44   kmp_uint64 func; // Pointer to name of routine where the parallel region is.
45   kmp_int32 begin; // Beginning of source line range.
46   kmp_int32 end; // End of source line range.
47   kmp_int32 num_threads; // Specified number of threads.
48 } kmp_omp_nthr_item_t;
49 
50 typedef struct {
51   kmp_int32 num; // Number of items in the arrray.
52   kmp_uint64 array; // Address of array of kmp_omp_num_threads_item_t.
53 } kmp_omp_nthr_info_t;
54 
55 /* This structure is known to the idb interface library */
56 typedef struct {
57 
58   /* Change this only if you make a fundamental data structure change here */
59   kmp_int32 lib_version;
60 
61   /* sanity check.  Only should be checked if versions are identical
62    * This is also used for backward compatibility to get the runtime
63    * structure size if it the runtime is older than the interface */
64   kmp_int32 sizeof_this_structure;
65 
66   /* OpenMP RTL version info. */
67   addr_and_size_t major;
68   addr_and_size_t minor;
69   addr_and_size_t build;
70   addr_and_size_t openmp_version;
71   addr_and_size_t banner;
72 
73   /* Various globals. */
74   addr_and_size_t threads; // Pointer to __kmp_threads.
75   addr_and_size_t roots; // Pointer to __kmp_root.
76   addr_and_size_t capacity; // Pointer to __kmp_threads_capacity.
77   addr_and_size_t monitor; // Pointer to __kmp_monitor.
78 #if !KMP_USE_DYNAMIC_LOCK
79   addr_and_size_t lock_table; // Pointer to __kmp_lock_table.
80 #endif
81   addr_and_size_t func_microtask;
82   addr_and_size_t func_fork;
83   addr_and_size_t func_fork_teams;
84   addr_and_size_t team_counter;
85   addr_and_size_t task_counter;
86   addr_and_size_t nthr_info;
87   kmp_int32 address_width;
88   kmp_int32 indexed_locks;
89   kmp_int32 last_barrier; // The end in enum barrier_type
90   kmp_int32 deque_size; // TASK_DEQUE_SIZE
91 
92   /* thread structure information. */
93   kmp_int32 th_sizeof_struct;
94   offset_and_size_t th_info; // descriptor for thread
95   offset_and_size_t th_team; // team for this thread
96   offset_and_size_t th_root; // root for this thread
97   offset_and_size_t th_serial_team; // serial team under this thread
98   offset_and_size_t th_ident; // location for this thread (if available)
99   offset_and_size_t th_spin_here; // is thread waiting for lock (if available)
100   offset_and_size_t
101       th_next_waiting; // next thread waiting for lock (if available)
102   offset_and_size_t th_task_team; // task team struct
103   offset_and_size_t th_current_task; // innermost task being executed
104   offset_and_size_t
105       th_task_state; // alternating 0/1 for task team identification
106   offset_and_size_t th_bar;
107   offset_and_size_t th_b_worker_arrived; // the worker increases it by 1 when it
108 // arrives to the barrier
109 
110 #if OMP_40_ENABLED
111   /* teams information */
112   offset_and_size_t th_teams_microtask; // entry address for teams construct
113   offset_and_size_t th_teams_level; // initial level of teams construct
114   offset_and_size_t th_teams_nteams; // number of teams in a league
115   offset_and_size_t
116       th_teams_nth; // number of threads in each team of the league
117 #endif
118 
119   /* kmp_desc structure (for info field above) */
120   kmp_int32 ds_sizeof_struct;
121   offset_and_size_t ds_tid; // team thread id
122   offset_and_size_t ds_gtid; // global thread id
123   offset_and_size_t ds_thread; // native thread id
124 
125   /* team structure information */
126   kmp_int32 t_sizeof_struct;
127   offset_and_size_t t_master_tid; // tid of master in parent team
128   offset_and_size_t t_ident; // location of parallel region
129   offset_and_size_t t_parent; // parent team
130   offset_and_size_t t_nproc; // # team threads
131   offset_and_size_t t_threads; // array of threads
132   offset_and_size_t t_serialized; // # levels of serialized teams
133   offset_and_size_t t_id; // unique team id
134   offset_and_size_t t_pkfn;
135   offset_and_size_t t_task_team; // task team structure
136   offset_and_size_t t_implicit_task; // taskdata for the thread's implicit task
137 #if OMP_40_ENABLED
138   offset_and_size_t t_cancel_request;
139 #endif
140   offset_and_size_t t_bar;
141   offset_and_size_t
142       t_b_master_arrived; // increased by 1 when master arrives to a barrier
143   offset_and_size_t
144       t_b_team_arrived; // increased by one when all the threads arrived
145 
146   /* root structure information */
147   kmp_int32 r_sizeof_struct;
148   offset_and_size_t r_root_team; // team at root
149   offset_and_size_t r_hot_team; // hot team for this root
150   offset_and_size_t r_uber_thread; // root thread
151   offset_and_size_t r_root_id; // unique root id (if available)
152 
153   /* ident structure information */
154   kmp_int32 id_sizeof_struct;
155   offset_and_size_t
156       id_psource; /* address of string ";file;func;line1;line2;;". */
157   offset_and_size_t id_flags;
158 
159   /* lock structure information */
160   kmp_int32 lk_sizeof_struct;
161   offset_and_size_t lk_initialized;
162   offset_and_size_t lk_location;
163   offset_and_size_t lk_tail_id;
164   offset_and_size_t lk_head_id;
165   offset_and_size_t lk_next_ticket;
166   offset_and_size_t lk_now_serving;
167   offset_and_size_t lk_owner_id;
168   offset_and_size_t lk_depth_locked;
169   offset_and_size_t lk_lock_flags;
170 
171 #if !KMP_USE_DYNAMIC_LOCK
172   /* lock_table_t */
173   kmp_int32 lt_size_of_struct; /* Size and layout of kmp_lock_table_t. */
174   offset_and_size_t lt_used;
175   offset_and_size_t lt_allocated;
176   offset_and_size_t lt_table;
177 #endif
178 
179   /* task_team_t */
180   kmp_int32 tt_sizeof_struct;
181   offset_and_size_t tt_threads_data;
182   offset_and_size_t tt_found_tasks;
183   offset_and_size_t tt_nproc;
184   offset_and_size_t tt_unfinished_threads;
185   offset_and_size_t tt_active;
186 
187   /* kmp_taskdata_t */
188   kmp_int32 td_sizeof_struct;
189   offset_and_size_t td_task_id; // task id
190   offset_and_size_t td_flags; // task flags
191   offset_and_size_t td_team; // team for this task
192   offset_and_size_t td_parent; // parent task
193   offset_and_size_t td_level; // task testing level
194   offset_and_size_t td_ident; // task identifier
195   offset_and_size_t td_allocated_child_tasks; // child tasks (+ current task)
196   // not yet deallocated
197   offset_and_size_t td_incomplete_child_tasks; // child tasks not yet complete
198 
199   /* Taskwait */
200   offset_and_size_t td_taskwait_ident;
201   offset_and_size_t td_taskwait_counter;
202   offset_and_size_t
203       td_taskwait_thread; // gtid + 1 of thread encountered taskwait
204 
205 #if OMP_40_ENABLED
206   /* Taskgroup */
207   offset_and_size_t td_taskgroup; // pointer to the current taskgroup
208   offset_and_size_t
209       td_task_count; // number of allocated and not yet complete tasks
210   offset_and_size_t td_cancel; // request for cancellation of this taskgroup
211 
212   /* Task dependency */
213   offset_and_size_t
214       td_depnode; // pointer to graph node if the task has dependencies
215   offset_and_size_t dn_node;
216   offset_and_size_t dn_next;
217   offset_and_size_t dn_successors;
218   offset_and_size_t dn_task;
219   offset_and_size_t dn_npredecessors;
220   offset_and_size_t dn_nrefs;
221 #endif
222   offset_and_size_t dn_routine;
223 
224   /* kmp_thread_data_t */
225   kmp_int32 hd_sizeof_struct;
226   offset_and_size_t hd_deque;
227   offset_and_size_t hd_deque_size;
228   offset_and_size_t hd_deque_head;
229   offset_and_size_t hd_deque_tail;
230   offset_and_size_t hd_deque_ntasks;
231   offset_and_size_t hd_deque_last_stolen;
232 
233   // The last field of stable version.
234   kmp_uint64 last_field;
235 
236 } kmp_omp_struct_info_t;
237 
238 #endif /* USE_DEBUGGER */
239 
240 /* end of file */
241