This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: source code database


On Tue, 2003-11-04 at 15:24, Mathieu Lacage wrote:
> [...]
>   - is there anyone here who is more experienced than me and who could
> help me figure out if what I want can be done. As an example, consider
> this piece of C++ code:
> 
> if (foo.GetData ()) 
> 
> Imagine the user clicks in his IDE view on the foo string. I want to
> figure out what this string is: variable ? macro ? If variable, its type
> ? If macro, what does the preprocessor transform it into given the
> compiler's command-line arguments ?
> 
> The hard part here is associating the "foo" string with something which
> represents the high-level langage object: I do not want to use
> heuristics to answer this question. Getting information on the language
> object itself once I have it can be done relatively easily with the
> dwarf2 debugging information but I need to know what this object is to
> first look it up.
> 
> I am open to _any_ suggestion :)

Hi Mathieu, the Ada front-end dumps such cross-reference information
when compiling into ".ali" text files that are created at the same times
as object files. The emacs Ada mode and any IDE (may be the GPS IDE uses
it) or tool (like gnatxrfef) can easily access this information and
provide navigation or translation of sources in another format like
HTML.

May be such an approach could be found acceptable for other GCC
languages (some kind of extended tags file).

For Ada, if you want full semantic information, you can use the ASIS
standard which define an Ada API to access lots of information that
the compiler has, a free implementation for GNAT is available
(asis4gnat). There is also JGNAT which is a standalone
Ada to Java bytecode compiler fully written in Ada.

Hope this helps,

Laurent


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]