Issue
i run my program in background as follows:
nohup ./program -c config.cfg &
So i saw segmentation fault in my program and decided to run my program with gdb
. My program has some infinite loops and may take some hours to deal with a segmentation fault error, again.
So i want to run the program on background.
How should i pass the gdb arguments to nohup
?
Solution
I tried my hand at getting the gdb
debugger to run in the background, but it's designed to be an interactive tool. I think what you are looking for here is a screen
. A screen
allows you to background the entire shell session by creating a virtual terminal.
Create the screen instance:
me@mybox$ screen -S my_screen_name
Then run:
me@mybox$ gdb --args ./program -c config.cfg
Once you are in the screen, Ctrl-A-D
will detach the screen so you can go about your business and it will keep running.
To reattach:
me@mybox$ screen -r my_screen_name
Once you are done, type Ctrl-D
in the screen to terminate the screen. For more help with screens, see man screen
.
Answered By - stephentgrammer Answer Checked By - Pedro (WPSolving Volunteer)