35 lines
974 B
C
35 lines
974 B
C
// This file is part of noxos and licensed under the MIT open source license
|
|
|
|
#ifndef NOX_SYMBOLS_H
|
|
#define NOX_SYMBOLS_H
|
|
|
|
#include "utils/string.h"
|
|
#include "utils/hashmap.h"
|
|
|
|
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;
|
|
|
|
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);
|
|
|
|
#endif //NOX_SYMBOLS_H
|