summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/pychrysa/analysis/blocks/flow.c33
-rw-r--r--plugins/python/samples/basic_blocks.py7
2 files changed, 38 insertions, 2 deletions
diff --git a/plugins/pychrysa/analysis/blocks/flow.c b/plugins/pychrysa/analysis/blocks/flow.c
index 216156c..49f3003 100644
--- a/plugins/pychrysa/analysis/blocks/flow.c
+++ b/plugins/pychrysa/analysis/blocks/flow.c
@@ -40,6 +40,8 @@
/* Fournit les adresses limites d'un bloc d'exécution. */
static PyObject *py_flow_block_get_boundary_addresses(PyObject *, void *);
+/* Fournit le rang du bloc dans le flot d'exécution. */
+static PyObject *py_flow_block_get_rank(PyObject *, void *);
@@ -77,6 +79,33 @@ static PyObject *py_flow_block_get_boundary_addresses(PyObject *self, void *clos
}
+/******************************************************************************
+* *
+* Paramètres : self = classe représentant une instruction. *
+* closure = adresse non utilisée ici. *
+* *
+* Description : Fournit le rang du bloc dans le flot d'exécution. *
+* *
+* Retour : Valeur associée à la propriété consultée. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_flow_block_get_rank(PyObject *self, void *closure)
+{
+ PyObject *result; /* Trouvailles à retourner */
+ GFlowBlock *block; /* Version native */
+
+ block = G_FLOW_BLOCK(pygobject_get(self));
+
+ result = Py_BuildValue("I", g_flow_block_get_rank(block));
+
+ return result;
+
+}
+
+
@@ -110,6 +139,10 @@ bool register_python_flow_block(PyObject *module)
"boundary_addresses", (getter)py_flow_block_get_boundary_addresses, (setter)NULL,
"Provide the boundary addresses of the current flow block.", NULL
},
+ {
+ "rank", (getter)py_flow_block_get_rank, (setter)NULL,
+ "Provide the rank of the current block in the execution flow.", NULL
+ },
{ NULL }
};
diff --git a/plugins/python/samples/basic_blocks.py b/plugins/python/samples/basic_blocks.py
index 583723c..90f3a2c 100644
--- a/plugins/python/samples/basic_blocks.py
+++ b/plugins/python/samples/basic_blocks.py
@@ -43,14 +43,17 @@ def visit_block(block, order, indent):
if isinstance(block, FlowBlock):
start, end = block.boundary_addresses
+ rank = block.rank
links = block.get_links_block()
if links != None:
laddr = get_c_address_of_pygobject(links)
- print '%s- flow %s : 0x%08lx -> 0x%08lx (links = %s)' % (padding, addr, start, end, laddr)
+ print '%s- flow %s (rank=%d) : 0x%08lx -> 0x%08lx (links = %s)' \
+ % (padding, addr, rank, start, end, laddr)
else:
- print '%s- flow %s : 0x%08lx -> 0x%08lx' % (padding, addr, start, end)
+ print '%s- flow %s (rank=%d) : 0x%08lx -> 0x%08lx' \
+ % (padding, addr, rank, start, end)
else: