Opened 9 years ago

Closed 14 months ago

#298 closed enhancement/feature request (fixed)

Add instrumentation code for debug to provide call stack logging

Reported by: Wouldd Owned by: KaZeR
Priority: minor Milestone:
Component: core Version: git master
Severity: normal Keywords: debug, tracing
Cc: gerritv@…


It is possible with GCC to compile an instrumented version of code that will call pre-defined methods on entry/exit to all functions. (except those marked with a special attribute) It is possible to use this mechanism to allow for debug.c to indent logging based on it's position in the call stack. What is more, it can be done in such a way that has no effect at all when not compiled with the flag: -finstrument-functions the process is documented here:

I've attached a patch to debug.c and debug.h as well as a script that can be used to post-process the resulting log files and insert all the function names and file:line nums for the entry/exit logging.

Attachments (3)

debugPatch (5.2 KB) - added by Wouldd 9 years ago.
Patch for debug.c/h (304 bytes) - added by Wouldd 9 years ago.
script to replace function pointers with real function name/location
diff-calltracing (1.7 KB) - added by Gerritv 9 years ago.
add --enable-calltracing

Download all attachments as: .zip

Change History (6)

Changed 9 years ago by Wouldd

Patch for debug.c/h

Changed 9 years ago by Wouldd

script to replace function pointers with real function name/location

Changed 9 years ago by Gerritv

add --enable-calltracing

comment:1 Changed 9 years ago by Gerritv

  • Cc gerritv@… added
  • Milestone set to version 0.2.0

I added a diff to add enable-calltracing to and to include (or not) a new file called instrument.c if calltracing is enabled. instrument.c should contain the code added to debug.c by dwould.

comment:2 Changed 5 years ago by usul

  • Milestone changed from version 0.2.1 to version 0.5.1

I'm sorry, that I'm not that skilled in debugging internals. Can please provide some further details on how this mechanism would be useful? Is this about profiling or getting a full stack trace, which is otherwise hidden?

comment:3 Changed 14 months ago by

  • Milestone version 0.5.1 deleted
  • Resolution set to fixed
  • Severity set to normal
  • Status changed from new to closed

As i know we have gdb for debugging things. If you meant something else please open a new ticket

Note: See TracTickets for help on using tickets.