summaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2013-01-09 20:36:26 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2013-01-09 20:36:26 (GMT)
commit7cc35e17f3af39ad9a23bff93c42d86f73dd1001 (patch)
tree13bf4ab0af8c277b5503720bb45f6a753206d241 /src/arch
parentdcd03173f71b09f38238f50dfcf4c1db0c014c4c (diff)
Restored some parts of the decompilation process using the new basic blocks.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@320 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/dalvik/instruction.c12
-rw-r--r--src/arch/instruction.c29
-rw-r--r--src/arch/instruction.h3
3 files changed, 38 insertions, 6 deletions
diff --git a/src/arch/dalvik/instruction.c b/src/arch/dalvik/instruction.c
index 1c109ba..20982b7 100644
--- a/src/arch/dalvik/instruction.c
+++ b/src/arch/dalvik/instruction.c
@@ -117,12 +117,12 @@ static dalvik_instruction _instructions[DOP_COUNT] = {
[DOP_IF_GE] = { 0x35, "if-ge", dalvik_decomp_instr_if },
[DOP_IF_GT] = { 0x36, "if-gt", dalvik_decomp_instr_if },
[DOP_IF_LE] = { 0x37, "if-le", dalvik_decomp_instr_if },
- [DOP_IF_EQZ] = { 0x38, "if-eqz", dalvik_decomp_instr_if_zero },
- [DOP_IF_NEZ] = { 0x39, "if-nez", dalvik_decomp_instr_if_zero },
- [DOP_IF_LTZ] = { 0x3a, "if-ltz", dalvik_decomp_instr_if_zero },
- [DOP_IF_GEZ] = { 0x3b, "if-gez", dalvik_decomp_instr_if_zero },
- [DOP_IF_GTZ] = { 0x3c, "if-gtz", dalvik_decomp_instr_if_zero },
- [DOP_IF_LEZ] = { 0x3d, "if-lez", dalvik_decomp_instr_if_zero },
+ [DOP_IF_EQZ] = { 0x38, "if-eqz"/*, dalvik_decomp_instr_if_zero*/ },
+ [DOP_IF_NEZ] = { 0x39, "if-nez"/*, dalvik_decomp_instr_if_zero*/ },
+ [DOP_IF_LTZ] = { 0x3a, "if-ltz"/*, dalvik_decomp_instr_if_zero*/ },
+ [DOP_IF_GEZ] = { 0x3b, "if-gez"/*, dalvik_decomp_instr_if_zero*/ },
+ [DOP_IF_GTZ] = { 0x3c, "if-gtz"/*, dalvik_decomp_instr_if_zero*/ },
+ [DOP_IF_LEZ] = { 0x3d, "if-lez"/*, dalvik_decomp_instr_if_zero*/ },
[DOP_UNUSED_3E] = { 0x3e, NULL /* unused */ },
[DOP_UNUSED_3F] = { 0x3f, NULL /* unused */ },
[DOP_UNUSED_40] = { 0x40, NULL /* unused */ },
diff --git a/src/arch/instruction.c b/src/arch/instruction.c
index b460b37..06d3e71 100644
--- a/src/arch/instruction.c
+++ b/src/arch/instruction.c
@@ -448,6 +448,35 @@ size_t g_arch_instruction_get_destinations(const GArchInstruction *instr, GArchI
}
+/******************************************************************************
+* *
+* Paramètres : instr = instruction dont les informations sont à consulter. *
+* type = type de lien recherché. *
+* *
+* Description : Fournit la destination d'une instruction et d'un type donné. *
+* *
+* Retour : Instruction de destination trouvée ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *g_arch_instruction_get_given_destination(const GArchInstruction *instr, InstructionLinkType type)
+{
+ GArchInstruction *result; /* Résultat à remonter */
+ size_t i; /* Boucle de parcours */
+
+ result = NULL;
+
+ for (i = 0; i < instr->to_count && result == NULL; i++)
+ if (instr->links_type[i] == type)
+ result = instr->to[i];
+
+ return result;
+
+}
+
+
/* ---------------------------------------------------------------------------------- */
/* CONVERSIONS DU FORMAT DES INSTRUCTIONS */
diff --git a/src/arch/instruction.h b/src/arch/instruction.h
index 2eddc3c..051ce51 100644
--- a/src/arch/instruction.h
+++ b/src/arch/instruction.h
@@ -117,6 +117,9 @@ bool g_arch_instruction_has_destinations(const GArchInstruction *);
/* Fournit les destinations d'une instruction donnée. */
size_t g_arch_instruction_get_destinations(const GArchInstruction *, GArchInstruction ***, InstructionLinkType **);
+/* Fournit la destination d'une instruction et d'un type donné. */
+GArchInstruction *g_arch_instruction_get_given_destination(const GArchInstruction *, InstructionLinkType);
+
/* --------------------- CONVERSIONS DU FORMAT DES INSTRUCTIONS --------------------- */