summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/arch/arm/v7/fetch.c2
-rw-r--r--src/format/symbol.c14
-rw-r--r--src/format/symbol.h6
3 files changed, 19 insertions, 3 deletions
diff --git a/src/arch/arm/v7/fetch.c b/src/arch/arm/v7/fetch.c
index 7296717..3fa6bbe 100644
--- a/src/arch/arm/v7/fetch.c
+++ b/src/arch/arm/v7/fetch.c
@@ -462,7 +462,7 @@ void help_fetching_with_instruction_ldr_literal_with_orig(GArchInstruction *inst
vmpa2_virt_to_string(get_mrange_addr(range), MDS_32_BITS, loc, NULL);
snprintf(name, name_len, _("Value used @ %s"), loc);
- ADD_RAW_AS_SYM(G_BIN_FORMAT(format), symbol, &sym_addr, sym_instr, comment, name);
+ ADD_RAW_AS_SYM(G_BIN_FORMAT(format), symbol, sym_instr, comment, name);
free(name);
diff --git a/src/format/symbol.c b/src/format/symbol.c
index fb198d9..48f3dbb 100644
--- a/src/format/symbol.c
+++ b/src/format/symbol.c
@@ -598,6 +598,20 @@ GArchInstruction *g_binary_symbol_get_instruction(const GBinSymbol *symbol)
void g_binary_symbol_set_comment(GBinSymbol *symbol, GDbComment *comment)
{
+#ifndef NDEBUG
+ const vmpa2t *saddr; /* Adresse du symbole */
+ const vmpa2t *caddr; /* Adresse du commentaire */
+#endif
+
+#ifndef NDEBUG
+
+ saddr = get_mrange_addr(g_binary_symbol_get_range(symbol));
+ caddr = g_db_comment_get_address(comment);
+
+ assert(cmp_vmpa(saddr, caddr) == 0);
+
+#endif
+
symbol->comment = comment;
}
diff --git a/src/format/symbol.h b/src/format/symbol.h
index ce452f1..8432d8d 100644
--- a/src/format/symbol.h
+++ b/src/format/symbol.h
@@ -136,10 +136,12 @@ GDbComment *g_binary_symbol_get_comment(const GBinSymbol *);
} \
while (0)
-#define ADD_RAW_AS_SYM(_fmt, _sym, _pos, _ins, _cmt, _txt) \
+#define ADD_RAW_AS_SYM(_fmt, _sym, _ins, _cmt, _txt) \
do \
{ \
- _cmt = g_db_comment_new_inlined(_pos, BLF_HAS_CODE, _txt, false); \
+ 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); \
g_db_item_set_volatile(G_DB_ITEM(_cmt), true); \
_sym = g_binary_symbol_new(STP_DATA); \
g_binary_symbol_attach_instruction(_sym, _ins); \