Who calls this feature?

On my last assignment (old FORTRAN code 77), we had cross-reference files that list which subprograms are called other subprograms, in which subprograms of files were defined, which common blocks contained which variables, which routines included some common blocks, etc. .d .. Then they were used by shell scripts that grepped cross-reference files and told you about the design of the program.

Now I am in a new company (C ++ code) and I found ctags to replace some of these functions. The only thing I missed was the command we called "who.calls", which lists which subroutines (I mean functions or methods that should get used to OO-talk) call this subroutine. For example, if a subroutine foocalls a subroutine bar:

>who.calls bar
foo

Any suggestions on how to do this without re-equipping the programming environment from my old company? I am looking for a super-regular expression or some other method that I can use on the command line, but I am open to other methods that use a completely different approach to give me the same information. I basically want to discover the stack of the debugging function without starting the debugger.

+3
source share
5 answers

You may consider using doxygen . It can create web pages that show you the entire call tree and class structure, and also retrieve properly formatted comments to document classes and methods, as Javadoc does for java.

Another possibility is to start using the IDE. After 25 years of using vi (and then gvim) and ctags, I recently joined the 21st century and started using Eclipse (I do Java, but I saw C ++ plugins for Eclipse). Along with being able to do whatever tags can do, it can also redirect you to all calls to the current method. And on top of that, a damn good interactive debugger is built into it.

+5

cscope; :

  • :
    • ,
    • ,
    • ,

++, ++ ( ).

-, OpenGrok, . , , , .

+4

SlickEdit , , "show reference". who.calls , - . .

+2
+1

, , SD. . langauge, (, " TAX" ). langauge, , . C, ++, #, COBOL, Java, ECMAScript, Java, XML, Verilog, VHDL , FORTRAN.

It is easy to find who calls X in Fortran with this tool; just look for all the identifiers "X". The actual query you have is this: I = X ("any identifier with the name X"). This finds all references to the entire base of the code of the sauce.

0
source

Source: https://habr.com/ru/post/1703130/


All Articles