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