`VL wrote: > Hello, ALL. > > I recently started to actively program using C and found that tools like > ctags or cscope do not work properly for big projects. Quite ofthen they > can't find function or symbol definition. The problem here is that they don't > use full code parsing, but just some sort of regular expressions. > > I need a tool for automatic code exploration that can at least find definition > for every symbol without problems. If you know any - please tell. > > Now, to gcc. It seems to me that existing and working compiler is an ideal > place to embedd such tool - since it already knows all the things required. > > I have one idea: i'm almost sure that inside gcc somewhere there is a place > (function > i beleive) that is called each time during compilation when definition of > something (type, variable,function...) > found and in this place gcc has context information - source file and line > where this definition came from. > So if i add something like printf("DEFINITION: %s,%s,%d\n", > info->object_type,info->src_file,info->line) into > that place, i will get information about every thing that compiler found. > > What i like more about this way of getting information about symbol > definition is that > i get the only reference to that part of source that was actually compiled. > I.e. if there are > a lot of #ifdef's, it's is hard to know what part of code will be used. > > So, my questions is: > > 1) Is it possible ? Is there a single place where all information is easily > accessible ? > 2) If yes - where is it and where can i find details about internals of gcc? > 3) Any good alternatives for cscope/ctags? It seemed to me that > eclipse has some good framework, but it looks to be too much integrated with > it...
All the information you need is in the debuginfo that is embedded in the object files. Existing binutils can read this info -- all you have to do is import it. Andrew.