summaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-08-02 22:25:15 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-08-02 22:25:15 (GMT)
commit8c84aa2e41305fd388b7dac49f29ae17ee0554fb (patch)
tree52830a7d896e2d9272e7c71677c72ce9d62cf26c /src/arch
parent30fc2ba22b469e38bc40e47f517988e418c178f3 (diff)
Introduced symbols dedicated to strings.
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/target.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/arch/target.c b/src/arch/target.c
index bdae746..a2e1f34 100644
--- a/src/arch/target.c
+++ b/src/arch/target.c
@@ -37,6 +37,7 @@
#include "../analysis/routine.h"
#include "../common/extstr.h"
#include "../format/format.h"
+#include "../format/strsym.h"
#include "../glibext/gbinarycursor.h"
@@ -422,8 +423,8 @@ static char *g_target_operand_build_tooltip(const GTargetOperand *operand, const
result = g_binary_routine_build_tooltip(G_BIN_ROUTINE(operand->symbol), binary);
break;
- case STP_STRING:
case STP_RO_STRING:
+ case STP_DYN_STRING:
srange = g_binary_symbol_get_range(operand->symbol);
@@ -499,9 +500,10 @@ bool g_target_operand_resolve(GTargetOperand *operand, GBinFormat *format, bool
{
bool result; /* Bilan à retourner */
GBinSymbol *symbol; /* Facilités d'accès au symbole*/
- SymbolType stype; /* Type de symbole trouvé */
- const mrange_t *range; /* Couverture du symbole */
char *label; /* Désignation de la chaîne */
+#ifndef NDEBUG
+ const mrange_t *range; /* Couverture du symbole */
+#endif
if (operand->symbol != NULL)
g_object_unref(G_OBJECT(operand->symbol));
@@ -528,9 +530,7 @@ bool g_target_operand_resolve(GTargetOperand *operand, GBinFormat *format, bool
{
symbol = operand->symbol;
- stype = g_binary_symbol_get_target_type(symbol);
-
- if (stype == STP_STRING || stype == STP_RO_STRING)
+ if (G_IS_STR_SYMBOL(symbol))
{
label = g_binary_symbol_get_label(symbol);
@@ -539,15 +539,13 @@ bool g_target_operand_resolve(GTargetOperand *operand, GBinFormat *format, bool
else
{
+#ifndef NDEBUG
range = g_binary_symbol_get_range(symbol);
assert(cmp_vmpa(&operand->addr, get_mrange_addr(range)) == 0);
+#endif
- label = create_string_label(format, get_mrange_addr(range), get_mrange_length(range));
-
- g_binary_symbol_set_alt_label(symbol, label);
-
- free(label);
+ g_string_symbol_build_label(G_STR_SYMBOL(symbol), format);
}