summaryrefslogtreecommitdiff
path: root/src/format/symbol.h
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2014-08-25 21:03:25 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2014-08-25 21:03:25 (GMT)
commit90a79bf4c2c21715e5ef9d8a370928d218c08784 (patch)
tree57afefc5caa098f4c34ac2d382d085f736245990 /src/format/symbol.h
parentdd51bdbc51abec252ad5169d722a8b6faa53c1ac (diff)
Loaded lots of ELF header information as symbols.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@393 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/format/symbol.h')
-rw-r--r--src/format/symbol.h31
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 */