[CastXML] Fwd: using castxml to generate control flow graph

Ranadeep Biswas ranadeep at cmi.ac.in
Sun Oct 2 13:51:23 EDT 2016


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/20161002/1ca3a350/attachment.html>


More information about the CastXML mailing list