summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog23
-rw-r--r--plugins/androhelpers/switch.c6
-rw-r--r--plugins/pychrysa/arch/instruction.c2
-rw-r--r--src/analysis/blocks/flow.c4
-rw-r--r--src/analysis/decomp/il.c6
-rw-r--r--src/analysis/disass/dragon.c4
-rw-r--r--src/analysis/disass/links.c2
-rw-r--r--src/analysis/disass/loop.c2
-rw-r--r--src/analysis/disass/macro.c2
-rw-r--r--src/analysis/disass/rank.c4
-rw-r--r--src/arch/dalvik/instruction.c4
-rw-r--r--src/arch/instruction-int.h14
-rw-r--r--src/arch/instruction.c38
-rw-r--r--src/arch/instruction.h18
-rw-r--r--src/gtkext/graph/cluster.c4
-rw-r--r--src/gui/dialogs/gotox.c2
16 files changed, 66 insertions, 69 deletions
diff --git a/ChangeLog b/ChangeLog
index 169362f..f0a760a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,28 @@
16-10-28 Cyrille Bagard <nocbos@gmail.com>
+ * plugins/androhelpers/switch.c:
+ * plugins/pychrysa/arch/instruction.c:
+ * src/analysis/blocks/flow.c:
+ * src/analysis/decomp/il.c:
+ * src/analysis/disass/dragon.c:
+ * src/analysis/disass/links.c:
+ * src/analysis/disass/loop.c:
+ * src/analysis/disass/macro.c:
+ * src/analysis/disass/rank.c:
+ * src/arch/dalvik/instruction.c:
+ Update code.
+
+ * src/arch/instruction-int.h:
+ * src/arch/instruction.c:
+ * src/arch/instruction.h:
+ Clean the structure for instructions a little bit.
+
+ * src/gtkext/graph/cluster.c:
+ * src/gui/dialogs/gotox.c:
+ Code.
+
+16-10-28 Cyrille Bagard <nocbos@gmail.com>
+
* src/arch/instruction-int.h:
* src/arch/instruction.c:
* src/arch/instruction.h:
diff --git a/plugins/androhelpers/switch.c b/plugins/androhelpers/switch.c
index 2434897..da91a50 100644
--- a/plugins/androhelpers/switch.c
+++ b/plugins/androhelpers/switch.c
@@ -169,7 +169,7 @@ static void link_all_switch_cases(GArchInstruction *instr, const dex_switch *dsw
value = dswitch->sparse.keys[i];
imm = g_imm_operand_new_from_value(MDS_32_BITS_UNSIGNED, value);
- g_arch_instruction_link_with(instr, next, ILT_CASE_JUMP, imm);
+ g_arch_instruction_link_with(instr, next, ILT_CASE_JUMP);
ensure_each_case_has_its_block(next, instrs);
}
@@ -182,7 +182,7 @@ static void link_all_switch_cases(GArchInstruction *instr, const dex_switch *dsw
if (next != NULL)
{
- g_arch_instruction_link_with(instr, next, ILT_CASE_JUMP, NULL);
+ g_arch_instruction_link_with(instr, next, ILT_CASE_JUMP);
ensure_each_case_has_its_block(next, instrs);
}
@@ -222,7 +222,7 @@ static void ensure_each_case_has_its_block(GArchInstruction *instr, GArchInstruc
&& !g_arch_instruction_has_destinations(prev)
&& !(g_arch_instruction_get_flags(prev) & AIF_RETURN_POINT))
{
- g_arch_instruction_link_with(prev, instr, ILT_EXEC_FLOW, NULL);
+ g_arch_instruction_link_with(prev, instr, ILT_EXEC_FLOW);
}
}
diff --git a/plugins/pychrysa/arch/instruction.c b/plugins/pychrysa/arch/instruction.c
index 5e4c19d..ff3d2ad 100644
--- a/plugins/pychrysa/arch/instruction.c
+++ b/plugins/pychrysa/arch/instruction.c
@@ -159,7 +159,7 @@ static PyObject *py_arch_instruction_get_destinations(PyObject *self, PyObject *
instr = G_ARCH_INSTRUCTION(pygobject_get(self));
- count = g_arch_instruction_get_destinations(instr, &dests, &types, NULL);
+ count = g_arch_instruction_get_destinations(instr, &dests, &types);
result = PyTuple_New(count);
diff --git a/src/analysis/blocks/flow.c b/src/analysis/blocks/flow.c
index bc14648..970fc21 100644
--- a/src/analysis/blocks/flow.c
+++ b/src/analysis/blocks/flow.c
@@ -575,7 +575,7 @@ bool g_flow_block_is_looping_to(GFlowBlock *block, const GInstrBlock *list, GFlo
result = (block == target);
g_arch_instruction_rlock_dest(block->last);
- dcount = g_arch_instruction_get_destinations(block->last, &dests, &types, NULL);
+ dcount = g_arch_instruction_get_destinations(block->last, &dests, &types);
for (i = 0; i < dcount && !result; i++)
switch (types[i])
@@ -638,7 +638,7 @@ bool g_flow_block_follow(GFlowBlock *block, const GInstrBlock *list, BlockFollow
result = callback(block, BFP_ENTER, data);
g_arch_instruction_rlock_dest(block->last);
- dcount = g_arch_instruction_get_destinations(block->last, &dests, &types, NULL);
+ dcount = g_arch_instruction_get_destinations(block->last, &dests, &types);
for (i = 0; i < dcount && result; i++)
switch (types[i])
diff --git a/src/analysis/decomp/il.c b/src/analysis/decomp/il.c
index 37110f2..36b5dfe 100644
--- a/src/analysis/decomp/il.c
+++ b/src/analysis/decomp/il.c
@@ -638,7 +638,7 @@ static void close_case_decomp_instructions(GDecInstruction *case_dinstr, GInstrB
for (i = 0; i < lcount && is_common; i++)
{
g_flow_block_get_boundary(G_FLOW_BLOCK(leafs[i]), NULL, &last);
- dcount = g_arch_instruction_get_destinations(last, &dests, NULL, NULL);
+ dcount = g_arch_instruction_get_destinations(last, &dests, NULL);
for (j = 0; j < dcount && is_common; j++)
{
@@ -701,6 +701,8 @@ static void close_case_decomp_instructions(GDecInstruction *case_dinstr, GInstrB
static void build_switch_branches(GSwitchInstruction *decomp, GFlowBlock *block, GDecContext *ctx)
{
+#if 0
+
GArchInstruction *last; /* Dernière instruction du lot */
GInstrBlock *sub_parent; /* Groupe des sous-branches */
GHashTable *sub_shared; /* Allocations communes */
@@ -752,5 +754,5 @@ static void build_switch_branches(GSwitchInstruction *decomp, GFlowBlock *block,
}
g_hash_table_unref(sub_shared);
-
+#endif
}
diff --git a/src/analysis/disass/dragon.c b/src/analysis/disass/dragon.c
index 58c293e..c817727 100644
--- a/src/analysis/disass/dragon.c
+++ b/src/analysis/disass/dragon.c
@@ -209,7 +209,7 @@ static dragon_node *create_dragon_nodes(const GArchProcessor *proc, const instr_
/* Analyse des destinations */
g_arch_instruction_rlock_dest(iter);
- dcount = g_arch_instruction_get_destinations(iter, NULL, &types, NULL);
+ dcount = g_arch_instruction_get_destinations(iter, NULL, &types);
cut = false;
@@ -439,7 +439,7 @@ void compute_all_paths(dragon_node *nodes, size_t count)
size_t id; /* Indice du bit associé */
g_arch_instruction_rlock_dest(node->last);
- dcount = g_arch_instruction_get_destinations(node->last, &dests, &types, NULL);
+ dcount = g_arch_instruction_get_destinations(node->last, &dests, &types);
for (i = 0; i < dcount; i++)
switch (types[i])
diff --git a/src/analysis/disass/links.c b/src/analysis/disass/links.c
index 0ce107a..294274f 100644
--- a/src/analysis/disass/links.c
+++ b/src/analysis/disass/links.c
@@ -85,7 +85,7 @@ void establish_natural_link(GArchInstruction *instr, GArchInstruction *prev)
*/
g_arch_instruction_rlock_dest(prev);
- count = g_arch_instruction_get_destinations(prev, &others, &types, NULL);
+ count = g_arch_instruction_get_destinations(prev, &others, &types);
for (i = 0; i < count; i++)
{
diff --git a/src/analysis/disass/loop.c b/src/analysis/disass/loop.c
index 01fca07..99121a8 100644
--- a/src/analysis/disass/loop.c
+++ b/src/analysis/disass/loop.c
@@ -65,7 +65,7 @@ static void detect_back_edges(dragon_node *nodes, size_t count)
get_dragon_node_bounding_instructions(node, NULL, &last);
g_arch_instruction_wlock_dest(last);
- dcount = g_arch_instruction_get_destinations(last, &dests, &types, NULL);
+ dcount = g_arch_instruction_get_destinations(last, &dests, &types);
for (i = 0; i < dcount; i++)
switch (types[i])
diff --git a/src/analysis/disass/macro.c b/src/analysis/disass/macro.c
index 6ac1fb2..4c4ba66 100644
--- a/src/analysis/disass/macro.c
+++ b/src/analysis/disass/macro.c
@@ -228,7 +228,7 @@ static GInstrBlock *build_instruction_blocks(GArchProcessor *proc, const dragon_
others = NULL;
g_arch_instruction_rlock_dest(last);
- dcount = g_arch_instruction_get_destinations(last, &dests, &types, NULL);
+ dcount = g_arch_instruction_get_destinations(last, &dests, &types);
for (i = 0; i < dcount && others == NULL; i++)
switch (types[i])
diff --git a/src/analysis/disass/rank.c b/src/analysis/disass/rank.c
index 7504231..3721ca0 100644
--- a/src/analysis/disass/rank.c
+++ b/src/analysis/disass/rank.c
@@ -79,7 +79,7 @@ static bool rank_flow_block(GFlowBlock *block, BlockVisitOrder order, const GIns
g_flow_block_get_boundary(block, NULL, &last);
g_arch_instruction_rlock_dest(last);
- dcount = g_arch_instruction_get_destinations(last, &dests, &types, NULL);
+ dcount = g_arch_instruction_get_destinations(last, &dests, &types);
for (i = 0; i < dcount; i++)
{
@@ -317,7 +317,7 @@ void rank_routine_block(const GBlockList *list, GBasicBlock *block)
g_basic_block_get_boundary(block, NULL, &last);
g_arch_instruction_rlock_dest(last);
- dcount = g_arch_instruction_get_destinations(last, &dests, &types, NULL);
+ dcount = g_arch_instruction_get_destinations(last, &dests, &types);
for (i = 0; i < dcount; i++)
{
diff --git a/src/arch/dalvik/instruction.c b/src/arch/dalvik/instruction.c
index 6e95147..3735bd7 100644
--- a/src/arch/dalvik/instruction.c
+++ b/src/arch/dalvik/instruction.c
@@ -393,8 +393,8 @@ static void g_dalvik_instruction_init(GDalvikInstruction *instr)
parent = G_ARCH_INSTRUCTION(instr);
- parent->get_rw_regs = (get_instruction_rw_regs_fc)g_dalvik_instruction_get_rw_registers;
- parent->decomp = (decomp_instr_fc)dalvik_instruction_decompile;
+ //parent->get_rw_regs = (get_instruction_rw_regs_fc)g_dalvik_instruction_get_rw_registers;
+ //parent->decomp = (decomp_instr_fc)dalvik_instruction_decompile;
}
diff --git a/src/arch/instruction-int.h b/src/arch/instruction-int.h
index 8eb6b68..c393b5f 100644
--- a/src/arch/instruction-int.h
+++ b/src/arch/instruction-int.h
@@ -67,15 +67,6 @@ struct _GArchInstruction
mrange_t range; /* Emplacement en mémoire */
- /* ------- %< ----------- */
-
- vmpa2t address2; /* Position associée */
- off_t offset; /* Position physique de départ */
- //off_t length; /* Taille de l'instruction */
-
- vmpa_t address; /* Position associée */
-
- /* ------- %< ----------- */
GArchOperand **operands; /* Liste des opérandes */
size_t operands_count; /* Nbre. d'opérandes utilisées */
@@ -89,18 +80,17 @@ struct _GArchInstruction
GArchInstruction **to; /* Eventuelles lignes visées */
InstructionLinkType *to_types; /* Type des liens de dest. */
- link_extra_info *links_info; /* Informations complémentaires*/
size_t to_count; /* Nombre de ces destinations */
GRWLock to_access; /* Verrou de protection */
#ifndef NDEBUG
gint hold_to_access; /* Suivi des verrouillages */
#endif
- get_instruction_rw_regs_fc get_rw_regs; /* Liste des registres liés */
+ //get_instruction_rw_regs_fc get_rw_regs; /* Liste des registres liés */
//print_instruction_fc print; /* Imprime l'ensemble */
//get_instruction_keyword_fc get_key; /* Texte humain équivalent */
//is_instruction_return_fc is_return; /* Retour de fonction ou pas ? */
- decomp_instr_fc decomp; /* Procédure de décompilation */
+ //decomp_instr_fc decomp; /* Procédure de décompilation */
};
diff --git a/src/arch/instruction.c b/src/arch/instruction.c
index 4c0fdb9..fa631ac 100644
--- a/src/arch/instruction.c
+++ b/src/arch/instruction.c
@@ -372,10 +372,10 @@ const mrange_t *g_arch_instruction_get_range(const GArchInstruction *instr)
void g_arch_instruction_get_location(const GArchInstruction *instr, off_t *offset, off_t *length, vmpa_t *address)
{
- if (offset != NULL) *offset = instr->offset;
+ //if (offset != NULL) *offset = instr->offset;
//if (length != NULL) *length = instr->length;
- if (address != NULL) *address = instr->address;
+ //if (address != NULL) *address = instr->address;
}
@@ -529,6 +529,8 @@ void g_arch_instruction_detach_operand(GArchInstruction *instr, GArchOperand *op
void g_arch_instruction_get_rw_registers(const GArchInstruction *instr, GArchRegister ***rregs, size_t *rcount, GArchRegister ***wregs, size_t *wcount)
{
+#if 0
+
size_t i; /* Boucle de parcours */
*rregs = NULL;
@@ -544,6 +546,8 @@ void g_arch_instruction_get_rw_registers(const GArchInstruction *instr, GArchReg
for (i = 0; i < *wcount; i++)
g_object_ref(G_OBJECT((*wregs)[i]));
+#endif
+
}
@@ -568,10 +572,9 @@ void g_arch_instruction_get_rw_registers(const GArchInstruction *instr, GArchReg
* *
******************************************************************************/
-void g_arch_instruction_link_with(GArchInstruction *instr, GArchInstruction *dest, InstructionLinkType type, ...)
+void g_arch_instruction_link_with(GArchInstruction *instr, GArchInstruction *dest, InstructionLinkType type)
{
size_t count; /* Raccourci pour la lecture */
- va_list ap; /* Gestion des variations */
/* Côté destination */
@@ -599,25 +602,10 @@ void g_arch_instruction_link_with(GArchInstruction *instr, GArchInstruction *des
count * sizeof(GArchInstruction *));
instr->to_types = (InstructionLinkType *)realloc(instr->to_types,
count * sizeof(InstructionLinkType));
- instr->links_info = (link_extra_info *)realloc(instr->links_info,
- count * sizeof(link_extra_info));
instr->to[count - 1] = dest;
instr->to_types[count - 1] = type;
- va_start(ap, type);
-
- switch (type)
- {
- case ILT_CASE_JUMP:
- instr->links_info[count - 1].imm = va_arg(ap, GImmOperand *);
- break;
- default:
- break;
- }
-
- va_end(ap);
-
g_arch_instruction_wunlock_dest(instr);
}
@@ -854,7 +842,6 @@ bool g_arch_instruction_has_destinations(const GArchInstruction *instr)
* Paramètres : instr = instruction dont les informations sont à consulter. *
* dests = liste des instructions de destination. [OUT] *
* types = liste des types de liens présents. [OUT] *
-* info = éventuelles informations complémentaires. [OUT] *
* *
* Description : Fournit les destinations d'une instruction donnée. *
* *
@@ -864,7 +851,7 @@ bool g_arch_instruction_has_destinations(const GArchInstruction *instr)
* *
******************************************************************************/
-size_t g_arch_instruction_get_destinations(const GArchInstruction *instr, GArchInstruction ***dests, InstructionLinkType **types, link_extra_info **info)
+size_t g_arch_instruction_get_destinations(const GArchInstruction *instr, GArchInstruction ***dests, InstructionLinkType **types)
{
assert(g_atomic_int_get(&instr->hold_to_access) > 0);
@@ -874,9 +861,6 @@ size_t g_arch_instruction_get_destinations(const GArchInstruction *instr, GArchI
if (types != NULL)
*types = instr->to_types;
- if (info != NULL)
- *info = instr->links_info;
-
return instr->to_count;
}
@@ -1114,6 +1098,8 @@ GBufferLine *g_arch_instruction_print(const GArchInstruction *instr, GCodeBuffer
GDecInstruction *g_arch_instruction_decompile(const GArchInstruction *instr, GDecContext *ctx)
{
+#if 0
+
GDecInstruction *result; /* Instruction à retourner */
GDecInstruction *list; /* Instructions décompilées */
@@ -1139,6 +1125,10 @@ GDecInstruction *g_arch_instruction_decompile(const GArchInstruction *instr, GDe
return result;
+#endif
+
+ return NULL;
+
}
diff --git a/src/arch/instruction.h b/src/arch/instruction.h
index 93dfa52..00e64ab 100644
--- a/src/arch/instruction.h
+++ b/src/arch/instruction.h
@@ -131,7 +131,7 @@ const mrange_t *g_arch_instruction_get_range(const GArchInstruction *);
/* Fournit la localisation d'une instruction. */
-void g_arch_instruction_get_location(const GArchInstruction *, off_t *, off_t *, vmpa_t *);
+void g_arch_instruction_get_location(const GArchInstruction *, off_t *, off_t *, vmpa_t *) __attribute__ ((deprecated));
@@ -151,7 +151,7 @@ void g_arch_instruction_replace_operand(GArchInstruction *, GArchOperand *, cons
void g_arch_instruction_detach_operand(GArchInstruction *, GArchOperand *);
/* Liste les registres lus et écrits par l'instruction. */
-void g_arch_instruction_get_rw_registers(const GArchInstruction *, GArchRegister ***, size_t *, GArchRegister ***, size_t *);
+void g_arch_instruction_get_rw_registers(const GArchInstruction *, GArchRegister ***, size_t *, GArchRegister ***, size_t *) __attribute__ ((deprecated));
@@ -174,17 +174,9 @@ typedef enum _InstructionLinkType
} InstructionLinkType;
-/* Informations complémentaires pour un lien */
-typedef union _link_extra_info
-{
- GImmOperand *imm; /* Valeur d'un cas de switch() */
- GDataType *type; /* Type d'une exception */
-
-} link_extra_info;
-
/* Etablit un lien entre deux instructions. */
-void g_arch_instruction_link_with(GArchInstruction *, GArchInstruction *, InstructionLinkType, ...);
+void g_arch_instruction_link_with(GArchInstruction *, GArchInstruction *, InstructionLinkType);
/* Change la nature d'un lien entre deux instructions. */
bool g_arch_instruction_change_link(GArchInstruction *, GArchInstruction *, InstructionLinkType, InstructionLinkType);
@@ -217,7 +209,7 @@ void g_arch_instruction_lock_unlock_destinations(GArchInstruction *, bool, bool)
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 **, link_extra_info **);
+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);
@@ -243,7 +235,7 @@ void g_arch_instruction_set_displayed_max_length(GArchInstruction *, phys_t);
GBufferLine *g_arch_instruction_print(const GArchInstruction *, GCodeBuffer *, MemoryDataSize, const GBinContent *, AsmSyntax);
/* Décompile une instruction de façon générique. */
-GDecInstruction *g_arch_instruction_decompile(const GArchInstruction *, GDecContext *);
+GDecInstruction *g_arch_instruction_decompile(const GArchInstruction *, GDecContext *) __attribute__ ((deprecated));
diff --git a/src/gtkext/graph/cluster.c b/src/gtkext/graph/cluster.c
index 3e18f5f..2f6feda 100644
--- a/src/gtkext/graph/cluster.c
+++ b/src/gtkext/graph/cluster.c
@@ -922,7 +922,7 @@ static void g_graph_cluster_define_links(GGraphCluster *cluster, GHashTable *all
g_basic_block_get_boundary(cluster->block, NULL, &last);
g_arch_instruction_rlock_dest(last);
- dcount = g_arch_instruction_get_destinations(last, &dests, &types, NULL);
+ dcount = g_arch_instruction_get_destinations(last, &dests, &types);
for (i = 0; i < dcount; i++)
switch (types[i])
@@ -1536,7 +1536,7 @@ static GGraphCluster *setup_graph_clusters(GLoadedBinary *binary, const GBlockLi
/* Détermination des blocs suivants */
g_arch_instruction_rlock_dest(last);
- dcount = g_arch_instruction_get_destinations(last, &dests, &types, NULL);
+ dcount = g_arch_instruction_get_destinations(last, &dests, &types);
for (i = 0; i < dcount; i++)
switch (types[i])
diff --git a/src/gui/dialogs/gotox.c b/src/gui/dialogs/gotox.c
index 0511be8..fe18e4e 100644
--- a/src/gui/dialogs/gotox.c
+++ b/src/gui/dialogs/gotox.c
@@ -297,7 +297,7 @@ GtkWidget *create_gotox_dialog_for_cross_references(GtkWindow *parent, GLoadedBi
else
{
g_arch_instruction_rlock_dest(instr);
- count = g_arch_instruction_get_destinations(instr, &list, NULL, NULL);
+ count = g_arch_instruction_get_destinations(instr, &list, NULL);
}
for (i = 0; i < count; i++)