My project contains many files.
Sometimes I need to know where a particular function is defined (implemented) in source code. What I currently do is text search within source files for the function name, which is very time consuming.
My question is: Is there a better way (compiler/linker flag) to find that function definition in source files?.... Since the linker has gone through all the trouble of resolving all these references already.
I am hoping for method better than stepping into a function call in debugger, since a function can be buried within many calls.
Try cscope utility.
From the manual:
Allows searching code for:
files including a file
Curses based (text screen)
A "screenshot":
C symbol: atoi
File Function Line
0 stdlib.h <global> 86 extern int atoi (const char *nptr);
1 dir.c makefilelist 336 dispcomponents = atoi(s);
2 invlib.c invdump 793 j = atoi(term + 1);
3 invlib.c invdump 804 j = atoi(term + 1);
4 main.c main 287 dispcomponents = atoi(s);
5 main.c main 500 dispcomponents = atoi(s);
6 stdlib.h atoi 309 int atoi (const char *nptr) __THROW
Find this C symbol:
Find this global definition:
Find functions called by this function:
Find functions calling this function:
Find this text string:
Change this text string:
Find this egrep pattern:
Find this file:
Find files #including this file: