2023-03-10 10:32:50 +00:00
|
|
|
// This file is part of noxos and licensed under the MIT open source license
|
2023-02-28 20:13:51 +00:00
|
|
|
|
|
|
|
#ifndef NOX_SYMBOLS_H
|
|
|
|
#define NOX_SYMBOLS_H
|
|
|
|
|
|
|
|
#include "utils/string.h"
|
2023-06-06 20:28:47 +00:00
|
|
|
#include "utils/hashmap.h"
|
2023-02-28 20:13:51 +00:00
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
SYMBOL_FUNCTION,
|
|
|
|
SYMBOL_VARIABLE,
|
|
|
|
SYMBOL_UNKNOWN
|
|
|
|
} symbol_type_E;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
string_t name;
|
|
|
|
symbol_type_E type;
|
|
|
|
uint64_t address;
|
|
|
|
} symbol_T;
|
|
|
|
|
2023-06-06 20:28:47 +00:00
|
|
|
typedef struct {
|
|
|
|
hashmap_T hashmap;
|
|
|
|
uint64_t num_symbols;
|
|
|
|
symbol_T* symbols;
|
|
|
|
uint64_t symbols_index;
|
|
|
|
} symbol_table_T;
|
|
|
|
|
|
|
|
symbol_table_T symbol_table_init (uint64_t num_symbols);
|
|
|
|
void symbol_table_destruct (symbol_table_T* symbol_table);
|
|
|
|
void symbol_table_insert (symbol_table_T* symbol_table, symbol_T symbol);
|
|
|
|
symbol_T* symbol_resolve_from_name (symbol_table_T* symbol_table, string_t name);
|
|
|
|
symbol_T* symbol_resolve_from_rip (symbol_table_T* symbol_table, uint64_t rip);
|
2023-03-01 20:58:14 +00:00
|
|
|
|
2023-02-28 20:13:51 +00:00
|
|
|
#endif //NOX_SYMBOLS_H
|