What I want to know is: suppose I have a function somewhere in the code base, and I need to find out who or what is calling it—how can I trace that back?
No amount of grepping has allowed me to pin-point where in the code this is called. What am I missing? Is there a standard recommended way to to do this?
Find Identifier ReferencesIn theory, there's a reference search function, that you can call in three ways:
*
Menu > Search > Find Identifier References*
Editor context menu > Find > Find Identifier References*
[Ctrl+Shift+I]It should take into account the visibility of identifiers, and, for example, not confuse the class property "
test" with the global variable "
test". Be sure to specify the search scope as "
in all open packages and projects". However, due to numerous specifics (e.g. conditional compilation directives), it may miss some occurrences.
Find In FilesTherefore, a more reliable and "recommended" method is to use file search:
*
Menu > Search > Find In Files*
Editor context menu > Find > Find In Files*
[Ctrl+Shift+F]When working with IDE code, it's best to set the search folder to "
C:\lazarus" or use the "
$LazarusDir()\" macro. I have several IDEs installed, and this really helps avoid confusion.
Depending on what you're searching for, this may return a lot of unnecessary results, but it usually works well enough. You should inspect all results anyway.