summaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-03-02 14:33:09 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-03-02 14:33:09 (GMT)
commitb3471e0c9ce6cc1becc9f56832fb4b93b337cb21 (patch)
treed32db80f05296ec918ad24d93634ea7d3832e49e /src/arch
parent027305c2447b05de2c576e3f5ee32ced400f439f (diff)
Filled rendering lines with relative binary contents.
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/instruction-int.h1
-rw-r--r--src/arch/instruction.c26
-rw-r--r--src/arch/instruction.h3
-rw-r--r--src/arch/raw.c2
-rw-r--r--src/arch/undefined.c2
5 files changed, 34 insertions, 0 deletions
diff --git a/src/arch/instruction-int.h b/src/arch/instruction-int.h
index e7d5ba0..89f589a 100644
--- a/src/arch/instruction-int.h
+++ b/src/arch/instruction-int.h
@@ -53,6 +53,7 @@ struct _GArchInstruction
const instr_hook_fc *hooks; /* Traitements complémentaires */
+ const GBinContent *content; /* Contenu binaire global */
mrange_t range; /* Emplacement en mémoire */
GArchOperand **operands; /* Liste des opérandes */
diff --git a/src/arch/instruction.c b/src/arch/instruction.c
index f539ddb..be049e1 100644
--- a/src/arch/instruction.c
+++ b/src/arch/instruction.c
@@ -190,6 +190,9 @@ static void g_arch_instruction_interface_init(GLineGeneratorInterface *iface)
static void g_arch_instruction_dispose(GArchInstruction *instr)
{
+ if (instr->content != NULL)
+ g_object_unref(G_OBJECT(instr->content));
+
G_OBJECT_CLASS(g_arch_instruction_parent_class)->dispose(G_OBJECT(instr));
}
@@ -324,6 +327,27 @@ void g_arch_instruction_call_hook(GArchInstruction *instr, InstrProcessHook type
/******************************************************************************
* *
* Paramètres : instr = instruction quelconque à modifier. *
+* content = contenu binaire global à référencer. *
+* *
+* Description : Note le contenu du sein duquel l'instruction est issue. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void g_arch_instruction_set_global_content(GArchInstruction *instr, const GBinContent *content)
+{
+ g_object_ref(G_OBJECT(content));
+ instr->content = content;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : instr = instruction quelconque à modifier. *
* address = adresse virtuelle et/ou position physique. *
* length = taille de l'instruction. *
* *
@@ -1140,6 +1164,8 @@ static void _g_arch_instruction_print(GArchInstruction *instr, GBufferLine *line
g_buffer_line_fill_vmpa(line, get_mrange_addr(&instr->range), MDS_32_BITS_UNSIGNED, MDS_32_BITS_UNSIGNED);
+ g_buffer_line_fill_content(line, instr->content, &instr->range, VMPA_NO_PHYSICAL);
+
/* Instruction proprement dite */
key = g_arch_instruction_get_keyword(instr, 0/*, syntax*/);
diff --git a/src/arch/instruction.h b/src/arch/instruction.h
index 7323a2e..27c28f5 100644
--- a/src/arch/instruction.h
+++ b/src/arch/instruction.h
@@ -107,6 +107,9 @@ void g_arch_instruction_set_hooks(GArchInstruction *, const instr_hook_fc [IPH_C
/* Complète un désassemblage accompli pour une instruction. */
void g_arch_instruction_call_hook(GArchInstruction *, InstrProcessHook, GArchProcessor *, GProcContext *, GExeFormat *);
+/* Note le contenu du sein duquel l'instruction est issue. */
+void g_arch_instruction_set_global_content(GArchInstruction *, const GBinContent *);
+
/* Définit la localisation d'une instruction. */
void g_arch_instruction_set_range(GArchInstruction *, const mrange_t *);
diff --git a/src/arch/raw.c b/src/arch/raw.c
index 8a44972..9b4a57d 100644
--- a/src/arch/raw.c
+++ b/src/arch/raw.c
@@ -479,6 +479,8 @@ static void g_raw_instruction_print(GRawInstruction *instr, GBufferLine *line, s
{
g_buffer_line_fill_vmpa(line, get_mrange_addr(&base->range), MDS_32_BITS_UNSIGNED, MDS_32_BITS_UNSIGNED);
+ g_buffer_line_fill_content(line, base->content, &base->range, VMPA_NO_PHYSICAL);
+
/* Instruction proprement dite */
key = g_arch_instruction_get_keyword(base, 0/*, syntax*/);
diff --git a/src/arch/undefined.c b/src/arch/undefined.c
index 39b3e8b..8741c43 100644
--- a/src/arch/undefined.c
+++ b/src/arch/undefined.c
@@ -286,6 +286,8 @@ static void g_undef_instruction_print(GUndefInstruction *instr, GBufferLine *lin
g_buffer_line_fill_vmpa(line, get_mrange_addr(&base->range), MDS_32_BITS_UNSIGNED, MDS_32_BITS_UNSIGNED);
+ g_buffer_line_fill_content(line, base->content, &base->range, VMPA_NO_PHYSICAL);
+
/* Instruction proprement dite */
key = g_arch_instruction_get_keyword(base, 0/*, syntax*/);