Fix crash from unhandled exceptions in RspConnector#1046
Conversation
plafosse
left a comment
There was a problem hiding this comment.
You changed from throw to return empty but it doesn't look like you're handling that return empty anywhere? Changing RspConnector::ExpectAck() from “throw on protocol failure” to “log and return empty” is not safe for the resume paths that ignore its return value. GdbAdapter::GenericGo, CorelliumAdapter::GenericGo, and EsrevenAdapter::GenericGo all set their local running flag, send the packet, call ExpectAck(), and then continue into ResponseHandler(...) without checking whether the ack failed (public/debugger/core/adapters/gdbadapter.cpp:1052, public/debugger/core/adapters/corelliumadapter.cpp:918, public/debugger/core/adapters/esrevenadapter.cpp:1903). With this PR, a disconnect or malformed ack no longer aborts that flow; it just logs and keeps going. That can leave the adapter/controller believing the target resumed when the command was never successfully acknowledged, which is a behavioral regression from the previous fail-fast behavior.
ui/ui.cpp
Outdated
| frame->navigate(m_controller->GetData(), address, true, true); | ||
| } | ||
|
|
||
| openDebuggerSideBar(frame); |
RspConnector::ExpectAck, TransmitAndReceive, and GetXml threw std::runtime_error on protocol errors, but nothing in the call stack caught them, causing crashes (e.g., in CorelliumAdapter::Connect via LoadRegisterInfo -> GetXml, and GdbAdapter::Connect via TransmitAndReceive -> ExpectAck). Replace all throws with LogError + return empty/default values. Callers already handle empty responses gracefully (e.g., LoadRegisterInfo returns false on parse failure). Fixes #1043 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
75f75cc to
4a4022f
Compare
I changed it so that Also, When |
|
I'm not seeing these changes but that sounds like the appropriate thing to do. |
Summary
throw std::runtime_error(...)inRspConnector::ExpectAck,TransmitAndReceive, andGetXmlwithLogError(...)+ return empty/default valuesCorelliumAdapter::Connect,GdbAdapter::Connect, andEsrevenAdapter::Connect, causing crashes (aborts)LoadRegisterInforeturnsfalseon parse failure, which is already checked)Test plan
Fixes #1043
🤖 Generated with Claude Code