[Lldb-commits] [PATCH] D101406: Rename human-readable name for DW_LANG_Mips_Assembler

2021-08-14 Thread Dimitry Andric via Phabricator via lldb-commits
dim added a comment.

Hmm so now on FreeBSD, basically *every* program will cause this warning, as 
our C startup objects are compiled from .S files, e.g.:

  % objdump --dwarf /bin/sleep|grep -B6 "MIPS assembler"
   <0><619>: Abbrev Number: 1 (DW_TAG_compile_unit)
  <61a>   DW_AT_stmt_list   : 0x3f1
  <61e>   DW_AT_ranges  : 0x30
  <622>   DW_AT_name: /usr/src/lib/csu/amd64/crti.S
  <640>   DW_AT_comp_dir: /usr/obj/usr/src/amd64.amd64/lib/csu/amd64
  <66b>   DW_AT_producer: FreeBSD clang version 12.0.1 
(g...@github.com:llvm/llvm-project.git llvmorg-12.0.1-0-gfed41342a82f)
  <6ce>   DW_AT_language: 32769   (MIPS assembler)
  --
   <0>: Abbrev Number: 1 (DW_TAG_compile_unit)
 DW_AT_stmt_list   : 0x93a
 DW_AT_ranges  : 0xb0
 DW_AT_name: /usr/src/lib/csu/amd64/crtn.S
 DW_AT_comp_dir: /usr/obj/usr/src/amd64.amd64/lib/csu/amd64
 DW_AT_producer: FreeBSD clang version 12.0.1 
(g...@github.com:llvm/llvm-project.git llvmorg-12.0.1-0-gfed41342a82f)
 DW_AT_language: 32769   (MIPS assembler)
  
  % lldb /bin/sleep 10
  (lldb) target create "/bin/sleep"
  Current executable set to '/bin/sleep' (x86_64).
  (lldb) settings set -- target.run-args  "10"
  (lldb) r
  Process 11879 launched: '/bin/sleep' (x86_64)
  This version of LLDB has no plugin for the mipsassem language. Inspection of 
frame variables will be limited.
  Process 11879 stopped
  * thread #1, name = 'sleep', stop reason = signal SIGSTOP
  frame #0: 0x0008011a610a libc.so.7`__sys_nanosleep at _nanosleep.S:4

This can't have been the intention of this commit? As far as  I can see, there 
*is* no plugin for plain assembler?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101406/new/

https://reviews.llvm.org/D101406

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D107470: [llvm+lldb] Remove dead-code in DWARFListTableHeader::extract modifying DWARFDataExtractor

2021-08-14 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil updated this revision to Diff 366446.
jankratochvil marked an inline comment as done.
jankratochvil retitled this revision from "2/3: [llvm+lldb] Remove dead-code in 
DWARFListTableHeader::extract modifying DWARFDataExtractor" to "[llvm+lldb] 
Remove dead-code in DWARFListTableHeader::extract modifying DWARFDataExtractor".

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107470/new/

https://reviews.llvm.org/D107470

Files:
  lldb/unittests/SymbolFile/DWARF/DWARFUnitTest.cpp
  llvm/include/llvm/DebugInfo/DWARF/DWARFListTable.h
  llvm/lib/DebugInfo/DWARF/DWARFListTable.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFListTableTest.cpp

Index: llvm/unittests/DebugInfo/DWARF/DWARFListTableTest.cpp
===
--- llvm/unittests/DebugInfo/DWARF/DWARFListTableTest.cpp
+++ llvm/unittests/DebugInfo/DWARF/DWARFListTableTest.cpp
@@ -7,6 +7,7 @@
 //===--===//
 
 #include "llvm/DebugInfo/DWARF/DWARFListTable.h"
+#include "llvm/DebugInfo/DWARF/DWARFDebugRnglists.h"
 #include "llvm/Testing/Support/Error.h"
 #include "gtest/gtest.h"
 
@@ -99,4 +100,136 @@
   EXPECT_EQ(Header.length(), sizeof(SecData) - 1);
 }
 
