<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Right, I did not realise you wanted information about variables defined inside the function’s body.<div class=""><br class=""></div><div class="">I think this can not be done with CastXML (GCCXML didn’t allow this too).</div><div class="">CastXML and GCCXML were written to generate XML files containing enough</div><div class="">information to generate bindings to other languages; the content of functions</div><div class="">is not of interest for that goal.</div><div class=""><br class=""></div><div class="">Of course if you want to do c++ analysis on these variables, castxml could</div><div class="">probably be extended to output that information. Not sure how much</div><div class="">work that would be though</div><div class=""><br class=""></div><div class="">Michka</div><div class=""><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 2 Oct 2016, at 19:51, Ranadeep Biswas <<a href="mailto:ranadeep@cmi.ac.in" class="">ranadeep@cmi.ac.in</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi Michka,<div class=""><br class=""></div><div class="">Thanks for the documentations. But I am still stuck.</div><div class="">Can you tell me how to extract information for variables inside of a function? Consider this simple c++ code.</div><div class=""><br class=""></div><div class="">int f(){</div><div class="">  int a = 3;</div><div class="">  return a;</div><div class="">}</div><div class=""><br class=""></div><div class="">how to extract information about variable a?</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="gmail_extra"><div class="gmail_signature"><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><span style="font-size:12.8px" class="">Ranadeep</span></div></div></div></div></div></div></div></div><div class="gmail_extra">
<br class=""><div class="gmail_quote">On Sat, Oct 1, 2016 at 9:39 PM, Michka Popoff <span dir="ltr" class=""><<a href="mailto:michkapopoff@gmail.com" target="_blank" class="">michkapopoff@gmail.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">Hi<div class=""><br class=""></div><div class="">There are a bunch of pygccxml examples here:</div><div class=""><a href="http://pygccxml.readthedocs.io/en/develop/examples.html" target="_blank" class="">http://pygccxml.readthedocs.<wbr class="">io/en/develop/examples.html</a></div><div class=""><br class=""></div><div class="">A simple example that almost looks like yours would be this one:</div><div class=""><a href="http://pygccxml.readthedocs.io/en/develop/examples/variables/example.html" target="_blank" class="">http://pygccxml.readthedocs.<wbr class="">io/en/develop/examples/<wbr class="">variables/example.html</a></div><div class=""><br class=""></div><div class="">Hope this helps you getting started.</div><span class="HOEnZb"><font color="#888888" class=""><div class=""><br class=""></div><div class="">Michka</div></font></span><div class=""><div class="h5"><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 1 Oct 2016, at 18:05, Ranadeep Biswas <<a href="mailto:ranadeep@cmi.ac.in" target="_blank" class="">ranadeep@cmi.ac.in</a>> wrote:</div><br class="m_-6704737580332629070Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi Matt,<div class=""><br class=""></div><div class="">Yes, I have tried Pygccxml. But I would prefer not to use Python.<div class="">But since that you mentioned pygccxml, can you give me an pygccxml example to parse x and y from that previous c++ code?</div><div class="">And if possible an example of castxml also to parse x and y. If trimming is not possible I am okay with that.</div><div class=""><br class=""></div><div class="">Thanks,</div></div><div class="gmail_extra"><div class=""><div class="m_-6704737580332629070gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div class=""><div class=""><span style="font-size:12.8000001907349px" class="">Ranadeep</span><br class=""></div></div></div></div></div></div></div></div></div></div>
<br class=""><div class="gmail_quote">On Sat, Oct 1, 2016 at 8:46 PM, Matt <span dir="ltr" class=""><<a href="mailto:mattator@gmail.com" target="_blank" class="">mattator@gmail.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br class="">
<br class="">
You can filter the results with pygccxml.<br class="">
<div class=""><div class="m_-6704737580332629070h5"><br class="">
2016-10-01 13:50 GMT+02:00 Ranadeep Biswas <<a href="mailto:ranadeep@cmi.ac.in" target="_blank" class="">ranadeep@cmi.ac.in</a>>:<br class="">
> Hello all,<br class="">
><br class="">
> I am doing this project that needs to parse a c/c++ program and generate its<br class="">
> control flow graph so that I can do some analysis on it. Can this be done<br class="">
> using castxml?<br class="">
><br class="">
> I tried to use castxml to generate xml output to build the CFG, but I can<br class="">
> not generate the output as per my need. I could not find any good<br class="">
> documentations. May be I am missing something.<br class="">
><br class="">
> Consider this very simple c++ program.<br class="">
><br class="">
> // foo.cpp<br class="">
> int main(){<br class="">
>   int x, y;<br class="">
>   x = 0;<br class="">
>   y = x + 3;<br class="">
>   return 0;<br class="">
> }<br class="">
><br class="">
> now I run `castxml --castxml-cc-gnu g++ --castxml-gccxml foo.cpp`. It<br class="">
> generates `foo.xml` file, but xml file contains a lot of other tags. But I<br class="">
> don't find tags for variable x and y. Also is it possible to trim the<br class="">
> output, so that I can get tags for only main, x, y and relevant types?<br class="">
><br class="">
> Thanks,<br class="">
><br class="">
> Ranadeep<br class="">
> MSc CS 2nd year<br class="">
> Chennai Mathematical Institute<br class="">
><br class="">
><br class="">
</div></div>> ______________________________<wbr class="">_________________<br class="">
> CastXML mailing list<br class="">
> <a href="mailto:CastXML@public.kitware.com" target="_blank" class="">CastXML@public.kitware.com</a><br class="">
> <a href="http://public.kitware.com/mailman/listinfo/castxml" rel="noreferrer" target="_blank" class="">http://public.kitware.com/mail<wbr class="">man/listinfo/castxml</a><br class="">
><br class="">
</blockquote></div><br class=""></div></div>
______________________________<wbr class="">_________________<br class="">CastXML mailing list<br class=""><a href="mailto:CastXML@public.kitware.com" target="_blank" class="">CastXML@public.kitware.com</a><br class=""><a href="http://public.kitware.com/mailman/listinfo/castxml" target="_blank" class="">http://public.kitware.com/<wbr class="">mailman/listinfo/castxml</a><br class=""></div></blockquote></div><br class=""></div></div></div></div></blockquote></div><br class=""></div></div>
</div></blockquote></div><br class=""></div></div></body></html>