User forums > Using Code::Blocks

Forbid debugger from entering certain sources


Is it possible to tell CB debugger to skip certain source files or functions when executing "step into" command ?
Expected behavior would be stopping at first allowed file or line after exiting places excluded from debugging.

The problem is that when executing "step into" command, debugger follows very exact execution path as it should do as a good and honest debugger, but sometime this peculiarity becomes too irritating.

In the following example

--- Code: ---// source#1: a.h, a.cpp
class A
 // class internals

// source #2: bar.h, bar.cpp
A bar(A& b)
 A c;
 // do something to b & c ..
 return c;

// source #3: foo.h, foo.cpp
void foo(void)
 A a;

--- End code ---
when stepping inside bar(a) the debugger will end up in the constructor of class A, but not in the bar() function.

This situation occurs very often and results in long and accurate stepping inside code that should not be debugged at all just to get to a desired location.
An ability to explicitly mark places in source code (units, functions) where debugger should not stop would be very useful.

No, ask the GDB devs to implement this and then we will integrate it in C::B :)
Until then it is not possible.

Probably you can check what can be done with python scripting and if you find something useful share it with us :)

I know its an old post, but I keep finding it when searching this issue. This info is from,24175.msg164871.html#msg164871

There is a function in gdb to do this, the "skip" function
Example for the gdb command line
--- Code: ---skip file baseclass.cpp       #this will skip all functions that have implementations in this file.
--- End code ---

The command defines functions that will be ignored by "step into". There are other ways beside the filename, including regex expressions.
The manual mentions it could be used like break points which I think sounds quite useful.

Currently CB does not seem to support this. To use it  either enter at the debugger command line (temporary use) or add to the  startup command section in the Debugger Settings Dialog.

Example for wxString
Adding this line as startup command in the Settings/Debugger for gdb will step over any wxString constructors and destructors in functions calls.

--- Code: --- skip file string.h
--- End code ---


[0] Message Index

Go to full version