add logging
This commit is contained in:
20
src/memory.c
20
src/memory.c
@@ -1,9 +1,29 @@
|
||||
#include "memory.h"
|
||||
|
||||
#include "array/sc_array.h"
|
||||
#include "files.h"
|
||||
#include "logger.h"
|
||||
#include "types.h"
|
||||
|
||||
static inline int ptr_in_range(uptr ptr, uptr start, uptr end) {
|
||||
return ptr >= start && ptr <= end;
|
||||
}
|
||||
|
||||
HiloadResult memory_find_pointer(uptr ptr, struct sc_array_memreg* const regions,
|
||||
size_t *index) {
|
||||
for (size_t i = 0; i < sc_array_size(regions); i++) {
|
||||
if (ptr_in_range(ptr, regions->elems[i].region_start,
|
||||
regions->elems[i].region_end)) {
|
||||
if (index) {
|
||||
*index = i;
|
||||
return HILOAD_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return HILOAD_FAIL;
|
||||
}
|
||||
|
||||
HiloadResult read_memory_maps_self(struct sc_array_memreg *regions) {
|
||||
str memory_str = str_null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user