Small backtrace support cleanup.

This commit is contained in:
Nikolay Igotti
2017-05-25 22:35:56 +03:00
parent 2dcfdebd5a
commit 070ea929f0
2 changed files with 3 additions and 13 deletions
+1 -2
View File
@@ -109,8 +109,7 @@ void setupCompilationFlags() {
if (isLinux()) {
binDir = "$gccToolchainDir/$gnuTriplet/bin"
ext.clangArgs.addAll([
"--gcc-toolchain=$gccToolchainDir",
"-L$llvmDir/lib"
"--gcc-toolchain=$gccToolchainDir"
])
} else {
binDir = "$macbookSysrootDir/usr/bin"
+2 -11
View File
@@ -35,20 +35,12 @@ namespace {
#error "Define ELFSIZE to 32 or 64"
#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
#define Elf_Ehdr Elf32_Ehdr
#define Elf_Phdr Elf32_Phdr
#define Elf_Shdr Elf32_Shdr
#define Elf_Sym Elf32_Sym
#elif ELFSIZE == 64
#define Elf_Ehdr Elf64_Ehdr
#define Elf_Phdr Elf64_Phdr
#define Elf_Shdr Elf64_Shdr
#define Elf_Sym Elf64_Sym
#else
@@ -62,7 +54,6 @@ struct SymRecord {
};
std::vector<SymRecord>* symbols = nullptr;
char* mapAddress = nullptr;
// Unfortunately, symbol tables are stored in ELF sections not mapped
// 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 end = record.symtabEnd;
while (begin < end) {
if (address >= (unsigned long)mapAddress + begin->st_value &&
address < (unsigned long)mapAddress + begin->st_value + begin->st_size) {
// st_value is load address adjusted.
if (address >= begin->st_value && address < begin->st_value + begin->st_size) {
return &record.strtab[begin->st_name];
}
begin++;