Possibly I’m about to make a fool of myself saying this, but since I wasted some time a few days ago I might help someone doing it.
Say you are debugging some feature in your program that is enabled with some command line paramater (“random” example: the –private option in Epiphany for private profiles). One way of passing this to gdb is the –args flag, but another one is to pass them to run/r in the prompt, like:
(gdb) r –private
You do your stuff, and then you decide you need to see what happens without the option. One “obvious” way to do it would be to write, after the previous line:
Right? Wrong. From the GDB manual:
run with no arguments uses the same arguments used by the previous run, or those set by the set args command.
So you’d be basically running your program with –private again. The right way to do it, as the manual says, is to reset the arguments with ‘set args’.
I wonder how many silly things I have done through the years without noticing because I didn’t know this.