mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-29 04:01:27 +01:00
Symbols: Add SymName function
This commit is contained in:
1 parent
8f578b57f2
commit
ae5cfcc249
2 files changed
+24
-19
No files matched your search
+5
-18
@@ -300,9 +300,9 @@ namespace FEXCore::IR {
|
||||
|
||||
AOTIRCaptureCache::PreGenerateIRFetchResult AOTIRCaptureCache::PreGenerateIRFetch(uint64_t GuestRIP, FEXCore::IR::IRListView *IRList) {
|
||||
auto AOTIRCacheEntry = CTX->SyscallHandler->LookupAOTIRCacheEntry(GuestRIP);
|
||||
|
||||
|
||||
PreGenerateIRFetchResult Result{};
|
||||
|
||||
|
||||
if (AOTIRCacheEntry.Entry) {
|
||||
AOTIRCacheEntry.Entry->ContainsCode = true;
|
||||
|
||||
@@ -344,24 +344,11 @@ namespace FEXCore::IR {
|
||||
auto map = Entry->SourcecodeMap.get();
|
||||
|
||||
if (map) {
|
||||
auto FileBegin = GuestRIP - VAFileStart;
|
||||
auto FileOffset = GuestRIP - VAFileStart;
|
||||
|
||||
auto Sym = map->FindSymbolMapping(FileBegin);
|
||||
auto Sym = map->FindSymbolMapping(FileOffset);
|
||||
|
||||
std::string SymName;
|
||||
if (Sym) {
|
||||
auto SymOffset = FileBegin - Sym->FileGuestBegin;
|
||||
if (SymOffset) {
|
||||
SymName = fmt::format("{}: {}+{} @{:x}", std::filesystem::path(Entry->Filename).stem().string(), Sym->Name,
|
||||
SymOffset, HostEntry);
|
||||
} else {
|
||||
SymName = fmt::format("{}: {} @{:x}", std::filesystem::path(Entry->Filename).stem().string(), Sym->Name,
|
||||
HostEntry);
|
||||
}
|
||||
} else {
|
||||
SymName = fmt::format("{}: +{} @{:x}", std::filesystem::path(Entry->Filename).stem().string(), FileBegin,
|
||||
HostEntry);
|
||||
}
|
||||
std::string SymName = HLE::SourcecodeSymbolMapping::SymName(Sym, Entry->Filename, HostEntry, FileOffset);
|
||||
|
||||
std::vector<gdb_line_mapping> Lines;
|
||||
for (const auto &GuestOpcode : DebugData->GuestOpcodes) {
|
||||
|
||||
+19
-1
@@ -1,9 +1,11 @@
|
||||
#pragma once
|
||||
#include <algorithm>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <filesystem>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
namespace FEXCore::IR {
|
||||
struct AOTIRCacheEntry;
|
||||
@@ -23,6 +25,22 @@ struct SourcecodeSymbolMapping {
|
||||
uintptr_t FileGuestEnd;
|
||||
|
||||
std::string Name;
|
||||
|
||||
static std::string SymName(const SourcecodeSymbolMapping *Sym, const std::string &GuestFilename, uintptr_t HostEntry, uintptr_t FileBegin) {
|
||||
if (Sym) {
|
||||
auto SymOffset = FileBegin - Sym->FileGuestBegin;
|
||||
if (SymOffset) {
|
||||
return fmt::format("{}: {}+{} @{:x}", std::filesystem::path(GuestFilename).stem().string(), Sym->Name,
|
||||
SymOffset, HostEntry);
|
||||
} else {
|
||||
return fmt::format("{}: {} @{:x}", std::filesystem::path(GuestFilename).stem().string(), Sym->Name,
|
||||
HostEntry);
|
||||
}
|
||||
} else {
|
||||
return fmt::format("{}: +{} @{:x}", std::filesystem::path(GuestFilename).stem().string(), FileBegin,
|
||||
HostEntry);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
struct SourcecodeMap {
|
||||
|
||||
Reference in new issue
Block a user