summaryrefslogtreecommitdiff
path: root/src/format
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-04-19 19:25:04 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-04-19 19:25:04 (GMT)
commitc177597d6da5dedb32aa176e8370db8ffb7f87aa (patch)
tree26f7eb2702ba4aa3dfd7267d74fe78ad79791a8c /src/format
parent35f37c72e9d81e478395914da6c10b3c546761a7 (diff)
Handled static strings as well as dynamic strings in comments.
Diffstat (limited to 'src/format')
-rw-r--r--src/format/symbol.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/format/symbol.h b/src/format/symbol.h
index 2b8abf8..7389195 100644
--- a/src/format/symbol.h
+++ b/src/format/symbol.h
@@ -147,7 +147,23 @@ GDbComment *g_binary_symbol_get_comment(const GBinSymbol *);
bool __result; \
const vmpa2t *__addr; \
__addr = get_mrange_addr(g_arch_instruction_get_range(_ins)); \
- _cmt = g_db_comment_new_inlined(__addr, BLF_HAS_CODE, _txt, false); \
+ _cmt = g_db_comment_new_inlined(__addr, BLF_HAS_CODE, false); \
+ g_db_comment_add_static_text(_cmt, strdup(_txt)); /* ! */ \
+ g_db_item_set_volatile(G_DB_ITEM(_cmt), true); \
+ _sym = g_binary_symbol_new(STP_DATA); \
+ g_binary_symbol_attach_instruction(_sym, _ins); \
+ g_binary_symbol_set_comment(_sym, _cmt); \
+ __result = g_binary_format_add_symbol(G_BIN_FORMAT(_fmt), _sym); \
+ __result; \
+ })
+
+#define ADD_RAW_AS_SYM_CST(_fmt, _sym, _ins, _cmt, _txt) \
+ ({ \
+ bool __result; \
+ const vmpa2t *__addr; \
+ __addr = get_mrange_addr(g_arch_instruction_get_range(_ins)); \
+ _cmt = g_db_comment_new_inlined(__addr, BLF_HAS_CODE, false); \
+ g_db_comment_add_static_text(_cmt, _txt); \
g_db_item_set_volatile(G_DB_ITEM(_cmt), true); \
_sym = g_binary_symbol_new(STP_DATA); \
g_binary_symbol_attach_instruction(_sym, _ins); \