summaryrefslogtreecommitdiff
path: root/plugins/dalvik/pseudo/switch.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/dalvik/pseudo/switch.c')
-rw-r--r--plugins/dalvik/pseudo/switch.c38
1 files changed, 35 insertions, 3 deletions
diff --git a/plugins/dalvik/pseudo/switch.c b/plugins/dalvik/pseudo/switch.c
index 90cff87..d6d255c 100644
--- a/plugins/dalvik/pseudo/switch.c
+++ b/plugins/dalvik/pseudo/switch.c
@@ -28,6 +28,7 @@
#include <malloc.h>
+#include "identifiers.h"
#include "../instruction-int.h"
@@ -68,6 +69,9 @@ static void g_dalvik_switch_instr_finalize(GDalvikSwitchInstr *);
/* Lit toutes les valeurs associés aux branchements. */
static bool g_dalvik_switch_decode_data(GDalvikSwitchInstr *, const GBinContent *, const vmpa2t *);
+/* Fournit le nom humain de l'instruction manipulée. */
+static const char *g_dalvik_switch_instruction_get_keyword(const GDalvikSwitchInstr *, AsmSyntax);
+
/* Indique le type défini pour une pseudo-instruction Dalvik de remplissage. */
@@ -89,12 +93,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->get_keyword = (get_instruction_keyword_fc)g_dalvik_switch_instruction_get_keyword;
+
}
@@ -112,7 +121,6 @@ static void g_dalvik_switch_instr_class_init(GDalvikSwitchInstrClass *klass)
static void g_dalvik_switch_instr_init(GDalvikSwitchInstr *instr)
{
- G_DALVIK_INSTRUCTION(instr)->keyword = "switch-data";
}
@@ -185,7 +193,7 @@ GArchInstruction *g_dalvik_switch_instr_new(uint16_t ident, GDalvikContext *ctx,
result = g_object_new(G_TYPE_DALVIK_SWITCH_INSTR, NULL);
- G_DALVIK_INSTRUCTION(result)->ptype = ident;
+ G_ARCH_INSTRUCTION(result)->uid = ident;
if (!g_binary_content_read_u16(content, pos, SRE_LITTLE, &result->switch_size))
goto gdsin_bad;
@@ -237,7 +245,7 @@ static bool g_dalvik_switch_decode_data(GDalvikSwitchInstr *instr, const GBinCon
copy_vmpa(&iter, pos);
- if (G_DALVIK_INSTRUCTION(instr)->ptype == DPO_PACKED_SWITCH)
+ if (G_ARCH_INSTRUCTION(instr)->uid == DPO_PACKED_SWITCH)
{
if (!g_binary_content_read_s32(content, &iter, SRE_LITTLE, &first_key))
goto gdsdd_bad;
@@ -276,6 +284,30 @@ static bool g_dalvik_switch_decode_data(GDalvikSwitchInstr *instr, const GBinCon
/******************************************************************************
* *
+* Paramètres : instr = instruction d'assemblage à consulter. *
+* syntax = type de représentation demandée. *
+* *
+* Description : Fournit le nom humain de l'instruction manipulée. *
+* *
+* Retour : Mot clef de bas niveau. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static const char *g_dalvik_switch_instruction_get_keyword(const GDalvikSwitchInstr *instr, AsmSyntax syntax)
+{
+ const char *result; /* Désignation à retourner */
+
+ result = "switch-data";
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : instr = instruction d'assemblage à compléter. *
* keys = tableau renseignant les conditions de saut. [OUT] *
* targets = tableau renseignant les sauts relatifs. [OUT] *