Code::Blocks Forums

User forums => Help => Topic started by: verthex on July 14, 2011, 05:49:54 pm

Title: Debugger Help-stepping through a program without going into other files.
Post by: verthex on July 14, 2011, 05:49:54 pm
I just upgraded to a newer version of codeblocks (from 8.x to 10.x) and I noticed that the debugger steps into files related to my project and it includes stl files like list and vectors which I dont really care about stepping through. Is there a way to make the debugger stick to the main file only without having to step into every single std::cout and std::endl?

Title: Re: Debugger Help-stepping through a program without going into other files.
Post by: oBFusCATed on July 14, 2011, 06:11:07 pm
Hm, are you sure that the problem is in C::B?
Because the real debugger is GDB, C::B is just the wrapper (it starts gdb and issues commands to it, then parses the output).
And as far as I know there is no way to black list functions for the step into command in GDB.

If you explain the problem a bit more clearly, we might help you...
Title: Re: Debugger Help-stepping through a program without going into other files.
Post by: verthex on July 14, 2011, 06:38:01 pm
This is an example program:

Code
#include <iostream>
#include <vector>

int main()
{
std::vector <int> value;

value.push_back(0);

std::cout<<value[0]<<std::endl;

return 0;
}

Basically I set the breakpoint at the line before I use,
Code
value.push_back(0);

and I start the debugger and I step through the program using only F7 and I end up stepping into these 4 files.

stl_vector.h
basic_ios.h
locale_facets.h
new_allocator.h

Is there some way to prevent this from happening? I used to be able to debug without seeing those steps in the version 8.x of codeblocks.
Title: Re: Debugger Help-stepping through a program without going into other files.
Post by: Jenna on July 14, 2011, 07:37:20 pm
This can happen, if you use "Step into" instead of "Next line".
The cause why it did not happen in 8.02 is most likely, that older gdb's have not been able to step into constructors, but newer can.
Title: Re: Debugger Help-stepping through a program without going into other files.
Post by: verthex on July 15, 2011, 01:46:02 am
So basically there is no way to turn it off?
Title: Re: Debugger Help-stepping through a program without going into other files.
Post by: Jenna on July 15, 2011, 06:34:43 am
So basically there is no way to turn it off?
This can happen, if you use "Step into" instead of "Next line".

If you really do that, this is the expected behaviour.
"Step into" means step into the function you call (if possible) and a constructor is a function (obviously), the same would happen for all function with a "reachable" implemantation (e.g. most likely inline-functions).
So you should use "Next line" in most cases (if you don't want to debug the called functions).

And as oBFusCATed wrote:
And as far as I know there is no way to black list functions for the step into command in GDB.
Title: Re: Debugger Help-stepping through a program without going into other files.
Post by: verthex on July 15, 2011, 08:05:24 am
Quote
So you should use "Next line" in most cases (if you don't want to debug the called functions).

By pressing F7 which is what I explained above and that's the problem I'm having.
Title: Re: Debugger Help-stepping through a program without going into other files.
Post by: ollydbg on July 15, 2011, 08:13:44 am
Quote
So you should use "Next line" in most cases (if you don't want to debug the called functions).

By pressing F7 which is what I explained above and that's the problem I'm having.
In you menu->Debug
F7 is assigned to "Next Line" or "Step into"?
Title: Re: Debugger Help-stepping through a program without going into other files.
Post by: verthex on July 15, 2011, 08:22:54 am
Quote
In you menu->Debug
F7 is assigned to "Next Line" or "Step into"?

F7 - Next Line.
Shift-F7 Step into.

My gdb version is 6.8.
Title: Re: Debugger Help-stepping through a program without going into other files.
Post by: ollydbg on July 15, 2011, 08:29:08 am
Quote
In you menu->Debug
F7 is assigned to "Next Line" or "Step into"?

F7 - Next Line.
Shift-F7 Step into.

My gdb version is 6.8.
Your code works fine on my PC (mingw 4,5, gdb 7.2)

I guess mostly your gcc or gdb has some problem, so, you should try a recent ones.
Title: Re: Debugger Help-stepping through a program without going into other files.
Post by: verthex on July 15, 2011, 08:31:17 am
Well I downloaded the most recent codeblocks for XP (may 27, 2010) here:
http://www.codeblocks.org/downloads/26

How would I upgrade to gdb 7.2?
Title: Re: Debugger Help-stepping through a program without going into other files.
Post by: zabzonk on July 15, 2011, 11:48:00 am
Upgrade both your compiler and debugger at http://tdm-gcc.tdragon.net - the current gdb there is 7.1.
Title: Re: Debugger Help-stepping through a program without going into other files.
Post by: verthex on July 15, 2011, 12:18:46 pm
Quote
Upgrade both your compiler and debugger at http://tdm-gcc.tdragon.net - the current gdb there is 7.1.

Thanks for the help but I did it differently. I downloaded gdb 7.2 from here http://ftp.gnu.org/gnu/gdb/
opened it into the C:\gdb-7.2 directory and used cygwin to compile it by using
./configure
make

and then I just went into the c:\gdb-7.2\gdb directory and used the gdb.exe file from there and replaced the gdb.exe in the mingw/bin folder.

It took forever to compile gdb though but it works now!  :D