From 0ad788465c7505bdadff64c2f3af3ad5edf71cc3 Mon Sep 17 00:00:00 2001 From: Quentin LADEVIE Date: Wed, 30 Apr 2025 00:17:19 +0200 Subject: Compiles files one by one --- include/hashmap.h | 26 ++++++++++++++++++++++++++ include/module.h | 22 ++++++++++++++++++++++ include/pdb.h | 6 +++++- include/stack_walk.h | 3 +++ include/types.h | 2 ++ 5 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 include/hashmap.h create mode 100644 include/stack_walk.h (limited to 'include') diff --git a/include/hashmap.h b/include/hashmap.h new file mode 100644 index 0000000..88490e7 --- /dev/null +++ b/include/hashmap.h @@ -0,0 +1,26 @@ +#pragma once + +#include "types.h" + +struct element { + u64 name; + u32 start; + u32 end; + u32 unwind_offset; + u32 psl; +}; + +struct hashmap { + u32 capacity; + u32 size; + + struct element* arr; +}; + +extern struct hashmap create_unordered_flat(); + +extern struct element* insert_elem(struct hashmap* map, u32 start, u32 end, u64 name); + +extern struct element* find_elem(struct hashmap* map, u32 start); + +extern void iterate(struct hashmap* map); diff --git a/include/module.h b/include/module.h index 8a1858f..e94e156 100644 --- a/include/module.h +++ b/include/module.h @@ -3,17 +3,39 @@ #include #include "types.h" +#include "hashmap.h" struct module { void* base_addr; + u8** functions_name; + u32* functions_start; + u32* functions_end; + u32* functions_unwind; + u32 functions_count; + u32 functions_capacity; + // u32 functions_name_capacity; + // u32 function_start_capacity; + // u32 function_end_capacity; + // u32 function_unwind_capacity; + IMAGE_DOS_HEADER dos_header; IMAGE_NT_HEADERS64 nt_header; +#ifdef HASHMAP + struct hashmap symbols; +#endif u8 name[256U]; }; + extern struct module modules[64U]; extern u64 modules_list; extern u8 add_module(); extern void remove_module(u8 index); + +#ifdef HASHMAP +extern struct element* find_function(struct module* module, u32 rip_offset); +#else +extern u32 find_function(struct module* module, u64 rip_offset); +#endif // HASHMAP diff --git a/include/pdb.h b/include/pdb.h index eee19ae..965ccc3 100644 --- a/include/pdb.h +++ b/include/pdb.h @@ -1 +1,5 @@ -extern void open_pdb(const char* pdb_path); +#pragma once + +#include "module.h" + +extern void open_pdb(const char* pdb_path, struct module* module); diff --git a/include/stack_walk.h b/include/stack_walk.h new file mode 100644 index 0000000..783cbb9 --- /dev/null +++ b/include/stack_walk.h @@ -0,0 +1,3 @@ +#pragma once + +extern void walk_stack(void* ctx); diff --git a/include/types.h b/include/types.h index a3b0942..463b73f 100644 --- a/include/types.h +++ b/include/types.h @@ -1,3 +1,5 @@ +#pragma once + #include typedef uint8_t u8; -- cgit v1.3