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