[Lldb-commits] [lldb] [lldb][DataFormatter] Surface CalculateNumChildren errors in std::vector summary (PR #135944)

2025-04-22 Thread Pavel Labath via lldb-commits

labath wrote:

cool

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


[Lldb-commits] [lldb] d7d1706 - [lldb] Fix use-color settings not persistent (#135626)

2025-04-22 Thread via lldb-commits

Author: Ebuka Ezike
Date: 2025-04-22T12:21:23+01:00
New Revision: d7d170656404e1cb29a51689fd66a12bc060c630

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

LOG: [lldb] Fix use-color settings not persistent (#135626)

Fixes https://github.com/llvm/llvm-project/issues/22981

If `settings set use-color` is changed when lldb is running it does not take 
effect. 
This is fixes that.

-

Signed-off-by: Ebuka Ezike 
Co-authored-by: Jonas Devlieghere 

Added: 


Modified: 
lldb/include/lldb/Core/IOHandler.h
lldb/include/lldb/Host/Editline.h
lldb/include/lldb/Interpreter/CommandInterpreter.h
lldb/source/Core/Debugger.cpp
lldb/source/Core/IOHandler.cpp
lldb/source/Host/common/Editline.cpp
lldb/source/Interpreter/CommandInterpreter.cpp
lldb/test/API/terminal/TestEditline.py

Removed: 




diff  --git a/lldb/include/lldb/Core/IOHandler.h 
b/lldb/include/lldb/Core/IOHandler.h
index 794d229bc1337..2fb3d7a7c9cc3 100644
--- a/lldb/include/lldb/Core/IOHandler.h
+++ b/lldb/include/lldb/Core/IOHandler.h
@@ -99,6 +99,12 @@ class IOHandler {
 // Prompt support isn't mandatory
 return false;
   }
+
+  virtual bool SetUseColor(bool use_color) {
+// Color support isn't mandatory.
+return false;
+  };
+
   bool SetPrompt(const char *) = delete;
 
   virtual llvm::StringRef GetControlSequence(char ch) { return {}; }
@@ -375,6 +381,8 @@ class IOHandlerEditline : public IOHandler {
   bool SetPrompt(llvm::StringRef prompt) override;
   bool SetPrompt(const char *prompt) = delete;
 
+  bool SetUseColor(bool use_color) override;
+
   const char *GetContinuationPrompt();
 
   void SetContinuationPrompt(llvm::StringRef prompt);

diff  --git a/lldb/include/lldb/Host/Editline.h 
b/lldb/include/lldb/Host/Editline.h
index 705ec9c49f7c7..c202a76758e13 100644
--- a/lldb/include/lldb/Host/Editline.h
+++ b/lldb/include/lldb/Host/Editline.h
@@ -168,6 +168,9 @@ class Editline {
   DisplayCompletions(Editline &editline,
  llvm::ArrayRef results);
 
+  /// Sets if editline should use color.
+  void UseColor(bool use_color);
+
   /// Sets a string to be used as a prompt, or combined with a line number to
   /// form a prompt.
   void SetPrompt(const char *prompt);
@@ -223,21 +226,29 @@ class Editline {
   void SetPromptAnsiPrefix(std::string prefix) {
 if (m_color)
   m_prompt_ansi_prefix = std::move(prefix);
+else
+  m_prompt_ansi_prefix.clear();
   }
 
   void SetPromptAnsiSuffix(std::string suffix) {
 if (m_color)
   m_prompt_ansi_suffix = std::move(suffix);
+else
+  m_prompt_ansi_suffix.clear();
   }
 
   void SetSuggestionAnsiPrefix(std::string prefix) {
 if (m_color)
   m_suggestion_ansi_prefix = std::move(prefix);
+else
+  m_suggestion_ansi_prefix.clear();
   }
 
   void SetSuggestionAnsiSuffix(std::string suffix) {
 if (m_color)
   m_suggestion_ansi_suffix = std::move(suffix);
+else
+  m_suggestion_ansi_suffix.clear();
   }
 
   /// Prompts for and reads a single line of user input.

diff  --git a/lldb/include/lldb/Interpreter/CommandInterpreter.h 
b/lldb/include/lldb/Interpreter/CommandInterpreter.h
index b65edcf68b251..724d88d65f6ac 100644
--- a/lldb/include/lldb/Interpreter/CommandInterpreter.h
+++ b/lldb/include/lldb/Interpreter/CommandInterpreter.h
@@ -476,6 +476,8 @@ class CommandInterpreter : public Broadcaster,
 
   void UpdatePrompt(llvm::StringRef prompt);
 
+  void UpdateUseColor(bool use_color);
+
   bool Confirm(llvm::StringRef message, bool default_answer);
 
   void LoadCommandDictionary();

diff  --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 8fe80b3841883..7b60e1a14f414 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -237,16 +237,16 @@ Status Debugger::SetPropertyValue(const ExecutionContext 
*exe_ctx,
   CommandInterpreter::eBroadcastBitResetPrompt, bytes.release());
   GetCommandInterpreter().BroadcastEvent(prompt_change_event_sp);
 } else if (property_path == g_debugger_properties[ePropertyUseColor].name) 
{
-  // use-color changed. Ping the prompt so it can reset the ansi terminal
-  // codes.
-  SetPrompt(GetPrompt());
+  // use-color changed. set use-color, this also pings the prompt so it can
+  // reset the ansi terminal codes.
+  SetUseColor(GetUseColor());
 } else if (property_path ==
g_debugger_properties[ePropertyPromptAnsiPrefix].name ||
property_path ==
g_debugger_properties[ePropertyPromptAnsiSuffix].name) {
-  // Prompt colors changed. Ping the prompt so it can reset the ansi
-  // terminal codes.
-  SetPrompt(GetPrompt());
+  // Prompt color changed. set use-color, this 

[Lldb-commits] [lldb] [lldb] Fix use-color settings not persistent (PR #135626)

2025-04-22 Thread Ebuka Ezike via lldb-commits

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


[Lldb-commits] [lldb] 84cd0d3 - [lldb] Slide eh_frame unwind plan if it doesn't begin at function boundary (#135333)

2025-04-22 Thread via lldb-commits

Author: Pavel Labath
Date: 2025-04-22T13:53:16+02:00
New Revision: 84cd0d3c38e40e4cb5e416684ecd84df914e19aa

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

LOG: [lldb] Slide eh_frame unwind plan if it doesn't begin at function boundary 
(#135333)

This is mainly useful for discontinuous functions because individual
parts of the function will have separate FDE entries, which can begin
many megabytes from the start of the function. However, I'm separating
it out, because it turns out we already have a test case for the
situation where the FDE does not begin exactly at the function boundary.

The test works mostly by accident because the FDE starts only one byte
after the beginning of the function so it doesn't really matter whether
one looks up the unwind row using the function or fde offset. In this
patch, I beef up the test to catch this problem more reliably.

To make this work I've also needed to change a couple of places which
that an unwind plan always has a row at offset zero.

Added: 


Modified: 
lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp
lldb/source/Symbol/DWARFCallFrameInfo.cpp
lldb/source/Symbol/UnwindPlan.cpp
lldb/test/Shell/Unwind/Inputs/eh-frame-small-fde.s
lldb/test/Shell/Unwind/eh-frame-small-fde.test
lldb/unittests/Symbol/UnwindPlanTest.cpp

Removed: 




diff  --git a/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp 
b/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp
index 5f0a863e936d4..f5279758a147c 100644
--- a/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp
+++ b/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp
@@ -73,7 +73,7 @@ bool UnwindAssembly_x86::AugmentUnwindPlanFromCallSite(
 
   int wordsize = 8;
   ProcessSP process_sp(thread.GetProcess());
-  if (process_sp.get() == nullptr)
+  if (!process_sp || !first_row || !last_row)
 return false;
 
   wordsize = process_sp->GetTarget().GetArchitecture().GetAddressByteSize();

diff  --git a/lldb/source/Symbol/DWARFCallFrameInfo.cpp 
b/lldb/source/Symbol/DWARFCallFrameInfo.cpp
index fb57c61d413aa..a763acb1fdf9e 100644
--- a/lldb/source/Symbol/DWARFCallFrameInfo.cpp
+++ b/lldb/source/Symbol/DWARFCallFrameInfo.cpp
@@ -190,8 +190,12 @@ bool DWARFCallFrameInfo::GetUnwindPlan(const AddressRange 
&range,
   unwind_plan.SetUnwindPlanForSignalTrap(fde->for_signal_trap ? eLazyBoolYes
   : eLazyBoolNo);
   unwind_plan.SetReturnAddressRegister(fde->return_addr_reg_num);
-  for (UnwindPlan::Row &row : fde->rows)
+  int64_t slide =
+  fde->range.GetBaseAddress().GetFileAddress() - addr.GetFileAddress();
+  for (UnwindPlan::Row &row : fde->rows) {
+row.SlideOffset(slide);
 unwind_plan.AppendRow(std::move(row));
+  }
 
   return true;
 }

diff  --git a/lldb/source/Symbol/UnwindPlan.cpp 
b/lldb/source/Symbol/UnwindPlan.cpp
index 94c23137e8f12..b1a96b5e26840 100644
--- a/lldb/source/Symbol/UnwindPlan.cpp
+++ b/lldb/source/Symbol/UnwindPlan.cpp
@@ -474,7 +474,7 @@ bool UnwindPlan::PlanValidAtAddress(Address addr) const {
   // If the 0th Row of unwind instructions is missing, or if it doesn't provide
   // a register to use to find the Canonical Frame Address, this is not a valid
   // UnwindPlan.
-  const Row *row0 = GetRowForFunctionOffset(0);
+  const Row *row0 = GetRowAtIndex(0);
   if (!row0 ||
   row0->GetCFAValue().GetValueType() == Row::FAValue::unspecified) {
 Log *log = GetLog(LLDBLog::Unwind);

diff  --git a/lldb/test/Shell/Unwind/Inputs/eh-frame-small-fde.s 
b/lldb/test/Shell/Unwind/Inputs/eh-frame-small-fde.s
index b08436af3f2ea..29decefad5e51 100644
--- a/lldb/test/Shell/Unwind/Inputs/eh-frame-small-fde.s
+++ b/lldb/test/Shell/Unwind/Inputs/eh-frame-small-fde.s
@@ -10,12 +10,20 @@ bar:
 
 .type   foo, @function
 foo:
-nop # Make the FDE entry start one byte later than the actual function.
+# Make the FDE entry start 16 bytes later than the actual function. The
+# size is chosen such that it is larger than the size of the FDE entry.
+# This allows us to test that we're using the correct offset for
+# unwinding (we'll stop 21 bytes into the function, but only 5 bytes
+# into the FDE).
+.nops 16
 .cfi_startproc
 .cfi_register %rip, %r13
 callbar
 addl$1, %eax
-jmp *%r13 # Return
+movq%r13, %r14
+.cfi_register %rip, %r14
+movq$0, %r13
+jmp *%r14 # Return
 .cfi_endproc
 .size   foo, .-foo
 

diff  --git a/lldb/test/Shell/Unwind/eh-frame-small-fde.test 
b/lldb/test/Shell/Unwind/eh-frame-small-fde.test
index 0ece6c2a12a3e..d86d41f73f1c1 100644
--- a/lldb/test/Shell/Unwind

[Lldb-commits] [lldb] [lldb] Slide eh_frame unwind plan if it doesn't begin at function boundary (PR #135333)

2025-04-22 Thread Pavel Labath via lldb-commits

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


[Lldb-commits] [lldb] Fix connecting via abstract socket (PR #136466)

2025-04-22 Thread Dmitry Vasilyev via lldb-commits

slydiman wrote:

Don't forget to update the protocol passed to the 
GDBRemoteCommunicationServerPlatform constructor.

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


[Lldb-commits] [lldb] [lldb] Preparation for DWARF indexing speedup (PR #123732)

2025-04-22 Thread Pavel Labath via lldb-commits

https://github.com/labath updated 
https://github.com/llvm/llvm-project/pull/123732

>From 68b192e29131d04f38474b7ad44e84aff41a8c21 Mon Sep 17 00:00:00 2001
From: Pavel Labath 
Date: Tue, 21 Jan 2025 11:50:31 +0100
Subject: [PATCH] [lldb] Preparation for DWARF indexing speedup

This is part of the work proposed in
.
One of the change is that the there will be a different structure for
holding the partial indexes and the final (consolidated) index. To
prepare for this, I'm making the IndexSet structure a template. The
index cache encoding/decoding methods are changed into free functions,
as they only need to know how to work with the final index.

I've moved this functionality to a separate file as all this doesn't
really depend on the rest of the ManualDWARFIndex and it needs to be
public due to its use in the unit test (both of which indicate that it
could be a component of its own).
---
 .../Plugins/SymbolFile/DWARF/CMakeLists.txt   |   1 +
 .../SymbolFile/DWARF/ManualDWARFIndex.cpp | 181 ++
 .../SymbolFile/DWARF/ManualDWARFIndex.h   |  31 +--
 .../SymbolFile/DWARF/ManualDWARFIndexSet.cpp  | 154 +++
 .../SymbolFile/DWARF/ManualDWARFIndexSet.h|  54 ++
 .../DWARF/DWARFIndexCachingTest.cpp   |  14 +-
 6 files changed, 240 insertions(+), 195 deletions(-)
 create mode 100644 lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndexSet.cpp
 create mode 100644 lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndexSet.h

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt 
b/lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
index e87194dfe74cb..2d2eb73f4513b 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
+++ b/lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
@@ -30,6 +30,7 @@ add_lldb_library(lldbPluginSymbolFileDWARF PLUGIN
   DWARFUnit.cpp
   LogChannelDWARF.cpp
   ManualDWARFIndex.cpp
+  ManualDWARFIndexSet.cpp
   NameToDIE.cpp
   SymbolFileDWARF.cpp
   SymbolFileDWARFDwo.cpp
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
index 98066b4a32cbc..523820874752a 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
@@ -77,8 +77,10 @@ void ManualDWARFIndex::Index() {
   lldb::eDescriptionLevelBrief);
 
   // Include 2 passes per unit to index for extracting DIEs from the unit and
-  // indexing the unit, and then 8 extra entries for finalizing each index set.
-  const uint64_t total_progress = units_to_index.size() * 2 + 8;
+  // indexing the unit, and then extra entries for finalizing each index in the
+  // set.
+  const auto indices = IndexSet::Indices();
+  const uint64_t total_progress = units_to_index.size() * 2 + indices.size();
   Progress progress("Manually indexing DWARF", module_desc.GetData(),
 total_progress, /*debugger=*/nullptr,
 Progress::kDefaultHighFrequencyReportTime);
@@ -122,7 +124,7 @@ void ManualDWARFIndex::Index() {
   });
 
   // Now index all DWARF unit in parallel.
-  std::vector sets(num_threads);
+  std::vector> sets(num_threads);
   for_each_unit(
   [this, dwp_dwarf, &sets](size_t worker_id, size_t, DWARFUnit *unit) {
 IndexUnit(*unit, dwp_dwarf, sets[worker_id]);
@@ -130,29 +132,22 @@ void ManualDWARFIndex::Index() {
 
   // Merge partial indexes into a single index. Process each index in a set in
   // parallel.
-  auto finalize_fn = [this, &sets, &progress](NameToDIE(IndexSet::*index)) {
-NameToDIE &result = m_set.*index;
-for (auto &set : sets)
-  result.Append(set.*index);
-result.Finalize();
-progress.Increment();
-  };
-
-  task_group.async(finalize_fn, &IndexSet::function_basenames);
-  task_group.async(finalize_fn, &IndexSet::function_fullnames);
-  task_group.async(finalize_fn, &IndexSet::function_methods);
-  task_group.async(finalize_fn, &IndexSet::function_selectors);
-  task_group.async(finalize_fn, &IndexSet::objc_class_selectors);
-  task_group.async(finalize_fn, &IndexSet::globals);
-  task_group.async(finalize_fn, &IndexSet::types);
-  task_group.async(finalize_fn, &IndexSet::namespaces);
+  for (NameToDIE IndexSet::*index : indices) {
+task_group.async([this, &sets, index, &progress]() {
+  NameToDIE &result = m_set.*index;
+  for (auto &set : sets)
+result.Append(set.*index);
+  result.Finalize();
+  progress.Increment();
+});
+  }
   task_group.wait();
 
   SaveToCache();
 }
 
 void ManualDWARFIndex::IndexUnit(DWARFUnit &unit, SymbolFileDWARFDwo *dwp,
- IndexSet &set) {
+ IndexSet &set) {
   Log *log = GetLog(DWARFLog::Lookups);
 
   if (log) {
@@ -210,7 +205,7 @@ void ManualDWARFIndex::IndexUnit(DWARFUnit &unit, 
SymbolFileDWARFDwo *dwp,
 
 void ManualDWARFIn

[Lldb-commits] [lldb] [lldb] Preparation for DWARF indexing speedup (PR #123732)

2025-04-22 Thread Pavel Labath via lldb-commits

labath wrote:

ping

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


[Lldb-commits] [lldb] Fix connecting via abstract socket (PR #136466)

2025-04-22 Thread Pavel Labath via lldb-commits

labath wrote:

Agreed

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


[Lldb-commits] [lldb] [lldb] Make the statusline separator configurable (PR #136611)

2025-04-22 Thread Pavel Labath via lldb-commits

labath wrote:

IIUC, the `${separator}` thingy could be used in places other than the status 
line, so maybe the setting controlling it shouldn't be called 
`statusline-separator` ?

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


[Lldb-commits] [lldb] [LLDB] Fix crash after second run when set a previous watchpoint. (PR #136649)

2025-04-22 Thread via lldb-commits

https://github.com/hapee updated 
https://github.com/llvm/llvm-project/pull/136649

>From 563cbddfe9b7da394c818a03e05924c0f7d39d5f Mon Sep 17 00:00:00 2001
From: hapee <623151...@qq.com>
Date: Tue, 22 Apr 2025 11:34:38 +0800
Subject: [PATCH] [lldb] Fix crash after second run when set a previous
 watchpoint.

---
 lldb/source/Breakpoint/Watchpoint.cpp | 9 +
 1 file changed, 9 insertions(+)

diff --git a/lldb/source/Breakpoint/Watchpoint.cpp 
b/lldb/source/Breakpoint/Watchpoint.cpp
index 2df848aaa0576..0fcc9b90c0ab5 100644
--- a/lldb/source/Breakpoint/Watchpoint.cpp
+++ b/lldb/source/Breakpoint/Watchpoint.cpp
@@ -409,6 +409,15 @@ bool Watchpoint::IsDisabledDuringEphemeralMode() {
 }
 
 void Watchpoint::SetEnabled(bool enabled, bool notify) {
+  // Whenever setting the enabled state of a watchpoint, we need to ensure
+  // that `m_new_value_sp` exists to avoid crash when reading old_data later.
+  // See https://github.com/llvm/llvm-project/issues/135590.
+  if (!m_new_value_sp) {
+ExecutionContext exe_ctx;
+m_target.GetProcessSP()->CalculateExecutionContext(exe_ctx);
+CaptureWatchedValue(exe_ctx);
+  }
+
   if (!enabled) {
 if (m_is_ephemeral)
   ++m_disabled_count;

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


[Lldb-commits] [lldb] [lldb][AArch64] Fix Apple M4 on Linux (PR #135563)

2025-04-22 Thread David Spickett via lldb-commits

DavidSpickett wrote:

I think I can test this on Arm's Foundation Model, I will do that and get back 
to you. I have not checked it before now.

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


[Lldb-commits] [lldb] [LLDB] Fix crash after second run when set a previous watchpoint. (PR #136649)

2025-04-22 Thread via lldb-commits

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


[Lldb-commits] [lldb] [lldb][AIX] get host info for AIX (PR #134354)

2025-04-22 Thread Pavel Labath via lldb-commits


@@ -40,8 +40,9 @@ TEST_F(HostTest, GetProcessInfo) {
triple.getEnvironment() == llvm::Triple::EnvironmentType::Android));
 
   ProcessInstanceInfo Info;
+#ifndef _AIX

labath wrote:

In that case, what would say to filtering this process out inside the AIX 
implementation? (basically add something like `if (pid == 0) return false;`)

In theory, I suppose that someone may want to get the process information of 
the process zero, but i doubt it's an important use case since we normally call 
this while attaching to a process. And it would ensure that 
`GetProcessInfo(LLDB_INVALID_PROCESS_ID)` behaves the same way everywhere (we 
could also change this test to use the LLDB_INVALID_PROCESS_ID macro to make it 
clear that it's checking for an "invalid" process).

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


[Lldb-commits] [lldb] [lldb] Fix crash after second run when set a previous watchpoint. (PR #136682)

2025-04-22 Thread via lldb-commits

github-actions[bot] wrote:



Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this 
page.

If this is not working for you, it is probably because you do not have write 
permissions for the repository. In which case you can instead tag reviewers by 
name in a comment by using `@` followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a 
review by "ping"ing the PR by adding a comment “Ping”. The common courtesy 
"ping" rate is once a week. Please remember that you are asking for valuable 
time from other developers.

If you have further questions, they may be answered by the [LLVM GitHub User 
Guide](https://llvm.org/docs/GitHub.html).

You can also ask questions in a comment on this PR, on the [LLVM 
Discord](https://discord.com/invite/xS7Z362) or on the 
[forums](https://discourse.llvm.org/).

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


[Lldb-commits] [lldb] [lldb] Fix crash after second run when set a previous watchpoint. (PR #136682)

2025-04-22 Thread via lldb-commits

https://github.com/hapee created 
https://github.com/llvm/llvm-project/pull/136682

This PR fixes a crash in `LLDB` caused by a dangling pointer to a reused 
`ValueObjectSP` when re-running the debuggee and setting the same watchpoint 
again.

As described by @jasonmolenda, the fix is to reinitialize the dangling pointer 
in `Watchpoint::SetEnabled`.

This PR closes [#135590](https://github.com/llvm/llvm-project/issues/135590).

>From 563cbddfe9b7da394c818a03e05924c0f7d39d5f Mon Sep 17 00:00:00 2001
From: hapee <623151...@qq.com>
Date: Tue, 22 Apr 2025 11:34:38 +0800
Subject: [PATCH] [lldb] Fix crash after second run when set a previous
 watchpoint.

---
 lldb/source/Breakpoint/Watchpoint.cpp | 9 +
 1 file changed, 9 insertions(+)

diff --git a/lldb/source/Breakpoint/Watchpoint.cpp 
b/lldb/source/Breakpoint/Watchpoint.cpp
index 2df848aaa0576..0fcc9b90c0ab5 100644
--- a/lldb/source/Breakpoint/Watchpoint.cpp
+++ b/lldb/source/Breakpoint/Watchpoint.cpp
@@ -409,6 +409,15 @@ bool Watchpoint::IsDisabledDuringEphemeralMode() {
 }
 
 void Watchpoint::SetEnabled(bool enabled, bool notify) {
+  // Whenever setting the enabled state of a watchpoint, we need to ensure
+  // that `m_new_value_sp` exists to avoid crash when reading old_data later.
+  // See https://github.com/llvm/llvm-project/issues/135590.
+  if (!m_new_value_sp) {
+ExecutionContext exe_ctx;
+m_target.GetProcessSP()->CalculateExecutionContext(exe_ctx);
+CaptureWatchedValue(exe_ctx);
+  }
+
   if (!enabled) {
 if (m_is_ephemeral)
   ++m_disabled_count;

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


[Lldb-commits] [lldb] [lldb] Fix crash after second run when set a previous watchpoint. (PR #136682)

2025-04-22 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: None (hapee)


Changes

This PR fixes a crash in `LLDB` caused by a dangling pointer to a reused 
`ValueObjectSP` when re-running the debuggee and setting the same watchpoint 
again.

As described by @jasonmolenda, the fix is to reinitialize the dangling 
pointer in `Watchpoint::SetEnabled`.

This PR closes [#135590](https://github.com/llvm/llvm-project/issues/135590).

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


1 Files Affected:

- (modified) lldb/source/Breakpoint/Watchpoint.cpp (+9) 


``diff
diff --git a/lldb/source/Breakpoint/Watchpoint.cpp 
b/lldb/source/Breakpoint/Watchpoint.cpp
index 2df848aaa0576..0fcc9b90c0ab5 100644
--- a/lldb/source/Breakpoint/Watchpoint.cpp
+++ b/lldb/source/Breakpoint/Watchpoint.cpp
@@ -409,6 +409,15 @@ bool Watchpoint::IsDisabledDuringEphemeralMode() {
 }
 
 void Watchpoint::SetEnabled(bool enabled, bool notify) {
+  // Whenever setting the enabled state of a watchpoint, we need to ensure
+  // that `m_new_value_sp` exists to avoid crash when reading old_data later.
+  // See https://github.com/llvm/llvm-project/issues/135590.
+  if (!m_new_value_sp) {
+ExecutionContext exe_ctx;
+m_target.GetProcessSP()->CalculateExecutionContext(exe_ctx);
+CaptureWatchedValue(exe_ctx);
+  }
+
   if (!enabled) {
 if (m_is_ephemeral)
   ++m_disabled_count;

``




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


[Lldb-commits] [lldb] [lldb] Clean up StartDebugserverProcess before I start refactoring it (PR #135342)

2025-04-22 Thread Pavel Labath via lldb-commits

https://github.com/labath updated 
https://github.com/llvm/llvm-project/pull/135342

>From 966b50e5a2a8cf7508d2b00f04ff2758d1420c30 Mon Sep 17 00:00:00 2001
From: Pavel Labath 
Date: Fri, 11 Apr 2025 12:06:15 +0200
Subject: [PATCH] [lldb] Clean up StartDebugserverProcess before I start
 refactoring it

- use early exits where possible
- avoid the listen thread by using Socket APIs which allow separate
  "listen" and "accept" steps
- use formatv-like log statements

There "should" be no functional changes from this patch.
---
 .../gdb-remote/GDBRemoteCommunication.cpp | 481 --
 .../gdb-remote/GDBRemoteCommunication.h   |  15 -
 2 files changed, 199 insertions(+), 297 deletions(-)

diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index abdc3da047dc7..500b8b6703adf 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -15,7 +15,6 @@
 #include "lldb/Host/Pipe.h"
 #include "lldb/Host/ProcessLaunchInfo.h"
 #include "lldb/Host/Socket.h"
-#include "lldb/Host/ThreadLauncher.h"
 #include "lldb/Host/common/TCPSocket.h"
 #include "lldb/Host/posix/ConnectionFileDescriptorPosix.h"
 #include "lldb/Target/Platform.h"
@@ -27,10 +26,10 @@
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Config/llvm-config.h" // for LLVM_ENABLE_ZLIB
+#include "llvm/Support/Error.h"
 #include "llvm/Support/ScopedPrinter.h"
 #include 
 #include 
-#include 
 #include 
 
 #if defined(__APPLE__)
@@ -63,7 +62,7 @@ GDBRemoteCommunication::GDBRemoteCommunication()
 #endif
   m_echo_number(0), m_supports_qEcho(eLazyBoolCalculate), m_history(512),
   m_send_acks(true), m_is_platform(false),
-  m_compression_type(CompressionType::None), m_listen_url() {
+  m_compression_type(CompressionType::None) {
 }
 
 // Destructor
@@ -835,53 +834,6 @@ GDBRemoteCommunication::CheckForPacket(const uint8_t *src, 
size_t src_len,
   return GDBRemoteCommunication::PacketType::Invalid;
 }
 
-Status GDBRemoteCommunication::StartListenThread(const char *hostname,
- uint16_t port) {
-  if (m_listen_thread.IsJoinable())
-return Status::FromErrorString("listen thread already running");
-
-  char listen_url[512];
-  if (hostname && hostname[0])
-snprintf(listen_url, sizeof(listen_url), "listen://%s:%i", hostname, port);
-  else
-snprintf(listen_url, sizeof(listen_url), "listen://%i", port);
-  m_listen_url = listen_url;
-  SetConnection(std::make_unique());
-  llvm::Expected listen_thread = ThreadLauncher::LaunchThread(
-  listen_url, [this] { return GDBRemoteCommunication::ListenThread(); });
-  if (!listen_thread)
-return Status::FromError(listen_thread.takeError());
-  m_listen_thread = *listen_thread;
-
-  return Status();
-}
-
-bool GDBRemoteCommunication::JoinListenThread() {
-  if (m_listen_thread.IsJoinable())
-m_listen_thread.Join(nullptr);
-  return true;
-}
-
-lldb::thread_result_t GDBRemoteCommunication::ListenThread() {
-  Status error;
-  ConnectionFileDescriptor *connection =
-  (ConnectionFileDescriptor *)GetConnection();
-
-  if (connection) {
-// Do the listen on another thread so we can continue on...
-if (connection->Connect(
-m_listen_url.c_str(),
-[this](llvm::StringRef port_str) {
-  uint16_t port = 0;
-  llvm::to_integer(port_str, port, 10);
-  m_port_promise.set_value(port);
-},
-&error) != eConnectionStatusSuccess)
-  SetConnection(nullptr);
-  }
-  return {};
-}
-
 FileSpec GDBRemoteCommunication::GetDebugserverPath(Platform *platform) {
   Log *log = GetLog(GDBRLog::Process);
   // If we locate debugserver, keep that located version around
@@ -945,277 +897,242 @@ Status GDBRemoteCommunication::StartDebugserverProcess(
 const char *url, Platform *platform, ProcessLaunchInfo &launch_info,
 uint16_t *port, const Args *inferior_args, shared_fd_t pass_comm_fd) {
   Log *log = GetLog(GDBRLog::Process);
-  LLDB_LOGF(log, "GDBRemoteCommunication::%s(url=%s, port=%" PRIu16 ")",
-__FUNCTION__, url ? url : "", port ? *port : uint16_t(0));
+  LLDB_LOG(log, "Starting debug server: url={0}, port={1}",
+   url ? url : "", port ? *port : uint16_t(0));
 
-  Status error;
-  FileSpec &debugserver_file_spec = launch_info.GetExecutableFile();
-  if ((debugserver_file_spec = GetDebugserverPath(platform))) {
-std::string debugserver_path = debugserver_file_spec.GetPath();
+  FileSpec debugserver_file_spec = GetDebugserverPath(platform);
+  if (!debugserver_file_spec)
+return Status::FromErrorString("unable to locate " DEBUGSERVER_BASENAME);
 
-Args &debugserver_args = launch_info.GetArguments();
-debugserver_args.Clear();
+  std::string debugserver_path = debugserver_file_spec.GetPath();

[Lldb-commits] [lldb] c3f815b - Modify the localCache API to require an explicit commit on CachedFile… (#136121)

2025-04-22 Thread via lldb-commits

Author: anjenner
Date: 2025-04-22T09:45:15+01:00
New Revision: c3f815ba82defc84244a9688fd2578da513340fb

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

LOG: Modify the localCache API to require an explicit commit on CachedFile… 
(#136121)

…Stream.

CachedFileStream has previously performed the commit step in its
destructor, but this means its only recourse for error handling is
report_fatal_error. Modify this to add an explicit commit() method, and
call this in the appropriate places with appropriate error handling for
the location.

Currently the destructor of CacheStream gives an assert failure in Debug
builds if commit() was not called. This will help track down any
remaining uses of the API that assume the old destructior behaviour. In
Release builds we fall back to the previous behaviour and call
report_fatal_error if the commit fails.

This is version 2 of this PR, superseding reverted PR
https://github.com/llvm/llvm-project/pull/115331 . I have incorporated a
change to the testcase to make it more reliable on Windows, as well as
two follow-up changes
(https://github.com/llvm/llvm-project/commit/df79000896101acc9b8d7435e59f767b36c00ac8
and
https://github.com/llvm/llvm-project/commit/b0baa1d8bd68a2ce2f7c5f2b62333e410e9122a1)
that were also reverted when 115331 was reverted.

-

Co-authored-by: Augie Fackler 
Co-authored-by: Vitaly Buka 

Added: 
llvm/unittests/Support/Caching.cpp

Modified: 
lldb/source/Core/DataFileCache.cpp
llvm/include/llvm/Support/Caching.h
llvm/lib/CGData/CodeGenData.cpp
llvm/lib/Debuginfod/Debuginfod.cpp
llvm/lib/LTO/LTOBackend.cpp
llvm/lib/Support/Caching.cpp
llvm/tools/gold/gold-plugin.cpp
llvm/tools/llvm-lto2/llvm-lto2.cpp
llvm/unittests/Support/CMakeLists.txt

Removed: 




diff  --git a/lldb/source/Core/DataFileCache.cpp 
b/lldb/source/Core/DataFileCache.cpp
index ef0e07a8b0342..9109269711231 100644
--- a/lldb/source/Core/DataFileCache.cpp
+++ b/lldb/source/Core/DataFileCache.cpp
@@ -132,6 +132,11 @@ bool DataFileCache::SetCachedData(llvm::StringRef key,
   if (file_or_err) {
 llvm::CachedFileStream *cfs = file_or_err->get();
 cfs->OS->write((const char *)data.data(), data.size());
+if (llvm::Error err = cfs->commit()) {
+  Log *log = GetLog(LLDBLog::Modules);
+  LLDB_LOG_ERROR(log, std::move(err),
+ "failed to commit to the cache for key: {0}");
+}
 return true;
   } else {
 Log *log = GetLog(LLDBLog::Modules);

diff  --git a/llvm/include/llvm/Support/Caching.h 
b/llvm/include/llvm/Support/Caching.h
index cf45145619d95..9a82921e6ffc7 100644
--- a/llvm/include/llvm/Support/Caching.h
+++ b/llvm/include/llvm/Support/Caching.h
@@ -24,15 +24,32 @@ class MemoryBuffer;
 /// This class wraps an output stream for a file. Most clients should just be
 /// able to return an instance of this base class from the stream callback, but
 /// if a client needs to perform some action after the stream is written to,
-/// that can be done by deriving from this class and overriding the destructor.
+/// that can be done by deriving from this class and overriding the destructor
+/// or the commit() method.
 class CachedFileStream {
 public:
   CachedFileStream(std::unique_ptr OS,
std::string OSPath = "")
   : OS(std::move(OS)), ObjectPathName(OSPath) {}
+
+  /// Must be called exactly once after the writes to OS have been completed
+  /// but before the CachedFileStream object is destroyed.
+  virtual Error commit() {
+if (Committed)
+  return createStringError(make_error_code(std::errc::invalid_argument),
+   Twine("CacheStream already committed."));
+Committed = true;
+
+return Error::success();
+  }
+
+  bool Committed = false;
   std::unique_ptr OS;
   std::string ObjectPathName;
-  virtual ~CachedFileStream() = default;
+  virtual ~CachedFileStream() {
+if (!Committed)
+  report_fatal_error("CachedFileStream was not committed.\n");
+  }
 };
 
 /// This type defines the callback to add a file that is generated on the fly.

diff  --git a/llvm/lib/CGData/CodeGenData.cpp b/llvm/lib/CGData/CodeGenData.cpp
index 02de528c4d007..7b9c584d64867 100644
--- a/llvm/lib/CGData/CodeGenData.cpp
+++ b/llvm/lib/CGData/CodeGenData.cpp
@@ -233,6 +233,9 @@ void saveModuleForTwoRounds(const Module &TheModule, 
unsigned Task,
 
   WriteBitcodeToFile(TheModule, *Stream->OS,
  /*ShouldPreserveUseListOrder=*/true);
+
+  if (Error Err = Stream->commit())
+report_fatal_error(std::move(Err));
 }
 
 std::unique_ptr loadModuleForTwoRounds(BitcodeModule &OrigModule,

diff  --git a/llvm/lib/Debuginfod/Debuginfod.cpp 
b/llvm/lib/Debuginfod/Debuginfod.cpp
index 4c

[Lldb-commits] [lldb] [llvm] Modify the localCache API to require an explicit commit on CachedFile… (PR #136121)

2025-04-22 Thread via lldb-commits

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


[Lldb-commits] [lldb] 3822633 - [lldb][docs] Repeat required Python version number

2025-04-22 Thread David Spickett via lldb-commits

Author: David Spickett
Date: 2025-04-22T08:53:01Z
New Revision: 382263376fcfed967f5bc17400d9e4542b37801c

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

LOG: [lldb][docs] Repeat required Python version number

We do say it in the table below but if you didn't
want any optional stuff you'd miss it.

Added: 


Modified: 
lldb/docs/resources/build.rst

Removed: 




diff  --git a/lldb/docs/resources/build.rst b/lldb/docs/resources/build.rst
index 9ba2405fc9628..e59dcc1972418 100644
--- a/lldb/docs/resources/build.rst
+++ b/lldb/docs/resources/build.rst
@@ -30,7 +30,7 @@ The following requirements are shared on all platforms.
 If you want to run the test suite, you'll need to build LLDB with Python
 scripting support.
 
-* `Python `_
+* `Python `_ 3.8 or later.
 * `SWIG `_ 4 or later.
 
 If you are on FreeBSD or NetBSD, you will need to install ``gmake`` for 
building



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


[Lldb-commits] [lldb] [lldb][AIX] get host info for AIX (PR #134354)

2025-04-22 Thread Pavel Labath via lldb-commits

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


[Lldb-commits] [lldb] [lldb][AIX] get host info for AIX (PR #134354)

2025-04-22 Thread Pavel Labath via lldb-commits


@@ -15,10 +15,10 @@ set (FILES
   XMLTest.cpp
 )
 
-if (CMAKE_SYSTEM_NAME MATCHES "Linux|Android")
+if (CMAKE_SYSTEM_NAME MATCHES "Linux|Android|AIX")

labath wrote:

```suggestion
if (UNIX)
```

If individual tests fail on some systems. We can disable them there.

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


[Lldb-commits] [lldb] [lldb][AIX] get host info for AIX (PR #134354)

2025-04-22 Thread Pavel Labath via lldb-commits


@@ -7,17 +7,135 @@
 
//===--===//
 
 #include "lldb/Host/Host.h"
+#include "lldb/Host/posix/Support.h"
+#include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/ProcessInfo.h"
 #include "lldb/Utility/Status.h"
+#include "llvm/BinaryFormat/XCOFF.h"
+#include 
+#include 
 
+using namespace llvm;
+using namespace lldb;
 using namespace lldb_private;
 
+namespace {
+enum class ProcessState {
+  Unknown,
+  Dead,
+  DiskSleep,
+  Idle,
+  Paging,
+  Parked,
+  Running,
+  Sleeping,
+  TracedOrStopped,
+  Zombie,
+};
+}
+
+ProcessInstanceInfo::timespec convert(pr_timestruc64_t t) {
+  ProcessInstanceInfo::timespec ts;
+  ts.tv_sec = t.tv_sec;
+  ts.tv_usec = t.tv_nsec / 1000; // nanos to micros
+  return ts;
+}
+
+static bool GetStatusInfo(::pid_t pid, ProcessInstanceInfo &processInfo,
+  ProcessState &State) {
+  struct pstatus pstatusData;
+  auto BufferOrError = getProcFile(pid, "status");
+  if (!BufferOrError)
+return false;
+
+  std::unique_ptr StatusBuffer = std::move(*BufferOrError);
+  // Ensure there's enough data for psinfoData
+  if (StatusBuffer->getBufferSize() < sizeof(pstatusData))
+return false;
+
+  std::memcpy(&pstatusData, StatusBuffer->getBufferStart(),
+  sizeof(pstatusData));
+  switch (pstatusData.pr_stat) {
+  case SIDL:
+State = ProcessState::Idle;
+break;
+  case SACTIVE:
+State = ProcessState::Running;
+break;
+  case SSTOP:
+State = ProcessState::TracedOrStopped;
+break;
+  case SZOMB:
+State = ProcessState::Zombie;
+break;
+  default:
+State = ProcessState::Unknown;
+break;
+  }
+  processInfo.SetIsZombie(State == ProcessState::Zombie);
+  processInfo.SetUserTime(convert(pstatusData.pr_utime));
+  processInfo.SetSystemTime(convert(pstatusData.pr_stime));
+  processInfo.SetCumulativeUserTime(convert(pstatusData.pr_cutime));
+  processInfo.SetCumulativeSystemTime(convert(pstatusData.pr_cstime));
+  return true;
+}
+
+static bool GetExePathAndIds(::pid_t pid, ProcessInstanceInfo &process_info) {
+  struct psinfo psinfoData;
+  auto BufferOrError = getProcFile(pid, "psinfo");
+  if (!BufferOrError)
+return false;
+
+  std::unique_ptr PsinfoBuffer = std::move(*BufferOrError);
+  // Ensure there's enough data for psinfoData
+  if (PsinfoBuffer->getBufferSize() < sizeof(psinfoData))
+return false;
+
+  std::memcpy(&psinfoData, PsinfoBuffer->getBufferStart(), sizeof(psinfoData));
+  llvm::StringRef PathRef(&(psinfoData.pr_psargs[0]));

labath wrote:

Is this guaranteed to be null-terminated (at least on linux, these kinds of 
fields do not get null-terminated when they're truncated). If it isn't, you may 
want to do something like `StringRef(psinfoData.pr_psargs, 
strnlen(psinfoData.pr_psargs, sizeof(psinfoData.pr_psargs))`

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


[Lldb-commits] [lldb] [lldb][AIX] get host info for AIX (PR #134354)

2025-04-22 Thread Pavel Labath via lldb-commits


@@ -7,21 +7,24 @@
 
//===--===//
 
 #include "lldb/Host/linux/Support.h"
+#include "lldb/Host/posix/Support.h"
 #include "llvm/Support/Threading.h"
 #include "gtest/gtest.h"
 
 using namespace lldb_private;
 
 TEST(Support, getProcFile_Pid) {
-  auto BufferOrError = getProcFile(getpid(), "maps");
+  auto BufferOrError = getProcFile(getpid(), "status");
   ASSERT_TRUE(BufferOrError);
   ASSERT_TRUE(*BufferOrError);
 }
 
+#ifndef _AIX
 #ifdef LLVM_ENABLE_THREADING
 TEST(Support, getProcFile_Tid) {
   auto BufferOrError = getProcFile(getpid(), llvm::get_threadid(), "comm");
   ASSERT_TRUE(BufferOrError);
   ASSERT_TRUE(*BufferOrError);
 }
 #endif /*ifdef LLVM_ENABLE_THREADING */
+#endif /*ifndef _AIX */

labath wrote:

Let's move this into lldb/unittests/Process/Linux/ProcfsTests.cpp since the 
function it's testing is also linux-specific.

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


[Lldb-commits] [lldb] [lldb][AIX] get host info for AIX (PR #134354)

2025-04-22 Thread Pavel Labath via lldb-commits

https://github.com/labath commented:

Looks pretty good. Just a couple of details.

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


[Lldb-commits] [lldb] [lldb][AIX] get host info for AIX (PR #134354)

2025-04-22 Thread Pavel Labath via lldb-commits


@@ -40,8 +40,9 @@ TEST_F(HostTest, GetProcessInfo) {
triple.getEnvironment() == llvm::Triple::EnvironmentType::Android));
 
   ProcessInstanceInfo Info;
+#ifndef _AIX

labath wrote:

Why is that? Does process zero exist on AIX?

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


[Lldb-commits] [lldb] [lldb][AIX] get host info for AIX (PR #134354)

2025-04-22 Thread Pavel Labath via lldb-commits


@@ -7,21 +7,24 @@
 
//===--===//
 
 #include "lldb/Host/linux/Support.h"
+#include "lldb/Host/posix/Support.h"
 #include "llvm/Support/Threading.h"
 #include "gtest/gtest.h"
 
 using namespace lldb_private;
 
 TEST(Support, getProcFile_Pid) {

labath wrote:

And then make this `#ifndef __APPLE__`, as that's the only OS which definitely 
doesn't have proc. It looks like the BSD should mostly have them. If it turns 
out to be  a problem, we opt them out as well.

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


[Lldb-commits] [lldb] [lldb][AIX] get host info for AIX (PR #134354)

2025-04-22 Thread Hemang Gadhavi via lldb-commits


@@ -40,8 +40,9 @@ TEST_F(HostTest, GetProcessInfo) {
triple.getEnvironment() == llvm::Triple::EnvironmentType::Android));
 
   ProcessInstanceInfo Info;
+#ifndef _AIX

HemangGadhavi wrote:

This process is basically for swapper/scheduling work. And yes its kernel 
process which is start after `init` only.
But that is sure we can not debugged/attached that process. 

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


[Lldb-commits] [lldb] [lldb] Use correct path for debugserver (PR #131609)

2025-04-22 Thread Pavel Labath via lldb-commits

labath wrote:

> > I can push the button for you if you could just update the patch 
> > description to what you'd like the commit message to say (in particular, I 
> > think the last paragraph is no longer correct).
> > As for cherry-picking, is this related to the lldb-server platform refactor 
> > in any way, or is it a separate problem that has always been there (I'm 
> > trying to figure out if this is a regression, at least for some cases)
> 
> Alright, I edited it. This is not related to the lldb-server platform 
> refactor, I get this issue even in Ubuntu's packaged lldb-server-19.

Got it. In that case, I'd probably go with not cherry-picking this since it's 
not a regression.

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


[Lldb-commits] [lldb] [lldb][AIX] get host info for AIX (PR #134354)

2025-04-22 Thread Hemang Gadhavi via lldb-commits


@@ -40,8 +40,9 @@ TEST_F(HostTest, GetProcessInfo) {
triple.getEnvironment() == llvm::Triple::EnvironmentType::Android));
 
   ProcessInstanceInfo Info;
+#ifndef _AIX

HemangGadhavi wrote:

Make sense. 
Thanks for the suggestion let me make the changes. 

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


[Lldb-commits] [lldb] [llvm] [lldb] Add new per-language frame-format variables for formatting function names (PR #131836)

2025-04-22 Thread Michael Buch via lldb-commits

Michael137 wrote:

`clang-format` failure is a false positive. I just copied a bunch of test-cases 
from the demangler test-suite and some of those happen to include the string 
`UndefValue::get` in them.

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


[Lldb-commits] [lldb] [lldb][AIX] get host info for AIX (PR #134354)

2025-04-22 Thread Pavel Labath via lldb-commits


@@ -40,8 +40,9 @@ TEST_F(HostTest, GetProcessInfo) {
triple.getEnvironment() == llvm::Triple::EnvironmentType::Android));
 
   ProcessInstanceInfo Info;
+#ifndef _AIX

labath wrote:

I see... Well, that could be a bit tricky (not just for this test, but in 
general), because lldb defines `LLDB_INVALID_PROCESS_ID` to be zero.

What can you tell me about this process? Is it some system/kernel process that 
runs before `init`? Can it even be debugged/attached to?

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


[Lldb-commits] [lldb] [llvm] Modify the localCache API to require an explicit commit on CachedFile… (PR #136121)

2025-04-22 Thread LLVM Continuous Integration via lldb-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `openmp-s390x-linux` 
running on `systemz-1` while building `lldb,llvm` at step 6 "test-openmp".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/88/builds/10746


Here is the relevant piece of the build log for the reference

```
Step 6 (test-openmp) failure: test (failure)
 TEST 'libomp :: tasking/issue-94260-2.c' FAILED 

Exit Code: -11

Command Output (stdout):
--
# RUN: at line 1
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/./bin/clang 
-fopenmp   -I 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/src
 -I 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/runtime/test 
-L 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/src
  -fno-omit-frame-pointer -mbackchain -I 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/runtime/test/ompt
 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/runtime/test/tasking/issue-94260-2.c
 -o 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/test/tasking/Output/issue-94260-2.c.tmp
 -lm -latomic && 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/test/tasking/Output/issue-94260-2.c.tmp
# executed command: 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/./bin/clang 
-fopenmp -I 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/src
 -I 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/runtime/test 
-L 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/src
 -fno-omit-frame-pointer -mbackchain -I 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/runtime/test/ompt
 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/runtime/test/tasking/issue-94260-2.c
 -o 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/test/tasking/Output/issue-94260-2.c.tmp
 -lm -latomic
# executed command: 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/test/tasking/Output/issue-94260-2.c.tmp
# note: command had no output on stdout or stderr
# error: command failed with exit status: -11

--




```



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


[Lldb-commits] [lldb] adb671e - [lldb] Clean up StartDebugserverProcess before I start refactoring it (#135342)

2025-04-22 Thread via lldb-commits

Author: Pavel Labath
Date: 2025-04-22T11:38:55+02:00
New Revision: adb671ea23af72c0fa1acd42103a5e9ca413d729

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

LOG: [lldb] Clean up StartDebugserverProcess before I start refactoring it 
(#135342)

- use early exits where possible
- avoid the listen thread by using Socket APIs which allow separate
"listen" and "accept" steps
- use formatv-like log statements

There "should" be no functional changes from this patch.

Added: 


Modified: 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h

Removed: 




diff  --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index 7fe5dd4827cfe..adedfa8ece917 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -15,7 +15,6 @@
 #include "lldb/Host/Pipe.h"
 #include "lldb/Host/ProcessLaunchInfo.h"
 #include "lldb/Host/Socket.h"
-#include "lldb/Host/ThreadLauncher.h"
 #include "lldb/Host/common/TCPSocket.h"
 #include "lldb/Host/posix/ConnectionFileDescriptorPosix.h"
 #include "lldb/Target/Platform.h"
@@ -27,10 +26,10 @@
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Config/llvm-config.h" // for LLVM_ENABLE_ZLIB
+#include "llvm/Support/Error.h"
 #include "llvm/Support/ScopedPrinter.h"
 #include 
 #include 
-#include 
 #include 
 
 #if defined(__APPLE__)
@@ -63,7 +62,7 @@ GDBRemoteCommunication::GDBRemoteCommunication()
 #endif
   m_echo_number(0), m_supports_qEcho(eLazyBoolCalculate), m_history(512),
   m_send_acks(true), m_is_platform(false),
-  m_compression_type(CompressionType::None), m_listen_url() {
+  m_compression_type(CompressionType::None) {
 }
 
 // Destructor
@@ -835,53 +834,6 @@ GDBRemoteCommunication::CheckForPacket(const uint8_t *src, 
size_t src_len,
   return GDBRemoteCommunication::PacketType::Invalid;
 }
 
-Status GDBRemoteCommunication::StartListenThread(const char *hostname,
- uint16_t port) {
-  if (m_listen_thread.IsJoinable())
-return Status::FromErrorString("listen thread already running");
-
-  char listen_url[512];
-  if (hostname && hostname[0])
-snprintf(listen_url, sizeof(listen_url), "listen://%s:%i", hostname, port);
-  else
-snprintf(listen_url, sizeof(listen_url), "listen://%i", port);
-  m_listen_url = listen_url;
-  SetConnection(std::make_unique());
-  llvm::Expected listen_thread = ThreadLauncher::LaunchThread(
-  listen_url, [this] { return GDBRemoteCommunication::ListenThread(); });
-  if (!listen_thread)
-return Status::FromError(listen_thread.takeError());
-  m_listen_thread = *listen_thread;
-
-  return Status();
-}
-
-bool GDBRemoteCommunication::JoinListenThread() {
-  if (m_listen_thread.IsJoinable())
-m_listen_thread.Join(nullptr);
-  return true;
-}
-
-lldb::thread_result_t GDBRemoteCommunication::ListenThread() {
-  Status error;
-  ConnectionFileDescriptor *connection =
-  (ConnectionFileDescriptor *)GetConnection();
-
-  if (connection) {
-// Do the listen on another thread so we can continue on...
-if (connection->Connect(
-m_listen_url.c_str(),
-[this](llvm::StringRef port_str) {
-  uint16_t port = 0;
-  llvm::to_integer(port_str, port, 10);
-  m_port_promise.set_value(port);
-},
-&error) != eConnectionStatusSuccess)
-  SetConnection(nullptr);
-  }
-  return {};
-}
-
 FileSpec GDBRemoteCommunication::GetDebugserverPath(Platform *platform) {
   Log *log = GetLog(GDBRLog::Process);
   // If we locate debugserver, keep that located version around
@@ -945,277 +897,242 @@ Status GDBRemoteCommunication::StartDebugserverProcess(
 const char *url, Platform *platform, ProcessLaunchInfo &launch_info,
 uint16_t *port, const Args *inferior_args, shared_fd_t pass_comm_fd) {
   Log *log = GetLog(GDBRLog::Process);
-  LLDB_LOGF(log, "GDBRemoteCommunication::%s(url=%s, port=%" PRIu16 ")",
-__FUNCTION__, url ? url : "", port ? *port : uint16_t(0));
+  LLDB_LOG(log, "Starting debug server: url={0}, port={1}",
+   url ? url : "", port ? *port : uint16_t(0));
 
-  Status error;
-  FileSpec &debugserver_file_spec = launch_info.GetExecutableFile();
-  if ((debugserver_file_spec = GetDebugserverPath(platform))) {
-std::string debugserver_path = debugserver_file_spec.GetPath();
+  FileSpec debugserver_file_spec = GetDebugserverPath(platform);
+  if (!debugserver_file_spec)
+return Status::FromErrorString("unable to locate " DEBUGSERVER_BASENAME);
 

[Lldb-commits] [lldb] [lldb] Clean up StartDebugserverProcess before I start refactoring it (PR #135342)

2025-04-22 Thread Pavel Labath via lldb-commits

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


[Lldb-commits] [lldb] a86f4ee - [lldb] Use correct path for debugserver (#131609)

2025-04-22 Thread via lldb-commits

Author: Yuval Deutscher
Date: 2025-04-22T11:43:23+02:00
New Revision: a86f4ee774e6d2eb9f38502ddda65842179a246a

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

LOG: [lldb] Use correct path for debugserver (#131609)

This solves an issue that arises when running lldb-server through a
symlink which is not named exactly `lldb-server`. For example, in many
distros lldb-server is packaged as e.g.
`/usr/lib/llvm-19/bin/lldb-server` which is then accessed through a
symlink such as `/usr/bin/lldb-server-19`.

It turns out that there is a cascade of bugs here:
* `GetShlibDir` attempts to locate the LLVM library directory by calling
`GetModuleFileSpecForHostAddress` on the address of the function
`ComputeSharedLibraryDirectory`, assuming that it is inside
`liblldb.so`. However, in every packaging I've seen of lldb-server the
function `ComputeSharedLibraryDirectory` is statically linked into the
`lldb-server` binary and is not in `liblldb.so`.
* When run through a symlink, `GetModuleFileSpecForHostAddress` on an
address that is in `lldb-server` returns the path of the symlink, not
the path of the binary itself. So we get e.g. `/usr/bin/` and not
`/usr/lib/llvm-19/bin/`.
* `GetDebugserverPath` attempts to concat `"lldb-server"` to the
directory we obtained, and thus fails when the symlink is not named
exactly `lldb-server`.
* Ironically, the reason that this works in the first place is precisely
because `GetModuleFileSpecForHostAddress` returns an incorrect path -
when the server is run as `lldb-server-19 ...` it returns
`"lldb-server-19"` which then causes `ComputePathRelativeToLibrary` to
fail and then `ComputeSupportExeDirectory` falls back to just using
`GetProgramFileSpec` instead (which is the only option that actually
yields a correct path).

Added: 


Modified: 

lldb/test/API/commands/platform/launchgdbserver/TestPlatformLaunchGDBServer.py
lldb/tools/lldb-server/SystemInitializerLLGS.h

Removed: 




diff  --git 
a/lldb/test/API/commands/platform/launchgdbserver/TestPlatformLaunchGDBServer.py
 
b/lldb/test/API/commands/platform/launchgdbserver/TestPlatformLaunchGDBServer.py
index c365bc993e338..ea846149e4983 100644
--- 
a/lldb/test/API/commands/platform/launchgdbserver/TestPlatformLaunchGDBServer.py
+++ 
b/lldb/test/API/commands/platform/launchgdbserver/TestPlatformLaunchGDBServer.py
@@ -58,3 +58,42 @@ def test_platform_process_launch_gdb_server(self):
 
 self.runCmd("target create {}".format(self.getBuildArtifact("a.out")))
 self.expect("run", substrs=["unable to launch a GDB server on"], 
error=True)
+
+@skipIfRemote
+@skipUnlessPlatform(["linux"])
+@add_test_categories(["lldb-server"])
+def test_lldb_server_weird_symlinks(self):
+self.build()
+
+hostname = socket.getaddrinfo("localhost", 0, 
proto=socket.IPPROTO_TCP)[0][4][0]
+listen_url = "[%s]:0" % hostname
+
+port_file = self.getBuildArtifact("port")
+commandline_args = [
+"platform",
+"--listen",
+listen_url,
+"--socket-file",
+port_file,
+]
+
+# Run lldb-server from a symlink without any binary called 
"lldb-server" in the directory.
+new_lldb_server = self.getBuildArtifact(
+"lldb-server-with-an-unconventional-name"
+)
+os.symlink(lldbgdbserverutils.get_lldb_server_exe(), new_lldb_server)
+
+proc = self.spawnSubprocess(new_lldb_server, commandline_args)
+socket_id = lldbutil.wait_for_file_on_target(self, port_file)
+
+new_platform = lldb.SBPlatform("remote-" + self.getPlatform())
+self.dbg.SetSelectedPlatform(new_platform)
+
+connect_url = "connect://[%s]:%s" % (hostname, socket_id)
+self.runCmd("platform connect %s" % connect_url)
+self.runCmd("target create {}".format(self.getBuildArtifact("a.out")))
+self.runCmd("run")
+self.expect(
+"process status",
+patterns=["Process .* exited with status = 0"],
+)

diff  --git a/lldb/tools/lldb-server/SystemInitializerLLGS.h 
b/lldb/tools/lldb-server/SystemInitializerLLGS.h
index 4469a8ba5f60a..c6020b0dd37da 100644
--- a/lldb/tools/lldb-server/SystemInitializerLLGS.h
+++ b/lldb/tools/lldb-server/SystemInitializerLLGS.h
@@ -11,10 +11,17 @@
 
 #include "lldb/Initialization/SystemInitializer.h"
 #include "lldb/Initialization/SystemInitializerCommon.h"
+#include "lldb/Utility/FileSpec.h"
 
 class SystemInitializerLLGS : public lldb_private::SystemInitializerCommon {
 public:
-  SystemInitializerLLGS() : SystemInitializerCommon(nullptr) {}
+  SystemInitializerLLGS()
+  : SystemInitializerCommon(
+// Finding the shared libraries directory on lldb-server is broken
+// sinc

[Lldb-commits] [lldb] [lldb] Use correct path for debugserver (PR #131609)

2025-04-22 Thread Pavel Labath via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Use correct path for debugserver (PR #131609)

2025-04-22 Thread via lldb-commits

github-actions[bot] wrote:



@yuvald-sweet-security 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/131609
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][AIX] get host info for AIX (PR #134354)

2025-04-22 Thread Hemang Gadhavi via lldb-commits


@@ -40,8 +40,9 @@ TEST_F(HostTest, GetProcessInfo) {
triple.getEnvironment() == llvm::Triple::EnvironmentType::Android));
 
   ProcessInstanceInfo Info;
+#ifndef _AIX

HemangGadhavi wrote:

Yes process zero exist on AIX. That is the reason disabled for AIX

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


[Lldb-commits] [lldb] a22ad65 - [lldb/cmake] Normalize use of HAVE_LIBCOMPRESSION (#135528)

2025-04-22 Thread via lldb-commits

Author: Pavel Labath
Date: 2025-04-22T10:14:03+02:00
New Revision: a22ad659cd0665669d89fae174f9e6a83d1a446d

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

LOG: [lldb/cmake] Normalize use of HAVE_LIBCOMPRESSION (#135528)

I *think* this was the reason behind the failures in
2fd860c1f559c0b0be66cc000e38270a04d0a1a3: the clang include tool showed
the Config.h headers as unused, and because the macro was referenced
through an `#ifdef`, its removal didn't cause build failures. Switching
to `#cmakedefine01` + `#if` should make sure this does not happen again.

According to D48977, the `#ifndef`+`#cmakedefine` patterns is due to
some files redefining the macro themselves. I no longer see any such
files in the source tree (there also were no files like that in the
source tree at the revision mentioned, but the macro *was* defined in
the hand-maintained XCode project we had at the time).

Added: 


Modified: 
lldb/include/lldb/Host/Config.h.cmake
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp

Removed: 




diff  --git a/lldb/include/lldb/Host/Config.h.cmake 
b/lldb/include/lldb/Host/Config.h.cmake
index 9e538534086a2..46e9a95781c32 100644
--- a/lldb/include/lldb/Host/Config.h.cmake
+++ b/lldb/include/lldb/Host/Config.h.cmake
@@ -23,9 +23,7 @@
 
 #cmakedefine01 HAVE_NR_PROCESS_VM_READV
 
-#ifndef HAVE_LIBCOMPRESSION
-#cmakedefine HAVE_LIBCOMPRESSION
-#endif
+#cmakedefine01 HAVE_LIBCOMPRESSION
 
 #cmakedefine01 LLDB_ENABLE_POSIX
 

diff  --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index abdc3da047dc7..7fe5dd4827cfe 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -41,7 +41,7 @@
 #define DEBUGSERVER_BASENAME "lldb-server"
 #endif
 
-#if defined(HAVE_LIBCOMPRESSION)
+#if HAVE_LIBCOMPRESSION
 #include 
 #endif
 
@@ -72,7 +72,7 @@ GDBRemoteCommunication::~GDBRemoteCommunication() {
 Disconnect();
   }
 
-#if defined(HAVE_LIBCOMPRESSION)
+#if HAVE_LIBCOMPRESSION
   if (m_decompression_scratch)
 free (m_decompression_scratch);
 #endif
@@ -509,7 +509,7 @@ bool GDBRemoteCommunication::DecompressPacket() {
 }
   }
 
-#if defined(HAVE_LIBCOMPRESSION)
+#if HAVE_LIBCOMPRESSION
   if (m_compression_type == CompressionType::ZlibDeflate ||
   m_compression_type == CompressionType::LZFSE ||
   m_compression_type == CompressionType::LZ4 ||

diff  --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
index 3565a73f19586..387ad0f65bdea 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
@@ -214,7 +214,7 @@ class GDBRemoteCommunication : public Communication {
   HostThread m_listen_thread;
   std::string m_listen_url;
 
-#if defined(HAVE_LIBCOMPRESSION)
+#if HAVE_LIBCOMPRESSION
   CompressionType m_decompression_scratch_type = CompressionType::None;
   void *m_decompression_scratch = nullptr;
 #endif

diff  --git 
a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index 501670d62e75b..748f95c61cd3c 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -41,7 +41,7 @@
 #include "llvm/Config/llvm-config.h" // for LLVM_ENABLE_ZLIB
 #include "llvm/Support/JSON.h"
 
-#if defined(HAVE_LIBCOMPRESSION)
+#if HAVE_LIBCOMPRESSION
 #include 
 #endif
 
@@ -1104,7 +1104,7 @@ void GDBRemoteCommunicationClient::MaybeEnableCompression(
   CompressionType avail_type = CompressionType::None;
   llvm::StringRef avail_name;
 
-#if defined(HAVE_LIBCOMPRESSION)
+#if HAVE_LIBCOMPRESSION
   if (avail_type == CompressionType::None) {
 for (auto compression : supported_compressions) {
   if (compression == "lzfse") {
@@ -1114,9 +1114,6 @@ void GDBRemoteCommunicationClient::MaybeEnableCompression(
   }
 }
   }
-#endif
-
-#if defined(HAVE_LIBCOMPRESSION)
   if (avail_type == CompressionType::None) {
 for (auto compression : supported_compressions) {
   if (compression == "zlib-deflate") {
@@ -1140,7 +1137,7 @@ void GDBRemoteCommunicationClient::MaybeEnableCompression(
   }
 #endif
 
-#if defined(HAVE_LIBCOMPRESSION)
+#if HAVE_LIBCOMPRESSION
   if (avail_type == CompressionType::None) {
 for (auto compression : supported_compressions) {
   

[Lldb-commits] [lldb] [lldb/cmake] Normalize use of HAVE_LIBCOMPRESSION (PR #135528)

2025-04-22 Thread Pavel Labath via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Clean up StartDebugserverProcess before I start refactoring it (PR #135342)

2025-04-22 Thread Pavel Labath via lldb-commits

https://github.com/labath updated 
https://github.com/llvm/llvm-project/pull/135342

>From 932830b169fd28f536382639a2bc46482962866d Mon Sep 17 00:00:00 2001
From: Pavel Labath 
Date: Fri, 11 Apr 2025 12:06:15 +0200
Subject: [PATCH] [lldb] Clean up StartDebugserverProcess before I start
 refactoring it

- use early exits where possible
- avoid the listen thread by using Socket APIs which allow separate
  "listen" and "accept" steps
- use formatv-like log statements

There "should" be no functional changes from this patch.
---
 .../gdb-remote/GDBRemoteCommunication.cpp | 481 --
 .../gdb-remote/GDBRemoteCommunication.h   |  15 -
 2 files changed, 199 insertions(+), 297 deletions(-)

diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index 7fe5dd4827cfe..adedfa8ece917 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -15,7 +15,6 @@
 #include "lldb/Host/Pipe.h"
 #include "lldb/Host/ProcessLaunchInfo.h"
 #include "lldb/Host/Socket.h"
-#include "lldb/Host/ThreadLauncher.h"
 #include "lldb/Host/common/TCPSocket.h"
 #include "lldb/Host/posix/ConnectionFileDescriptorPosix.h"
 #include "lldb/Target/Platform.h"
@@ -27,10 +26,10 @@
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Config/llvm-config.h" // for LLVM_ENABLE_ZLIB
+#include "llvm/Support/Error.h"
 #include "llvm/Support/ScopedPrinter.h"
 #include 
 #include 
-#include 
 #include 
 
 #if defined(__APPLE__)
@@ -63,7 +62,7 @@ GDBRemoteCommunication::GDBRemoteCommunication()
 #endif
   m_echo_number(0), m_supports_qEcho(eLazyBoolCalculate), m_history(512),
   m_send_acks(true), m_is_platform(false),
-  m_compression_type(CompressionType::None), m_listen_url() {
+  m_compression_type(CompressionType::None) {
 }
 
 // Destructor
@@ -835,53 +834,6 @@ GDBRemoteCommunication::CheckForPacket(const uint8_t *src, 
size_t src_len,
   return GDBRemoteCommunication::PacketType::Invalid;
 }
 
-Status GDBRemoteCommunication::StartListenThread(const char *hostname,
- uint16_t port) {
-  if (m_listen_thread.IsJoinable())
-return Status::FromErrorString("listen thread already running");
-
-  char listen_url[512];
-  if (hostname && hostname[0])
-snprintf(listen_url, sizeof(listen_url), "listen://%s:%i", hostname, port);
-  else
-snprintf(listen_url, sizeof(listen_url), "listen://%i", port);
-  m_listen_url = listen_url;
-  SetConnection(std::make_unique());
-  llvm::Expected listen_thread = ThreadLauncher::LaunchThread(
-  listen_url, [this] { return GDBRemoteCommunication::ListenThread(); });
-  if (!listen_thread)
-return Status::FromError(listen_thread.takeError());
-  m_listen_thread = *listen_thread;
-
-  return Status();
-}
-
-bool GDBRemoteCommunication::JoinListenThread() {
-  if (m_listen_thread.IsJoinable())
-m_listen_thread.Join(nullptr);
-  return true;
-}
-
-lldb::thread_result_t GDBRemoteCommunication::ListenThread() {
-  Status error;
-  ConnectionFileDescriptor *connection =
-  (ConnectionFileDescriptor *)GetConnection();
-
-  if (connection) {
-// Do the listen on another thread so we can continue on...
-if (connection->Connect(
-m_listen_url.c_str(),
-[this](llvm::StringRef port_str) {
-  uint16_t port = 0;
-  llvm::to_integer(port_str, port, 10);
-  m_port_promise.set_value(port);
-},
-&error) != eConnectionStatusSuccess)
-  SetConnection(nullptr);
-  }
-  return {};
-}
-
 FileSpec GDBRemoteCommunication::GetDebugserverPath(Platform *platform) {
   Log *log = GetLog(GDBRLog::Process);
   // If we locate debugserver, keep that located version around
@@ -945,277 +897,242 @@ Status GDBRemoteCommunication::StartDebugserverProcess(
 const char *url, Platform *platform, ProcessLaunchInfo &launch_info,
 uint16_t *port, const Args *inferior_args, shared_fd_t pass_comm_fd) {
   Log *log = GetLog(GDBRLog::Process);
-  LLDB_LOGF(log, "GDBRemoteCommunication::%s(url=%s, port=%" PRIu16 ")",
-__FUNCTION__, url ? url : "", port ? *port : uint16_t(0));
+  LLDB_LOG(log, "Starting debug server: url={0}, port={1}",
+   url ? url : "", port ? *port : uint16_t(0));
 
-  Status error;
-  FileSpec &debugserver_file_spec = launch_info.GetExecutableFile();
-  if ((debugserver_file_spec = GetDebugserverPath(platform))) {
-std::string debugserver_path = debugserver_file_spec.GetPath();
+  FileSpec debugserver_file_spec = GetDebugserverPath(platform);
+  if (!debugserver_file_spec)
+return Status::FromErrorString("unable to locate " DEBUGSERVER_BASENAME);
 
-Args &debugserver_args = launch_info.GetArguments();
-debugserver_args.Clear();
+  std::string debugserver_path = debugserver_file_spec.GetPath();

[Lldb-commits] [lldb] [lldb] Fix crash after second run when set a previous watchpoint. (PR #136682)

2025-04-22 Thread via lldb-commits

hapee wrote:

 @jasonmolenda Please review this commit.

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


[Lldb-commits] [lldb] 616e8cc - Revert "[lldb] Use correct path for debugserver (#131609)"

2025-04-22 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2025-04-22T15:35:53+02:00
New Revision: 616e8cc1fa0319819aa6978af0af9a3e4896103a

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

LOG: Revert "[lldb] Use correct path for debugserver (#131609)"

This reverts commit a86f4ee774e6d2eb9f38502ddda65842179a246a and the fixup in
587206a442ebb656f9d72e7e0cc5845ef3a2f7ed because brakage on macos
(TestAutoInstallMainExecutable.py).

Added: 


Modified: 

lldb/test/API/commands/platform/launchgdbserver/TestPlatformLaunchGDBServer.py
lldb/tools/lldb-server/SystemInitializerLLGS.h

Removed: 




diff  --git 
a/lldb/test/API/commands/platform/launchgdbserver/TestPlatformLaunchGDBServer.py
 
b/lldb/test/API/commands/platform/launchgdbserver/TestPlatformLaunchGDBServer.py
index 584879d3e723a..c365bc993e338 100644
--- 
a/lldb/test/API/commands/platform/launchgdbserver/TestPlatformLaunchGDBServer.py
+++ 
b/lldb/test/API/commands/platform/launchgdbserver/TestPlatformLaunchGDBServer.py
@@ -58,45 +58,3 @@ def test_platform_process_launch_gdb_server(self):
 
 self.runCmd("target create {}".format(self.getBuildArtifact("a.out")))
 self.expect("run", substrs=["unable to launch a GDB server on"], 
error=True)
-
-@skipIfRemote
-@skipUnlessPlatform(["linux"])
-@add_test_categories(["lldb-server"])
-def test_lldb_server_weird_symlinks(self):
-self.build()
-
-hostname = socket.getaddrinfo("localhost", 0, 
proto=socket.IPPROTO_TCP)[0][4][0]
-listen_url = "[%s]:0" % hostname
-
-port_file = self.getBuildArtifact("port")
-commandline_args = [
-"platform",
-"--listen",
-listen_url,
-"--socket-file",
-port_file,
-]
-
-# Run lldb-server from a symlink without any binary called 
"lldb-server" in the directory.
-new_lldb_server = self.getBuildArtifact(
-"lldb-server-with-an-unconventional-name"
-)
-os.symlink(lldbgdbserverutils.get_lldb_server_exe(), new_lldb_server)
-
-proc = self.spawnSubprocess(new_lldb_server, commandline_args)
-socket_id = lldbutil.wait_for_file_on_target(self, port_file)
-
-new_platform = lldb.SBPlatform("remote-" + self.getPlatform())
-self.dbg.SetSelectedPlatform(new_platform)
-
-connect_url = "connect://[%s]:%s" % (hostname, socket_id)
-self.runCmd("platform connect %s" % connect_url)
-wd = self.getBuildArtifact("wd")
-self.assertSuccess(new_platform.MakeDirectory(wd))
-new_platform.SetWorkingDirectory(wd)
-self.runCmd("target create {}".format(self.getBuildArtifact("a.out")))
-self.runCmd("run")
-self.expect(
-"process status",
-patterns=["Process .* exited with status = 0"],
-)

diff  --git a/lldb/tools/lldb-server/SystemInitializerLLGS.h 
b/lldb/tools/lldb-server/SystemInitializerLLGS.h
index c6020b0dd37da..4469a8ba5f60a 100644
--- a/lldb/tools/lldb-server/SystemInitializerLLGS.h
+++ b/lldb/tools/lldb-server/SystemInitializerLLGS.h
@@ -11,17 +11,10 @@
 
 #include "lldb/Initialization/SystemInitializer.h"
 #include "lldb/Initialization/SystemInitializerCommon.h"
-#include "lldb/Utility/FileSpec.h"
 
 class SystemInitializerLLGS : public lldb_private::SystemInitializerCommon {
 public:
-  SystemInitializerLLGS()
-  : SystemInitializerCommon(
-// Finding the shared libraries directory on lldb-server is broken
-// since lldb-server isn't dynamically linked with liblldb.so.
-// Clearing the filespec here causes GetShlibDir to fail and
-// GetSupportExeDir to fall-back to using the binary path instead.
-[](lldb_private::FileSpec &file) { file.Clear(); }) {}
+  SystemInitializerLLGS() : SystemInitializerCommon(nullptr) {}
 
   llvm::Error Initialize() override;
   void Terminate() override;



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


[Lldb-commits] [lldb] [lldb] Upgrade `GetIndexOfChildWithName` to use `llvm::Expected` (PR #136693)

2025-04-22 Thread Charles Zablit via lldb-commits

https://github.com/charles-zablit created 
https://github.com/llvm/llvm-project/pull/136693

This patch replaces the use of `UINT32_MAX` as the error return value of 
`GetIndexOfChildWithName` with `llvm::Expected`.

>From 143140ca46927e87019dcc818702785ebdb15540 Mon Sep 17 00:00:00 2001
From: Charles Zablit 
Date: Tue, 22 Apr 2025 12:09:02 +0100
Subject: [PATCH] [lldb] Upgrade GetIndexOfChildWithName to use llvm::Expected

---
 lldb/include/lldb/API/SBValue.h   |  2 +
 .../lldb/DataFormatters/TypeSynthetic.h   | 11 ++--
 .../lldb/DataFormatters/VectorIterator.h  |  2 +-
 .../lldb/Interpreter/ScriptInterpreter.h  |  5 +-
 lldb/include/lldb/Symbol/CompilerType.h   |  5 +-
 lldb/include/lldb/Symbol/TypeSystem.h |  7 ++-
 lldb/include/lldb/ValueObject/ValueObject.h   |  2 +-
 .../lldb/ValueObject/ValueObjectRegister.h|  2 +-
 .../ValueObject/ValueObjectSyntheticFilter.h  |  2 +-
 lldb/source/API/SBValue.cpp   | 10 +++-
 .../DataFormatters/FormatterBytecode.cpp  |  9 ++-
 lldb/source/DataFormatters/TypeSynthetic.cpp  |  9 +--
 lldb/source/DataFormatters/VectorType.cpp |  5 +-
 .../Language/CPlusPlus/BlockPointer.cpp   | 16 --
 .../Plugins/Language/CPlusPlus/Coroutines.cpp |  9 ++-
 .../Plugins/Language/CPlusPlus/Coroutines.h   |  2 +-
 .../Language/CPlusPlus/GenericBitset.cpp  |  2 +-
 .../Language/CPlusPlus/GenericOptional.cpp|  2 +-
 .../Plugins/Language/CPlusPlus/LibCxx.cpp | 14 +++--
 .../Plugins/Language/CPlusPlus/LibCxx.h   |  4 +-
 .../Language/CPlusPlus/LibCxxAtomic.cpp   | 11 +++-
 .../CPlusPlus/LibCxxInitializerList.cpp   |  5 +-
 .../Plugins/Language/CPlusPlus/LibCxxList.cpp |  2 +-
 .../Plugins/Language/CPlusPlus/LibCxxMap.cpp  | 12 ++--
 .../Language/CPlusPlus/LibCxxProxyArray.cpp   |  5 +-
 .../Language/CPlusPlus/LibCxxQueue.cpp|  9 ++-
 .../CPlusPlus/LibCxxRangesRefView.cpp |  2 +-
 .../Language/CPlusPlus/LibCxxSliceArray.cpp   |  8 ++-
 .../Plugins/Language/CPlusPlus/LibCxxSpan.cpp |  9 +--
 .../Language/CPlusPlus/LibCxxTuple.cpp|  2 +-
 .../Language/CPlusPlus/LibCxxUnorderedMap.cpp | 13 +++--
 .../Language/CPlusPlus/LibCxxValarray.cpp |  8 ++-
 .../Language/CPlusPlus/LibCxxVariant.cpp  |  9 ++-
 .../Language/CPlusPlus/LibCxxVector.cpp   | 16 --
 .../Plugins/Language/CPlusPlus/LibStdcpp.cpp  | 25 
 .../Language/CPlusPlus/LibStdcppTuple.cpp |  6 +-
 .../CPlusPlus/LibStdcppUniquePointer.cpp  |  9 +--
 lldb/source/Plugins/Language/ObjC/Cocoa.cpp   |  5 +-
 lldb/source/Plugins/Language/ObjC/NSArray.cpp | 23 
 .../Plugins/Language/ObjC/NSDictionary.cpp| 57 +++
 lldb/source/Plugins/Language/ObjC/NSError.cpp |  5 +-
 .../Plugins/Language/ObjC/NSException.cpp |  5 +-
 .../Plugins/Language/ObjC/NSIndexPath.cpp |  5 +-
 lldb/source/Plugins/Language/ObjC/NSSet.cpp   | 25 
 .../Python/ScriptInterpreterPython.cpp| 16 --
 .../Python/ScriptInterpreterPythonImpl.h  |  5 +-
 .../TypeSystem/Clang/TypeSystemClang.cpp  |  2 +-
 .../TypeSystem/Clang/TypeSystemClang.h|  7 ++-
 lldb/source/Symbol/CompilerType.cpp   |  5 +-
 lldb/source/ValueObject/ValueObject.cpp   |  3 +-
 .../ValueObject/ValueObjectRegister.cpp   |  6 +-
 .../ValueObjectSyntheticFilter.cpp| 37 ++--
 52 files changed, 286 insertions(+), 191 deletions(-)

diff --git a/lldb/include/lldb/API/SBValue.h b/lldb/include/lldb/API/SBValue.h
index 75d20a4378f09..69c50ab038e5b 100644
--- a/lldb/include/lldb/API/SBValue.h
+++ b/lldb/include/lldb/API/SBValue.h
@@ -13,6 +13,8 @@
 #include "lldb/API/SBDefines.h"
 #include "lldb/API/SBType.h"
 
+#include "lldb/Core/Value.h"
+
 class ValueImpl;
 class ValueLocker;
 
diff --git a/lldb/include/lldb/DataFormatters/TypeSynthetic.h 
b/lldb/include/lldb/DataFormatters/TypeSynthetic.h
index 14e516964f250..a132c63a93b08 100644
--- a/lldb/include/lldb/DataFormatters/TypeSynthetic.h
+++ b/lldb/include/lldb/DataFormatters/TypeSynthetic.h
@@ -51,7 +51,7 @@ class SyntheticChildrenFrontEnd {
 
   virtual lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) = 0;
 
-  virtual size_t GetIndexOfChildWithName(ConstString name) = 0;
+  virtual llvm::Expected GetIndexOfChildWithName(ConstString name) = 0;
 
   /// This function is assumed to always succeed and if it fails, the front-end
   /// should know to deal with it in the correct way (most probably, by 
refusing
@@ -117,8 +117,9 @@ class SyntheticValueProviderFrontEnd : public 
SyntheticChildrenFrontEnd {
 
   lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override { return nullptr; 
}
 
-  size_t GetIndexOfChildWithName(ConstString name) override {
-return UINT32_MAX;
+  llvm::Expected GetIndexOfChildWithName(ConstString name) override {
+return llvm::createStringError("Cannot find index of child '%s'",
+   name.AsCString());
   }
 
   lldb::ChildCacheState Update() override {
@@ -343

[Lldb-commits] [lldb] [lldb] Add symbol/table count into statistics (PR #136226)

2025-04-22 Thread Omair Javaid via lldb-commits

omjavaid wrote:

the reported number of symbols is zero on Windows

   "symbolsLoaded": 0,
  ...
},
...
  ],
  ...
  "totalSymbolTablesLoaded": 0,
  "totalSymbolsLoaded": 0
}

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


[Lldb-commits] [lldb] [lldb/DWARF] Remove "range lower than function low_pc" check (PR #132395)

2025-04-22 Thread David Spickett via lldb-commits

DavidSpickett wrote:

I think this relates to:
> 2.17 Code Addresses, Ranges and Base Addresses
> <...>
> The base address of the scope for any of the debugging information entries 
> listed
> above is given by either the DW_AT_low_pc attribute or the first address in 
> the
> first range entry in the list of ranges given by the DW_AT_ranges attribute. 
> If
> there is no such attribute, the base address is undefined.

(https://dwarfstd.org/doc/DWARF5.pdf)

I'm just guessing here that the functions you refer to have both. It doesn't 
say which should win, but we can take "or" to mean "whichever actually makes 
sense", and in these cases you'd assume that low_pc is maybe the entry point of 
the function not the actual lowest PC value some block of it sits at.

Is that roughly the logic of this change? Sounds like the check itself was not 
100% correct to begin with, perhaps it was for some previous standard version.

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


[Lldb-commits] [lldb] [lldb/DWARF] Remove "range lower than function low_pc" check (PR #132395)

2025-04-22 Thread David Spickett via lldb-commits

DavidSpickett wrote:

> In particular the dynamic loader in the next debian release (trixie) has 
> functions like this which means that lldb spews a bunch warning when 
> debugging pretty much any binary

If you add this to the PR description, anyone downstream of us seeing this 
error will have an easier time finding out that we fixed it.

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


[Lldb-commits] [lldb] [lldb] Upgrade `GetIndexOfChildWithName` to use `llvm::Expected` (PR #136693)

2025-04-22 Thread Michael Buch via lldb-commits


@@ -488,10 +488,12 @@ 
lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEnd::GetChildAtIndex(
   return m_pair_sp->GetChildAtIndex(idx);
 }
 
-size_t lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEnd::
+llvm::Expected
+lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEnd::
 GetIndexOfChildWithName(ConstString name) {
   if (!m_pair_sp)
-return UINT32_MAX;
+return llvm::createStringError("Cannot find index of child '%s'",
+   name.AsCString());

Michael137 wrote:

Lets add to the error message that we have an invalid underlying pair

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


[Lldb-commits] [lldb] [lldb] Upgrade `GetIndexOfChildWithName` to use `llvm::Expected` (PR #136693)

2025-04-22 Thread Michael Buch via lldb-commits


@@ -319,40 +319,41 @@ 
ValueObjectSynthetic::GetChildMemberWithName(llvm::StringRef name,
  bool can_create) {
   UpdateValueIfNeeded();
 
-  uint32_t index = GetIndexOfChildWithName(name);
+  auto index_or_err = GetIndexOfChildWithName(name);
 
-  if (index == UINT32_MAX)
+  if (!index_or_err)
 return lldb::ValueObjectSP();
 
-  return GetChildAtIndex(index, can_create);
+  return GetChildAtIndex(*index_or_err, can_create);
 }
 
-size_t ValueObjectSynthetic::GetIndexOfChildWithName(llvm::StringRef name_ref) 
{
+llvm::Expected
+ValueObjectSynthetic::GetIndexOfChildWithName(llvm::StringRef name_ref) {
   UpdateValueIfNeeded();
 
   ConstString name(name_ref);
 
-  uint32_t found_index = UINT32_MAX;
-  bool did_find;
+  std::optional found_index = std::nullopt;
   {
 std::lock_guard guard(m_child_mutex);
 auto name_to_index = m_name_toindex.find(name.GetCString());
-did_find = name_to_index != m_name_toindex.end();
-if (did_find)
+if (name_to_index != m_name_toindex.end())
   found_index = name_to_index->second;
   }
 
-  if (!did_find && m_synth_filter_up != nullptr) {
-uint32_t index = m_synth_filter_up->GetIndexOfChildWithName(name);
-if (index == UINT32_MAX)
-  return index;
+  if (!found_index.has_value() && m_synth_filter_up != nullptr) {
+auto index_or_err = m_synth_filter_up->GetIndexOfChildWithName(name);
+if (!index_or_err)
+  return llvm::createStringError("Cannot find index of child '%s'",
+ name.AsCString());

Michael137 wrote:

```suggestion
  return index_or_err.takeError();
```

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


[Lldb-commits] [lldb] [lldb] Upgrade `GetIndexOfChildWithName` to use `llvm::Expected` (PR #136693)

2025-04-22 Thread Michael Buch via lldb-commits


@@ -173,7 +173,8 @@ 
lldb_private::formatters::LibcxxStdProxyArraySyntheticFrontEnd::Update() {
   return ChildCacheState::eRefetch;
 }
 
-size_t lldb_private::formatters::LibcxxStdProxyArraySyntheticFrontEnd::
+llvm::Expected
+lldb_private::formatters::LibcxxStdProxyArraySyntheticFrontEnd::
 GetIndexOfChildWithName(ConstString name) {
   if (!m_base)
 return std::numeric_limits::max();

Michael137 wrote:

This should return an error

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


[Lldb-commits] [lldb] [lldb] Upgrade `GetIndexOfChildWithName` to use `llvm::Expected` (PR #136693)

2025-04-22 Thread Michael Buch via lldb-commits


@@ -319,40 +319,41 @@ 
ValueObjectSynthetic::GetChildMemberWithName(llvm::StringRef name,
  bool can_create) {
   UpdateValueIfNeeded();
 
-  uint32_t index = GetIndexOfChildWithName(name);
+  auto index_or_err = GetIndexOfChildWithName(name);
 
-  if (index == UINT32_MAX)
+  if (!index_or_err)

Michael137 wrote:

need to use `llvm::consumeError` here

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


[Lldb-commits] [lldb] [lldb] Upgrade `GetIndexOfChildWithName` to use `llvm::Expected` (PR #136693)

2025-04-22 Thread Michael Buch via lldb-commits


@@ -1045,12 +1052,14 @@ 
lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd<
 }
 
 template 
-size_t lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd<
+llvm::Expected
+lldb_private::formatters::GenericNSDictionaryMSyntheticFrontEnd<
 D32, D64>::GetIndexOfChildWithName(ConstString name) {
   const char *item_name = name.GetCString();
   uint32_t idx = ExtractIndexFromString(item_name);
   if (idx < UINT32_MAX && idx >= CalculateNumChildrenIgnoringErrors())
-return UINT32_MAX;
+return llvm::createStringError("Cannot find index of child '%s'",

Michael137 wrote:

I expect this function to get some cleanup once `ExtractIndexFromString` 
returns `llvm::Expected`

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


[Lldb-commits] [lldb] [lldb] Upgrade `GetIndexOfChildWithName` to use `llvm::Expected` (PR #136693)

2025-04-22 Thread Michael Buch via lldb-commits


@@ -319,40 +319,41 @@ 
ValueObjectSynthetic::GetChildMemberWithName(llvm::StringRef name,
  bool can_create) {
   UpdateValueIfNeeded();
 
-  uint32_t index = GetIndexOfChildWithName(name);
+  auto index_or_err = GetIndexOfChildWithName(name);
 
-  if (index == UINT32_MAX)
+  if (!index_or_err)
 return lldb::ValueObjectSP();
 
-  return GetChildAtIndex(index, can_create);
+  return GetChildAtIndex(*index_or_err, can_create);
 }
 
-size_t ValueObjectSynthetic::GetIndexOfChildWithName(llvm::StringRef name_ref) 
{
+llvm::Expected
+ValueObjectSynthetic::GetIndexOfChildWithName(llvm::StringRef name_ref) {
   UpdateValueIfNeeded();
 
   ConstString name(name_ref);
 
-  uint32_t found_index = UINT32_MAX;
-  bool did_find;
+  std::optional found_index = std::nullopt;
   {
 std::lock_guard guard(m_child_mutex);
 auto name_to_index = m_name_toindex.find(name.GetCString());
-did_find = name_to_index != m_name_toindex.end();
-if (did_find)
+if (name_to_index != m_name_toindex.end())
   found_index = name_to_index->second;
   }
 
-  if (!did_find && m_synth_filter_up != nullptr) {
-uint32_t index = m_synth_filter_up->GetIndexOfChildWithName(name);
-if (index == UINT32_MAX)
-  return index;
+  if (!found_index.has_value() && m_synth_filter_up != nullptr) {
+auto index_or_err = m_synth_filter_up->GetIndexOfChildWithName(name);
+if (!index_or_err)
+  return llvm::createStringError("Cannot find index of child '%s'",
+ name.AsCString());
 std::lock_guard guard(m_child_mutex);
-m_name_toindex[name.GetCString()] = index;
-return index;
-  } else if (!did_find && m_synth_filter_up == nullptr)
-return UINT32_MAX;
+m_name_toindex[name.GetCString()] = *index_or_err;
+return *index_or_err;
+  } else if (!found_index.has_value() && m_synth_filter_up == nullptr)

Michael137 wrote:

```suggestion
  } else if (!found_index && m_synth_filter_up == nullptr)
```

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


[Lldb-commits] [lldb] [lldb] Upgrade `GetIndexOfChildWithName` to use `llvm::Expected` (PR #136693)

2025-04-22 Thread Michael Buch via lldb-commits


@@ -248,14 +249,17 @@ 
lldb_private::formatters::LibcxxVectorBoolSyntheticFrontEnd::Update() {
   return lldb::ChildCacheState::eRefetch;
 }
 
-size_t lldb_private::formatters::LibcxxVectorBoolSyntheticFrontEnd::
+llvm::Expected
+lldb_private::formatters::LibcxxVectorBoolSyntheticFrontEnd::
 GetIndexOfChildWithName(ConstString name) {
   if (!m_count || !m_base_data_address)
-return UINT32_MAX;
+return llvm::createStringError("Cannot find index of child '%s'",
+   name.AsCString());
   const char *item_name = name.GetCString();
   uint32_t idx = ExtractIndexFromString(item_name);
   if (idx < UINT32_MAX && idx >= CalculateNumChildrenIgnoringErrors())
-return UINT32_MAX;
+return llvm::createStringError("Cannot find index of child '%s'",

Michael137 wrote:

I expect this function to get some cleanup once `ExtractIndexFromString` 
returns `llvm::Expected`

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


[Lldb-commits] [lldb] [lldb] Upgrade `GetIndexOfChildWithName` to use `llvm::Expected` (PR #136693)

2025-04-22 Thread Michael Buch via lldb-commits


@@ -319,40 +319,41 @@ 
ValueObjectSynthetic::GetChildMemberWithName(llvm::StringRef name,
  bool can_create) {
   UpdateValueIfNeeded();
 
-  uint32_t index = GetIndexOfChildWithName(name);
+  auto index_or_err = GetIndexOfChildWithName(name);
 
-  if (index == UINT32_MAX)
+  if (!index_or_err)
 return lldb::ValueObjectSP();
 
-  return GetChildAtIndex(index, can_create);
+  return GetChildAtIndex(*index_or_err, can_create);
 }
 
-size_t ValueObjectSynthetic::GetIndexOfChildWithName(llvm::StringRef name_ref) 
{
+llvm::Expected
+ValueObjectSynthetic::GetIndexOfChildWithName(llvm::StringRef name_ref) {
   UpdateValueIfNeeded();
 
   ConstString name(name_ref);
 
-  uint32_t found_index = UINT32_MAX;
-  bool did_find;
+  std::optional found_index = std::nullopt;
   {
 std::lock_guard guard(m_child_mutex);
 auto name_to_index = m_name_toindex.find(name.GetCString());
-did_find = name_to_index != m_name_toindex.end();
-if (did_find)
+if (name_to_index != m_name_toindex.end())
   found_index = name_to_index->second;
   }
 
-  if (!did_find && m_synth_filter_up != nullptr) {
-uint32_t index = m_synth_filter_up->GetIndexOfChildWithName(name);
-if (index == UINT32_MAX)
-  return index;
+  if (!found_index.has_value() && m_synth_filter_up != nullptr) {
+auto index_or_err = m_synth_filter_up->GetIndexOfChildWithName(name);
+if (!index_or_err)
+  return llvm::createStringError("Cannot find index of child '%s'",
+ name.AsCString());
 std::lock_guard guard(m_child_mutex);
-m_name_toindex[name.GetCString()] = index;
-return index;
-  } else if (!did_find && m_synth_filter_up == nullptr)
-return UINT32_MAX;
+m_name_toindex[name.GetCString()] = *index_or_err;
+return *index_or_err;
+  } else if (!found_index.has_value() && m_synth_filter_up == nullptr)
+return llvm::createStringError("Cannot find index of child '%s'",
+   name.AsCString());
   else /*if (iter != m_name_toindex.end())*/
-return found_index;
+return found_index.value();

Michael137 wrote:

```suggestion
return *found_index;
```

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


[Lldb-commits] [lldb] [lldb] Upgrade `GetIndexOfChildWithName` to use `llvm::Expected` (PR #136693)

2025-04-22 Thread Michael Buch via lldb-commits


@@ -612,9 +611,9 @@ 
lldb_private::formatters::GenericNSArrayISyntheticFrontEnd::
 }
 
 template 
-size_t
-lldb_private::formatters::GenericNSArrayISyntheticFrontEnd::
-  GetIndexOfChildWithName(ConstString name) {
+llvm::Expected
+lldb_private::formatters::GenericNSArrayISyntheticFrontEnd<
+D32, D64, Inline>::GetIndexOfChildWithName(ConstString name) {
   const char *item_name = name.GetCString();

Michael137 wrote:

I expect this function to get some cleanup once `ExtractIndexFromString` 
returns `llvm::Expected`

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


[Lldb-commits] [lldb] [lldb] Upgrade `GetIndexOfChildWithName` to use `llvm::Expected` (PR #136693)

2025-04-22 Thread Michael Buch via lldb-commits


@@ -130,9 +130,14 @@ 
lldb_private::formatters::LibcxxStdAtomicSyntheticFrontEnd::GetChildAtIndex(
   return nullptr;
 }
 
-size_t lldb_private::formatters::LibcxxStdAtomicSyntheticFrontEnd::
+llvm::Expected
+lldb_private::formatters::LibcxxStdAtomicSyntheticFrontEnd::
 GetIndexOfChildWithName(ConstString name) {
-  return name == "Value" ? 0 : UINT32_MAX;
+  if (name == "Value") {
+return 0;
+  }

Michael137 wrote:

```suggestion
  if (name == "Value")
return 0;
```

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


[Lldb-commits] [lldb] [lldb] Upgrade `GetIndexOfChildWithName` to use `llvm::Expected` (PR #136693)

2025-04-22 Thread Michael Buch via lldb-commits


@@ -456,7 +460,7 @@ ExtractLibcxxStringInfo(ValueObject &valobj) {
   if (!l)
 return {};
 
-  StringLayout layout = l->GetIndexOfChildWithName("__data_") == 0
+  StringLayout layout = l->GetIndexOfChildWithName("__data_").get() == 0

Michael137 wrote:

This would compare the underlying pointer value to `0`, aka it's now a nullptr 
check, which is not what we want. (I'd expect some test-failures...hopefully)

We should do something like this instead:
```
auto index_or_err = l->GetIndexOfChildWithName("__data_");
if (!index_or_err)
  return index_or_err.takeError();

StringLayout layout = *index_or_err == 0 ? StringLayout::DSC : 
StringLayout::CSD;
```

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


[Lldb-commits] [lldb] [lldb] Upgrade `GetIndexOfChildWithName` to use `llvm::Expected` (PR #136693)

2025-04-22 Thread Michael Buch via lldb-commits


@@ -152,7 +152,8 @@ 
lldb_private::formatters::LibcxxStdVectorSyntheticFrontEnd::Update() {
   return lldb::ChildCacheState::eRefetch;
 }
 
-size_t lldb_private::formatters::LibcxxStdVectorSyntheticFrontEnd::
+llvm::Expected
+lldb_private::formatters::LibcxxStdVectorSyntheticFrontEnd::
 GetIndexOfChildWithName(ConstString name) {
   if (!m_start || !m_finish)
 return UINT32_MAX;

Michael137 wrote:

This function needs to be changed to return an error

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


[Lldb-commits] [lldb] [lldb] Upgrade `GetIndexOfChildWithName` to use `llvm::Expected` (PR #136693)

2025-04-22 Thread Michael Buch via lldb-commits


@@ -20,9 +20,12 @@ class QueueFrontEnd : public SyntheticChildrenFrontEnd {
 Update();
   }
 
-  size_t GetIndexOfChildWithName(ConstString name) override {
-return m_container_sp ? m_container_sp->GetIndexOfChildWithName(name)
-  : UINT32_MAX;
+  llvm::Expected GetIndexOfChildWithName(ConstString name) override {
+if (m_container_sp) {
+  return m_container_sp->GetIndexOfChildWithName(name);
+}

Michael137 wrote:

```suggestion
if (m_container_sp)
  return m_container_sp->GetIndexOfChildWithName(name);
```

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


[Lldb-commits] [lldb] [lldb] Upgrade `GetIndexOfChildWithName` to use `llvm::Expected` (PR #136693)

2025-04-22 Thread Michael Buch via lldb-commits


@@ -202,8 +202,13 @@ class VariantFrontEnd : public SyntheticChildrenFrontEnd {
 Update();
   }
 
-  size_t GetIndexOfChildWithName(ConstString name) override {
-return formatters::ExtractIndexFromString(name.GetCString());
+  llvm::Expected GetIndexOfChildWithName(ConstString name) override {
+size_t index = formatters::ExtractIndexFromString(name.GetCString());
+if (index == UINT32_MAX) {
+  return llvm::createStringError("Cannot find index of child '%s'",
+ name.AsCString());
+}
+return index;

Michael137 wrote:

This should all just become:
```suggestion
return formatters::ExtractIndexFromString(name.GetCString());
```

Once `ExtractIndexFromString` returns an `llvm::Expected`

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


[Lldb-commits] [lldb] [lldb/DWARF] Remove "range lower than function low_pc" check (PR #132395)

2025-04-22 Thread Pavel Labath via lldb-commits


@@ -42,6 +27,21 @@ look_me_up:
 .size   foo.__part.1, .Lfoo.__part.1_end-foo.__part.1
 
 
+bar:
+nop
+.Lbar_end:
+.size   bar, .Lbar_end-bar
+
+.type   foo,@function
+foo:

labath wrote:

(and yes, `look_me_up` is in the middle of that block, so that it causes lldb 
to parse it)

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


[Lldb-commits] [lldb] [lldb/DWARF] Remove "range lower than function low_pc" check (PR #132395)

2025-04-22 Thread Pavel Labath via lldb-commits


@@ -42,6 +27,21 @@ look_me_up:
 .size   foo.__part.1, .Lfoo.__part.1_end-foo.__part.1
 
 
+bar:
+nop
+.Lbar_end:
+.size   bar, .Lbar_end-bar
+
+.type   foo,@function
+foo:

labath wrote:

It's because the range `[.Lfoo_inl.__part.1, .Lfoo_inl.__part.1_end)` is before 
the `foo` entry point. This is the range of the fake "foo_inl" inlined function 
(which, for most purposes, is treated the same way as DW_TAG_lexical_block). 
This is described in the DWARF at lines 115--117 and 159-166

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


[Lldb-commits] [lldb] [lldb/DWARF] Remove "range lower than function low_pc" check (PR #132395)

2025-04-22 Thread Pavel Labath via lldb-commits

https://github.com/labath updated 
https://github.com/llvm/llvm-project/pull/132395

>From 3326940bbae82afa6b19e1ee696447a39ea3723b Mon Sep 17 00:00:00 2001
From: Pavel Labath 
Date: Fri, 21 Mar 2025 14:04:12 +0100
Subject: [PATCH 1/2] [lldb/DWARF] Remove "range lower than function low_pc"
 check

The check is not correct for discontinuous functions, as one of the
blocks could very well begin before the function entry point. To catch
dead-stripped ranges, I check whether the functions is after the first
known code address. I don't print any error in this case as that is a
common/expected situation.

If the block ranges is not a subrange of the enclosing block then this
will range will currently be added to the outer block as well (i.e., we
get the same behavior that's currently possible for non-subrange blocks
larger than function_low_pc). However, this code path is buggy and I'd
like to change that (#117725).
---
 .../SymbolFile/DWARF/SymbolFileDWARF.cpp  |  12 +-
 .../DWARF/range-lower-then-low-pc.s   | 317 --
 .../DWARF/x86/discontinuous-inline-function.s |  38 +--
 3 files changed, 20 insertions(+), 347 deletions(-)
 delete mode 100644 lldb/test/Shell/SymbolFile/DWARF/range-lower-then-low-pc.s

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index d1aaf0bd36de4..58d8969c54e27 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1346,19 +1346,9 @@ size_t SymbolFileDWARF::ParseBlocksRecursive(CompileUnit 
&comp_unit,
  decl_line, decl_column, call_file, call_line,
  call_column, nullptr)) {
   for (const llvm::DWARFAddressRange &range : ranges) {
-if (!range.valid())
-  continue;
-if (range.LowPC >= subprogram_low_pc)
+if (range.valid() && range.LowPC >= m_first_code_address)
   block->AddRange(Block::Range(range.LowPC - subprogram_low_pc,
range.HighPC - range.LowPC));
-else {
-  GetObjectFile()->GetModule()->ReportError(
-  "{0:x8}: adding range [{1:x16}-{2:x16}) which has a base "
-  "that is less than the function's low PC {3:x16}. Please file "
-  "a bug and attach the file at the "
-  "start of this error message",
-  block->GetID(), range.LowPC, range.HighPC, subprogram_low_pc);
-}
   }
   block->FinalizeRanges();
 
diff --git a/lldb/test/Shell/SymbolFile/DWARF/range-lower-then-low-pc.s 
b/lldb/test/Shell/SymbolFile/DWARF/range-lower-then-low-pc.s
deleted file mode 100644
index e3cc84db12652..0
--- a/lldb/test/Shell/SymbolFile/DWARF/range-lower-then-low-pc.s
+++ /dev/null
@@ -1,317 +0,0 @@
-# REQUIRES: x86
-
-# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s > %t
-# RUN: lldb-test symbols %t &> %t.txt
-# RUN: cat %t.txt | FileCheck %s
-
-# Tests that error is printed correctly when DW_AT_low_pc value is
-# greater then a range entry.
-
-# CHECK: 0x006e: adding range [0x-0x001f)
-# CHECK-SAME: which has a base that is less than the function's low PC 
0x0021.
-# CHECK-SAME: Please file a bug and attach the file at the start of this error 
message
-
-
-
-# Test was manually modified to change DW_TAG_lexical_block
-# to use DW_AT_ranges, and value lower then DW_AT_low_pc value
-# in DW_TAG_subprogram
-# static int foo(bool b) {
-#   if (b) {
-#int food = 1;
-# return food;
-#   }
-#   return 0;
-# }
-# int main() {
-#   return foo(true);
-# }
-   .text
-   .file   "main.cpp"
-   .section.text.main,"ax",@progbits
-   .globl  main# -- Begin function main
-   .p2align4, 0x90
-   .type   main,@function
-main:   # @main
-.Lfunc_begin0:
-   .file   1 "base-lower-then-range-entry" "main.cpp"
-   .loc1 8 0   # main.cpp:8:0
-   .cfi_startproc
-# %bb.0:# %entry
-   pushq   %rbp
-   .cfi_def_cfa_offset 16
-   .cfi_offset %rbp, -16
-   movq%rsp, %rbp
-   .cfi_def_cfa_register %rbp
-   subq$16, %rsp
-   movl$0, -4(%rbp)
-.Ltmp0:
-   .loc1 9 10 prologue_end # main.cpp:9:10
-   movl$1, %edi
-   callq   _ZL3foob
-   .loc1 9 3 epilogue_begin is_stmt 0  # main.cpp:9:3
-   addq$16, %rsp
-   popq%rbp
-   .cfi_def_cfa %rsp, 8
-   retq
-.Ltmp1:
-.Lfunc_end0:
-   .size   main, .Lfunc_end0-main
-   .cfi_endproc
-# -- End function
-   .section.text._ZL3foob,"ax",@progbits
-   .p2align4, 0x90 # -- Begin function 
_ZL3foob
-   .type   _ZL3foob,@function
-_ZL3foob: 

[Lldb-commits] [lldb] [lldb/DWARF] Remove "range lower than function low_pc" check (PR #132395)

2025-04-22 Thread Pavel Labath via lldb-commits

https://github.com/labath updated 
https://github.com/llvm/llvm-project/pull/132395

>From 3326940bbae82afa6b19e1ee696447a39ea3723b Mon Sep 17 00:00:00 2001
From: Pavel Labath 
Date: Fri, 21 Mar 2025 14:04:12 +0100
Subject: [PATCH 1/2] [lldb/DWARF] Remove "range lower than function low_pc"
 check

The check is not correct for discontinuous functions, as one of the
blocks could very well begin before the function entry point. To catch
dead-stripped ranges, I check whether the functions is after the first
known code address. I don't print any error in this case as that is a
common/expected situation.

If the block ranges is not a subrange of the enclosing block then this
will range will currently be added to the outer block as well (i.e., we
get the same behavior that's currently possible for non-subrange blocks
larger than function_low_pc). However, this code path is buggy and I'd
like to change that (#117725).
---
 .../SymbolFile/DWARF/SymbolFileDWARF.cpp  |  12 +-
 .../DWARF/range-lower-then-low-pc.s   | 317 --
 .../DWARF/x86/discontinuous-inline-function.s |  38 +--
 3 files changed, 20 insertions(+), 347 deletions(-)
 delete mode 100644 lldb/test/Shell/SymbolFile/DWARF/range-lower-then-low-pc.s

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index d1aaf0bd36de4..58d8969c54e27 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1346,19 +1346,9 @@ size_t SymbolFileDWARF::ParseBlocksRecursive(CompileUnit 
&comp_unit,
  decl_line, decl_column, call_file, call_line,
  call_column, nullptr)) {
   for (const llvm::DWARFAddressRange &range : ranges) {
-if (!range.valid())
-  continue;
-if (range.LowPC >= subprogram_low_pc)
+if (range.valid() && range.LowPC >= m_first_code_address)
   block->AddRange(Block::Range(range.LowPC - subprogram_low_pc,
range.HighPC - range.LowPC));
-else {
-  GetObjectFile()->GetModule()->ReportError(
-  "{0:x8}: adding range [{1:x16}-{2:x16}) which has a base "
-  "that is less than the function's low PC {3:x16}. Please file "
-  "a bug and attach the file at the "
-  "start of this error message",
-  block->GetID(), range.LowPC, range.HighPC, subprogram_low_pc);
-}
   }
   block->FinalizeRanges();
 
diff --git a/lldb/test/Shell/SymbolFile/DWARF/range-lower-then-low-pc.s 
b/lldb/test/Shell/SymbolFile/DWARF/range-lower-then-low-pc.s
deleted file mode 100644
index e3cc84db12652..0
--- a/lldb/test/Shell/SymbolFile/DWARF/range-lower-then-low-pc.s
+++ /dev/null
@@ -1,317 +0,0 @@
-# REQUIRES: x86
-
-# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s > %t
-# RUN: lldb-test symbols %t &> %t.txt
-# RUN: cat %t.txt | FileCheck %s
-
-# Tests that error is printed correctly when DW_AT_low_pc value is
-# greater then a range entry.
-
-# CHECK: 0x006e: adding range [0x-0x001f)
-# CHECK-SAME: which has a base that is less than the function's low PC 
0x0021.
-# CHECK-SAME: Please file a bug and attach the file at the start of this error 
message
-
-
-
-# Test was manually modified to change DW_TAG_lexical_block
-# to use DW_AT_ranges, and value lower then DW_AT_low_pc value
-# in DW_TAG_subprogram
-# static int foo(bool b) {
-#   if (b) {
-#int food = 1;
-# return food;
-#   }
-#   return 0;
-# }
-# int main() {
-#   return foo(true);
-# }
-   .text
-   .file   "main.cpp"
-   .section.text.main,"ax",@progbits
-   .globl  main# -- Begin function main
-   .p2align4, 0x90
-   .type   main,@function
-main:   # @main
-.Lfunc_begin0:
-   .file   1 "base-lower-then-range-entry" "main.cpp"
-   .loc1 8 0   # main.cpp:8:0
-   .cfi_startproc
-# %bb.0:# %entry
-   pushq   %rbp
-   .cfi_def_cfa_offset 16
-   .cfi_offset %rbp, -16
-   movq%rsp, %rbp
-   .cfi_def_cfa_register %rbp
-   subq$16, %rsp
-   movl$0, -4(%rbp)
-.Ltmp0:
-   .loc1 9 10 prologue_end # main.cpp:9:10
-   movl$1, %edi
-   callq   _ZL3foob
-   .loc1 9 3 epilogue_begin is_stmt 0  # main.cpp:9:3
-   addq$16, %rsp
-   popq%rbp
-   .cfi_def_cfa %rsp, 8
-   retq
-.Ltmp1:
-.Lfunc_end0:
-   .size   main, .Lfunc_end0-main
-   .cfi_endproc
-# -- End function
-   .section.text._ZL3foob,"ax",@progbits
-   .p2align4, 0x90 # -- Begin function 
_ZL3foob
-   .type   _ZL3foob,@function
-_ZL3foob: 

[Lldb-commits] [lldb] [lldb] Upgrade `GetIndexOfChildWithName` to use `llvm::Expected` (PR #136693)

2025-04-22 Thread Michael Buch via lldb-commits


@@ -218,10 +218,11 @@ bool 
ScriptedSyntheticChildren::FrontEnd::MightHaveChildren() {
   return m_interpreter->MightHaveChildrenSynthProviderInstance(m_wrapper_sp);
 }
 
-size_t ScriptedSyntheticChildren::FrontEnd::GetIndexOfChildWithName(
-ConstString name) {
+llvm::Expected
+ScriptedSyntheticChildren::FrontEnd::GetIndexOfChildWithName(ConstString name) 
{
   if (!m_wrapper_sp || m_interpreter == nullptr)
-return UINT32_MAX;
+return llvm::createStringError("Cannot find index of child '%s'",
+   name.AsCString());

Michael137 wrote:

Should we be more descriptive with where the error came from? E.g., 
"ScriptedSyntheticChildren::FrontEnd cannot find index of child '%s'"? Same 
with the other places in this PR

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


[Lldb-commits] [lldb] [lldb] Upgrade `GetIndexOfChildWithName` to use `llvm::Expected` (PR #136693)

2025-04-22 Thread Michael Buch via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Upgrade `GetIndexOfChildWithName` to use `llvm::Expected` (PR #136693)

2025-04-22 Thread Michael Buch via lldb-commits


@@ -28,7 +28,7 @@ class GenericBitsetFrontEnd : public 
SyntheticChildrenFrontEnd {
 
   GenericBitsetFrontEnd(ValueObject &valobj, StdLib stdlib);
 
-  size_t GetIndexOfChildWithName(ConstString name) override {
+  llvm::Expected GetIndexOfChildWithName(ConstString name) override {
 return formatters::ExtractIndexFromString(name.GetCString());
   }

Michael137 wrote:

`lldb_private::formatters::ExtractIndexFromString` will also need to be changed 
to return `llvm::Expected`

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


[Lldb-commits] [lldb] 974a8cc - [LLDB] Silence Windows buildbot failure caused by #136226

2025-04-22 Thread Muhammad Omair Javaid via lldb-commits

Author: Muhammad Omair Javaid
Date: 2025-04-22T18:03:54+05:00
New Revision: 974a8ccb2b9f5b930ce47f65122b5a86481e57fe

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

LOG: [LLDB] Silence Windows buildbot failure caused by #136226

This patch temporarily silences a LLDB test failure caused by PR 136226.
The PR added symbol/table count statistics but caused failures in the
lldb-aarch64-windows buildbot where the reported number of symbols and
symbol tables were incorrectly showing as 0.

https://lab.llvm.org/buildbot/#/builders/141/builds/8084

Added: 


Modified: 
lldb/test/API/commands/statistics/basic/TestStats.py

Removed: 




diff  --git a/lldb/test/API/commands/statistics/basic/TestStats.py 
b/lldb/test/API/commands/statistics/basic/TestStats.py
index 0265a0d7c9948..a358f5178c7fa 100644
--- a/lldb/test/API/commands/statistics/basic/TestStats.py
+++ b/lldb/test/API/commands/statistics/basic/TestStats.py
@@ -179,8 +179,9 @@ def test_default_no_run(self):
 "totalDebugInfoParseTime",
 ]
 self.verify_keys(debug_stats, '"debug_stats"', debug_stat_keys, None)
-self.assertGreater(debug_stats["totalSymbolsLoaded"], 0)
-self.assertGreater(debug_stats["totalSymbolTablesLoaded"], 0)
+if self.getPlatform() != "windows":
+self.assertGreater(debug_stats["totalSymbolsLoaded"], 0)
+self.assertGreater(debug_stats["totalSymbolTablesLoaded"], 0)
 
 # Verify target stats keys.
 target_stats = debug_stats["targets"][0]
@@ -207,7 +208,8 @@ def test_default_no_run(self):
 self.verify_keys(
 module_stats, '"module_stats"', module_stat_keys_exist, None
 )
-self.assertGreater(module_stats["symbolsLoaded"], 0)
+if self.getPlatform() != "windows":
+self.assertGreater(module_stats["symbolsLoaded"], 0)
 
 def test_default_with_run(self):
 """Test "statistics dump" when running the target to a breakpoint.



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


[Lldb-commits] [lldb] 587206a - [lldb] Avoid modifying the source tree in TestPlatformLaunchGDBServer

2025-04-22 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2025-04-22T14:41:59+02:00
New Revision: 587206a442ebb656f9d72e7e0cc5845ef3a2f7ed

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

LOG: [lldb] Avoid modifying the source tree in TestPlatformLaunchGDBServer

The test binary gets uploaded to the "remote" platform's working
directory which, by default is in the source tree. Change that.

Added: 


Modified: 

lldb/test/API/commands/platform/launchgdbserver/TestPlatformLaunchGDBServer.py

Removed: 




diff  --git 
a/lldb/test/API/commands/platform/launchgdbserver/TestPlatformLaunchGDBServer.py
 
b/lldb/test/API/commands/platform/launchgdbserver/TestPlatformLaunchGDBServer.py
index ea846149e4983..584879d3e723a 100644
--- 
a/lldb/test/API/commands/platform/launchgdbserver/TestPlatformLaunchGDBServer.py
+++ 
b/lldb/test/API/commands/platform/launchgdbserver/TestPlatformLaunchGDBServer.py
@@ -91,6 +91,9 @@ def test_lldb_server_weird_symlinks(self):
 
 connect_url = "connect://[%s]:%s" % (hostname, socket_id)
 self.runCmd("platform connect %s" % connect_url)
+wd = self.getBuildArtifact("wd")
+self.assertSuccess(new_platform.MakeDirectory(wd))
+new_platform.SetWorkingDirectory(wd)
 self.runCmd("target create {}".format(self.getBuildArtifact("a.out")))
 self.runCmd("run")
 self.expect(



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


[Lldb-commits] [lldb] [lldb/DWARF] Remove "range lower than function low_pc" check (PR #132395)

2025-04-22 Thread Pavel Labath via lldb-commits

labath wrote:

> I think this relates to:
> 
> > 2.17 Code Addresses, Ranges and Base Addresses
> > <...>
> > The base address of the scope for any of the debugging information entries 
> > listed
> > above is given by either the DW_AT_low_pc attribute or the first address in 
> > the
> > first range entry in the list of ranges given by the DW_AT_ranges 
> > attribute. If
> > there is no such attribute, the base address is undefined.
> 
> (https://dwarfstd.org/doc/DWARF5.pdf)
> 
> I'm just guessing here that the functions you refer to have both. It doesn't 
> say which should win, but we can take "or" to mean "whichever actually makes 
> sense", and in these cases you'd assume that low_pc is maybe the entry point 
> of the function not the actual lowest PC value some block of it sits at.

It is related to that, and I think this is the correct reading of that 
paragraph, but the situation is simpler than that.

> 
> Is that roughly the logic of this change? Sounds like the check itself was 
> not 100% correct to begin with, perhaps it was for some previous standard 
> version.

The function just has a DW_AT_ranges attribute like this:
```
0x00085f0f:   DW_TAG_subprogram
DW_AT_name  ("_dl_start")
DW_AT_decl_file ("./elf/rtld.c")
DW_AT_decl_line (518)
DW_AT_decl_column   (1)
DW_AT_prototyped(true)
DW_AT_type  (0x0007d5fb "Elf64_Addr")
DW_AT_ranges(0x4586
   [0x0001cfb0, 0x0001d680)
   [0x1a0f, 0x1b07))
```

which (according to the paragraph you quote) means that the function's entry 
point is 0x1cfb0, which is *not* the lowest address in the function.

Now this part is still fine. The problem starts when we start parsing nested 
blocks:
```
0x00085f3b: DW_TAG_lexical_block
  DW_AT_ranges  (0x462b
 [0x0001d1f8, 0x0001d488)
 [0x0001d4e0, 0x0001d550)
 [0x0001d608, 0x0001d62e)
 [0x1ae8, 0x1b07))
```

This block contains a range (the last one) which is below the functions entry 
point (which is called that because it *can*, and often is set by DW_AT_low_pc 
-- I guess we should rename that), even though it's still within the bounds of 
the function. This code was correct in a world where the functions are always 
contiguous and start at the first instruction, but that's not the case now (and 
strictly speaking, it never was). I'm not entirely sure what prompted this 
check to be added in the first place, but the two candidates I can think of are:
- bad ranges which would cause the internal block representation to overflow 
(because the blocks are stored as offsets from the entry point). This is no 
longer a problem because blocks now use signed numbers for offsets.
- to catch ranges which have been eliminated by the linker (in this case, their 
address is usually set to zero). I don't know if the linker can eliminate a 
part of the function, but if it can, this would now be caught by the 
m_first_code_address check (which is a relatively new invention).


(BTW, this warning does not show up on old LLDB's -- before I started 
implementing support for these kinds of functions, because then LLDB just 
picked the lowest address as the function entry point -- and so this check 
would not fire)

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


[Lldb-commits] [lldb] [lldb][Minidump Parser] Implement a range data vector for minidump memory ranges (PR #136040)

2025-04-22 Thread Jacob Lalonde via lldb-commits

Jlalond wrote:

@dmpots adding you after our conversation yesterday as an FYI

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


[Lldb-commits] [lldb] [lldb] Clarify the documentation for GetIndexOfChildMemberWithName (PR #136633)

2025-04-22 Thread via lldb-commits

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

LGTM

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


[Lldb-commits] [lldb] [lldb] Add symbol/table count into statistics (PR #136226)

2025-04-22 Thread Omair Javaid via lldb-commits

omjavaid wrote:

I have tested the using clang and used lld-link as the default linker the 
symbols are still zero. For now I have added a bypass commit for this to make 
buildbot happy.

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


[Lldb-commits] [lldb] [lldb/DWARF] Remove "range lower than function low_pc" check (PR #132395)

2025-04-22 Thread Pavel Labath via lldb-commits

labath wrote:

ping ping :)

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


[Lldb-commits] [lldb] [lldb/DWARF] Remove "range lower than function low_pc" check (PR #132395)

2025-04-22 Thread Pavel Labath via lldb-commits

labath wrote:

The priority of this has increased from "it's a niche feature only used by 
google" to "it's used by *everyone*" because (as I was made aware of at the dev 
meeting), gcc has started producing functions like this on a regular basis. In 
particular the dynamic loader in the next debian release (trixie)  has 
functions like this which means that lldb spews a bunch warning when debugging 
pretty much any binary (if the user has the corresponding debug info package 
installed):
```
$ lldb usr/lib64/ld-linux-x86-64.so.2 -O "settings set 
target.debug-file-search-paths ./usr/lib/debug/"
(lldb) settings set target.debug-file-search-paths ./usr/lib/debug/
(lldb) target create "usr/lib64/ld-linux-x86-64.so.2"
Current executable set to '/tmp/debian/usr/lib64/ld-linux-x86-64.so.2' (x86_64).
(lldb) process launch -s
Process 21646 stopped
* thread #1, name = 'ld-linux-x86-64', stop reason = signal SIGSTOP
frame #0: 0x77fe3440 ld-linux-x86-64.so.2`_start
ld-linux-x86-64.so.2`_start:
->  0x77fe3440 <+0>: movq   %rsp, %rdi
0x77fe3443 <+3>: callq  0x77fe3fb0 ; _dl_start at rtld.c:519:1

ld-linux-x86-64.so.2`_dl_start_user:
0x77fe3448 <+0>: movq   %rax, %r12
0x77fe344b <+3>: movq   %rsp, %r13
error: ld-linux-x86-64.so.2 0x00085f3b: adding range 
[0x1ae8-0x1b07) which has a 
base that is less than the function's low PC 0x0001cfb0. Please file a 
bug and attach the file at
 the start of this error message
error: ld-linux-x86-64.so.2 0x00085fdb: adding range 
[0x1ae8-0x1b07) which has a 
base that is less than the function's low PC 0x0001cfb0. Please file a 
bug and attach the file at
 the start of this error message
error: ld-linux-x86-64.so.2 0x0008601f: adding range 
[0x1ae8-0x1b07) which has a 
base that is less than the function's low PC 0x0001cfb0. Please file a 
bug and attach the file at
 the start of this error message
error: ld-linux-x86-64.so.2 0x0008603c: adding range 
[0x1ae8-0x1b07) which has a 
base that is less than the function's low PC 0x0001cfb0. Please file a 
bug and attach the file at
 the start of this error message
error: ld-linux-x86-64.so.2 0x000860ad: adding range 
[0x1ae8-0x1b07) which has a 
base that is less than the function's low PC 0x0001cfb0. Please file a 
bug and attach the file at
 the start of this error message
error: ld-linux-x86-64.so.2 0x00086120: adding range 
[0x1ae8-0x1b07) which has a 
base that is less than the function's low PC 0x0001cfb0. Please file a 
bug and attach the file at
 the start of this error message
error: ld-linux-x86-64.so.2 0x00086159: adding range 
[0x1ae8-0x1b07) which has a 
base that is less than the function's low PC 0x0001cfb0. Please file a 
bug and attach the file at
 the start of this error message
error: ld-linux-x86-64.so.2 0x000863ae: adding range 
[0x1a0f-0x1ae8) which has a 
base that is less than the function's low PC 0x0001cfb0. Please file a 
bug and attach the file at
 the start of this error message
error: ld-linux-x86-64.so.2 0x000863ef: adding range 
[0x1a0f-0x1ae8) which has a 
base that is less than the function's low PC 0x0001cfb0. Please file a 
bug and attach the file at
 the start of this error message
Process 21646 launched: '/tmp/debian/usr/lib64/ld-linux-x86-64.so.2' (x86_64)
```

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


[Lldb-commits] [lldb] [lldb] Upgrade `GetIndexOfChildWithName` to use `llvm::Expected` (PR #136693)

2025-04-22 Thread Michael Buch via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Upgrade `GetIndexOfChildWithName` to use `llvm::Expected` (PR #136693)

2025-04-22 Thread Michael Buch via lldb-commits

https://github.com/Michael137 commented:

On first walkthrough

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


[Lldb-commits] [lldb] [lldb] Upgrade `GetIndexOfChildWithName` to use `llvm::Expected` (PR #136693)

2025-04-22 Thread Michael Buch via lldb-commits


@@ -13,6 +13,8 @@
 #include "lldb/API/SBDefines.h"
 #include "lldb/API/SBType.h"
 
+#include "lldb/Core/Value.h"

Michael137 wrote:

drive-by change?

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


[Lldb-commits] [lldb] [lldb] Upgrade `GetIndexOfChildWithName` to use `llvm::Expected` (PR #136693)

2025-04-22 Thread Michael Buch via lldb-commits


@@ -172,8 +173,15 @@ bool lldb_private::formatters::BlockPointerSummaryProvider(
 
   static const ConstString s_FuncPtr_name("__FuncPtr");
 
-  lldb::ValueObjectSP child_sp = synthetic_children->GetChildAtIndex(
-  synthetic_children->GetIndexOfChildWithName(s_FuncPtr_name));
+  auto index_or_err =
+  synthetic_children->GetIndexOfChildWithName(s_FuncPtr_name);
+
+  if (!index_or_err) {
+return false;

Michael137 wrote:

you will need to `llvm::consumeError` here (or even log the error...search for 
`LLDB_LOG_ERROR` for some examples). Otherwise we crash

If tests pass it probably means we don't have coverage for that case

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


[Lldb-commits] [lldb] [lldb] Upgrade `GetIndexOfChildWithName` to use `llvm::Expected` (PR #136693)

2025-04-22 Thread Michael Buch via lldb-commits


@@ -704,13 +704,17 @@ SBValue SBValue::GetChildAtIndex(uint32_t idx,
 uint32_t SBValue::GetIndexOfChildWithName(const char *name) {
   LLDB_INSTRUMENT_VA(this, name);
 
-  uint32_t idx = UINT32_MAX;
   ValueLocker locker;
   lldb::ValueObjectSP value_sp(GetSP(locker));
   if (value_sp) {
-idx = value_sp->GetIndexOfChildWithName(name);
+auto idx_or_err = value_sp->GetIndexOfChildWithName(name);
+if (!idx_or_err) {
+  llvm::consumeError(idx_or_err.takeError());
+  return UINT32_MAX;
+}
+return *idx_or_err;

Michael137 wrote:

```suggestion
if (auto idx_or_err = value_sp->GetIndexOfChildWithName(name)) {
  return *idx_or_err;
else
  llvm::consumeError(idx_or_err.takeError());
```
feels a bit easier to read

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


[Lldb-commits] [lldb] [lldb] Upgrade `GetIndexOfChildWithName` to use `llvm::Expected` (PR #136693)

2025-04-22 Thread Michael Buch via lldb-commits


@@ -199,10 +199,12 @@ 
lldb_private::formatters::StdlibCoroutineHandleSyntheticFrontEnd::Update() {
   return lldb::ChildCacheState::eRefetch;
 }
 
-size_t StdlibCoroutineHandleSyntheticFrontEnd::GetIndexOfChildWithName(
+llvm::Expected
+StdlibCoroutineHandleSyntheticFrontEnd::GetIndexOfChildWithName(
 ConstString name) {
   if (!m_resume_ptr_sp || !m_destroy_ptr_sp)
-return UINT32_MAX;
+return llvm::createStringError("Cannot find index of child '%s'",

Michael137 wrote:

Lets print the pointer values of `m_resume_ptr_sp` and `m_destroy_ptr_sp` here

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


[Lldb-commits] [lldb] [lldb] Upgrade `GetIndexOfChildWithName` to use `llvm::Expected` (PR #136693)

2025-04-22 Thread Michael Buch via lldb-commits


@@ -489,7 +490,13 @@ llvm::Error Interpret(std::vector 
&control,
 TYPE_CHECK(Object, String);
 auto name = data.Pop();
 POP_VALOBJ(valobj);
-data.Push((uint64_t)valobj->GetIndexOfChildWithName(name));
+auto index_or_err = valobj->GetIndexOfChildWithName(name);
+if (!index_or_err) {
+  data.Push(ValueObjectConstResult::Create(
+  nullptr, Status::FromError(index_or_err.takeError(;
+  break;
+}
+data.Push((uint64_t)*index_or_err);

Michael137 wrote:

```suggestion
auto index_or_err = valobj->GetIndexOfChildWithName(name);
if (!index_or_err)
  return index_or_err.takeError();

data.Push((uint64_t)*index_or_err);
```

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


[Lldb-commits] [lldb] [lldb] Fix crash after second run when set a previous watchpoint. (PR #136682)

2025-04-22 Thread Jonas Devlieghere via lldb-commits

JDevlieghere wrote:

This will need a test. The issue has a fairly simple reproducer that should be 
easily converted into a test case.

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


[Lldb-commits] [lldb] [lldb/DWARF] Remove "range lower than function low_pc" check (PR #132395)

2025-04-22 Thread David Spickett via lldb-commits


@@ -42,6 +27,21 @@ look_me_up:
 .size   foo.__part.1, .Lfoo.__part.1_end-foo.__part.1
 
 
+bar:
+nop
+.Lbar_end:
+.size   bar, .Lbar_end-bar
+
+.type   foo,@function
+foo:

DavidSpickett wrote:

Trying to understand the change here.

I think what you have done is moved them around so that the order is:
foo.__part.1
bar
foo

"look_me_up" is inside of foo.__part.1, which puts it below foo. Previously 
this would have lead to the error, but not it does not.

Either because look_me_up's range would be below foo's low pc, or same thing 
for foo.__part.1, not sure which.

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


[Lldb-commits] [lldb] [lldb] Preparation for DWARF indexing speedup (PR #123732)

2025-04-22 Thread Jonas Devlieghere via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb][lldb-dap] fix repeating commands in repl mode (PR #135008)

2025-04-22 Thread Jonas Devlieghere via lldb-commits

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

LGTM modulo `RunLLDBCommandsVerbatim`. 

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


[Lldb-commits] [lldb] [lldb][lldb-dap] fix repeating commands in repl mode (PR #135008)

2025-04-22 Thread Jonas Devlieghere via lldb-commits


@@ -81,18 +85,23 @@ bool RunLLDBCommands(lldb::SBDebugger &debugger, 
llvm::StringRef prefix,
 /// If \b false, then command prefixes like \b ! or \b ? are not parsed and
 /// each command is executed verbatim.
 ///
+/// \param[in] echo_commands
+/// If \b true, the command are echoed to the stream.
+///
 /// \return
 /// A std::string that contains the prefix and all commands and
 /// command output.
 std::string RunLLDBCommands(lldb::SBDebugger &debugger, llvm::StringRef prefix,
 const llvm::ArrayRef &commands,
 bool &required_command_failed,
-bool parse_command_directives = true);
+bool parse_command_directives = true,
+bool echo_commands = false);
 
 /// Similar to the method above, but without parsing command directives.
-std::string
-RunLLDBCommandsVerbatim(lldb::SBDebugger &debugger, llvm::StringRef prefix,
-const llvm::ArrayRef &commands);
+std::string RunLLDBCommandsVerbatim(lldb::SBDebugger &debugger,
+llvm::StringRef prefix,
+const llvm::ArrayRef 
&commands,
+bool echo_commands);

JDevlieghere wrote:

I think we should drop this method altogether and use `RunLLDBCommands`. Maybe 
it made sense in the past (I actually don't think so because there's the 
default argument) but with the extra option I think it makes even less sense. 
The alternative would be to drop the `echo_commands` argument and always set 
that to false in the implementation, as there are no call sites that actually 
set this to true right now. 

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


[Lldb-commits] [lldb] [lldb/DWARF] Remove "range lower than function low_pc" check (PR #132395)

2025-04-22 Thread David Spickett via lldb-commits

DavidSpickett wrote:

> which (according to the paragraph you quote) means that the function's entry 
> point is 0x1cfb0, which is not the lowest address in the function.

I managed to nitpick the text but then go on to assume the ranges would be 
sorted with start address increasing. Bad idea.

But, if the first range was the `[0x1a0f, 0x1b07)` 
range, then the lexical block range `[0x1ae8, 0x1b07)` 
would not produce this error.

So then I think what if we used the minimum base address of the ranges, and I 
have just reinvented what you have already done with `m_first_code_address`. I 
think `InitializeFirstCodeAddressRecursive` is calculating exactly this.

Removing this error case sounds good to me.

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


[Lldb-commits] [lldb] [lldb/DWARF] Remove "range lower than function low_pc" check (PR #132395)

2025-04-22 Thread David Spickett via lldb-commits

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

LGTM.

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


[Lldb-commits] [lldb] [lldb] Upgrade `GetIndexOfChildWithName` to use `llvm::Expected` (PR #136693)

2025-04-22 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Charles Zablit (charles-zablit)


Changes

This patch replaces the use of `UINT32_MAX` as the error return value of 
`GetIndexOfChildWithName` with `llvm::Expected`.

---

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


52 Files Affected:

- (modified) lldb/include/lldb/API/SBValue.h (+2) 
- (modified) lldb/include/lldb/DataFormatters/TypeSynthetic.h (+6-5) 
- (modified) lldb/include/lldb/DataFormatters/VectorIterator.h (+1-1) 
- (modified) lldb/include/lldb/Interpreter/ScriptInterpreter.h (+3-2) 
- (modified) lldb/include/lldb/Symbol/CompilerType.h (+3-2) 
- (modified) lldb/include/lldb/Symbol/TypeSystem.h (+4-3) 
- (modified) lldb/include/lldb/ValueObject/ValueObject.h (+1-1) 
- (modified) lldb/include/lldb/ValueObject/ValueObjectRegister.h (+1-1) 
- (modified) lldb/include/lldb/ValueObject/ValueObjectSyntheticFilter.h (+1-1) 
- (modified) lldb/source/API/SBValue.cpp (+7-3) 
- (modified) lldb/source/DataFormatters/FormatterBytecode.cpp (+8-1) 
- (modified) lldb/source/DataFormatters/TypeSynthetic.cpp (+5-4) 
- (modified) lldb/source/DataFormatters/VectorType.cpp (+3-2) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp (+12-4) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/Coroutines.cpp (+6-3) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/Coroutines.h (+1-1) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/GenericBitset.cpp (+1-1) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp (+1-1) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp (+9-5) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxx.h (+2-2) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp (+8-3) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp 
(+3-2) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp (+1-1) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp (+7-5) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxProxyArray.cpp (+3-2) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxQueue.cpp (+6-3) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxRangesRefView.cpp 
(+1-1) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxSliceArray.cpp (+5-3) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxSpan.cpp (+5-4) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp (+1-1) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp 
(+8-5) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxValarray.cpp (+5-3) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp (+7-2) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp (+10-6) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp (+15-10) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp (+3-3) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp 
(+5-4) 
- (modified) lldb/source/Plugins/Language/ObjC/Cocoa.cpp (+3-2) 
- (modified) lldb/source/Plugins/Language/ObjC/NSArray.cpp (+11-12) 
- (modified) lldb/source/Plugins/Language/ObjC/NSDictionary.cpp (+33-24) 
- (modified) lldb/source/Plugins/Language/ObjC/NSError.cpp (+3-2) 
- (modified) lldb/source/Plugins/Language/ObjC/NSException.cpp (+3-2) 
- (modified) lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp (+3-2) 
- (modified) lldb/source/Plugins/Language/ObjC/NSSet.cpp (+13-12) 
- (modified) 
lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp 
(+11-5) 
- (modified) 
lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h 
(+3-2) 
- (modified) lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp (+1-1) 
- (modified) lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h (+4-3) 
- (modified) lldb/source/Symbol/CompilerType.cpp (+3-2) 
- (modified) lldb/source/ValueObject/ValueObject.cpp (+2-1) 
- (modified) lldb/source/ValueObject/ValueObjectRegister.cpp (+4-2) 
- (modified) lldb/source/ValueObject/ValueObjectSyntheticFilter.cpp (+19-18) 


``diff
diff --git a/lldb/include/lldb/API/SBValue.h b/lldb/include/lldb/API/SBValue.h
index 75d20a4378f09..69c50ab038e5b 100644
--- a/lldb/include/lldb/API/SBValue.h
+++ b/lldb/include/lldb/API/SBValue.h
@@ -13,6 +13,8 @@
 #include "lldb/API/SBDefines.h"
 #include "lldb/API/SBType.h"
 
+#include "lldb/Core/Value.h"
+
 class ValueImpl;
 class ValueLocker;
 
diff --git a/lldb/include/lldb/DataFormatters/TypeSynthetic.h 
b/lldb/include/lldb/DataFormatters/TypeSynthetic.h
index 14e516964f250..a132c63a93b08 100644
--- a/lldb/include/lldb/DataFormatters/TypeSynthetic.h
+++ b/lldb/include/lldb/DataFormatters/TypeSynthetic.h
@@ -51,7 +51,7 @@ class SyntheticChildrenFrontEnd {
 
   virtual lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) = 0;
 
-  virtual size_t GetIndexOfChildWithName(ConstString 

[Lldb-commits] [lldb] [lldb] Add symbol/table count into statistics (PR #136226)

2025-04-22 Thread Omair Javaid via lldb-commits

omjavaid wrote:

this PR caused lldb windows buildbot to fail

https://lab.llvm.org/buildbot/#/builders/141/builds/8084

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


[Lldb-commits] [lldb] [lldb] Add symbol/table count into statistics (PR #136226)

2025-04-22 Thread David Spickett via lldb-commits

DavidSpickett wrote:

Might be another case of us building with clang, producing DWARF, then linking 
with link.exe which discards the DWARF. I've skipped a few tests for this 
already.

(though I wonder if we should just be using lld anyway)

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


[Lldb-commits] [lldb] [lldb] Add symbol/table count into statistics (PR #136226)

2025-04-22 Thread via lldb-commits

royitaqi wrote:

@dmpots: See the comments above and the revert of #136236. Both are about the 
symbol count being inconsistent under different configurations (os, linker, 
debug info plug-in etc; so far it's not clear what is causing the difference).

I propose that for both PR we should remove the verification about the symbol 
count. Reasons:
1. This PR(#136226)'s goal is to add symbol count to stats dump. The goal isn't 
to assure that the count is zero or not.
2. In #136236, we should drop the test case in TestStats.py, because there is 
no guarantee that a different configuration won't cause the symbols to be 
loaded during target creation.

WDYT?

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


[Lldb-commits] [lldb] [lldb][lldb-dap] fix repeating commands in repl mode (PR #135008)

2025-04-22 Thread Jonas Devlieghere via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Make the statusline separator configurable (PR #136611)

2025-04-22 Thread Jonas Devlieghere via lldb-commits

JDevlieghere wrote:

> IIUC, the `${separator}` thingy could be used in places other than the status 
> line, so maybe the setting controlling it shouldn't be called 
> `statusline-separator` ?

I noticed the discrepancy between the format string (`${separator}`) and the 
setting (`statusline-separator`) and I was on the fence between making it more 
generic or more specific. Let's go with Pavel's suggestion. 

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


[Lldb-commits] [lldb] 3ccfbc8 - [lldb] Make sure changing the separator takes immediate effect (#136779)

2025-04-22 Thread via lldb-commits

Author: Jonas Devlieghere
Date: 2025-04-22T22:38:28-07:00
New Revision: 3ccfbc8a002e1e0f64b5408d26bc42282afc194b

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

LOG: [lldb] Make sure changing the separator takes immediate effect (#136779)

The setter is only used when changing the setting programmatically. When
using the settings command, we need to monitor SetPropertyValue.

Added: 


Modified: 
lldb/source/Core/Debugger.cpp
lldb/test/API/functionalities/statusline/TestStatusline.py

Removed: 




diff  --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index b572210f25603..cd8726eeba632 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -257,7 +257,9 @@ Status Debugger::SetPropertyValue(const ExecutionContext 
*exe_ctx,
   else
 m_statusline.reset();
 } else if (property_path ==
-   g_debugger_properties[ePropertyStatuslineFormat].name) {
+   g_debugger_properties[ePropertyStatuslineFormat].name ||
+   property_path ==
+   g_debugger_properties[ePropertySeparator].name) {
   // Statusline format changed. Redraw the statusline.
   RedrawStatusline();
 } else if (property_path ==

diff  --git a/lldb/test/API/functionalities/statusline/TestStatusline.py 
b/lldb/test/API/functionalities/statusline/TestStatusline.py
index dcededdb11e39..da6b4e7c8f320 100644
--- a/lldb/test/API/functionalities/statusline/TestStatusline.py
+++ b/lldb/test/API/functionalities/statusline/TestStatusline.py
@@ -46,8 +46,10 @@ def test(self):
 self.child.expect(re.escape("a.out | main.c:2:11 | bre"))
 self.child.setwinsize(terminal_height, terminal_width)
 
+# Change the separator.
+self.expect('set set separator "S "', ["a.out S main.c:2:11"])
+
 # Change the format.
-self.expect('set set separator "S"')
 self.expect(
 'set set statusline-format "target = {${target.file.basename}} 
${separator}"',
 ["target = a.out S"],



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


[Lldb-commits] [lldb] [lldb] Make sure changing the separator takes immediate effect (PR #136779)

2025-04-22 Thread Jonas Devlieghere via lldb-commits

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


  1   2   >