How can I save the debugging status in gdb? - gdb

So that next time I just can continue from where I stopped?

I think you want to use checkpoint
http://sourceware.org/gdb/current/onlinedocs/gdb/Checkpoint_002fRestart.html#Checkpoint_002fRestart

What about generate-core-file???

Related

Prevent breaking/stopping program on signals within GDB

I've run into a bit of an issue. I'm debugging a BOCHS OS emulator in GDB, and it sends Signal 0 fairly often (every time there is a page fault). I was wondering if there was a way to explicitly tell gdb to not break/stop execution on signals?
I've tried "handle all nostop" and specifically "handle 0 nostop", but it doesn't work.
Let me know if there's any additional information I can provide. I'd consider myself only an intermediate gdb user, so any help is great!
I've read this SO question and this man page but neither worked.
I believe you want to set
handle 0 noprint
From the man page
GDB should not mention the occurrence of the signal at all. This implies the nostop keyword as well.
If you run info signals in gdb, it gives you a list of signals by name, which works fine with handle.
For example:
(gdb) handle SIG34 noprint
Signal Stop Print Pass to program Description
SIG34 No No Yes Real-time event 34

Change evaluation timeout in RubyMine debugger

I use RubyMine and its remote debugger. At a breakpoint I want to make an IMAP request so it take a long time. But I get an exception "Timeout: evaluation took longer than 10 seconds."
I tried to increase debug connection timeout in Settings->Debugger. But obviously this trick didn't work.
So is it possible to increase evaluation expresion timeout in RubyMine debugger?
You can change it. Open up Preferences and under Build, Execution, Deployment, select Debugger. From there, there is an option Debug connection timeout (s). Change that value. Or just search for `Debug connection timeout and it should show up highlighted.
My problem was actually not in RubyMine debugger. So the question isn't correct. I've found that the reason of timeout was actual time out of a web-server worker. So the fix is in changing worker timeout. Currently, I'm using Puma, and for it the fix is next (taken from this answer):
# config/puma.rb
if ENV['RACK_ENV'] == 'development'
worker_timeout 3600
end
For those who still looking for an answer, check client.timeout setting. I had the same problem with client.timeout = 240 but works for me with client.timeout = 60. Hope this helps.

Make gdb exit on breakpoint

I'm using gdb to solve a binary bomb as part of a class. Every time we set the bomb off we lose points. I already have a break point on the function that explodes the bomb, but have accidentally stepped past it a couple times already and exploded the bomb. Is there a way to make gdb exit at a specific point rather than just break?
You can attach commands to breakpoints. After you set breakpoint, e.g. #1, do this:
commands 1
quit
end

A server program is on an infinite loop. How to check for it?

A server program is on an infinite loop. How to check for it?
My solution:
use GDB to check the values of condition variables that control the loop.
It is ok for small program.
how to do that for large program ?
If the program is not running in GDB, how to detect the endless loop ?
thanks
You could use some form of a watchdog timer. Have the program output a character or touch a file periodically, so if it gets stuck in a loop, a separate process can detect that the watchdog has not been updated and kill/reset the process.
A lot of microcontrollers have this built into the hardware, and they will automatically reset if you don't reset the timer. It's very handy :)
If the program is running on the server you can attach a GDB process to it by giving its pid.
So for example look for the pid of the process using ps:
ps ax | grep server_process
3789 ?? S 0:00.58 /usr/bin/server_process
3790 ?? S 0:00.58 /usr/bin/server_process
18002 ?? S 0:00.58 grep server_process
You probably want the child:
so use gdb to attach to the running process
gdb /usr/bin/server_process 3790
.... loads symbols
gdb>
Happy tracing :)
Of course replace server_process with your program name and the path appropriately :P
Detecting an infinite loop is called the Halting problem which is undecidable.
So in principle there is no sure way to detect it.

What possible cfthread statuses are there?

I am creating an app that needs to know the current status of dynamically named threads..
But since i was unable to get the value as a variable, i must check for each possible status, in my cfc to return some value indicating the current status...
Been digging for good articles on this....like http://cfsearching.blogspot.com/2008/01/using-runtimeexec-mencoder-and-cfthread.html but the documentation is rather sparse...
Thank You.
According to the docs:
NOT_STARTED
RUNNNG
TERMINATED
COMPLETED
WAITING