109 lines · c
1/*2 * omp-debug.h3 *4 * Created on: Jan 14, 20155 * Author: Ignacio Laguna6 * Joachim Protze7 * Contact: ilaguna@llnl.gov8 * protze@llnl.gov9 */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-exception15//16//===----------------------------------------------------------------------===//17 18#ifndef SRC_OMP_DEBUG_H_19#define SRC_OMP_DEBUG_H_20 21#define OMPD_VERSION 20181122 23#ifdef __cplusplus24 25#include <cstdlib>26 27extern "C" {28#endif29 30#define OMPD_IMPLEMENTS_OPENMP 531#define OMPD_IMPLEMENTS_OPENMP_SUBVERSION 032#define OMPD_TR_VERSION 633#define OMPD_TR_SUBVERSION 234#define OMPD_DLL_VERSION \35 (OMPD_IMPLEMENTS_OPENMP << 24) + (OMPD_IMPLEMENTS_OPENMP_SUBVERSION << 16) + \36 (OMPD_TR_VERSION << 8) + OMPD_TR_SUBVERSION37 38#define STR_HELPER(x) #x39#define STR(x) STR_HELPER(x)40 41#include "omp-tools.h"42#include "ompd-types.h"43 44#ifdef __cplusplus45}46#endif47/******************************************************************************48 * General helper functions49 ******************************************************************************/50ompd_rc_t initTypeSizes(ompd_address_space_context_t *context);51 52// NOLINTNEXTLINE "Used in below Macro:OMPD_CALLBACK."53static const ompd_callbacks_t *callbacks = nullptr;54 55// Invoke callback function and return if it fails56#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 symbol64#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 72typedef struct _ompd_aspace_cont ompd_address_space_context_t;73 74typedef 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 80typedef 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 86typedef 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 92typedef 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 105void __ompd_init_icvs(const ompd_callbacks_t *table);106void __ompd_init_states(const ompd_callbacks_t *table);107 108#endif /* SRC_OMP_DEBUG_H_ */109