Path: blob/main/contrib/llvm-project/compiler-rt/lib/memprof/memprof_internal.h
35236 views
//===-- memprof_internal.h -------------------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// This file is a part of MemProfiler, a memory profiler.9//10// MemProf-private header which defines various general utilities.11//===----------------------------------------------------------------------===//12#ifndef MEMPROF_INTERNAL_H13#define MEMPROF_INTERNAL_H1415#include "memprof_flags.h"16#include "memprof_interface_internal.h"17#include "sanitizer_common/sanitizer_common.h"18#include "sanitizer_common/sanitizer_internal_defs.h"19#include "sanitizer_common/sanitizer_libc.h"20#include "sanitizer_common/sanitizer_stacktrace.h"2122// Build-time configuration options.2324// If set, memprof will intercept C++ exception api call(s).25#ifndef MEMPROF_HAS_EXCEPTIONS26#define MEMPROF_HAS_EXCEPTIONS 127#endif2829#ifndef MEMPROF_DYNAMIC30#ifdef PIC31#define MEMPROF_DYNAMIC 132#else33#define MEMPROF_DYNAMIC 034#endif35#endif3637// All internal functions in memprof reside inside the __memprof namespace38// to avoid namespace collisions with the user programs.39// Separate namespace also makes it simpler to distinguish the memprof40// run-time functions from the instrumented user code in a profile.41namespace __memprof {4243class MemprofThread;44using __sanitizer::StackTrace;4546void MemprofInitFromRtl();4748// memprof_rtl.cpp49void PrintAddressSpaceLayout();5051// memprof_shadow_setup.cpp52void InitializeShadowMemory();5354// memprof_malloc_linux.cpp55void ReplaceSystemMalloc();5657// memprof_linux.cpp58uptr FindDynamicShadowStart();5960// memprof_thread.cpp61MemprofThread *CreateMainThread();6263// Wrapper for TLS/TSD.64void TSDInit(void (*destructor)(void *tsd));65void *TSDGet();66void TSDSet(void *tsd);67void PlatformTSDDtor(void *tsd);6869void *MemprofDlSymNext(const char *sym);7071extern int memprof_inited;72extern int memprof_timestamp_inited;73// Used to avoid infinite recursion in __memprof_init().74extern bool memprof_init_is_running;75extern void (*death_callback)(void);76extern long memprof_init_timestamp_s;7778} // namespace __memprof7980#endif // MEMPROF_INTERNAL_H818283