diff --git a/src/GdbServer.cc b/src/GdbServer.cc index 5c0a9e550a6..473c3b83bd0 100644 --- a/src/GdbServer.cc +++ b/src/GdbServer.cc @@ -312,7 +312,7 @@ void GdbServer::dispatch_debugger_request(Session& session, return; case DREQ_GET_THREAD_LIST: { vector tids; - if (state != REPORT_THREADS_DEAD) { + if (state != REPORT_THREADS_DEAD && !failed_restart) { for (auto& kv : session.tasks()) { tids.push_back(get_threadid(session, kv.second->tuid())); } @@ -1504,6 +1504,7 @@ void GdbServer::restart_session(const GdbRequest& req) { DEBUG_ASSERT(req.type == DREQ_RESTART); DEBUG_ASSERT(dbg); + failed_restart = false; in_debuggee_end_state = false; timeline.remove_breakpoints_and_watchpoints(); @@ -1517,6 +1518,7 @@ void GdbServer::restart_session(const GdbRequest& req) { cout << " " << c.first; } cout << "\n"; + failed_restart = true; dbg->notify_restart_failed(); return; } @@ -1528,6 +1530,7 @@ void GdbServer::restart_session(const GdbRequest& req) { FrameTime time = compute_time_from_ticks(timeline, ticks); if (time == -1) { cout << "No event found matching specified ticks target.\n"; + failed_restart = true; dbg->notify_restart_failed(); return; } diff --git a/src/GdbServer.h b/src/GdbServer.h index 48730c3c65d..3e628a4ed0b 100644 --- a/src/GdbServer.h +++ b/src/GdbServer.h @@ -209,6 +209,8 @@ class GdbServer { // siginfo for last notified stop. siginfo_t stop_siginfo; bool in_debuggee_end_state; + // True when a restart was attempted but didn't succeed. + bool failed_restart; // True when the user has interrupted replaying to a target event. volatile bool stop_replaying_to_target; // True when a DREQ_INTERRUPT has been received but not handled, or when diff --git a/src/test/restart_invalid_checkpoint.py b/src/test/restart_invalid_checkpoint.py index 30dad46e7e3..ffb87efead6 100644 --- a/src/test/restart_invalid_checkpoint.py +++ b/src/test/restart_invalid_checkpoint.py @@ -16,6 +16,12 @@ send_gdb('checkpoint') expect_gdb('Checkpoint 1 at') send_gdb('restart 8') + +send_gdb('info threads') +# Don't expect anything specific from 'info threads', but make sure gdb at least functions +send_gdb('p 987654321+1') +expect_gdb('987654322') + send_gdb('restart -1') send_gdb('restart abc') send_gdb('restart 1') diff --git a/src/test/seekticks.py b/src/test/seekticks.py index cacbe96b2e9..4d87e2c648f 100644 --- a/src/test/seekticks.py +++ b/src/test/seekticks.py @@ -72,4 +72,10 @@ if ticks8 != ticks7: failed("ERROR: seek-ticks didn't go to correct tick on test %d" % i) +send_gdb('seek-ticks 2000000000') +expect_gdb('No event found matching specified ticks target') +send_gdb('info threads') +# don't expect anything specific from 'info threads', but make sure gdb at least functions +send_gdb('p 123456789+1') +expect_gdb('123456790') ok() diff --git a/src/test/seekticks_threads.py b/src/test/seekticks_threads.py index e10132ac5f7..f689809f86c 100644 --- a/src/test/seekticks_threads.py +++ b/src/test/seekticks_threads.py @@ -1,6 +1,9 @@ from util import * import re, os +send_gdb('restart 9') +expect_gdb(re.compile(r'Checkpoint 9 not found')) + def curr_thread(): send_gdb('thread') expect_gdb(re.compile(r'\[Current thread is \d+ \(Thread (.*?)\)\]')) @@ -44,12 +47,15 @@ def expect_stopped(): [event_C, tick_B, tick_D]] threads = set() +is_first = True for [start_event, initial_tick, other_tick] in tests: center_tick = (initial_tick + other_tick) // 2 send_gdb('run %d' % start_event) - expect_gdb('from the beginning') - send_gdb('y') + if not is_first: + expect_gdb('from the beginning') + send_gdb('y') + is_first = False expect_stopped() thread = curr_thread() @@ -82,6 +88,11 @@ def expect_stopped(): send_gdb('seek-ticks %d' % other_tick) expect_stopped() expect_thread_tick(thread, other_tick) + + send_gdb('info threads') + expect_gdb(r'\d\s*Thread') + expect_gdb(r'\d\s*Thread') + if len(threads) != 2: failed('ERROR: Tested events had the same thread')