Skip to content
LeviMC
Home
Projects
Docs
6
LeviLamina
Mod loader for Minecraft Bedrock Edition
LegacyScriptEngine
Runs LLSE script plugins on LeviLamina
lip
General package installer
LeviLauncher
Bedrock launcher for Windows and Android
Be.D.D.
Scripted client input for mod tests
bedboo
Bedrock bots with a mineflayer-compatible API
All repositories on GitHub
Mods
Blog
Community
About
English
English
简体中文
繁體中文
Auto
Light
Dark
Auto
Light
Dark
LeviLamina
User Guides
Developer Guides
API Guides
API Reference
Maintainer Guides
Resources
LeviLamina on GitHub
LeviMC
Home
Projects
Docs
6
LeviLamina
Mod loader for Minecraft Bedrock Edition
LegacyScriptEngine
Runs LLSE script plugins on LeviLamina
lip
General package installer
LeviLauncher
Bedrock launcher for Windows and Android
Be.D.D.
Scripted client input for mod tests
bedboo
Bedrock bots with a mineflayer-compatible API
All repositories on GitHub
Mods
Blog
Community
About
API Reference
On this page
LeviLamina
User Guides
Developer Guides
API Guides
API Reference
Maintainer Guides
Search
Ctrl
K
Loading...
Searching...
No Matches
StacktraceUtils.h
1
#pragma once
2
3
#include <atomic>
4
#include <optional>
5
#include <string>
6
#include <vector>
7
8
#include "ll/api/base/Macro.h"
9
#include "ll/api/base/StdInt.h"
10
11
namespace
ll {
12
13
class
Stacktrace
;
14
15
class
StacktraceEntry {
16
friend ::ll::Stacktrace;
17
void
* address{};
18
19
public
:
20
using
native_handle_type =
void
*;
21
22
explicit
StacktraceEntry(
void
* address) : address(address) {}
23
24
void
* native_handle()
const
{
return
address; }
25
};
26
class
Stacktrace
{
27
std::vector<StacktraceEntry> entries;
28
uint64 hash;
29
30
public
:
31
LLNDAPI
static
Stacktrace
current(
size_t
skip = 0,
size_t
maxDepth = ~0ull);
32
LLNDAPI
static
Stacktrace
fromThread(std::thread::id
id
);
33
34
uint64 getHash()
const
{
return
hash; }
35
36
size_t
size()
const
{
return
entries.size(); }
37
38
bool
empty()
const
{
return
entries.empty(); }
39
40
StacktraceEntry
const
& operator[](
size_t
index)
const
{
return
entries[index]; }
41
};
42
}
// namespace ll
43
44
namespace
std
{
45
template
<>
46
struct
hash<ll::StacktraceEntry> {
47
[[nodiscard]]
size_t
operator()(
ll::StacktraceEntry
const
& val)
const
noexcept
{
48
return
hash<ll::StacktraceEntry::native_handle_type>{}(val.native_handle());
49
}
50
};
51
template
<>
52
struct
hash<ll::Stacktrace> {
53
[[nodiscard]]
size_t
operator()(
ll::Stacktrace
const
& val)
const
noexcept
{
return
val.getHash(); }
54
};
55
}
// namespace std
56
57
namespace
ll::inline utils::stacktrace_utils {
58
class
SymbolLoader {
59
void
* handle;
60
static
std::atomic_size_t count;
61
62
public
:
63
SymbolLoader(SymbolLoader
const
&) =
delete
;
64
SymbolLoader& operator=(SymbolLoader
const
&) =
delete
;
65
66
LLAPI SymbolLoader();
67
LLAPI SymbolLoader(std::string_view);
68
LLAPI ~SymbolLoader();
69
};
70
71
struct
StackTraceEntryInfo
{
72
std::optional<size_t> displacement;
73
std::string name;
74
std::optional<ulong> line;
75
std::string file;
76
};
77
78
LLNDAPI
StackTraceEntryInfo
getInfo(StacktraceEntry
const
&);
79
LLNDAPI std::string toString(StacktraceEntry
const
&);
80
LLNDAPI std::string toString(Stacktrace
const
&);
81
}
// namespace ll::inline utils::stacktrace_utils
ll::StacktraceEntry
Definition
StacktraceUtils.h:15
ll::Stacktrace
Definition
StacktraceUtils.h:26
std
STL namespace.
utils::stacktrace_utils::StackTraceEntryInfo
Definition
StacktraceUtils.h:71
src
ll
api
utils
StacktraceUtils.h
Generated on
for LeviLamina by
1.16.1