Permalink
Browse files

Generate fake SIGKILL when the last task in the debuggee task group i…

…s about to exit.

This lets users reverse-execute from the task exit.

Resolves #1490.
  • Loading branch information...
rocallahan committed Jun 6, 2015
1 parent e56b58a commit ef4c2f05ff71437d6af4d106801d6a4c31eff289
View
@@ -551,6 +551,7 @@ set(TESTS_WITHOUT_PROGRAM
env_newline
execp
explicit_checkpoint_clone
final_sigkill
fork_exec_info_thr
get_thread_list
hardlink_mmapped_files
View
@@ -59,7 +59,10 @@ static bool request_needs_immediate_response(const GdbRequest* req) {
}
GdbConnection::GdbConnection(pid_t tgid, const Features& features)
: tgid(tgid), no_ack(false), inlen(0), outlen(0), features(features) {
: tgid(tgid), no_ack(false), inlen(0), outlen(0), features_(features) {
#ifndef REVERSE_EXECUTION
features_.reverse_execution = false;
#endif
memset(&req, 0, sizeof(req));
}
@@ -648,11 +651,9 @@ bool GdbConnection::query(char* payload) {
LOG(debug) << "gdb supports " << args;
const char* reverse_exec = "";
#ifdef REVERSE_EXECUTION
if (features.reverse_execution) {
if (features().reverse_execution) {
reverse_exec = ";ReverseContinue+;ReverseStep+";
}
#endif
snprintf(supported, sizeof(supported) - 1,
"PacketSize=%zd;QStartNoAckMode+;qXfer:auxv:read+"
";qXfer:siginfo:read+;qXfer:siginfo:write+;multiprocess+%s",
View
@@ -393,6 +393,8 @@ class GdbConnection {
*/
bool sniff_packet();
const Features& features() { return features_; }
private:
GdbConnection(pid_t tgid, const Features& features);
@@ -486,7 +488,7 @@ class GdbConnection {
ssize_t packetend; /* index of '#' character */
uint8_t outbuf[32768]; /* buffered output for gdb */
ssize_t outlen;
Features features;
Features features_;
};
#endif /* RR_GDB_CONNECTION_H_ */
View
@@ -590,6 +590,13 @@ void GdbServer::maybe_notify_stop(const BreakStatus& break_status) {
if (break_status.signal) {
sig = break_status.signal;
}
if (break_status.task_exit && dbg->features().reverse_execution &&
break_status.task->task_group()->task_set().size() == 1) {
// The exit of the last task in a task group generates a fake SIGKILL,
// when reverse-execution is enabled, because users often want to run
// backwards from the end of the task.
sig = SIGKILL;
}
if (sig >= 0) {
/* Notify the debugger and process any new requests
* that might have triggered before resuming. */
View
@@ -1426,10 +1426,11 @@ static void end_task(Task* t) {
delete t;
}
Completion ReplaySession::exit_task(Task* t, const StepConstraints& constraints) {
Completion ReplaySession::exit_task(Task* t,
const StepConstraints& constraints) {
if (tasks().size() == 1) {
LOG(debug) << "last interesting task is " << t->rec_tid << " ("
<< t->tid << ")";
LOG(debug) << "last interesting task is " << t->rec_tid << " (" << t->tid
<< ")";
set_last_task(t);
return COMPLETE;
}
View
@@ -0,0 +1,11 @@
from rrutil import *
import re
send_gdb('handle SIGKILL stop')
send_gdb('c')
expect_gdb('received signal SIGKILL')
send_gdb('c')
expect_gdb('exited normally')
ok()
@@ -0,0 +1,3 @@
source `dirname $0`/util.sh
record simple$bitness
debug final_sigkill
View
@@ -1,2 +1,3 @@
set pagination off
handle SIGSEGV stop
handle SIGKILL nostop

0 comments on commit ef4c2f0

Please sign in to comment.