From mboxrd@z Thu Jan 1 00:00:00 1970 From: Syd Polk To: "Salman Khilji" , "'sourcenav@sources.redhat.com'" Subject: Re: Want Help with Source Navigator source code Date: Mon, 30 Jul 2001 09:40:00 -0000 Message-id: <200107301639.JAA43271@postman.bayarea.net> X-SW-Source: 2001-q3/msg00076.html Salman Khilji wrote: >I wanted some help with the source code of the Source Navigator. Usually, >the developers and maintainers do not like to be sent direct e-mails. Their >e-mail addresses are: > >Syd Polk spolk@redhat.com Hmm. I should change this. I no longer work at Red Hat. >Ian Roxborough irox@redhat.com >Mo DeJong mdejong@redhat.com > >If this is appropriate to ask, could you please forward this e-mail to them? >If not, can you please tell me who I need to contact in order to get some >help on this issue. Here is my question: > >NEED HELP WITH SOURCE CODE PARSING >================================== > >I am developing a debugger type application for C/C++/FORTRAN (not exactly a >source line debugger). I need access to the complete symbol table of the >target application. This requires me to parse the source code of the >application and build a complete symbol table. For example, I will parse >the source code and determine the type of each symbol. For example, if a >given symbol is a structure, what are the structure members? What is the >type of each structure member? Ok, if a given symbol is an array, what kind >of an array is it? What is its dimension? Is it a multiple dimension >array? If a given symbol is a pointer, is it pointing to a structure, a >float, etc? Do I have an array of structures, pointers to structures etc >etc. Usually, compilers generate this information and encode it into the executable. The debugger knows to look at the section in the executable and load the symbol table that way. There are all sorts of complications arising from shared libraries, etc. gcc and the fsf Fortran compiler both generate this information in much more detail than Source-Navigator, and in a more compact form. I would investigate using gcc for this before using the Source-Navigator parsers. Source-Navigator's Fortran parser, for instance, is code that has not been actively maintained in several years. In C, you are going to have problems with local variables. I would also investigate gcc's debugging formats, STABS and DWARF2. In particular, DWARF2 has recently been updated to be much more robust with C++. >For this purpose, I need to have a parser for C, C++, and FORTRAN. I have >downloaded the source code of Source Navigator. I feel that I can somehow >extract the parsing specific code out of it and use it for my application. >The source code that I found was under the snavigator/parsers folder. >However, given the size of all the code out there, it would be hard for me >to dig into the code and find out how my main function should look like to >build a symbol table. I'd suppose that the maintainers would know somewhat >about it and would have some sort of idea as to where and how the parsers >are used. If you could give me pointers to where I need to look at the code >to extract parsing specific code, this would give me a great jump start. Is >there a design documentation available that I can go through and find out >how each block of the software is put together? > >Could I ask a maintainer of Source Navigator for this favor? If you really wish to use SN for this purpose, and I don't recommend it, I would read the SDK documentation. It details how to get symbols out of Source-Navigator's database using Tcl or C. Another reason not to use SN: Right now, SN requires a GUI, even when building a project.