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
  • 61,078
  • 31
  • 152
  • 193
Ravi Gadhia
  • 490
  • 3
  • 11
  • 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. m. could be an AI
  • 112,515
  • 14
  • 128
  • 243
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,805
  • 17
  • 110
  • 144