Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Accessing CDT's AST using a new Plugin

We (IBM Research) are developing some static analysis features that will be
used for PTP (Parallel Tools Platform,   http://eclipse.org/ptp)
analysis; they are described in "CDT Static Analysis Features" at
http://wiki.eclipse.org/index.php/CDT/summitfall2006.
We are creating at least a call graph and control flow graph, which are
created by using the CDT's AST.
They will probably be contributed around December or January.  We are
hoping they will be generally useful as well.

There is also a CDT call hierarchy graph in 4.0.0 (get a nightly build or
build it yourself from CVS HEAD to see it) -
Markus Schorn described it at the same CDT developer Summit in September.
He has a tree UI view to display it as well.  You can find his presentation
at above fall summit web site as well.

Our ui views are more geared toward displaying the results of our specific
barrier and concurrency analysis
(mostly in tree and table views!)

For a good starting point for using the AST, try out the DOM AST view that
is
in the CDT testing plugin. available for 3.1.1
For example use the latest 3.1.1 build page on
http://download.eclipse.org/tools/cdt/builds/3.1.1/index.html  and you will
find the testing plug-in at the bottom.
Try it out, and look at its source code.

It's technically possible to build a plug-in that does analysis using the
CDT's AST; others may have specific
opinions on how easy it is to build a complete dependency graph with it.
But good luck!

...Beth

Beth Tibbitts  (859) 243-4981  (TL 545-4981)
High Productivity Tools / Parallel Tools  http://eclipse.org/ptp
IBM T.J.Watson Research Center
Mailing Address:  IBM Corp., 455 Park Place, Lexington, KY 40511


                                                                           
             Max                                                           
             <cdt-dev@hohenegg                                             
             er.eu>                                                     To 
             Sent by:                  cdt-dev@xxxxxxxxxxx                 
             cdt-dev-bounces@e                                          cc 
             clipse.org                                                    
                                                                   Subject 
                                       [cdt-dev] Accessing CDT's AST using 
             10/30/2006 01:03          a new Plugin                        
             PM                                                            
                                                                           
                                                                           
             Please respond to                                             
               "CDT General                                                
             developers list."                                             
             <cdt-dev@eclipse.                                             
                   org>                                                    
                                                                           
                                                                           




Hello,

this is my first mail on the list, I hope it's the right place for these
kind of questions, if not I hope you can point me to the right one :)

Me and some friends started with planning an Eclipse plugin that is
supposed to create and show a dependency graph for C++ projects much
like Metrics (http://metrics.sourceforge.net/) already does it for Java
projects.
To achieve this goal we're planning to use CDT and it's Abstract Syntax
Tree.
We don't want to create a fork of your plugin but create a new one that
extends the features of CDT.
The result will be FOSS of course!

The first thing we need to know now is whether it's technically possible
to create such a plugin.
To assure this I tried to find an example that accesses CDT's AST in a
way we can do it too but the only thing I found is this:
http://www-128.ibm.com/developerworks/opensource/library/os-ecl-cdt3/
It looked much like we could reuse this example except the fact that in
this article a "Bare Bone" version of CDT is created and not an Eclipse
plugin.
Nonetheless I tried to compile the code example at the bottom but the
method "getCompilationUnit()" didn't work.
I tried to get a "CompilationUnit" directly from a source file but
didn't find documentation how to do this.

I'm guessing I need to create an Eclipse plugin that extends CDT first
(Fragment project right?) so  "getCompilationUnit()" can access the (?
currently open ?) CPP-file, but I've never created an Eclipse plugin so
this isn't to easy for me.

Now my questions are:
- How can I best access CDT's AST using an Eclipse plugin (would the IBM
example above work at all)?
- And how does this plugin need to look like (how do I start extending
CDT)?
Of course I'm not asking you for a complete source code (except you
already know a complete example :) but I need some hints, or a link to
the documentation I didn't find using google, in order to make some
progress.

I'm very grateful for every hint you can give me.

Best regards,

Max

PS: Excuse my poor English.
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev




Back to the top