It is a bit difficult to discern what exactly you are asking, but I hope I understood you correctly.
Yes, you can normally run the debugged command again from within gdb
as long as it was started with gdb
in the first place. In fact this is the common workflow for gdb
. Use it in one window/tab/pane to debug your stuff and fix the code in another, rebuild in a third etc.
One way gdb
gets started is this one:
# gdb --args command arg1 arg2 ...
another is:
# gdb command
in the latter case you would anyway only start the program from the gdb prompt like this.
(gdb) run arg1 arg2 ...
in the former the arguments are implied (and remembered by gdb
). In either case you can retrieve the arguments after the fact using:
(gdb) show args
It is common to rebuild the program once you hit, analyzed and fixed a bug re-run it using only run
(which reuses the previous arguments) and verify the fix or continue debugging another problem.