diff options
Diffstat (limited to 'src/arch/immediate.c')
-rw-r--r-- | src/arch/immediate.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/arch/immediate.c b/src/arch/immediate.c index c57919f..f8bba35 100644 --- a/src/arch/immediate.c +++ b/src/arch/immediate.c @@ -31,6 +31,7 @@ #include "operand-int.h" #include "../common/extstr.h" +#include "../format/format.h" @@ -83,7 +84,7 @@ static void g_imm_operand_class_init(GImmOperandClass *); static void g_imm_operand_init(GImmOperand *); /* Traduit un opérande en version humainement lisible. */ -static char *g_imm_operand_get_text(const GImmOperand *, const exe_format *, AsmSyntax); +static char *g_imm_operand_get_text(const GImmOperand *, const GExeFormat *, AsmSyntax); /* Indique le type défini pour un opérande de valeur numérique. */ @@ -337,12 +338,13 @@ bool g_imm_operand_is_negative(const GImmOperand *operand) * * ******************************************************************************/ -static char *g_imm_operand_get_text(const GImmOperand *operand, const exe_format *format, AsmSyntax syntax) +static char *g_imm_operand_get_text(const GImmOperand *operand, const GExeFormat *format, AsmSyntax syntax) { char *result; /* Chaîne à retourner */ - char *label; /* Etiquette de symbole */ - SymbolType symtype; /* Type de symbole */ vmpa_t address; /* Décallage final constaté */ + const char *label; /* Etiquette de symbole */ + SymbolType symtype; /* Type de symbole */ + char *printable; /* Version texte présentable */ char buffer[256]; /* Complément d'information */ /* Valeur brute */ @@ -437,28 +439,29 @@ static char *g_imm_operand_get_text(const GImmOperand *operand, const exe_format { address = operand->unsigned_imm.val32; /* FIXME !!! */ - if (resolve_exe_symbol(format, &label, &symtype, &address)) + if (g_binary_format_resolve_symbol(G_BIN_FORMAT(format), &label, &symtype, &address)) { switch (symtype) { - case STP_SECTION: + case STP_OBJECT: + case STP_FUNCTION: if (address == 0) snprintf(buffer, 256, " <%s>", label); else snprintf(buffer, 256, " <%s+0x%llx>", label, address); result = stradd(result, buffer); break; case STP_STRING: - label = escape_crlf(label); - label = strrpl(label, "<", "<"); - label = strrpl(label, ">", ">"); - snprintf(buffer, 256, " \"%s\"", label); + printable = strdup(label); + printable = escape_crlf(printable); + printable = strrpl(printable, "<", "<"); + printable = strrpl(printable, ">", ">"); + snprintf(buffer, 256, " \"%s\"", printable); result = stradd(result, buffer); + free(printable); break; } - free(label); - } } |