summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2020-07-26 19:13:51 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2020-07-26 19:13:51 (GMT)
commitba30fbc703ff3ad77bb5df6c167809955215d49c (patch)
treeef3b8dda358be68b834503f794836d7dde17dabf /src
parenta6c46fc296db67321db3d4bb586346998de90422 (diff)
Avoided fixed columns when filling lines with locations.
Diffstat (limited to 'src')
-rw-r--r--src/arch/instruction.c5
-rw-r--r--src/arch/instructions/raw.c7
-rw-r--r--src/arch/instructions/undefined.c5
-rw-r--r--src/format/symbol.c5
-rw-r--r--src/glibext/bufferline.c40
-rw-r--r--src/glibext/bufferline.h7
-rw-r--r--src/glibext/gbinportion.c5
-rw-r--r--src/glibext/generators/hex.c2
-rw-r--r--src/glibext/generators/rborder.c5
9 files changed, 37 insertions, 44 deletions
diff --git a/src/arch/instruction.c b/src/arch/instruction.c
index 6bc158f..73b68f2 100644
--- a/src/arch/instruction.c
+++ b/src/arch/instruction.c
@@ -34,6 +34,7 @@
#include "storage.h"
#include "../glibext/gbinarycursor.h"
#include "../glibext/linegen-int.h"
+#include "../gtkext/gtkblockdisplay.h"
@@ -1962,7 +1963,9 @@ static void _g_arch_instruction_print(GArchInstruction *instr, GBufferLine *line
size_t i; /* Boucle de parcours */
GArchOperand *op; /* Opérande à manipuler */
- g_buffer_line_fill_vmpa(line, get_mrange_addr(&instr->range), MDS_32_BITS_UNSIGNED, MDS_32_BITS_UNSIGNED);
+ g_buffer_line_fill_phys(line, DLC_PHYSICAL, MDS_32_BITS_UNSIGNED, get_mrange_addr(&instr->range));
+
+ g_buffer_line_fill_virt(line, DLC_VIRTUAL, MDS_32_BITS_UNSIGNED, get_mrange_addr(&instr->range));
g_buffer_line_fill_content(line, content, &instr->range, VMPA_NO_PHYSICAL);
diff --git a/src/arch/instructions/raw.c b/src/arch/instructions/raw.c
index 05eb886..84a79e9 100644
--- a/src/arch/instructions/raw.c
+++ b/src/arch/instructions/raw.c
@@ -1,6 +1,6 @@
/* Chrysalide - Outil d'analyse de fichiers binaires
- * artificial.c - instructions pures vues de l'esprit
+ * raw.c - instructions pures vues de l'esprit
*
* Copyright (C) 2014-2020 Cyrille Bagard
*
@@ -35,6 +35,7 @@
#include "../instruction-int.h"
#include "../operands/immediate.h"
#include "../operands/target.h"
+#include "../../gtkext/gtkblockdisplay.h"
@@ -629,7 +630,9 @@ static void g_raw_instruction_print(GRawInstruction *instr, GBufferLine *line, s
/* Localisation */
- g_buffer_line_fill_vmpa(line, get_mrange_addr(&base->range), MDS_32_BITS_UNSIGNED, MDS_32_BITS_UNSIGNED);
+ g_buffer_line_fill_phys(line, DLC_PHYSICAL, MDS_32_BITS_UNSIGNED, get_mrange_addr(&base->range));
+
+ g_buffer_line_fill_virt(line, DLC_VIRTUAL, MDS_32_BITS_UNSIGNED, get_mrange_addr(&base->range));
/* Contenu */
diff --git a/src/arch/instructions/undefined.c b/src/arch/instructions/undefined.c
index 6d90a1c..1623d7b 100644
--- a/src/arch/instructions/undefined.c
+++ b/src/arch/instructions/undefined.c
@@ -31,6 +31,7 @@
#include "undefined-int.h"
+#include "../../gtkext/gtkblockdisplay.h"
@@ -385,7 +386,9 @@ static void g_undef_instruction_print(GUndefInstruction *instr, GBufferLine *lin
base = G_ARCH_INSTRUCTION(instr);
- g_buffer_line_fill_vmpa(line, get_mrange_addr(&base->range), MDS_32_BITS_UNSIGNED, MDS_32_BITS_UNSIGNED);
+ g_buffer_line_fill_phys(line, DLC_PHYSICAL, MDS_32_BITS_UNSIGNED, get_mrange_addr(&base->range));
+
+ g_buffer_line_fill_virt(line, DLC_VIRTUAL, MDS_32_BITS_UNSIGNED, get_mrange_addr(&base->range));
g_buffer_line_fill_content(line, content, &base->range, VMPA_NO_PHYSICAL);
diff --git a/src/format/symbol.c b/src/format/symbol.c
index d2faf7c..918b006 100644
--- a/src/format/symbol.c
+++ b/src/format/symbol.c
@@ -32,6 +32,7 @@
#include "symbol-int.h"
#include "../glibext/gbinarycursor.h"
#include "../glibext/linegen-int.h"
+#include "../gtkext/gtkblockdisplay.h"
@@ -842,7 +843,9 @@ static void g_binary_symbol_print(GBinSymbol *symbol, GBufferLine *line, size_t
{
char *label; /* Etiquette à insérer */
- g_buffer_line_fill_vmpa(line, get_mrange_addr(&symbol->range), MDS_32_BITS_UNSIGNED, MDS_32_BITS_UNSIGNED);
+ g_buffer_line_fill_phys(line, DLC_PHYSICAL, MDS_32_BITS_UNSIGNED, get_mrange_addr(&symbol->range));
+
+ g_buffer_line_fill_virt(line, DLC_VIRTUAL, MDS_32_BITS_UNSIGNED, get_mrange_addr(&symbol->range));
label = g_binary_symbol_get_label(symbol);
diff --git a/src/glibext/bufferline.c b/src/glibext/bufferline.c
index 2f694dd..ba25b8f 100644
--- a/src/glibext/bufferline.c
+++ b/src/glibext/bufferline.c
@@ -288,6 +288,7 @@ const mrange_t *g_buffer_line_get_range(const GBufferLine *line)
/******************************************************************************
* *
* Paramètres : line = ligne à venir compléter. *
+* col = indice de la colonne à constituer. *
* size = taille souhaitée de l'impression des positions. *
* addr = localisation physique à venir représenter. *
* *
@@ -299,7 +300,7 @@ const mrange_t *g_buffer_line_get_range(const GBufferLine *line)
* *
******************************************************************************/
-void g_buffer_line_fill_phys(GBufferLine *line, MemoryDataSize size, const vmpa2t *addr)
+void g_buffer_line_fill_phys(GBufferLine *line, size_t col, MemoryDataSize size, const vmpa2t *addr)
{
VMPA_BUFFER(position); /* Emplacement au format texte */
size_t len; /* Taille de l'élément inséré */
@@ -314,9 +315,9 @@ void g_buffer_line_fill_phys(GBufferLine *line, MemoryDataSize size, const vmpa2
i = len - 1;
if (i > 0)
- g_buffer_line_append_text(line, BLC_PHYSICAL, position, i, RTT_PHYS_ADDR_PAD, NULL);
+ g_buffer_line_append_text(line, col, position, i, RTT_PHYS_ADDR_PAD, NULL);
- g_buffer_line_append_text(line, BLC_PHYSICAL, &position[i], len - i, RTT_PHYS_ADDR, NULL);
+ g_buffer_line_append_text(line, col, &position[i], len - i, RTT_PHYS_ADDR, NULL);
}
@@ -324,6 +325,7 @@ void g_buffer_line_fill_phys(GBufferLine *line, MemoryDataSize size, const vmpa2
/******************************************************************************
* *
* Paramètres : line = ligne à venir compléter. *
+* col = indice de la colonne à constituer. *
* size = taille souhaitée de l'impression des positions. *
* addr = localisation virtuelle à venir représenter. *
* *
@@ -335,7 +337,7 @@ void g_buffer_line_fill_phys(GBufferLine *line, MemoryDataSize size, const vmpa2
* *
******************************************************************************/
-void g_buffer_line_fill_virt(GBufferLine *line, MemoryDataSize size, const vmpa2t *addr)
+void g_buffer_line_fill_virt(GBufferLine *line, size_t col, MemoryDataSize size, const vmpa2t *addr)
{
VMPA_BUFFER(position); /* Emplacement au format texte */
size_t len; /* Taille de l'élément inséré */
@@ -352,38 +354,14 @@ void g_buffer_line_fill_virt(GBufferLine *line, MemoryDataSize size, const vmpa2
i = len - 1;
if (i > 0)
- g_buffer_line_append_text(line, BLC_VIRTUAL, position, i, RTT_VIRT_ADDR_PAD, NULL);
+ g_buffer_line_append_text(line, col, position, i, RTT_VIRT_ADDR_PAD, NULL);
- g_buffer_line_append_text(line, BLC_VIRTUAL, &position[i], len - i, RTT_VIRT_ADDR, NULL);
+ g_buffer_line_append_text(line, col, &position[i], len - i, RTT_VIRT_ADDR, NULL);
}
else
- g_buffer_line_append_text(line, BLC_VIRTUAL, position, len, RTT_VIRT_ADDR_PAD, NULL);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : line = ligne à venir compléter. *
-* addr = localisation à afficher. *
-* psize = taille souhaitée de l'impression des positions. *
-* vsize = taille souhaitée de l'impression des adresses. *
-* *
-* Description : Construit le tronc commun d'une ligne autour de sa position. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_buffer_line_fill_vmpa(GBufferLine *line, const vmpa2t *addr, MemoryDataSize psize, MemoryDataSize vsize)
-{
- g_buffer_line_fill_phys(line, psize, addr);
-
- g_buffer_line_fill_virt(line, vsize, addr);
+ g_buffer_line_append_text(line, col, position, len, RTT_VIRT_ADDR_PAD, NULL);
}
diff --git a/src/glibext/bufferline.h b/src/glibext/bufferline.h
index a7982d0..cfb4432 100644
--- a/src/glibext/bufferline.h
+++ b/src/glibext/bufferline.h
@@ -110,13 +110,10 @@ GBufferLine *g_buffer_line_new(const mrange_t *, BufferLineColumn);
const mrange_t *g_buffer_line_get_range(const GBufferLine *);
/* Construit le tronc commun d'une ligne autour de sa position. */
-void g_buffer_line_fill_phys(GBufferLine *, MemoryDataSize, const vmpa2t *);
+void g_buffer_line_fill_phys(GBufferLine *, size_t, MemoryDataSize, const vmpa2t *);
/* Construit le tronc commun d'une ligne autour de sa position. */
-void g_buffer_line_fill_virt(GBufferLine *, MemoryDataSize, const vmpa2t *);
-
-/* Construit le tronc commun d'une ligne autour de sa position. */
-void g_buffer_line_fill_vmpa(GBufferLine *, const vmpa2t *, MemoryDataSize, MemoryDataSize);
+void g_buffer_line_fill_virt(GBufferLine *, size_t, MemoryDataSize, const vmpa2t *);
/* Construit le tronc commun d'une ligne autour de son contenu. */
void g_buffer_line_fill_content(GBufferLine *, const GBinContent *, const mrange_t *, phys_t);
diff --git a/src/glibext/gbinportion.c b/src/glibext/gbinportion.c
index 44053f9..670e0ec 100644
--- a/src/glibext/gbinportion.c
+++ b/src/glibext/gbinportion.c
@@ -40,6 +40,7 @@
#include "../common/sort.h"
#include "../glibext/gbinarycursor.h"
#include "../glibext/linegen-int.h"
+#include "../gtkext/gtkblockdisplay.h"
@@ -1121,7 +1122,9 @@ static void g_binary_portion_print(GBinPortion *portion, GBufferLine *line, size
{
assert(repeat < portion->lcount);
- g_buffer_line_fill_vmpa(line, get_mrange_addr(&portion->range), MDS_32_BITS_UNSIGNED, MDS_32_BITS_UNSIGNED);
+ g_buffer_line_fill_phys(line, DLC_PHYSICAL, MDS_32_BITS_UNSIGNED, get_mrange_addr(&portion->range));
+
+ g_buffer_line_fill_virt(line, DLC_VIRTUAL, MDS_32_BITS_UNSIGNED, get_mrange_addr(&portion->range));
if (portion->text[repeat] != NULL)
{
diff --git a/src/glibext/generators/hex.c b/src/glibext/generators/hex.c
index f08d3fb..9285e00 100644
--- a/src/glibext/generators/hex.c
+++ b/src/glibext/generators/hex.c
@@ -487,7 +487,7 @@ static void g_hex_generator_print(GHexGenerator *generator, GBufferLine *line, s
init_vmpa(&pos, generator->bytes_per_line * index, VMPA_NO_VIRTUAL);
- g_buffer_line_fill_phys(line, MDS_32_BITS_UNSIGNED, &pos);
+ g_buffer_line_fill_phys(line, HLC_PHYSICAL, MDS_32_BITS_UNSIGNED, &pos);
/* Contenu brut */
diff --git a/src/glibext/generators/rborder.c b/src/glibext/generators/rborder.c
index 8ff1271..42ffc23 100644
--- a/src/glibext/generators/rborder.c
+++ b/src/glibext/generators/rborder.c
@@ -33,6 +33,7 @@
#include "../gbinarycursor.h"
#include "../linegen-int.h"
#include "../linesegment.h"
+#include "../../gtkext/gtkblockdisplay.h"
@@ -357,7 +358,9 @@ static void g_border_generator_print(GBorderGenerator *generator, GBufferLine *l
assert(repeat < 3);
- g_buffer_line_fill_vmpa(line, &generator->addr, generator->msize, generator->msize);
+ g_buffer_line_fill_phys(line, DLC_PHYSICAL, generator->msize, &generator->addr);
+
+ g_buffer_line_fill_virt(line, DLC_VIRTUAL, generator->msize, &generator->addr);
if (repeat == 1)
{