--- layout: fc_discuss_archives title: Message 39 from Frama-C-discuss on March 2009 ---
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Frama-c-discuss] Getting a node from its id for a particular pdg



Let's say I need to get a node from its id for a particular pdg, for
now, in order to get this, I use Db.Pdg.iter_nodes looking for the
correct id (I'm not sure it's worth creating a hashtable for this), but
I was wondering if there were an easier way to do it (I did search but
found nothing) or if maybe frama-c's dev would consider adding such
feature.

Also, if I'm talking about this on the ML, it's because I've also
considered the fact that maybe if I need such feature, it's because I
went wrong somewhere.

So just in case, I will tell why I need this. Let's consider this simple
piece of C code:

1.	b += z;
	
2.	c = toto(b,a);

3.	c++;

4.	e = toto(c,a);

For the statement 4, I ask for the corresponding nodes (using
Db.Pdg.find_simple_stmt_nodes), then I ask for all its dependencies
(using Db.Pdg.all_dpds). I get statements 2 and 3.

But since statement 2 is a call, from which the result might depend (in
worst case scenario) on all it's dependencies, I want to add those to
the dependencies of the statement 4.

So, within the dependencies of a particular statement, when I find a
node the key match 'PdgIndex.Key.SigCallKey (_,PdgIndex.Signature.Out
PdgIndex.Signature.OutRet)', I add the dependencies of the nodes with
the ids (id-1) and (id-2), with id the elem_id of the matched node (I'm
not sure I'm clear... ^^).

Anyway, thanks.