summaryrefslogtreecommitdiff
path: root/src/glibext/gbinportion.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2014-10-11 20:50:03 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2014-10-11 20:50:03 (GMT)
commitffc49de3b424d3daf08b5fdeefd4a3ede6defd02 (patch)
treecf1a96860e922715bcab55126f8095b7f562d2a1 /src/glibext/gbinportion.c
parenta5e162d47a574f334b172dfee3128a40e8d52fb3 (diff)
Improved the disassembling process using memory ranges.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@411 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/glibext/gbinportion.c')
-rw-r--r--src/glibext/gbinportion.c55
1 files changed, 53 insertions, 2 deletions
diff --git a/src/glibext/gbinportion.c b/src/glibext/gbinportion.c
index 76926ca..94a04cc 100644
--- a/src/glibext/gbinportion.c
+++ b/src/glibext/gbinportion.c
@@ -50,6 +50,7 @@ struct _GBinPortion
char *desc; /* Désignation humaine */
+ mrange_t range; /* Emplacement dans le code */
vmpa2t addr; /* Emplacement dans le code */
off_t size; /* Taille de la partie */
@@ -265,7 +266,7 @@ const char *g_binary_portion_get_desc(const GBinPortion *portion)
* addr = emplacement de la section à conserver. *
* size = taille de la section à conserver. *
* *
-* Description : Définit les valeurs utiles d'une partie de code. *
+* Description : Définit les valeurs utiles d'une partie de code binaire. *
* *
* Retour : - *
* *
@@ -273,11 +274,32 @@ const char *g_binary_portion_get_desc(const GBinPortion *portion)
* *
******************************************************************************/
-void g_binary_portion_set_values(GBinPortion *portion, const vmpa2t *addr, off_t size)
+void g_binary_portion_set_values(GBinPortion *portion, const vmpa2t *addr, phys_t size)
{
copy_vmpa(&portion->addr, addr);
portion->size = size;
+ init_mrange(&portion->range, addr, size);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : portion = description de partie à mettre à jour. *
+* *
+* Description : Fournit l'emplacement d'une partie de code binaire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+const mrange_t *g_binary_portion_get_range(const GBinPortion *portion)
+{
+ return &portion->range;
+
}
@@ -376,6 +398,35 @@ static bool g_binary_portion_compute_sub_area(GBinPortion *portion, GBinPortion
/******************************************************************************
* *
+* Paramètres : portion = première portion amorçant la visite. *
+* visitor = fonction à appeler à chaque étape de la descente. *
+* data = adresse pointant vers des données de l'utilisateur.*
+* *
+* Description : Parcours un ensemble de portions binaires. *
+* *
+* Retour : true si la visite a été jusqu'à son terme, false sinon. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool g_binary_portion_visit(GBinPortion *portion, visit_portion_fc visitor, void *data)
+{
+ bool result; /* Etat à retourner */
+ size_t i; /* Boucle de parcours */
+
+ result = visitor(portion, data);
+
+ for (i = 0; i < portion->sub_count && result; i++)
+ result = g_binary_portion_visit(portion->sub_portions[i], visitor, data);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : portion = description de partie à mettre à jour. *
* x = abscisse du point de recherche. *
* y = ordonnée du point de recherche. *