[Lldb-commits] [lldb] [lldb] Be conversative about setting highmem address masks (PR #90533)

2024-04-29 Thread Jason Molenda via lldb-commits

https://github.com/jasonmolenda updated 
https://github.com/llvm/llvm-project/pull/90533

>From 3c272e99326a287f0a61c1f8c2c7ee790e1aeb48 Mon Sep 17 00:00:00 2001
From: Jason Molenda 
Date: Mon, 29 Apr 2024 16:45:36 -0700
Subject: [PATCH 1/2] [lldb] Be conversative about setting highmem address
 masks

The most common case with address masks/addressable bits is that
we have one value/mask that applies across the entire address space,
for code and data.  On AArch64, we can have separate masks for high
and low address spaces.  In the normal "one mask for all memory"
case, we use the low memory masks in Process, and we use the
`virtual-addressable-bits` setting for the user to override that
value.  When high memory has a different set of masks, those become
active in Process and the user can use `highmem-virtual-addressable-bits`
to override only the highmem value, if it is wrong.

This patch is handling a case where a gdb stub sent incorrect address
masks, for both high and low memory:

```
(lldb) process plugin packet send qHostInfo
  packet: qHostInfo
response: 
cputype:16777228;cpusubtype:0;endian:little;ptrsize:8;low_mem_addressing_bits:64;high_mem_addressing_bits:64;
```

When in fact this target was using 47 bits of addressing.  This
qHostInfo response set the Process low and high address masks for
code and data so that no bit-clearing is performed.  The user tried
to override this with the virtual-addressable-bits setting, and was
surprised when it had no affect on code running in high memory.
Because the high memory code mask now has a setting (all bits are
addressable) and they needed to use the very-uncommon
highmem-virtual-addressable-bits setting.

When we have an *unset* high memory address mask, and we are told
to set low- and high-memory to the same new address mask, maintain
the high memory mask as unset in Process.  The same thing is done
with the SBProcess::SetAddressMask API when the user specifies
lldb.eAddressMaskRangeAll.

Added a new test case to TestAddressMasks.py to test that the
low-memory override works correctly.  Also fixed a bug in the
testsuite that I did where I added `@skipIf(archs=["arm"])`
to avoid a problem on the Linaro 32-bit arm Ubuntu CI bot.  I
forgot that this is a regex, and so the tests were being skipped
entirely on any arm.* system.
---
 lldb/source/API/SBProcess.cpp | 26 ---
 lldb/source/Target/Process.cpp| 20 +++---
 .../process/address-masks/TestAddressMasks.py | 21 ---
 3 files changed, 56 insertions(+), 11 deletions(-)

diff --git a/lldb/source/API/SBProcess.cpp b/lldb/source/API/SBProcess.cpp
index c37c111c5a58e0..a0654d23e67efd 100644
--- a/lldb/source/API/SBProcess.cpp
+++ b/lldb/source/API/SBProcess.cpp
@@ -1298,7 +1298,12 @@ void SBProcess::SetAddressMask(AddressMaskType type, 
addr_t mask,
 case eAddressMaskTypeCode:
   if (addr_range == eAddressMaskRangeAll) {
 process_sp->SetCodeAddressMask(mask);
-process_sp->SetHighmemCodeAddressMask(mask);
+// If the highmem mask is the default-invalid,
+// don't change it, keep everything consistently
+// using the lowmem all-address-space mask.
+if (process_sp->GetHighmemCodeAddressMask() !=
+LLDB_INVALID_ADDRESS_MASK)
+  process_sp->SetHighmemCodeAddressMask(mask);
   } else if (addr_range == eAddressMaskRangeHigh) {
 process_sp->SetHighmemCodeAddressMask(mask);
   } else {
@@ -1308,7 +1313,12 @@ void SBProcess::SetAddressMask(AddressMaskType type, 
addr_t mask,
 case eAddressMaskTypeData:
   if (addr_range == eAddressMaskRangeAll) {
 process_sp->SetDataAddressMask(mask);
-process_sp->SetHighmemDataAddressMask(mask);
+// If the highmem mask is the default-invalid,
+// don't change it, keep everything consistently
+// using the lowmem all-address-space mask.
+if (process_sp->GetHighmemDataAddressMask() !=
+LLDB_INVALID_ADDRESS_MASK)
+  process_sp->SetHighmemDataAddressMask(mask);
   } else if (addr_range == eAddressMaskRangeHigh) {
 process_sp->SetHighmemDataAddressMask(mask);
   } else {
@@ -1319,8 +1329,16 @@ void SBProcess::SetAddressMask(AddressMaskType type, 
addr_t mask,
   if (addr_range == eAddressMaskRangeAll) {
 process_sp->SetCodeAddressMask(mask);
 process_sp->SetDataAddressMask(mask);
-process_sp->SetHighmemCodeAddressMask(mask);
-process_sp->SetHighmemDataAddressMask(mask);
+// If the highmem masks are the default-invalid,
+// don't change them, keep everything consistently
+// using the lowmem all-address-space masks.
+if (process_sp->GetHighmemDataAddressMask() !=
+LLDB_INVALID_ADDRESS_MASK ||
+process_sp->GetHighmemCodeAddressMask() !=
+LLDB_INVALID_ADDRESS_MASK) {
+  process_sp->SetHighmemCodeAddressMask(mask);
+  

[Lldb-commits] [lldb] [lldb] Be conversative about setting highmem address masks (PR #90533)

2024-04-29 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jason Molenda (jasonmolenda)


Changes

The most common case with address masks/addressable bits is that we have one 
value/mask that applies across the entire address space, for code and data.  On 
AArch64, we can have separate masks for high and low address spaces.  In the 
normal "one mask for all memory" case, we use the low memory masks in Process, 
and we use the `virtual-addressable-bits` setting for the user to override that 
value.  When high memory has a different set of masks, those become active in 
Process and the user can use `highmem-virtual-addressable-bits` to override 
only the highmem value, if it is wrong.

This patch is handling a case where a gdb stub sent incorrect address masks, 
for both high and low memory:

```
(lldb) process plugin packet send qHostInfo
  packet: qHostInfo
response: 
cputype:16777228;cpusubtype:0;endian:little;ptrsize:8;low_mem_addressing_bits:64;high_mem_addressing_bits:64;
```

When in fact this target was using 47 bits of addressing.  This qHostInfo 
response set the Process low and high address masks for code and data so that 
no bit-clearing is performed.  The user tried to override this with the 
virtual-addressable-bits setting, and was surprised when it had no affect on 
code running in high memory. Because the high memory code mask now has a 
setting (all bits are addressable) and they needed to use the very-uncommon 
highmem-virtual-addressable-bits setting.

When we have an *unset* high memory address mask, and we are told to set low- 
and high-memory to the same new address mask, maintain the high memory mask as 
unset in Process.  The same thing is done with the SBProcess::SetAddressMask 
API when the user specifies lldb.eAddressMaskRangeAll.

Added a new test case to TestAddressMasks.py to test that the low-memory 
override works correctly.  Also fixed a bug in the testsuite that I did where I 
added `@skipIf(archs=["arm"])` to avoid a problem on the Linaro 32-bit 
arm Ubuntu CI bot.  I forgot that this is a regex, and so the tests were being 
skipped entirely on any arm.* system.

---
Full diff: https://github.com/llvm/llvm-project/pull/90533.diff


3 Files Affected:

- (modified) lldb/source/API/SBProcess.cpp (+22-4) 
- (modified) lldb/source/Target/Process.cpp (+16-4) 
- (modified) lldb/test/API/python_api/process/address-masks/TestAddressMasks.py 
(+18-3) 


``diff
diff --git a/lldb/source/API/SBProcess.cpp b/lldb/source/API/SBProcess.cpp
index c37c111c5a58e0..a0654d23e67efd 100644
--- a/lldb/source/API/SBProcess.cpp
+++ b/lldb/source/API/SBProcess.cpp
@@ -1298,7 +1298,12 @@ void SBProcess::SetAddressMask(AddressMaskType type, 
addr_t mask,
 case eAddressMaskTypeCode:
   if (addr_range == eAddressMaskRangeAll) {
 process_sp->SetCodeAddressMask(mask);
-process_sp->SetHighmemCodeAddressMask(mask);
+// If the highmem mask is the default-invalid,
+// don't change it, keep everything consistently
+// using the lowmem all-address-space mask.
+if (process_sp->GetHighmemCodeAddressMask() !=
+LLDB_INVALID_ADDRESS_MASK)
+  process_sp->SetHighmemCodeAddressMask(mask);
   } else if (addr_range == eAddressMaskRangeHigh) {
 process_sp->SetHighmemCodeAddressMask(mask);
   } else {
@@ -1308,7 +1313,12 @@ void SBProcess::SetAddressMask(AddressMaskType type, 
addr_t mask,
 case eAddressMaskTypeData:
   if (addr_range == eAddressMaskRangeAll) {
 process_sp->SetDataAddressMask(mask);
-process_sp->SetHighmemDataAddressMask(mask);
+// If the highmem mask is the default-invalid,
+// don't change it, keep everything consistently
+// using the lowmem all-address-space mask.
+if (process_sp->GetHighmemDataAddressMask() !=
+LLDB_INVALID_ADDRESS_MASK)
+  process_sp->SetHighmemDataAddressMask(mask);
   } else if (addr_range == eAddressMaskRangeHigh) {
 process_sp->SetHighmemDataAddressMask(mask);
   } else {
@@ -1319,8 +1329,16 @@ void SBProcess::SetAddressMask(AddressMaskType type, 
addr_t mask,
   if (addr_range == eAddressMaskRangeAll) {
 process_sp->SetCodeAddressMask(mask);
 process_sp->SetDataAddressMask(mask);
-process_sp->SetHighmemCodeAddressMask(mask);
-process_sp->SetHighmemDataAddressMask(mask);
+// If the highmem masks are the default-invalid,
+// don't change them, keep everything consistently
+// using the lowmem all-address-space masks.
+if (process_sp->GetHighmemDataAddressMask() !=
+LLDB_INVALID_ADDRESS_MASK ||
+process_sp->GetHighmemCodeAddressMask() !=
+LLDB_INVALID_ADDRESS_MASK) {
+  process_sp->SetHighmemCodeAddressMask(mask);
+  process_sp->SetHighmemDataAddressMask(mask);
+}
   } else if (addr_range == eAddressMaskRangeHigh) {
 

[Lldb-commits] [lldb] [lldb] Be conversative about setting highmem address masks (PR #90533)

2024-04-29 Thread Jason Molenda via lldb-commits

https://github.com/jasonmolenda created 
https://github.com/llvm/llvm-project/pull/90533

The most common case with address masks/addressable bits is that we have one 
value/mask that applies across the entire address space, for code and data.  On 
AArch64, we can have separate masks for high and low address spaces.  In the 
normal "one mask for all memory" case, we use the low memory masks in Process, 
and we use the `virtual-addressable-bits` setting for the user to override that 
value.  When high memory has a different set of masks, those become active in 
Process and the user can use `highmem-virtual-addressable-bits` to override 
only the highmem value, if it is wrong.

This patch is handling a case where a gdb stub sent incorrect address masks, 
for both high and low memory:

```
(lldb) process plugin packet send qHostInfo
  packet: qHostInfo
response: 
cputype:16777228;cpusubtype:0;endian:little;ptrsize:8;low_mem_addressing_bits:64;high_mem_addressing_bits:64;
```

When in fact this target was using 47 bits of addressing.  This qHostInfo 
response set the Process low and high address masks for code and data so that 
no bit-clearing is performed.  The user tried to override this with the 
virtual-addressable-bits setting, and was surprised when it had no affect on 
code running in high memory. Because the high memory code mask now has a 
setting (all bits are addressable) and they needed to use the very-uncommon 
highmem-virtual-addressable-bits setting.

When we have an *unset* high memory address mask, and we are told to set low- 
and high-memory to the same new address mask, maintain the high memory mask as 
unset in Process.  The same thing is done with the SBProcess::SetAddressMask 
API when the user specifies lldb.eAddressMaskRangeAll.

Added a new test case to TestAddressMasks.py to test that the low-memory 
override works correctly.  Also fixed a bug in the testsuite that I did where I 
added `@skipIf(archs=["arm"])` to avoid a problem on the Linaro 32-bit arm 
Ubuntu CI bot.  I forgot that this is a regex, and so the tests were being 
skipped entirely on any arm.* system.

>From 3c272e99326a287f0a61c1f8c2c7ee790e1aeb48 Mon Sep 17 00:00:00 2001
From: Jason Molenda 
Date: Mon, 29 Apr 2024 16:45:36 -0700
Subject: [PATCH] [lldb] Be conversative about setting highmem address masks

The most common case with address masks/addressable bits is that
we have one value/mask that applies across the entire address space,
for code and data.  On AArch64, we can have separate masks for high
and low address spaces.  In the normal "one mask for all memory"
case, we use the low memory masks in Process, and we use the
`virtual-addressable-bits` setting for the user to override that
value.  When high memory has a different set of masks, those become
active in Process and the user can use `highmem-virtual-addressable-bits`
to override only the highmem value, if it is wrong.

This patch is handling a case where a gdb stub sent incorrect address
masks, for both high and low memory:

```
(lldb) process plugin packet send qHostInfo
  packet: qHostInfo
response: 
cputype:16777228;cpusubtype:0;endian:little;ptrsize:8;low_mem_addressing_bits:64;high_mem_addressing_bits:64;
```

When in fact this target was using 47 bits of addressing.  This
qHostInfo response set the Process low and high address masks for
code and data so that no bit-clearing is performed.  The user tried
to override this with the virtual-addressable-bits setting, and was
surprised when it had no affect on code running in high memory.
Because the high memory code mask now has a setting (all bits are
addressable) and they needed to use the very-uncommon
highmem-virtual-addressable-bits setting.

When we have an *unset* high memory address mask, and we are told
to set low- and high-memory to the same new address mask, maintain
the high memory mask as unset in Process.  The same thing is done
with the SBProcess::SetAddressMask API when the user specifies
lldb.eAddressMaskRangeAll.

Added a new test case to TestAddressMasks.py to test that the
low-memory override works correctly.  Also fixed a bug in the
testsuite that I did where I added `@skipIf(archs=["arm"])`
to avoid a problem on the Linaro 32-bit arm Ubuntu CI bot.  I
forgot that this is a regex, and so the tests were being skipped
entirely on any arm.* system.
---
 lldb/source/API/SBProcess.cpp | 26 ---
 lldb/source/Target/Process.cpp| 20 +++---
 .../process/address-masks/TestAddressMasks.py | 21 ---
 3 files changed, 56 insertions(+), 11 deletions(-)

diff --git a/lldb/source/API/SBProcess.cpp b/lldb/source/API/SBProcess.cpp
index c37c111c5a58e0..a0654d23e67efd 100644
--- a/lldb/source/API/SBProcess.cpp
+++ b/lldb/source/API/SBProcess.cpp
@@ -1298,7 +1298,12 @@ void SBProcess::SetAddressMask(AddressMaskType type, 
addr_t mask,
 case eAddressMaskTypeCode:
   if (addr_range == eAddressMaskRangeAll) {
 

[Lldb-commits] [lldb] Summarize std::string's when created from data. (PR #89110)

2024-04-29 Thread Jacob Lalonde via lldb-commits


@@ -254,13 +254,17 @@ bool 
lldb_private::formatters::LibStdcppStringSummaryProvider(
   } else
 addr_of_string =
 valobj.GetAddressOf(scalar_is_load_addr, _type);
-  if (addr_of_string != LLDB_INVALID_ADDRESS) {
+
+  // We have to check for host address here
+  // because GetAddressOf returns INVALID for all non load addresses.
+  // But we can still format strings in host memory.
+  if (addr_of_string != LLDB_INVALID_ADDRESS ||
+addr_type == eAddressTypeHost) {

Jlalond wrote:

That I don't know. ValueObject does [explicitly 
return](https://github.com/llvm/llvm-project/blob/main/lldb/source/Core/ValueObject.cpp#L1408C12-L1408C32)
 `LLDB_INVALID_ADDRESS` when `addressType == eAddressTypeHost`. I thought this 
was weird and potentially returning the address of the in memory buffer made 
more sense, but that seemed like a major refactor for a minor string issue

https://github.com/llvm/llvm-project/pull/89110
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Summarize std::string's when created from data. (PR #89110)

2024-04-29 Thread Jacob Lalonde via lldb-commits


@@ -287,8 +291,52 @@ bool 
lldb_private::formatters::LibStdcppStringSummaryProvider(
   } else
 return true;
 } break;
-case eAddressTypeHost:
-  break;
+case eAddressTypeHost: {
+
+  DataExtractor data;
+  Status error;
+  valobj.GetData(data, error);
+  if (error.Fail())
+return false;
+

Jlalond wrote:

Wouldn't short string optimization be covered by the check at the address type 
of children (Line 303)? If the children are host we directly read the 
std::string from the data extractor

https://github.com/llvm/llvm-project/pull/89110
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Display breakpoint locations using display name (PR #90297)

2024-04-29 Thread Dave Lee via lldb-commits


@@ -685,7 +686,7 @@ bool Address::Dump(Stream *s, ExecutionContextScope 
*exe_scope, DumpStyle style,
   sc.DumpStopContext(s, exe_scope, *this, show_fullpaths,
  show_module, show_inlined_frames,
  show_function_arguments, show_function_name,
- settings);
+ false, settings);

kastiglione wrote:

I wanted to limit the initial scope of changes to just breakpoint locations. It 
may be that we want to change this to true, but it has not be discussed (or 
audited, or tested) and so I am not confident in changing this too.

https://github.com/llvm/llvm-project/pull/90297
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Display breakpoint locations using display name (PR #90297)

2024-04-29 Thread Dave Lee via lldb-commits

kastiglione wrote:

@jimingham I'm not sure I've understood your comment entirely. Are you saying 
the following?

1. Always use `GetDisplayName` when displaying a mangled name
2. Add a setting allowing the user to see `GetName` (which `GetDisplayName` 
will call whenever the setting is enabled)

What about the cases where the context ("is the name being displayed?") is 
unclear at the call site? This is why I introduced the 
`show_function_display_name` parameter, because `DumpStopContext` could be 
called from either context.

https://github.com/llvm/llvm-project/pull/90297
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Display breakpoint locations using display name (PR #90297)

2024-04-29 Thread Adrian Prantl via lldb-commits


@@ -685,7 +686,7 @@ bool Address::Dump(Stream *s, ExecutionContextScope 
*exe_scope, DumpStyle style,
   sc.DumpStopContext(s, exe_scope, *this, show_fullpaths,
  show_module, show_inlined_frames,
  show_function_arguments, show_function_name,
- settings);
+ false, settings);

adrian-prantl wrote:

Why is this one false?

https://github.com/llvm/llvm-project/pull/90297
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Consult Language plugin in GetDisplayDemangledName (PR #90294)

2024-04-29 Thread Adrian Prantl via lldb-commits

https://github.com/adrian-prantl approved this pull request.


https://github.com/llvm/llvm-project/pull/90294
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Display breakpoint locations using display name (PR #90297)

2024-04-29 Thread Dave Lee via lldb-commits

https://github.com/kastiglione edited 
https://github.com/llvm/llvm-project/pull/90297
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Summarize std::string's when created from data. (PR #89110)

2024-04-29 Thread Greg Clayton via lldb-commits


@@ -287,8 +291,52 @@ bool 
lldb_private::formatters::LibStdcppStringSummaryProvider(
   } else
 return true;
 } break;
-case eAddressTypeHost:
-  break;
+case eAddressTypeHost: {
+
+  DataExtractor data;
+  Status error;
+  valobj.GetData(data, error);
+  if (error.Fail())
+return false;
+

clayborg wrote:

Where is the code that detects the short string optimization? I don't see it 
here anywhere?

https://github.com/llvm/llvm-project/pull/89110
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Summarize std::string's when created from data. (PR #89110)

2024-04-29 Thread Greg Clayton via lldb-commits


@@ -287,8 +291,52 @@ bool 
lldb_private::formatters::LibStdcppStringSummaryProvider(
   } else
 return true;
 } break;
-case eAddressTypeHost:
-  break;
+case eAddressTypeHost: {
+
+  DataExtractor data;
+  Status error;
+  valobj.GetData(data, error);
+  if (error.Fail())
+return false;
+
+  lldb::offset_t offset = 0;
+  AddressType child_addressType = valobj.GetAddressTypeOfChildren();
+  if (child_addressType == eAddressTypeLoad)
+  {

clayborg wrote:

The `{` goes at the end of the `if` line per llvm coding guidelines

https://github.com/llvm/llvm-project/pull/89110
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Summarize std::string's when created from data. (PR #89110)

2024-04-29 Thread Greg Clayton via lldb-commits


@@ -287,8 +291,52 @@ bool 
lldb_private::formatters::LibStdcppStringSummaryProvider(
   } else
 return true;
 } break;
-case eAddressTypeHost:
-  break;
+case eAddressTypeHost: {
+
+  DataExtractor data;
+  Status error;
+  valobj.GetData(data, error);
+  if (error.Fail())
+return false;
+
+  lldb::offset_t offset = 0;
+  AddressType child_addressType = valobj.GetAddressTypeOfChildren();
+  if (child_addressType == eAddressTypeLoad)
+  {
+// We have the host address of our std::string
+// But we need to read the pointee data from the debugged process.
+ProcessSP process_sp(valobj.GetProcessSP());
+// We want to read the address from std::string, which is the first 8 
bytes.
+lldb::addr_t addr = data.GetAddress();
+if (!addr)
+{

clayborg wrote:

The `{` goes at the end of the `if` line per llvm coding guidelines

https://github.com/llvm/llvm-project/pull/89110
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Summarize std::string's when created from data. (PR #89110)

2024-04-29 Thread Greg Clayton via lldb-commits


@@ -287,8 +291,52 @@ bool 
lldb_private::formatters::LibStdcppStringSummaryProvider(
   } else
 return true;
 } break;
-case eAddressTypeHost:
-  break;
+case eAddressTypeHost: {
+
+  DataExtractor data;
+  Status error;
+  valobj.GetData(data, error);
+  if (error.Fail())
+return false;
+
+  lldb::offset_t offset = 0;
+  AddressType child_addressType = valobj.GetAddressTypeOfChildren();
+  if (child_addressType == eAddressTypeLoad)
+  {
+// We have the host address of our std::string
+// But we need to read the pointee data from the debugged process.
+ProcessSP process_sp(valobj.GetProcessSP());
+// We want to read the address from std::string, which is the first 8 
bytes.
+lldb::addr_t addr = data.GetAddress();
+if (!addr)
+{
+  stream.Printf("nullptr");
+  return true;
+}
+std::string contents;
+process_sp->ReadCStringFromMemory(addr, contents, error);
+if (error.Fail())
+  return false;
+
+stream.Printf("%s", contents.c_str());
+return true;
+  }
+
+  if (child_addressType == eAddressTypeHost)
+  {

clayborg wrote:

The `{` goes at the end of the `if` line per llvm coding guidelines

https://github.com/llvm/llvm-project/pull/89110
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Summarize std::string's when created from data. (PR #89110)

2024-04-29 Thread Greg Clayton via lldb-commits


@@ -254,13 +254,17 @@ bool 
lldb_private::formatters::LibStdcppStringSummaryProvider(
   } else
 addr_of_string =
 valobj.GetAddressOf(scalar_is_load_addr, _type);
-  if (addr_of_string != LLDB_INVALID_ADDRESS) {
+
+  // We have to check for host address here
+  // because GetAddressOf returns INVALID for all non load addresses.
+  // But we can still format strings in host memory.
+  if (addr_of_string != LLDB_INVALID_ADDRESS ||
+addr_type == eAddressTypeHost) {

clayborg wrote:

Why does `addr_of_string = valobj.GetAddressOf(scalar_is_load_addr, 
_type);` return `eAddressTypeHost` with `addr_of_string` being set to 
`LLDB_INVALID_ADDRESS`?

https://github.com/llvm/llvm-project/pull/89110
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 1b70580 - Skip various tests under ASAN on green dragon (#90531)

2024-04-29 Thread via lldb-commits

Author: Adrian Prantl
Date: 2024-04-29T15:56:41-07:00
New Revision: 1b70580dd867195b0442e582eccd42abc41ee12d

URL: 
https://github.com/llvm/llvm-project/commit/1b70580dd867195b0442e582eccd42abc41ee12d
DIFF: 
https://github.com/llvm/llvm-project/commit/1b70580dd867195b0442e582eccd42abc41ee12d.diff

LOG: Skip various tests under ASAN on green dragon (#90531)

using the macOS version as a proxy. I can't reproduce any of these
failures locally, but the tests all use pexpect and probably have bad
timeout behavior under high load.

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/decorators.py
lldb/test/API/driver/batch_mode/TestBatchMode.py
lldb/test/API/driver/job_control/TestJobControl.py
lldb/test/API/driver/quit_speed/TestQuitWithProcess.py
lldb/test/API/iohandler/sigint/TestProcessIOHandlerInterrupt.py
lldb/test/API/macosx/nslog/TestDarwinNSLogOutput.py
lldb/test/API/terminal/TestSTTYBeforeAndAfter.py

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/decorators.py 
b/lldb/packages/Python/lldbsuite/test/decorators.py
index 8e13aa6a13882f..7fb88cef165356 100644
--- a/lldb/packages/Python/lldbsuite/test/decorators.py
+++ b/lldb/packages/Python/lldbsuite/test/decorators.py
@@ -206,6 +206,7 @@ def _decorateTest(
 remote=None,
 dwarf_version=None,
 setting=None,
+asan=None,
 ):
 def fn(actual_debug_info=None):
 skip_for_os = _match_decorator_property(
@@ -256,6 +257,7 @@ def fn(actual_debug_info=None):
 )
 )
 skip_for_setting = (setting is None) or (setting in 
configuration.settings)
+skip_for_asan = (asan is None) or is_running_under_asan()
 
 # For the test to be skipped, all specified (e.g. not None) parameters 
must be True.
 # An unspecified parameter means "any", so those are marked skip by 
default.  And we skip
@@ -273,6 +275,7 @@ def fn(actual_debug_info=None):
 (remote, skip_for_remote, "platform locality (remote/local)"),
 (dwarf_version, skip_for_dwarf_version, "dwarf version"),
 (setting, skip_for_setting, "setting"),
+(asan, skip_for_asan, "running under asan"),
 ]
 reasons = []
 final_skip_result = True
@@ -331,6 +334,7 @@ def expectedFailureAll(
 remote=None,
 dwarf_version=None,
 setting=None,
+asan=None,
 ):
 return _decorateTest(
 DecorateMode.Xfail,
@@ -348,6 +352,7 @@ def expectedFailureAll(
 remote=remote,
 dwarf_version=dwarf_version,
 setting=setting,
+asan=asan,
 )
 
 
@@ -356,7 +361,7 @@ def expectedFailureAll(
 # for example,
 # @skipIf, skip for all platform/compiler/arch,
 # @skipIf(compiler='gcc'), skip for gcc on all platform/architecture
-# @skipIf(bugnumber, ["linux"], "gcc", ['>=', '4.9'], ['i386']), skip for 
gcc>=4.9 on linux with i386
+# @skipIf(bugnumber, ["linux"], "gcc", ['>=', '4.9'], ['i386']), skip for 
gcc>=4.9 on linux with i386 (all conditions must be true)
 def skipIf(
 bugnumber=None,
 oslist=None,
@@ -372,6 +377,7 @@ def skipIf(
 remote=None,
 dwarf_version=None,
 setting=None,
+asan=None,
 ):
 return _decorateTest(
 DecorateMode.Skip,
@@ -389,6 +395,7 @@ def skipIf(
 remote=remote,
 dwarf_version=dwarf_version,
 setting=setting,
+asan=asan,
 )
 
 

diff  --git a/lldb/test/API/driver/batch_mode/TestBatchMode.py 
b/lldb/test/API/driver/batch_mode/TestBatchMode.py
index 642dd47c6d4586..bc6f2daebbab81 100644
--- a/lldb/test/API/driver/batch_mode/TestBatchMode.py
+++ b/lldb/test/API/driver/batch_mode/TestBatchMode.py
@@ -13,6 +13,7 @@
 class DriverBatchModeTest(PExpectTest):
 source = "main.c"
 
+@skipIf(macos_version=["<", "14.0"], asan=True)
 @skipIf(oslist=["linux"], archs=["arm", "aarch64"])  # Randomly fails on 
buildbot
 @expectedFlakeyFreeBSD("llvm.org/pr25172 fails rarely on the buildbot")
 def test_batch_mode_run_crash(self):
@@ -50,6 +51,7 @@ def test_batch_mode_run_crash(self):
 self.expect_prompt()
 self.expect("frame variable touch_me_not", substrs=["(char *) 
touch_me_not"])
 
+@skipIf(macos_version=["<", "14.0"], asan=True)
 @skipIf(oslist=["linux"], archs=["arm", "aarch64"])  # Randomly fails on 
buildbot
 @expectedFlakeyFreeBSD("llvm.org/pr25172 fails rarely on the buildbot")
 def test_batch_mode_run_exit(self):
@@ -86,6 +88,7 @@ def test_batch_mode_run_exit(self):
 
 child.expect(pexpect.EOF)
 
+@skipIf(macos_version=["<", "14.0"], asan=True)
 @skipIf(oslist=["linux"], archs=["arm", "aarch64"])  # Randomly fails on 
buildbot
 @expectedFlakeyFreeBSD("llvm.org/pr25172 fails rarely on the buildbot")
 def test_batch_mode_launch_stop_at_entry(self):
@@ -125,6 +128,7 @@ def closeVictim(self):
 self.victim.close()
 self.victim = None
 
+ 

[Lldb-commits] [lldb] Skip various tests under ASAN on green dragon (PR #90531)

2024-04-29 Thread Adrian Prantl via lldb-commits

https://github.com/adrian-prantl closed 
https://github.com/llvm/llvm-project/pull/90531
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Skip various tests under ASAN on green dragon (PR #90531)

2024-04-29 Thread Adrian Prantl via lldb-commits

https://github.com/adrian-prantl updated 
https://github.com/llvm/llvm-project/pull/90531

>From 34aaec09e03d0da6b2d511708fb3fe3e71b29c55 Mon Sep 17 00:00:00 2001
From: Adrian Prantl 
Date: Mon, 29 Apr 2024 15:38:25 -0700
Subject: [PATCH] Skip various tests under ASAN on green dragon

using the macOS version as a proxy. I can't reproduce any of these
failures locally, but the tests all use pexpect and probably have bad
timeout behavior under high load.
---
 lldb/packages/Python/lldbsuite/test/decorators.py| 9 -
 lldb/test/API/driver/batch_mode/TestBatchMode.py | 4 
 lldb/test/API/driver/job_control/TestJobControl.py   | 1 +
 lldb/test/API/driver/quit_speed/TestQuitWithProcess.py   | 2 +-
 .../iohandler/sigint/TestProcessIOHandlerInterrupt.py| 1 +
 lldb/test/API/macosx/nslog/TestDarwinNSLogOutput.py  | 8 ++--
 lldb/test/API/terminal/TestSTTYBeforeAndAfter.py | 1 +
 7 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py 
b/lldb/packages/Python/lldbsuite/test/decorators.py
index 8e13aa6a13882f..7fb88cef165356 100644
--- a/lldb/packages/Python/lldbsuite/test/decorators.py
+++ b/lldb/packages/Python/lldbsuite/test/decorators.py
@@ -206,6 +206,7 @@ def _decorateTest(
 remote=None,
 dwarf_version=None,
 setting=None,
+asan=None,
 ):
 def fn(actual_debug_info=None):
 skip_for_os = _match_decorator_property(
@@ -256,6 +257,7 @@ def fn(actual_debug_info=None):
 )
 )
 skip_for_setting = (setting is None) or (setting in 
configuration.settings)
+skip_for_asan = (asan is None) or is_running_under_asan()
 
 # For the test to be skipped, all specified (e.g. not None) parameters 
must be True.
 # An unspecified parameter means "any", so those are marked skip by 
default.  And we skip
@@ -273,6 +275,7 @@ def fn(actual_debug_info=None):
 (remote, skip_for_remote, "platform locality (remote/local)"),
 (dwarf_version, skip_for_dwarf_version, "dwarf version"),
 (setting, skip_for_setting, "setting"),
+(asan, skip_for_asan, "running under asan"),
 ]
 reasons = []
 final_skip_result = True
@@ -331,6 +334,7 @@ def expectedFailureAll(
 remote=None,
 dwarf_version=None,
 setting=None,
+asan=None,
 ):
 return _decorateTest(
 DecorateMode.Xfail,
@@ -348,6 +352,7 @@ def expectedFailureAll(
 remote=remote,
 dwarf_version=dwarf_version,
 setting=setting,
+asan=asan,
 )
 
 
@@ -356,7 +361,7 @@ def expectedFailureAll(
 # for example,
 # @skipIf, skip for all platform/compiler/arch,
 # @skipIf(compiler='gcc'), skip for gcc on all platform/architecture
-# @skipIf(bugnumber, ["linux"], "gcc", ['>=', '4.9'], ['i386']), skip for 
gcc>=4.9 on linux with i386
+# @skipIf(bugnumber, ["linux"], "gcc", ['>=', '4.9'], ['i386']), skip for 
gcc>=4.9 on linux with i386 (all conditions must be true)
 def skipIf(
 bugnumber=None,
 oslist=None,
@@ -372,6 +377,7 @@ def skipIf(
 remote=None,
 dwarf_version=None,
 setting=None,
+asan=None,
 ):
 return _decorateTest(
 DecorateMode.Skip,
@@ -389,6 +395,7 @@ def skipIf(
 remote=remote,
 dwarf_version=dwarf_version,
 setting=setting,
+asan=asan,
 )
 
 
diff --git a/lldb/test/API/driver/batch_mode/TestBatchMode.py 
b/lldb/test/API/driver/batch_mode/TestBatchMode.py
index 642dd47c6d4586..bc6f2daebbab81 100644
--- a/lldb/test/API/driver/batch_mode/TestBatchMode.py
+++ b/lldb/test/API/driver/batch_mode/TestBatchMode.py
@@ -13,6 +13,7 @@
 class DriverBatchModeTest(PExpectTest):
 source = "main.c"
 
+@skipIf(macos_version=["<", "14.0"], asan=True)
 @skipIf(oslist=["linux"], archs=["arm", "aarch64"])  # Randomly fails on 
buildbot
 @expectedFlakeyFreeBSD("llvm.org/pr25172 fails rarely on the buildbot")
 def test_batch_mode_run_crash(self):
@@ -50,6 +51,7 @@ def test_batch_mode_run_crash(self):
 self.expect_prompt()
 self.expect("frame variable touch_me_not", substrs=["(char *) 
touch_me_not"])
 
+@skipIf(macos_version=["<", "14.0"], asan=True)
 @skipIf(oslist=["linux"], archs=["arm", "aarch64"])  # Randomly fails on 
buildbot
 @expectedFlakeyFreeBSD("llvm.org/pr25172 fails rarely on the buildbot")
 def test_batch_mode_run_exit(self):
@@ -86,6 +88,7 @@ def test_batch_mode_run_exit(self):
 
 child.expect(pexpect.EOF)
 
+@skipIf(macos_version=["<", "14.0"], asan=True)
 @skipIf(oslist=["linux"], archs=["arm", "aarch64"])  # Randomly fails on 
buildbot
 @expectedFlakeyFreeBSD("llvm.org/pr25172 fails rarely on the buildbot")
 def test_batch_mode_launch_stop_at_entry(self):
@@ -125,6 +128,7 @@ def closeVictim(self):
 self.victim.close()
 self.victim = None
 
+@skipIf(macos_version=["<", "14.0"], asan=True)
 

[Lldb-commits] [lldb] Skip various tests under ASAN on green dragon (PR #90531)

2024-04-29 Thread via lldb-commits

github-actions[bot] wrote:




:warning: Python code formatter, darker found issues in your code. :warning:



You can test this locally with the following command:


``bash
darker --check --diff -r 
975eca0e6a3459e59e96b0df33ea0cfbd157c597...46d19cc3211fa6e27f7e49238777e533c0a173bc
 lldb/packages/Python/lldbsuite/test/decorators.py 
lldb/test/API/driver/batch_mode/TestBatchMode.py 
lldb/test/API/driver/job_control/TestJobControl.py 
lldb/test/API/driver/quit_speed/TestQuitWithProcess.py 
lldb/test/API/iohandler/sigint/TestProcessIOHandlerInterrupt.py 
lldb/test/API/macosx/nslog/TestDarwinNSLogOutput.py 
lldb/test/API/terminal/TestSTTYBeforeAndAfter.py
``





View the diff from darker here.


``diff
--- packages/Python/lldbsuite/test/decorators.py2024-04-29 
22:38:25.00 +
+++ packages/Python/lldbsuite/test/decorators.py2024-04-29 
22:46:41.105318 +
@@ -373,11 +373,11 @@
 py_version=None,
 macos_version=None,
 remote=None,
 dwarf_version=None,
 setting=None,
-asan=None
+asan=None,
 ):
 return _decorateTest(
 DecorateMode.Skip,
 bugnumber=bugnumber,
 oslist=oslist,
@@ -391,11 +391,11 @@
 py_version=py_version,
 macos_version=macos_version,
 remote=remote,
 dwarf_version=dwarf_version,
 setting=setting,
-asan=asan
+asan=asan,
 )
 
 
 def _skip_fn_for_android(reason, api_levels, archs):
 def impl():

``




https://github.com/llvm/llvm-project/pull/90531
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Skip various tests under ASAN on green dragon (PR #90531)

2024-04-29 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere approved this pull request.


https://github.com/llvm/llvm-project/pull/90531
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Skip various tests under ASAN on green dragon (PR #90531)

2024-04-29 Thread Adrian Prantl via lldb-commits

https://github.com/adrian-prantl created 
https://github.com/llvm/llvm-project/pull/90531

using the macOS version as a proxy. I can't reproduce any of these failures 
locally, but the tests all use pexpect and probably have bad timeout behavior 
under high load.

>From 46d19cc3211fa6e27f7e49238777e533c0a173bc Mon Sep 17 00:00:00 2001
From: Adrian Prantl 
Date: Mon, 29 Apr 2024 15:38:25 -0700
Subject: [PATCH] Skip various tests under ASAN on green dragon

using the macOS version as a proxy. I can't reproduce any of these
failures locally, but the tests all use pexpect and probably have bad
timeout behavior under high load.
---
 lldb/packages/Python/lldbsuite/test/decorators.py | 7 ++-
 lldb/test/API/driver/batch_mode/TestBatchMode.py  | 4 
 lldb/test/API/driver/job_control/TestJobControl.py| 1 +
 lldb/test/API/driver/quit_speed/TestQuitWithProcess.py| 2 +-
 .../API/iohandler/sigint/TestProcessIOHandlerInterrupt.py | 1 +
 lldb/test/API/macosx/nslog/TestDarwinNSLogOutput.py   | 8 ++--
 lldb/test/API/terminal/TestSTTYBeforeAndAfter.py  | 1 +
 7 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py 
b/lldb/packages/Python/lldbsuite/test/decorators.py
index 8e13aa6a13882f..90eb198ad8c9e3 100644
--- a/lldb/packages/Python/lldbsuite/test/decorators.py
+++ b/lldb/packages/Python/lldbsuite/test/decorators.py
@@ -206,6 +206,7 @@ def _decorateTest(
 remote=None,
 dwarf_version=None,
 setting=None,
+asan=None,
 ):
 def fn(actual_debug_info=None):
 skip_for_os = _match_decorator_property(
@@ -256,6 +257,7 @@ def fn(actual_debug_info=None):
 )
 )
 skip_for_setting = (setting is None) or (setting in 
configuration.settings)
+skip_for_asan = (asan is None) or is_running_under_asan()
 
 # For the test to be skipped, all specified (e.g. not None) parameters 
must be True.
 # An unspecified parameter means "any", so those are marked skip by 
default.  And we skip
@@ -273,6 +275,7 @@ def fn(actual_debug_info=None):
 (remote, skip_for_remote, "platform locality (remote/local)"),
 (dwarf_version, skip_for_dwarf_version, "dwarf version"),
 (setting, skip_for_setting, "setting"),
+(asan, skip_for_asan, "running under asan"),
 ]
 reasons = []
 final_skip_result = True
@@ -356,7 +359,7 @@ def expectedFailureAll(
 # for example,
 # @skipIf, skip for all platform/compiler/arch,
 # @skipIf(compiler='gcc'), skip for gcc on all platform/architecture
-# @skipIf(bugnumber, ["linux"], "gcc", ['>=', '4.9'], ['i386']), skip for 
gcc>=4.9 on linux with i386
+# @skipIf(bugnumber, ["linux"], "gcc", ['>=', '4.9'], ['i386']), skip for 
gcc>=4.9 on linux with i386 (all conditions must be true)
 def skipIf(
 bugnumber=None,
 oslist=None,
@@ -372,6 +375,7 @@ def skipIf(
 remote=None,
 dwarf_version=None,
 setting=None,
+asan=None
 ):
 return _decorateTest(
 DecorateMode.Skip,
@@ -389,6 +393,7 @@ def skipIf(
 remote=remote,
 dwarf_version=dwarf_version,
 setting=setting,
+asan=asan
 )
 
 
diff --git a/lldb/test/API/driver/batch_mode/TestBatchMode.py 
b/lldb/test/API/driver/batch_mode/TestBatchMode.py
index 642dd47c6d4586..bc6f2daebbab81 100644
--- a/lldb/test/API/driver/batch_mode/TestBatchMode.py
+++ b/lldb/test/API/driver/batch_mode/TestBatchMode.py
@@ -13,6 +13,7 @@
 class DriverBatchModeTest(PExpectTest):
 source = "main.c"
 
+@skipIf(macos_version=["<", "14.0"], asan=True)
 @skipIf(oslist=["linux"], archs=["arm", "aarch64"])  # Randomly fails on 
buildbot
 @expectedFlakeyFreeBSD("llvm.org/pr25172 fails rarely on the buildbot")
 def test_batch_mode_run_crash(self):
@@ -50,6 +51,7 @@ def test_batch_mode_run_crash(self):
 self.expect_prompt()
 self.expect("frame variable touch_me_not", substrs=["(char *) 
touch_me_not"])
 
+@skipIf(macos_version=["<", "14.0"], asan=True)
 @skipIf(oslist=["linux"], archs=["arm", "aarch64"])  # Randomly fails on 
buildbot
 @expectedFlakeyFreeBSD("llvm.org/pr25172 fails rarely on the buildbot")
 def test_batch_mode_run_exit(self):
@@ -86,6 +88,7 @@ def test_batch_mode_run_exit(self):
 
 child.expect(pexpect.EOF)
 
+@skipIf(macos_version=["<", "14.0"], asan=True)
 @skipIf(oslist=["linux"], archs=["arm", "aarch64"])  # Randomly fails on 
buildbot
 @expectedFlakeyFreeBSD("llvm.org/pr25172 fails rarely on the buildbot")
 def test_batch_mode_launch_stop_at_entry(self):
@@ -125,6 +128,7 @@ def closeVictim(self):
 self.victim.close()
 self.victim = None
 
+@skipIf(macos_version=["<", "14.0"], asan=True)
 @skipIf(oslist=["linux"], archs=["arm", "aarch64"])  # Randomly fails on 
buildbot
 @expectedFlakeyFreeBSD("llvm.org/pr25172 fails rarely on the buildbot")
 @expectedFailureNetBSD

[Lldb-commits] [lldb] Skip various tests under ASAN on green dragon (PR #90531)

2024-04-29 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Adrian Prantl (adrian-prantl)


Changes

using the macOS version as a proxy. I can't reproduce any of these failures 
locally, but the tests all use pexpect and probably have bad timeout behavior 
under high load.

---
Full diff: https://github.com/llvm/llvm-project/pull/90531.diff


7 Files Affected:

- (modified) lldb/packages/Python/lldbsuite/test/decorators.py (+6-1) 
- (modified) lldb/test/API/driver/batch_mode/TestBatchMode.py (+4) 
- (modified) lldb/test/API/driver/job_control/TestJobControl.py (+1) 
- (modified) lldb/test/API/driver/quit_speed/TestQuitWithProcess.py (+1-1) 
- (modified) lldb/test/API/iohandler/sigint/TestProcessIOHandlerInterrupt.py 
(+1) 
- (modified) lldb/test/API/macosx/nslog/TestDarwinNSLogOutput.py (+6-2) 
- (modified) lldb/test/API/terminal/TestSTTYBeforeAndAfter.py (+1) 


``diff
diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py 
b/lldb/packages/Python/lldbsuite/test/decorators.py
index 8e13aa6a13882f..90eb198ad8c9e3 100644
--- a/lldb/packages/Python/lldbsuite/test/decorators.py
+++ b/lldb/packages/Python/lldbsuite/test/decorators.py
@@ -206,6 +206,7 @@ def _decorateTest(
 remote=None,
 dwarf_version=None,
 setting=None,
+asan=None,
 ):
 def fn(actual_debug_info=None):
 skip_for_os = _match_decorator_property(
@@ -256,6 +257,7 @@ def fn(actual_debug_info=None):
 )
 )
 skip_for_setting = (setting is None) or (setting in 
configuration.settings)
+skip_for_asan = (asan is None) or is_running_under_asan()
 
 # For the test to be skipped, all specified (e.g. not None) parameters 
must be True.
 # An unspecified parameter means "any", so those are marked skip by 
default.  And we skip
@@ -273,6 +275,7 @@ def fn(actual_debug_info=None):
 (remote, skip_for_remote, "platform locality (remote/local)"),
 (dwarf_version, skip_for_dwarf_version, "dwarf version"),
 (setting, skip_for_setting, "setting"),
+(asan, skip_for_asan, "running under asan"),
 ]
 reasons = []
 final_skip_result = True
@@ -356,7 +359,7 @@ def expectedFailureAll(
 # for example,
 # @skipIf, skip for all platform/compiler/arch,
 # @skipIf(compiler='gcc'), skip for gcc on all platform/architecture
-# @skipIf(bugnumber, ["linux"], "gcc", ['>=', '4.9'], ['i386']), skip for 
gcc>=4.9 on linux with i386
+# @skipIf(bugnumber, ["linux"], "gcc", ['>=', '4.9'], ['i386']), skip for 
gcc>=4.9 on linux with i386 (all conditions must be true)
 def skipIf(
 bugnumber=None,
 oslist=None,
@@ -372,6 +375,7 @@ def skipIf(
 remote=None,
 dwarf_version=None,
 setting=None,
+asan=None
 ):
 return _decorateTest(
 DecorateMode.Skip,
@@ -389,6 +393,7 @@ def skipIf(
 remote=remote,
 dwarf_version=dwarf_version,
 setting=setting,
+asan=asan
 )
 
 
diff --git a/lldb/test/API/driver/batch_mode/TestBatchMode.py 
b/lldb/test/API/driver/batch_mode/TestBatchMode.py
index 642dd47c6d4586..bc6f2daebbab81 100644
--- a/lldb/test/API/driver/batch_mode/TestBatchMode.py
+++ b/lldb/test/API/driver/batch_mode/TestBatchMode.py
@@ -13,6 +13,7 @@
 class DriverBatchModeTest(PExpectTest):
 source = "main.c"
 
+@skipIf(macos_version=["<", "14.0"], asan=True)
 @skipIf(oslist=["linux"], archs=["arm", "aarch64"])  # Randomly fails on 
buildbot
 @expectedFlakeyFreeBSD("llvm.org/pr25172 fails rarely on the buildbot")
 def test_batch_mode_run_crash(self):
@@ -50,6 +51,7 @@ def test_batch_mode_run_crash(self):
 self.expect_prompt()
 self.expect("frame variable touch_me_not", substrs=["(char *) 
touch_me_not"])
 
+@skipIf(macos_version=["<", "14.0"], asan=True)
 @skipIf(oslist=["linux"], archs=["arm", "aarch64"])  # Randomly fails on 
buildbot
 @expectedFlakeyFreeBSD("llvm.org/pr25172 fails rarely on the buildbot")
 def test_batch_mode_run_exit(self):
@@ -86,6 +88,7 @@ def test_batch_mode_run_exit(self):
 
 child.expect(pexpect.EOF)
 
+@skipIf(macos_version=["<", "14.0"], asan=True)
 @skipIf(oslist=["linux"], archs=["arm", "aarch64"])  # Randomly fails on 
buildbot
 @expectedFlakeyFreeBSD("llvm.org/pr25172 fails rarely on the buildbot")
 def test_batch_mode_launch_stop_at_entry(self):
@@ -125,6 +128,7 @@ def closeVictim(self):
 self.victim.close()
 self.victim = None
 
+@skipIf(macos_version=["<", "14.0"], asan=True)
 @skipIf(oslist=["linux"], archs=["arm", "aarch64"])  # Randomly fails on 
buildbot
 @expectedFlakeyFreeBSD("llvm.org/pr25172 fails rarely on the buildbot")
 @expectedFailureNetBSD
diff --git a/lldb/test/API/driver/job_control/TestJobControl.py 
b/lldb/test/API/driver/job_control/TestJobControl.py
index 1a1739f4cb391d..648acb1d4730bc 100644
--- a/lldb/test/API/driver/job_control/TestJobControl.py
+++ 

[Lldb-commits] [lldb] 028546c - Simplify condition (NFC)

2024-04-29 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2024-04-29T15:08:49-07:00
New Revision: 028546cce2316a1074aa27001450295d856e1fdc

URL: 
https://github.com/llvm/llvm-project/commit/028546cce2316a1074aa27001450295d856e1fdc
DIFF: 
https://github.com/llvm/llvm-project/commit/028546cce2316a1074aa27001450295d856e1fdc.diff

LOG: Simplify condition (NFC)

Added: 


Modified: 
lldb/source/Expression/UserExpression.cpp

Removed: 




diff  --git a/lldb/source/Expression/UserExpression.cpp 
b/lldb/source/Expression/UserExpression.cpp
index 84578c7f9ad272..5658426c88912d 100644
--- a/lldb/source/Expression/UserExpression.cpp
+++ b/lldb/source/Expression/UserExpression.cpp
@@ -242,7 +242,7 @@ UserExpression::Evaluate(ExecutionContext _ctx,
   // If the language was not specified in the expression command, set it to the
   // language in the target's properties if specified, else default to the
   // langage for the frame.
-  if (!language.name) {
+  if (!language) {
 if (target->GetLanguage() != lldb::eLanguageTypeUnknown)
   language = target->GetLanguage();
 else if (StackFrame *frame = exe_ctx.GetFramePtr())



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


[Lldb-commits] [lldb] SBDebugger: Add new APIs `AddDestroyCallback` and `RemoveDestroyCallback` (PR #89868)

2024-04-29 Thread via lldb-commits


@@ -743,9 +743,19 @@ DebuggerSP 
Debugger::CreateInstance(lldb::LogOutputCallback log_callback,
 }
 
 void Debugger::HandleDestroyCallback() {
-  if (m_destroy_callback) {
-m_destroy_callback(GetID(), m_destroy_callback_baton);
-m_destroy_callback = nullptr;
+  std::lock_guard guard(m_destroy_callback_mutex);
+  const lldb::user_id_t user_id = GetID();
+  // In case one destroy callback adds or removes other destroy callbacks
+  // which aren't taken care of in the same inner loop.
+  while (m_destroy_callback_and_baton.size()) {
+auto iter = m_destroy_callback_and_baton.begin();
+while (iter != m_destroy_callback_and_baton.end()) {
+  // Invoke the callback and remove the entry from the map
+  const auto  = iter->second.first;
+  const auto  = iter->second.second;
+  callback(user_id, baton);
+  iter = m_destroy_callback_and_baton.erase(iter);
+}

royitaqi wrote:

Updated the PR accordingly.

--

(Regardless of the loop implementation.) However, it came to me that the 
behavior of removing a callback from an existing callback can be 
**inconsistant**: regardless of the order of registration, if the remov**er** 
is invoked first, the remov**ee** is removed and never invoked; meanwhile, if 
the remov**ee** is invoked first, it is invoked and instead the removal returns 
`false`.

I am wondering if the container should be changed to `std::map`, so that the 
order and behavior will be consistent. I.e. earlier-registered callbacks always 
gets invoked before later-registered ones. This also means that the loop can 
simply be to iterate through and erase until `.end()` - because added callbacks 
will always be inserted after the current one.

Perf-wise this shouldn't make a difference, since this is on the destroy path, 
and assuming there isn't too many callbacks added.

**LMK what you think.**

https://github.com/llvm/llvm-project/pull/89868
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] SBDebugger: Add new APIs `AddDestroyCallback` and `RemoveDestroyCallback` (PR #89868)

2024-04-29 Thread via lldb-commits

https://github.com/royitaqi updated 
https://github.com/llvm/llvm-project/pull/89868

>From 079a550481d4cdcb69ad01c376b5e1f0632a07d6 Mon Sep 17 00:00:00 2001
From: Roy Shi 
Date: Tue, 23 Apr 2024 18:10:21 -0700
Subject: [PATCH 01/13] Allow multiple destroy callbacks in
 `SBDebugger::SetDestroyCallback()`

---
 lldb/include/lldb/Core/Debugger.h |  4 ++--
 lldb/source/Core/Debugger.cpp | 10 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/lldb/include/lldb/Core/Debugger.h 
b/lldb/include/lldb/Core/Debugger.h
index 418c2403d020f4..20884f954ec7db 100644
--- a/lldb/include/lldb/Core/Debugger.h
+++ b/lldb/include/lldb/Core/Debugger.h
@@ -731,8 +731,8 @@ class Debugger : public 
std::enable_shared_from_this,
   lldb::TargetSP m_dummy_target_sp;
   Diagnostics::CallbackID m_diagnostics_callback_id;
 
-  lldb_private::DebuggerDestroyCallback m_destroy_callback = nullptr;
-  void *m_destroy_callback_baton = nullptr;
+  std::vector>
+   m_destroy_callback_and_baton;
 
   uint32_t m_interrupt_requested = 0; ///< Tracks interrupt requests
   std::mutex m_interrupt_mutex;
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 19b3cf3bbf46b1..0ebdf2b0a0f970 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -743,10 +743,11 @@ DebuggerSP 
Debugger::CreateInstance(lldb::LogOutputCallback log_callback,
 }
 
 void Debugger::HandleDestroyCallback() {
-  if (m_destroy_callback) {
-m_destroy_callback(GetID(), m_destroy_callback_baton);
-m_destroy_callback = nullptr;
+  const lldb::user_id_t user_id = GetID();
+  for (const auto _and_baton : m_destroy_callback_and_baton) {
+callback_and_baton.first(user_id, callback_and_baton.second);
   }
+  m_destroy_callback_and_baton.clear();
 }
 
 void Debugger::Destroy(DebuggerSP _sp) {
@@ -1427,8 +1428,7 @@ void Debugger::SetLoggingCallback(lldb::LogOutputCallback 
log_callback,
 
 void Debugger::SetDestroyCallback(
 lldb_private::DebuggerDestroyCallback destroy_callback, void *baton) {
-  m_destroy_callback = destroy_callback;
-  m_destroy_callback_baton = baton;
+  m_destroy_callback_and_baton.emplace_back(destroy_callback, baton);
 }
 
 static void PrivateReportProgress(Debugger , uint64_t progress_id,

>From 771b52723be8d0ffecaf8f0818105cfdb82ba332 Mon Sep 17 00:00:00 2001
From: Roy Shi 
Date: Tue, 23 Apr 2024 21:05:58 -0700
Subject: [PATCH 02/13] Fix code format

---
 lldb/include/lldb/Core/Debugger.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/include/lldb/Core/Debugger.h 
b/lldb/include/lldb/Core/Debugger.h
index 20884f954ec7db..af025219b0bc12 100644
--- a/lldb/include/lldb/Core/Debugger.h
+++ b/lldb/include/lldb/Core/Debugger.h
@@ -732,7 +732,7 @@ class Debugger : public 
std::enable_shared_from_this,
   Diagnostics::CallbackID m_diagnostics_callback_id;
 
   std::vector>
-   m_destroy_callback_and_baton;
+  m_destroy_callback_and_baton;
 
   uint32_t m_interrupt_requested = 0; ///< Tracks interrupt requests
   std::mutex m_interrupt_mutex;

>From d1f13cad8a3789a994572459893b32a225ba3e1b Mon Sep 17 00:00:00 2001
From: Roy Shi 
Date: Wed, 24 Apr 2024 11:55:16 -0700
Subject: [PATCH 03/13] Add `AddDestroyCallback()` and `ClearDestroyCallback()`

---
 lldb/include/lldb/Core/Debugger.h | 11 +++
 lldb/source/Core/Debugger.cpp | 12 +++-
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/lldb/include/lldb/Core/Debugger.h 
b/lldb/include/lldb/Core/Debugger.h
index af025219b0bc12..5b3e433f09c68e 100644
--- a/lldb/include/lldb/Core/Debugger.h
+++ b/lldb/include/lldb/Core/Debugger.h
@@ -568,10 +568,21 @@ class Debugger : public 
std::enable_shared_from_this,
 
   static void ReportSymbolChange(const ModuleSpec _spec);
 
+  /// Add a callback for when the debugger is destroyed. A list is maintained
+  /// internally.
+  void
+  AddDestroyCallback(lldb_private::DebuggerDestroyCallback destroy_callback,
+ void *baton);
+
+  /// Clear the list of callbacks, then add the callback.
   void
   SetDestroyCallback(lldb_private::DebuggerDestroyCallback destroy_callback,
  void *baton);
 
+  /// Clear the list of callbacks.
+  void
+  ClearDestroyCallback();
+
   /// Manually start the global event handler thread. It is useful to plugins
   /// that directly use the \a lldb_private namespace and want to use the
   /// debugger's default event handler thread instead of defining their own.
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 0ebdf2b0a0f970..159913642f253e 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -1426,11 +1426,21 @@ void 
Debugger::SetLoggingCallback(lldb::LogOutputCallback log_callback,
   std::make_shared(log_callback, baton);
 }
 
-void Debugger::SetDestroyCallback(
+void Debugger::AddDestroyCallback(
 lldb_private::DebuggerDestroyCallback destroy_callback, void *baton) {
   

[Lldb-commits] [lldb] 35fa46a - Improve comment

2024-04-29 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2024-04-29T13:37:37-07:00
New Revision: 35fa46a56ae2a220de514e5de5c5e6b4607f5ebb

URL: 
https://github.com/llvm/llvm-project/commit/35fa46a56ae2a220de514e5de5c5e6b4607f5ebb
DIFF: 
https://github.com/llvm/llvm-project/commit/35fa46a56ae2a220de514e5de5c5e6b4607f5ebb.diff

LOG: Improve comment

Added: 


Modified: 
lldb/source/Commands/CommandObjectDWIMPrint.cpp

Removed: 




diff  --git a/lldb/source/Commands/CommandObjectDWIMPrint.cpp 
b/lldb/source/Commands/CommandObjectDWIMPrint.cpp
index f0b37e6832eab0..57a372a762e150 100644
--- a/lldb/source/Commands/CommandObjectDWIMPrint.cpp
+++ b/lldb/source/Commands/CommandObjectDWIMPrint.cpp
@@ -93,7 +93,7 @@ void CommandObjectDWIMPrint::DoExecute(StringRef command,
 
   StackFrame *frame = m_exe_ctx.GetFramePtr();
 
-  // Either Swift was explicitly specified, or the frame is Swift.
+  // Either the language was explicitly specified, or we check the frame.
   lldb::LanguageType language = m_expr_options.language;
   if (language == lldb::eLanguageTypeUnknown && frame)
 language = frame->GuessLanguage().AsLanguageType();



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


[Lldb-commits] [lldb] [lldb][Docs] Remove more subtitles from packets doc (PR #90443)

2024-04-29 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere approved this pull request.


https://github.com/llvm/llvm-project/pull/90443
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] SBDebugger: Add new APIs `AddDestroyCallback` and `RemoveDestroyCallback` (PR #89868)

2024-04-29 Thread via lldb-commits


@@ -743,9 +743,19 @@ DebuggerSP 
Debugger::CreateInstance(lldb::LogOutputCallback log_callback,
 }
 
 void Debugger::HandleDestroyCallback() {
-  if (m_destroy_callback) {
-m_destroy_callback(GetID(), m_destroy_callback_baton);
-m_destroy_callback = nullptr;
+  std::lock_guard guard(m_destroy_callback_mutex);
+  const lldb::user_id_t user_id = GetID();
+  // In case one destroy callback adds or removes other destroy callbacks
+  // which aren't taken care of in the same inner loop.
+  while (m_destroy_callback_and_baton.size()) {
+auto iter = m_destroy_callback_and_baton.begin();
+while (iter != m_destroy_callback_and_baton.end()) {
+  // Invoke the callback and remove the entry from the map
+  const auto  = iter->second.first;
+  const auto  = iter->second.second;
+  callback(user_id, baton);
+  iter = m_destroy_callback_and_baton.erase(iter);
+}

royitaqi wrote:

Ah I like it! It's a lot simpler this way. Will update.

https://github.com/llvm/llvm-project/pull/89868
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Add a new SBExpressionOptions::SetLanguage() API (NFCI) (PR #89981)

2024-04-29 Thread Adrian Prantl via lldb-commits

https://github.com/adrian-prantl closed 
https://github.com/llvm/llvm-project/pull/89981
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 975eca0 - Add a new SBExpressionOptions::SetLanguage() API (NFCI) (#89981)

2024-04-29 Thread via lldb-commits

Author: Adrian Prantl
Date: 2024-04-29T13:26:24-07:00
New Revision: 975eca0e6a3459e59e96b0df33ea0cfbd157c597

URL: 
https://github.com/llvm/llvm-project/commit/975eca0e6a3459e59e96b0df33ea0cfbd157c597
DIFF: 
https://github.com/llvm/llvm-project/commit/975eca0e6a3459e59e96b0df33ea0cfbd157c597.diff

LOG: Add a new SBExpressionOptions::SetLanguage() API (NFCI) (#89981)

that separates out language and version. To avoid reinventing the wheel
and introducing subtle incompatibilities, this API uses the table of
languages and versiond defined by the upcoming DWARF 6 standard
(https://dwarfstd.org/languages-v6.html). While the DWARF 6 spec is not
finialized, the list of languages is broadly considered stable.

The primary motivation for this is to allow the Swift language plugin to
switch between language dialects between, e.g., Swift 5.9 and 6.0 with
out introducing a ton of new language codes. On the main branch this
change is considered NFC.

Depends on https://github.com/llvm/llvm-project/pull/89980

Added: 
lldb/utils/TableGen/LLDBSBAPIDWARFEnum.cpp

Modified: 
lldb/include/lldb/API/SBExpressionOptions.h
lldb/include/lldb/Expression/Expression.h
lldb/include/lldb/Expression/LLVMUserExpression.h
lldb/include/lldb/Expression/UserExpression.h
lldb/include/lldb/Symbol/TypeSystem.h
lldb/include/lldb/Target/StackFrame.h
lldb/include/lldb/Target/Target.h
lldb/include/lldb/lldb-private-types.h
lldb/packages/Python/lldbsuite/test/configuration.py
lldb/packages/Python/lldbsuite/test/dotest.py
lldb/packages/Python/lldbsuite/test/dotest_args.py
lldb/packages/Python/lldbsuite/test/lldbtest.py
lldb/source/API/CMakeLists.txt
lldb/source/API/SBExpressionOptions.cpp
lldb/source/API/SBFrame.cpp
lldb/source/Breakpoint/Watchpoint.cpp
lldb/source/Commands/CommandObjectDWIMPrint.cpp
lldb/source/Commands/CommandObjectType.cpp
lldb/source/Expression/LLVMUserExpression.cpp
lldb/source/Expression/UserExpression.cpp
lldb/source/Expression/UtilityFunction.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
lldb/source/Target/Language.cpp
lldb/source/Target/StackFrame.cpp
lldb/source/Target/Target.cpp
lldb/test/API/lit.cfg.py
lldb/test/API/lit.site.cfg.py.in
lldb/utils/TableGen/CMakeLists.txt
lldb/utils/TableGen/LLDBTableGen.cpp
lldb/utils/TableGen/LLDBTableGenBackends.h

Removed: 




diff  --git a/lldb/include/lldb/API/SBExpressionOptions.h 
b/lldb/include/lldb/API/SBExpressionOptions.h
index e0ddfda5ba37a2..19c416d0f3bcbc 100644
--- a/lldb/include/lldb/API/SBExpressionOptions.h
+++ b/lldb/include/lldb/API/SBExpressionOptions.h
@@ -10,6 +10,7 @@
 #define LLDB_API_SBEXPRESSIONOPTIONS_H
 
 #include "lldb/API/SBDefines.h"
+#include "lldb/API/SBLanguages.h"
 
 #include 
 
@@ -67,6 +68,10 @@ class LLDB_API SBExpressionOptions {
   void SetTrapExceptions(bool trap_exceptions = true);
 
   void SetLanguage(lldb::LanguageType language);
+  /// Set the language using a pair of language code and version as
+  /// defined by the DWARF 6 specification.
+  /// WARNING: These codes may change until DWARF 6 is finalized.
+  void SetLanguage(SBSourceLanguageName name, uint32_t version);
 
 #ifndef SWIG
   void SetCancelCallback(lldb::ExpressionCancelCallback callback, void *baton);

diff  --git a/lldb/include/lldb/Expression/Expression.h 
b/lldb/include/lldb/Expression/Expression.h
index 3e61d78828bbbf..356fe4b82ae43a 100644
--- a/lldb/include/lldb/Expression/Expression.h
+++ b/lldb/include/lldb/Expression/Expression.h
@@ -47,11 +47,8 @@ class Expression {
   /// expression.  Text() should contain the definition of this function.
   virtual const char *FunctionName() = 0;
 
-  /// Return the language that should be used when parsing.  To use the
-  /// default, return eLanguageTypeUnknown.
-  virtual lldb::LanguageType Language() const {
-return lldb::eLanguageTypeUnknown;
-  }
+  /// Return the language that should be used when parsing.
+  virtual SourceLanguage Language() const { return {}; }
 
   /// Return the Materializer that the parser should use when registering
   /// external values.

diff  --git a/lldb/include/lldb/Expression/LLVMUserExpression.h 
b/lldb/include/lldb/Expression/LLVMUserExpression.h
index 7d32d17dbf544c..40b463933c07e8 100644
--- a/lldb/include/lldb/Expression/LLVMUserExpression.h
+++ b/lldb/include/lldb/Expression/LLVMUserExpression.h
@@ -52,7 +52,7 @@ class LLVMUserExpression : public UserExpression {
   };
 
   LLVMUserExpression(ExecutionContextScope _scope, llvm::StringRef expr,
- llvm::StringRef prefix, 

[Lldb-commits] [lldb] SBDebugger: Add new APIs `AddDestroyCallback` and `RemoveDestroyCallback` (PR #89868)

2024-04-29 Thread Alex Langford via lldb-commits


@@ -743,9 +743,19 @@ DebuggerSP 
Debugger::CreateInstance(lldb::LogOutputCallback log_callback,
 }
 
 void Debugger::HandleDestroyCallback() {
-  if (m_destroy_callback) {
-m_destroy_callback(GetID(), m_destroy_callback_baton);
-m_destroy_callback = nullptr;
+  std::lock_guard guard(m_destroy_callback_mutex);
+  const lldb::user_id_t user_id = GetID();
+  // In case one destroy callback adds or removes other destroy callbacks
+  // which aren't taken care of in the same inner loop.
+  while (m_destroy_callback_and_baton.size()) {
+auto iter = m_destroy_callback_and_baton.begin();
+while (iter != m_destroy_callback_and_baton.end()) {
+  // Invoke the callback and remove the entry from the map
+  const auto  = iter->second.first;
+  const auto  = iter->second.second;
+  callback(user_id, baton);
+  iter = m_destroy_callback_and_baton.erase(iter);
+}

bulbazord wrote:

Instead of your 2 loop approach, could you not just repeatedly grab and call 
the first callback in the list? If new ones are added it'll be picked up, if 
others are removed then the next iteration won't see them.

https://github.com/llvm/llvm-project/pull/89868
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Add a new SBExpressionOptions::SetLanguage() API (NFCI) (PR #89981)

2024-04-29 Thread Adrian Prantl via lldb-commits

https://github.com/adrian-prantl updated 
https://github.com/llvm/llvm-project/pull/89981

>From 34eda7b484e3fa9eaaf97c66af3e81bf337e6edd Mon Sep 17 00:00:00 2001
From: Adrian Prantl 
Date: Wed, 24 Apr 2024 12:50:43 -0700
Subject: [PATCH] Add a new SBExpressionOptions::SetLanguage() API (NFCI)

that separates out language and version. To avoid reinventing the
wheel and introducing subtle incompatibilities, this API uses the
table of languages and versiond defined by the upcoming DWARF 6
standard (https://dwarfstd.org/languages-v6.html). While the DWARF 6
spec is not finialized, the list of languages is broadly considered
stable.

The primary motivation for this is to allow the Swift language plugin
to switch between language dialects between, e.g., Swift 5.9 and 6.0
with out introducing a ton of new language codes. On the main branch
this change is considered NFC.
---
 lldb/include/lldb/API/SBExpressionOptions.h   |  5 ++
 lldb/include/lldb/Expression/Expression.h |  7 +-
 .../lldb/Expression/LLVMUserExpression.h  |  2 +-
 lldb/include/lldb/Expression/UserExpression.h | 33 -
 lldb/include/lldb/Symbol/TypeSystem.h | 10 ++-
 lldb/include/lldb/Target/StackFrame.h | 12 ++--
 lldb/include/lldb/Target/Target.h | 19 --
 lldb/include/lldb/lldb-private-types.h| 19 ++
 .../Python/lldbsuite/test/configuration.py|  1 +
 lldb/packages/Python/lldbsuite/test/dotest.py |  3 +
 .../Python/lldbsuite/test/dotest_args.py  |  8 ++-
 .../Python/lldbsuite/test/lldbtest.py | 25 +--
 lldb/source/API/CMakeLists.txt|  7 ++
 lldb/source/API/SBExpressionOptions.cpp   |  7 ++
 lldb/source/API/SBFrame.cpp   | 30 +
 lldb/source/Breakpoint/Watchpoint.cpp |  5 +-
 .../Commands/CommandObjectDWIMPrint.cpp   |  2 +-
 lldb/source/Commands/CommandObjectType.cpp|  2 +-
 lldb/source/Expression/LLVMUserExpression.cpp |  2 +-
 lldb/source/Expression/UserExpression.cpp | 14 ++--
 lldb/source/Expression/UtilityFunction.cpp|  4 +-
 .../Clang/ClangExpressionParser.cpp   | 12 ++--
 .../Clang/ClangUserExpression.cpp | 19 +++---
 .../Clang/ClangUserExpression.h   |  6 +-
 .../TypeSystem/Clang/TypeSystemClang.cpp  |  2 +-
 .../TypeSystem/Clang/TypeSystemClang.h| 12 ++--
 lldb/source/Target/Language.cpp   | 34 ++
 lldb/source/Target/StackFrame.cpp | 23 +++
 lldb/source/Target/Target.cpp | 21 +++---
 lldb/test/API/lit.cfg.py  |  3 +
 lldb/test/API/lit.site.cfg.py.in  |  2 +-
 lldb/utils/TableGen/CMakeLists.txt|  1 +
 lldb/utils/TableGen/LLDBSBAPIDWARFEnum.cpp| 67 +++
 lldb/utils/TableGen/LLDBTableGen.cpp  |  9 ++-
 lldb/utils/TableGen/LLDBTableGenBackends.h|  1 +
 35 files changed, 306 insertions(+), 123 deletions(-)
 create mode 100644 lldb/utils/TableGen/LLDBSBAPIDWARFEnum.cpp

diff --git a/lldb/include/lldb/API/SBExpressionOptions.h 
b/lldb/include/lldb/API/SBExpressionOptions.h
index e0ddfda5ba37a2..19c416d0f3bcbc 100644
--- a/lldb/include/lldb/API/SBExpressionOptions.h
+++ b/lldb/include/lldb/API/SBExpressionOptions.h
@@ -10,6 +10,7 @@
 #define LLDB_API_SBEXPRESSIONOPTIONS_H
 
 #include "lldb/API/SBDefines.h"
+#include "lldb/API/SBLanguages.h"
 
 #include 
 
@@ -67,6 +68,10 @@ class LLDB_API SBExpressionOptions {
   void SetTrapExceptions(bool trap_exceptions = true);
 
   void SetLanguage(lldb::LanguageType language);
+  /// Set the language using a pair of language code and version as
+  /// defined by the DWARF 6 specification.
+  /// WARNING: These codes may change until DWARF 6 is finalized.
+  void SetLanguage(SBSourceLanguageName name, uint32_t version);
 
 #ifndef SWIG
   void SetCancelCallback(lldb::ExpressionCancelCallback callback, void *baton);
diff --git a/lldb/include/lldb/Expression/Expression.h 
b/lldb/include/lldb/Expression/Expression.h
index 3e61d78828bbbf..356fe4b82ae43a 100644
--- a/lldb/include/lldb/Expression/Expression.h
+++ b/lldb/include/lldb/Expression/Expression.h
@@ -47,11 +47,8 @@ class Expression {
   /// expression.  Text() should contain the definition of this function.
   virtual const char *FunctionName() = 0;
 
-  /// Return the language that should be used when parsing.  To use the
-  /// default, return eLanguageTypeUnknown.
-  virtual lldb::LanguageType Language() const {
-return lldb::eLanguageTypeUnknown;
-  }
+  /// Return the language that should be used when parsing.
+  virtual SourceLanguage Language() const { return {}; }
 
   /// Return the Materializer that the parser should use when registering
   /// external values.
diff --git a/lldb/include/lldb/Expression/LLVMUserExpression.h 
b/lldb/include/lldb/Expression/LLVMUserExpression.h
index 7d32d17dbf544c..40b463933c07e8 100644
--- a/lldb/include/lldb/Expression/LLVMUserExpression.h
+++ b/lldb/include/lldb/Expression/LLVMUserExpression.h

[Lldb-commits] [lldb] Add a new SBExpressionOptions::SetLanguage() API (NFCI) (PR #89981)

2024-04-29 Thread Adrian Prantl via lldb-commits

https://github.com/adrian-prantl updated 
https://github.com/llvm/llvm-project/pull/89981

>From c4b1ff6c92126ebf721b6044088b05112ec98477 Mon Sep 17 00:00:00 2001
From: Adrian Prantl 
Date: Wed, 24 Apr 2024 12:50:43 -0700
Subject: [PATCH] Add a new SBExpressionOptions::SetLanguage() API (NFCI)

that separates out language and version. To avoid reinventing the
wheel and introducing subtle incompatibilities, this API uses the
table of languages and versiond defined by the upcoming DWARF 6
standard (https://dwarfstd.org/languages-v6.html). While the DWARF 6
spec is not finialized, the list of languages is broadly considered
stable.

The primary motivation for this is to allow the Swift language plugin
to switch between language dialects between, e.g., Swift 5.9 and 6.0
with out introducing a ton of new language codes. On the main branch
this change is considered NFC.
---
 lldb/include/lldb/API/SBExpressionOptions.h   |  5 ++
 lldb/include/lldb/Expression/Expression.h |  7 +-
 .../lldb/Expression/LLVMUserExpression.h  |  2 +-
 lldb/include/lldb/Expression/UserExpression.h | 33 -
 lldb/include/lldb/Symbol/TypeSystem.h | 10 ++-
 lldb/include/lldb/Target/StackFrame.h | 12 ++--
 lldb/include/lldb/Target/Target.h | 19 --
 lldb/include/lldb/lldb-private-types.h| 19 ++
 .../Python/lldbsuite/test/configuration.py|  1 +
 lldb/packages/Python/lldbsuite/test/dotest.py |  3 +
 .../Python/lldbsuite/test/dotest_args.py  |  8 ++-
 .../Python/lldbsuite/test/lldbtest.py | 19 --
 lldb/source/API/CMakeLists.txt|  7 ++
 lldb/source/API/SBExpressionOptions.cpp   |  7 ++
 lldb/source/API/SBFrame.cpp   | 30 +
 lldb/source/Breakpoint/Watchpoint.cpp |  5 +-
 .../Commands/CommandObjectDWIMPrint.cpp   |  2 +-
 lldb/source/Commands/CommandObjectType.cpp|  2 +-
 lldb/source/Expression/LLVMUserExpression.cpp |  2 +-
 lldb/source/Expression/UserExpression.cpp | 14 ++--
 lldb/source/Expression/UtilityFunction.cpp|  4 +-
 .../Clang/ClangExpressionParser.cpp   | 12 ++--
 .../Clang/ClangUserExpression.cpp | 19 +++---
 .../Clang/ClangUserExpression.h   |  6 +-
 .../TypeSystem/Clang/TypeSystemClang.cpp  |  2 +-
 .../TypeSystem/Clang/TypeSystemClang.h| 12 ++--
 lldb/source/Target/Language.cpp   | 34 ++
 lldb/source/Target/StackFrame.cpp | 23 +++
 lldb/source/Target/Target.cpp | 21 +++---
 lldb/test/API/lit.cfg.py  |  3 +
 lldb/test/API/lit.site.cfg.py.in  |  2 +-
 lldb/utils/TableGen/CMakeLists.txt|  1 +
 lldb/utils/TableGen/LLDBSBAPIDWARFEnum.cpp| 67 +++
 lldb/utils/TableGen/LLDBTableGen.cpp  |  9 ++-
 lldb/utils/TableGen/LLDBTableGenBackends.h|  1 +
 35 files changed, 300 insertions(+), 123 deletions(-)
 create mode 100644 lldb/utils/TableGen/LLDBSBAPIDWARFEnum.cpp

diff --git a/lldb/include/lldb/API/SBExpressionOptions.h 
b/lldb/include/lldb/API/SBExpressionOptions.h
index e0ddfda5ba37a2..19c416d0f3bcbc 100644
--- a/lldb/include/lldb/API/SBExpressionOptions.h
+++ b/lldb/include/lldb/API/SBExpressionOptions.h
@@ -10,6 +10,7 @@
 #define LLDB_API_SBEXPRESSIONOPTIONS_H
 
 #include "lldb/API/SBDefines.h"
+#include "lldb/API/SBLanguages.h"
 
 #include 
 
@@ -67,6 +68,10 @@ class LLDB_API SBExpressionOptions {
   void SetTrapExceptions(bool trap_exceptions = true);
 
   void SetLanguage(lldb::LanguageType language);
+  /// Set the language using a pair of language code and version as
+  /// defined by the DWARF 6 specification.
+  /// WARNING: These codes may change until DWARF 6 is finalized.
+  void SetLanguage(SBSourceLanguageName name, uint32_t version);
 
 #ifndef SWIG
   void SetCancelCallback(lldb::ExpressionCancelCallback callback, void *baton);
diff --git a/lldb/include/lldb/Expression/Expression.h 
b/lldb/include/lldb/Expression/Expression.h
index 3e61d78828bbbf..356fe4b82ae43a 100644
--- a/lldb/include/lldb/Expression/Expression.h
+++ b/lldb/include/lldb/Expression/Expression.h
@@ -47,11 +47,8 @@ class Expression {
   /// expression.  Text() should contain the definition of this function.
   virtual const char *FunctionName() = 0;
 
-  /// Return the language that should be used when parsing.  To use the
-  /// default, return eLanguageTypeUnknown.
-  virtual lldb::LanguageType Language() const {
-return lldb::eLanguageTypeUnknown;
-  }
+  /// Return the language that should be used when parsing.
+  virtual SourceLanguage Language() const { return {}; }
 
   /// Return the Materializer that the parser should use when registering
   /// external values.
diff --git a/lldb/include/lldb/Expression/LLVMUserExpression.h 
b/lldb/include/lldb/Expression/LLVMUserExpression.h
index 7d32d17dbf544c..40b463933c07e8 100644
--- a/lldb/include/lldb/Expression/LLVMUserExpression.h
+++ b/lldb/include/lldb/Expression/LLVMUserExpression.h

[Lldb-commits] [lldb] Add a new SBExpressionOptions::SetLanguage() API (NFCI) (PR #89981)

2024-04-29 Thread Adrian Prantl via lldb-commits

https://github.com/adrian-prantl updated 
https://github.com/llvm/llvm-project/pull/89981

>From 00fdda9a57660533c5a97223bd52619b36f8999c Mon Sep 17 00:00:00 2001
From: Adrian Prantl 
Date: Wed, 24 Apr 2024 12:50:43 -0700
Subject: [PATCH] Add a new SBExpressionOptions::SetLanguage() API (NFCI)

that separates out language and version. To avoid reinventing the
wheel and introducing subtle incompatibilities, this API uses the
table of languages and versiond defined by the upcoming DWARF 6
standard (https://dwarfstd.org/languages-v6.html). While the DWARF 6
spec is not finialized, the list of languages is broadly considered
stable.

The primary motivation for this is to allow the Swift language plugin
to switch between language dialects between, e.g., Swift 5.9 and 6.0
with out introducing a ton of new language codes. On the main branch
this change is considered NFC.
---
 lldb/include/lldb/API/SBExpressionOptions.h   |  5 ++
 lldb/include/lldb/Expression/Expression.h |  7 +-
 .../lldb/Expression/LLVMUserExpression.h  |  2 +-
 lldb/include/lldb/Expression/UserExpression.h | 33 -
 lldb/include/lldb/Symbol/TypeSystem.h | 10 ++-
 lldb/include/lldb/Target/StackFrame.h | 12 ++--
 lldb/include/lldb/Target/Target.h | 19 --
 lldb/include/lldb/lldb-private-types.h| 19 ++
 .../Python/lldbsuite/test/configuration.py|  1 +
 lldb/packages/Python/lldbsuite/test/dotest.py |  3 +
 .../Python/lldbsuite/test/dotest_args.py  |  8 ++-
 .../Python/lldbsuite/test/lldbtest.py | 19 --
 lldb/source/API/CMakeLists.txt|  7 ++
 lldb/source/API/SBExpressionOptions.cpp   |  7 ++
 lldb/source/API/SBFrame.cpp   | 30 +
 lldb/source/Breakpoint/Watchpoint.cpp |  5 +-
 .../Commands/CommandObjectDWIMPrint.cpp   |  2 +-
 lldb/source/Commands/CommandObjectType.cpp|  2 +-
 lldb/source/Expression/LLVMUserExpression.cpp |  2 +-
 lldb/source/Expression/UserExpression.cpp | 14 ++--
 lldb/source/Expression/UtilityFunction.cpp|  4 +-
 .../Clang/ClangExpressionParser.cpp   | 12 ++--
 .../Clang/ClangUserExpression.cpp | 19 +++---
 .../Clang/ClangUserExpression.h   |  6 +-
 .../TypeSystem/Clang/TypeSystemClang.cpp  |  2 +-
 .../TypeSystem/Clang/TypeSystemClang.h| 12 ++--
 lldb/source/Target/Language.cpp   | 34 ++
 lldb/source/Target/StackFrame.cpp | 23 +++
 lldb/source/Target/Target.cpp | 21 +++---
 lldb/test/API/lit.cfg.py  |  3 +
 lldb/test/API/lit.site.cfg.py.in  |  2 +-
 lldb/utils/TableGen/CMakeLists.txt|  1 +
 lldb/utils/TableGen/LLDBSBAPIDWARFEnum.cpp| 67 +++
 lldb/utils/TableGen/LLDBTableGen.cpp  |  9 ++-
 lldb/utils/TableGen/LLDBTableGenBackends.h|  1 +
 35 files changed, 300 insertions(+), 123 deletions(-)
 create mode 100644 lldb/utils/TableGen/LLDBSBAPIDWARFEnum.cpp

diff --git a/lldb/include/lldb/API/SBExpressionOptions.h 
b/lldb/include/lldb/API/SBExpressionOptions.h
index e0ddfda5ba37a2..19c416d0f3bcbc 100644
--- a/lldb/include/lldb/API/SBExpressionOptions.h
+++ b/lldb/include/lldb/API/SBExpressionOptions.h
@@ -10,6 +10,7 @@
 #define LLDB_API_SBEXPRESSIONOPTIONS_H
 
 #include "lldb/API/SBDefines.h"
+#include "lldb/API/SBLanguages.h"
 
 #include 
 
@@ -67,6 +68,10 @@ class LLDB_API SBExpressionOptions {
   void SetTrapExceptions(bool trap_exceptions = true);
 
   void SetLanguage(lldb::LanguageType language);
+  /// Set the language using a pair of language code and version as
+  /// defined by the DWARF 6 specification.
+  /// WARNING: These codes may change until DWARF 6 is finalized.
+  void SetLanguage(SBSourceLanguageName name, uint32_t version);
 
 #ifndef SWIG
   void SetCancelCallback(lldb::ExpressionCancelCallback callback, void *baton);
diff --git a/lldb/include/lldb/Expression/Expression.h 
b/lldb/include/lldb/Expression/Expression.h
index 3e61d78828bbbf..356fe4b82ae43a 100644
--- a/lldb/include/lldb/Expression/Expression.h
+++ b/lldb/include/lldb/Expression/Expression.h
@@ -47,11 +47,8 @@ class Expression {
   /// expression.  Text() should contain the definition of this function.
   virtual const char *FunctionName() = 0;
 
-  /// Return the language that should be used when parsing.  To use the
-  /// default, return eLanguageTypeUnknown.
-  virtual lldb::LanguageType Language() const {
-return lldb::eLanguageTypeUnknown;
-  }
+  /// Return the language that should be used when parsing.
+  virtual SourceLanguage Language() const { return {}; }
 
   /// Return the Materializer that the parser should use when registering
   /// external values.
diff --git a/lldb/include/lldb/Expression/LLVMUserExpression.h 
b/lldb/include/lldb/Expression/LLVMUserExpression.h
index 7d32d17dbf544c..40b463933c07e8 100644
--- a/lldb/include/lldb/Expression/LLVMUserExpression.h
+++ b/lldb/include/lldb/Expression/LLVMUserExpression.h

[Lldb-commits] [lldb] Add a new SBExpressionOptions::SetLanguage() API (NFCI) (PR #89981)

2024-04-29 Thread Adrian Prantl via lldb-commits

https://github.com/adrian-prantl updated 
https://github.com/llvm/llvm-project/pull/89981

>From ea06aa4664b9b47b3cb11ec27774b9a0d109f92f Mon Sep 17 00:00:00 2001
From: Adrian Prantl 
Date: Wed, 24 Apr 2024 12:50:43 -0700
Subject: [PATCH] Add a new SBExpressionOptions::SetLanguage() API (NFCI)

that separates out language and version. To avoid reinventing the
wheel and introducing subtle incompatibilities, this API uses the
table of languages and versiond defined by the upcoming DWARF 6
standard (https://dwarfstd.org/languages-v6.html). While the DWARF 6
spec is not finialized, the list of languages is broadly considered
stable.

The primary motivation for this is to allow the Swift language plugin
to switch between language dialects between, e.g., Swift 5.9 and 6.0
with out introducing a ton of new language codes. On the main branch
this change is considered NFC.
---
 lldb/include/lldb/API/SBExpressionOptions.h   |  5 ++
 lldb/include/lldb/Expression/Expression.h |  7 +-
 .../lldb/Expression/LLVMUserExpression.h  |  2 +-
 lldb/include/lldb/Expression/UserExpression.h | 33 -
 lldb/include/lldb/Symbol/TypeSystem.h | 10 ++-
 lldb/include/lldb/Target/StackFrame.h | 11 ++-
 lldb/include/lldb/Target/Target.h | 19 --
 lldb/include/lldb/lldb-private-types.h| 19 ++
 .../Python/lldbsuite/test/configuration.py|  1 +
 lldb/packages/Python/lldbsuite/test/dotest.py |  3 +
 .../Python/lldbsuite/test/dotest_args.py  |  8 ++-
 .../Python/lldbsuite/test/lldbtest.py | 19 --
 lldb/source/API/CMakeLists.txt|  7 ++
 lldb/source/API/SBExpressionOptions.cpp   |  7 ++
 lldb/source/API/SBFrame.cpp   | 30 +
 lldb/source/Breakpoint/Watchpoint.cpp |  5 +-
 .../Commands/CommandObjectDWIMPrint.cpp   |  2 +-
 lldb/source/Commands/CommandObjectType.cpp|  2 +-
 lldb/source/Expression/LLVMUserExpression.cpp |  2 +-
 lldb/source/Expression/UserExpression.cpp | 14 ++--
 lldb/source/Expression/UtilityFunction.cpp|  4 +-
 .../Clang/ClangExpressionParser.cpp   | 12 ++--
 .../Clang/ClangUserExpression.cpp | 19 +++---
 .../Clang/ClangUserExpression.h   |  6 +-
 .../TypeSystem/Clang/TypeSystemClang.cpp  |  2 +-
 .../TypeSystem/Clang/TypeSystemClang.h| 12 ++--
 lldb/source/Target/Language.cpp   | 34 ++
 lldb/source/Target/StackFrame.cpp | 23 +++
 lldb/source/Target/Target.cpp | 21 +++---
 lldb/test/API/lit.cfg.py  |  3 +
 lldb/test/API/lit.site.cfg.py.in  |  2 +-
 lldb/utils/TableGen/CMakeLists.txt|  1 +
 lldb/utils/TableGen/LLDBSBAPIDWARFEnum.cpp| 67 +++
 lldb/utils/TableGen/LLDBTableGen.cpp  |  9 ++-
 lldb/utils/TableGen/LLDBTableGenBackends.h|  1 +
 35 files changed, 299 insertions(+), 123 deletions(-)
 create mode 100644 lldb/utils/TableGen/LLDBSBAPIDWARFEnum.cpp

diff --git a/lldb/include/lldb/API/SBExpressionOptions.h 
b/lldb/include/lldb/API/SBExpressionOptions.h
index e0ddfda5ba37a2..19c416d0f3bcbc 100644
--- a/lldb/include/lldb/API/SBExpressionOptions.h
+++ b/lldb/include/lldb/API/SBExpressionOptions.h
@@ -10,6 +10,7 @@
 #define LLDB_API_SBEXPRESSIONOPTIONS_H
 
 #include "lldb/API/SBDefines.h"
+#include "lldb/API/SBLanguages.h"
 
 #include 
 
@@ -67,6 +68,10 @@ class LLDB_API SBExpressionOptions {
   void SetTrapExceptions(bool trap_exceptions = true);
 
   void SetLanguage(lldb::LanguageType language);
+  /// Set the language using a pair of language code and version as
+  /// defined by the DWARF 6 specification.
+  /// WARNING: These codes may change until DWARF 6 is finalized.
+  void SetLanguage(SBSourceLanguageName name, uint32_t version);
 
 #ifndef SWIG
   void SetCancelCallback(lldb::ExpressionCancelCallback callback, void *baton);
diff --git a/lldb/include/lldb/Expression/Expression.h 
b/lldb/include/lldb/Expression/Expression.h
index 3e61d78828bbbf..356fe4b82ae43a 100644
--- a/lldb/include/lldb/Expression/Expression.h
+++ b/lldb/include/lldb/Expression/Expression.h
@@ -47,11 +47,8 @@ class Expression {
   /// expression.  Text() should contain the definition of this function.
   virtual const char *FunctionName() = 0;
 
-  /// Return the language that should be used when parsing.  To use the
-  /// default, return eLanguageTypeUnknown.
-  virtual lldb::LanguageType Language() const {
-return lldb::eLanguageTypeUnknown;
-  }
+  /// Return the language that should be used when parsing.
+  virtual SourceLanguage Language() const { return {}; }
 
   /// Return the Materializer that the parser should use when registering
   /// external values.
diff --git a/lldb/include/lldb/Expression/LLVMUserExpression.h 
b/lldb/include/lldb/Expression/LLVMUserExpression.h
index 7d32d17dbf544c..40b463933c07e8 100644
--- a/lldb/include/lldb/Expression/LLVMUserExpression.h
+++ b/lldb/include/lldb/Expression/LLVMUserExpression.h
@@ 

[Lldb-commits] [lldb] Add ability to specify running LLDB API testsuite by json description (PR #89764)

2024-04-29 Thread Jonas Devlieghere via lldb-commits

JDevlieghere wrote:

I'm curious to understand the motivation behind this a bit more. Specifically, 
how are the JSON files different from creating separate `lit.site.cfg.py` for 
the different test suite? Downstream we generate separate separate 
`lit.site.cfg.py` for different test runs, and then point lit towards them. 
Could you achieve the same with adding another configuration layer in between? 

https://github.com/llvm/llvm-project/pull/89764
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [compiler-rt] [libc] [libclc] [libcxxabi] [lld] [lldb] [llvm] [mlir] llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp:3804: lacking () for c… (PR #90391)

2024-04-29 Thread via lldb-commits

lntue wrote:

> #85868

You can update the title of the PR to reflect the changes, and add `Fixes 
https://github.com/llvm/llvm-project/issues/85868` to relating the PR to the 
issue.

OTOH, the libc changes look good to me.

https://github.com/llvm/llvm-project/pull/90391
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [compiler-rt] [libc] [libclc] [libcxxabi] [lld] [lldb] [llvm] [mlir] llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp:3804: lacking () for c… (PR #90391)

2024-04-29 Thread Louis Dionne via lldb-commits

https://github.com/ldionne approved this pull request.

The libc++abi changes look fine to me.

https://github.com/llvm/llvm-project/pull/90391
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [compiler-rt] [libc] [libclc] [libcxxabi] [lld] [lldb] [llvm] [mlir] llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp:3804: lacking () for c… (PR #90391)

2024-04-29 Thread Alex Langford via lldb-commits

bulbazord wrote:

> > Please update the PR subject as its a lot more than just X86AsmParser.cpp
> 
> Hi @RKSimon
> 
> All the issues mentioned are fixed. The title of the PR is misleading. The 
> title is the same as the issue (#85868) it corresponds to. Got a look to 
> other PR's and I thought that this is the usual naming convention. Please 
> refer to the 
> [commit](https://github.com/llvm/llvm-project/pull/90391/commits/54c6c6b7d71f5ff293412f5f91e9f880480284f8)
>  and you will see all the modified files.

Commit titles should accurately reflect a change. Your change modifies more 
than just X86AsmParser.cpp, so reading the commit title alone might lead one to 
believe that's all that changed. But it's not, you changed many things across 
the code base (even if the changes are all of the same kind). A more accurate 
title might be something like: `Add clarifying parenthesis around non-trivial 
conditions in ternary expressions`.

https://github.com/llvm/llvm-project/pull/90391
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Add ability to specify running LLDB API testsuite by json description (PR #89764)

2024-04-29 Thread Alex Langford via lldb-commits

https://github.com/bulbazord commented:

This change does 2 things, both of which are quite substantial on their own. 
Can you break them up into two changes to make it easier to review?

Higher level feedback:
Please add some documentation for these new changes. The change to dotest.py is 
minor but a short line about it somewhere (perhaps in the test suite docs?) 
would be helpful. As for the JSON Config, there is documentation on common 
build options where this might be useful.

Some feedback on the individual changes:
1) Changing dotest so that it can accept multiple things for `-E`. You solved 
this by inserting a special token (`start:`) that tells dotest to interpret it 
differently. Could you not instead change the action for `-E` to be `append`? 
That way E is already a list of arguments. I see that `start` is there to 
prevent an issue when the argument starts with `--` right? Is that an issue if 
you add quotes? What about if you do something like `-E "--first -Second 
--third"`? Does that work?

2) It looks like you're expected to pass the JSON config file into CMake which 
does some processing on it to fill out lit.cfg right? Does this mean I'd have 
to reconfigure if I change the JSON at all? I think it would be easier if we 
could instead teach dotest.py to read the JSON configuration. The CMake code 
would then either accept a user-provided JSON file or build a default one.

https://github.com/llvm/llvm-project/pull/89764
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Display breakpoint locations using display name (PR #90297)

2024-04-29 Thread Alex Langford via lldb-commits

bulbazord wrote:

I think your commit summary has a typo. It should say that the parameter 
defaults to false, not true.

https://github.com/llvm/llvm-project/pull/90297
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Consult Language plugin in GetDisplayDemangledName (PR #90294)

2024-04-29 Thread Alex Langford via lldb-commits

https://github.com/bulbazord approved this pull request.


https://github.com/llvm/llvm-project/pull/90294
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Add a new SBExpressionOptions::SetLanguage() API (NFCI) (PR #89981)

2024-04-29 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere approved this pull request.

Thanks for bearing with me! LGTM.

https://github.com/llvm/llvm-project/pull/89981
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Add a new SBExpressionOptions::SetLanguage() API (NFCI) (PR #89981)

2024-04-29 Thread Adrian Prantl via lldb-commits

https://github.com/adrian-prantl updated 
https://github.com/llvm/llvm-project/pull/89981

>From 6d91ad848b73183268617fecf14255b0ba0b9dd8 Mon Sep 17 00:00:00 2001
From: Adrian Prantl 
Date: Wed, 24 Apr 2024 12:50:43 -0700
Subject: [PATCH] Add a new SBExpressionOptions::SetLanguage() API (NFCI)

that separates out language and version. To avoid reinventing the
wheel and introducing subtle incompatibilities, this API uses the
table of languages and versiond defined by the upcoming DWARF 6
standard (https://dwarfstd.org/languages-v6.html). While the DWARF 6
spec is not finialized, the list of languages is broadly considered
stable.

The primary motivation for this is to allow the Swift language plugin
to switch between language dialects between, e.g., Swift 5.9 and 6.0
with out introducing a ton of new language codes. On the main branch
this change is considered NFC.
---
 lldb/include/lldb/API/SBExpressionOptions.h   |  5 ++
 lldb/include/lldb/Expression/Expression.h |  7 +-
 .../lldb/Expression/LLVMUserExpression.h  |  2 +-
 lldb/include/lldb/Expression/UserExpression.h | 33 -
 lldb/include/lldb/Symbol/TypeSystem.h | 10 ++-
 lldb/include/lldb/Target/StackFrame.h | 11 ++-
 lldb/include/lldb/Target/Target.h | 19 --
 lldb/include/lldb/lldb-private-types.h| 19 ++
 .../Python/lldbsuite/test/configuration.py|  1 +
 lldb/packages/Python/lldbsuite/test/dotest.py |  3 +
 .../Python/lldbsuite/test/dotest_args.py  |  8 ++-
 .../Python/lldbsuite/test/lldbtest.py | 19 --
 lldb/source/API/CMakeLists.txt|  7 ++
 lldb/source/API/SBExpressionOptions.cpp   |  7 ++
 lldb/source/API/SBFrame.cpp   | 30 +
 lldb/source/Breakpoint/Watchpoint.cpp |  5 +-
 .../Commands/CommandObjectDWIMPrint.cpp   |  2 +-
 lldb/source/Commands/CommandObjectType.cpp|  2 +-
 lldb/source/Expression/LLVMUserExpression.cpp |  2 +-
 lldb/source/Expression/UserExpression.cpp | 14 ++--
 lldb/source/Expression/UtilityFunction.cpp|  4 +-
 .../Clang/ClangExpressionParser.cpp   | 12 ++--
 .../Clang/ClangUserExpression.cpp | 19 +++---
 .../Clang/ClangUserExpression.h   |  6 +-
 .../TypeSystem/Clang/TypeSystemClang.cpp  |  2 +-
 .../TypeSystem/Clang/TypeSystemClang.h| 12 ++--
 lldb/source/Target/Language.cpp   | 34 ++
 lldb/source/Target/StackFrame.cpp | 23 +++
 lldb/source/Target/Target.cpp | 21 +++---
 lldb/test/API/lit.cfg.py  |  3 +
 lldb/test/API/lit.site.cfg.py.in  |  2 +-
 lldb/utils/TableGen/CMakeLists.txt|  1 +
 lldb/utils/TableGen/LLDBSBAPIDWARFEnum.cpp| 67 +++
 lldb/utils/TableGen/LLDBTableGen.cpp  |  9 ++-
 lldb/utils/TableGen/LLDBTableGenBackends.h|  1 +
 35 files changed, 299 insertions(+), 123 deletions(-)
 create mode 100644 lldb/utils/TableGen/LLDBSBAPIDWARFEnum.cpp

diff --git a/lldb/include/lldb/API/SBExpressionOptions.h 
b/lldb/include/lldb/API/SBExpressionOptions.h
index e0ddfda5ba37a2..19c416d0f3bcbc 100644
--- a/lldb/include/lldb/API/SBExpressionOptions.h
+++ b/lldb/include/lldb/API/SBExpressionOptions.h
@@ -10,6 +10,7 @@
 #define LLDB_API_SBEXPRESSIONOPTIONS_H
 
 #include "lldb/API/SBDefines.h"
+#include "lldb/API/SBLanguages.h"
 
 #include 
 
@@ -67,6 +68,10 @@ class LLDB_API SBExpressionOptions {
   void SetTrapExceptions(bool trap_exceptions = true);
 
   void SetLanguage(lldb::LanguageType language);
+  /// Set the language using a pair of language code and version as
+  /// defined by the DWARF 6 specification.
+  /// WARNING: These codes may change until DWARF 6 is finalized.
+  void SetLanguage(SBSourceLanguageName name, uint32_t version);
 
 #ifndef SWIG
   void SetCancelCallback(lldb::ExpressionCancelCallback callback, void *baton);
diff --git a/lldb/include/lldb/Expression/Expression.h 
b/lldb/include/lldb/Expression/Expression.h
index 3e61d78828bbbf..356fe4b82ae43a 100644
--- a/lldb/include/lldb/Expression/Expression.h
+++ b/lldb/include/lldb/Expression/Expression.h
@@ -47,11 +47,8 @@ class Expression {
   /// expression.  Text() should contain the definition of this function.
   virtual const char *FunctionName() = 0;
 
-  /// Return the language that should be used when parsing.  To use the
-  /// default, return eLanguageTypeUnknown.
-  virtual lldb::LanguageType Language() const {
-return lldb::eLanguageTypeUnknown;
-  }
+  /// Return the language that should be used when parsing.
+  virtual SourceLanguage Language() const { return {}; }
 
   /// Return the Materializer that the parser should use when registering
   /// external values.
diff --git a/lldb/include/lldb/Expression/LLVMUserExpression.h 
b/lldb/include/lldb/Expression/LLVMUserExpression.h
index 7d32d17dbf544c..40b463933c07e8 100644
--- a/lldb/include/lldb/Expression/LLVMUserExpression.h
+++ b/lldb/include/lldb/Expression/LLVMUserExpression.h
@@ 

[Lldb-commits] [lldb] Add a new SBExpressionOptions::SetLanguage() API (NFCI) (PR #89981)

2024-04-29 Thread Adrian Prantl via lldb-commits


@@ -10,6 +10,7 @@ config.llvm_build_mode = 
lit_config.substitute("@LLVM_BUILD_MODE@")
 config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
 config.lldb_obj_root = "@LLDB_BINARY_DIR@"
 config.lldb_src_root = "@LLDB_SOURCE_DIR@"
+config.lldb_built_include_dir = 
lit_config.substitute("@LLDB_BINARY_DIR@/include")

adrian-prantl wrote:

@JDevlieghere  I made the change — I'm not sure it does what you were hoping 
for though, since we still need to thread through `lldb_obj_root`.

https://github.com/llvm/llvm-project/pull/89981
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Add a new SBExpressionOptions::SetLanguage() API (NFCI) (PR #89981)

2024-04-29 Thread Adrian Prantl via lldb-commits

https://github.com/adrian-prantl updated 
https://github.com/llvm/llvm-project/pull/89981

>From 19cfcf3230d02a93a907fe93ca95dbecd48bcaf9 Mon Sep 17 00:00:00 2001
From: Adrian Prantl 
Date: Wed, 24 Apr 2024 12:50:43 -0700
Subject: [PATCH] Add a new SBExpressionOptions::SetLanguage() API (NFCI)

that separates out language and version. To avoid reinventing the
wheel and introducing subtle incompatibilities, this API uses the
table of languages and versiond defined by the upcoming DWARF 6
standard (https://dwarfstd.org/languages-v6.html). While the DWARF 6
spec is not finialized, the list of languages is broadly considered
stable.

The primary motivation for this is to allow the Swift language plugin
to switch between language dialects between, e.g., Swift 5.9 and 6.0
with out introducing a ton of new language codes. On the main branch
this change is considered NFC.
---
 lldb/include/lldb/API/SBExpressionOptions.h   |  5 ++
 lldb/include/lldb/Expression/Expression.h |  7 +-
 .../lldb/Expression/LLVMUserExpression.h  |  2 +-
 lldb/include/lldb/Expression/UserExpression.h | 33 -
 lldb/include/lldb/Symbol/TypeSystem.h | 10 ++-
 lldb/include/lldb/Target/StackFrame.h | 11 ++-
 lldb/include/lldb/Target/Target.h | 19 --
 lldb/include/lldb/lldb-private-types.h| 19 ++
 .../Python/lldbsuite/test/configuration.py|  1 +
 lldb/packages/Python/lldbsuite/test/dotest.py |  3 +
 .../Python/lldbsuite/test/dotest_args.py  |  8 ++-
 .../Python/lldbsuite/test/lldbtest.py | 19 --
 lldb/source/API/CMakeLists.txt|  7 ++
 lldb/source/API/SBExpressionOptions.cpp   |  7 ++
 lldb/source/API/SBFrame.cpp   | 30 +
 lldb/source/Breakpoint/Watchpoint.cpp |  5 +-
 .../Commands/CommandObjectDWIMPrint.cpp   |  2 +-
 lldb/source/Commands/CommandObjectType.cpp|  2 +-
 lldb/source/Expression/LLVMUserExpression.cpp |  2 +-
 lldb/source/Expression/UserExpression.cpp | 14 ++--
 lldb/source/Expression/UtilityFunction.cpp|  4 +-
 .../Clang/ClangExpressionParser.cpp   | 12 ++--
 .../Clang/ClangUserExpression.cpp | 19 +++---
 .../Clang/ClangUserExpression.h   |  6 +-
 .../TypeSystem/Clang/TypeSystemClang.cpp  |  2 +-
 .../TypeSystem/Clang/TypeSystemClang.h| 12 ++--
 lldb/source/Target/Language.cpp   | 34 ++
 lldb/source/Target/StackFrame.cpp | 23 +++
 lldb/source/Target/Target.cpp | 21 +++---
 lldb/test/API/lit.cfg.py  |  3 +
 lldb/utils/TableGen/CMakeLists.txt|  1 +
 lldb/utils/TableGen/LLDBSBAPIDWARFEnum.cpp| 67 +++
 lldb/utils/TableGen/LLDBTableGen.cpp  |  9 ++-
 lldb/utils/TableGen/LLDBTableGenBackends.h|  1 +
 34 files changed, 298 insertions(+), 122 deletions(-)
 create mode 100644 lldb/utils/TableGen/LLDBSBAPIDWARFEnum.cpp

diff --git a/lldb/include/lldb/API/SBExpressionOptions.h 
b/lldb/include/lldb/API/SBExpressionOptions.h
index e0ddfda5ba37a2..19c416d0f3bcbc 100644
--- a/lldb/include/lldb/API/SBExpressionOptions.h
+++ b/lldb/include/lldb/API/SBExpressionOptions.h
@@ -10,6 +10,7 @@
 #define LLDB_API_SBEXPRESSIONOPTIONS_H
 
 #include "lldb/API/SBDefines.h"
+#include "lldb/API/SBLanguages.h"
 
 #include 
 
@@ -67,6 +68,10 @@ class LLDB_API SBExpressionOptions {
   void SetTrapExceptions(bool trap_exceptions = true);
 
   void SetLanguage(lldb::LanguageType language);
+  /// Set the language using a pair of language code and version as
+  /// defined by the DWARF 6 specification.
+  /// WARNING: These codes may change until DWARF 6 is finalized.
+  void SetLanguage(SBSourceLanguageName name, uint32_t version);
 
 #ifndef SWIG
   void SetCancelCallback(lldb::ExpressionCancelCallback callback, void *baton);
diff --git a/lldb/include/lldb/Expression/Expression.h 
b/lldb/include/lldb/Expression/Expression.h
index 3e61d78828bbbf..356fe4b82ae43a 100644
--- a/lldb/include/lldb/Expression/Expression.h
+++ b/lldb/include/lldb/Expression/Expression.h
@@ -47,11 +47,8 @@ class Expression {
   /// expression.  Text() should contain the definition of this function.
   virtual const char *FunctionName() = 0;
 
-  /// Return the language that should be used when parsing.  To use the
-  /// default, return eLanguageTypeUnknown.
-  virtual lldb::LanguageType Language() const {
-return lldb::eLanguageTypeUnknown;
-  }
+  /// Return the language that should be used when parsing.
+  virtual SourceLanguage Language() const { return {}; }
 
   /// Return the Materializer that the parser should use when registering
   /// external values.
diff --git a/lldb/include/lldb/Expression/LLVMUserExpression.h 
b/lldb/include/lldb/Expression/LLVMUserExpression.h
index 7d32d17dbf544c..40b463933c07e8 100644
--- a/lldb/include/lldb/Expression/LLVMUserExpression.h
+++ b/lldb/include/lldb/Expression/LLVMUserExpression.h
@@ -52,7 +52,7 @@ class LLVMUserExpression : public 

[Lldb-commits] [lldb] [LLDB][ELF] Fix section unification to not just use names. (PR #90099)

2024-04-29 Thread Alastair Houghton via lldb-commits


@@ -1854,6 +1854,49 @@ class VMAddressProvider {
 };
 }
 
+namespace {
+  // We have to do this because ELF doesn't have section IDs, and also
+  // doesn't require section names to be unique.  (We use the section index
+  // for section IDs, but that isn't guaranteed to be the same in separate
+  // debug images.)
+  SectionSP FindMatchingSection(const SectionList _list,
+SectionSP section) {
+SectionSP sect_sp;
+
+addr_t vm_addr = section->GetFileAddress();
+ConstString name = section->GetName();
+offset_t file_size = section->GetFileSize();
+offset_t byte_size = section->GetByteSize();
+SectionType type = section->GetType();
+bool thread_specific = section->IsThreadSpecific();
+uint32_t permissions = section->GetPermissions();
+uint32_t alignment = section->GetLog2Align();
+
+for (auto sect_iter = section_list.begin();
+ sect_iter != section_list.end();
+ ++sect_iter) {
+  if ((*sect_iter)->GetName() == name
+  && (*sect_iter)->GetType() == type
+  && (*sect_iter)->IsThreadSpecific() == thread_specific
+  && (*sect_iter)->GetPermissions() == permissions
+  && (*sect_iter)->GetFileSize() == file_size
+  && (*sect_iter)->GetByteSize() == byte_size
+  && (*sect_iter)->GetFileAddress() == vm_addr
+  && (*sect_iter)->GetLog2Align() == alignment) {

al45tair wrote:

OK. I've removed the section type test as well.

https://github.com/llvm/llvm-project/pull/90099
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][ELF] Fix section unification to not just use names. (PR #90099)

2024-04-29 Thread Alastair Houghton via lldb-commits

https://github.com/al45tair updated 
https://github.com/llvm/llvm-project/pull/90099

>From ce54a7fb339a00029da266c9f518e344aac5d19e Mon Sep 17 00:00:00 2001
From: Alastair Houghton 
Date: Thu, 25 Apr 2024 11:35:55 +0100
Subject: [PATCH 1/5] [LLDB][ELF] Fix section unification to not just use
 names.

Section unification cannot just use names, because it's valid for ELF
binaries to have multiple sections with the same name.  We should check
other section properties too.

rdar://124467787
---
 .../Plugins/ObjectFile/ELF/ObjectFileELF.cpp  | 64 +++
 1 file changed, 53 insertions(+), 11 deletions(-)

diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp 
b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 0d95a1c12bde35..60fc68c96bcc1c 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -1854,6 +1854,49 @@ class VMAddressProvider {
 };
 }
 
+namespace {
+  // We have to do this because ELF doesn't have section IDs, and also
+  // doesn't require section names to be unique.  (We use the section index
+  // for section IDs, but that isn't guaranteed to be the same in separate
+  // debug images.)
+  SectionSP FindMatchingSection(const SectionList _list,
+SectionSP section) {
+SectionSP sect_sp;
+
+addr_t vm_addr = section->GetFileAddress();
+ConstString name = section->GetName();
+offset_t file_size = section->GetFileSize();
+offset_t byte_size = section->GetByteSize();
+SectionType type = section->GetType();
+bool thread_specific = section->IsThreadSpecific();
+uint32_t permissions = section->GetPermissions();
+uint32_t alignment = section->GetLog2Align();
+
+for (auto sect_iter = section_list.begin();
+ sect_iter != section_list.end();
+ ++sect_iter) {
+  if ((*sect_iter)->GetName() == name
+  && (*sect_iter)->GetType() == type
+  && (*sect_iter)->IsThreadSpecific() == thread_specific
+  && (*sect_iter)->GetPermissions() == permissions
+  && (*sect_iter)->GetFileSize() == file_size
+  && (*sect_iter)->GetByteSize() == byte_size
+  && (*sect_iter)->GetFileAddress() == vm_addr
+  && (*sect_iter)->GetLog2Align() == alignment) {
+sect_sp = *sect_iter;
+break;
+  } else {
+sect_sp = FindMatchingSection((*sect_iter)->GetChildren(),
+  section);
+if (sect_sp)
+  break;
+  }
+}
+
+return sect_sp;
+  }
+}
+
 void ObjectFileELF::CreateSections(SectionList _section_list) {
   if (m_sections_up)
 return;
@@ -2067,10 +2110,8 @@ unsigned ObjectFileELF::ParseSymbols(Symtab *symtab, 
user_id_t start_id,
   SectionList *module_section_list =
   module_sp ? module_sp->GetSectionList() : nullptr;
 
-  // Local cache to avoid doing a FindSectionByName for each symbol. The "const
-  // char*" key must came from a ConstString object so they can be compared by
-  // pointer
-  std::unordered_map section_name_to_section;
+  // Cache the section mapping
+  std::unordered_map section_map;
 
   unsigned i;
   for (i = 0; i < num_symbols; ++i) {
@@ -2275,14 +2316,15 @@ unsigned ObjectFileELF::ParseSymbols(Symtab *symtab, 
user_id_t start_id,
 
 if (symbol_section_sp && module_section_list &&
 module_section_list != section_list) {
-  ConstString sect_name = symbol_section_sp->GetName();
-  auto section_it = section_name_to_section.find(sect_name.GetCString());
-  if (section_it == section_name_to_section.end())
+  auto section_it = section_map.find(symbol_section_sp);
+  if (section_it == section_map.end()) {
 section_it =
-section_name_to_section
-.emplace(sect_name.GetCString(),
- module_section_list->FindSectionByName(sect_name))
-.first;
+  section_map
+  .emplace(symbol_section_sp,
+   FindMatchingSection(*module_section_list,
+   symbol_section_sp))
+  .first;
+  }
   if (section_it->second)
 symbol_section_sp = section_it->second;
 }

>From 9653351729b4ef2d98faba936b8fa6fb51a9a47c Mon Sep 17 00:00:00 2001
From: Alastair Houghton 
Date: Fri, 26 Apr 2024 14:53:20 +0100
Subject: [PATCH 2/5] [LLDB][ELF] Address review feedback, add test.

Fixed a couple of nits from review, and fixed up formatting.

Also added a test.

rdar://124467787
---
 .../Plugins/ObjectFile/ELF/ObjectFileELF.cpp  |  86 +-
 .../ELF/Inputs/two-text-sections.elf  | Bin 0 -> 4976 bytes
 .../ObjectFile/ELF/two-text-sections.test |   8 ++
 3 files changed, 49 insertions(+), 45 deletions(-)
 create mode 100644 lldb/test/Shell/ObjectFile/ELF/Inputs/two-text-sections.elf
 create mode 100644 lldb/test/Shell/ObjectFile/ELF/two-text-sections.test

diff --git 

[Lldb-commits] [lldb] [LLDB][ELF] Fix section unification to not just use names. (PR #90099)

2024-04-29 Thread Pavel Labath via lldb-commits

labath wrote:

> > I saw that, but a textual test is definitely preferable, particularly after 
> > the linux xz fiasco. This wouldn't be the first test binary in our repo, 
> > but in this case, I think it actually adds a lot of value, since yaml2obj 
> > operates on the same level as what you are testing (so you can see the 
> > input of the test eyeball-verify that the expected output makes sense).
> 
> :-) Fair point (though this is very much not like the xz incident — I'm a 
> colleague of Jonas's at Apple, albeit in a different team, with a fairly 
> longstanding history of contributing to OSS projects, and doing something 
> like that would be… very career limiting).
> 
> I'll have a go at changing things to use `yaml2obj`.

The new test looks great.

https://github.com/llvm/llvm-project/pull/90099
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][ELF] Fix section unification to not just use names. (PR #90099)

2024-04-29 Thread Pavel Labath via lldb-commits


@@ -1854,6 +1854,49 @@ class VMAddressProvider {
 };
 }
 
+namespace {
+  // We have to do this because ELF doesn't have section IDs, and also
+  // doesn't require section names to be unique.  (We use the section index
+  // for section IDs, but that isn't guaranteed to be the same in separate
+  // debug images.)
+  SectionSP FindMatchingSection(const SectionList _list,
+SectionSP section) {
+SectionSP sect_sp;
+
+addr_t vm_addr = section->GetFileAddress();
+ConstString name = section->GetName();
+offset_t file_size = section->GetFileSize();
+offset_t byte_size = section->GetByteSize();
+SectionType type = section->GetType();
+bool thread_specific = section->IsThreadSpecific();
+uint32_t permissions = section->GetPermissions();
+uint32_t alignment = section->GetLog2Align();
+
+for (auto sect_iter = section_list.begin();
+ sect_iter != section_list.end();
+ ++sect_iter) {
+  if ((*sect_iter)->GetName() == name
+  && (*sect_iter)->GetType() == type
+  && (*sect_iter)->IsThreadSpecific() == thread_specific
+  && (*sect_iter)->GetPermissions() == permissions
+  && (*sect_iter)->GetFileSize() == file_size
+  && (*sect_iter)->GetByteSize() == byte_size
+  && (*sect_iter)->GetFileAddress() == vm_addr
+  && (*sect_iter)->GetLog2Align() == alignment) {

labath wrote:

The section type can also change. You can see that with .text, because there we 
have a name-based fallback, but with anything else, it changes from "code" to 
"regular":
```$ bin/lldb-test object-file /tmp/a.debug  | grep -e foo -C 3
  Showing 1 subsections
Index: 0
ID: 0x6
Name: .foo
Type: regular
Permissions: r-x
Thread specific: no
$ bin/lldb-test object-file /tmp/a.out  | grep -e foo -C 3
  Showing 1 subsections
Index: 0
ID: 0x6
Name: .foo
Type: code
Permissions: r-x
Thread specific: no
```

The other fields are _probably_ fine.

https://github.com/llvm/llvm-project/pull/90099
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB][ELF] Fix section unification to not just use names. (PR #90099)

2024-04-29 Thread Alastair Houghton via lldb-commits

https://github.com/al45tair updated 
https://github.com/llvm/llvm-project/pull/90099

>From ce54a7fb339a00029da266c9f518e344aac5d19e Mon Sep 17 00:00:00 2001
From: Alastair Houghton 
Date: Thu, 25 Apr 2024 11:35:55 +0100
Subject: [PATCH 1/4] [LLDB][ELF] Fix section unification to not just use
 names.

Section unification cannot just use names, because it's valid for ELF
binaries to have multiple sections with the same name.  We should check
other section properties too.

rdar://124467787
---
 .../Plugins/ObjectFile/ELF/ObjectFileELF.cpp  | 64 +++
 1 file changed, 53 insertions(+), 11 deletions(-)

diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp 
b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 0d95a1c12bde35..60fc68c96bcc1c 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -1854,6 +1854,49 @@ class VMAddressProvider {
 };
 }
 
+namespace {
+  // We have to do this because ELF doesn't have section IDs, and also
+  // doesn't require section names to be unique.  (We use the section index
+  // for section IDs, but that isn't guaranteed to be the same in separate
+  // debug images.)
+  SectionSP FindMatchingSection(const SectionList _list,
+SectionSP section) {
+SectionSP sect_sp;
+
+addr_t vm_addr = section->GetFileAddress();
+ConstString name = section->GetName();
+offset_t file_size = section->GetFileSize();
+offset_t byte_size = section->GetByteSize();
+SectionType type = section->GetType();
+bool thread_specific = section->IsThreadSpecific();
+uint32_t permissions = section->GetPermissions();
+uint32_t alignment = section->GetLog2Align();
+
+for (auto sect_iter = section_list.begin();
+ sect_iter != section_list.end();
+ ++sect_iter) {
+  if ((*sect_iter)->GetName() == name
+  && (*sect_iter)->GetType() == type
+  && (*sect_iter)->IsThreadSpecific() == thread_specific
+  && (*sect_iter)->GetPermissions() == permissions
+  && (*sect_iter)->GetFileSize() == file_size
+  && (*sect_iter)->GetByteSize() == byte_size
+  && (*sect_iter)->GetFileAddress() == vm_addr
+  && (*sect_iter)->GetLog2Align() == alignment) {
+sect_sp = *sect_iter;
+break;
+  } else {
+sect_sp = FindMatchingSection((*sect_iter)->GetChildren(),
+  section);
+if (sect_sp)
+  break;
+  }
+}
+
+return sect_sp;
+  }
+}
+
 void ObjectFileELF::CreateSections(SectionList _section_list) {
   if (m_sections_up)
 return;
@@ -2067,10 +2110,8 @@ unsigned ObjectFileELF::ParseSymbols(Symtab *symtab, 
user_id_t start_id,
   SectionList *module_section_list =
   module_sp ? module_sp->GetSectionList() : nullptr;
 
-  // Local cache to avoid doing a FindSectionByName for each symbol. The "const
-  // char*" key must came from a ConstString object so they can be compared by
-  // pointer
-  std::unordered_map section_name_to_section;
+  // Cache the section mapping
+  std::unordered_map section_map;
 
   unsigned i;
   for (i = 0; i < num_symbols; ++i) {
@@ -2275,14 +2316,15 @@ unsigned ObjectFileELF::ParseSymbols(Symtab *symtab, 
user_id_t start_id,
 
 if (symbol_section_sp && module_section_list &&
 module_section_list != section_list) {
-  ConstString sect_name = symbol_section_sp->GetName();
-  auto section_it = section_name_to_section.find(sect_name.GetCString());
-  if (section_it == section_name_to_section.end())
+  auto section_it = section_map.find(symbol_section_sp);
+  if (section_it == section_map.end()) {
 section_it =
-section_name_to_section
-.emplace(sect_name.GetCString(),
- module_section_list->FindSectionByName(sect_name))
-.first;
+  section_map
+  .emplace(symbol_section_sp,
+   FindMatchingSection(*module_section_list,
+   symbol_section_sp))
+  .first;
+  }
   if (section_it->second)
 symbol_section_sp = section_it->second;
 }

>From 9653351729b4ef2d98faba936b8fa6fb51a9a47c Mon Sep 17 00:00:00 2001
From: Alastair Houghton 
Date: Fri, 26 Apr 2024 14:53:20 +0100
Subject: [PATCH 2/4] [LLDB][ELF] Address review feedback, add test.

Fixed a couple of nits from review, and fixed up formatting.

Also added a test.

rdar://124467787
---
 .../Plugins/ObjectFile/ELF/ObjectFileELF.cpp  |  86 +-
 .../ELF/Inputs/two-text-sections.elf  | Bin 0 -> 4976 bytes
 .../ObjectFile/ELF/two-text-sections.test |   8 ++
 3 files changed, 49 insertions(+), 45 deletions(-)
 create mode 100644 lldb/test/Shell/ObjectFile/ELF/Inputs/two-text-sections.elf
 create mode 100644 lldb/test/Shell/ObjectFile/ELF/two-text-sections.test

diff --git 

[Lldb-commits] [lldb] 0c8151a - [lldb][Test] Disable concurrent vfork tests on Arm and AArch64 Linux (again)

2024-04-29 Thread David Spickett via lldb-commits

Author: David Spickett
Date: 2024-04-29T11:41:14+01:00
New Revision: 0c8151ac809c283187e9b19d0cbe72a09c8d74e0

URL: 
https://github.com/llvm/llvm-project/commit/0c8151ac809c283187e9b19d0cbe72a09c8d74e0
DIFF: 
https://github.com/llvm/llvm-project/commit/0c8151ac809c283187e9b19d0cbe72a09c8d74e0.diff

LOG: [lldb][Test] Disable concurrent vfork tests on Arm and AArch64 Linux 
(again)

5f3e106de3cd5ce6d7ba37fb11f6ad740cb430c5 made them a lot more stable but
there are still occasions where they will timeout and leave behind stale
processes.

For example https://lab.llvm.org/buildbot/#/builders/96/builds/56699.

Added: 


Modified: 
lldb/test/API/functionalities/fork/concurrent_vfork/TestConcurrentVFork.py

Removed: 




diff  --git 
a/lldb/test/API/functionalities/fork/concurrent_vfork/TestConcurrentVFork.py 
b/lldb/test/API/functionalities/fork/concurrent_vfork/TestConcurrentVFork.py
index 2dcbb728549fb4..dd9500c186b2c8 100644
--- a/lldb/test/API/functionalities/fork/concurrent_vfork/TestConcurrentVFork.py
+++ b/lldb/test/API/functionalities/fork/concurrent_vfork/TestConcurrentVFork.py
@@ -48,6 +48,8 @@ def follow_child_helper(self, use_fork, call_exec):
 self.expect("continue", patterns=[r"exited with status = 1[0-4]"])
 
 @skipUnlessPlatform(["linux"])
+# https://github.com/llvm/llvm-project/issues/85084.
+@skipIf(oslist=["linux"], archs=["aarch64", "arm"])
 def test_follow_parent_vfork_no_exec(self):
 """
 Make sure that debugging concurrent vfork() from multiple threads 
won't crash lldb during follow-parent.
@@ -56,6 +58,8 @@ def test_follow_parent_vfork_no_exec(self):
 self.follow_parent_helper(use_fork=False, call_exec=False)
 
 @skipUnlessPlatform(["linux"])
+# https://github.com/llvm/llvm-project/issues/85084.
+@skipIf(oslist=["linux"], archs=["aarch64", "arm"])
 def test_follow_parent_fork_no_exec(self):
 """
 Make sure that debugging concurrent fork() from multiple threads won't 
crash lldb during follow-parent.
@@ -64,6 +68,8 @@ def test_follow_parent_fork_no_exec(self):
 self.follow_parent_helper(use_fork=True, call_exec=False)
 
 @skipUnlessPlatform(["linux"])
+# https://github.com/llvm/llvm-project/issues/85084.
+@skipIf(oslist=["linux"], archs=["aarch64", "arm"])
 def test_follow_parent_vfork_call_exec(self):
 """
 Make sure that debugging concurrent vfork() from multiple threads 
won't crash lldb during follow-parent.
@@ -72,6 +78,8 @@ def test_follow_parent_vfork_call_exec(self):
 self.follow_parent_helper(use_fork=False, call_exec=True)
 
 @skipUnlessPlatform(["linux"])
+# https://github.com/llvm/llvm-project/issues/85084.
+@skipIf(oslist=["linux"], archs=["aarch64", "arm"])
 def test_follow_parent_fork_call_exec(self):
 """
 Make sure that debugging concurrent vfork() from multiple threads 
won't crash lldb during follow-parent.
@@ -80,6 +88,8 @@ def test_follow_parent_fork_call_exec(self):
 self.follow_parent_helper(use_fork=True, call_exec=True)
 
 @skipUnlessPlatform(["linux"])
+# https://github.com/llvm/llvm-project/issues/85084.
+@skipIf(oslist=["linux"], archs=["aarch64", "arm"])
 def test_follow_child_vfork_no_exec(self):
 """
 Make sure that debugging concurrent vfork() from multiple threads 
won't crash lldb during follow-child.
@@ -88,6 +98,8 @@ def test_follow_child_vfork_no_exec(self):
 self.follow_child_helper(use_fork=False, call_exec=False)
 
 @skipUnlessPlatform(["linux"])
+# https://github.com/llvm/llvm-project/issues/85084.
+@skipIf(oslist=["linux"], archs=["aarch64", "arm"])
 def test_follow_child_fork_no_exec(self):
 """
 Make sure that debugging concurrent fork() from multiple threads won't 
crash lldb during follow-child.
@@ -96,6 +108,8 @@ def test_follow_child_fork_no_exec(self):
 self.follow_child_helper(use_fork=True, call_exec=False)
 
 @skipUnlessPlatform(["linux"])
+# https://github.com/llvm/llvm-project/issues/85084.
+@skipIf(oslist=["linux"], archs=["aarch64", "arm"])
 def test_follow_child_vfork_call_exec(self):
 """
 Make sure that debugging concurrent vfork() from multiple threads 
won't crash lldb during follow-child.
@@ -104,6 +118,8 @@ def test_follow_child_vfork_call_exec(self):
 self.follow_child_helper(use_fork=False, call_exec=True)
 
 @skipUnlessPlatform(["linux"])
+# https://github.com/llvm/llvm-project/issues/85084.
+@skipIf(oslist=["linux"], archs=["aarch64", "arm"])
 def test_follow_child_fork_call_exec(self):
 """
 Make sure that debugging concurrent fork() from multiple threads won't 
crash lldb during follow-child.



___
lldb-commits mailing list
lldb-commits@lists.llvm.org

[Lldb-commits] [lldb] [lldb][Docs] Remove more subtitles from packets doc (PR #90443)

2024-04-29 Thread David Spickett via lldb-commits

DavidSpickett wrote:

After this I am going to sort the entries into alphabetical order and split out 
the ones that are extensions to existing packets - then I should be done with 
this doc :)

https://github.com/llvm/llvm-project/pull/90443
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][Docs] Remove more subtitles from packets doc (PR #90443)

2024-04-29 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: David Spickett (DavidSpickett)


Changes

This removes various subtitles or converts them to bold text so that the table 
of contents is less cluttered.

This includes "Example", "Notes", "Priority To Implement" and "Response".

---

Patch is 32.23 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/90443.diff


1 Files Affected:

- (modified) lldb/docs/resources/lldbgdbremote.md (+146-274) 


``diff
diff --git a/lldb/docs/resources/lldbgdbremote.md 
b/lldb/docs/resources/lldbgdbremote.md
index a9fa2a432b7009..aaf903c9a5d13b 100644
--- a/lldb/docs/resources/lldbgdbremote.md
+++ b/lldb/docs/resources/lldbgdbremote.md
@@ -42,10 +42,8 @@ read packet: $OK#9a
 send packet: +
 ```
 
-### Priority To Implement
-
-High. Any GDB remote server that can implement this should if the
-connection is reliable. This improves packet throughput and increases
+**Priority To Implement:** High. Any GDB remote server that can implement this
+should if the connection is reliable. This improves packet throughput and 
increases
 the performance of the connection.
 
 ## QSupported
@@ -84,9 +82,7 @@ In the example above, three lldb extensions are shown:
   watchpoints, up to a pointer size, `sizeof(void*)`, a reasonable
   baseline assumption.
 
-### Priority To Implement
-
-Optional.
+**Priority To Implement:** Optional
 
 ## "A" - launch args packet
 
@@ -111,10 +107,8 @@ The above packet helps when you have remote debugging 
abilities where you
 could launch a process on a remote host, this isn't needed for bare board
 debugging.
 
-### Priority To Implement
-
-Low. Only needed if the remote target wants to launch a target after
-making a connection to a GDB server that isn't already connected to
+**Priority To Implement:** Low. Only needed if the remote target wants to 
launch
+a target after making a connection to a GDB server that isn't already 
connected to
 an inferior process.
 
 ## qLaunchSuccess
@@ -125,9 +119,8 @@ Returns the status of the last attempt to launch a process.
 Either `OK` if no error ocurred, or `E` followed by a string
 describing the error.
 
-### Priority To Implement
-
-High, launching processes is a key part of LLDB's platform mode.
+**Priority To Implement:** High, launching processes is a key part of LLDB's
+platform mode.
 
 ## QEnvironment:NAME=VALUE
 
@@ -150,10 +143,8 @@ read packet: $OK#00
 ```
 This packet can be sent one or more times _prior_ to sending a "A" packet.
 
-### Priority To Implement
-
-Low. Only needed if the remote target wants to launch a target after
-making a connection to a GDB server that isn't already connected to
+**Priority To Implement:** Low. Only needed if the remote target wants to 
launch
+a target after making a connection to a GDB server that isn't already 
connected to
 an inferior process.
 
 ## QEnvironmentHexEncoded:HEX-ENCODING(NAME=VALUE)
@@ -173,18 +164,23 @@ read packet: $OK#00
 ```
 This packet can be sent one or more times _prior_ to sending a "A" packet.
 
-### Priority To Implement
-
-Low. Only needed if the remote target wants to launch a target after
-making a connection to a GDB server that isn't already connected to
+**Priority To Implement:** Low. Only needed if the remote target wants to 
launch
+a target after making a connection to a GDB server that isn't already 
connected to
 an inferior process.
 
 ## QEnableErrorStrings
 
 This packet enables reporting of Error strings in remote packet
 replies from the server to client. If the server supports this
-feature, it should send an OK response. The client can expect the
-following error replies if this feature is enabled in the server:
+feature, it should send an OK response.
+
+```
+send packet: $QEnableErrorStrings
+read packet: $OK#00
+```
+
+The client can expect the following error replies if this feature is enabled in
+the server:
 ```
 EXX;A
 ```
@@ -195,17 +191,8 @@ It must be noted that even if the client has enabled 
reporting
 strings in error replies, it must not expect error strings to all
 error replies.
 
-### Priority To Implement
-
-Low. Only needed if the remote target wants to provide strings that
-are human readable along with an error code.
-
-### Example
-
-```
-send packet: $QEnableErrorStrings
-read packet: $OK#00
-```
+**Priority To Implement:** Low. Only needed if the remote target wants to
+provide strings that are human readable along with an error code.
 
 ## QSetSTDIN:\ / QSetSTDOUT:\ / 
QSetSTDERR:\
 
@@ -221,13 +208,10 @@ QSetSTDERR:
 ```
 These packets must be sent  _prior_ to sending a "A" packet.
 
-### Priority To Implement
-
-Low. Only needed if the remote target wants to launch a target after
-making a connection to a GDB server that isn't already connected to
+**Priority To Implement:** Low. Only needed if the remote target wants to 
launch
+a target after making a connection to a GDB server that isn't already 
connected to
 an inferior 

[Lldb-commits] [lldb] [lldb][Docs] Remove more subtitles from packets doc (PR #90443)

2024-04-29 Thread David Spickett via lldb-commits

https://github.com/DavidSpickett created 
https://github.com/llvm/llvm-project/pull/90443

This removes various subtitles or converts them to bold text so that the table 
of contents is less cluttered.

This includes "Example", "Notes", "Priority To Implement" and "Response".

>From 7810ba3e09ef947b8eba9522655dfb3e05223936 Mon Sep 17 00:00:00 2001
From: David Spickett 
Date: Mon, 29 Apr 2024 09:26:42 +0100
Subject: [PATCH 1/3] [lldb][Docs] Remove/convert notes and example titles in
 packet docs

To reduce noise in the list of contents.
---
 lldb/docs/resources/lldbgdbremote.md | 156 ++-
 1 file changed, 54 insertions(+), 102 deletions(-)

diff --git a/lldb/docs/resources/lldbgdbremote.md 
b/lldb/docs/resources/lldbgdbremote.md
index a9fa2a432b7009..70905c2de7d9d2 100644
--- a/lldb/docs/resources/lldbgdbremote.md
+++ b/lldb/docs/resources/lldbgdbremote.md
@@ -183,8 +183,15 @@ an inferior process.
 
 This packet enables reporting of Error strings in remote packet
 replies from the server to client. If the server supports this
-feature, it should send an OK response. The client can expect the
-following error replies if this feature is enabled in the server:
+feature, it should send an OK response.
+
+```
+send packet: $QEnableErrorStrings
+read packet: $OK#00
+```
+
+The client can expect the following error replies if this feature is enabled in
+the server:
 ```
 EXX;A
 ```
@@ -200,13 +207,6 @@ error replies.
 Low. Only needed if the remote target wants to provide strings that
 are human readable along with an error code.
 
-### Example
-
-```
-send packet: $QEnableErrorStrings
-read packet: $OK#00
-```
-
 ## QSetSTDIN:\ / QSetSTDOUT:\ / 
QSetSTDERR:\
 
 Setup where STDIN, STDOUT, and STDERR go prior to sending an "A"
@@ -249,8 +249,6 @@ an inferior process.
 Get the current working directory of the platform stub in
 ASCII hex encoding.
 
-### Example
-
 ```
 receive: qGetWorkingDir
 send:
2f4170706c65496e7465726e616c2f6c6c64622f73657474696e67732f342f5465737453657474696e67732e746573745f646973617373656d626c65725f73657474696e6773
@@ -283,6 +281,11 @@ Enable the `threads:` and `thread-pcs:` data in the 
question-mark packet
 ("T packet") responses when the stub reports that a program has
 stopped executing.
 
+```
+send packet: QListThreadsInStopReply
+read packet: OK
+```
+
 ### Priority To Implement
 
 Performance.  This is a performance benefit to lldb if the thread id's
@@ -290,19 +293,17 @@ and thread pc values are provided to lldb in the T stop 
packet -- if
 they are not provided to lldb, lldb will likely need to send one to
 two packets per thread to fetch the data at every private stop.
 
-### Example
-
-```
-send packet: QListThreadsInStopReply
-read packet: OK
-```
-
 ## jLLDBTraceSupported
 
 Get the processor tracing type supported by the gdb-server for the current
 inferior. Responses might be different depending on the architecture and
 capabilities of the underlying OS.
 
+```
+send packet: jLLDBTraceSupported
+read packet: {"name":, "description":}/E;A
+```
+
 ### Output Schema
 
 ```
@@ -317,19 +318,10 @@ capabilities of the underlying OS.
 If no tracing technology is supported for the inferior, or no process is
 running, then an error message is returned.
 
-### Note
-
-This packet is used by Trace plug-ins (see `lldb_private::Trace.h`) to
+**Note:** This packet is used by Trace plug-ins (see `lldb_private::Trace.h`) 
to
 do live tracing. Specifically, the name of the plug-in should match the name
 of the tracing technology returned by this packet.
 
-### Example
-
-```
-send packet: jLLDBTraceSupported
-read packet: {"name":, "description":}/E;A
-```
-
 ## jLLDBTraceStart
 
 Start tracing a process or its threads using a provided tracing technology.
@@ -341,10 +333,20 @@ response is returned, or an error otherwise.
 This traces existing and future threads of the current process. An error is
 returned if the process is already being traced.
 
+```
+send packet: jLLDBTraceStart:{"type":,...other params}]
+read packet: OK/E;A
+```
+
 ### Thread Tracing
 
 This traces specific threads.
 
+```
+send packet: jLLDBTraceStart:{"type":,"tids":,...other params}]
+read packet: OK/E;A
+```
+
 ### Input Schema
 
 ```
@@ -360,8 +362,7 @@ This traces specific threads.
 }
 ```
 
-### Notes
-
+**Notes:**
 - If "tids" is not provided, then the operation is "process tracing",
   otherwise it's "thread tracing".
 - Each tracing technology can have different levels of support for "thread
@@ -468,20 +469,6 @@ Notes:
  - If "thread tracing" is attempted on a thread already being traced with
either "thread tracing" or "process tracing", it fails.
 
-### Examples
-
-Process tracing:
-```
-send packet: jLLDBTraceStart:{"type":,...other params}]
-read packet: OK/E;A
-```
-
-Thread tracing:
-```
-send packet: jLLDBTraceStart:{"type":,"tids":,...other params}]
-read packet: OK/E;A
-```
-
 ## jLLDBTraceStop
 
 Stop tracing a 

[Lldb-commits] [lldb] [LLDB][ELF] Fix section unification to not just use names. (PR #90099)

2024-04-29 Thread Alastair Houghton via lldb-commits

al45tair wrote:

> I saw that, but a textual test is definitely preferable, particularly after 
> the linux xz fiasco. This wouldn't be the first test binary in our repo, but 
> in this case, I think it actually adds a lot of value, since yaml2obj 
> operates on the same level as what you are testing (so you can see the input 
> of the test eyeball-verify that the expected output makes sense).

:-) Fair point (though this is very much not like the xz incident — I'm a 
colleague of Jonas's at Apple, albeit in a different team, with a fairly 
longstanding history of contributing to OSS projects, and doing something like 
that would be… very career limiting).

I'll have a go at changing things to use `yaml2obj`.

https://github.com/llvm/llvm-project/pull/90099
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb[Docs] Reduce title noise in packets doc (PR #90183)

2024-04-29 Thread David Spickett via lldb-commits

https://github.com/DavidSpickett closed 
https://github.com/llvm/llvm-project/pull/90183
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 41942c8 - [lldb[Docs] Reduce title noise in packets doc (#90183)

2024-04-29 Thread via lldb-commits

Author: David Spickett
Date: 2024-04-29T08:40:09+01:00
New Revision: 41942c852e2be6c7c37f41e5128d446182fc9763

URL: 
https://github.com/llvm/llvm-project/commit/41942c852e2be6c7c37f41e5128d446182fc9763
DIFF: 
https://github.com/llvm/llvm-project/commit/41942c852e2be6c7c37f41e5128d446182fc9763.diff

LOG: [lldb[Docs] Reduce title noise in packets doc (#90183)

This removes the "Brief" and "Description" subtitles and merges the text
of both so that the contents listing is clearer.

Added: 


Modified: 
lldb/docs/resources/lldbgdbremote.md

Removed: 




diff  --git a/lldb/docs/resources/lldbgdbremote.md 
b/lldb/docs/resources/lldbgdbremote.md
index 05e4f714f7f704..a9fa2a432b7009 100644
--- a/lldb/docs/resources/lldbgdbremote.md
+++ b/lldb/docs/resources/lldbgdbremote.md
@@ -27,18 +27,8 @@ standard GDB remote protocol packets.
 
 ## QStartNoAckMode
 
-### Brief
-
 Try to enable no ACK mode to skip sending ACKs and NACKs.
 
-### Priority To Implement
-
-High. Any GDB remote server that can implement this should if the
-connection is reliable. This improves packet throughput and increases
-the performance of the connection.
-
-### Description
-
 Having to send an ACK/NACK after every packet slows things down a bit, so we
 have a way to disable ACK packets to minimize the traffic for reliable
 communication interfaces (like sockets). Below GDB or LLDB will send this
@@ -52,17 +42,15 @@ read packet: $OK#9a
 send packet: +
 ```
 
-## QSupported
-
-### Brief
-
-Query the GDB remote server for features it supports
-
 ### Priority To Implement
 
-Optional.
+High. Any GDB remote server that can implement this should if the
+connection is reliable. This improves packet throughput and increases
+the performance of the connection.
 
-### Description
+## QSupported
+
+Query the GDB remote server for features it supports
 
 QSupported is a standard GDB Remote Serial Protocol packet, but
 there are several additions to the response that lldb can parse.
@@ -96,21 +84,14 @@ In the example above, three lldb extensions are shown:
   watchpoints, up to a pointer size, `sizeof(void*)`, a reasonable
   baseline assumption.
 
+### Priority To Implement
 
-## "A" - launch args packet
+Optional.
 
-### Brief
+## "A" - launch args packet
 
 Launch a program using the supplied arguments
 
-### Priority To Implement
-
-Low. Only needed if the remote target wants to launch a target after
-making a connection to a GDB server that isn't already connected to
-an inferior process.
-
-### Description
-
 We have added support for the "set program arguments" packet where we can
 start a connection to a remote server and then later supply the path to the
 executable and the arguments to use when executing:
@@ -130,14 +111,16 @@ The above packet helps when you have remote debugging 
abilities where you
 could launch a process on a remote host, this isn't needed for bare board
 debugging.
 
-## qLaunchSuccess
+### Priority To Implement
+
+Low. Only needed if the remote target wants to launch a target after
+making a connection to a GDB server that isn't already connected to
+an inferior process.
 
-### Brief
+## qLaunchSuccess
 
 Check whether launching a process with the `A` packet succeeded.
 
-### Description
-
 Returns the status of the last attempt to launch a process.
 Either `OK` if no error ocurred, or `E` followed by a string
 describing the error.
@@ -148,8 +131,6 @@ High, launching processes is a key part of LLDB's platform 
mode.
 
 ## QEnvironment:NAME=VALUE
 
-### Brief
-
 Setup the environment up for a new child process that will soon be
 launched using the "A" packet.
 
@@ -161,14 +142,6 @@ scan the environment strings before sending, prefer
 the `QEnvironmentHexEncoded` packet over `QEnvironment`, if it is
 available.
 
-### Priority To Implement
-
-Low. Only needed if the remote target wants to launch a target after
-making a connection to a GDB server that isn't already connected to
-an inferior process.
-
-### Description
-
 Both GDB and LLDB support passing down environment variables. Is it ok to
 respond with a `$#00` (unimplemented):
 ```
@@ -177,9 +150,13 @@ read packet: $OK#00
 ```
 This packet can be sent one or more times _prior_ to sending a "A" packet.
 
-## QEnvironmentHexEncoded:HEX-ENCODING(NAME=VALUE)
+### Priority To Implement
+
+Low. Only needed if the remote target wants to launch a target after
+making a connection to a GDB server that isn't already connected to
+an inferior process.
 
-### Brief
+## QEnvironmentHexEncoded:HEX-ENCODING(NAME=VALUE)
 
 Setup the environment up for a new child process that will soon be
 launched using the "A" packet.
@@ -188,14 +165,6 @@ The only 
diff erence between this packet and `QEnvironment` is that the
 environment key-value pair is ascii hex encoded for transmission.
 This allows values with gdb-remote metacharacters like `#` to be sent.
 
-### Priority To Implement
-
-Low.