4 * Created on: Jan 14, 2015
5 * Author: Ignacio Laguna
7 * Contact: ilaguna@llnl.gov
10 //===----------------------------------------------------------------------===//
12 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
13 // See https://llvm.org/LICENSE.txt for license information.
14 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
16 //===----------------------------------------------------------------------===//
18 #ifndef SRC_OMP_DEBUG_H_
19 #define SRC_OMP_DEBUG_H_
21 #define OMPD_VERSION 201811
30 #define OMPD_IMPLEMENTS_OPENMP 5
31 #define OMPD_IMPLEMENTS_OPENMP_SUBVERSION 0
32 #define OMPD_TR_VERSION 6
33 #define OMPD_TR_SUBVERSION 2
34 #define OMPD_DLL_VERSION \
35 (OMPD_IMPLEMENTS_OPENMP << 24) + (OMPD_IMPLEMENTS_OPENMP_SUBVERSION << 16) + \
36 (OMPD_TR_VERSION << 8) + OMPD_TR_SUBVERSION
38 #define STR_HELPER(x) #x
39 #define STR(x) STR_HELPER(x)
41 #include "omp-tools.h"
42 #include "ompd-types.h"
47 /******************************************************************************
48 * General helper functions
49 ******************************************************************************/
50 ompd_rc_t
initTypeSizes(ompd_address_space_context_t
*context
);
52 // NOLINTNEXTLINE "Used in below Macro:OMPD_CALLBACK."
53 static const ompd_callbacks_t
*callbacks
= nullptr;
55 // Invoke callback function and return if it fails
56 #define OMPD_CALLBACK(fn, ...) \
58 ompd_rc_t _rc = callbacks->fn(__VA_ARGS__); \
59 if (_rc != ompd_rc_ok) \
63 // Read the memory contents located at the given symbol
64 #define OMPD_GET_VALUE(context, th_context, name, size, buf) \
66 ompd_address_t _addr; \
67 OMPD_CALLBACK(symbol_addr_lookup, context, th_context, name, &_addr, \
69 OMPD_CALLBACK(read_memory, context, th_context, &_addr, size, buf); \
72 typedef struct _ompd_aspace_cont ompd_address_space_context_t
;
74 typedef struct _ompd_aspace_handle
{
75 ompd_address_space_context_t
*context
;
78 } ompd_address_space_handle_t
;
80 typedef struct _ompd_thread_handle
{
81 ompd_address_space_handle_t
*ah
;
82 ompd_thread_context_t
*thread_context
;
83 ompd_address_t th
; /* target handle */
84 } ompd_thread_handle_t
;
86 typedef struct _ompd_parallel_handle
{
87 ompd_address_space_handle_t
*ah
;
88 ompd_address_t th
; /* target handle */
89 ompd_address_t lwt
; /* lwt handle */
90 } ompd_parallel_handle_t
;
92 typedef struct _ompd_task_handle
{
93 ompd_address_space_handle_t
*ah
;
94 ompd_address_t th
; /* target handle */
95 ompd_address_t lwt
; /* lwt handle */
98 th
.segment
= OMPD_SEGMENT_UNSPECIFIED
;
99 lwt
.segment
= OMPD_SEGMENT_UNSPECIFIED
;
103 } ompd_task_handle_t
;
105 void __ompd_init_icvs(const ompd_callbacks_t
*table
);
106 void __ompd_init_states(const ompd_callbacks_t
*table
);
108 #endif /* SRC_OMP_DEBUG_H_ */