I'm a casual C developer. Up until recently it's been kind of a love/hate relationship. I mostly attribute that to being ignorant of the breadth of debugging, tuning, and profiling toolsets that are out there.
We use an open source tile rendering engine that's entirely written in C. My goal is to identify it's data access patterns. This will help me determine which functions need to be optimized, or how to reorder the data on disk to to optimize for those data access patterns.
I'm going to eventually end up reading the whole codebase, but I'm certain that there are best practices for determining this kind of information that I am just unaware of. I'm vaguely familiar with gdb and valgrind, but I feel like I'm only scratching the surface of their capabilities.
What kind of tooling is everyone else using these days? My specific use case is on linux, but I'd appreciate tips across the board.
I'm also interested to see if recompiling with llvm and clang would give me any performance increase. I see there are malloc replacements like tcmalloc and hoard. Does anyone have experience with these?
http://sourceware.org/binutils/docs/gprof/Compiling.html#Com...
There are better alternatives as well. But adding -pg first is just so easy, and usually (I've found for my stuff) is enough...
For code discovery: I've experimented with strace as others mention (and ltrace). And there are awesome things like Fenris in theory:
http://lcamtuf.coredump.cx/fenris/devel.shtml
But I could never really get them to work personally in practice. Though I learned a lot about what good integration at the terminal level could look like by browsing them. At some point, I hacked together vim and gdb integration pretty well for my purposes (or I should say, improved on the clewn project. I'm pretty happy with it). I wonder if others have done similar things. Anyway, I'm curious what others say as well.