| 1 |
/* |
| 2 |
* omp-debug.h |
| 3 |
* |
| 4 |
* Created on: Jan 14, 2015 |
| 5 |
* Author: Ignacio Laguna |
| 6 |
* Joachim Protze |
| 7 |
* Contact: [email protected] |
| 8 |
* [email protected] |
| 9 |
*/ |
| 10 |
//===----------------------------------------------------------------------===// |
| 11 |
// |
| 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 |
| 15 |
// |
| 16 |
//===----------------------------------------------------------------------===// |
| 17 |
|
| 18 |
#ifndef SRC_OMP_DEBUG_H_ |
| 19 |
#define SRC_OMP_DEBUG_H_ |
| 20 |
|
| 21 |
#define OMPD_VERSION 201811 |
| 22 |
|
| 23 |
#ifdef __cplusplus |
| 24 |
|
| 25 |
#include <cstdlib> |
| 26 |
|
| 27 |
extern "C" { |
| 28 |
#endif |
| 29 |
|
| 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 |
| 37 |
|
| 38 |
#define STR_HELPER(x) #x |
| 39 |
#define STR(x) STR_HELPER(x) |
| 40 |
|
| 41 |
#include "omp-tools.h" |
| 42 |
#include "ompd-types.h" |
| 43 |
|
| 44 |
#ifdef __cplusplus |
| 45 |
} |
| 46 |
#endif |
| 47 |
/****************************************************************************** |
| 48 |
* General helper functions |
| 49 |
******************************************************************************/ |
| 50 |
ompd_rc_t initTypeSizes(ompd_address_space_context_t *context); |
| 51 |
|
| 52 |
// NOLINTNEXTLINE "Used in below Macro:OMPD_CALLBACK." |
| 53 |
static const ompd_callbacks_t *callbacks = nullptr; |
| 54 |
|
| 55 |
// Invoke callback function and return if it fails |
| 56 |
#define OMPD_CALLBACK(fn, ...) \ |
| 57 |
do { \ |
| 58 |
ompd_rc_t _rc = callbacks->fn(__VA_ARGS__); \ |
| 59 |
if (_rc != ompd_rc_ok) \ |
| 60 |
return _rc; \ |
| 61 |
} while (0) |
| 62 |
|
| 63 |
// Read the memory contents located at the given symbol |
| 64 |
#define OMPD_GET_VALUE(context, th_context, name, size, buf) \ |
| 65 |
do { \ |
| 66 |
ompd_address_t _addr; \ |
| 67 |
OMPD_CALLBACK(symbol_addr_lookup, context, th_context, name, &_addr, \ |
| 68 |
NULL); \ |
| 69 |
OMPD_CALLBACK(read_memory, context, th_context, &_addr, size, buf); \ |
| 70 |
} while (0) |
| 71 |
|
| 72 |
typedef struct _ompd_aspace_cont ompd_address_space_context_t; |
| 73 |
|
| 74 |
typedef struct _ompd_aspace_handle { |
| 75 |
ompd_address_space_context_t *context; |
| 76 |
ompd_device_t kind; |
| 77 |
uint64_t id; |
| 78 |
} ompd_address_space_handle_t; |
| 79 |
|
| 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; |
| 85 |
|
| 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; |
| 91 |
|
| 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 */ |
| 96 |
_ompd_task_handle() { |
| 97 |
ah = NULL; |
| 98 |
th.segment = OMPD_SEGMENT_UNSPECIFIED; |
| 99 |
lwt.segment = OMPD_SEGMENT_UNSPECIFIED; |
| 100 |
th.address = 0; |
| 101 |
lwt.address = 0; |
| 102 |
} |
| 103 |
} ompd_task_handle_t; |
| 104 |
|
| 105 |
void __ompd_init_icvs(const ompd_callbacks_t *table); |
| 106 |
void __ompd_init_states(const ompd_callbacks_t *table); |
| 107 |
|
| 108 |
#endif /* SRC_OMP_DEBUG_H_ */ |