xref: /freebsd/contrib/llvm-project/openmp/runtime/src/kmp_debugger.h (revision 0a36787e4c1fa0cf77dcf83be0867178476e372b)
1 #if USE_DEBUGGER
2 /*
3  * kmp_debugger.h -- debugger support.
4  */
5 
6 //===----------------------------------------------------------------------===//
7 //
8 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
9 // See https://llvm.org/LICENSE.txt for license information.
10 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef KMP_DEBUGGER_H
15 #define KMP_DEBUGGER_H
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif // __cplusplus
20 
21 /* This external variable can be set by any debugger to flag to the runtime
22    that we are currently executing inside a debugger.  This will allow the
23    debugger to override the number of threads spawned in a parallel region by
24    using __kmp_omp_num_threads() (below).
25    * When __kmp_debugging is TRUE, each team and each task gets a unique integer
26    identifier that can be used by debugger to conveniently identify teams and
27    tasks.
28    * The debugger has access to __kmp_omp_debug_struct_info which contains
29    information about the OpenMP library's important internal structures.  This
30    access will allow the debugger to read detailed information from the typical
31    OpenMP constructs (teams, threads, tasking, etc. ) during a debugging
32    session and offer detailed and useful information which the user can probe
33    about the OpenMP portion of their code. */
34 extern int __kmp_debugging; /* Boolean whether currently debugging OpenMP RTL */
35 // Return number of threads specified by the debugger for given parallel region.
36 /* The ident field, which represents a source file location, is used to check if
37    the debugger has changed the number of threads for the parallel region at
38    source file location ident.  This way, specific parallel regions' number of
39    threads can be changed at the debugger's request. */
40 int __kmp_omp_num_threads(ident_t const *ident);
41 
42 #ifdef __cplusplus
43 } // extern "C"
44 #endif // __cplusplus
45 
46 #endif // KMP_DEBUGGER_H
47 
48 #endif // USE_DEBUGGER
49