J'ai un moyen que j'ai toujours fait cela, mais voyant votre question m'a fait curieux de voir s'il y a un meilleur mécanisme. Je n'ai rien trouvé.
Vous pouvez toujours définir un point d'arrêt à l'intérieur de la fonction dans laquelle vous intervenez, mais AVANT de faire l'étape, utilisez la commande 'commands' pour indiquer à gdb que vous ne voulez pas imprimer quoi que ce soit ce point d'arrêt. Un exemple rendra les choses plus claires ...
Vous remarquerez que lorsque j'exécute le programme, je m'arrête au point d'arrêt de la ligne 10 (l'appel à foo) et imprime mon contexte actuel. Après avoir lancé la commande 'commands 2' et dit à gdb de rester silencieux sur ce point d'arrêt, rien ne s'imprime quand je le touche. J'ai fait le backtrace (bt) juste pour montrer que j'étais là où je voulais être.
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)