diff options
Diffstat (limited to 'src/arch/immediate.c')
-rw-r--r-- | src/arch/immediate.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/arch/immediate.c b/src/arch/immediate.c index dde5f02..7ef1220 100644 --- a/src/arch/immediate.c +++ b/src/arch/immediate.c @@ -30,6 +30,7 @@ #include "operand-int.h" +#include "../common/extstr.h" @@ -339,6 +340,12 @@ 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) { char *result; /* Chaîne à retourner */ + char *label; /* Etiquette de symbole */ + SymbolType symtype; /* Type de symbole */ + vmpa_t offset; /* Décallage final constaté */ + char buffer[256]; /* Complément d'information */ + + /* Valeur brute */ result = (char *)calloc(19, sizeof(char)); @@ -412,6 +419,38 @@ static char *g_imm_operand_get_text(const GImmOperand *operand, const exe_format } + /* Complément d'information */ + + if (operand->size == AOS_32_BITS_SIGNED || operand->size == AOS_32_BITS_UNSIGNED) /* FIXME */ + { + offset = operand->unsigned_imm.val32; /* FIXME !!! */ + + if (resolve_exe_symbol(format, &label, &symtype, &offset)) + { + switch (symtype) + { + case STP_SECTION: + if (offset == 0) snprintf(buffer, 256, " <%s>", label); + else snprintf(buffer, 256, " <%s+0x%llx>", label, offset); + result = stradd(result, buffer); + break; + + case STP_STRING: + label = escape_crlf(label); + label = strrpl(label, "<", "<"); + label = strrpl(label, ">", ">"); + snprintf(buffer, 256, " \"%s\"", label); + result = stradd(result, buffer); + break; + + } + + free(label); + + } + + } + return result; } |