repr
0.1
Reconstructable string representations and more
Toggle main menu visibility
Main Page
Installation
Usage
Customization
Extending
FAQ
CI Results
Test
Benchmark
API Documentation
Namespace List
Namespace List
Namespace Members
All
_
a
c
d
e
f
g
i
l
m
n
o
p
r
s
t
u
v
w
Functions
_
a
c
d
e
f
g
i
l
m
n
o
r
s
t
u
v
w
Variables
Typedefs
Enumerations
Concept List
Class List
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
~
Functions
_
a
c
e
f
g
i
l
m
n
o
p
r
s
t
v
w
~
Variables
a
b
c
d
e
f
g
i
k
l
m
n
o
p
q
r
s
t
u
v
Typedefs
a
c
d
e
f
g
h
l
m
p
r
s
t
u
v
w
Enumerations
Enumerator
Related Symbols
File List
File List
File Members
All
_
l
n
o
r
u
Variables
Macros
_
l
o
r
u
Examples
Source Code
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
Concepts
Loading...
Searching...
No Matches
undecorate.h
Go to the documentation of this file.
#pragma once
#include <
librepr/feature.h
>
#include <
librepr/macro/platform.h
>
#if USING(LIBREPR_PLATFORM_WINDOWS)
#pragma comment(lib, "dbghelp.lib")
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <Windows.h>
#include <DbgHelp.h>
#include <
array
>
#include <
mutex
>
#include <
typeinfo
>
#include <
librepr/macro/assert.h
>
#include "
denoise.h
"
#include "
undname.h
"
namespace
librepr::detail
{
namespace
msvc {
inline
constexpr
bool
has_rawname
=
requires
(
const
std::type_info
&
ty
) {
ty
.raw_name(); };
}
// namespace msvc
// TODO: Make this better ig
[[
nodiscard
]]
inline
int
syminit_
() {
SymSetOptions
(
SYMOPT_ALLOW_ABSOLUTE_SYMBOLS
|
SYMOPT_DEFERRED_LOADS
);
bool
did_initialize
= !!
SymInitialize
(
GetCurrentProcess
(),
NULL
,
TRUE
);
assert
(
did_initialize
&&
"Failed to initialize the symbol handler!"
);
return
true
;
}
inline
std::size_t
undecorate_name
(
const
char
*
symdata
,
DemangleBuffer
& buf) {
{ [[
maybe_unused
]]
static
int
sym
=
syminit_
(); }
static
std::mutex
mtx
{ };
if
(!
symdata
) [[
unlikely
]] {
return
0; }
if
constexpr
(msvc::has_rawname) {
if
(*
symdata
==
'.'
) [[
likely
]] {
constexpr
static
auto
flags =
UndStrategy::Decode32Bit
|
UndStrategy::TypeOnly
;
msvc::unDName
((
symdata
+ 1), buf,
UndStrategy::Type
(flags));
auto
denoised
=
denoise_name
({ buf.data() });
std::memcpy
(buf.data(),
denoised
.data(),
denoised
.size());
return
denoised
.size();
}
}
LIBREPR_SOFT_ASSERT
(*
symdata
==
'?'
,
"Got '{}', expected '?'"
, *
symdata
);
std::scoped_lock
lock
{
mtx
};
return
std::size_t
(
::UnDecorateSymbolName
(
symdata
, buf.data(),
REPR_DEMANGLE_MAX
,
UNDNAME_NO_MS_KEYWORDS
));
}
}
// namespace librepr::detail
#endif
include
librepr
name
detail
undecorate.h
Generated by
1.9.8, using the excellent
Doxygen Awesome
Theme