-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcrash_handler_init.hpp
More file actions
50 lines (41 loc) · 1.93 KB
/
Copy pathcrash_handler_init.hpp
File metadata and controls
50 lines (41 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
//
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2025-Present Datadog, Inc.
#pragma once
#include <string_view>
#include "datadog/impl/core/util/diagnostics.hpp"
#include "datadog/impl/crash_reporting/crash_handler.hpp"
namespace datadog::impl {
class IFilesystem;
class StoragePath;
namespace CrashHandler {
/**
* On first call, creates and initializes the process-global ICrashHandler instance to
* be used by the CrashReporting feature. If ICrashHandler::Initialize() succeeds on the
* first call to this function, returns a pointer to the handler value, which remains
* alive for the duration of the process.
*
* If initialization fails on the first call, returns null. On all subsequent calls
* after the first, regardless of whether initialization succeeded, returns null.
*
* @param logger Allows diagnostic messages to be emitted during initialization. Passed
* by value to ensure that the handler can not retain references to state owned by the
* Core. DiagnosticLogger wraps a std::function that is safe to call throughout the
* lifetime of the process: the handler MAY store the logger value and use it later.
* However, the handler MUST NOT use the logger during a crash, as it can not be
* assumed that the diagnostic-handler callback is async-signal-safe.
* @param crash_storage_dir_path Path to the directory where this handler may store
* crash-related artifacts.
* @param helper_exe_path Configured path to a helper executable that may be used by the
* crash handler, if any. Valid only for the scope of the function call.
*/
ICrashHandler* InitializeOnce(
DiagnosticLogger logger,
IFilesystem& fs,
const StoragePath& crash_storage_dir_path,
std::string_view helper_exe_path
);
} // namespace CrashHandler
} // namespace datadog::impl