summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/analysis/disass
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-12-13 22:55:39 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-12-13 22:55:39 (GMT)
commite957ec4ff043f6025d6a993bb6e97fe7d57a8bd6 (patch)
tree233d2b52e04edf8969bc59730cda9cda3019c972 /plugins/pychrysalide/analysis/disass
parent29b7d4dcc28eca8e807f5eb2f20a5ffdde41a9d9 (diff)
Extended the Python API for code blocks.
Diffstat (limited to 'plugins/pychrysalide/analysis/disass')
-rw-r--r--plugins/pychrysalide/analysis/disass/block.c44
1 files changed, 43 insertions, 1 deletions
diff --git a/plugins/pychrysalide/analysis/disass/block.c b/plugins/pychrysalide/analysis/disass/block.c
index 6855368..38e65a1 100644
--- a/plugins/pychrysalide/analysis/disass/block.c
+++ b/plugins/pychrysalide/analysis/disass/block.c
@@ -40,7 +40,8 @@
/* ------------------------ MISE EN PLACE DES BLOCS BASIQUES ------------------------ */
-
+/* Fournit les instructions limites d'un bloc basique. */
+static PyObject *py_basic_block_get_boundaries(PyObject *, void *);
@@ -51,6 +52,43 @@
/******************************************************************************
* *
+* Paramètres : self = objet Python concerné par l'appel. *
+* closure = non utilisé ici. *
+* *
+* Description : Fournit les instructions limites d'un bloc basique. *
+* *
+* Retour : Première et dernière instructions du bloc. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_basic_block_get_boundaries(PyObject *self, void *closure)
+{
+ PyObject *result; /* Trouvailles à retourner */
+ GBasicBlock *block; /* Bloc de code à consulter */
+ GArchInstruction *first; /* Première instruction de bloc*/
+ GArchInstruction *last; /* Dernière instruction de bloc*/
+
+ block = G_BASIC_BLOCK(pygobject_get(self));
+
+ g_basic_block_get_boundaries(block, &first, &last);
+
+ result = PyTuple_New(2);
+
+ PyTuple_SetItem(result, 0, pygobject_new(G_OBJECT(first)));
+ PyTuple_SetItem(result, 1, pygobject_new(G_OBJECT(last)));
+
+ g_object_unref(G_OBJECT(first));
+ g_object_unref(G_OBJECT(last));
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : - *
* *
* Description : Fournit un accès à une définition de type à diffuser. *
@@ -68,6 +106,10 @@ PyTypeObject *get_python_basic_block_type(void)
};
static PyGetSetDef py_basic_block_getseters[] = {
+ {
+ "boundaries", py_basic_block_get_boundaries, NULL,
+ "First and last instructions of the basic block.", NULL
+ },
{ NULL }
};