mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-04-14 04:48:59 +02:00
fixes and license
This commit is contained in:
parent
791a5af791
commit
86fedc1e5b
3 changed files with 21 additions and 25 deletions
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
// Add our own tracy instrumentation macros which compile to nothing without TRACY_ENABLE
|
||||
|
|
|
|||
|
|
@ -1,25 +1,15 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include "tracy_jit_symbols.h"
|
||||
|
||||
#if defined(TRACY_ENABLE) && defined(TRACY_HAS_USER_SYMBOLS)
|
||||
#include <client/TracyStringHelpers.hpp>
|
||||
#include <tracy/Tracy.hpp>
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#ifndef WIN32_NOMINMAX
|
||||
#define WIN32_NOMINMAX
|
||||
#endif
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#include <windows.h>
|
||||
|
||||
namespace tracy_jit {
|
||||
std::string JitCodeMap::get_exe_name () {
|
||||
char name[1024];
|
||||
const auto nameLength = GetModuleFileNameA( NULL, name, sizeof( name ) );
|
||||
return "<JIT> ["+std::string(name, nameLength)+"]";
|
||||
std::string JitCodeMap::get_module_name () {
|
||||
return "[JIT_Code]";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -28,7 +18,7 @@ namespace tracy {
|
|||
if (buf_size <= 0) return false;
|
||||
|
||||
auto& map = tracy_jit::JitCodeMap::instance();
|
||||
return map.lookup_code_address( ptr, [name_buf, buf_size] (tracy_jit::JitCodeMap::JittedCodeBlock& block, char const* exe_name) -> void {
|
||||
return map.lookup_code_address( ptr, [name_buf, buf_size] (tracy_jit::JitCodeMap::JittedCodeBlock& block, char const* module_name) -> void {
|
||||
// copy name truncated
|
||||
size_t safe_chars = std::min(block.name.size(), buf_size-1);
|
||||
memcpy(name_buf, block.name.c_str(), safe_chars);
|
||||
|
|
@ -37,17 +27,17 @@ namespace tracy {
|
|||
}
|
||||
extern bool UserDecodeSymbolAddress( uint64_t ptr, CallstackSymbolData* result ) {
|
||||
auto& map = tracy_jit::JitCodeMap::instance();
|
||||
return map.lookup_code_address( ptr, [result] (tracy_jit::JitCodeMap::JittedCodeBlock& block, char const* exe_name) -> void {
|
||||
return map.lookup_code_address( ptr, [result] (tracy_jit::JitCodeMap::JittedCodeBlock& block, char const* module_name) -> void {
|
||||
result->symAddr = block.entrypoint;
|
||||
// we have no source file
|
||||
result->file = CopyStringFast("[unknown]");
|
||||
result->file = "[unknown]";
|
||||
result->line = 0;
|
||||
result->needFree = true;
|
||||
result->needFree = false;
|
||||
} );
|
||||
}
|
||||
extern bool UserDecodeCallstackPtr( uint64_t ptr, CallstackEntryData* result, CallstackEntry* cb_data ) {
|
||||
auto& map = tracy_jit::JitCodeMap::instance();
|
||||
return map.lookup_code_address( ptr, [result, cb_data] (tracy_jit::JitCodeMap::JittedCodeBlock& block, char const* exe_name) -> void {
|
||||
return map.lookup_code_address( ptr, [result, cb_data] (tracy_jit::JitCodeMap::JittedCodeBlock& block, char const* module_name) -> void {
|
||||
cb_data[0].symAddr = block.entrypoint;
|
||||
cb_data[0].symLen = block.size;
|
||||
cb_data[0].name = CopyStringFast(block.name.c_str(), block.name.size());
|
||||
|
|
@ -55,7 +45,7 @@ namespace tracy {
|
|||
cb_data[0].file = CopyStringFast("[unknown]");
|
||||
cb_data[0].line = 0;
|
||||
|
||||
*result = { cb_data, 1, exe_name };
|
||||
*result = { cb_data, 1, module_name };
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <cassert>
|
||||
|
|
@ -78,7 +81,7 @@ public:
|
|||
|
||||
assert(ptr >= it->second.entrypoint);
|
||||
if (ptr - it->second.entrypoint < it->second.size) {
|
||||
set_result(it->second, exe_name.c_str());
|
||||
set_result(it->second, module_name.c_str());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -96,12 +99,12 @@ private:
|
|||
// sorted map of currently active jitted code blocks
|
||||
std::map<uint64_t, JittedCodeBlock> sorted_blocks;
|
||||
std::mutex mutex;
|
||||
std::string exe_name;
|
||||
std::string module_name;
|
||||
|
||||
static std::string get_exe_name ();
|
||||
static std::string get_module_name ();
|
||||
|
||||
JitCodeMap () {
|
||||
exe_name = get_exe_name();
|
||||
module_name = get_module_name();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue