summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2013-01-09 21:54:28 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2013-01-09 21:54:28 (GMT)
commitc455057e634b30c3214a49db009bad5fd0c631ff (patch)
tree07f0a223787b8a3d3244b10e6969aff5b44fcd80
parent7cc35e17f3af39ad9a23bff93c42d86f73dd1001 (diff)
Fixed immediates output by defining a default column for rendering codes.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@321 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
-rw-r--r--ChangeLog15
-rw-r--r--src/analysis/decomp/decompiler.c2
-rw-r--r--src/analysis/disass/disassembler.c2
-rw-r--r--src/arch/immediate.c2
-rw-r--r--src/glibext/gbufferline.c8
-rw-r--r--src/glibext/gbufferline.h7
-rw-r--r--src/glibext/gcodebuffer.c12
-rw-r--r--src/glibext/gcodebuffer.h2
8 files changed, 38 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index bc68fcf..b081ee7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
13-01-09 Cyrille Bagard <nocbos@gmail.com>
+ * src/analysis/decomp/decompiler.c:
+ * src/analysis/disass/disassembler.c:
+ Setup the buffers with the right values.
+
+ * src/arch/immediate.c:
+ Update code.
+
+ * src/glibext/gbufferline.c:
+ * src/glibext/gbufferline.h:
+ * src/glibext/gcodebuffer.c:
+ * src/glibext/gcodebuffer.h:
+ Fix immediates output by defining a default column for rendering codes.
+
+13-01-09 Cyrille Bagard <nocbos@gmail.com>
+
* src/analysis/block.c:
* src/analysis/block.h:
* src/analysis/block-int.h:
diff --git a/src/analysis/decomp/decompiler.c b/src/analysis/decomp/decompiler.c
index 47c379d..fff654f 100644
--- a/src/analysis/decomp/decompiler.c
+++ b/src/analysis/decomp/decompiler.c
@@ -216,7 +216,7 @@ GCodeBuffer *decompile_all_from_file(const GLoadedBinary *binary, const char *fi
GCodeBuffer *result; /* Tampon constitué à renvoyer */
GExeFormat *format; /* Format du binaire fourni */
- result = g_code_buffer_new();
+ result = g_code_buffer_new(BLC_ASSEMBLY_HEAD);
build_decomp_prologue(result, filename);
diff --git a/src/analysis/disass/disassembler.c b/src/analysis/disass/disassembler.c
index e7c972d..8f1d3f1 100644
--- a/src/analysis/disass/disassembler.c
+++ b/src/analysis/disass/disassembler.c
@@ -402,7 +402,7 @@ void disassemble_binary(GLoadedBinary *binary, GBinPart **parts, size_t parts_co
GDelayedDisassembly *disass; /* Désassemblage à mener */
GWorkQueue *queue; /* Gestionnaire de différés */
- *buffer = g_code_buffer_new();
+ *buffer = g_code_buffer_new(BLC_ASSEMBLY);
data = g_loaded_binary_get_data(binary, &length);
build_disass_prologue(*buffer, g_loaded_binary_get_filename(binary, true), data, length);
diff --git a/src/arch/immediate.c b/src/arch/immediate.c
index e8f0212..19c86b2 100644
--- a/src/arch/immediate.c
+++ b/src/arch/immediate.c
@@ -729,7 +729,7 @@ static void g_imm_operand_print(const GImmOperand *operand, GBufferLine *line, A
len = g_imm_operand_to_string(operand, syntax, value);
- g_buffer_line_insert_text(line, BLC_ASSEMBLY, value, len, RTT_IMMEDIATE);
+ g_buffer_line_insert_text(line, BLC_MAIN, value, len, RTT_IMMEDIATE);
}
diff --git a/src/glibext/gbufferline.c b/src/glibext/gbufferline.c
index 9dc970b..95d6126 100644
--- a/src/glibext/gbufferline.c
+++ b/src/glibext/gbufferline.c
@@ -80,6 +80,7 @@ struct _GBufferLine
GObject parent; /* A laisser en premier */
vmpa_t addr; /* Adresse geographique */
+ BufferLineColumn main_column; /* Colonne principale */
buffer_line_column columns[BLC_COUNT]; /* Répartition du texte */
BufferLineColumn merge_start; /* Début de la zone globale */
@@ -483,6 +484,7 @@ static void g_buffer_line_init(GBufferLine *line)
/******************************************************************************
* *
* Paramètres : addr = adresse où va se situer la ligne. *
+* main = colonne à référencer comme étant la principale. *
* *
* Description : Crée une nouvelle représentation de fragments de texte. *
* *
@@ -492,13 +494,14 @@ static void g_buffer_line_init(GBufferLine *line)
* *
******************************************************************************/
-GBufferLine *g_buffer_line_new(vmpa_t addr)
+GBufferLine *g_buffer_line_new(vmpa_t addr, BufferLineColumn main)
{
GBufferLine *result; /* Composant à retourner */
result = g_object_new(G_TYPE_BUFFER_LINE, NULL);
result->addr = addr;
+ result->main_column = main;
return result;
@@ -625,6 +628,9 @@ void g_buffer_line_insert_text(GBufferLine *line, BufferLineColumn column, const
GBufferLineClass *class; /* Stockage de briques de base */
GBufferSegment *segment; /* Portion de texte à ajouter */
+ if (column == BLC_MAIN)
+ column = line->main_column;
+
if (column == BLC_LAST_USED)
column = line->last_used;
else
diff --git a/src/glibext/gbufferline.h b/src/glibext/gbufferline.h
index 9afff58..6eb4e27 100644
--- a/src/glibext/gbufferline.h
+++ b/src/glibext/gbufferline.h
@@ -62,7 +62,8 @@ typedef enum _BufferLineColumn
BLC_COUNT,
BLC_LAST_USED, /* Dernière colonne utilisée */
- BLC_INVALID /* Valeur de non-initialisation*/
+ BLC_INVALID, /* Valeur de non-initialisation*/
+ BLC_MAIN /* Colonne principale (cf. imm)*/
} BufferLineColumn;
@@ -120,13 +121,13 @@ typedef void (* buffer_line_draw_fc) (GBufferLine *, GdkDrawable *, GdkGC *, gin
GType g_buffer_line_get_type(void);
/* Crée une nouvelle représentation de fragments de texte. */
-GBufferLine *g_buffer_line_new(vmpa_t);
+GBufferLine *g_buffer_line_new(vmpa_t, BufferLineColumn);
/* Indique l'adresse à laquelle se situe la ligne. */
vmpa_t g_buffer_line_get_address(const GBufferLine *);
/* Ajoute un fragment de texte à une colonne de ligne. */
-void g_buffer_line_add_segment(GBufferLine *, BufferLineColumn, GBufferSegment *);
+void g_buffer_line_add_segment(GBufferLine *, BufferLineColumn, GBufferSegment *) __attribute__ ((deprecated));
/* Donne le segment présent à une abscisse donnée. */
GBufferSegment *g_buffer_line_get_segment_at(const GBufferLine *, const gint [BLC_COUNT], gint);
diff --git a/src/glibext/gcodebuffer.c b/src/glibext/gcodebuffer.c
index 22bdcd8..e81966e 100644
--- a/src/glibext/gcodebuffer.c
+++ b/src/glibext/gcodebuffer.c
@@ -94,6 +94,8 @@ struct _GCodeBuffer
{
GObject parent; /* A laisser en premier */
+ BufferLineColumn main_column; /* Colonne principale */
+
GBufferLine **lines; /* Liste des lignes intégrées */
size_t count; /* Quantité en cache */
size_t used; /* Quantité utilisée */
@@ -372,7 +374,7 @@ static void g_code_buffer_init(GCodeBuffer *buffer)
/******************************************************************************
* *
-* Paramètres : - *
+* Paramètres : main = colonne à référencer comme étant la principale. *
* *
* Description : Crée un nouveau composant de tampon pour code désassemblé. *
* *
@@ -382,12 +384,14 @@ static void g_code_buffer_init(GCodeBuffer *buffer)
* *
******************************************************************************/
-GCodeBuffer *g_code_buffer_new(void)
+GCodeBuffer *g_code_buffer_new(BufferLineColumn main)
{
GCodeBuffer *result; /* Composant à retourner */
result = g_object_new(G_TYPE_CODE_BUFFER, NULL);
+ result->main_column = main;
+
return result;
}
@@ -488,7 +492,7 @@ GBufferLine *g_code_buffer_append_new_line(GCodeBuffer *buffer, vmpa_t addr)
buffer->count * sizeof(GBufferLine *));
}
- result = g_buffer_line_new(addr);
+ result = g_buffer_line_new(addr, buffer->main_column);
buffer->lines[buffer->used++] = result;
for (i = 0; i < buffer->indent; i++)
@@ -535,7 +539,7 @@ GBufferLine *g_code_buffer_insert_at(GCodeBuffer *buffer, vmpa_t addr, bool befo
buffer->used++;
- result = g_buffer_line_new(addr);
+ result = g_buffer_line_new(addr, buffer->main_column);
buffer->lines[index] = result;
}
diff --git a/src/glibext/gcodebuffer.h b/src/glibext/gcodebuffer.h
index 725bd1f..fc4bc66 100644
--- a/src/glibext/gcodebuffer.h
+++ b/src/glibext/gcodebuffer.h
@@ -54,7 +54,7 @@ typedef struct _GCodeBufferClass GCodeBufferClass;
GType g_code_buffer_get_type(void);
/* Crée un nouveau composant de tampon pour code désassemblé. */
-GCodeBuffer *g_code_buffer_new(void);
+GCodeBuffer *g_code_buffer_new(BufferLineColumn);
/* FIXME */
#define g_code_buffer_append_new_line_fixme(b) g_code_buffer_append_new_line(b, 0ull)