[llvm-branch-commits] [lldb] [lldbremote][NFC] Factor out code handling breakpoint packets (PR #192915)
Jonas Devlieghere via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Apr 23 08:24:53 PDT 2026
================
@@ -2900,155 +2900,172 @@ GDBRemoteCommunicationServerLLGS::Handle_qMemoryRegionInfo(
return SendPacketNoLock(response.GetString());
}
-GDBRemoteCommunication::PacketResult
-GDBRemoteCommunicationServerLLGS::Handle_Z(StringExtractorGDBRemote &packet) {
+namespace {
+/// Helper struct to expand a GDBStoppointType into flags.
+struct BreakpointKind {
+ bool want_hardware;
+ bool want_breakpoint;
+ uint32_t watch_flags;
+
+ /// Invalid types must be handled prior to calling this.
+ BreakpointKind(GDBStoppointType stoppoint_type) {
+ switch (stoppoint_type) {
+ case eBreakpointSoftware:
+ want_hardware = false;
+ want_breakpoint = true;
+ break;
+ case eBreakpointHardware:
+ want_hardware = true;
+ want_breakpoint = true;
+ break;
+ case eWatchpointWrite:
+ watch_flags = 1;
+ want_hardware = true;
+ want_breakpoint = false;
+ break;
+ case eWatchpointRead:
+ watch_flags = 2;
+ want_hardware = true;
+ want_breakpoint = false;
+ break;
+ case eWatchpointReadWrite:
+ watch_flags = 3;
+ want_hardware = true;
+ want_breakpoint = false;
+ break;
+ default:
+ llvm_unreachable("unhandled GDBStoppointType");
----------------
JDevlieghere wrote:
Should we move this out of the default case (so we get a warning if a enum value gets added) and retain the benefits of the unreachable by moving it beyond the switch and doing a return in the supported cases?
https://github.com/llvm/llvm-project/pull/192915
More information about the llvm-branch-commits
mailing list