CommonLib
Toggle main menu visibility
Loading...
Searching...
No Matches
this_process.h
Go to the documentation of this file.
1
#
pragma
once
2
3
#
include
<
filesystem
>
4
#
include
<
vector
>
5
6
#
include
"diag/stack_frame.h"
7
#
include
"ut/expr/string_expr.h"
8
9
namespace
hedgedev::csl::diag::
this_process
10
{
11
///
12
/// Gets the command line arguments that were passed into this process at launch.
13
///
14
template
<ut::expr::any_string T>
15
inline
std
::
vector
<
T
>
get_command_line
();
16
17
///
18
/// Gets the path to the executable this process started from.
19
///
20
inline
std
::
filesystem
::
path
get_executable_path
();
21
22
///
23
/// Gets the path to the directory containing executable this process started from.
24
///
25
inline
std
::
filesystem
::
path
get_executable_root
();
26
27
///
28
/// Gets the path to the module containing the specified address.
29
///
30
/// \param in_address The address to search for.
31
///
32
inline
std
::
filesystem
::
path
get_module_path_from_address
(
const
void
*
in_address
);
33
34
///
35
/// Gets the working directory of this process.
36
///
37
inline
std
::
filesystem
::
path
get_working_directory
();
38
39
///
40
/// Gets a stack trace.
41
///
42
/// \param in_context A pointer to a CPU context structure.
43
/// \param in_max_frames The maximum number of stack frames to capture.
44
///
45
/// \returns A collection of stack frames.
46
///
47
inline
std
::
vector
<
stack_frame
>
get_stack_trace
(
const
void
*
in_context
,
const
size_t
in_max_frames
= 0);
48
49
///
50
/// Checks if this process is the owner of the specified address.
51
///
52
/// \param in_address The address to search for.
53
///
54
/// \returns `true` if the address is inside this process' memory.
55
/// Otherwise, `false`.
56
///
57
inline
bool
has_address
(
const
void
* in_address);
58
59
///
60
/// Checks if a path is in the same directory as the executable this process
61
/// started from.
62
///
63
/// \param in_path The path to check.
64
///
65
/// \returns `true` if both paths are in the same directory. Otherwise, `false`.
66
///
67
inline
bool
is_neighbour
(
const
std::filesystem::path& in_path);
68
69
///
70
/// Restarts this process.
71
///
72
/// \tparam T The string type for the arguments.
73
///
74
/// \param in_args The command line arguments to pass into the new process.
75
///
76
/// \returns `true` if this process was terminated successfully. Otherwise, `false`.
77
///
78
template
<ut::expr::any_string T>
79
inline
bool
restart
(
const
std::vector<T>& in_args);
80
81
///
82
/// Restarts this process.
83
///
84
/// \returns `true` if this process was terminated successfully. Otherwise, `false`.
85
///
86
inline
bool
restart
();
87
}
88
89
#
include
"this_process.inl"
90
91
#
ifdef
WIN32
92
#
include
"os/this_process_win32.inl"
93
#
endif
hedgedev::csl::diag::this_process
Definition
this_process_win32.inl:13
hedgedev::csl::diag::this_process::get_executable_root
std::filesystem::path get_executable_root()
Definition
this_process.inl:7
hedgedev::csl::diag::this_process::get_command_line
std::vector< T > get_command_line()
Definition
this_process_win32.inl:15
hedgedev::csl::diag::this_process::is_neighbour
bool is_neighbour(const std::filesystem::path &in_path)
Definition
this_process.inl:12
hedgedev::csl::diag::this_process::restart
bool restart(const std::vector< T > &in_args)
Definition
this_process_win32.inl:175
hedgedev::csl::diag::this_process::get_working_directory
std::filesystem::path get_working_directory()
Definition
this_process_win32.inl:69
hedgedev::csl::diag::this_process::restart
bool restart()
Definition
this_process_win32.inl:182
hedgedev::csl::diag::this_process::get_stack_trace
std::vector< stack_frame > get_stack_trace(const void *in_context, const size_t in_max_frames)
Definition
this_process_win32.inl:81
hedgedev::csl::diag::this_process::has_address
bool has_address(const void *in_address)
Definition
this_process_win32.inl:157
hedgedev::csl::diag::this_process::get_module_path_from_address
std::filesystem::path get_module_path_from_address(const void *in_address)
Definition
this_process_win32.inl:45
hedgedev::csl::diag::this_process::get_executable_path
std::filesystem::path get_executable_path()
Definition
this_process_win32.inl:33
include
diag
this_process.h
Generated by
1.18.0