summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2013-03-19 21:13:51 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2013-03-19 21:13:51 (GMT)
commitcf97db0ea4d1ea983db38df85984034b49fa4f77 (patch)
treeb6d69945b24ec8da93f0bef7ccf4dfdbe1d920a2 /plugins
parente7a85861ba8bcd00ceb7bf9e47f4eadccd48ce3f (diff)
Defined the first steps towards new graph renderings.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@345 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
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: