summaryrefslogtreecommitdiff
path: root/src/arch/immediate.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2009-08-09 18:12:27 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2009-08-09 18:12:27 (GMT)
commit5cd25c4adfe0426520a51a76de3f77c77cfa4b8e (patch)
tree396514971fb78e81b7bb55c9cd3331d87b45ca9a /src/arch/immediate.c
parentd02deb2425d6559c357bdd00e1c0fb05f35d5fc9 (diff)
Reorganized the way formats are handled (Java and PE got disabled, Dwarf is empty).
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@105 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch/immediate.c')
-rw-r--r--src/arch/immediate.c27
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, " &lt;%s&gt;", label);
else snprintf(buffer, 256, " &lt;%s+0x%llx&gt;", label, address);
result = stradd(result, buffer);
break;
case STP_STRING:
- label = escape_crlf(label);
- label = strrpl(label, "<", "&lt;");
- label = strrpl(label, ">", "&gt;");
- snprintf(buffer, 256, " \"%s\"", label);
+ printable = strdup(label);
+ printable = escape_crlf(printable);
+ printable = strrpl(printable, "<", "&lt;");
+ printable = strrpl(printable, ">", "&gt;");
+ snprintf(buffer, 256, " \"%s\"", printable);
result = stradd(result, buffer);
+ free(printable);
break;
}
- free(label);
-
}
}