Skip to content

Commit b36cab0

Browse files
committed
Fix formatting
1 parent ee049f0 commit b36cab0

File tree

2 files changed

+82
-81
lines changed

2 files changed

+82
-81
lines changed

Sources/GDBRemoteProtocol/GDBHostCommand.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ package struct GDBHostCommand: Equatable {
8282
let registerInfoPrefix = "qRegisterInfo"
8383

8484
if kindString.starts(with: "x") {
85-
self.kind = .readMemoryBinaryData
86-
self.arguments = String(kindString.dropFirst())
87-
return
85+
self.kind = .readMemoryBinaryData
86+
self.arguments = String(kindString.dropFirst())
87+
return
8888
} else if kindString.starts(with: "m") {
89-
self.kind = .readMemory
90-
self.arguments = String(kindString.dropFirst())
91-
return
89+
self.kind = .readMemory
90+
self.arguments = String(kindString.dropFirst())
91+
return
9292
} else if kindString.starts(with: registerInfoPrefix) {
9393
self.kind = .registerInfo
9494

Sources/WasmKitGDBHandler/WasmKitDebugger.swift

Lines changed: 76 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -24,90 +24,91 @@ package actor WasmKitDebugger {
2424
logger.trace("handling GDB host command", metadata: ["GDBHostCommand": .string(command.kind.rawValue)])
2525

2626
var isNoAckModeActivated = false
27-
switch command.kind {
28-
case .startNoAckMode:
29-
isNoAckModeActivated = true
30-
fallthrough
31-
32-
case .isThreadSuffixSupported, .listThreadsInStopReply:
33-
responseKind = .ok
34-
35-
case .hostInfo:
27+
switch command.kind {
28+
case .startNoAckMode:
29+
isNoAckModeActivated = true
30+
fallthrough
31+
32+
case .isThreadSuffixSupported, .listThreadsInStopReply:
33+
responseKind = .ok
34+
35+
case .hostInfo:
36+
responseKind = .keyValuePairs([
37+
"arch": "wasm32",
38+
"ptrsize": "4",
39+
"endian": "little",
40+
"ostype": "wasip1",
41+
"vendor": "WasmKit",
42+
])
43+
44+
case .supportedFeatures:
45+
responseKind = .raw("qXfer:libraries:read+;PacketSize=1000;")
46+
47+
case .vContSupportedActions:
48+
responseKind = .vContSupportedActions([.continue, .step])
49+
50+
case .isVAttachOrWaitSupported, .enableErrorStrings, .structuredDataPlugins, .readMemoryBinaryData:
51+
responseKind = .empty
52+
53+
case .processInfo:
54+
responseKind = .keyValuePairs([
55+
"pid": "1",
56+
"parent-pid": "1",
57+
"arch": "wasm32",
58+
"endian": "little",
59+
"ptrsize": "4",
60+
])
61+
62+
case .currentThreadID:
63+
responseKind = .raw("QC1")
64+
65+
case .firstThreadInfo:
66+
responseKind = .raw("m1")
67+
68+
case .subsequentThreadInfo:
69+
responseKind = .raw("l")
70+
71+
case .targetStatus:
72+
responseKind = .keyValuePairs([
73+
"T05thread": "1",
74+
"reason": "trace",
75+
])
76+
77+
case .registerInfo:
78+
if command.arguments == "0" {
3679
responseKind = .keyValuePairs([
37-
"arch": "wasm32",
38-
"ptrsize": "4",
39-
"endian": "little",
40-
"ostype": "wasip1",
41-
"vendor": "WasmKit",
42-
])
43-
44-
case .supportedFeatures:
45-
responseKind = .raw("qXfer:libraries:read+;PacketSize=1000;")
46-
47-
case .vContSupportedActions:
48-
responseKind = .vContSupportedActions([.continue, .step])
49-
50-
case .isVAttachOrWaitSupported, .enableErrorStrings, .structuredDataPlugins, .readMemoryBinaryData:
51-
responseKind = .empty
52-
53-
case .processInfo:
54-
responseKind = .keyValuePairs([
55-
"pid": "1",
56-
"parent-pid": "1",
57-
"arch": "wasm32",
58-
"endian": "little",
59-
"ptrsize": "4",
60-
])
61-
62-
case .currentThreadID:
63-
responseKind = .raw("QC1")
64-
65-
case .firstThreadInfo:
66-
responseKind = .raw("m1")
67-
68-
case .subsequentThreadInfo:
69-
responseKind = .raw("l")
70-
71-
case .targetStatus:
72-
responseKind = .keyValuePairs([
73-
"T05thread": "1",
74-
"reason": "trace",
80+
"name": "pc",
81+
"bitsize": "64",
82+
"offset": "0",
83+
"encoding": "uint",
84+
"format": "hex",
85+
"set": "General Purpose Registers",
86+
"gcc": "16",
87+
"dwarf": "16",
88+
"generic": "pc",
7589
])
90+
} else {
91+
responseKind = .raw("E45")
92+
}
7693

77-
case .registerInfo:
78-
if command.arguments == "0" {
79-
responseKind = .keyValuePairs([
80-
"name": "pc",
81-
"bitsize": "64",
82-
"offset": "0",
83-
"encoding": "uint",
84-
"format": "hex",
85-
"set": "General Purpose Registers",
86-
"gcc": "16",
87-
"dwarf": "16",
88-
"generic": "pc",
89-
])
90-
} else {
91-
responseKind = .raw("E45")
92-
}
93-
94-
case .transfer:
95-
if command.arguments.starts(with: "libraries:read:") {
96-
responseKind = .raw("""
94+
case .transfer:
95+
if command.arguments.starts(with: "libraries:read:") {
96+
responseKind = .raw(
97+
"""
9798
l<library-list>
9899
<library name="\(self.moduleFilePath.string)"><section address="0x4000000000000000"/></library>
99100
</library-list>
100101
""")
101-
} else {
102-
throw Error.unknownTransferArguments
103-
}
102+
} else {
103+
throw Error.unknownTransferArguments
104+
}
104105

105-
case .readMemory:
106-
responseKind = .empty
106+
case .readMemory:
107+
responseKind = .empty
107108

108-
case .wasmCallStack, .generalRegisters:
109-
fatalError()
110-
}
109+
case .wasmCallStack, .generalRegisters:
110+
fatalError()
111+
}
111112

112113
logger.trace("handler produced a response", metadata: ["GDBTargetResponse": .string("\(responseKind)")])
113114

0 commit comments

Comments
 (0)