diff --git a/src/GdbCommand.cc b/src/GdbCommand.cc index 11b79f2b9a5..d3c77fbaa01 100644 --- a/src/GdbCommand.cc +++ b/src/GdbCommand.cc @@ -109,6 +109,9 @@ static int gNextCheckpointId = 0; string invoke_checkpoint(GdbServer& gdb_server, Task*, const vector& args) { const string& where = args[0]; + if (gdb_server.in_debuggee_end_state) { + return string("The program is not being run."); + } int checkpoint_id = ++gNextCheckpointId; GdbServer::Checkpoint::Explicit e; if (gdb_server.timeline.can_add_checkpoint()) { diff --git a/src/test/restart_invalid_checkpoint.py b/src/test/restart_invalid_checkpoint.py index dd9aeadda8c..30dad46e7e3 100644 --- a/src/test/restart_invalid_checkpoint.py +++ b/src/test/restart_invalid_checkpoint.py @@ -1,8 +1,12 @@ from util import * +send_gdb('c') +send_gdb('checkpoint') +expect_gdb('is not being run') + send_gdb('b main') expect_gdb('Breakpoint 1') -send_gdb('c') +restart_replay() expect_gdb('Breakpoint 1') send_gdb('b atomic_puts') expect_gdb('Breakpoint 2')