CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
93 lines
3.0 KiB
C++
93 lines
3.0 KiB
C++
//===-- xray_flags.cpp ------------------------------------------*- C++ -*-===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file is a part of XRay, a dynamic runtime instrumentation system.
|
|
//
|
|
// XRay flag parsing logic.
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "xray_flags.h"
|
|
#include "sanitizer_common/sanitizer_common.h"
|
|
#include "sanitizer_common/sanitizer_flag_parser.h"
|
|
#include "sanitizer_common/sanitizer_libc.h"
|
|
#include "xray_defs.h"
|
|
|
|
using namespace __sanitizer;
|
|
|
|
namespace __xray {
|
|
|
|
Flags xray_flags_dont_use_directly; // use via flags().
|
|
|
|
void Flags::setDefaults() XRAY_NEVER_INSTRUMENT {
|
|
#define XRAY_FLAG(Type, Name, DefaultValue, Description) Name = DefaultValue;
|
|
#include "xray_flags.inc"
|
|
#undef XRAY_FLAG
|
|
}
|
|
|
|
void registerXRayFlags(FlagParser *P, Flags *F) XRAY_NEVER_INSTRUMENT {
|
|
#define XRAY_FLAG(Type, Name, DefaultValue, Description) \
|
|
RegisterFlag(P, #Name, Description, &F->Name);
|
|
#include "xray_flags.inc"
|
|
#undef XRAY_FLAG
|
|
}
|
|
|
|
// This function, as defined with the help of a macro meant to be introduced at
|
|
// build time of the XRay runtime, passes in a statically defined list of
|
|
// options that control XRay. This means users/deployments can tweak the
|
|
// defaults that override the hard-coded defaults in the xray_flags.inc at
|
|
// compile-time using the XRAY_DEFAULT_OPTIONS macro.
|
|
const char *useCompilerDefinedFlags() XRAY_NEVER_INSTRUMENT {
|
|
#ifdef XRAY_DEFAULT_OPTIONS
|
|
// Do the double-layered string conversion to prevent badly crafted strings
|
|
// provided through the XRAY_DEFAULT_OPTIONS from causing compilation issues
|
|
// (or changing the semantics of the implementation through the macro). This
|
|
// ensures that we convert whatever XRAY_DEFAULT_OPTIONS is defined as a
|
|
// string literal.
|
|
return SANITIZER_STRINGIFY(XRAY_DEFAULT_OPTIONS);
|
|
#else
|
|
return "";
|
|
#endif
|
|
}
|
|
|
|
void initializeFlags() XRAY_NEVER_INSTRUMENT {
|
|
SetCommonFlagsDefaults();
|
|
auto *F = flags();
|
|
F->setDefaults();
|
|
|
|
FlagParser XRayParser;
|
|
registerXRayFlags(&XRayParser, F);
|
|
RegisterCommonFlags(&XRayParser);
|
|
|
|
// Use options defaulted at compile-time for the runtime.
|
|
const char *XRayCompileFlags = useCompilerDefinedFlags();
|
|
XRayParser.ParseString(XRayCompileFlags);
|
|
|
|
// Use options provided at build time of the instrumented program.
|
|
const char *XRayDefaultOptions = __xray_default_options();
|
|
XRayParser.ParseString(XRayDefaultOptions);
|
|
|
|
// Override from environment variables.
|
|
XRayParser.ParseStringFromEnv("XRAY_OPTIONS");
|
|
|
|
// Override from command line.
|
|
InitializeCommonFlags();
|
|
|
|
if (Verbosity())
|
|
ReportUnrecognizedFlags();
|
|
|
|
if (common_flags()->help) {
|
|
XRayParser.PrintFlagDescriptions();
|
|
}
|
|
}
|
|
|
|
} // namespace __xray
|
|
|
|
SANITIZER_INTERFACE_WEAK_DEF(const char *, __xray_default_options, void) {
|
|
return "";
|
|
}
|