+TEST(DWARFListTableHeader, AddressSize64Header) {
+  static const char SecData[] = "\x1a\x00\x00\x00" // Length
+"\x05\x00" // Version
+"\x08" // Address size
+"\x00" // Segment selector size
+"\x00\x00\x00\x00" // Offset entry count
+"\x06" // DW_RLE_start_end
+"\x07\x06\x05\x04" // 64-bit starting address
+"\x03\x02\x01\x00" // 64-bit starting address
+"\x87\x86\x85\x84" // 64-bit ending address
+"\x83\x82\x81\x80" // 64-bit ending address
+"\x00";// DW_RLE_end_of_list
+  DWARFDataExtractor Extractor(StringRef(SecData, sizeof(SecData) - 1),
+   /*isLittleEndian=*/true,
+   /*AddrSize=*/4);
+  DWARFListTableHeader Header(/*SectionName=*/".debug_rnglists",
+  /*ListTypeString=*/"range");
+  uint64_t Offset = 0;
+  llvm::DWARFDebugRnglistTable Table;
+  llvm::Error E = Table.extractHeaderAndOffsets(Extractor, &Offset);
+  EXPECT_FALSE(!!E);
+  EXPECT_EQ(Offset, 12U);
+  EXPECT_EQ(Table.length(), sizeof(SecData) - 1);
+  EXPECT_EQ(Extractor.getAddressSize(), 4U);
+  EXPECT_EQ(Table.getAddrSize(), 8U);
+  Expected List = Table.findList(Extractor, Offset);
+  EXPECT_TRUE(!!List);
+  EXPECT_EQ(List->getEntries().size(), 2U);
+  EXPECT_EQ(List->getEntries()[0].Offset, 12 + 0U);
+  EXPECT_EQ(List->getEntries()[0].EntryKind, dwarf::DW_RLE_start_end);
+  EXPECT_EQ(List->getEntries()[0].Value0, 0x0001020304050607U);
+  EXPECT_EQ(List->getEntries()[0].Value1, 0x8081828384858687U);
+  EXPECT_EQ(List->getEntries()[1].Offset, 12 + 17U);
+  EXPECT_EQ(List->getEntries()[1].EntryKind, dwarf::DW_RLE_end_of_list);
+}
+
+TEST(DWARFListTableHeader, AddressSize64Offset) {
+  static const char SecData[] = "\x1a\x00\x00\x00" // Length
+"\x05\x00" // Version
+"\x08" // Address size
+"\x00" // Segment selector size
+"\x00\x00\x00\x00" // Offset entry count
+"\x06" // DW_RLE_start_end
+"\x07\x06\x05\x04" // 64-bit starting address
+"\x03\x02\x01\x00" // 64-bit starting address
+"\x87\x86\x85\x84" // 64-bit ending address
+"\x83\x82\x81\x80" // 64-bit ending address
+"\x00";// DW_RLE_end_of_list
+  DWARFDataExtractor Extractor(StringRef(SecData, sizeof(SecData) - 1),
+   /*isLittleEndian=*/true,
+   /*AddrSize=*/4);
+  DWARFListTableHeader Header(/*SectionName=*/".debug_rnglists",
+  /*ListTypeString=*/"range");
+  llvm::DWARFDebugRnglistTable Table;
+  // Table.getAddrSize() is uninitialized.
+  EXPECT_EQ(Extractor.getAddressSize(), 4U);
+  Extractor.setAddressSize(8);
+  Expected List = Table.findList(Extractor, 12);
+  EXPECT_TRUE(!!List);
+  EXPECT_EQ(List->getEntries().size(), 2U);
+  EXPECT_EQ(List->getEntries()[0].Offset, 12 + 0U);
+  EXPECT_EQ(List->getEntries()[0].EntryKind, dwarf::DW_RLE_start_end);
+  EXPECT_EQ(List->getEntries()[0].Value0, 0x0001020304050607U);
+  EXPECT_EQ(List->getEntries()[0].Va

[Lldb-commits] [PATCH] D107470: [llvm+lldb] Remove dead-code in DWARFListTableHeader::extract modifying DWARFDataExtractor

2021-08-14 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil updated this revision to Diff 366448.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107470/new/

https://reviews.llvm.org/D107470

Files:
  lldb/unittests/SymbolFile/DWARF/DWARFUnitTest.cpp
  llvm/include/llvm/DebugInfo/DWARF/DWARFListTable.h
  llvm/lib/DebugInfo/DWARF/DWARFListTable.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFListTableTest.cpp

Index: llvm/unittests/DebugInfo/DWARF/DWARFListTableTest.cpp
===
--- llvm/unittests/DebugInfo/DWARF/DWARFListTableTest.cpp
+++ llvm/unittests/DebugInfo/DWARF/DWARFListTableTest.cpp
@@ -7,6 +7,7 @@
 //===--===//
 
 #include "llvm/DebugInfo/DWARF/DWARFListTable.h"
+#include "llvm/DebugInfo/DWARF/DWARFDebugRnglists.h"
 #include "llvm/Testing/Support/Error.h"
 #include "gtest/gtest.h"
 
@@ -99,4 +100,136 @@
   EXPECT_EQ(Header.length(), sizeof(SecData) - 1);
 }
 
+TEST(DWARFListTableHeader, AddressSize64Header) {
+  static const char SecData[] = "\x1a\x00\x00\x00" // Length
+"\x05\x00" // Version
+"\x08" // Address size
+"\x00" // Segment selector size
+"\x00\x00\x00\x00" // Offset entry count
+"\x06" // DW_RLE_start_end
+"\x07\x06\x05\x04" // 64-bit starting address
+"\x03\x02\x01\x00" // 64-bit starting address
+"\x87\x86\x85\x84" // 64-bit ending address
+"\x83\x82\x81\x80" // 64-bit ending address
+"\x00";// DW_RLE_end_of_list
+  DWARFDataExtractor Extractor(StringRef(SecData, sizeof(SecData) - 1),
+   /*isLittleEndian=*/true,
+   /*AddrSize=*/4);
+  DWARFListTableHeader Header(/*SectionName=*/".debug_rnglists",
+  /*ListTypeString=*/"range");
+  uint64_t Offset = 0;
+  llvm::DWARFDebugRnglistTable Table;
+  llvm::Error E = Table.extractHeaderAndOffsets(Extractor, &Offset);
+  EXPECT_FALSE(!!E);
+  EXPECT_EQ(Offset, 12U);
+  EXPECT_EQ(Table.length(), sizeof(SecData) - 1);
+  EXPECT_EQ(Extractor.getAddressSize(), 4U);
+  EXPECT_EQ(Table.getAddrSize(), 8U);
+  Expected List = Table.findList(Extractor, Offset);
+  EXPECT_TRUE(!!List);
+  EXPECT_EQ(List->getEntries().size(), 2U);
+  EXPECT_EQ(List->getEntries()[0].Offset, 12 + 0U);
+  EXPECT_EQ(List->getEntries()[0].EntryKind, dwarf::DW_RLE_start_end);
+  EXPECT_EQ(List->getEntries()[0].Value0, 0x0001020304050607U);
+  EXPECT_EQ(List->getEntries()[0].Value1, 0x8081828384858687U);
+  EXPECT_EQ(List->getEntries()[1].Offset, 12 + 17U);
+  EXPECT_EQ(List->getEntries()[1].EntryKind, dwarf::DW_RLE_end_of_list);
+}
+
+TEST(DWARFListTableHeader, AddressSize64Offset) {
+  static const char SecData[] = "\x1a\x00\x00\x00" // Length
+"\x05\x00" // Version
+"\x08" // Address size
+"\x00" // Segment selector size
+"\x00\x00\x00\x00" // Offset entry count
+"\x06" // DW_RLE_start_end
+"\x07\x06\x05\x04" // 64-bit starting address
+"\x03\x02\x01\x00" // 64-bit starting address
+"\x87\x86\x85\x84" // 64-bit ending address
+"\x83\x82\x81\x80" // 64-bit ending address
+"\x00";// DW_RLE_end_of_list
+  DWARFDataExtractor Extractor(StringRef(SecData, sizeof(SecData) - 1),
+   /*isLittleEndian=*/true,
+   /*AddrSize=*/4);
+  DWARFListTableHeader Header(/*SectionName=*/".debug_rnglists",
+  /*ListTypeString=*/"range");
+  llvm::DWARFDebugRnglistTable Table;
+  // Table.getAddrSize() is uninitialized.
+  EXPECT_EQ(Extractor.getAddressSize(), 4U);
+  Extractor.setAddressSize(8);
+  Expected List = Table.findList(Extractor, 12);
+  EXPECT_TRUE(!!List);
+  EXPECT_EQ(List->getEntries().size(), 2U);
+  EXPECT_EQ(List->getEntries()[0].Offset, 12 + 0U);
+  EXPECT_EQ(List->getEntries()[0].EntryKind, dwarf::DW_RLE_start_end);
+  EXPECT_EQ(List->getEntries()[0].Value0, 0x0001020304050607U);
+  EXPECT_EQ(List->getEntries()[0].Value1, 0x8081828384858687U);
+  EXPECT_EQ(List->getEntries()[1].Offset, 12 + 17U);
+  EXPECT_EQ(List->getEntries()[1].EntryKind, dwarf::DW_RLE_end_of_list);
+}
+
+TEST(DWARFListTableHeader, AddressSize32Header) {
+  static const char SecData[] = "\x12\x00\x00\x00" // Length
+

[Lldb-commits] [PATCH] D107470: [llvm+lldb] Remove dead-code in DWARFListTableHeader::extract modifying DWARFDataExtractor

2021-08-14 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil marked an inline comment as done.
jankratochvil added inline comments.



Comment at: llvm/include/llvm/DebugInfo/DWARF/DWARFListTable.h:289-291
   if (Header.length())
 Data = DWARFDataExtractor(Data, getHeaderOffset() + Header.length());
+  Data.setAddressSize(getAddrSize());

ikudrin wrote:
> if `Header.Length` is zero that means that there is no header discovered for 
> the table. That can be handled accordingly and no need to fill header fields 
> with artificial values based on a particular use.
I agree, I still did not get the length==0 case, thanks for showing it.
(It would be nice to have a more simple class for that case.)



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107470/new/

https://reviews.llvm.org/D107470

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D106466: [llvm+lldb] Fix#2 of DW_AT_ranges DW_FORM_sec_offset not using DW_AT_rnglists_base (used by GCC)

2021-08-14 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil updated this revision to Diff 366449.
jankratochvil retitled this revision from "3/3: [llvm+lldb] Fix#2 of 
DW_AT_ranges DW_FORM_sec_offset not using DW_AT_rnglists_base (used by GCC)" to 
"[llvm+lldb] Fix#2 of DW_AT_ranges DW_FORM_sec_offset not using 
DW_AT_rnglists_base (used by GCC)".

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106466/new/

https://reviews.llvm.org/D106466

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  lldb/test/Shell/SymbolFile/DWARF/DW_AT_range-DW_FORM_sec_offset.s


Index: lldb/test/Shell/SymbolFile/DWARF/DW_AT_range-DW_FORM_sec_offset.s
===
--- lldb/test/Shell/SymbolFile/DWARF/DW_AT_range-DW_FORM_sec_offset.s
+++ lldb/test/Shell/SymbolFile/DWARF/DW_AT_range-DW_FORM_sec_offset.s
@@ -29,7 +29,7 @@
 # RUN:   -o exit 2>&1 | FileCheck --check-prefix=RNGLISTBASE %s
 
 # RNGLISTBASE-LABEL: image lookup -v -s lookup_rnglists
-# RNGLISTBASE: error: {{.*}}-rnglistbase {0x0043}: DIE has 
DW_AT_ranges(DW_FORM_rnglistx 0x0) attribute, but range extraction failed 
(invalid range list table index 0; OffsetEntryCount is 0, DW_AT_rnglists_base 
is 12), please file a bug and attach the file at the start of this error message
+# RNGLISTBASE: error: {{.*}}-rnglistbase {0x0043}: DIE has 
DW_AT_ranges(DW_FORM_rnglistx 0x0) attribute, but range extraction failed 
(invalid range list table index 0; OffsetEntryCount is 0, DW_AT_rnglists_base 
is 24), please file a bug and attach the file at the start of this error message
 
 .text
 rnglists:
@@ -97,7 +97,7 @@
 .long   .Lrnglists_end-rnglists # DW_AT_high_pc
 .long   .Laddr_table_base0  # DW_AT_addr_base
 .ifdef RNGLISTBASE
-.long   .Ldebug_ranges0 # DW_AT_rnglists_base
+.long   .Ldebug_ranges1 # DW_AT_rnglists_base
 .endif
 .byte   2   # Abbrev [2] 0x2b:0x37 
DW_TAG_subprogram
 .quad   rnglists# DW_AT_low_pc
@@ -105,7 +105,7 @@
 .asciz  "rnglists"  # DW_AT_name
 .byte   5   # Abbrev [5] 0x52:0xf 
DW_TAG_lexical_block
 .ifndef RNGLISTX
-.long   .Ldebug_ranges0 # DW_AT_ranges DW_FORM_sec_offset
+.long   .Ldebug_ranges1 # DW_AT_ranges DW_FORM_sec_offset
 .else
 .uleb128 0  # DW_AT_ranges DW_FORM_rnglistx
 .endif
@@ -130,9 +130,17 @@
 .byte   8   # Address size
 .byte   0   # Segment selector size
 .long   0   # Offset entry count
-.Ldebug_ranges0:
+.Ldebug_rnglist_table_end0:
+
+.long   .Ldebug_rnglist_table_end1-.Ldebug_rnglist_table_start1 # 
Length
+.Ldebug_rnglist_table_start1:
+.short  5   # Version
+.byte   8   # Address size
+.byte   0   # Segment selector size
+.long   0   # Offset entry count
+.Ldebug_ranges1:
 .byte   4   # DW_RLE_offset_pair
 .uleb128 .Lblock1_begin-rnglists  #   starting offset
 .uleb128 .Lblock1_end-rnglists#   ending offset
 .byte   0   # DW_RLE_end_of_list
-.Ldebug_rnglist_table_end0:
+.Ldebug_rnglist_table_end1:
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -437,15 +437,18 @@
   // We are expected to be called with Offset 0 or pointing just past the table
   // header. Correct Offset in the latter case so that it points to the start
   // of the header.
-  if (offset > 0) {
-uint64_t HeaderSize = llvm::DWARFListTableHeader::getHeaderSize(format);
-if (offset < HeaderSize)
-  return llvm::createStringError(errc::invalid_argument,
- "did not detect a valid"
- " list table with base = 0x%" PRIx64 "\n",
- offset);
-offset -= HeaderSize;
+  if (offset == 0) {
+// Caller must not use this default initializater for GetRnglistOffset.
+return ListTableType();
   }
+
+  uint64_t HeaderSize = llvm::DWARFListTableHeader::getHeaderSize(format);
+  if (offset < HeaderSize)
+return llvm::createStringError(errc::invalid_argument,
+   "did not detect a valid"
+   " list table with base = 0x%" PRIx64 "\n",
+   offset);
+  offset -= HeaderSize;
   ListTableType Table;
   if (llvm::Error E = Table.extractHeaderAndOffsets(data, &offset))
 return std::move(E);
@@ -996,8 +999,12 @@
 return llvm::createStringError(errc::invalid_argument,
"missing or i

[Lldb-commits] [PATCH] D106466: [llvm+lldb] Fix#2 of DW_AT_ranges DW_FORM_sec_offset not using DW_AT_rnglists_base (used by GCC)

2021-08-14 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil added a comment.

In D106466#2939551 , @ikudrin wrote:

> In D106466#2926185 , @jankratochvil 
> wrote:
>
>> One needs to set at least `AddrSize` and `OffsetEntryCount` as callers do 
>> use it.
>
> Could you please point me to that usage? I am not that familiar with the LLDB 
> code.

Those are used by 
`DWARFUnit::GetRnglistOffset`->`llvm::DWARFDebugRnglistTable::getOffsetEntry`. 
But in such case `llvm::DWARFDebugRnglistTable::extractHeaderAndOffsets` were 
already called that time.
So that is not the code path I need for DWARF not using `DW_AT_rnglists_base`.

I understand now the `Header.length==0` case so the fix is simple now, thanks 
for showing it to me.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106466/new/

https://reviews.llvm.org/D106466

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D108078: [lldb] Support gdbserver signals [WIP]

2021-08-14 Thread Michał Górny via Phabricator via lldb-commits
mgorny created this revision.
mgorny added reviewers: krytarowski, emaste, labath, jasonmolenda, JDevlieghere.
mgorny requested review of this revision.

Add support for the original gdbserver signal mapping when communicating
with GDB.  If qSupported indicates that we are talking to LLDB (via
'native-signals+'), the previous behavior of using native host signals
is preserved.

TODO: add all gdb signals, add tests


https://reviews.llvm.org/D108078

Files:
  lldb/source/Plugins/Process/Utility/GDBRemoteSignals.cpp
  lldb/source/Plugins/Process/Utility/GDBRemoteSignals.h
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Index: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -720,11 +720,15 @@
 GetTarget().GetArchitecture().GetTriple().getTriple().c_str());
 
   if (error.Success()) {
-PlatformSP platform_sp = GetTarget().GetPlatform();
-if (platform_sp && platform_sp->IsConnected())
-  SetUnixSignals(platform_sp->GetUnixSignals());
-else
-  SetUnixSignals(UnixSignals::Create(GetTarget().GetArchitecture()));
+if (!m_gdb_comm.UsesNativeSignals()) {
+  Process::SetUnixSignals(std::make_shared());
+} else {
+  PlatformSP platform_sp = GetTarget().GetPlatform();
+  if (platform_sp && platform_sp->IsConnected())
+SetUnixSignals(platform_sp->GetUnixSignals());
+  else
+SetUnixSignals(UnixSignals::Create(GetTarget().GetArchitecture()));
+}
   }
 
   return error;
Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
@@ -1341,5 +1341,6 @@
   llvm::formatv("PacketSize={0}", max_packet_size),
   "QStartNoAckMode+",
   "qEcho+",
+  "native-signals+",
   };
 }
Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
@@ -469,6 +469,8 @@
 
   bool GetMemoryTaggingSupported();
 
+  bool UsesNativeSignals();
+
   lldb::DataBufferSP ReadMemoryTags(lldb::addr_t addr, size_t len,
 int32_t type);
 
@@ -589,6 +591,7 @@
   LazyBool m_supports_error_string_reply = eLazyBoolCalculate;
   LazyBool m_supports_multiprocess = eLazyBoolCalculate;
   LazyBool m_supports_memory_tagging = eLazyBoolCalculate;
+  LazyBool m_uses_native_signals = eLazyBoolCalculate;
 
   bool m_supports_qProcessInfoPID : 1, m_supports_qfProcessInfo : 1,
   m_supports_qUserName : 1, m_supports_qGroupName : 1,
Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -265,6 +265,7 @@
 m_supports_qXfer_features_read = eLazyBoolCalculate;
 m_supports_qXfer_memory_map_read = eLazyBoolCalculate;
 m_supports_augmented_libraries_svr4_read = eLazyBoolCalculate;
+m_uses_native_signals = eLazyBoolCalculate;
 m_supports_qProcessInfoPID = true;
 m_supports_qfProcessInfo = true;
 m_supports_qUserName = true;
@@ -314,6 +315,7 @@
   m_supports_qEcho = eLazyBoolNo;
   m_supports_QPassSignals = eLazyBoolNo;
   m_supports_memory_tagging = eLazyBoolNo;
+  m_uses_native_signals = eLazyBoolNo;
 
   m_max_packet_size = UINT64_MAX; // It's supposed to always be there, but if
   // not, we assume no limit
@@ -360,6 +362,8 @@
 m_supports_multiprocess = eLazyBoolYes;
   else if (x == "memory-tagging+")
 m_supports_memory_tagging = eLazyBoolYes;
+  else if (x == "native-signals+")
+m_uses_native_signals = eLazyBoolYes;
   // Look for a list of compressions in the features list e.g.
   // qXfer:features:read+;PacketSize=2;qEcho+;SupportedCompressions=zlib-
   // deflate,lzma
@@ -4298,3 +4302,10 @@
   GDBRemoteClientBase::OnRunPacketSent(first);
   m_curr_tid = LLDB_INVALID_THREAD_ID;
 }
+
+bool GDBRemoteCommunicationClient::UsesNativeSignals() {
+  if (m_uses_native_signals == eLazyBoolCalculate) {
+GetRemoteQSupported();
+  }
+  return m_uses_native_signals == eLazyBoolYes;
+}