2

I'm wondering if there is a way to see the call path of specific part in c++ program. I'm working in open source code where it contains of many libraries. I tries to follow the code from the path I end up in a template. So if there such a library or profiler to show the call path for just specific part of the code?

Thanks!

  • 1
    You need to provide some background information about the environment you're in (which OS, which IDE you're using, etc). [Maybe google will help too](https://www.google.com/search?q=c%2B%2B+profilers). – Son-Huy Pham Jun 26 '13 at 18:44
  • Thank you. I'm working in Linux OS. No IDE. The call paths that is generated via GNU profiler is huge and unreadable I'm looking only for specific path – Amani AlOnazi Jun 28 '13 at 10:07

1 Answers1

1

Compile application with full debug info, issue a fatal exception in place of interest and do the stack backtracking to console with full call path - source file names and line numbers (if available). Profilers will not be able to do that themselves if there is not enough debug information

Ulterior
  • 2,786
  • 3
  • 30
  • 58
  • + That works if he knows where to put the exception or break point. If he doesn't, then he can just hit Ctrl-C or a pause button, which if he's looking for a performance issue will stop in the right place with probability equal to the amount of time it's costing. – Mike Dunlavey Jun 26 '13 at 21:17
  • I'm working on linux. I'm not using any IDE. I used IPM profiler and TAU but none of them gives a specific call path. GNU profiler generates a call path but a very huge one that is unreadable. I just wanr the call path of specific part. Thanks for the answers :) – Amani AlOnazi Jun 28 '13 at 10:05
  • @AmaniAlOnazi: If you actually meant that you [*used GDB, got the program running, hit Ctrl-C, and then did `bt` to see a backtrace*](http://stackoverflow.com/a/378024/23771), then that trace contains the information you need. When I hear the word "unreadable" I'm sure you don't mean "I'm one of those programmers who expects everything to be easy." :) – Mike Dunlavey Jun 28 '13 at 19:06