Small backtrace support cleanup.
This commit is contained in:
+1
-2
@@ -109,8 +109,7 @@ void setupCompilationFlags() {
|
|||||||
if (isLinux()) {
|
if (isLinux()) {
|
||||||
binDir = "$gccToolchainDir/$gnuTriplet/bin"
|
binDir = "$gccToolchainDir/$gnuTriplet/bin"
|
||||||
ext.clangArgs.addAll([
|
ext.clangArgs.addAll([
|
||||||
"--gcc-toolchain=$gccToolchainDir",
|
"--gcc-toolchain=$gccToolchainDir"
|
||||||
"-L$llvmDir/lib"
|
|
||||||
])
|
])
|
||||||
} else {
|
} else {
|
||||||
binDir = "$macbookSysrootDir/usr/bin"
|
binDir = "$macbookSysrootDir/usr/bin"
|
||||||
|
|||||||
@@ -35,20 +35,12 @@ namespace {
|
|||||||
#error "Define ELFSIZE to 32 or 64"
|
#error "Define ELFSIZE to 32 or 64"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define CONCAT(x,y) __CONCAT(x,y)
|
|
||||||
#define ELFNAME(x) CONCAT(elf,CONCAT(ELFSIZE,CONCAT(_,x)))
|
|
||||||
#define ELFNAME2(x,y) CONCAT(x,CONCAT(_elf,CONCAT(ELFSIZE,CONCAT(_,y))))
|
|
||||||
#define ELFNAMEEND(x) CONCAT(x,CONCAT(_elf,ELFSIZE))
|
|
||||||
#define ELFDEFNNAME(x) CONCAT(ELF,CONCAT(ELFSIZE,CONCAT(_,x)))
|
|
||||||
|
|
||||||
#if ELFSIZE == 32
|
#if ELFSIZE == 32
|
||||||
#define Elf_Ehdr Elf32_Ehdr
|
#define Elf_Ehdr Elf32_Ehdr
|
||||||
#define Elf_Phdr Elf32_Phdr
|
|
||||||
#define Elf_Shdr Elf32_Shdr
|
#define Elf_Shdr Elf32_Shdr
|
||||||
#define Elf_Sym Elf32_Sym
|
#define Elf_Sym Elf32_Sym
|
||||||
#elif ELFSIZE == 64
|
#elif ELFSIZE == 64
|
||||||
#define Elf_Ehdr Elf64_Ehdr
|
#define Elf_Ehdr Elf64_Ehdr
|
||||||
#define Elf_Phdr Elf64_Phdr
|
|
||||||
#define Elf_Shdr Elf64_Shdr
|
#define Elf_Shdr Elf64_Shdr
|
||||||
#define Elf_Sym Elf64_Sym
|
#define Elf_Sym Elf64_Sym
|
||||||
#else
|
#else
|
||||||
@@ -62,7 +54,6 @@ struct SymRecord {
|
|||||||
};
|
};
|
||||||
|
|
||||||
std::vector<SymRecord>* symbols = nullptr;
|
std::vector<SymRecord>* symbols = nullptr;
|
||||||
char* mapAddress = nullptr;
|
|
||||||
|
|
||||||
// Unfortunately, symbol tables are stored in ELF sections not mapped
|
// Unfortunately, symbol tables are stored in ELF sections not mapped
|
||||||
// during regular execution, so we have to map binary ourselves.
|
// during regular execution, so we have to map binary ourselves.
|
||||||
@@ -122,8 +113,8 @@ extern "C" const char* AddressToSymbol(unsigned long address) {
|
|||||||
auto begin = record.symtabBegin;
|
auto begin = record.symtabBegin;
|
||||||
auto end = record.symtabEnd;
|
auto end = record.symtabEnd;
|
||||||
while (begin < end) {
|
while (begin < end) {
|
||||||
if (address >= (unsigned long)mapAddress + begin->st_value &&
|
// st_value is load address adjusted.
|
||||||
address < (unsigned long)mapAddress + begin->st_value + begin->st_size) {
|
if (address >= begin->st_value && address < begin->st_value + begin->st_size) {
|
||||||
return &record.strtab[begin->st_name];
|
return &record.strtab[begin->st_name];
|
||||||
}
|
}
|
||||||
begin++;
|
begin++;
|
||||||
|
|||||||
Reference in New Issue
Block a user