When hitting breakpoints and stepping into functions, gdb version 6.8 prints the name of the function followed by the function arguments.
It just so happens, in the program I'm debugging, one of the parameter values is a HUGE record being passed by reference. gdb prints the variable name followed by ALL of its member variables. It literally takes gdb a minute or two to print all the member variables contained in the class... which is really annoying when debugging.
I'm pretty sure there is a setting to disable this behavior, what is that setting?
Found it, finally. To disable the output completely:
set print frame-arguments none
To print only scalar values and ignore arrays & structs:
set print frame-arguments scalars
To turn the printing back on:
set print frame-arguments all
I have a way that I've always done this, but seeing your question made me curious to see if there is a better mechanism. I didn't find anything.
You can always set a breakpoint inside the function you're stepping into, but BEFORE you do the step, use the 'commands' command to tell gdb that you don't want it to print anything at all when it hits that breakpoint. An example will make things clearer...
You'll notice that when I run the program, I stop at the breakpoint on line 10 (the call to foo) and it prints my current context. After issuing the 'commands 2' command and telling gdb to be silent on that breakpoint, nothing is printed at all when I hit it. I did the backtrace (bt) just to show that I was where I wanted to be.
Hope this helps:
> cat tmp.cpp
#include <stdio.h>
void foo(int a)
{
printf ("%d\n", a);
}
int main()
{
foo(0);
return 0;
}
> g++ -g tmp.cpp
> gdb a.out
GNU gdb Fedora (6.8-27.el5)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...
(gdb) break 10
Breakpoint 1 at 0x8048491: file tmp.cpp, line 10.
(gdb) break 5
Breakpoint 2 at 0x804846a: file tmp.cpp, line 5.
(gdb) run
Starting program: /home/ronb/software/a.out
Breakpoint 1, main () at tmp.cpp:10
10 foo(0);
(gdb) commands 2
Type commands for when breakpoint 2 is hit, one per line.
End with a line saying just "end".
>silent
>end
(gdb) c
Continuing.
(gdb) bt
#0 foo (a=0) at tmp.cpp:5
#1 0x0804849d in main () at tmp.cpp:10
(gdb)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With