mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-05 14:31:17 +12:00
Linux: Resolve backtrace symbols directly from .symtab instead of .dynsym (#385)
This commit is contained in:
parent
271a4e4719
commit
9df1325d14
5 changed files with 182 additions and 16 deletions
32
src/Common/ExceptionHandler/ELFSymbolTable.h
Normal file
32
src/Common/ExceptionHandler/ELFSymbolTable.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
#pragma once
|
||||
#include <memory>
|
||||
#include <elf.h>
|
||||
|
||||
class ELFSymbolTable
|
||||
{
|
||||
public:
|
||||
std::string_view OffsetToSymbol(uint64 ptr, uint64& fromStart) const;
|
||||
|
||||
ELFSymbolTable();
|
||||
~ELFSymbolTable();
|
||||
private:
|
||||
uint8* mappedExecutable = nullptr;
|
||||
size_t mappedExecutableSize = 0;
|
||||
|
||||
Elf64_Ehdr* header = nullptr;
|
||||
|
||||
Elf64_Shdr* shTable = nullptr;
|
||||
char* shStrTable = nullptr;
|
||||
|
||||
Elf64_Sym* symTable = nullptr;
|
||||
uint64 symTableLen = 0;
|
||||
char* strTable = nullptr;
|
||||
|
||||
uint16 FindSection(int type, const std::string_view& name);
|
||||
|
||||
void* SectionPointer (uint16 index);
|
||||
void* SectionPointer(const Elf64_Shdr& section);
|
||||
|
||||
// ownership of mapped memory, cannot copy.
|
||||
ELFSymbolTable(const ELFSymbolTable&) = delete;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue