Fixing merge conflict resolution
This commit is contained in:
54
src/hiload.c
54
src/hiload.c
@@ -1,4 +1,7 @@
|
||||
#include "hiload/hiload.h"
|
||||
|
||||
#include "logger.h"
|
||||
#include "memory.h"
|
||||
#include "symbols.h"
|
||||
|
||||
#include <assert.h>
|
||||
@@ -51,8 +54,10 @@ static int gather_module_infos_callback(struct dl_phdr_info *info, size_t size,
|
||||
infos->handles[infos->count] =
|
||||
dlopen(info->dlpi_name, RTLD_LAZY | RTLD_NOLOAD);
|
||||
|
||||
if (hi_create_symbol_info(&infos->symbols[infos->count], info) != CREATE_SUCCESS) {
|
||||
fprintf(stderr, "Failed to create symbol info for %s\n", infos->names[infos->count]);
|
||||
if (hi_create_symbol_info(&infos->symbols[infos->count], info) !=
|
||||
CREATE_SUCCESS) {
|
||||
fprintf(stderr, "Failed to create symbol info for %s\n",
|
||||
infos->names[infos->count]);
|
||||
}
|
||||
infos->count++;
|
||||
return 0; // Continue iteration
|
||||
@@ -110,23 +115,6 @@ static ModuleInfos *gather_shared_libraries(void) {
|
||||
return result;
|
||||
}
|
||||
|
||||
int hi_init() {
|
||||
assert(!module_infos);
|
||||
|
||||
ModuleInfos *infos = gather_shared_libraries();
|
||||
if (!infos) {
|
||||
fprintf(stderr, "Failed to gather module infos.\n");
|
||||
return 1;
|
||||
}
|
||||
if (module_infos) {
|
||||
free_module_infos(module_infos);
|
||||
}
|
||||
module_infos = infos;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void hi_deinit() { free_module_infos(module_infos); }
|
||||
|
||||
/**
|
||||
* Reloads a shared library module
|
||||
*
|
||||
@@ -261,3 +249,31 @@ void hi_print_module_infos() {
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
int hi_init() {
|
||||
assert(!module_infos);
|
||||
|
||||
if (sc_log_init() != 0) {
|
||||
fprintf(stderr, "Failed to init logger.\n");
|
||||
return 1;
|
||||
}
|
||||
sc_log_set_level("DEBUG");
|
||||
|
||||
read_memory_maps_self();
|
||||
|
||||
ModuleInfos *infos = gather_shared_libraries();
|
||||
if (!infos) {
|
||||
fprintf(stderr, "Failed to gather module infos.\n");
|
||||
return 1;
|
||||
}
|
||||
if (module_infos) {
|
||||
free_module_infos(module_infos);
|
||||
}
|
||||
module_infos = infos;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void hi_deinit() {
|
||||
free_module_infos(module_infos);
|
||||
sc_log_term();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user