Author Topic: Forbid debugger from entering certain sources  (Read 4681 times)

Offline mirai

  • Multiple posting newcomer
  • *
  • Posts: 107
Forbid debugger from entering certain sources
« on: September 09, 2011, 06:08:20 pm »
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
// 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;
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.
« Last Edit: September 09, 2011, 07:44:48 pm by mirai »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13438
    • Travis build status
Re: Forbid debugger from entering certain sources
« Reply #1 on: September 09, 2011, 07:09:10 pm »
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 :)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline tigerbeard

  • Almost regular
  • **
  • Posts: 159
Re: Forbid debugger from entering certain sources
« Reply #2 on: October 17, 2021, 11:57:21 am »
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
skip file baseclass.cpp       #this will skip all functions that have implementations in this file. 

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.
 skip file string.h
« Last Edit: October 17, 2021, 01:59:32 pm by tigerbeard »