41 lines · c
1//===-- memprof_interceptors_memintrinsics.h -------------------*- C++ -*-===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===---------------------------------------------------------------------===//8//9// This file is a part of MemProfiler, a memory profiler.10//11// MemProf-private header for memprof_interceptors_memintrinsics.cpp12//===---------------------------------------------------------------------===//13#ifndef MEMPROF_MEMINTRIN_H14#define MEMPROF_MEMINTRIN_H15 16#include "interception/interception.h"17#include "memprof_interface_internal.h"18#include "memprof_internal.h"19#include "memprof_mapping.h"20 21DECLARE_REAL(void *, memcpy, void *to, const void *from, SIZE_T size)22DECLARE_REAL(void *, memset, void *block, int c, SIZE_T size)23 24namespace __memprof {25 26// We implement ACCESS_MEMORY_RANGE, MEMPROF_READ_RANGE,27// and MEMPROF_WRITE_RANGE as macro instead of function so28// that no extra frames are created, and stack trace contains29// relevant information only.30#define ACCESS_MEMORY_RANGE(offset, size) \31 do { \32 __memprof_record_access_range(offset, size); \33 } while (0)34 35#define MEMPROF_READ_RANGE(offset, size) ACCESS_MEMORY_RANGE(offset, size)36#define MEMPROF_WRITE_RANGE(offset, size) ACCESS_MEMORY_RANGE(offset, size)37 38} // namespace __memprof39 40#endif // MEMPROF_MEMINTRIN_H41