[CastXML] using castxml to generate control flow graph

Ranadeep Biswas ranadeep at cmi.ac.in
Sun Oct 2 16:34:43 EDT 2016


Hi Michka,

Oh, I see. Thank you for clarifying that. :)

Ranadeep

On Mon, Oct 3, 2016 at 1:58 AM, Michka Popoff <michkapopoff at gmail.com>
wrote:

> Right, I did not realise you wanted information about variables defined
> inside the function’s body.
>
> I think this can not be done with CastXML (GCCXML didn’t allow this too).
> CastXML and GCCXML were written to generate XML files containing enough
> information to generate bindings to other languages; the content of
> functions
> is not of interest for that goal.
>
> Of course if you want to do c++ analysis on these variables, castxml could
> probably be extended to output that information. Not sure how much
> work that would be though
>
> Michka
>
>
> On 2 Oct 2016, at 19:51, Ranadeep Biswas <ranadeep at cmi.ac.in> wrote:
>
> Hi Michka,
>
> Thanks for the documentations. But I am still stuck.
> Can you tell me how to extract information for variables inside of a
> function? Consider this simple c++ code.
>
> int f(){
>   int a = 3;
>   return a;
> }
>
> how to extract information about variable a?
>
> Thanks,
> Ranadeep
>
> On Sat, Oct 1, 2016 at 9:39 PM, Michka Popoff <michkapopoff at gmail.com>
> wrote:
>
>> Hi
>>
>> There are a bunch of pygccxml examples here:
>> http://pygccxml.readthedocs.io/en/develop/examples.html
>>
>> A simple example that almost looks like yours would be this one:
>> http://pygccxml.readthedocs.io/en/develop/examples/variables/example.html
>>
>> Hope this helps you getting started.
>>
>> Michka
>>
>> On 1 Oct 2016, at 18:05, Ranadeep Biswas <ranadeep at cmi.ac.in> wrote:
>>
>> Hi Matt,
>>
>> Yes, I have tried Pygccxml. But I would prefer not to use Python.
>> But since that you mentioned pygccxml, can you give me an pygccxml
>> example to parse x and y from that previous c++ code?
>> And if possible an example of castxml also to parse x and y. If trimming
>> is not possible I am okay with that.
>>
>> Thanks,
>> Ranadeep
>>
>> On Sat, Oct 1, 2016 at 8:46 PM, Matt <mattator at gmail.com> wrote:
>>
>>> Hi,
>>>
>>> You can filter the results with pygccxml.
>>>
>>> 2016-10-01 13:50 GMT+02:00 Ranadeep Biswas <ranadeep at cmi.ac.in>:
>>> > Hello all,
>>> >
>>> > I am doing this project that needs to parse a c/c++ program and
>>> generate its
>>> > control flow graph so that I can do some analysis on it. Can this be
>>> done
>>> > using castxml?
>>> >
>>> > I tried to use castxml to generate xml output to build the CFG, but I
>>> can
>>> > not generate the output as per my need. I could not find any good
>>> > documentations. May be I am missing something.
>>> >
>>> > Consider this very simple c++ program.
>>> >
>>> > // foo.cpp
>>> > int main(){
>>> >   int x, y;
>>> >   x = 0;
>>> >   y = x + 3;
>>> >   return 0;
>>> > }
>>> >
>>> > now I run `castxml --castxml-cc-gnu g++ --castxml-gccxml foo.cpp`. It
>>> > generates `foo.xml` file, but xml file contains a lot of other tags.
>>> But I
>>> > don't find tags for variable x and y. Also is it possible to trim the
>>> > output, so that I can get tags for only main, x, y and relevant types?
>>> >
>>> > Thanks,
>>> >
>>> > Ranadeep
>>> > MSc CS 2nd year
>>> > Chennai Mathematical Institute
>>> >
>>> >
>>> > _______________________________________________
>>> > CastXML mailing list
>>> > CastXML at public.kitware.com
>>> > http://public.kitware.com/mailman/listinfo/castxml
>>> >
>>>
>>
>> _______________________________________________
>> CastXML mailing list
>> CastXML at public.kitware.com
>> http://public.kitware.com/mailman/listinfo/castxml
>>
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/castxml/attachments/20161003/0a8a3d15/attachment-0001.html>


More information about the CastXML mailing list