[Lldb-commits] [lldb] f8ba534 - Revert "[lldb] Cortex-M exception unwind API test cleanup" (#162520)

2025-10-11 Thread via lldb-commits

Author: Vladislav Dzhidzhoev
Date: 2025-10-08T20:17:54+02:00
New Revision: f8ba5343ae19651b148e53960597bdff0c877757

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

LOG: Revert "[lldb] Cortex-M exception unwind API test cleanup" (#162520)

This reverts commit 01a8f9b81870ac9bfe26d80fa3313d56cb8cbe13.

The reason is "lldb-remote-linux-win" buildbot breakage
(https://lab.llvm.org/buildbot/#/builders/197/builds/9625).

Added: 


Modified: 

lldb/test/API/functionalities/unwind/cortex-m-exception/TestCortexMExceptionUnwind.py

lldb/test/API/functionalities/unwind/cortex-m-exception/armv7m-nofpu-exception.yaml
lldb/test/API/functionalities/unwind/cortex-m-exception/binary.json

Removed: 




diff  --git 
a/lldb/test/API/functionalities/unwind/cortex-m-exception/TestCortexMExceptionUnwind.py
 
b/lldb/test/API/functionalities/unwind/cortex-m-exception/TestCortexMExceptionUnwind.py
index 6535f89f4488b..768dd6fe6867c 100644
--- 
a/lldb/test/API/functionalities/unwind/cortex-m-exception/TestCortexMExceptionUnwind.py
+++ 
b/lldb/test/API/functionalities/unwind/cortex-m-exception/TestCortexMExceptionUnwind.py
@@ -12,6 +12,21 @@
 class TestCortexMExceptionUnwind(TestBase):
 NO_DEBUG_INFO_TESTCASE = True
 
+# on the lldb-remote-linux-ubuntu CI, the binary.json's triple of
+# armv7m-apple is not being set in the Target triple, and we're
+# picking the wrong ABI plugin, ABISysV_arm.
+# ABISysV_arm::CreateDefaultUnwindPlan() doesn't have a way to detect
+# arm/thumb for a stack frame, or even the Target's triple for a
+# Cortex-M part that is always thumb.  It hardcodes r11 as the frame
+# pointer register, which is correct for arm code but not thumb.
+# It is never correct # on a Cortex-M target.
+# The Darwin ABIMacOSX_arm diverges from AAPCS and always uses r7 for
+# the frame pointer -- the thumb convention -- whether executing arm or
+# thumb.  So its CreateDefaultUnwindPlan picks the correct register for
+# the frame pointer, and we can walk the stack.
+# ABISysV_arm::CreateDefaultUnwindPlan will only get one frame and
+# not be able to continue.
+@skipIfRemote
 def test_no_fpu(self):
 """Test that we can backtrace correctly through an ARM Cortex-M 
Exception return stack"""
 
@@ -44,8 +59,9 @@ def test_no_fpu(self):
 # frames above that.  The topmost two stack frames
 # were not interesting for this test, so I didn't
 # create symbols for them.
-self.assertEqual(thread.GetNumFrames(), 3)
+self.assertEqual(thread.GetNumFrames(), 6)
 stackframe_names = [
+"exception_catcher",
 "exception_catcher",
 "exception_thrower",
 "main",

diff  --git 
a/lldb/test/API/functionalities/unwind/cortex-m-exception/armv7m-nofpu-exception.yaml
 
b/lldb/test/API/functionalities/unwind/cortex-m-exception/armv7m-nofpu-exception.yaml
index 0b4e1f8fac3e2..9ce5ff49d9b6e 100644
--- 
a/lldb/test/API/functionalities/unwind/cortex-m-exception/armv7m-nofpu-exception.yaml
+++ 
b/lldb/test/API/functionalities/unwind/cortex-m-exception/armv7m-nofpu-exception.yaml
@@ -2,8 +2,8 @@ cpu: armv7m
 threads:
   - regsets:
   - flavor: gpr
-registers: [{name: sp, value: 0x2000fe88}, {name: r7, value: 
0x2000fe88}, 
-{name: pc, value: 0x00203916}, {name: lr, value: 
0x0020392d}]
+registers: [{name: sp, value: 0x2000fe70}, {name: r7, value: 
0x2000fe80}, 
+{name: pc, value: 0x0020392c}, {name: lr, value: 
0x0020392d}]
 memory-regions:
   # stack memory fetched via 
   # (lldb) p/x $sp
@@ -14,7 +14,7 @@ memory-regions:
   0x002a, 0x20010e58, 0x00203923, 0x0001,
   0x2000fe88, 0x00203911, 0x2000ffdc, 0xfff9,
   0x0102, 0x0002, 0x03f0, 0x002a,
-  0x20012620, 0x00203215, 0x00202a92, 0x81000200,
+  0x20012620, 0x00203215, 0x00203366, 0x81000200,
   0x00203215, 0x200128b0, 0x0024928d, 0x2000fecc,
   0x002491ed, 0x20010e58, 0x20010e4c, 0x2000ffa0,
   0x200107a0, 0x003c, 0x200116e8, 0x200108b0,
@@ -62,26 +62,3 @@ memory-regions:
   0x98, 0xae, 0x28, 0x00
 ]
 
-  # exception_thrower
-  # (lldb) disass -b -c 12 -n exception_thrower
-  # 0x202a88 <+0>:  0xb5f0   push   {r4, r5, r6, r7, lr}
-  # 0x202a8a <+2>:  0xaf03   addr7, sp, #0xc
-  # 0x202a8c <+4>:  0xe92d0f00   push.w {r8, r9, r10, r11}
-  # 0x202a90 <+8>:  0xb0c3   subsp, #0x10c
-  # 0x202a92 <+10>: 0xf7d9   bl 0x202a48 
-  - addr: 0x202a88
-UInt8: [
-  0xf0, 0xb5, 0x03, 0xaf, 0x2d, 0xe9, 0x00, 0x0f,
-  0xc3, 0xb0, 0xff, 0xf7, 0xd9, 0xff, 0xff, 0xf7
-]
-
-  # main:
-  # 0x202a7e <+0>: push   {r7, lr}
-  # 0x202a80 <+2>

[Lldb-commits] [lldb] Make SBBreakpoint/SBBreakpointLocation.SetCondition(nullptr) work again. (PR #162370)

2025-10-11 Thread LLVM Continuous Integration via lldb-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `lldb-x86_64-win` running 
on `as-builder-10` while building `lldb` at step 6 "cmake-configure".

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


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

```
Step 6 (cmake-configure) failure: cmake (failure)
...
-- Clang version: 22.0.0git
-- Performing Test HAVE_LINKER_FLAG_LONG_PLT
-- Performing Test HAVE_LINKER_FLAG_LONG_PLT - Success
-- Found Perl: C:/Program Files/Git/usr/bin/perl.exe (found version "5.38.2") 
-- Found Python3: C:/Python312/python.exe (found version "3.12.7") found 
components: Interpreter 
-- Found SWIG: C:/Python312/Scripts/swig4.0.exe (found suitable version 
"4.3.0", minimum required is "4")  
-- Enable SWIG to generate LLDB bindings: TRUE
-- Enable editline support in LLDB: FALSE
-- Enable curses support in LLDB: FALSE
-- Enable LZMA compression support in LLDB: FALSE
-- Could NOT find Lua (missing: LUA_LIBRARIES LUA_INCLUDE_DIR) (Required is at 
least version "5.3")
-- Could NOT find LuaAndSwig (missing: LUA_LIBRARIES LUA_INCLUDE_DIR 
LUA_VERSION_MINOR LUA_VERSION_MAJOR) 
-- Enable Lua scripting support in LLDB: FALSE
-- Found Python3: C:/Python312/python.exe (found version "3.12.7") found 
components: Interpreter Development Development.Module Development.Embed 
-- Found PythonAndSwig: C:/Python312/libs/python312.lib  
-- Enable Python scripting support in LLDB: TRUE
-- Enable Libxml 2 support in LLDB: FALSE
-- Enable libfbsdvmcore support in LLDB: 0
-- LLDB version: 22.0.0git
-- Looking for ppoll
-- Looking for ppoll - not found
-- Looking for ptsname_r
-- Looking for ptsname_r - not found
-- Looking for accept4
-- Looking for accept4 - not found
-- Looking for termios.h
-- Looking for termios.h - not found
-- Looking for include files sys/types.h, sys/event.h
-- Looking for include files sys/types.h, sys/event.h - not found
-- Looking for process_vm_readv
-- Looking for process_vm_readv - not found
-- Looking for __NR_process_vm_readv
-- Looking for __NR_process_vm_readv - not found
-- Looking for compression_encode_buffer in compression
-- Looking for compression_encode_buffer in compression - not found
-- Skipping FreeBSDKernel plugin due to missing libfbsdvmcore
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 
-- Enforcing strict test requirements for LLDB
-- Found Python module 'psutil'
-- Found Python module 'packaging'
-- Found make: C:/ninja/make.exe
CMake Error at 
C:/buildbot/as-builder-10/lldb-x86-64/llvm-project/lldb/unittests/CMakeLists.txt:25
 (message):
  The LLDBBreakpointTests are not allowed to link liblldb.
Call Stack (most recent call first):
  
C:/buildbot/as-builder-10/lldb-x86-64/llvm-project/lldb/unittests/Breakpoint/CMakeLists.txt:1
 (add_lldb_unittest)


-- Configuring incomplete, errors occurred!
See also 
"C:/buildbot/as-builder-10/lldb-x86-64/build/CMakeFiles/CMakeOutput.log".
See also 
"C:/buildbot/as-builder-10/lldb-x86-64/build/CMakeFiles/CMakeError.log".

```



https://github.com/llvm/llvm-project/pull/162370
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][windows] add support for out of PATH python.dll resolution (PR #162509)

2025-10-11 Thread Charles Zablit via lldb-commits

charles-zablit wrote:

> Please note that this patch has broken 
> [lldb-remote-linux-win](https://lab.llvm.org/buildbot/#/builders/197).
> 
> ```
> C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\tools\driver\Driver.cpp(465):
>  error C2065: 'LLDB_PYTHON_DLL_RELATIVE_PATH': undeclared identifier
> ```
> 
> [lab.llvm.org/buildbot#/builders/197/builds/9689](https://lab.llvm.org/buildbot/#/builders/197/builds/9689)
> 
> Could you please take a look at that?

Thank you for letting me know, I have opened a PR for the fix here:
- https://github.com/llvm/llvm-project/pull/162705

https://github.com/llvm/llvm-project/pull/162509
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [debugserver] Implement MultiMemRead packet (PR #162670)

2025-10-11 Thread Jason Molenda via lldb-commits


@@ -3160,6 +3165,140 @@ rnb_err_t RNBRemote::HandlePacket_m(const char *p) {
   return SendPacket(ostrm.str());
 }
 
+/// Returns true if `str` starts with `prefix`.
+static bool starts_with(std::string_view str, std::string_view prefix) {
+  return str.size() >= prefix.size() &&
+ str.compare(0, prefix.size(), prefix) == 0;
+}
+
+/// Attempts to parse a prefix of `number_str` as a number of type `T`. If
+/// successful, the number is returned and the prefix is dropped from
+/// `number_str`.
+template 
+static std::optional extract_number(std::string_view &number_str) {
+  static_assert(std::is_integral());
+  char *str_end = nullptr;
+  errno = 0;
+  nub_addr_t number = strtoull(number_str.data(), &str_end, 16);
+  if (errno != 0)
+return std::nullopt;
+  assert(str_end);
+  number_str.remove_prefix(str_end - number_str.data());
+  return number;
+}
+
+/// Splits `list_str` into multiple string_views separated by `,`.
+static std::vector
+parse_comma_separated_list(std::string_view list_str) {
+  std::vector list;
+  while (!list_str.empty()) {
+auto pos = list_str.find(',');
+list.push_back(list_str.substr(0, pos));
+if (pos == list_str.npos)
+  break;
+list_str.remove_prefix(pos + 1);
+  }
+  return list;
+}
+
+rnb_err_t RNBRemote::HandlePacket_MultiMemRead(const char *p) {
+  const std::string_view packet_name("MultiMemRead:");
+  std::string_view packet(p);
+
+  if (!starts_with(packet, packet_name))
+return HandlePacket_ILLFORMED(__FILE__, __LINE__, p,
+  "Invalid MultiMemRead packet prefix");
+
+  packet.remove_prefix(packet_name.size());
+
+  const std::string_view ranges_prefix("ranges:");
+  if (!starts_with(packet, ranges_prefix))
+return HandlePacket_ILLFORMED(__FILE__, __LINE__, packet.data(),
+  "Missing 'ranges' in MultiMemRead packet");
+  packet.remove_prefix(ranges_prefix.size());
+
+  std::vector> ranges;
+  std::size_t total_length = 0;
+
+  // Ranges should have the form: ,[,,]*;
+  auto end_of_ranges_pos = packet.find(';');
+  if (end_of_ranges_pos == packet.npos)
+return HandlePacket_ILLFORMED(__FILE__, __LINE__, packet.data(),
+  "MultiMemRead missing end of ranges marker");
+
+  std::vector numbers_list =
+  parse_comma_separated_list(packet.substr(0, end_of_ranges_pos));
+  packet.remove_prefix(end_of_ranges_pos + 1);
+
+  // Ranges are pairs, so the number of elements must be even.
+  if (numbers_list.size() % 2 == 1)
+return HandlePacket_ILLFORMED(
+__FILE__, __LINE__, p,
+"MultiMemRead has an odd number of numbers for the ranges");
+
+  for (unsigned idx = 0; idx < numbers_list.size(); idx += 2) {
+std::optional maybe_addr =
+extract_number(numbers_list[idx]);
+std::optional maybe_length =
+extract_number(numbers_list[idx + 1]);
+if (!maybe_addr || !maybe_length)
+  return HandlePacket_ILLFORMED(__FILE__, __LINE__, packet.data(),
+"Invalid MultiMemRead range");
+// A sanity check that the packet requested is not too large or a negative
+// number.
+if (*maybe_length > 4 * 1024 * 1024)
+  return HandlePacket_ILLFORMED(__FILE__, __LINE__, packet.data(),
+"MultiMemRead length is too large");
+
+ranges.emplace_back(*maybe_addr, *maybe_length);
+total_length += *maybe_length;
+  }
+
+  if (ranges.empty())
+return HandlePacket_ILLFORMED(__FILE__, __LINE__, p,
+  "MultiMemRead has an empty range list");
+
+  // If 'options:' is present, ensure it's empty.
+  const std::string_view options_prefix("options:");
+  if (starts_with(packet, options_prefix)) {

jasonmolenda wrote:

This hardcodes that `options` key must come after `ranges` key.  I'd `find` 
these from the start of the original packet string.

https://github.com/llvm/llvm-project/pull/162670
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits