diff options
Diffstat (limited to 'src/format/symbol.h')
-rw-r--r-- | src/format/symbol.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/format/symbol.h b/src/format/symbol.h index bfbf541..407375f 100644 --- a/src/format/symbol.h +++ b/src/format/symbol.h @@ -29,6 +29,7 @@ #include "../analysis/routine.h" +#include "../analysis/db/items/comment.h" @@ -92,6 +93,36 @@ void g_binary_symbol_attach_instruction(GBinSymbol *, GArchInstruction *); /* Fournit l'éventuelle instruction associée au symbole. */ GArchInstruction *g_binary_symbol_get_instruction(const GBinSymbol *); +/* Ajoute un commentaire facultatif au symbole. */ +void g_binary_symbol_set_comment(GBinSymbol *, GDbComment *); + +/* Fournit l'éventuel commentaire associé au symbole. */ +GDbComment *g_binary_symbol_get_comment(const GBinSymbol *); + + +/** + * Confort pour l'ajout de symboles basés sur des formats. + */ + +#define SET_IMM_DISPLAY(_ins, _op, _idx, _dsp) \ + do \ + { \ + _op = g_arch_instruction_get_operand(_ins, _idx); \ + g_imm_operand_set_display(G_IMM_OPERAND(_op), _dsp); \ + } \ + while (0) + +#define ADD_RAW_AS_SYM(_fmt, _sym, _pos, _ins, _cmt, _txt) \ + do \ + { \ + _cmt = g_db_comment_new(_pos, _txt, true); \ + _sym = g_binary_symbol_new(STP_DATA, NULL, 0); \ + g_binary_symbol_attach_instruction(_sym, _ins); \ + g_binary_symbol_set_comment(_sym, _cmt); \ + g_binary_format_add_symbol(G_BIN_FORMAT(_fmt), _sym); \ + } \ + while (0) + #endif /* _FORMAT_SYMBOL_H */ |