diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2014-08-05 20:19:08 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2014-08-05 20:19:08 (GMT) |
commit | 56ee4d3ecddeee05f11083fcc1595e3756b91790 (patch) | |
tree | 5ec6e5449214093280629047c36016a0de09cbeb /src/arch/dalvik/pseudo | |
parent | a2eb5483fe74923e488013b2d8b94ded6340499e (diff) |
Defined the first steps for a new disassembling approach.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@387 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch/dalvik/pseudo')
-rw-r--r-- | src/arch/dalvik/pseudo/fill.c | 67 | ||||
-rw-r--r-- | src/arch/dalvik/pseudo/switch.c | 66 |
2 files changed, 125 insertions, 8 deletions
diff --git a/src/arch/dalvik/pseudo/fill.c b/src/arch/dalvik/pseudo/fill.c index 702f4b9..acb8551 100644 --- a/src/arch/dalvik/pseudo/fill.c +++ b/src/arch/dalvik/pseudo/fill.c @@ -56,6 +56,12 @@ static void g_dalvik_fill_instr_class_init(GDalvikFillInstrClass *); /* Initialise une instance d'opérande d'architecture. */ static void g_dalvik_fill_instr_init(GDalvikFillInstr *); +/* Supprime toutes les références externes. */ +static void g_dalvik_fill_instr_dispose(GDalvikFillInstr *); + +/* Procède à la libération totale de la mémoire. */ +static void g_dalvik_fill_instr_finalize(GDalvikFillInstr *); + /* Ajoute à un tampon GLib le contenu de l'instance spécifiée. */ static void g_dalvik_fill_instr_print(const GDalvikFillInstr *, GCodeBuffer *, MemoryDataSize, const bin_t *, AsmSyntax); @@ -79,6 +85,17 @@ G_DEFINE_TYPE(GDalvikFillInstr, g_dalvik_fill_instr, G_TYPE_DALVIK_INSTRUCTION); static void g_dalvik_fill_instr_class_init(GDalvikFillInstrClass *klass) { + GObjectClass *object; /* Autre version de la classe */ + GArchInstructionClass *instr; /* Encore une autre vision... */ + + object = G_OBJECT_CLASS(klass); + + object->dispose = (GObjectFinalizeFunc/* ! */)g_dalvik_fill_instr_dispose; + object->finalize = (GObjectFinalizeFunc)g_dalvik_fill_instr_finalize; + + instr = G_ARCH_INSTRUCTION_CLASS(klass); + + instr->print = (print_instruction_fc)g_dalvik_fill_instr_print; } @@ -97,11 +114,44 @@ static void g_dalvik_fill_instr_class_init(GDalvikFillInstrClass *klass) static void g_dalvik_fill_instr_init(GDalvikFillInstr *instr) { - GArchInstruction *parent; /* Instance parente */ - parent = G_ARCH_INSTRUCTION(instr); +} + + +/****************************************************************************** +* * +* Paramètres : instr = instance d'objet GLib à traiter. * +* * +* Description : Supprime toutes les références externes. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ - parent->print = (print_instruction_fc)g_dalvik_fill_instr_print; +static void g_dalvik_fill_instr_dispose(GDalvikFillInstr *instr) +{ + G_OBJECT_CLASS(g_dalvik_fill_instr_parent_class)->dispose(G_OBJECT(instr)); + +} + + +/****************************************************************************** +* * +* Paramètres : instr = instance d'objet GLib à traiter. * +* * +* Description : Procède à la libération totale de la mémoire. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_dalvik_fill_instr_finalize(GDalvikFillInstr *instr) +{ + G_OBJECT_CLASS(g_dalvik_fill_instr_parent_class)->finalize(G_OBJECT(instr)); } @@ -179,13 +229,20 @@ static void g_dalvik_fill_instr_print(const GDalvikFillInstr *instr, GCodeBuffer base = G_ARCH_INSTRUCTION(instr); + line = NULL; + + +#if 0 + line = g_code_buffer_append_new_line(buffer, base->address); /* Adresse virtuelle ou physique */ len = vmpa_to_string(base->address, msize, address); - g_buffer_line_insert_text(line, BLC_ADDRESS, address, len, RTT_RAW); + g_buffer_line_insert_text(line, BLC_PHYSICAL, address, len, RTT_RAW); + + /* TODO ... */ /* Code brut */ @@ -204,6 +261,8 @@ static void g_dalvik_fill_instr_print(const GDalvikFillInstr *instr, GCodeBuffer free(bin_code); +#endif + /* Instruction proprement dite */ key = "<fill-array>"; diff --git a/src/arch/dalvik/pseudo/switch.c b/src/arch/dalvik/pseudo/switch.c index c97c82b..169c5bf 100644 --- a/src/arch/dalvik/pseudo/switch.c +++ b/src/arch/dalvik/pseudo/switch.c @@ -55,6 +55,12 @@ static void g_dalvik_switch_instr_class_init(GDalvikSwitchInstrClass *); /* Initialise une instance d'opérande d'architecture. */ static void g_dalvik_switch_instr_init(GDalvikSwitchInstr *); +/* Supprime toutes les références externes. */ +static void g_dalvik_switch_instr_dispose(GDalvikSwitchInstr *); + +/* Procède à la libération totale de la mémoire. */ +static void g_dalvik_switch_instr_finalize(GDalvikSwitchInstr *); + /* Ajoute à un tampon GLib le contenu de l'instance spécifiée. */ static void g_dalvik_switch_instr_print(const GDalvikSwitchInstr *, GCodeBuffer *, MemoryDataSize, const bin_t *, AsmSyntax); @@ -78,6 +84,17 @@ G_DEFINE_TYPE(GDalvikSwitchInstr, g_dalvik_switch_instr, G_TYPE_DALVIK_INSTRUCTI static void g_dalvik_switch_instr_class_init(GDalvikSwitchInstrClass *klass) { + GObjectClass *object; /* Autre version de la classe */ + GArchInstructionClass *instr; /* Encore une autre vision... */ + + object = G_OBJECT_CLASS(klass); + + object->dispose = (GObjectFinalizeFunc/* ! */)g_dalvik_switch_instr_dispose; + object->finalize = (GObjectFinalizeFunc)g_dalvik_switch_instr_finalize; + + instr = G_ARCH_INSTRUCTION_CLASS(klass); + + instr->print = (print_instruction_fc)g_dalvik_switch_instr_print; } @@ -96,11 +113,44 @@ static void g_dalvik_switch_instr_class_init(GDalvikSwitchInstrClass *klass) static void g_dalvik_switch_instr_init(GDalvikSwitchInstr *instr) { - GArchInstruction *parent; /* Instance parente */ - parent = G_ARCH_INSTRUCTION(instr); +} + + +/****************************************************************************** +* * +* Paramètres : instr = instance d'objet GLib à traiter. * +* * +* Description : Supprime toutes les références externes. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_dalvik_switch_instr_dispose(GDalvikSwitchInstr *instr) +{ + G_OBJECT_CLASS(g_dalvik_switch_instr_parent_class)->dispose(G_OBJECT(instr)); + +} - parent->print = (print_instruction_fc)g_dalvik_switch_instr_print; + +/****************************************************************************** +* * +* Paramètres : instr = instance d'objet GLib à traiter. * +* * +* Description : Procède à la libération totale de la mémoire. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_dalvik_switch_instr_finalize(GDalvikSwitchInstr *instr) +{ + G_OBJECT_CLASS(g_dalvik_switch_instr_parent_class)->finalize(G_OBJECT(instr)); } @@ -182,13 +232,19 @@ static void g_dalvik_switch_instr_print(const GDalvikSwitchInstr *instr, GCodeBu base = G_ARCH_INSTRUCTION(instr); + line = NULL; + + +#if 0 line = g_code_buffer_append_new_line(buffer, base->address); /* Adresse virtuelle ou physique */ len = vmpa_to_string(base->address, msize, address); - g_buffer_line_insert_text(line, BLC_ADDRESS, address, len, RTT_RAW); + g_buffer_line_insert_text(line, BLC_PHYSICAL, address, len, RTT_RAW); + + /* TODO ... */ /* Code brut */ @@ -207,6 +263,8 @@ static void g_dalvik_switch_instr_print(const GDalvikSwitchInstr *instr, GCodeBu free(bin_code); +#endif + /* Instruction proprement dite */ key = "<fill-array>"; |