[Lldb-commits] [lldb] [lldb][NFC] Add test utility for sending gdbremote packets (PR #195247)

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Fri May 1 04:45:01 PDT 2026


================
@@ -1869,3 +1870,25 @@ def launch_exe_in_apple_simulator(
                 break
 
     return exe_path, matched_strings
+
+
+# Binary escapes `packet_str`, sends it to the remote and returns the reply.
+def send_packet_get_reply(test, packet_str):
+    packet_str = escape_binary(packet_str)
+    test.runCmd(f"proc plugin packet send '{packet_str}'", check=False)
+    # The output is of the form:
+    #  packet: <packet_str>
+    #  response: <response>
+    output = test.res.GetOutput()
+    reply = output.split("\n")
+    packet = reply[0].strip()
+    response = reply[1].strip()
+
+    test.assertTrue(packet.startswith("packet: "))
+    test.assertTrue(response.startswith("response: "))
----------------
Teemperor wrote:

Can you add to the message the full package/response so when the test fails we can directly see what it sent? (the original one code did that too kinda)

https://github.com/llvm/llvm-project/pull/195247


More information about the lldb-commits mailing list