-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
9 changed files
with
114 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include "Symbol32.h" | ||
|
||
#include <cstring> | ||
|
||
#if defined(__GNUC__) || defined(__MINGW32__) | ||
#include <cxxabi.h> | ||
#else | ||
#error "The program can only work on GCC Compilers" | ||
#endif | ||
|
||
Symbol32::Symbol32(uint32_t index_, const char* demangled_, const char* mangled_, uint32_t nameOffset_, | ||
uint32_t valueOffset_, uint32_t size_, unsigned char bind_, unsigned char type_, | ||
uint16_t sectionIndex_, unsigned char other_) : | ||
index(index_), demangled(demangled_), mangled(mangled_), nameOffset(nameOffset_), | ||
valueOffset(valueOffset_), size(size_), bind(bind_), type(type_), | ||
sectionIndex(sectionIndex_), other(other_) { | ||
|
||
isStatic = sectionIndex != 11 && bind == 1; | ||
isDestructor = std::strstr(demangled, "::~") != nullptr; | ||
} | ||
|
||
const char* Symbol32::demangle(const char* mangled) { | ||
int status; | ||
char* demangled = abi::__cxa_demangle(mangled, nullptr, nullptr, &status); | ||
if (status != 0) { | ||
return ""; | ||
} | ||
|
||
return demangled; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#include "VTable.h" | ||
|
||
#include <cstring> | ||
|
||
#include "Symbol32.h" | ||
|
||
VTable::VTable(Symbol32* symbol_) : symbol(symbol_) { | ||
size = symbol_->size / 4 - 2; | ||
baseOffset = symbol_->valueOffset + 8; | ||
maxOffset = baseOffset + size * 4; | ||
|
||
auto len = strlen(symbol->demangled); | ||
for (size_t i = 11; i < len; ++i) { | ||
name += symbol->demangled[i]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
the permission has to be written as octal number. You should change 777 to 0777.