8

Is there any library in C like python's inspect?

def myfunction():
   import inspect
   inspect.stack(): # this give you complete stack up to this function call

It's very useful to debug python program.

Actually I want to debug GTK Combobox widget, to understand complete flow I need complete function call stack.

So is there any similar library of Technic in C language like python inspect package?

rid
  • 57,636
  • 30
  • 143
  • 185
Ravi Gadhia
  • 460
  • 3
  • 9
  • 3
    You can use GDB to get a stack trace. Otherwise see this discussion: http://stackoverflow.com/questions/77005/how-to-generate-a-stacktrace-when-my-gcc-c-app-crashes – user786653 Aug 05 '11 at 09:26

2 Answers2

2

No such portable library exists. There's a solution specific to GNU libc.

n. 1.8e9-where's-my-share m.
  • 102,958
  • 14
  • 123
  • 225
0

If you are using gcc you can have a look at this (old) blog about getting the stacktrace in runtime.

C++ stack traces with GCC

epatel
  • 45,445
  • 17
  • 107
  • 143