1

I often spend lots of time trying to find out where the exact implementation is located. It gets very frustrating when dealing with some low-level code that might end up somewhere in kernel.

I usually just google or try to guess the location and/or method names, but it is not always very effective.

Is there some methodical way to trace the flow up to the implementation? How do you guys usually do it?

haccks
  • 104,019
  • 25
  • 176
  • 264
Andres Traumann
  • 144
  • 1
  • 8
  • 1
    possible duplicate of [How can one grab a stack trace in C?](http://stackoverflow.com/questions/105659/how-can-one-grab-a-stack-trace-in-c) – Schulze Thomas Oct 04 '13 at 20:23

2 Answers2

0

There used to be a ctrace program that did just that but I don't think it is actively maintained.

Ultimately, it depends what exactly you are trying to achieve. It actually looks like you want to look up a specific function rather than trace it. If that is the case indeed, consider using some kind of source browser: from etags to cscope to OpenGrok.

Alexander L. Belikoff
  • 5,698
  • 1
  • 25
  • 31
  • valgrind is a memory debugging tool (among other things, but that's its primary purpose). It doesn't trace execution. –  Oct 04 '13 at 20:26
  • I believe, valgrind has a way to spit all functions hit (need to look it up). Anyway, removed from the response. – Alexander L. Belikoff Oct 04 '13 at 20:34
0

Load the whole the code with relevant dependencies to a graphical IDE (NetBeans can do it, for instance) which can to call graph, declaration-definition jumps, etc. or use LibClang and its wrapper for the text editor of your choice, it is also very good at indexing. At last, you can consider classics, ctags, which can link definition and declaration points.

bobah
  • 18,364
  • 2
  • 37
  • 70