Reputation: 1071
this post briefly discusses the same trouble I am facing. Essentially, is there a default setting or a hack for gdb to stop stepping inside every single glib library and only step inside user files? I know I can call finish
each time it steps inside one but it's some wasted keystrokes I'd rather avoid.
It's already annoying as it is to deal with g++'s output. If this exhibitionism cannot be stopped, are there good alternatives to these gnu tools? I do hear good things about eclipse, but I'm just a student looking for quick and dirty fixes with minimal effort.
Upvotes: 4
Views: 1268
Reputation: 33944
If you have GDB 7.12.1 or above you can add the following to your ~/.gdbinit
file:
skip -gfi /usr/include/c++/*/*/*
skip -gfi /usr/include/c++/*/*
skip -gfi /usr/include/c++/*
Double check that these are in fact the right places for those libs. This answer comes from here.
Some options without editing gdb init
If you want to "step over" a line (like std::vector<int> a;
) without stepping into it, you can use next
.
If you have a situation like int b = is_negative(a[0])
and you want to stop in is_negative
you have a few options:
a[0]
function then use finish
to step out again.tbreak is_negative
to create a temporary breakpoint on the is_negative
function then use next
to step which will break on the breakpoint. 2 is faster in the case where you have something with many sub calls in a function like:
is_negative(a[b.at(2)] * c[3]);
Upvotes: 7