guarded_heap: Replace symbol lookup syscall with runtime_loader.
Use the private runtime_loader API to do the symbol lookup instead of using the syscall.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
SubDir HAIKU_TOP src system libroot posix malloc_debug ;
|
SubDir HAIKU_TOP src system libroot posix malloc_debug ;
|
||||||
|
|
||||||
UsePrivateHeaders libroot shared ;
|
UsePrivateHeaders libroot shared runtime_loader ;
|
||||||
|
|
||||||
local architectureObject ;
|
local architectureObject ;
|
||||||
for architectureObject in [ MultiArchSubDirSetup ] {
|
for architectureObject in [ MultiArchSubDirSetup ] {
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
#include <locks.h>
|
#include <locks.h>
|
||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
|
|
||||||
|
#include <runtime_loader.h>
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark - Debug Helpers
|
// #pragma mark - Debug Helpers
|
||||||
|
|
||||||
@@ -224,16 +226,17 @@ guarded_heap_page_protect(guarded_heap_area& area, size_t pageIndex,
|
|||||||
static void
|
static void
|
||||||
guarded_heap_print_stack_trace(addr_t stackTrace[], size_t depth)
|
guarded_heap_print_stack_trace(addr_t stackTrace[], size_t depth)
|
||||||
{
|
{
|
||||||
addr_t baseAddress;
|
char* imageName;
|
||||||
char symbolName[1024];
|
char* symbolName;
|
||||||
char imageName[B_PATH_NAME_LENGTH];
|
void* location;
|
||||||
bool exactMatch;
|
bool exactMatch;
|
||||||
|
|
||||||
for (size_t i = 0; i < depth; i++) {
|
for (size_t i = 0; i < depth; i++) {
|
||||||
addr_t address = stackTrace[i];
|
addr_t address = stackTrace[i];
|
||||||
|
|
||||||
status_t status = _kern_lookup_symbol(address, &baseAddress, symbolName,
|
status_t status = __gRuntimeLoader->get_nearest_symbol_at_address(
|
||||||
sizeof(symbolName), imageName, sizeof(imageName), &exactMatch);
|
(void*)address, NULL, NULL, &imageName, &symbolName, NULL,
|
||||||
|
&location, &exactMatch);
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
print_stdout("\t%#" B_PRIxADDR " (lookup failed: %s)\n", address,
|
print_stdout("\t%#" B_PRIxADDR " (lookup failed: %s)\n", address,
|
||||||
strerror(status));
|
strerror(status));
|
||||||
@@ -241,7 +244,7 @@ guarded_heap_print_stack_trace(addr_t stackTrace[], size_t depth)
|
|||||||
}
|
}
|
||||||
|
|
||||||
print_stdout("\t<%s> %s + %#" B_PRIxADDR "%s\n", imageName, symbolName,
|
print_stdout("\t<%s> %s + %#" B_PRIxADDR "%s\n", imageName, symbolName,
|
||||||
address - baseAddress, (exactMatch ? "" : " (nearest)"));
|
address - (addr_t)location, exactMatch ? "" : " (nearest)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user