Home > Software engineering >  Debugger (C) steps into stdio.h library, how do i prevent that?
Debugger (C) steps into stdio.h library, how do i prevent that?

Time:03-18

I have a "problem" about my debugger.

When I debug, I usually use the command step into, to go forward, and everything was going smooth. Then some day, when I stepped into a function like printf(), or fscanf(), the debugger started taking me into the actual library, <stdio.h>...

I know I can avoid this just using the command step over, but I'm really used to debug my code easily and fast, just by pressing constantly the same button, and I don't want to switch every 3 seconds from step into to step over, because I want to focus on my code flow...

Can anyone help me please?

If you need other info, of course I'm going to give them to you.

CodePudding user response:

As you have tagged Visual Studio Code, I am answering for the debugger in that IDE. To execute and then leave a function you have entered while debugging, you can press SHIFT F11. (This would in effect be "the opposite" of entering a function, which is F11.) From the Microsoft documentation a description of Step Out can be found:

"Click Step Out on the Debug menu to resume running on the target. This command executes the rest of the current function and breaks when the function return is completed."

CodePudding user response:

You can use ~/.gdbinit configuration file, see man gdbinit

skip file /usr/include/stdio.h

You can check it in gdb using info skip:

(gdb) info skip
Num   Enb Glob File                 RE Function
1     y      n /usr/include/stdio.h  n <none>
(gdb)

You can skip a whole file skip file /what/ever.c or a function : skip printf

  • Related