Skip to content

Commit c8107a2

Browse files
[lldb][GDBRemote] Parse MultiBreakpoint+ capability
1 parent 5c73c7a commit c8107a2

3 files changed

Lines changed: 35 additions & 0 deletions

File tree

lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,12 @@ bool GDBRemoteCommunicationClient::GetMultiMemReadSupported() {
217217
return m_supports_multi_mem_read == eLazyBoolYes;
218218
}
219219

220+
bool GDBRemoteCommunicationClient::GetMultiBreakpointSupported() {
221+
if (m_supports_multi_breakpoint == eLazyBoolCalculate)
222+
GetRemoteQSupported();
223+
return m_supports_multi_breakpoint == eLazyBoolYes;
224+
}
225+
220226
bool GDBRemoteCommunicationClient::QueryNoAckModeSupported() {
221227
if (m_supports_not_sending_acks == eLazyBoolCalculate) {
222228
m_send_acks = true;
@@ -346,6 +352,7 @@ void GDBRemoteCommunicationClient::ResetDiscoverableSettings(bool did_exec) {
346352
m_supported_async_json_packets_sp.reset();
347353
m_supports_jModulesInfo = true;
348354
m_supports_multi_mem_read = eLazyBoolCalculate;
355+
m_supports_multi_breakpoint = eLazyBoolCalculate;
349356
}
350357

351358
// These flags should be reset when we first connect to a GDB server and when
@@ -373,6 +380,7 @@ void GDBRemoteCommunicationClient::GetRemoteQSupported() {
373380
m_supports_reverse_continue = eLazyBoolNo;
374381
m_supports_reverse_step = eLazyBoolNo;
375382
m_supports_multi_mem_read = eLazyBoolNo;
383+
m_supports_multi_breakpoint = eLazyBoolNo;
376384

377385
m_max_packet_size = UINT64_MAX; // It's supposed to always be there, but if
378386
// not, we assume no limit
@@ -434,6 +442,8 @@ void GDBRemoteCommunicationClient::GetRemoteQSupported() {
434442
m_supports_reverse_step = eLazyBoolYes;
435443
else if (x == "MultiMemRead+")
436444
m_supports_multi_mem_read = eLazyBoolYes;
445+
else if (x == "jMultiBreakpoint+")
446+
m_supports_multi_breakpoint = eLazyBoolYes;
437447
// Look for a list of compressions in the features list e.g.
438448
// qXfer:features:read+;PacketSize=20000;qEcho+;SupportedCompressions=zlib-
439449
// deflate,lzma

lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,8 @@ class GDBRemoteCommunicationClient : public GDBRemoteClientBase {
344344

345345
bool GetMultiMemReadSupported();
346346

347+
bool GetMultiBreakpointSupported();
348+
347349
LazyBool SupportsAllocDeallocMemory() // const
348350
{
349351
// Uncomment this to have lldb pretend the debug server doesn't respond to
@@ -579,6 +581,7 @@ class GDBRemoteCommunicationClient : public GDBRemoteClientBase {
579581
LazyBool m_supports_reverse_continue = eLazyBoolCalculate;
580582
LazyBool m_supports_reverse_step = eLazyBoolCalculate;
581583
LazyBool m_supports_multi_mem_read = eLazyBoolCalculate;
584+
LazyBool m_supports_multi_breakpoint = eLazyBoolCalculate;
582585

583586
bool m_supports_qProcessInfoPID : 1, m_supports_qfProcessInfo : 1,
584587
m_supports_qUserName : 1, m_supports_qGroupName : 1,

lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,3 +729,25 @@ TEST_F(GDBRemoteCommunicationClientTest, MultiMemReadNotSupported) {
729729
ASSERT_FALSE(client.GetMultiMemReadSupported());
730730
async_result.wait();
731731
}
732+
733+
TEST_F(GDBRemoteCommunicationClientTest, MultiBreakpointdSupported) {
734+
std::future<bool> async_result = std::async(std::launch::async, [&] {
735+
StringExtractorGDBRemote qSupported_packet_request;
736+
server.GetPacket(qSupported_packet_request);
737+
server.SendPacket("jMultiBreakpoint+;");
738+
return true;
739+
});
740+
ASSERT_TRUE(client.GetMultiBreakpointSupported());
741+
async_result.wait();
742+
}
743+
744+
TEST_F(GDBRemoteCommunicationClientTest, MultiBreakpointdNotSupported) {
745+
std::future<bool> async_result = std::async(std::launch::async, [&] {
746+
StringExtractorGDBRemote qSupported_packet_request;
747+
server.GetPacket(qSupported_packet_request);
748+
server.SendPacket(";");
749+
return true;
750+
});
751+
ASSERT_FALSE(client.GetMultiBreakpointSupported());
752+
async_result.wait();
753+
}

0 commit comments

Comments
 (0)