When range stepping, start with a single step, as expected by GDB
This commit is contained in:
@@ -176,7 +176,8 @@ namespace DebugServer::Gdb::AvrGdb
|
||||
* The target stopped due to an intercepting breakpoint, but we're still within the stepping range,
|
||||
* which can only mean that we weren't sure where this instruction would lead to.
|
||||
*
|
||||
* We must perform a single step and see what happens.
|
||||
* We must perform a single step and see what happens. If the instruction takes us out of the stepping
|
||||
* range, we'll end the session and report back to GDB.
|
||||
*/
|
||||
Logger::debug("Reached intercepting breakpoint within stepping range");
|
||||
Logger::debug("Attempting single step from 0x" + StringService::toHex(programAddress));
|
||||
@@ -191,7 +192,7 @@ namespace DebugServer::Gdb::AvrGdb
|
||||
* We performed a single step once and we're still within the stepping range, so we're good to
|
||||
* continue the range stepping session.
|
||||
*/
|
||||
Logger::debug("Completed single step from an intercepted address - PC still within stepping range");
|
||||
Logger::debug("Completed single step - PC still within stepping range");
|
||||
Logger::debug("Continuing range stepping");
|
||||
|
||||
activeRangeSteppingSession->singleStepping = false;
|
||||
|
||||
@@ -205,7 +205,16 @@ namespace DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
}
|
||||
|
||||
debugSession.startRangeSteppingSession(std::move(rangeSteppingSession), targetControllerService);
|
||||
targetControllerService.continueTargetExecution(std::nullopt, std::nullopt);
|
||||
|
||||
/*
|
||||
* GDB expects us to start the range stepping session with a single step, and then only continue if the
|
||||
* single step didn't immediately take us out of the stepping range.
|
||||
*
|
||||
* So we kick off a single step here, then let AvrGdbRsp::handleTargetStoppedGdbResponse() determine if
|
||||
* we should continue. See that member function for more.
|
||||
*/
|
||||
debugSession.activeRangeSteppingSession->singleStepping = true;
|
||||
targetControllerService.stepTargetExecution(std::nullopt);
|
||||
debugSession.waitingForBreak = true;
|
||||
|
||||
} catch (const Exception& exception) {
|
||||
|
||||
@@ -28,8 +28,8 @@ namespace DebugServer::Gdb
|
||||
std::set<Targets::TargetMemoryAddress> interceptedAddresses;
|
||||
|
||||
/**
|
||||
* Whether we're currently performing a single step, in this session, to observe the behaviour of a particular
|
||||
* instruction.
|
||||
* Whether we're currently performing a single step, in this session, to start the session or observe the
|
||||
* behaviour of a particular instruction.
|
||||
*
|
||||
* See AvrGdbRsp::handleTargetStoppedGdbResponse() for more.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user