aboutsummaryrefslogtreecommitdiff
path: root/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
diff options
context:
space:
mode:
authorMichał Górny <mgorny@moritz.systems>2021-04-14 11:56:09 +0200
committerMichał Górny <mgorny@moritz.systems>2021-07-02 14:36:17 +0200
commit02ef0f5ab483875b7b6b38e24b245e4fd4053959 (patch)
tree15c7dddea23d10ff4821633cb9acafe52978d9e6 /lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
parentcdca1785d35f41ef154d7271bf97c4d1d0e69995 (diff)
downloadllvm-02ef0f5ab483875b7b6b38e24b245e4fd4053959.zip
llvm-02ef0f5ab483875b7b6b38e24b245e4fd4053959.tar.gz
llvm-02ef0f5ab483875b7b6b38e24b245e4fd4053959.tar.bz2
[lldb] [gdb-remote client] Refactor SetCurrentThread*()
Refactor SetCurrentThread() and SetCurrentThreadForRun() to reduce code duplication and simplify it. Both methods now call common SendSetCurrentThreadPacket() that implements the common protocol exchange part (the only variable is sending `Hg` vs `Hc`) and returns the selected TID. The logic is rewritten to use a StreamString instead of snprintf(). A side effect of the change is that thread-id sent is now zero-padded. However, this should not have practical impact on the server as both forms are equivalent. Differential Revision: https://reviews.llvm.org/D100459
Diffstat (limited to 'lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp')
-rw-r--r--lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
index b9fc107..45e0356 100644
--- a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
+++ b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
@@ -98,7 +98,7 @@ TEST_F(GDBRemoteCommunicationClientTest, WriteRegisterNoSuffix) {
});
Handle_QThreadSuffixSupported(server, false);
- HandlePacket(server, "Hg47", "OK");
+ HandlePacket(server, "Hg0000000000000047", "OK");
HandlePacket(server, "P4=" + one_register_hex, "OK");
ASSERT_TRUE(write_result.get());
@@ -143,7 +143,7 @@ TEST_F(GDBRemoteCommunicationClientTest, SaveRestoreRegistersNoSuffix) {
return client.SaveRegisterState(tid, save_id);
});
Handle_QThreadSuffixSupported(server, false);
- HandlePacket(server, "Hg47", "OK");
+ HandlePacket(server, "Hg0000000000000047", "OK");
HandlePacket(server, "QSaveRegisterState", "1");
ASSERT_TRUE(async_result.get());
EXPECT_EQ(1u, save_id);