Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 1 | #if USE_DEBUGGER |
| 2 | /* |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 3 | * kmp_debugger.cpp -- debugger support. |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 4 | */ |
| 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 | |
| 17 | #include "kmp.h" |
| 18 | #include "kmp_lock.h" |
| 19 | #include "kmp_omp.h" |
| 20 | #include "kmp_str.h" |
| 21 | |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 22 | // NOTE: All variable names are known to the debugger, do not change! |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 23 | |
| 24 | #ifdef __cplusplus |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 25 | extern "C" { |
| 26 | extern kmp_omp_struct_info_t __kmp_omp_debug_struct_info; |
| 27 | } // extern "C" |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 28 | #endif // __cplusplus |
| 29 | |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 30 | int __kmp_debugging = FALSE; // Boolean whether currently debugging OpenMP RTL. |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 31 | |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 32 | #define offset_and_size_of(structure, field) \ |
| 33 | { offsetof(structure, field), sizeof(((structure *)NULL)->field) } |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 34 | |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 35 | #define offset_and_size_not_available \ |
| 36 | { -1, -1 } |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 37 | |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 38 | #define addr_and_size_of(var) \ |
| 39 | { (kmp_uint64)(&var), sizeof(var) } |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 40 | |
| 41 | #define nthr_buffer_size 1024 |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 42 | static kmp_int32 kmp_omp_nthr_info_buffer[nthr_buffer_size] = { |
| 43 | nthr_buffer_size * sizeof(kmp_int32)}; |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 44 | |
| 45 | /* TODO: Check punctuation for various platforms here */ |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 46 | static char func_microtask[] = "__kmp_invoke_microtask"; |
| 47 | static char func_fork[] = "__kmpc_fork_call"; |
| 48 | static char func_fork_teams[] = "__kmpc_fork_teams"; |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 49 | |
| 50 | // Various info about runtime structures: addresses, field offsets, sizes, etc. |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 51 | kmp_omp_struct_info_t __kmp_omp_debug_struct_info = { |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 52 | |
| 53 | /* Change this only if you make a fundamental data structure change here */ |
| 54 | KMP_OMP_VERSION, |
| 55 | |
| 56 | /* sanity check. Only should be checked if versions are identical |
| 57 | * This is also used for backward compatibility to get the runtime |
| 58 | * structure size if it the runtime is older than the interface */ |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 59 | sizeof(kmp_omp_struct_info_t), |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 60 | |
| 61 | /* OpenMP RTL version info. */ |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 62 | addr_and_size_of(__kmp_version_major), |
| 63 | addr_and_size_of(__kmp_version_minor), |
| 64 | addr_and_size_of(__kmp_version_build), |
| 65 | addr_and_size_of(__kmp_openmp_version), |
| 66 | {(kmp_uint64)(__kmp_copyright) + KMP_VERSION_MAGIC_LEN, |
| 67 | 0}, // Skip magic prefix. |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 68 | |
| 69 | /* Various globals. */ |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 70 | addr_and_size_of(__kmp_threads), |
| 71 | addr_and_size_of(__kmp_root), |
| 72 | addr_and_size_of(__kmp_threads_capacity), |
| 73 | addr_and_size_of(__kmp_monitor), |
| 74 | #if !KMP_USE_DYNAMIC_LOCK |
| 75 | addr_and_size_of(__kmp_user_lock_table), |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 76 | #endif |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 77 | addr_and_size_of(func_microtask), |
| 78 | addr_and_size_of(func_fork), |
| 79 | addr_and_size_of(func_fork_teams), |
| 80 | addr_and_size_of(__kmp_team_counter), |
| 81 | addr_and_size_of(__kmp_task_counter), |
| 82 | addr_and_size_of(kmp_omp_nthr_info_buffer), |
| 83 | sizeof(void *), |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 84 | OMP_LOCK_T_SIZE < sizeof(void *), |
| 85 | bs_last_barrier, |
Jonathan Peyton | f4f9695 | 2016-05-31 19:07:00 +0000 | [diff] [blame] | 86 | INITIAL_TASK_DEQUE_SIZE, |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 87 | |
| 88 | // thread structure information |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 89 | sizeof(kmp_base_info_t), |
| 90 | offset_and_size_of(kmp_base_info_t, th_info), |
| 91 | offset_and_size_of(kmp_base_info_t, th_team), |
| 92 | offset_and_size_of(kmp_base_info_t, th_root), |
| 93 | offset_and_size_of(kmp_base_info_t, th_serial_team), |
| 94 | offset_and_size_of(kmp_base_info_t, th_ident), |
| 95 | offset_and_size_of(kmp_base_info_t, th_spin_here), |
| 96 | offset_and_size_of(kmp_base_info_t, th_next_waiting), |
| 97 | offset_and_size_of(kmp_base_info_t, th_task_team), |
| 98 | offset_and_size_of(kmp_base_info_t, th_current_task), |
| 99 | offset_and_size_of(kmp_base_info_t, th_task_state), |
| 100 | offset_and_size_of(kmp_base_info_t, th_bar), |
| 101 | offset_and_size_of(kmp_bstate_t, b_worker_arrived), |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 102 | |
Jonathan Peyton | 441f337 | 2015-09-21 17:24:46 +0000 | [diff] [blame] | 103 | #if OMP_40_ENABLED |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 104 | // teams information |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 105 | offset_and_size_of(kmp_base_info_t, th_teams_microtask), |
| 106 | offset_and_size_of(kmp_base_info_t, th_teams_level), |
| 107 | offset_and_size_of(kmp_teams_size_t, nteams), |
| 108 | offset_and_size_of(kmp_teams_size_t, nth), |
Jonathan Peyton | 441f337 | 2015-09-21 17:24:46 +0000 | [diff] [blame] | 109 | #endif |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 110 | |
| 111 | // kmp_desc structure (for info field above) |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 112 | sizeof(kmp_desc_base_t), |
| 113 | offset_and_size_of(kmp_desc_base_t, ds_tid), |
| 114 | offset_and_size_of(kmp_desc_base_t, ds_gtid), |
| 115 | // On Windows* OS, ds_thread contains a thread /handle/, which is not usable, |
| 116 | // while thread /id/ is in ds_thread_id. |
| 117 | #if KMP_OS_WINDOWS |
| 118 | offset_and_size_of(kmp_desc_base_t, ds_thread_id), |
| 119 | #else |
| 120 | offset_and_size_of(kmp_desc_base_t, ds_thread), |
| 121 | #endif |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 122 | |
| 123 | // team structure information |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 124 | sizeof(kmp_base_team_t), |
| 125 | offset_and_size_of(kmp_base_team_t, t_master_tid), |
| 126 | offset_and_size_of(kmp_base_team_t, t_ident), |
| 127 | offset_and_size_of(kmp_base_team_t, t_parent), |
| 128 | offset_and_size_of(kmp_base_team_t, t_nproc), |
| 129 | offset_and_size_of(kmp_base_team_t, t_threads), |
| 130 | offset_and_size_of(kmp_base_team_t, t_serialized), |
| 131 | offset_and_size_of(kmp_base_team_t, t_id), |
| 132 | offset_and_size_of(kmp_base_team_t, t_pkfn), |
| 133 | offset_and_size_of(kmp_base_team_t, t_task_team), |
| 134 | offset_and_size_of(kmp_base_team_t, t_implicit_task_taskdata), |
Jonathan Peyton | 441f337 | 2015-09-21 17:24:46 +0000 | [diff] [blame] | 135 | #if OMP_40_ENABLED |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 136 | offset_and_size_of(kmp_base_team_t, t_cancel_request), |
Jonathan Peyton | 441f337 | 2015-09-21 17:24:46 +0000 | [diff] [blame] | 137 | #endif |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 138 | offset_and_size_of(kmp_base_team_t, t_bar), |
| 139 | offset_and_size_of(kmp_balign_team_t, b_master_arrived), |
| 140 | offset_and_size_of(kmp_balign_team_t, b_team_arrived), |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 141 | |
| 142 | // root structure information |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 143 | sizeof(kmp_base_root_t), |
| 144 | offset_and_size_of(kmp_base_root_t, r_root_team), |
| 145 | offset_and_size_of(kmp_base_root_t, r_hot_team), |
| 146 | offset_and_size_of(kmp_base_root_t, r_uber_thread), |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 147 | offset_and_size_not_available, |
| 148 | |
| 149 | // ident structure information |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 150 | sizeof(ident_t), |
| 151 | offset_and_size_of(ident_t, psource), |
| 152 | offset_and_size_of(ident_t, flags), |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 153 | |
| 154 | // lock structure information |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 155 | sizeof(kmp_base_queuing_lock_t), |
| 156 | offset_and_size_of(kmp_base_queuing_lock_t, initialized), |
| 157 | offset_and_size_of(kmp_base_queuing_lock_t, location), |
| 158 | offset_and_size_of(kmp_base_queuing_lock_t, tail_id), |
| 159 | offset_and_size_of(kmp_base_queuing_lock_t, head_id), |
| 160 | offset_and_size_of(kmp_base_queuing_lock_t, next_ticket), |
| 161 | offset_and_size_of(kmp_base_queuing_lock_t, now_serving), |
| 162 | offset_and_size_of(kmp_base_queuing_lock_t, owner_id), |
| 163 | offset_and_size_of(kmp_base_queuing_lock_t, depth_locked), |
| 164 | offset_and_size_of(kmp_base_queuing_lock_t, flags), |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 165 | |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 166 | #if !KMP_USE_DYNAMIC_LOCK |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 167 | /* Lock table. */ |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 168 | sizeof(kmp_lock_table_t), |
| 169 | offset_and_size_of(kmp_lock_table_t, used), |
| 170 | offset_and_size_of(kmp_lock_table_t, allocated), |
| 171 | offset_and_size_of(kmp_lock_table_t, table), |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 172 | #endif |
| 173 | |
| 174 | // Task team structure information. |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 175 | sizeof(kmp_base_task_team_t), |
| 176 | offset_and_size_of(kmp_base_task_team_t, tt_threads_data), |
| 177 | offset_and_size_of(kmp_base_task_team_t, tt_found_tasks), |
| 178 | offset_and_size_of(kmp_base_task_team_t, tt_nproc), |
| 179 | offset_and_size_of(kmp_base_task_team_t, tt_unfinished_threads), |
| 180 | offset_and_size_of(kmp_base_task_team_t, tt_active), |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 181 | |
| 182 | // task_data_t. |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 183 | sizeof(kmp_taskdata_t), |
| 184 | offset_and_size_of(kmp_taskdata_t, td_task_id), |
| 185 | offset_and_size_of(kmp_taskdata_t, td_flags), |
| 186 | offset_and_size_of(kmp_taskdata_t, td_team), |
| 187 | offset_and_size_of(kmp_taskdata_t, td_parent), |
| 188 | offset_and_size_of(kmp_taskdata_t, td_level), |
| 189 | offset_and_size_of(kmp_taskdata_t, td_ident), |
| 190 | offset_and_size_of(kmp_taskdata_t, td_allocated_child_tasks), |
| 191 | offset_and_size_of(kmp_taskdata_t, td_incomplete_child_tasks), |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 192 | |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 193 | offset_and_size_of(kmp_taskdata_t, td_taskwait_ident), |
| 194 | offset_and_size_of(kmp_taskdata_t, td_taskwait_counter), |
| 195 | offset_and_size_of(kmp_taskdata_t, td_taskwait_thread), |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 196 | |
Jonathan Peyton | 441f337 | 2015-09-21 17:24:46 +0000 | [diff] [blame] | 197 | #if OMP_40_ENABLED |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 198 | offset_and_size_of(kmp_taskdata_t, td_taskgroup), |
| 199 | offset_and_size_of(kmp_taskgroup_t, count), |
| 200 | offset_and_size_of(kmp_taskgroup_t, cancel_request), |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 201 | |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 202 | offset_and_size_of(kmp_taskdata_t, td_depnode), |
| 203 | offset_and_size_of(kmp_depnode_list_t, node), |
| 204 | offset_and_size_of(kmp_depnode_list_t, next), |
| 205 | offset_and_size_of(kmp_base_depnode_t, successors), |
| 206 | offset_and_size_of(kmp_base_depnode_t, task), |
| 207 | offset_and_size_of(kmp_base_depnode_t, npredecessors), |
| 208 | offset_and_size_of(kmp_base_depnode_t, nrefs), |
Jonathan Peyton | 441f337 | 2015-09-21 17:24:46 +0000 | [diff] [blame] | 209 | #endif |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 210 | offset_and_size_of(kmp_task_t, routine), |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 211 | |
| 212 | // thread_data_t. |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 213 | sizeof(kmp_thread_data_t), |
| 214 | offset_and_size_of(kmp_base_thread_data_t, td_deque), |
| 215 | offset_and_size_of(kmp_base_thread_data_t, td_deque_size), |
| 216 | offset_and_size_of(kmp_base_thread_data_t, td_deque_head), |
| 217 | offset_and_size_of(kmp_base_thread_data_t, td_deque_tail), |
| 218 | offset_and_size_of(kmp_base_thread_data_t, td_deque_ntasks), |
| 219 | offset_and_size_of(kmp_base_thread_data_t, td_deque_last_stolen), |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 220 | |
| 221 | // The last field. |
| 222 | KMP_OMP_VERSION, |
| 223 | |
| 224 | }; // __kmp_omp_debug_struct_info |
| 225 | |
| 226 | #undef offset_and_size_of |
| 227 | #undef addr_and_size_of |
| 228 | |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 229 | /* Intel compiler on IA-32 architecture issues a warning "conversion |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 230 | from "unsigned long long" to "char *" may lose significant bits" |
| 231 | when 64-bit value is assigned to 32-bit pointer. Use this function |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 232 | to suppress the warning. */ |
| 233 | static inline void *__kmp_convert_to_ptr(kmp_uint64 addr) { |
| 234 | #if KMP_COMPILER_ICC |
| 235 | #pragma warning(push) |
| 236 | #pragma warning(disable : 810) // conversion from "unsigned long long" to "char |
| 237 | // *" may lose significant bits |
| 238 | #pragma warning(disable : 1195) // conversion from integer to smaller pointer |
| 239 | #endif // KMP_COMPILER_ICC |
| 240 | return (void *)addr; |
| 241 | #if KMP_COMPILER_ICC |
| 242 | #pragma warning(pop) |
| 243 | #endif // KMP_COMPILER_ICC |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 244 | } // __kmp_convert_to_ptr |
| 245 | |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 246 | static int kmp_location_match(kmp_str_loc_t *loc, kmp_omp_nthr_item_t *item) { |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 247 | |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 248 | int file_match = 0; |
| 249 | int func_match = 0; |
| 250 | int line_match = 0; |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 251 | |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 252 | char *file = (char *)__kmp_convert_to_ptr(item->file); |
| 253 | char *func = (char *)__kmp_convert_to_ptr(item->func); |
| 254 | file_match = __kmp_str_fname_match(&loc->fname, file); |
| 255 | func_match = |
| 256 | item->func == 0 // If item->func is NULL, it allows any func name. |
| 257 | || strcmp(func, "*") == 0 || |
| 258 | (loc->func != NULL && strcmp(loc->func, func) == 0); |
| 259 | line_match = |
| 260 | item->begin <= loc->line && |
| 261 | (item->end <= 0 || |
| 262 | loc->line <= item->end); // if item->end <= 0, it means "end of file". |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 263 | |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 264 | return (file_match && func_match && line_match); |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 265 | |
| 266 | } // kmp_location_match |
| 267 | |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 268 | int __kmp_omp_num_threads(ident_t const *ident) { |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 269 | |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 270 | int num_threads = 0; |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 271 | |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 272 | kmp_omp_nthr_info_t *info = (kmp_omp_nthr_info_t *)__kmp_convert_to_ptr( |
| 273 | __kmp_omp_debug_struct_info.nthr_info.addr); |
| 274 | if (info->num > 0 && info->array != 0) { |
| 275 | kmp_omp_nthr_item_t *items = |
| 276 | (kmp_omp_nthr_item_t *)__kmp_convert_to_ptr(info->array); |
| 277 | kmp_str_loc_t loc = __kmp_str_loc_init(ident->psource, 1); |
| 278 | int i; |
| 279 | for (i = 0; i < info->num; ++i) { |
| 280 | if (kmp_location_match(&loc, &items[i])) { |
| 281 | num_threads = items[i].num_threads; |
| 282 | }; // if |
| 283 | }; // for |
| 284 | __kmp_str_loc_free(&loc); |
| 285 | }; // if |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 286 | |
Jonathan Peyton | 3041982 | 2017-05-12 18:01:32 +0000 | [diff] [blame] | 287 | return num_threads; |
| 288 | ; |
Jonathan Peyton | 8fbb49a | 2015-07-09 18:16:58 +0000 | [diff] [blame] | 289 | |
| 290 | } // __kmp_omp_num_threads |
| 291 | #endif /* USE_DEBUGGER */ |