[Lldb-commits] [lldb] [lldb] Avoid repeated map lookups (NFC) (PR #113121)

2024-10-21 Thread Nikita Popov via lldb-commits

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

LGTM

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


[Lldb-commits] [lldb] [lldb][LoongArch64] Add support for LoongArch64 in elf-core for lldb (PR #112296)

2024-10-21 Thread Lu Weining via lldb-commits

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

LGTM and thanks!

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


[Lldb-commits] [lldb] Push down cpython module to the submodule (PR #113066)

2024-10-21 Thread Jonas Devlieghere via lldb-commits

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


[Lldb-commits] [lldb] Push down cpython module to the submodule (PR #113066)

2024-10-21 Thread Jonas Devlieghere via lldb-commits


@@ -145,7 +145,7 @@ add_lldb_library(liblldb SHARED ${option_framework}
   ${option_install_prefix}
 )
 
-# lib/pythonX.Y/dist-packages/lldb/_lldb.so is a symlink to lib/liblldb.so,
+# lib/pythonX.Y/site-packages/lldb/_lldb.so is a symlink to lib/liblldb.so,

JDevlieghere wrote:

This isn't related to this change, right? This was already the case previously? 

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


[Lldb-commits] [lldb] Add the ability to break on call-site locations, improve inline stepping (PR #112939)

2024-10-21 Thread via lldb-commits


@@ -508,8 +508,20 @@ void BreakpointLocation::GetDescription(Stream *s,
 s->PutCString("re-exported target = ");
   else
 s->PutCString("where = ");
+
+  // If there's a preferred line entry for printing, use that.
+  bool show_function_info = true;
+  if (auto preferred = GetPreferredLineEntry()) {
+sc.line_entry = *preferred;
+// FIXME: We're going to get the function name wrong when the preferred
+// line entry is not the lowest one.  For now, just leave the function
+// out in this case, but we really should also figure out how to easily
+// fake the function name here.

jimingham wrote:

What would it mean to replace the Module, the CompileUnit or the Function?  
This is for a breakpoint location, so whatever we do has to result in this 
being the same address.  I was hesitant to introduce a more general "breakpoint 
gets to modify its symbol context" if I didn't know what it meant or how to 
ensure we didn't end up with a SymbolContext that wasn't at the breakpoint 
location's address.  I was originally planning to JUST store the "inlined call 
stack depth" to make it clear this couldn't change the PC value, but that ended 
up being more annoying that helpful.

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


[Lldb-commits] [lldb] [lldb][LoongArch64] Add support for LoongArch64 in elf-core for lldb (PR #112296)

2024-10-21 Thread David Spickett via lldb-commits

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


[Lldb-commits] [lldb] 911a6f2 - [lldb][LoongArch64] Add support for LoongArch64 in elf-core for lldb (#112296)

2024-10-21 Thread via lldb-commits

Author: Liu An
Date: 2024-10-21T10:04:55+01:00
New Revision: 911a6f2fcc719c46b5b392823473ba0bb5b1f4e1

URL: 
https://github.com/llvm/llvm-project/commit/911a6f2fcc719c46b5b392823473ba0bb5b1f4e1
DIFF: 
https://github.com/llvm/llvm-project/commit/911a6f2fcc719c46b5b392823473ba0bb5b1f4e1.diff

LOG: [lldb][LoongArch64] Add support for LoongArch64 in elf-core for lldb 
(#112296)

When using the lldb command 'target create --core' on the LoongArch64
architecture, this part of the code is required.

Added: 

lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_loongarch64.cpp
lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_loongarch64.h
lldb/test/API/functionalities/postmortem/elf-core/linux-loongarch64.core
lldb/test/API/functionalities/postmortem/elf-core/linux-loongarch64.out

Modified: 
lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_loongarch64.cpp
lldb/source/Plugins/Process/elf-core/CMakeLists.txt
lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp
lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py

Removed: 




diff  --git 
a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_loongarch64.cpp 
b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_loongarch64.cpp
index a48a58f28f7aad..49f371fb949b7b 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_loongarch64.cpp
+++ b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_loongarch64.cpp
@@ -58,7 +58,7 @@ 
RegisterContextPOSIX_loongarch64::GetRegisterInfoAtIndex(size_t reg) {
 }
 
 size_t RegisterContextPOSIX_loongarch64::GetRegisterSetCount() {
-  return m_register_info_up->GetRegisterCount();
+  return m_register_info_up->GetRegisterSetCount();
 }
 
 const lldb_private::RegisterSet *

diff  --git a/lldb/source/Plugins/Process/elf-core/CMakeLists.txt 
b/lldb/source/Plugins/Process/elf-core/CMakeLists.txt
index 72925c835b5c89..7473fa8d41ccb3 100644
--- a/lldb/source/Plugins/Process/elf-core/CMakeLists.txt
+++ b/lldb/source/Plugins/Process/elf-core/CMakeLists.txt
@@ -10,6 +10,7 @@ add_lldb_library(lldbPluginProcessElfCore PLUGIN
   RegisterContextPOSIXCore_s390x.cpp
   RegisterContextPOSIXCore_x86_64.cpp
   RegisterContextPOSIXCore_riscv64.cpp
+  RegisterContextPOSIXCore_loongarch64.cpp
   RegisterUtilities.cpp
 
   LINK_LIBS

diff  --git 
a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_loongarch64.cpp 
b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_loongarch64.cpp
new file mode 100644
index 00..f0500948a6ab22
--- /dev/null
+++ 
b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_loongarch64.cpp
@@ -0,0 +1,84 @@
+//===-- RegisterContextPOSIXCore_loongarch64.cpp 
--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "RegisterContextPOSIXCore_loongarch64.h"
+
+#include "lldb/Utility/DataBufferHeap.h"
+
+using namespace lldb_private;
+
+std::unique_ptr
+RegisterContextCorePOSIX_loongarch64::Create(Thread &thread,
+ const ArchSpec &arch,
+ const DataExtractor &gpregset,
+ llvm::ArrayRef notes) {
+  return std::unique_ptr(
+  new RegisterContextCorePOSIX_loongarch64(
+  thread,
+  std::make_unique(arch, Flags()),
+  gpregset, notes));
+}
+
+RegisterContextCorePOSIX_loongarch64::RegisterContextCorePOSIX_loongarch64(
+Thread &thread,
+std::unique_ptr register_info,
+const DataExtractor &gpregset, llvm::ArrayRef notes)
+: RegisterContextPOSIX_loongarch64(thread, std::move(register_info)) {
+
+  m_gpr.SetData(std::make_shared(gpregset.GetDataStart(),
+ gpregset.GetByteSize()));
+  m_gpr.SetByteOrder(gpregset.GetByteOrder());
+
+  ArchSpec arch = m_register_info_up->GetTargetArchitecture();
+  DataExtractor fpregset = getRegset(notes, arch.GetTriple(), FPR_Desc);
+  m_fpr.SetData(std::make_shared(fpregset.GetDataStart(),
+ fpregset.GetByteSize()));
+  m_fpr.SetByteOrder(fpregset.GetByteOrder());
+}
+
+RegisterContextCorePOSIX_loongarch64::~RegisterContextCorePOSIX_loongarch64() =
+default;
+
+bool RegisterContextCorePOSIX_loongarch64::ReadGPR() { return true; }
+
+bool RegisterContextCorePOSIX_loongarch64::ReadFPR() { return true; }
+
+bool RegisterContextCorePOSIX_loongarch64::WriteGPR() {
+  assert(false && "Writing registers is not allowed for core dumps");
+  return false;
+}
+
+bool RegisterContextCorePOSIX_loongarch64::WriteFPR() {
+  assert(false && "Writ

[Lldb-commits] [lldb] [lldb][AArch64] Read fpmr register from core files (PR #110104)

2024-10-21 Thread David Spickett via lldb-commits

DavidSpickett wrote:

ping! @omjavaid 

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


[Lldb-commits] [lldb] [lldb][LoongArch64] Add support for LoongArch64 in elf-core for lldb (PR #112296)

2024-10-21 Thread Liu An via lldb-commits

https://github.com/lawn123 updated 
https://github.com/llvm/llvm-project/pull/112296

>From ba485de763a08f6ff3c7468c1a1bfbbfb25ac48f Mon Sep 17 00:00:00 2001
From: Liu An 
Date: Tue, 15 Oct 2024 10:31:35 +0800
Subject: [PATCH 1/5] [LoongArch64]: Add support for LoongArch64 in elf-core
 for lldb

---
 .../Plugins/Process/elf-core/CMakeLists.txt   |  1 +
 .../RegisterContextPOSIXCore_loongarch64.cpp  | 87 +++
 .../RegisterContextPOSIXCore_loongarch64.h| 62 +
 .../Process/elf-core/ThreadElfCore.cpp|  6 ++
 4 files changed, 156 insertions(+)
 create mode 100644 
lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_loongarch64.cpp
 create mode 100644 
lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_loongarch64.h

diff --git a/lldb/source/Plugins/Process/elf-core/CMakeLists.txt 
b/lldb/source/Plugins/Process/elf-core/CMakeLists.txt
index 72925c835b5c89..7473fa8d41ccb3 100644
--- a/lldb/source/Plugins/Process/elf-core/CMakeLists.txt
+++ b/lldb/source/Plugins/Process/elf-core/CMakeLists.txt
@@ -10,6 +10,7 @@ add_lldb_library(lldbPluginProcessElfCore PLUGIN
   RegisterContextPOSIXCore_s390x.cpp
   RegisterContextPOSIXCore_x86_64.cpp
   RegisterContextPOSIXCore_riscv64.cpp
+  RegisterContextPOSIXCore_loongarch64.cpp
   RegisterUtilities.cpp
 
   LINK_LIBS
diff --git 
a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_loongarch64.cpp 
b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_loongarch64.cpp
new file mode 100644
index 00..af192ecbe01e1b
--- /dev/null
+++ 
b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_loongarch64.cpp
@@ -0,0 +1,87 @@
+//===-- RegisterContextPOSIXCore_loongarch64.cpp
+//--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "RegisterContextPOSIXCore_loongarch64.h"
+
+#include "lldb/Utility/DataBufferHeap.h"
+
+using namespace lldb_private;
+
+std::unique_ptr
+RegisterContextCorePOSIX_loongarch64::Create(Thread &thread,
+ const ArchSpec &arch,
+ const DataExtractor &gpregset,
+ llvm::ArrayRef notes) {
+  return std::unique_ptr(
+  new RegisterContextCorePOSIX_loongarch64(
+  thread,
+  std::make_unique(arch, Flags()),
+  gpregset, notes));
+}
+
+RegisterContextCorePOSIX_loongarch64::RegisterContextCorePOSIX_loongarch64(
+Thread &thread,
+std::unique_ptr register_info,
+const DataExtractor &gpregset, llvm::ArrayRef notes)
+: RegisterContextPOSIX_loongarch64(thread, std::move(register_info)) {
+
+  m_gpr_buffer = std::make_shared(gpregset.GetDataStart(),
+  gpregset.GetByteSize());
+  m_gpr.SetData(m_gpr_buffer);
+  m_gpr.SetByteOrder(gpregset.GetByteOrder());
+
+  ArchSpec arch = m_register_info_up->GetTargetArchitecture();
+  DataExtractor fpregset = getRegset(notes, arch.GetTriple(), FPR_Desc);
+  m_fpr_buffer = std::make_shared(fpregset.GetDataStart(),
+  fpregset.GetByteSize());
+  m_fpr.SetData(m_fpr_buffer);
+  m_fpr.SetByteOrder(fpregset.GetByteOrder());
+}
+
+RegisterContextCorePOSIX_loongarch64::~RegisterContextCorePOSIX_loongarch64() =
+default;
+
+bool RegisterContextCorePOSIX_loongarch64::ReadGPR() { return true; }
+
+bool RegisterContextCorePOSIX_loongarch64::ReadFPR() { return true; }
+
+bool RegisterContextCorePOSIX_loongarch64::WriteGPR() {
+  assert(false && "Writing registers is not allowed for core dumps");
+  return false;
+}
+
+bool RegisterContextCorePOSIX_loongarch64::WriteFPR() {
+  assert(false && "Writing registers is not allowed for core dumps");
+  return false;
+}
+
+bool RegisterContextCorePOSIX_loongarch64::ReadRegister(
+const RegisterInfo *reg_info, RegisterValue &value) {
+  const uint8_t *src = nullptr;
+  lldb::offset_t offset = reg_info->byte_offset;
+
+  if (IsGPR(reg_info->kinds[lldb::eRegisterKindLLDB])) {
+src = m_gpr.GetDataStart();
+  } else if (IsFPR(reg_info->kinds[lldb::eRegisterKindLLDB])) {
+src = m_fpr.GetDataStart();
+offset -= GetGPRSize();
+  } else {
+return false;
+  }
+
+  Status error;
+  value.SetFromMemoryData(*reg_info, src + offset, reg_info->byte_size,
+  lldb::eByteOrderLittle, error);
+  return error.Success();
+}
+
+bool RegisterContextCorePOSIX_loongarch64::WriteRegister(
+const RegisterInfo *reg_info, const RegisterValue &value) {
+  return false;
+}
diff --git 
a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_loongarch64.h 
b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_loongarch6

[Lldb-commits] [lldb] [lldb][LoongArch64] Add support for LoongArch64 in elf-core for lldb (PR #112296)

2024-10-21 Thread Liu An via lldb-commits

lawn123 wrote:

@DavidSpickett @SixWeining I have fix CI fail and fcsr format issues

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


[Lldb-commits] [lldb] [lldb][LoongArch64] Add support for LoongArch64 in elf-core for lldb (PR #112296)

2024-10-21 Thread via lldb-commits

github-actions[bot] wrote:



@lawn123 Congratulations on having your first Pull Request (PR) merged into the 
LLVM Project!

Your changes will be combined with recent changes from other authors, then 
tested by our [build bots](https://lab.llvm.org/buildbot/). If there is a 
problem with a build, you may receive a report in an email or a comment on this 
PR.

Please check whether problems have been caused by your change specifically, as 
the builds can include changes from many authors. It is not uncommon for your 
change to be included in a build that fails due to someone else's changes, or 
infrastructure issues.

How to do this, and the rest of the post-merge process, is covered in detail 
[here](https://llvm.org/docs/MyFirstTypoFix.html#myfirsttypofix-issues-after-landing-your-pr).

If your change does cause a problem, it may be reverted, or you can revert it 
yourself. This is a normal part of [LLVM 
development](https://llvm.org/docs/DeveloperPolicy.html#patch-reversion-policy).
 You can fix your changes and open a new PR to merge them again.

If you don't get any reports, no action is required from you. Your changes are 
working as expected, well done!


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


[Lldb-commits] [lldb] c47df3e - [lldb][test] Make vector operator[] return T& to workaround Arm codegen issue

2024-10-21 Thread David Spickett via lldb-commits

Author: David Spickett
Date: 2024-10-21T11:54:54Z
New Revision: c47df3e8c8f47bab8a8302757c50710e0e1c43fb

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

LOG: [lldb][test] Make vector operator[] return T& to workaround Arm codegen 
issue

Since https://github.com/llvm/llvm-project/pull/109628 landed, this test
has been failing on 32-bit Arm.

This is due to a codegen problem (whether added or uncovered by the change,
not known) where the trap instruction is placed after the frame pointer
and link register are restored.

https://github.com/llvm/llvm-project/issues/113154

So the code was:
```
std::__1::vector::operator[](unsigned int):
  sub sp, sp, #8
  str r0, [sp, #4]
  str r1, [sp]
  add sp, sp, #8
  .inst 0xe7ffdefe
  bx lr
```
When lldb saw the trap, the PC was inside operator[] but the frame
information actually pointed to g.

This bug only happens for leaf functions so adding a return type
works around it:
```
std::__1::vector::operator[](unsigned int):
  push {r11, lr}
  mov r11, sp
  sub sp, sp, #8
  str r0, [sp, #4]
  str r1, [sp]
  mov sp, r11
  pop {r11, lr}
  .inst 0xe7ffdefe
  bx lr
```
(and operator[] should return T& anyway)

Now the PC location and frame information should match and the
test passes.

Added: 


Modified: 
lldb/test/Shell/Recognizer/Inputs/verbose_trap-in-stl.cpp

Removed: 




diff  --git a/lldb/test/Shell/Recognizer/Inputs/verbose_trap-in-stl.cpp 
b/lldb/test/Shell/Recognizer/Inputs/verbose_trap-in-stl.cpp
index 4f01827944e166..20db722ef105da 100644
--- a/lldb/test/Shell/Recognizer/Inputs/verbose_trap-in-stl.cpp
+++ b/lldb/test/Shell/Recognizer/Inputs/verbose_trap-in-stl.cpp
@@ -1,7 +1,7 @@
 namespace std {
 inline namespace __1 {
 template  struct vector {
-  void operator[](unsigned) { __builtin_verbose_trap("Bounds error", 
"out-of-bounds access"); }
+  T& operator[](unsigned) { __builtin_verbose_trap("Bounds error", 
"out-of-bounds access"); }
 };
 } // namespace __1
 } // namespace std



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


[Lldb-commits] [lldb] [lldb] Rename CommandReturnObject::Get.*Data -> Get.*String (PR #112062)

2024-10-21 Thread Carlos Alberto Enciso via lldb-commits

CarlosAlbertoEnciso wrote:

@adrian-prantl It seems that this change is causing the 
'lldb/unittests/ScriptInterpreter/Lua/ScriptInterpreterTests.cpp' to fail when 
building using GCC.

c2750807ba2a [lldb] Rename CommandReturnObject::Get.*Data -> Get.*String 
(#112062)
```
../llvm-project/lldb/unittests/ScriptInterpreter/Lua/ScriptInterpreterTests.cpp:51:22:
error: ‘class lldb_private::CommandReturnObject’ has no member named 
‘GetErrorData’;
did you mean ‘GetErrorStream’?
   51 |   EXPECT_TRUE(result.GetErrorData().starts_with(
```

After change:
9eddc8b9bf4e [lldb] Expose structured command diagnostics via the SBAPI. 
(#112109)
The error message changes to:
```
../llvm-project/lldb/unittests/ScriptInterpreter/Lua/ScriptInterpreterTests.cpp:51:37:
error: ‘lldb_private::StructuredData::ObjectSP’
 {aka ‘class std::shared_ptr’}
 has no member named ‘starts_with’
   51 |   EXPECT_TRUE(result.GetErrorData().starts_with(
```


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


[Lldb-commits] [clang] [clang-tools-extra] [lldb] [llvm] Propagate IsText parameter to openFileForRead function (PR #110661)

2024-10-21 Thread Abhina Sree via lldb-commits

abhina-sree wrote:

Closing this because an alternative solution was implemented here 
https://github.com/llvm/llvm-project/pull/111723

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


[Lldb-commits] [clang] [clang-tools-extra] [lldb] [llvm] Propagate IsText parameter to openFileForRead function (PR #110661)

2024-10-21 Thread Abhina Sree via lldb-commits

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


[Lldb-commits] [clang] [lldb] [clang][RecordLayoutBuilder] Be stricter about inferring packed-ness in ExternalLayouts (PR #97443)

2024-10-21 Thread Michael Buch via lldb-commits

https://github.com/Michael137 updated 
https://github.com/llvm/llvm-project/pull/97443

>From 38b7837bcc5da9e89778191654f9552ebccacbd5 Mon Sep 17 00:00:00 2001
From: Michael Buch 
Date: Tue, 2 Jul 2024 18:43:34 +0200
Subject: [PATCH 1/3] [clang][RecordLayoutBuilder] Be stricter about inferring
 packed-ness in ExternalLayouts

This patch is motivated by the LLDB support required for:
https://github.com/llvm/llvm-project/issues/93069

In the presence of `[[no_unique_address]]`, LLDB may ask Clang
to lay out types with overlapping field offsets. Because we don't
have attributes such as `packed` or `no_unique_address` in the LLDB
AST, the `RecordLayoutBuilder` supports an `InferAlignment` mode, which,
in the past, attempted to detect layouts which came from packed
structures in order to provide a conservative estimate of alignment for
it (since `DW_AT_alignment` isn't emitted unless explicitly changed with
`alignas`, etc.).

However, in the presence of overlapping fields due to `no_unique_address`,
`InferAlignment` would set the alignment of structures to `1` for which
that's incorrect. This poses issues in some LLDB formatters that
synthesize new Clang types and rely on the layout builder to get the
`FieldOffset` of structures right that we did have DWARF offsets for.
The result of this is that if we get the alignment wrong, LLDB reads
out garbage data from the wrong field offsets.

There are a couple of solutions to this that we considered:
1. Make LLDB formatters not do the above, and make them more robust
   to inaccurate alignment.
2. Remove `InferAlignment` entirely and rely on Clang emitting
   `DW_AT_alignment` for packed structures.
3. Remove `InferAlignment` and detect packedness from within LLDB.
4. Make the `InferAlignment` logic account for overlapping fields.

Option (1) turned out quite hairy and it's not clear we can achieve
this with the tools available for certain STL formatters (particularly
`std::map`). But I would still very much like to simplify this if we
can.

Option (2) wouldn't help with GCC-compiled binaries, and if we can
get away with LLDB not needing the alignment, then we wouldn't need
to increase debug-info size.

Option (3), AFAICT, would require us to reimplement some of the layout
logic in the layout builder. Would be great if we can avoid this added
complexity.

Option (4) seemed like the best option in the interim. As part of this
change I also removed one of the `InferAlignment` blocks. The test-cases
associated with this code-path pass regardless, and from the description
of the change that introduced it it's not clear why specifically the
base offsets would influence the `Alignment` field, and how it would
imply packedness. But happy to be proven wrong. Ultimately it would be
great if we can get rid of the `InferAlignment` infrastructure and
support our use-cases in LLDB or DWARF instead.
---
 clang/lib/AST/RecordLayoutBuilder.cpp | 34 +--
 .../DWARF/x86/no_unique_address-alignment.cpp |  2 --
 .../x86/no_unique_address-base-alignment.cpp  |  2 --
 3 files changed, 17 insertions(+), 21 deletions(-)

diff --git a/clang/lib/AST/RecordLayoutBuilder.cpp 
b/clang/lib/AST/RecordLayoutBuilder.cpp
index d9bf62c2bbb04a..8dbf69c310cbb4 100644
--- a/clang/lib/AST/RecordLayoutBuilder.cpp
+++ b/clang/lib/AST/RecordLayoutBuilder.cpp
@@ -802,7 +802,8 @@ class ItaniumRecordLayoutBuilder {
   /// \param Field The field whose offset is being queried.
   /// \param ComputedOffset The offset that we've computed for this field.
   uint64_t updateExternalFieldOffset(const FieldDecl *Field,
- uint64_t ComputedOffset);
+ uint64_t ComputedOffset,
+ uint64_t PreviousOffset);
 
   void CheckFieldPadding(uint64_t Offset, uint64_t UnpaddedOffset,
   uint64_t UnpackedOffset, unsigned UnpackedAlign,
@@ -1296,13 +1297,6 @@ ItaniumRecordLayoutBuilder::LayoutBase(const 
BaseSubobjectInfo *Base) {
 bool Allowed = EmptySubobjects->CanPlaceBaseAtOffset(Base, Offset);
 (void)Allowed;
 assert(Allowed && "Base subobject externally placed at overlapping 
offset");
-
-if (InferAlignment && Offset < getDataSize().alignTo(AlignTo)) {
-  // The externally-supplied base offset is before the base offset we
-  // computed. Assume that the structure is packed.
-  Alignment = CharUnits::One();
-  InferAlignment = false;
-}
   }
 
   if (!Base->Class->isEmpty()) {
@@ -1770,7 +1764,8 @@ void ItaniumRecordLayoutBuilder::LayoutBitField(const 
FieldDecl *D) {
   // If we're using external layout, give the external layout a chance
   // to override this information.
   if (UseExternalLayout)
-FieldOffset = updateExternalFieldOffset(D, FieldOffset);
+FieldOffset = updateExternalFieldOffset(
+D, FieldOffset, FieldOffsets.empty() ? 0 : FieldOffsets.back());
 
   // Okay, place the bitfield at the calculated offset.
   Field

[Lldb-commits] [clang] [lldb] [clang][RecordLayoutBuilder] Be stricter about inferring packed-ness in ExternalLayouts (PR #97443)

2024-10-21 Thread Michael Buch via lldb-commits

https://github.com/Michael137 commented:

gentle ping

@efriedma-quic mind taking another look? Latest iteration skips over empty 
fields that overlap.

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


[Lldb-commits] [lldb] 1bf1e92 - [lldb] Avoid repeated map lookups (NFC) (#113121)

2024-10-21 Thread via lldb-commits

Author: Kazu Hirata
Date: 2024-10-21T06:51:25-07:00
New Revision: 1bf1e92c72ec9086ab24103cf968e115b7248101

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

LOG: [lldb] Avoid repeated map lookups (NFC) (#113121)

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp 
b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
index 584c2115459c66..4fc48b4d133382 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
@@ -1295,12 +1295,11 @@ void SymbolFilePDB::CacheFunctionNames() {
 continue;
 
   if (CPlusPlusLanguage::IsCPPMangledName(name.c_str())) {
-auto vm_addr = pub_sym_up->getVirtualAddress();
-
 // PDB public symbol has mangled name for its associated function.
-if (vm_addr && addr_ids.find(vm_addr) != addr_ids.end()) {
-  // Cache mangled name.
-  m_func_full_names.Append(ConstString(name), addr_ids[vm_addr]);
+if (auto vm_addr = pub_sym_up->getVirtualAddress()) {
+  if (auto it = addr_ids.find(vm_addr); it != addr_ids.end())
+// Cache mangled name.
+m_func_full_names.Append(ConstString(name), it->second);
 }
   }
 }



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


[Lldb-commits] [lldb] [lldb] Avoid repeated map lookups (NFC) (PR #113121)

2024-10-21 Thread Kazu Hirata via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Remove stack_logging.h (PR #112987)

2024-10-21 Thread Jason Molenda via lldb-commits

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

ah, hilarious.  good cleanup.

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


[Lldb-commits] [lldb] 4de708e - [lldb] Remove stack_logging.h (#112987)

2024-10-21 Thread via lldb-commits

Author: Jonas Devlieghere
Date: 2024-10-21T10:45:55-07:00
New Revision: 4de708e32e31ac32b924dfeb020086636700c0f7

URL: 
https://github.com/llvm/llvm-project/commit/4de708e32e31ac32b924dfeb020086636700c0f7
DIFF: 
https://github.com/llvm/llvm-project/commit/4de708e32e31ac32b924dfeb020086636700c0f7.diff

LOG: [lldb] Remove stack_logging.h (#112987)

This file is covered under the Apple open source license rather than the
LLVM license. Presumably this was an oversight, but it doesn't really
matter as this file is unused. Remove it altogether.

Added: 


Modified: 
lldb/tools/debugserver/debugserver.xcodeproj/project.pbxproj

Removed: 
lldb/tools/debugserver/source/MacOSX/stack_logging.h



diff  --git a/lldb/tools/debugserver/debugserver.xcodeproj/project.pbxproj 
b/lldb/tools/debugserver/debugserver.xcodeproj/project.pbxproj
index 79175c6d9dd739..c25eabcbadab38 100644
--- a/lldb/tools/debugserver/debugserver.xcodeproj/project.pbxproj
+++ b/lldb/tools/debugserver/debugserver.xcodeproj/project.pbxproj
@@ -163,7 +163,6 @@
456F67721AD46CE9002850C2 /* debugserver-nonui */ = {isa = 
PBXFileReference; explicitFileType = "compiled.mach-o.executable"; 
includeInIndex = 0; path = "debugserver-nonui"; sourceTree = 
BUILT_PRODUCTS_DIR; };
49D404611E39260F00570CDC /* Foundation.framework */ = {isa = 
PBXFileReference; lastKnownFileType = wrapper.framework; name = 
Foundation.framework; path = System/Library/Frameworks/Foundation.framework; 
sourceTree = SDKROOT; };
49F5301213316D7F008956F6 /* MachRegisterStatesX86_64.h */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; 
path = MachRegisterStatesX86_64.h; sourceTree = ""; };
-   9457ECF61419864100DFE7D8 /* stack_logging.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stack_logging.h; 
sourceTree = ""; };
9684D93A29FCA1E10046D45E /* 
debugserver-macosx-private-entitlements.plist */ = {isa = PBXFileReference; 
lastKnownFileType = text.plist; name = 
"debugserver-macosx-private-entitlements.plist"; path = 
"resources/debugserver-macosx-private-entitlements.plist"; sourceTree = 
SOURCE_ROOT; };
9684D93B29FCA1E10046D45E /* lldb-debugserver-Info.plist */ = 
{isa = PBXFileReference; lastKnownFileType = text.plist; name = 
"lldb-debugserver-Info.plist"; path = "resources/lldb-debugserver-Info.plist"; 
sourceTree = SOURCE_ROOT; };
9684D93C29FCA1E10046D45E /* 
debugserver-macosx-entitlements.plist */ = {isa = PBXFileReference; 
lastKnownFileType = text.plist; name = "debugserver-macosx-entitlements.plist"; 
path = "resources/debugserver-macosx-entitlements.plist"; sourceTree = 
SOURCE_ROOT; };

diff  --git a/lldb/tools/debugserver/source/MacOSX/stack_logging.h 
b/lldb/tools/debugserver/source/MacOSX/stack_logging.h
deleted file mode 100644
index 5209e38a08ea79..00
--- a/lldb/tools/debugserver/source/MacOSX/stack_logging.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Copyright (c) 1999-2007 Apple Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- *
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- *
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- *
- * @APPLE_LICENSE_HEADER_END@
- */
-
-#ifndef malloc_history_test_stack_logging_h
-#define malloc_history_test_stack_logging_h
-
-#import 
-
-#define stack_logging_type_free 0
-#define stack_logging_type_generic 
\
-  1 /* anything that is not allocation/deallocation */
-#define stack_logging_type_alloc 2   /* malloc, realloc, etc... */
-#define stack_logging_type_dealloc 4 /* free, realloc, etc... */
-
-// Following flags are absorbed by stack_logging_log_stack()
-#define stack_logging_flag_zone 8/* NSZoneMalloc, etc... */
-#define stack_logging_flag_calloc 16 /* multiply arguments to get the size */
-#define stack_logging_flag_object  
\
-  32 /* NSAllocateObject(Class, extraBytes, zone) */
-#define stack_logging_flag_cleared 64 /* for NewEmptyHandle */
-#define stack_logging_flag_handle 128 /* for Handle (de-)allocation routines   

[Lldb-commits] [lldb] [lldb] Remove stack_logging.h (PR #112987)

2024-10-21 Thread Jonas Devlieghere via lldb-commits

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


[Lldb-commits] [lldb] [lldb][docs] Fix "Developing LLDB" table of contents (PR #113166)

2024-10-21 Thread Jonas Devlieghere via lldb-commits

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


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


[Lldb-commits] [lldb] Add the ability to break on call-site locations, improve inline stepping (PR #112939)

2024-10-21 Thread via lldb-commits

https://github.com/jimingham updated 
https://github.com/llvm/llvm-project/pull/112939

>From 9c6705b21df14dc911665e1082c9b31ce00d7e7c Mon Sep 17 00:00:00 2001
From: Jim Ingham 
Date: Thu, 3 Oct 2024 18:24:46 -0700
Subject: [PATCH 1/7] Add the ability to break on call-site locations, report
 the correct position in the virtual inlined call stack when they are hit, and
 step through the inlined stack from there.

---
 .../lldb/Breakpoint/BreakpointLocation.h  |  31 
 lldb/include/lldb/Breakpoint/BreakpointSite.h |   5 +
 lldb/include/lldb/Target/StopInfo.h   |  11 ++
 .../lldb/Target/ThreadPlanStepInRange.h   |   4 +-
 lldb/source/Breakpoint/BreakpointLocation.cpp |  61 ++-
 lldb/source/Breakpoint/BreakpointResolver.cpp |  12 ++
 lldb/source/Breakpoint/BreakpointSite.cpp |  16 ++
 lldb/source/Core/Declaration.cpp  |   2 +-
 lldb/source/Symbol/CompileUnit.cpp| 104 ++-
 lldb/source/Target/StackFrameList.cpp | 170 ++
 lldb/source/Target/StopInfo.cpp   |  55 ++
 lldb/source/Target/Thread.cpp |   8 +
 lldb/source/Target/ThreadPlanStepInRange.cpp  |  24 ++-
 .../source/Target/ThreadPlanStepOverRange.cpp |   2 +-
 .../inline-stepping/TestInlineStepping.py |  54 ++
 .../inline-stepping/calling.cpp   |  31 
 16 files changed, 462 insertions(+), 128 deletions(-)

diff --git a/lldb/include/lldb/Breakpoint/BreakpointLocation.h 
b/lldb/include/lldb/Breakpoint/BreakpointLocation.h
index cca00335bc3c67..f9c258daf137f7 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointLocation.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointLocation.h
@@ -11,10 +11,12 @@
 
 #include 
 #include 
+#include 
 
 #include "lldb/Breakpoint/BreakpointOptions.h"
 #include "lldb/Breakpoint/StoppointHitCounter.h"
 #include "lldb/Core/Address.h"
+#include "lldb/Symbol/LineEntry.h"
 #include "lldb/Utility/UserID.h"
 #include "lldb/lldb-private.h"
 
@@ -281,6 +283,18 @@ class BreakpointLocation
 
   /// Returns the breakpoint location ID.
   lldb::break_id_t GetID() const { return m_loc_id; }
+  
+  // Set the line entry that should be shown to users for this location.
+  // It is up to the caller to verify that this is a valid entry to show.
+  // The current use of this is to distinguish among line entries from a
+  // virtual inlined call stack that all share the same address.
+  void SetPreferredLineEntry(const LineEntry &line_entry) {
+m_preferred_line_entry = line_entry;
+  }
+  
+  const std::optional GetPreferredLineEntry() {
+return m_preferred_line_entry;
+  }
 
 protected:
   friend class BreakpointSite;
@@ -305,6 +319,16 @@ class BreakpointLocation
   /// It also takes care of decrementing the ignore counters.
   /// If it returns false we should continue, otherwise stop.
   bool IgnoreCountShouldStop();
+  
+  // If this location knows that the virtual stack frame it represents is
+  // not frame 0, return the suggested stack frame instead.  This will happen
+  // when the location's address contains a "virtual inlined call stack" and 
the
+  // breakpoint was set on a file & line that are not at the bottom of that
+  // stack.  For now we key off the "preferred line entry" - looking for that
+  // in the blocks that start with the stop PC.
+  // This version of the API doesn't take an "inlined" parameter because it
+  // only changes frames in the inline stack.
+  std::optional GetSuggestedStackFrameIndex();
 
 private:
   void SwapLocation(lldb::BreakpointLocationSP swap_from);
@@ -369,6 +393,13 @@ class BreakpointLocation
   lldb::break_id_t m_loc_id; ///< Breakpoint location ID.
   StoppointHitCounter m_hit_counter; ///< Number of times this breakpoint
  /// location has been hit.
+  std::optional m_preferred_line_entry; // If this exists, use it 
to print the stop
+// description rather than the LineEntry 
+// m_address resolves to directly.  Use 
this
+// for instance when the location was given
+// somewhere in the virtual inlined call
+// stack since the Address always resolves 
+// to the lowest entry in the stack.
 
   void SetShouldResolveIndirectFunctions(bool do_resolve) {
 m_should_resolve_indirect_functions = do_resolve;
diff --git a/lldb/include/lldb/Breakpoint/BreakpointSite.h 
b/lldb/include/lldb/Breakpoint/BreakpointSite.h
index 17b76d51c1ae53..30cb5a80b908e0 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointSite.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointSite.h
@@ -169,6 +169,11 @@ class BreakpointSite : public 
std::enable_shared_from_this,
   ///
   /// \see lldb::DescriptionLevel
   void GetDescription(Stream *s, lldb::DescriptionLevel level);
+  
+  // This runs through all the breakpoint locations owning this s

[Lldb-commits] [lldb] [lldb][docs] Fix "Developing LLDB" table of contents (PR #113166)

2024-10-21 Thread Med Ismail Bennani via lldb-commits

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

LGTM

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


[Lldb-commits] [lldb] 30a4028 - [lldb][NFC] Fix doxygen comment on top of GetMangledTypeName

2024-10-21 Thread Augusto Noronha via lldb-commits

Author: Augusto Noronha
Date: 2024-10-21T10:37:46-07:00
New Revision: 30a402833f50b14148c8b963f3ffaaeaeea5fd78

URL: 
https://github.com/llvm/llvm-project/commit/30a402833f50b14148c8b963f3ffaaeaeea5fd78
DIFF: 
https://github.com/llvm/llvm-project/commit/30a402833f50b14148c8b963f3ffaaeaeea5fd78.diff

LOG: [lldb][NFC] Fix doxygen comment on top of GetMangledTypeName

Added: 


Modified: 
lldb/include/lldb/Symbol/TypeSystem.h

Removed: 




diff  --git a/lldb/include/lldb/Symbol/TypeSystem.h 
b/lldb/include/lldb/Symbol/TypeSystem.h
index 416445a60bd017..b06bfa583bad6d 100644
--- a/lldb/include/lldb/Symbol/TypeSystem.h
+++ b/lldb/include/lldb/Symbol/TypeSystem.h
@@ -237,8 +237,8 @@ class TypeSystem : public PluginInterface,
 
   virtual ConstString GetDisplayTypeName(lldb::opaque_compiler_type_t type) = 
0;
 
-  // Defaults to GetTypeName(type).  Override if your language desires
-  // specialized behavior.
+  /// Defaults to GetTypeName(type).  Override if your language desires
+  /// specialized behavior.
   virtual ConstString GetMangledTypeName(lldb::opaque_compiler_type_t type);
 
   virtual uint32_t



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


[Lldb-commits] [lldb] [lldb] Log errors to the system log if they would otherwise get dropped (PR #111911)

2024-10-21 Thread Jonas Devlieghere via lldb-commits

JDevlieghere wrote:

Now that the system log is a Darwin-only concept and the review comments have 
been addressed, I assume nobody objects to merging this? 

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


[Lldb-commits] [lldb] Add the ability to break on call-site locations, improve inline stepping (PR #112939)

2024-10-21 Thread Greg Clayton via lldb-commits


@@ -87,6 +87,22 @@ void BreakpointSite::GetDescription(Stream *s, 
lldb::DescriptionLevel level) {
   m_constituents.GetDescription(s, level);
 }
 
+std::optional BreakpointSite::GetSuggestedStackFrameIndex() {
+
+  std::optional result;
+  std::lock_guard guard(m_constituents_mutex);
+  for (BreakpointLocationSP loc_sp : m_constituents.BreakpointLocations()) {
+std::optional this_result = 
loc_sp->GetSuggestedStackFrameIndex();
+if (this_result) {
+  if (!result)
+result = this_result;
+  else
+result = std::max(*this_result, *result);

clayborg wrote:

reverse the logic here?
```
  if (result)
result = std::max(*this_result, *result);
  else
result = this_result;
```

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


[Lldb-commits] [lldb] Add the ability to break on call-site locations, improve inline stepping (PR #112939)

2024-10-21 Thread Greg Clayton via lldb-commits


@@ -508,8 +508,20 @@ void BreakpointLocation::GetDescription(Stream *s,
 s->PutCString("re-exported target = ");
   else
 s->PutCString("where = ");
+
+  // If there's a preferred line entry for printing, use that.
+  bool show_function_info = true;
+  if (auto preferred = GetPreferredLineEntry()) {
+sc.line_entry = *preferred;
+// FIXME: We're going to get the function name wrong when the preferred
+// line entry is not the lowest one.  For now, just leave the function
+// out in this case, but we really should also figure out how to easily
+// fake the function name here.

clayborg wrote:

Would a solution that changed `GetPreferredLineEntry()` to be 
`GetPreferredSymbolContext()` where it would return a `SymbolContext` object 
where anything that is valid in the `SymbolContext` would end up overriding the 
actual symbol context in `sc`? We might want to add a new function like:
```
SymbolContext BreakpointLocation::CalculateSymbolContext()
```
That would calll `m_address.CalculateSymbolContext(&sc);` and then insert any 
preferred entries into that symbol context. That would allow anyone to get the 
right symbol context for a `BreakpointLocation` easily. Then this function 
would change or need to know anything about the preferred stuff.

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


[Lldb-commits] [lldb] Add the ability to break on call-site locations, improve inline stepping (PR #112939)

2024-10-21 Thread Greg Clayton via lldb-commits


@@ -71,7 +71,7 @@ int Declaration::Compare(const Declaration &a, const 
Declaration &b) {
 }
 
 bool Declaration::FileAndLineEqual(const Declaration &declaration) const {
-  int file_compare = FileSpec::Compare(this->m_file, declaration.m_file, true);
+  int file_compare = FileSpec::Compare(this->m_file, declaration.m_file, 
false);

clayborg wrote:

Why was this changed? 

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


[Lldb-commits] [lldb] Add the ability to break on call-site locations, improve inline stepping (PR #112939)

2024-10-21 Thread Greg Clayton via lldb-commits


@@ -87,6 +87,22 @@ void BreakpointSite::GetDescription(Stream *s, 
lldb::DescriptionLevel level) {
   m_constituents.GetDescription(s, level);
 }
 
+std::optional BreakpointSite::GetSuggestedStackFrameIndex() {
+
+  std::optional result;
+  std::lock_guard guard(m_constituents_mutex);
+  for (BreakpointLocationSP loc_sp : m_constituents.BreakpointLocations()) {
+std::optional this_result = 
loc_sp->GetSuggestedStackFrameIndex();

clayborg wrote:

rename `this_result` to `loc_frame_index`?

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


[Lldb-commits] [lldb] [lldb] Use Locale to convert between std::wstring and std::string (NFC) (PR #112582)

2024-10-21 Thread Pavel Labath via lldb-commits

labath wrote:

Actually (and, in retrospect, obviously) llvm already has 
[functions](https://github.com/llvm/llvm-project/blob/7dc2542ac24fcae89dfd179fa58c4ec4fb959e2b/llvm/include/llvm/Support/ConvertUTF.h#L227C6-L227C23)
 for wstring<->string conversions, so it would be best to use those.

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


[Lldb-commits] [lldb] [lldb] Add early CMake check for 'make' tool (PR #111531)

2024-10-21 Thread via lldb-commits
Stefan =?utf-8?q?Gränitz?= ,
Stefan =?utf-8?q?Gränitz?= ,
Stefan =?utf-8?q?Gränitz?= ,
Stefan =?utf-8?q?Gränitz?= ,
Stefan =?utf-8?q?Gränitz?= ,
Stefan =?utf-8?q?Gränitz?= 
Message-ID:
In-Reply-To: 


GkvJwa wrote:

In fact, for many developers on Windows, `make.exe` will not be in the 
environment PATH, which will cause cmake to fail to find and ultimately delay 
the build of the project error.
I personally think it is better to use `FATAL_ERROR` instead of `SEND_ERROR`. 
After all, it will cause cmake to continue executing for a short period of time 
and finally display

```
CMake Error at C:/llvm-project/lldb/test/API/CMakeLists.txt:60 (message):
  LLDB tests require 'make' tool.  Please pass via `LLDB_TEST_MAKE` (or
  otherwise disable tests with `LLDB_INCLUDE_TESTS=OFF`)


-- BugpointPasses ignored -- Loadable modules not supported on this platform.
-- Google Benchmark version: v0.0.0, normalized to 0.0.0
-- Looking for shm_open in rt
-- Looking for shm_open in rt - not found
-- Performing Test HAVE_CXX_FLAG_EHS_
-- Performing Test HAVE_CXX_FLAG_EHS_ - Success
-- Performing Test HAVE_CXX_FLAG_EHA_
-- Performing Test HAVE_CXX_FLAG_EHA_ - Success
-- Compiling and running to test HAVE_GNU_POSIX_REGEX
-- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
-- Compiling and running to test HAVE_POSIX_REGEX
-- Performing Test HAVE_POSIX_REGEX -- failed to compile
CMake Warning at C:/llvm-project/third-party/benchmark/CMakeLists.txt:319 
(message):
  Using std::regex with exceptions disabled is not fully supported


-- Compiling and running to test HAVE_STEADY_CLOCK
-- Performing Test HAVE_STEADY_CLOCK -- success
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Found Threads: TRUE
-- Compiling and running to test HAVE_PTHREAD_AFFINITY
-- Performing Test HAVE_PTHREAD_AFFINITY -- failed to compile
-- Configuring incomplete, errors occurred!
```

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


[Lldb-commits] [lldb] [lldb][docs] Fix "Developing LLDB" table of contents (PR #113166)

2024-10-21 Thread David Spickett via lldb-commits

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

I guess it sees each `# ...` as the start of a new document? Strange.

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


[Lldb-commits] [lldb] Add the ability to break on call-site locations, improve inline stepping (PR #112939)

2024-10-21 Thread via lldb-commits


@@ -312,6 +315,112 @@ void CompileUnit::ResolveSymbolContext(
 0, file_indexes, src_location_spec, &line_entry);
   }
 
+  // If we didn't manage to find a breakpoint that matched the line number
+  // requested, that might be because it is only an inline call site, and
+  // doesn't have a line entry in the line table.  Scan for that here.
+  //
+  // We are making the assumption that if there was an inlined function it will
+  // contribute at least 1 non-call-site entry to the line table.  That's handy
+  // because we don't move line breakpoints over function boundaries, so if we
+  // found a hit, and there were also a call site entry, it would have to be in
+  // the function containing the PC of the line table match.  That way we can
+  // limit the call site search to that function.
+  // We will miss functions that ONLY exist as a call site entry.
+
+  if (line_entry.IsValid() &&
+  (line_entry.line != line || line_entry.column != column_num) &&
+  resolve_scope & eSymbolContextLineEntry && check_inlines) {
+// We don't move lines over function boundaries, so the address in the
+// line entry will be the in function that contained the line that might
+// be a CallSite, and we can just iterate over that function to find any
+// inline records, and dig up their call sites.
+Address start_addr = line_entry.range.GetBaseAddress();
+Function *function = start_addr.CalculateSymbolContextFunction();
+
+Declaration sought_decl(file_spec, line, column_num);
+// We use this recursive function to descend the block structure looking
+// for a block that has this Declaration as in it's CallSite info.
+// This function recursively scans the sibling blocks of the incoming
+// block parameter.
+std::function examine_block =
+[&sought_decl, &sc_list, &src_location_spec, resolve_scope,
+ &examine_block](Block &block) -> void {
+  // Iterate over the sibling child blocks of the incoming block.
+  Block *sibling_block = block.GetFirstChild();
+  while (sibling_block) {
+// We only have to descend through the regular blocks, looking for
+// immediate inlines, since those are the only ones that will have this
+// callsite.
+const InlineFunctionInfo *inline_info =
+sibling_block->GetInlinedFunctionInfo();
+if (inline_info) {
+  // If this is the call-site we are looking for, record that:
+  // We need to be careful because the call site from the debug info
+  // will generally have a column, but the user might not have 
specified
+  // it.
+  Declaration found_decl = inline_info->GetCallSite();
+  uint32_t sought_column = sought_decl.GetColumn();
+  if (found_decl.FileAndLineEqual(sought_decl) &&
+  (sought_column == LLDB_INVALID_COLUMN_NUMBER ||
+   sought_column == found_decl.GetColumn())) {
+// If we found a call site, it belongs not in this inlined block,
+// but in the parent block that inlined it.
+Address parent_start_addr;
+if (sibling_block->GetParent()->GetStartAddress(

jimingham wrote:

Ditto.

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


[Lldb-commits] [lldb] [lldb][docs] Fix "Developing LLDB" table of contents (PR #113166)

2024-10-21 Thread Michael Buch via lldb-commits

https://github.com/Michael137 created 
https://github.com/llvm/llvm-project/pull/113166

Currently all the headings marked as `#` show up
as a top-level entry in the `Developing LLDB`
toctree. This patch marks these as `##` so only
`Adding Programming Language Support` is displayed
in the table of contents.

>From add8bbebccb41252d54689d59530d56cd68c664e Mon Sep 17 00:00:00 2001
From: Michael Buch 
Date: Mon, 21 Oct 2024 15:05:19 +0100
Subject: [PATCH] [lldb][docs] Fix "Developing LLDB" table of contents

Currently all the headings marked as `#` show up
as a top-level entry in the `Developing LLDB`
toctree. This patch marks these as `##` so only
`Adding Programming Language Support` shows up
in the table of contents.
---
 lldb/docs/resources/addinglanguagesupport.md | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lldb/docs/resources/addinglanguagesupport.md 
b/lldb/docs/resources/addinglanguagesupport.md
index 28789048643d77..524d0b5f2940aa 100644
--- a/lldb/docs/resources/addinglanguagesupport.md
+++ b/lldb/docs/resources/addinglanguagesupport.md
@@ -49,21 +49,21 @@ clearer that evaluation with the static `Module`-returned 
`TypeSystem` instances
 make no sense, and have them error out on those calls. But either approach is
 fine.
 
-# Creating Types
+## Creating Types
 
 Your `TypeSystem` will need an approach for creating types based on a set of
 `Module`s. If your type info is going to come from DWARF info, you will want to
 subclass 
[DWARFASTParser](https://github.com/llvm/llvm-project/blob/main/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h).
 
 
-# Add Expression Evaluation Support
+## Add Expression Evaluation Support
 
 Expression Evaluation support is enabled by implementing the relevant methods 
on
 a `TypeSystem`-derived class. Search for `Expression` in the
 [TypeSystem 
header](https://github.com/llvm/llvm-project/blob/main/lldb/include/lldb/Symbol/TypeSystem.h)
 to find the methods to implement.
 
-# Type Completion
+## Type Completion
 
 There are three levels of type completion, each requiring more type 
information:
 1. Pointer size: When you have a forward decl or a reference, and that's all 
you
@@ -76,7 +76,7 @@ There are three levels of type completion, each requiring 
more type information:
 Ensure you never complete more of a type than is needed for a given situation.
 This will keep your type system from doing more work than necessary.
 
-# Language and LanguageRuntime Plugins
+## Language and LanguageRuntime Plugins
 
 If you followed the steps outlined above, you already have taught LLDB a great
 deal about your language. If your language's runtime model and fundamental data
@@ -92,4 +92,4 @@ These tasks are covered by two plugins:
   information (for example dynamic type resolution).
 * a `Language` plugin, which provides LLDB with a static view of your language;
   questions that are statically knowable and do not require a process are
-  answered by this plugin (for example data formatters).
\ No newline at end of file
+  answered by this plugin (for example data formatters).

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


[Lldb-commits] [lldb] [lldb][docs] Fix "Developing LLDB" table of contents (PR #113166)

2024-10-21 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Michael Buch (Michael137)


Changes

Currently all the headings marked as `#` show up
as a top-level entry in the `Developing LLDB`
toctree. This patch marks these as `##` so only
`Adding Programming Language Support` is displayed
in the table of contents.

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


1 Files Affected:

- (modified) lldb/docs/resources/addinglanguagesupport.md (+5-5) 


``diff
diff --git a/lldb/docs/resources/addinglanguagesupport.md 
b/lldb/docs/resources/addinglanguagesupport.md
index 28789048643d77..524d0b5f2940aa 100644
--- a/lldb/docs/resources/addinglanguagesupport.md
+++ b/lldb/docs/resources/addinglanguagesupport.md
@@ -49,21 +49,21 @@ clearer that evaluation with the static `Module`-returned 
`TypeSystem` instances
 make no sense, and have them error out on those calls. But either approach is
 fine.
 
-# Creating Types
+## Creating Types
 
 Your `TypeSystem` will need an approach for creating types based on a set of
 `Module`s. If your type info is going to come from DWARF info, you will want to
 subclass 
[DWARFASTParser](https://github.com/llvm/llvm-project/blob/main/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h).
 
 
-# Add Expression Evaluation Support
+## Add Expression Evaluation Support
 
 Expression Evaluation support is enabled by implementing the relevant methods 
on
 a `TypeSystem`-derived class. Search for `Expression` in the
 [TypeSystem 
header](https://github.com/llvm/llvm-project/blob/main/lldb/include/lldb/Symbol/TypeSystem.h)
 to find the methods to implement.
 
-# Type Completion
+## Type Completion
 
 There are three levels of type completion, each requiring more type 
information:
 1. Pointer size: When you have a forward decl or a reference, and that's all 
you
@@ -76,7 +76,7 @@ There are three levels of type completion, each requiring 
more type information:
 Ensure you never complete more of a type than is needed for a given situation.
 This will keep your type system from doing more work than necessary.
 
-# Language and LanguageRuntime Plugins
+## Language and LanguageRuntime Plugins
 
 If you followed the steps outlined above, you already have taught LLDB a great
 deal about your language. If your language's runtime model and fundamental data
@@ -92,4 +92,4 @@ These tasks are covered by two plugins:
   information (for example dynamic type resolution).
 * a `Language` plugin, which provides LLDB with a static view of your language;
   questions that are statically knowable and do not require a process are
-  answered by this plugin (for example data formatters).
\ No newline at end of file
+  answered by this plugin (for example data formatters).

``




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


[Lldb-commits] [lldb] [lldb] Implement basic support for reverse-continue (PR #112079)

2024-10-21 Thread via lldb-commits

jimingham wrote:



> On Oct 19, 2024, at 8:29 PM, Med Ismail Bennani ***@***.***> wrote:
> 
> 
> @rocallahan  does rr work on Mac?
> 
> No, it doesn't. It does work on Linux AAarch64 though.
> 
> This didn't work because we also build lldb-server on macOS.
> 
> Hmm, so lldb-server is built on macOS but we're not supposed to use it?
> 
lldb-server on Darwin works in platform mode, but not for process control.  We 
already had debugserver working which had a very different looking codebase, 
and we never merged the process control parts of debugserver into lldb-server.

Jim



> Yeah I was also surprised to see that but I guess it doesn't hurt. I don't 
> think we can use it because it doesn't have any support for macOS which also 
> explains the crash. Honestly I think it would be fine if you skipped that 
> test on Darwin platforms (by adding an @skipDarwin decorator at the beginning 
> of each test_* methods). @JDevlieghere  
> @jimingham  do you have any objection to that ?
> 
> —
> Reply to this email directly, view it on GitHub 
> , 
> or unsubscribe 
> .
> You are receiving this because you were mentioned.
> 



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


[Lldb-commits] [clang] [clang-tools-extra] [flang] [lldb] [llvm] [openmp] [pstl] Finally formalise our defacto line-ending policy (PR #86318)

2024-10-21 Thread via lldb-commits

zmodem wrote:

Thanks for reverting!

I must have missed this PR originally. I oppose letting Git change any line 
endings. It always ends like this.

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


[Lldb-commits] [lldb] 40ea92c - [lldb] Update ScriptInterpreterTests for CommandReturnObject API change

2024-10-21 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2024-10-21T11:37:26-07:00
New Revision: 40ea92c859234d536553cf26650e89d6e52071c6

URL: 
https://github.com/llvm/llvm-project/commit/40ea92c859234d536553cf26650e89d6e52071c6
DIFF: 
https://github.com/llvm/llvm-project/commit/40ea92c859234d536553cf26650e89d6e52071c6.diff

LOG: [lldb] Update ScriptInterpreterTests for CommandReturnObject API change

Added: 


Modified: 
lldb/unittests/ScriptInterpreter/Lua/ScriptInterpreterTests.cpp

Removed: 




diff  --git a/lldb/unittests/ScriptInterpreter/Lua/ScriptInterpreterTests.cpp 
b/lldb/unittests/ScriptInterpreter/Lua/ScriptInterpreterTests.cpp
index 2693bef3f5fbd2..214de14f73ff9e 100644
--- a/lldb/unittests/ScriptInterpreter/Lua/ScriptInterpreterTests.cpp
+++ b/lldb/unittests/ScriptInterpreter/Lua/ScriptInterpreterTests.cpp
@@ -48,6 +48,6 @@ TEST_F(ScriptInterpreterTest, ExecuteOneLine) {
   CommandReturnObject result(/*colors*/ false);
   EXPECT_TRUE(script_interpreter.ExecuteOneLine("foo = 1", &result));
   EXPECT_FALSE(script_interpreter.ExecuteOneLine("nil = foo", &result));
-  EXPECT_TRUE(result.GetErrorData().starts_with(
-  "error: lua failed attempting to evaluate 'nil = foo'"));
+  EXPECT_EQ(result.GetErrorString().find(
+  "error: lua failed attempting to evaluate 'nil = foo'"), 0 );
 }



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


[Lldb-commits] [lldb] Add the ability to break on call-site locations, improve inline stepping (PR #112939)

2024-10-21 Thread via lldb-commits


@@ -312,6 +315,112 @@ void CompileUnit::ResolveSymbolContext(
 0, file_indexes, src_location_spec, &line_entry);
   }
 
+  // If we didn't manage to find a breakpoint that matched the line number
+  // requested, that might be because it is only an inline call site, and
+  // doesn't have a line entry in the line table.  Scan for that here.
+  //
+  // We are making the assumption that if there was an inlined function it will
+  // contribute at least 1 non-call-site entry to the line table.  That's handy
+  // because we don't move line breakpoints over function boundaries, so if we
+  // found a hit, and there were also a call site entry, it would have to be in
+  // the function containing the PC of the line table match.  That way we can
+  // limit the call site search to that function.
+  // We will miss functions that ONLY exist as a call site entry.
+
+  if (line_entry.IsValid() &&
+  (line_entry.line != line || line_entry.column != column_num) &&
+  resolve_scope & eSymbolContextLineEntry && check_inlines) {
+// We don't move lines over function boundaries, so the address in the
+// line entry will be the in function that contained the line that might
+// be a CallSite, and we can just iterate over that function to find any
+// inline records, and dig up their call sites.
+Address start_addr = line_entry.range.GetBaseAddress();
+Function *function = start_addr.CalculateSymbolContextFunction();
+
+Declaration sought_decl(file_spec, line, column_num);
+// We use this recursive function to descend the block structure looking
+// for a block that has this Declaration as in it's CallSite info.
+// This function recursively scans the sibling blocks of the incoming
+// block parameter.
+std::function examine_block =
+[&sought_decl, &sc_list, &src_location_spec, resolve_scope,
+ &examine_block](Block &block) -> void {
+  // Iterate over the sibling child blocks of the incoming block.
+  Block *sibling_block = block.GetFirstChild();
+  while (sibling_block) {
+// We only have to descend through the regular blocks, looking for
+// immediate inlines, since those are the only ones that will have this
+// callsite.
+const InlineFunctionInfo *inline_info =
+sibling_block->GetInlinedFunctionInfo();
+if (inline_info) {
+  // If this is the call-site we are looking for, record that:
+  // We need to be careful because the call site from the debug info
+  // will generally have a column, but the user might not have 
specified
+  // it.
+  Declaration found_decl = inline_info->GetCallSite();
+  uint32_t sought_column = sought_decl.GetColumn();
+  if (found_decl.FileAndLineEqual(sought_decl) &&

jimingham wrote:

These can't continue either, they'd need a goto to get the sibling iteration & 
child recursion at the end of the while.

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


[Lldb-commits] [lldb] Add the ability to break on call-site locations, improve inline stepping (PR #112939)

2024-10-21 Thread via lldb-commits


@@ -87,6 +87,22 @@ void BreakpointSite::GetDescription(Stream *s, 
lldb::DescriptionLevel level) {
   m_constituents.GetDescription(s, level);
 }
 
+std::optional BreakpointSite::GetSuggestedStackFrameIndex() {
+
+  std::optional result;
+  std::lock_guard guard(m_constituents_mutex);
+  for (BreakpointLocationSP loc_sp : m_constituents.BreakpointLocations()) {
+std::optional this_result = 
loc_sp->GetSuggestedStackFrameIndex();

jimingham wrote:

Sure.

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


[Lldb-commits] [lldb] Add the ability to break on call-site locations, improve inline stepping (PR #112939)

2024-10-21 Thread via lldb-commits


@@ -87,6 +87,22 @@ void BreakpointSite::GetDescription(Stream *s, 
lldb::DescriptionLevel level) {
   m_constituents.GetDescription(s, level);
 }
 
+std::optional BreakpointSite::GetSuggestedStackFrameIndex() {
+
+  std::optional result;
+  std::lock_guard guard(m_constituents_mutex);
+  for (BreakpointLocationSP loc_sp : m_constituents.BreakpointLocations()) {
+std::optional this_result = 
loc_sp->GetSuggestedStackFrameIndex();
+if (this_result) {
+  if (!result)
+result = this_result;
+  else
+result = std::max(*this_result, *result);

jimingham wrote:

Sure.

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


[Lldb-commits] [lldb] [lldb] Avoid repeated hash lookups (NFC) (PR #113248)

2024-10-21 Thread Kazu Hirata via lldb-commits

https://github.com/kazutakahirata created 
https://github.com/llvm/llvm-project/pull/113248

None

>From 89e3f1ca679e8e821205d1c0e729ea575cac5031 Mon Sep 17 00:00:00 2001
From: Kazu Hirata 
Date: Mon, 21 Oct 2024 07:04:48 -0700
Subject: [PATCH] [lldb] Avoid repeated hash lookups (NFC)

---
 .../FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp   | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp
 
b/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp
index 7c678faaae7fd5..8391467c375f42 100644
--- 
a/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp
+++ 
b/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp
@@ -552,9 +552,9 @@ bool DynamicLoaderFreeBSDKernel::ParseKmods(Address 
linker_files_head_addr) {
   m_process->GetTarget().ModulesDidUnload(remove_modules, false);
 
   for (KModImageInfo &image_info : linker_files_list) {
-if (m_kld_name_to_uuid.find(image_info.GetName()) !=
-m_kld_name_to_uuid.end())
-  image_info.SetUUID(m_kld_name_to_uuid[image_info.GetName()]);
+auto it = m_kld_name_to_uuid.find(image_info.GetName());
+if (it != m_kld_name_to_uuid.end())
+  image_info.SetUUID(it->second);
 bool failed_to_load = false;
 if (!image_info.LoadImageUsingMemoryModule(m_process)) {
   image_info.LoadImageUsingFileAddress(m_process);

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


[Lldb-commits] [lldb] [lldb] Avoid repeated hash lookups (NFC) (PR #113248)

2024-10-21 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Kazu Hirata (kazutakahirata)


Changes



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


1 Files Affected:

- (modified) 
lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp 
(+3-3) 


``diff
diff --git 
a/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp
 
b/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp
index 7c678faaae7fd5..8391467c375f42 100644
--- 
a/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp
+++ 
b/lldb/source/Plugins/DynamicLoader/FreeBSD-Kernel/DynamicLoaderFreeBSDKernel.cpp
@@ -552,9 +552,9 @@ bool DynamicLoaderFreeBSDKernel::ParseKmods(Address 
linker_files_head_addr) {
   m_process->GetTarget().ModulesDidUnload(remove_modules, false);
 
   for (KModImageInfo &image_info : linker_files_list) {
-if (m_kld_name_to_uuid.find(image_info.GetName()) !=
-m_kld_name_to_uuid.end())
-  image_info.SetUUID(m_kld_name_to_uuid[image_info.GetName()]);
+auto it = m_kld_name_to_uuid.find(image_info.GetName());
+if (it != m_kld_name_to_uuid.end())
+  image_info.SetUUID(it->second);
 bool failed_to_load = false;
 if (!image_info.LoadImageUsingMemoryModule(m_process)) {
   image_info.LoadImageUsingFileAddress(m_process);

``




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


[Lldb-commits] [lldb] [lldb][test] Fix TestUseSourceCache for readonly source trees (PR #113251)

2024-10-21 Thread Jordan Rupprecht via lldb-commits

https://github.com/rupprecht created 
https://github.com/llvm/llvm-project/pull/113251

TestUseSourceCache attempts to write to a build artifact copied from the source 
tree, and asserts the write succeeded. If the source tree is read only, the 
copy will also be read only, causing it to fail. When producing the build 
artifact, ensure that it is writable.

I use `chmod` as a build step to do this, but I believe that is linuxish-only 
thing, so I excluded this extra command for Windows.

>From 0d27f7643007805bc2b1f2965edbd71d6563dae3 Mon Sep 17 00:00:00 2001
From: Jordan Rupprecht 
Date: Mon, 21 Oct 2024 19:29:50 -0700
Subject: [PATCH] [lldb][test] Fix TestUseSourceCache for readonly source trees

TestUseSourceCache attempts to write to a build artifact copied from the source 
tree, and asserts the write succeeded. If the source tree is read only, the 
copy will also be read only, causing it to fail. When producing the build 
artifact, ensure that it is writable.

I use `chmod` as a build step to do this, but I believe that is linuxish-only 
thing, so I excluded this extra command for Windows.
---
 lldb/test/API/commands/settings/use_source_cache/Makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lldb/test/API/commands/settings/use_source_cache/Makefile 
b/lldb/test/API/commands/settings/use_source_cache/Makefile
index 791cb7d868d87e..0090acf5591daa 100644
--- a/lldb/test/API/commands/settings/use_source_cache/Makefile
+++ b/lldb/test/API/commands/settings/use_source_cache/Makefile
@@ -6,3 +6,6 @@ include Makefile.rules
 # Copy file into the build folder to enable the test to modify it.
 main-copy.cpp: main.cpp
cp -f $< $@
+ifneq "$(OS)" "Windows_NT"  # chmod is not available on Windows
+   chmod u+w $@
+endif

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


[Lldb-commits] [lldb] [lldb][test] Fix TestUseSourceCache for readonly source trees (PR #113251)

2024-10-21 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jordan Rupprecht (rupprecht)


Changes

TestUseSourceCache attempts to write to a build artifact copied from the source 
tree, and asserts the write succeeded. If the source tree is read only, the 
copy will also be read only, causing it to fail. When producing the build 
artifact, ensure that it is writable.

I use `chmod` as a build step to do this, but I believe that is linuxish-only 
thing, so I excluded this extra command for Windows.

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


1 Files Affected:

- (modified) lldb/test/API/commands/settings/use_source_cache/Makefile (+3) 


``diff
diff --git a/lldb/test/API/commands/settings/use_source_cache/Makefile 
b/lldb/test/API/commands/settings/use_source_cache/Makefile
index 791cb7d868d87e..0090acf5591daa 100644
--- a/lldb/test/API/commands/settings/use_source_cache/Makefile
+++ b/lldb/test/API/commands/settings/use_source_cache/Makefile
@@ -6,3 +6,6 @@ include Makefile.rules
 # Copy file into the build folder to enable the test to modify it.
 main-copy.cpp: main.cpp
cp -f $< $@
+ifneq "$(OS)" "Windows_NT"  # chmod is not available on Windows
+   chmod u+w $@
+endif

``




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


[Lldb-commits] [lldb] Add the ability to break on call-site locations, improve inline stepping (PR #112939)

2024-10-21 Thread via lldb-commits

https://github.com/jimingham updated 
https://github.com/llvm/llvm-project/pull/112939

>From 9c6705b21df14dc911665e1082c9b31ce00d7e7c Mon Sep 17 00:00:00 2001
From: Jim Ingham 
Date: Thu, 3 Oct 2024 18:24:46 -0700
Subject: [PATCH 1/8] Add the ability to break on call-site locations, report
 the correct position in the virtual inlined call stack when they are hit, and
 step through the inlined stack from there.

---
 .../lldb/Breakpoint/BreakpointLocation.h  |  31 
 lldb/include/lldb/Breakpoint/BreakpointSite.h |   5 +
 lldb/include/lldb/Target/StopInfo.h   |  11 ++
 .../lldb/Target/ThreadPlanStepInRange.h   |   4 +-
 lldb/source/Breakpoint/BreakpointLocation.cpp |  61 ++-
 lldb/source/Breakpoint/BreakpointResolver.cpp |  12 ++
 lldb/source/Breakpoint/BreakpointSite.cpp |  16 ++
 lldb/source/Core/Declaration.cpp  |   2 +-
 lldb/source/Symbol/CompileUnit.cpp| 104 ++-
 lldb/source/Target/StackFrameList.cpp | 170 ++
 lldb/source/Target/StopInfo.cpp   |  55 ++
 lldb/source/Target/Thread.cpp |   8 +
 lldb/source/Target/ThreadPlanStepInRange.cpp  |  24 ++-
 .../source/Target/ThreadPlanStepOverRange.cpp |   2 +-
 .../inline-stepping/TestInlineStepping.py |  54 ++
 .../inline-stepping/calling.cpp   |  31 
 16 files changed, 462 insertions(+), 128 deletions(-)

diff --git a/lldb/include/lldb/Breakpoint/BreakpointLocation.h 
b/lldb/include/lldb/Breakpoint/BreakpointLocation.h
index cca00335bc3c67..f9c258daf137f7 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointLocation.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointLocation.h
@@ -11,10 +11,12 @@
 
 #include 
 #include 
+#include 
 
 #include "lldb/Breakpoint/BreakpointOptions.h"
 #include "lldb/Breakpoint/StoppointHitCounter.h"
 #include "lldb/Core/Address.h"
+#include "lldb/Symbol/LineEntry.h"
 #include "lldb/Utility/UserID.h"
 #include "lldb/lldb-private.h"
 
@@ -281,6 +283,18 @@ class BreakpointLocation
 
   /// Returns the breakpoint location ID.
   lldb::break_id_t GetID() const { return m_loc_id; }
+  
+  // Set the line entry that should be shown to users for this location.
+  // It is up to the caller to verify that this is a valid entry to show.
+  // The current use of this is to distinguish among line entries from a
+  // virtual inlined call stack that all share the same address.
+  void SetPreferredLineEntry(const LineEntry &line_entry) {
+m_preferred_line_entry = line_entry;
+  }
+  
+  const std::optional GetPreferredLineEntry() {
+return m_preferred_line_entry;
+  }
 
 protected:
   friend class BreakpointSite;
@@ -305,6 +319,16 @@ class BreakpointLocation
   /// It also takes care of decrementing the ignore counters.
   /// If it returns false we should continue, otherwise stop.
   bool IgnoreCountShouldStop();
+  
+  // If this location knows that the virtual stack frame it represents is
+  // not frame 0, return the suggested stack frame instead.  This will happen
+  // when the location's address contains a "virtual inlined call stack" and 
the
+  // breakpoint was set on a file & line that are not at the bottom of that
+  // stack.  For now we key off the "preferred line entry" - looking for that
+  // in the blocks that start with the stop PC.
+  // This version of the API doesn't take an "inlined" parameter because it
+  // only changes frames in the inline stack.
+  std::optional GetSuggestedStackFrameIndex();
 
 private:
   void SwapLocation(lldb::BreakpointLocationSP swap_from);
@@ -369,6 +393,13 @@ class BreakpointLocation
   lldb::break_id_t m_loc_id; ///< Breakpoint location ID.
   StoppointHitCounter m_hit_counter; ///< Number of times this breakpoint
  /// location has been hit.
+  std::optional m_preferred_line_entry; // If this exists, use it 
to print the stop
+// description rather than the LineEntry 
+// m_address resolves to directly.  Use 
this
+// for instance when the location was given
+// somewhere in the virtual inlined call
+// stack since the Address always resolves 
+// to the lowest entry in the stack.
 
   void SetShouldResolveIndirectFunctions(bool do_resolve) {
 m_should_resolve_indirect_functions = do_resolve;
diff --git a/lldb/include/lldb/Breakpoint/BreakpointSite.h 
b/lldb/include/lldb/Breakpoint/BreakpointSite.h
index 17b76d51c1ae53..30cb5a80b908e0 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointSite.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointSite.h
@@ -169,6 +169,11 @@ class BreakpointSite : public 
std::enable_shared_from_this,
   ///
   /// \see lldb::DescriptionLevel
   void GetDescription(Stream *s, lldb::DescriptionLevel level);
+  
+  // This runs through all the breakpoint locations owning this s

[Lldb-commits] [lldb] Add the ability to break on call-site locations, improve inline stepping (PR #112939)

2024-10-21 Thread via lldb-commits


@@ -656,6 +671,49 @@ void 
BreakpointLocation::SendBreakpointLocationChangedEvent(
   }
 }
 
+std::optional BreakpointLocation::GetSuggestedStackFrameIndex() {
+  if (!GetPreferredLineEntry())
+return {};
+  LineEntry preferred = *GetPreferredLineEntry();

jimingham wrote:

Sure.

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


[Lldb-commits] [lldb] Add the ability to break on call-site locations, improve inline stepping (PR #112939)

2024-10-21 Thread via lldb-commits

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


[Lldb-commits] [lldb] Add the ability to break on call-site locations, improve inline stepping (PR #112939)

2024-10-21 Thread via lldb-commits

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


[Lldb-commits] [lldb] Add the ability to break on call-site locations, improve inline stepping (PR #112939)

2024-10-21 Thread via lldb-commits


@@ -537,7 +549,10 @@ void BreakpointLocation::GetDescription(Stream *s,
 if (sc.line_entry.line > 0) {
   s->EOL();
   s->Indent("location = ");
-  sc.line_entry.DumpStopContext(s, true);
+  if (GetPreferredLineEntry())
+GetPreferredLineEntry()->DumpStopContext(s, true);

jimingham wrote:

Sure

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


[Lldb-commits] [lldb] Add the ability to break on call-site locations, improve inline stepping (PR #112939)

2024-10-21 Thread via lldb-commits


@@ -71,7 +71,7 @@ int Declaration::Compare(const Declaration &a, const 
Declaration &b) {
 }
 
 bool Declaration::FileAndLineEqual(const Declaration &declaration) const {
-  int file_compare = FileSpec::Compare(this->m_file, declaration.m_file, true);
+  int file_compare = FileSpec::Compare(this->m_file, declaration.m_file, 
false);

jimingham wrote:

I was using it in a context where the source location being compared came from 
outside - and so potentially had no directory specified since we don't ever 
require users to type full paths.  So false was a necessary option for that use.

The only other use was pulling FileSpec's from debug info, so both sides were 
going to have full paths in them.  Passing full as false doesn't mean ignore 
directories, it just means treat empty directories as `.*`, so true and false 
were equivalent in that case.

But if this bugs you, I'll just add a `full` parameter to 
Declaration::FileAndLineEqual and pipe it through appropriately.

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


[Lldb-commits] [lldb] Add the ability to break on call-site locations, improve inline stepping (PR #112939)

2024-10-21 Thread via lldb-commits

https://github.com/jimingham updated 
https://github.com/llvm/llvm-project/pull/112939

>From 9c6705b21df14dc911665e1082c9b31ce00d7e7c Mon Sep 17 00:00:00 2001
From: Jim Ingham 
Date: Thu, 3 Oct 2024 18:24:46 -0700
Subject: [PATCH 1/9] Add the ability to break on call-site locations, report
 the correct position in the virtual inlined call stack when they are hit, and
 step through the inlined stack from there.

---
 .../lldb/Breakpoint/BreakpointLocation.h  |  31 
 lldb/include/lldb/Breakpoint/BreakpointSite.h |   5 +
 lldb/include/lldb/Target/StopInfo.h   |  11 ++
 .../lldb/Target/ThreadPlanStepInRange.h   |   4 +-
 lldb/source/Breakpoint/BreakpointLocation.cpp |  61 ++-
 lldb/source/Breakpoint/BreakpointResolver.cpp |  12 ++
 lldb/source/Breakpoint/BreakpointSite.cpp |  16 ++
 lldb/source/Core/Declaration.cpp  |   2 +-
 lldb/source/Symbol/CompileUnit.cpp| 104 ++-
 lldb/source/Target/StackFrameList.cpp | 170 ++
 lldb/source/Target/StopInfo.cpp   |  55 ++
 lldb/source/Target/Thread.cpp |   8 +
 lldb/source/Target/ThreadPlanStepInRange.cpp  |  24 ++-
 .../source/Target/ThreadPlanStepOverRange.cpp |   2 +-
 .../inline-stepping/TestInlineStepping.py |  54 ++
 .../inline-stepping/calling.cpp   |  31 
 16 files changed, 462 insertions(+), 128 deletions(-)

diff --git a/lldb/include/lldb/Breakpoint/BreakpointLocation.h 
b/lldb/include/lldb/Breakpoint/BreakpointLocation.h
index cca00335bc3c67..f9c258daf137f7 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointLocation.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointLocation.h
@@ -11,10 +11,12 @@
 
 #include 
 #include 
+#include 
 
 #include "lldb/Breakpoint/BreakpointOptions.h"
 #include "lldb/Breakpoint/StoppointHitCounter.h"
 #include "lldb/Core/Address.h"
+#include "lldb/Symbol/LineEntry.h"
 #include "lldb/Utility/UserID.h"
 #include "lldb/lldb-private.h"
 
@@ -281,6 +283,18 @@ class BreakpointLocation
 
   /// Returns the breakpoint location ID.
   lldb::break_id_t GetID() const { return m_loc_id; }
+  
+  // Set the line entry that should be shown to users for this location.
+  // It is up to the caller to verify that this is a valid entry to show.
+  // The current use of this is to distinguish among line entries from a
+  // virtual inlined call stack that all share the same address.
+  void SetPreferredLineEntry(const LineEntry &line_entry) {
+m_preferred_line_entry = line_entry;
+  }
+  
+  const std::optional GetPreferredLineEntry() {
+return m_preferred_line_entry;
+  }
 
 protected:
   friend class BreakpointSite;
@@ -305,6 +319,16 @@ class BreakpointLocation
   /// It also takes care of decrementing the ignore counters.
   /// If it returns false we should continue, otherwise stop.
   bool IgnoreCountShouldStop();
+  
+  // If this location knows that the virtual stack frame it represents is
+  // not frame 0, return the suggested stack frame instead.  This will happen
+  // when the location's address contains a "virtual inlined call stack" and 
the
+  // breakpoint was set on a file & line that are not at the bottom of that
+  // stack.  For now we key off the "preferred line entry" - looking for that
+  // in the blocks that start with the stop PC.
+  // This version of the API doesn't take an "inlined" parameter because it
+  // only changes frames in the inline stack.
+  std::optional GetSuggestedStackFrameIndex();
 
 private:
   void SwapLocation(lldb::BreakpointLocationSP swap_from);
@@ -369,6 +393,13 @@ class BreakpointLocation
   lldb::break_id_t m_loc_id; ///< Breakpoint location ID.
   StoppointHitCounter m_hit_counter; ///< Number of times this breakpoint
  /// location has been hit.
+  std::optional m_preferred_line_entry; // If this exists, use it 
to print the stop
+// description rather than the LineEntry 
+// m_address resolves to directly.  Use 
this
+// for instance when the location was given
+// somewhere in the virtual inlined call
+// stack since the Address always resolves 
+// to the lowest entry in the stack.
 
   void SetShouldResolveIndirectFunctions(bool do_resolve) {
 m_should_resolve_indirect_functions = do_resolve;
diff --git a/lldb/include/lldb/Breakpoint/BreakpointSite.h 
b/lldb/include/lldb/Breakpoint/BreakpointSite.h
index 17b76d51c1ae53..30cb5a80b908e0 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointSite.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointSite.h
@@ -169,6 +169,11 @@ class BreakpointSite : public 
std::enable_shared_from_this,
   ///
   /// \see lldb::DescriptionLevel
   void GetDescription(Stream *s, lldb::DescriptionLevel level);
+  
+  // This runs through all the breakpoint locations owning this s

[Lldb-commits] [lldb] [lldb][test] Fix TestUseSourceCache for readonly source trees (PR #113251)

2024-10-21 Thread Jordan Rupprecht via lldb-commits

rupprecht wrote:

A more platform-agnostic way to do this would be to do it from Python:

```py
src = self.getBuildArtifact("main-copy.cpp")
statinfo = os.stat(src)
os.chmod(src, statinfo.st_mode | stat.S_IWUSR)
```

However, I don't understand the test case well enough to say if this would make 
it less representative. Would that fix be preferred?

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


[Lldb-commits] [lldb] Add the ability to break on call-site locations, improve inline stepping (PR #112939)

2024-10-21 Thread via lldb-commits


@@ -71,7 +71,7 @@ int Declaration::Compare(const Declaration &a, const 
Declaration &b) {
 }
 
 bool Declaration::FileAndLineEqual(const Declaration &declaration) const {
-  int file_compare = FileSpec::Compare(this->m_file, declaration.m_file, true);
+  int file_compare = FileSpec::Compare(this->m_file, declaration.m_file, 
false);

jimingham wrote:

Better to do it on the up-and-up.  I added a full parameter and set it in the 
two places this function is used.

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


[Lldb-commits] [lldb] [lldb][test] Fix TestUseSourceCache for readonly source trees (PR #113251)

2024-10-21 Thread Igor Kudrin via lldb-commits

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


[Lldb-commits] [lldb] [lldb][test] Fix TestUseSourceCache for readonly source trees (PR #113251)

2024-10-21 Thread Igor Kudrin via lldb-commits


@@ -6,3 +6,6 @@ include Makefile.rules
 # Copy file into the build folder to enable the test to modify it.
 main-copy.cpp: main.cpp
cp -f $< $@
+ifneq "$(OS)" "Windows_NT"  # chmod is not available on Windows

igorkudrin wrote:

If I understand correctly, we rely on some Unix-like tools on Windows anyway; 
otherwise, `cp` would not be available. Such toolsets, e.g., MSYS2, provide 
`chmod`, so you can drop the conditions.

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


[Lldb-commits] [lldb] [lldb] Fix a crash when two diagnostics are on the same column or in … (PR #112451)

2024-10-21 Thread Adrian Prantl via lldb-commits


@@ -98,10 +94,31 @@ void RenderDiagnosticDetails(Stream &stream,
   continue;
 }
 
-auto &loc = *detail.source_location;
 remaining_details.push_back(detail);
+  }
+
+  // Sort the diagnostics.
+  auto sort = [](auto &ds) {
+llvm::sort(ds.begin(), ds.end(), [](auto &d1, auto &d2) {
+  auto l1 = 
d1.source_location.value_or(DiagnosticDetail::SourceLocation{});
+  auto l2 = 
d2.source_location.value_or(DiagnosticDetail::SourceLocation{});
+  return std::pair(l1.line, l2.column) < std::pair(l1.line, l2.column);

adrian-prantl wrote:

Thanks!

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


[Lldb-commits] [lldb] [lldb] Rename CommandReturnObject::Get.*Data -> Get.*String (PR #112062)

2024-10-21 Thread Adrian Prantl via lldb-commits

adrian-prantl wrote:

@JDevlieghere fixed this in 40ea92c859234d536553cf26650e89d6e52071c6

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


[Lldb-commits] [lldb] [lldb] Use Locale to convert between std::wstring and std::string (NFC) (PR #112582)

2024-10-21 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere updated 
https://github.com/llvm/llvm-project/pull/112582

>From de19f43fbee9aff2a99106a23b7f264012ab5485 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Mon, 21 Oct 2024 13:40:02 -0700
Subject: [PATCH] [lldb] Use LLVM's helper for Unicode conversion (NFC)

The codecvt header has been deprecated in C++17. Use LLVM's unicode
helpers to convert between UTF-8 and UTF-16.
---
 lldb/include/lldb/Host/Editline.h| 25 ---
 lldb/source/Host/common/Editline.cpp | 48 
 2 files changed, 28 insertions(+), 45 deletions(-)

diff --git a/lldb/include/lldb/Host/Editline.h 
b/lldb/include/lldb/Host/Editline.h
index a02f90891599ad..57e2c831e3499d 100644
--- a/lldb/include/lldb/Host/Editline.h
+++ b/lldb/include/lldb/Host/Editline.h
@@ -30,9 +30,6 @@
 
 #include "lldb/Host/Config.h"
 
-#if LLDB_EDITLINE_USE_WCHAR
-#include 
-#endif
 #include 
 #include 
 #include 
@@ -57,23 +54,6 @@
 
 #include "llvm/ADT/FunctionExtras.h"
 
-#if defined(__clang__) && defined(__has_warning)
-#if __has_warning("-Wdeprecated-declarations")
-#define LLDB_DEPRECATED_WARNING_DISABLE
\
-  _Pragma("clang diagnostic push") 
\
-  _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
-#define LLDB_DEPRECATED_WARNING_RESTORE _Pragma("clang diagnostic pop")
-#endif
-#elif defined(__GNUC__) && __GNUC__ > 6
-#define LLDB_DEPRECATED_WARNING_DISABLE
\
-  _Pragma("GCC diagnostic push")   
\
-  _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
-#define LLDB_DEPRECATED_WARNING_RESTORE _Pragma("GCC diagnostic pop")
-#else
-#define LLDB_DEPRECATED_WARNING_DISABLE
-#define LLDB_DEPRECATED_WARNING_RESTORE
-#endif
-
 namespace lldb_private {
 namespace line_editor {
 
@@ -383,11 +363,6 @@ class Editline {
   void SetEditLinePromptCallback(EditlinePromptCallbackType callbackFn);
   void SetGetCharacterFunction(EditlineGetCharCallbackType callbackFn);
 
-#if LLDB_EDITLINE_USE_WCHAR
-  LLDB_DEPRECATED_WARNING_DISABLE
-  std::wstring_convert> m_utf8conv;
-  LLDB_DEPRECATED_WARNING_RESTORE
-#endif
   ::EditLine *m_editline = nullptr;
   EditlineHistorySP m_history_sp;
   bool m_in_history = false;
diff --git a/lldb/source/Host/common/Editline.cpp 
b/lldb/source/Host/common/Editline.cpp
index 60117cb5f0e615..b568ede4fa0322 100644
--- a/lldb/source/Host/common/Editline.cpp
+++ b/lldb/source/Host/common/Editline.cpp
@@ -12,6 +12,8 @@
 
 #include "lldb/Host/Editline.h"
 
+#include 
+
 #include "lldb/Host/ConnectionFileDescriptor.h"
 #include "lldb/Host/FileSystem.h"
 #include "lldb/Host/Host.h"
@@ -23,6 +25,7 @@
 #include "lldb/Utility/StreamString.h"
 #include "lldb/Utility/StringList.h"
 #include "lldb/Utility/Timeout.h"
+#include "llvm/Support/ConvertUTF.h"
 
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Locale.h"
@@ -444,7 +447,9 @@ StringList Editline::GetInputAsStringList(int line_count) {
 if (line_count == 0)
   break;
 #if LLDB_EDITLINE_USE_WCHAR
-lines.AppendString(m_utf8conv.to_bytes(line));
+std::string buffer;
+llvm::convertWideToUTF8(line, buffer);
+lines.AppendString(buffer);
 #else
 lines.AppendString(line);
 #endif
@@ -636,7 +641,9 @@ unsigned char Editline::BreakLineCommand(int ch) {
 if (m_fix_indentation_callback) {
   StringList lines = GetInputAsStringList(m_current_line_index + 1);
 #if LLDB_EDITLINE_USE_WCHAR
-  lines.AppendString(m_utf8conv.to_bytes(new_line_fragment));
+  std::string buffer;
+  llvm::convertWideToUTF8(new_line_fragment, buffer);
+  lines.AppendString(buffer);
 #else
   lines.AppendString(new_line_fragment);
 #endif
@@ -684,8 +691,9 @@ unsigned char Editline::EndOrAddLineCommand(int ch) {
   m_input_lines.clear();
   for (unsigned index = 0; index < lines.GetSize(); index++) {
 #if LLDB_EDITLINE_USE_WCHAR
-m_input_lines.insert(m_input_lines.end(),
- m_utf8conv.from_bytes(lines[index]));
+std::wstring wbuffer;
+llvm::ConvertUTF8toWide(lines[index], wbuffer);
+m_input_lines.insert(m_input_lines.end(), wbuffer);
 #else
 m_input_lines.insert(m_input_lines.end(), lines[index]);
 #endif
@@ -869,7 +877,9 @@ unsigned char Editline::FixIndentationCommand(int ch) {
 currentLine = currentLine.erase(0, -indent_correction);
   }
 #if LLDB_EDITLINE_USE_WCHAR
-  m_input_lines[m_current_line_index] = m_utf8conv.from_bytes(currentLine);
+  std::wstring wbuffer;
+  llvm::ConvertUTF8toWide(currentLine, wbuffer);
+  m_input_lines[m_current_line_index] = wbuffer;
 #else
   m_input_lines[m_current_line_index] = currentLine;
 #endif
@@ -1502,7 +1512,7 @@ bool Editline::GetLine(std::string &line, bool 
&interrupted) {
 } else {
   m_history_sp->Enter(input);
 #if LLDB_EDITLINE_USE_WCHAR
-  line = m_utf8conv.to_bytes

[Lldb-commits] [lldb] 7b703bd - [lldb][docs] Fix "Developing LLDB" table of contents (#113166)

2024-10-21 Thread via lldb-commits

Author: Michael Buch
Date: 2024-10-21T22:19:26+01:00
New Revision: 7b703bd3e7c1f8fa2274978679664d41673cdea1

URL: 
https://github.com/llvm/llvm-project/commit/7b703bd3e7c1f8fa2274978679664d41673cdea1
DIFF: 
https://github.com/llvm/llvm-project/commit/7b703bd3e7c1f8fa2274978679664d41673cdea1.diff

LOG: [lldb][docs] Fix "Developing LLDB" table of contents (#113166)

Currently all the headings marked as `#` show up
as a top-level entry in the `Developing LLDB`
toctree. This patch marks these as `##` so only
`Adding Programming Language Support` is displayed
in the table of contents.

Added: 


Modified: 
lldb/docs/resources/addinglanguagesupport.md

Removed: 




diff  --git a/lldb/docs/resources/addinglanguagesupport.md 
b/lldb/docs/resources/addinglanguagesupport.md
index 28789048643d77..524d0b5f2940aa 100644
--- a/lldb/docs/resources/addinglanguagesupport.md
+++ b/lldb/docs/resources/addinglanguagesupport.md
@@ -49,21 +49,21 @@ clearer that evaluation with the static `Module`-returned 
`TypeSystem` instances
 make no sense, and have them error out on those calls. But either approach is
 fine.
 
-# Creating Types
+## Creating Types
 
 Your `TypeSystem` will need an approach for creating types based on a set of
 `Module`s. If your type info is going to come from DWARF info, you will want to
 subclass 
[DWARFASTParser](https://github.com/llvm/llvm-project/blob/main/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h).
 
 
-# Add Expression Evaluation Support
+## Add Expression Evaluation Support
 
 Expression Evaluation support is enabled by implementing the relevant methods 
on
 a `TypeSystem`-derived class. Search for `Expression` in the
 [TypeSystem 
header](https://github.com/llvm/llvm-project/blob/main/lldb/include/lldb/Symbol/TypeSystem.h)
 to find the methods to implement.
 
-# Type Completion
+## Type Completion
 
 There are three levels of type completion, each requiring more type 
information:
 1. Pointer size: When you have a forward decl or a reference, and that's all 
you
@@ -76,7 +76,7 @@ There are three levels of type completion, each requiring 
more type information:
 Ensure you never complete more of a type than is needed for a given situation.
 This will keep your type system from doing more work than necessary.
 
-# Language and LanguageRuntime Plugins
+## Language and LanguageRuntime Plugins
 
 If you followed the steps outlined above, you already have taught LLDB a great
 deal about your language. If your language's runtime model and fundamental data
@@ -92,4 +92,4 @@ These tasks are covered by two plugins:
   information (for example dynamic type resolution).
 * a `Language` plugin, which provides LLDB with a static view of your language;
   questions that are statically knowable and do not require a process are
-  answered by this plugin (for example data formatters).
\ No newline at end of file
+  answered by this plugin (for example data formatters).



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


[Lldb-commits] [lldb] [lldb][docs] Fix "Developing LLDB" table of contents (PR #113166)

2024-10-21 Thread Michael Buch via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Use LLVM's helper for Unicode conversion (NFC) (PR #112582)

2024-10-21 Thread Jonas Devlieghere via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Use LLVM's helper for Unicode conversion (NFC) (PR #112582)

2024-10-21 Thread Jonas Devlieghere via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Fix the sorting function for diagnostics (PR #113220)

2024-10-21 Thread Adrian Prantl via lldb-commits

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

None

>From 417e6f4c27d1603d118dadd8327e57b766626e6d Mon Sep 17 00:00:00 2001
From: Adrian Prantl 
Date: Mon, 21 Oct 2024 13:57:09 -0700
Subject: [PATCH] [lldb] Fix the sorting function for diagnostics

---
 lldb/source/Utility/DiagnosticsRendering.cpp|  4 ++--
 lldb/unittests/Utility/DiagnosticsRenderingTest.cpp | 10 +++---
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/lldb/source/Utility/DiagnosticsRendering.cpp 
b/lldb/source/Utility/DiagnosticsRendering.cpp
index d28a9ab8958ba6..208733ffc86853 100644
--- a/lldb/source/Utility/DiagnosticsRendering.cpp
+++ b/lldb/source/Utility/DiagnosticsRendering.cpp
@@ -99,10 +99,10 @@ void RenderDiagnosticDetails(Stream &stream,
 
   // Sort the diagnostics.
   auto sort = [](auto &ds) {
-llvm::sort(ds.begin(), ds.end(), [](auto &d1, auto &d2) {
+std::stable_sort(ds.begin(), ds.end(), [](auto &d1, auto &d2) {
   auto l1 = 
d1.source_location.value_or(DiagnosticDetail::SourceLocation{});
   auto l2 = 
d2.source_location.value_or(DiagnosticDetail::SourceLocation{});
-  return std::pair(l1.line, l2.column) < std::pair(l1.line, l2.column);
+  return std::tie(l1.line, l1.column) < std::tie(l2.line, l2.column);
 });
   };
   sort(remaining_details);
diff --git a/lldb/unittests/Utility/DiagnosticsRenderingTest.cpp 
b/lldb/unittests/Utility/DiagnosticsRenderingTest.cpp
index 39d8b1d558420d..ad2ebf7ffe1e2f 100644
--- a/lldb/unittests/Utility/DiagnosticsRenderingTest.cpp
+++ b/lldb/unittests/Utility/DiagnosticsRenderingTest.cpp
@@ -46,16 +46,20 @@ TEST_F(ErrorDisplayTest, RenderStatus) {
 std::string result =
 Render({DiagnosticDetail{loc2, eSeverityError, "X", "X"},
 DiagnosticDetail{loc1, eSeverityError, "Y", "Y"}});
-ASSERT_LT(StringRef(result).find("Y"), StringRef(result).find("X"));
+// Unintuitively the later diagnostic appears first in the string:
+//^   ^
+//|   second
+//first
+ASSERT_GT(StringRef(result).find("Y"), StringRef(result).find("X"));
   }
   {
 // Test that diagnostics in reverse order are emitted correctly.
-SourceLocation loc1 = {FileSpec{"a.c"}, 2, 10, 0, false, true};
+SourceLocation loc1 = {FileSpec{"a.c"}, 1, 10, 0, false, true};
 SourceLocation loc2 = {FileSpec{"a.c"}, 1, 20, 0, false, true};
 std::string result =
 Render({DiagnosticDetail{loc2, eSeverityError, "X", "X"},
 DiagnosticDetail{loc1, eSeverityError, "Y", "Y"}});
-ASSERT_LT(StringRef(result).find("Y"), StringRef(result).find("X"));
+ASSERT_GT(StringRef(result).find("Y"), StringRef(result).find("X"));
   }
   {
 // Test that range diagnostics are emitted correctly.

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


[Lldb-commits] [lldb] [lldb] Fix a crash when two diagnostics are on the same column or in … (PR #112451)

2024-10-21 Thread Adrian Prantl via lldb-commits


@@ -98,10 +94,31 @@ void RenderDiagnosticDetails(Stream &stream,
   continue;
 }
 
-auto &loc = *detail.source_location;
 remaining_details.push_back(detail);
+  }
+
+  // Sort the diagnostics.
+  auto sort = [](auto &ds) {
+llvm::sort(ds.begin(), ds.end(), [](auto &d1, auto &d2) {
+  auto l1 = 
d1.source_location.value_or(DiagnosticDetail::SourceLocation{});
+  auto l2 = 
d2.source_location.value_or(DiagnosticDetail::SourceLocation{});
+  return std::pair(l1.line, l2.column) < std::pair(l1.line, l2.column);

adrian-prantl wrote:

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

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


[Lldb-commits] [lldb] [lldb] Fix the sorting function for diagnostics (PR #113220)

2024-10-21 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Adrian Prantl (adrian-prantl)


Changes



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


2 Files Affected:

- (modified) lldb/source/Utility/DiagnosticsRendering.cpp (+2-2) 
- (modified) lldb/unittests/Utility/DiagnosticsRenderingTest.cpp (+7-3) 


``diff
diff --git a/lldb/source/Utility/DiagnosticsRendering.cpp 
b/lldb/source/Utility/DiagnosticsRendering.cpp
index d28a9ab8958ba6..208733ffc86853 100644
--- a/lldb/source/Utility/DiagnosticsRendering.cpp
+++ b/lldb/source/Utility/DiagnosticsRendering.cpp
@@ -99,10 +99,10 @@ void RenderDiagnosticDetails(Stream &stream,
 
   // Sort the diagnostics.
   auto sort = [](auto &ds) {
-llvm::sort(ds.begin(), ds.end(), [](auto &d1, auto &d2) {
+std::stable_sort(ds.begin(), ds.end(), [](auto &d1, auto &d2) {
   auto l1 = 
d1.source_location.value_or(DiagnosticDetail::SourceLocation{});
   auto l2 = 
d2.source_location.value_or(DiagnosticDetail::SourceLocation{});
-  return std::pair(l1.line, l2.column) < std::pair(l1.line, l2.column);
+  return std::tie(l1.line, l1.column) < std::tie(l2.line, l2.column);
 });
   };
   sort(remaining_details);
diff --git a/lldb/unittests/Utility/DiagnosticsRenderingTest.cpp 
b/lldb/unittests/Utility/DiagnosticsRenderingTest.cpp
index 39d8b1d558420d..ad2ebf7ffe1e2f 100644
--- a/lldb/unittests/Utility/DiagnosticsRenderingTest.cpp
+++ b/lldb/unittests/Utility/DiagnosticsRenderingTest.cpp
@@ -46,16 +46,20 @@ TEST_F(ErrorDisplayTest, RenderStatus) {
 std::string result =
 Render({DiagnosticDetail{loc2, eSeverityError, "X", "X"},
 DiagnosticDetail{loc1, eSeverityError, "Y", "Y"}});
-ASSERT_LT(StringRef(result).find("Y"), StringRef(result).find("X"));
+// Unintuitively the later diagnostic appears first in the string:
+//^   ^
+//|   second
+//first
+ASSERT_GT(StringRef(result).find("Y"), StringRef(result).find("X"));
   }
   {
 // Test that diagnostics in reverse order are emitted correctly.
-SourceLocation loc1 = {FileSpec{"a.c"}, 2, 10, 0, false, true};
+SourceLocation loc1 = {FileSpec{"a.c"}, 1, 10, 0, false, true};
 SourceLocation loc2 = {FileSpec{"a.c"}, 1, 20, 0, false, true};
 std::string result =
 Render({DiagnosticDetail{loc2, eSeverityError, "X", "X"},
 DiagnosticDetail{loc1, eSeverityError, "Y", "Y"}});
-ASSERT_LT(StringRef(result).find("Y"), StringRef(result).find("X"));
+ASSERT_GT(StringRef(result).find("Y"), StringRef(result).find("X"));
   }
   {
 // Test that range diagnostics are emitted correctly.

``




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


[Lldb-commits] [lldb] [lldb] Fix the sorting function for diagnostics (PR #113220)

2024-10-21 Thread Jonas Devlieghere via lldb-commits

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


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


[Lldb-commits] [lldb] 74e1554 - [lldb] Fix the sorting function for diagnostics (#113220)

2024-10-21 Thread via lldb-commits

Author: Adrian Prantl
Date: 2024-10-21T14:03:49-07:00
New Revision: 74e1554d7b4013a975cf5fb8df64a6419bb14a45

URL: 
https://github.com/llvm/llvm-project/commit/74e1554d7b4013a975cf5fb8df64a6419bb14a45
DIFF: 
https://github.com/llvm/llvm-project/commit/74e1554d7b4013a975cf5fb8df64a6419bb14a45.diff

LOG: [lldb] Fix the sorting function for diagnostics (#113220)

Added: 


Modified: 
lldb/source/Utility/DiagnosticsRendering.cpp
lldb/unittests/Utility/DiagnosticsRenderingTest.cpp

Removed: 




diff  --git a/lldb/source/Utility/DiagnosticsRendering.cpp 
b/lldb/source/Utility/DiagnosticsRendering.cpp
index d28a9ab8958ba6..208733ffc86853 100644
--- a/lldb/source/Utility/DiagnosticsRendering.cpp
+++ b/lldb/source/Utility/DiagnosticsRendering.cpp
@@ -99,10 +99,10 @@ void RenderDiagnosticDetails(Stream &stream,
 
   // Sort the diagnostics.
   auto sort = [](auto &ds) {
-llvm::sort(ds.begin(), ds.end(), [](auto &d1, auto &d2) {
+std::stable_sort(ds.begin(), ds.end(), [](auto &d1, auto &d2) {
   auto l1 = 
d1.source_location.value_or(DiagnosticDetail::SourceLocation{});
   auto l2 = 
d2.source_location.value_or(DiagnosticDetail::SourceLocation{});
-  return std::pair(l1.line, l2.column) < std::pair(l1.line, l2.column);
+  return std::tie(l1.line, l1.column) < std::tie(l2.line, l2.column);
 });
   };
   sort(remaining_details);

diff  --git a/lldb/unittests/Utility/DiagnosticsRenderingTest.cpp 
b/lldb/unittests/Utility/DiagnosticsRenderingTest.cpp
index 39d8b1d558420d..ad2ebf7ffe1e2f 100644
--- a/lldb/unittests/Utility/DiagnosticsRenderingTest.cpp
+++ b/lldb/unittests/Utility/DiagnosticsRenderingTest.cpp
@@ -46,16 +46,20 @@ TEST_F(ErrorDisplayTest, RenderStatus) {
 std::string result =
 Render({DiagnosticDetail{loc2, eSeverityError, "X", "X"},
 DiagnosticDetail{loc1, eSeverityError, "Y", "Y"}});
-ASSERT_LT(StringRef(result).find("Y"), StringRef(result).find("X"));
+// Unintuitively the later diagnostic appears first in the string:
+//^   ^
+//|   second
+//first
+ASSERT_GT(StringRef(result).find("Y"), StringRef(result).find("X"));
   }
   {
 // Test that diagnostics in reverse order are emitted correctly.
-SourceLocation loc1 = {FileSpec{"a.c"}, 2, 10, 0, false, true};
+SourceLocation loc1 = {FileSpec{"a.c"}, 1, 10, 0, false, true};
 SourceLocation loc2 = {FileSpec{"a.c"}, 1, 20, 0, false, true};
 std::string result =
 Render({DiagnosticDetail{loc2, eSeverityError, "X", "X"},
 DiagnosticDetail{loc1, eSeverityError, "Y", "Y"}});
-ASSERT_LT(StringRef(result).find("Y"), StringRef(result).find("X"));
+ASSERT_GT(StringRef(result).find("Y"), StringRef(result).find("X"));
   }
   {
 // Test that range diagnostics are emitted correctly.



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


[Lldb-commits] [lldb] [lldb] Fix the sorting function for diagnostics (PR #113220)

2024-10-21 Thread Adrian Prantl via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Fix the sorting function for diagnostics (PR #113220)

2024-10-21 Thread Jorge Gorbe Moya via lldb-commits

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

Thanks!

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


[Lldb-commits] [lldb] Push down cpython module to the submodule (PR #113066)

2024-10-21 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere commented:

Can you reference documentation about the `.native` import and explain why this 
is necessary? Intuitively it makes sense but I want to make sure I fully 
understand this change and having it documented will help the next person that 
sees this. 

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


[Lldb-commits] [lldb] [lldb] Rename CommandReturnObject::Get.*Data -> Get.*String (PR #112062)

2024-10-21 Thread Carlos Alberto Enciso via lldb-commits

CarlosAlbertoEnciso wrote:

> @JDevlieghere fixed this in 
> [40ea92c](https://github.com/llvm/llvm-project/commit/40ea92c859234d536553cf26650e89d6e52071c6)

@adrian-prantl, @JDevlieghere Thanks for the fix.

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