|
1 | 1 | /// See GDB and LLDB remote protocol documentation for more details: |
2 | 2 | /// * https://sourceware.org/gdb/current/onlinedocs/gdb.html/General-Query-Packets.html |
3 | 3 | /// * https://lldb.llvm.org/resources/lldbgdbremote.html |
4 | | -package struct GDBHostCommand { |
| 4 | +package struct GDBHostCommand: Equatable { |
5 | 5 | enum Error: Swift.Error { |
6 | 6 | case unexpectedArgumentsValue |
7 | 7 | case unknownCommand(kind: String, arguments: String) |
@@ -67,22 +67,27 @@ package struct GDBHostCommand { |
67 | 67 |
|
68 | 68 | package let arguments: String |
69 | 69 |
|
70 | | - package init(kind: String, arguments: String) throws { |
| 70 | + package init(kindString: String, arguments: String) throws { |
71 | 71 | let registerInfoPrefix = "qRegisterInfo" |
72 | | - if kind.starts(with: registerInfoPrefix) { |
| 72 | + if kindString.starts(with: registerInfoPrefix) { |
73 | 73 | self.kind = .registerInfo |
74 | 74 |
|
75 | 75 | guard arguments.isEmpty else { |
76 | 76 | throw Error.unexpectedArgumentsValue |
77 | 77 | } |
78 | | - self.arguments = String(kind.dropFirst(registerInfoPrefix.count)) |
| 78 | + self.arguments = String(kindString.dropFirst(registerInfoPrefix.count)) |
79 | 79 | return |
80 | | - } else if let kind = Kind(rawValue: kind) { |
| 80 | + } else if let kind = Kind(rawValue: kindString) { |
81 | 81 | self.kind = kind |
82 | 82 | } else { |
83 | | - throw Error.unknownCommand(kind: kind, arguments: arguments) |
| 83 | + throw Error.unknownCommand(kind: kindString, arguments: arguments) |
84 | 84 | } |
85 | 85 |
|
86 | | - self.arguments = arguments |
| 86 | + self.arguments = arguments |
| 87 | + } |
| 88 | + |
| 89 | + package init(kind: Kind, arguments: String) { |
| 90 | + self.kind = kind |
| 91 | + self.arguments = arguments |
87 | 92 | } |
88 | 93 | } |
0 commit comments