summaryrefslogtreecommitdiff
path: root/src/analysis/disass
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-01-15 22:02:24 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-01-15 22:02:24 (GMT)
commit69806d75d7a3d7c0501d8205cd561447b52ac0b2 (patch)
tree1aa4753a51b96ddaf72f2ec9a0de990281e9e6de /src/analysis/disass
parent831f90f15a145636177c387fdd73d777a9e6d84f (diff)
Provided functions to compare links between code blocks.
Diffstat (limited to 'src/analysis/disass')
-rw-r--r--src/analysis/disass/block.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/analysis/disass/block.c b/src/analysis/disass/block.c
index ec8cf2a..021284e 100644
--- a/src/analysis/disass/block.c
+++ b/src/analysis/disass/block.c
@@ -71,6 +71,9 @@ static void g_basic_block_finalize(GBasicBlock *);
/* Détermine si un bloc de code contient une adresse donnée. */
static bool g_basic_block_contains_addr(const GBasicBlock *, const vmpa2t *);
+/* Compare deux liens entre blocs de code. */
+static int g_basic_block_compare_links(const block_link_t *, const block_link_t *);
+
/* Fournit les détails des origines d'un bloc de code donné. */
static block_link_t *g_basic_block_get_sources(const GBasicBlock *, const GBlockList *, size_t *);
@@ -116,6 +119,7 @@ static void g_basic_block_class_init(GBasicBlockClass *class)
block = G_CODE_BLOCK_CLASS(class);
block->contains = (block_contains_fc)g_basic_block_contains_addr;
+ block->cmp_links = (block_compare_links_fc)g_basic_block_compare_links;
block->get_src = (block_get_links_fc)g_basic_block_get_sources;
block->get_dest = (block_get_links_fc)g_basic_block_get_destinations;
block->build = (block_build_view_fc)g_basic_block_build_view;
@@ -275,6 +279,35 @@ static bool g_basic_block_contains_addr(const GBasicBlock *block, const vmpa2t *
/******************************************************************************
* *
+* Paramètres : link_a = premier lien à traiter. *
+* link_b = second lien à traiter. *
+* *
+* Description : Compare deux liens entre blocs de code. *
+* *
+* Retour : Bilan de la comparaison. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static int g_basic_block_compare_links(const block_link_t *link_a, const block_link_t *link_b)
+{
+ int result; /* Bilan à retourner */
+ const mrange_t *range_a; /* Couverture d'instruction #1 */
+ const mrange_t *range_b; /* Couverture d'instruction #2 */
+
+ range_a = g_arch_instruction_get_range(G_BASIC_BLOCK(link_a->linked)->first);
+ range_b = g_arch_instruction_get_range(G_BASIC_BLOCK(link_b->linked)->first);
+
+ result = cmp_mrange(range_a, range_b);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : block = bloc dont les informations sont à consulter. *
* list = ensemble des blocs de code à disposition. *
* count = nombre de ces origines. [OUT] *