[Lldb-commits] [lldb] [lldb-dap] Don't emit a removed module event for unseen modules (PR #139324)

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

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `lldb-aarch64-windows` 
running on `linaro-armv8-windows-msvc-05` while building `lldb` at step 6 
"test".

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


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

```
Step 6 (test) failure: build (failure)
...
UNSUPPORTED: lldb-api :: tools/lldb-dap/exception/cpp/TestDAP_exception_cpp.py 
(1179 of 2156)
UNSUPPORTED: lldb-api :: 
tools/lldb-dap/exception/objc/TestDAP_exception_objc.py (1180 of 2156)
UNSUPPORTED: lldb-api :: 
tools/lldb-dap/extendedStackTrace/TestDAP_extendedStackTrace.py (1181 of 2156)
UNSUPPORTED: lldb-api :: 
tools/lldb-dap/instruction-breakpoint/TestDAP_instruction_breakpoint.py (1182 
of 2156)
PASS: lldb-api :: tools/lldb-dap/io/TestDAP_io.py (1183 of 2156)
UNSUPPORTED: lldb-api :: tools/lldb-dap/locations/TestDAP_locations.py (1184 of 
2156)
UNSUPPORTED: lldb-api :: tools/lldb-dap/memory/TestDAP_memory.py (1185 of 2156)
PASS: lldb-api :: tools/lldb-dap/launch/TestDAP_launch.py (1186 of 2156)
UNSUPPORTED: lldb-api :: tools/lldb-dap/module/TestDAP_module.py (1187 of 2156)
UNRESOLVED: lldb-api :: tools/lldb-dap/module-event/TestDAP_module_event.py 
(1188 of 2156)
 TEST 'lldb-api :: 
tools/lldb-dap/module-event/TestDAP_module_event.py' FAILED 
Script:
--
C:/Users/tcwg/scoop/apps/python/current/python.exe 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/llvm-project/lldb\test\API\dotest.py
 -u CXXFLAGS -u CFLAGS --env 
LLVM_LIBS_DIR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./lib --env 
LLVM_INCLUDE_DIR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/include 
--env LLVM_TOOLS_DIR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin 
--arch aarch64 --build-dir 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex 
--lldb-module-cache-dir 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex/module-cache-lldb\lldb-api
 --clang-module-cache-dir 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex/module-cache-clang\lldb-api
 --executable 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/lldb.exe --compiler 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/clang.exe --dsymutil 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/dsymutil.exe --make 
C:/Users/tcwg/scoop/shims/make.exe --llvm-tools-dir 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin --lldb-obj-root 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/tools/lldb --lldb-libs-dir 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./lib 
--skip-category=watchpoint 
C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\API\tools\lldb-dap\module-event
 -p TestDAP_module_event.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 21.0.0git (https://github.com/llvm/llvm-project.git revision 
b7c449ac0b0c4ccbe99937052c9428960cea7664)
  clang revision b7c449ac0b0c4ccbe99937052c9428960cea7664
  llvm revision b7c449ac0b0c4ccbe99937052c9428960cea7664
Skipping the following test categories: ['watchpoint', 'libc++', 'libstdcxx', 
'dwo', 'dsym', 'gmodules', 'debugserver', 'objc', 'fork', 'pexpect']


--
Command Output (stderr):
--
FAIL: LLDB 
(C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: 
test_module_event (TestDAP_module_event.TestDAP_module_event.test_module_event)

==

ERROR: test_module_event 
(TestDAP_module_event.TestDAP_module_event.test_module_event)

--

Error when building test subject.



Build Command:

C:/Users/tcwg/scoop/shims/make.exe 
'VPATH=C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\API\tools\lldb-dap\module-event'
 -C 
'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\lldb-test-build.noindex\tools\lldb-dap\module-event\TestDAP_module_event.test_module_event'
 -I 
'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\API\tools\lldb-dap\module-event'
 -I 
'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\packages\Python\lldbsuite\test\make'
 -f 
'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\API\tools\lldb-dap\module-event\Makefile'
 all ARCH=aarch64 
'CC=C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe' 
CC_TYPE=clang 
'CXX=C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang++.exe' 
'LLVM_AR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin\llvm-ar.exe'
 'AR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin\llvm-ar.exe' 
'OBJCOPY=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin\llvm-objcopy.exe'
 
'STRIP=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin\llvm-strip.exe'
 
'ARCHIVER=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin\llvm-ar.exe

[Lldb-commits] [lldb] [lldb-dap] Split lldb-dap into library and tool (NFC) (PR #139402)

2025-05-10 Thread Jonas Devlieghere via lldb-commits

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

>From b0996a236d9eaf70de562ae2cf0e1900417cae93 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Sat, 10 May 2025 12:08:29 -0700
Subject: [PATCH 1/2] [lldb-dap] Split lldb-dap into library and tool (NFC)

Split lldb-dap into a library (lldbDAP) and a tool (lldb-dap). The
motivation is being able to link parts of lldb-dap separately, for
example to support unit testing and fizzing.
---
 lldb/tools/lldb-dap/CMakeLists.txt| 22 ++-
 lldb/tools/lldb-dap/tool/CMakeLists.txt   | 28 +++
 .../{ => tool}/lldb-dap-Info.plist.in |  0
 lldb/tools/lldb-dap/{ => tool}/lldb-dap.cpp   |  0
 4 files changed, 36 insertions(+), 14 deletions(-)
 create mode 100644 lldb/tools/lldb-dap/tool/CMakeLists.txt
 rename lldb/tools/lldb-dap/{ => tool}/lldb-dap-Info.plist.in (100%)
 rename lldb/tools/lldb-dap/{ => tool}/lldb-dap.cpp (100%)

diff --git a/lldb/tools/lldb-dap/CMakeLists.txt 
b/lldb/tools/lldb-dap/CMakeLists.txt
index a9dc19006293b..25bacd91fe581 100644
--- a/lldb/tools/lldb-dap/CMakeLists.txt
+++ b/lldb/tools/lldb-dap/CMakeLists.txt
@@ -1,20 +1,14 @@
-if(APPLE)
-  configure_file(
-${CMAKE_CURRENT_SOURCE_DIR}/lldb-dap-Info.plist.in
-${CMAKE_CURRENT_BINARY_DIR}/lldb-dap-Info.plist
-)
-  # Inline info plist in binary (use target_link_options for this as soon as 
CMake 3.13 is available)
-  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} 
-Wl,-sectcreate,__TEXT,__info_plist,${CMAKE_CURRENT_BINARY_DIR}/lldb-dap-Info.plist")
-endif()
-
 # We need to include the llvm components we depend on manually, as liblldb does
 # not re-export those.
 set(LLVM_LINK_COMPONENTS Support)
 set(LLVM_TARGET_DEFINITIONS Options.td)
 tablegen(LLVM Options.inc -gen-opt-parser-defs)
 add_public_tablegen_target(LLDBDAPOptionsTableGen)
-add_lldb_tool(lldb-dap
-  lldb-dap.cpp
+
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
+
+add_lldb_library(lldbDAP
   Breakpoint.cpp
   BreakpointBase.cpp
   DAP.cpp
@@ -85,10 +79,8 @@ add_lldb_tool(lldb-dap
 Support
   )
 
-target_include_directories(lldb-dap PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
-
 if(LLDB_DAP_WELCOME_MESSAGE)
-  target_compile_definitions(lldb-dap
+  target_compile_definitions(lldbDAP
 PRIVATE
 -DLLDB_DAP_WELCOME_MESSAGE=\"${LLDB_DAP_WELCOME_MESSAGE}\")
 endif()
@@ -105,3 +97,5 @@ if(LLDB_BUILD_FRAMEWORK)
   "@loader_path/../../Library/PrivateFrameworks"
   )
 endif()
+
+add_subdirectory(tool)
diff --git a/lldb/tools/lldb-dap/tool/CMakeLists.txt 
b/lldb/tools/lldb-dap/tool/CMakeLists.txt
new file mode 100644
index 0..e418737bc05b1
--- /dev/null
+++ b/lldb/tools/lldb-dap/tool/CMakeLists.txt
@@ -0,0 +1,28 @@
+if(APPLE)
+  configure_file(
+${CMAKE_CURRENT_SOURCE_DIR}/lldb-dap-Info.plist.in
+${CMAKE_CURRENT_BINARY_DIR}/lldb-dap-Info.plist
+)
+  # Inline info plist in binary (use target_link_options for this as soon as 
CMake 3.13 is available)
+  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} 
-Wl,-sectcreate,__TEXT,__info_plist,${CMAKE_CURRENT_BINARY_DIR}/lldb-dap-Info.plist")
+endif()
+
+add_lldb_tool(lldb-dap
+  lldb-dap.cpp
+
+  LINK_LIBS
+lldbDAP
+  )
+
+if(LLDB_BUILD_FRAMEWORK)
+  # In the build-tree, we know the exact path to the framework directory.
+  # The installed framework can be in different locations.
+  lldb_setup_rpaths(lldb-dap
+BUILD_RPATH
+  "${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}"
+INSTALL_RPATH
+  "@loader_path/../../../SharedFrameworks"
+  "@loader_path/../../System/Library/PrivateFrameworks"
+  "@loader_path/../../Library/PrivateFrameworks"
+  )
+endif()
diff --git a/lldb/tools/lldb-dap/lldb-dap-Info.plist.in 
b/lldb/tools/lldb-dap/tool/lldb-dap-Info.plist.in
similarity index 100%
rename from lldb/tools/lldb-dap/lldb-dap-Info.plist.in
rename to lldb/tools/lldb-dap/tool/lldb-dap-Info.plist.in
diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp 
b/lldb/tools/lldb-dap/tool/lldb-dap.cpp
similarity index 100%
rename from lldb/tools/lldb-dap/lldb-dap.cpp
rename to lldb/tools/lldb-dap/tool/lldb-dap.cpp

>From 6f0768f467b3991069ae6c35e5bb9f612340444d Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Sat, 10 May 2025 12:32:07 -0700
Subject: [PATCH 2/2] Add simple unit tests as an example

---
 lldb/tools/lldb-dap/CMakeLists.txt   |  6 ++---
 lldb/unittests/CMakeLists.txt|  1 +
 lldb/unittests/DAP/CMakeLists.txt|  8 +++
 lldb/unittests/DAP/JSONUtilsTest.cpp | 33 
 4 files changed, 45 insertions(+), 3 deletions(-)
 create mode 100644 lldb/unittests/DAP/CMakeLists.txt
 create mode 100644 lldb/unittests/DAP/JSONUtilsTest.cpp

diff --git a/lldb/tools/lldb-dap/CMakeLists.txt 
b/lldb/tools/lldb-dap/CMakeLists.txt
index 25bacd91fe581..cdca4a0d62e8a 100644
--- a/lldb/tools/lldb-dap/CMakeLists.txt
+++ b/lldb/tools/lldb-dap/CMakeLists.txt
@@ -5,9 +5,6 @@ set(LLVM_TARGET

[Lldb-commits] [lldb] [lldb-dap] Split lldb-dap into library and tool (NFC) (PR #139402)

2025-05-10 Thread John Harrison via lldb-commits

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

Looks good to me, I started something similar to write unit tests for the c++ 
code a while ago but never made it to a PR. Looks good to start having more 
direct tests of the c++ parts.

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


[Lldb-commits] [lldb] [lldb] Remove redundant calls to std::unique_ptr::get (NFC) (PR #139428)

2025-05-10 Thread Kazu Hirata via lldb-commits

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

None

>From 4001252c4cd0cc8fedfb1773ef3a53befe2774f6 Mon Sep 17 00:00:00 2001
From: Kazu Hirata 
Date: Tue, 25 Mar 2025 00:24:37 -0700
Subject: [PATCH] [lldb] Remove redundant calls to std::unique_ptr::get
 (NFC)

---
 lldb/source/Target/RegisterContextUnwind.cpp | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lldb/source/Target/RegisterContextUnwind.cpp 
b/lldb/source/Target/RegisterContextUnwind.cpp
index 4c760b84e45a5..f56dda187e12a 100644
--- a/lldb/source/Target/RegisterContextUnwind.cpp
+++ b/lldb/source/Target/RegisterContextUnwind.cpp
@@ -279,7 +279,7 @@ void RegisterContextUnwind::InitializeZerothFrame() {
   call_site_unwind_plan = func_unwinders_sp->GetUnwindPlanAtCallSite(
   process->GetTarget(), m_thread);
 
-if (call_site_unwind_plan.get() != nullptr) {
+if (call_site_unwind_plan != nullptr) {
   m_fallback_unwind_plan_sp = call_site_unwind_plan;
   if (TryFallbackUnwindPlan())
 cfa_status = true;
@@ -1722,10 +1722,10 @@ RegisterContextUnwind::SavedLocationForRegister(
 // tricky frame and our usual techniques can continue to be used.
 
 bool RegisterContextUnwind::TryFallbackUnwindPlan() {
-  if (m_fallback_unwind_plan_sp.get() == nullptr)
+  if (m_fallback_unwind_plan_sp == nullptr)
 return false;
 
-  if (m_full_unwind_plan_sp.get() == nullptr)
+  if (m_full_unwind_plan_sp == nullptr)
 return false;
 
   if (m_full_unwind_plan_sp.get() == m_fallback_unwind_plan_sp.get() ||
@@ -1773,7 +1773,7 @@ bool RegisterContextUnwind::TryFallbackUnwindPlan() {
   // fallback UnwindPlan. We checked if m_fallback_unwind_plan_sp was nullptr
   // at the top -- the only way it became nullptr since then is via
   // SavedLocationForRegister().
-  if (m_fallback_unwind_plan_sp.get() == nullptr)
+  if (m_fallback_unwind_plan_sp == nullptr)
 return true;
 
   // Switch the full UnwindPlan to be the fallback UnwindPlan.  If we decide
@@ -1862,10 +1862,10 @@ bool RegisterContextUnwind::TryFallbackUnwindPlan() {
 }
 
 bool RegisterContextUnwind::ForceSwitchToFallbackUnwindPlan() {
-  if (m_fallback_unwind_plan_sp.get() == nullptr)
+  if (m_fallback_unwind_plan_sp == nullptr)
 return false;
 
-  if (m_full_unwind_plan_sp.get() == nullptr)
+  if (m_full_unwind_plan_sp == nullptr)
 return false;
 
   if (m_full_unwind_plan_sp.get() == m_fallback_unwind_plan_sp.get() ||

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


[Lldb-commits] [lldb] bae77d5 - [lldb-dap] Skip TestDAP_module_event on Windows

2025-05-10 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2025-05-10T09:36:07-07:00
New Revision: bae77d5b02df562277a335433551e2c53b37917a

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

LOG: [lldb-dap] Skip TestDAP_module_event on Windows

Added: 


Modified: 
lldb/test/API/tools/lldb-dap/module-event/TestDAP_module_event.py

Removed: 




diff  --git a/lldb/test/API/tools/lldb-dap/module-event/TestDAP_module_event.py 
b/lldb/test/API/tools/lldb-dap/module-event/TestDAP_module_event.py
index c216b5d92823c..19de35b60a3ef 100644
--- a/lldb/test/API/tools/lldb-dap/module-event/TestDAP_module_event.py
+++ b/lldb/test/API/tools/lldb-dap/module-event/TestDAP_module_event.py
@@ -7,6 +7,7 @@
 
 
 class TestDAP_module_event(lldbdap_testcase.DAPTestCaseBase):
+@skipIfWindows
 def test_module_event(self):
 program = self.getBuildArtifact("a.out")
 self.build_and_launch(program, stopOnEntry=True)



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


[Lldb-commits] [lldb] [lldb] Remove redundant calls to std::unique_ptr::get (NFC) (PR #139428)

2025-05-10 Thread Alex Langford via lldb-commits

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


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


[Lldb-commits] [lldb] fadd427 - [lldb] Remove redundant calls to std::unique_ptr::get (NFC) (#139428)

2025-05-10 Thread via lldb-commits

Author: Kazu Hirata
Date: 2025-05-10T19:31:35-07:00
New Revision: fadd42b23a63248d57745126a3a30db71b02

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

LOG: [lldb] Remove redundant calls to std::unique_ptr::get (NFC) (#139428)

Added: 


Modified: 
lldb/source/Target/RegisterContextUnwind.cpp

Removed: 




diff  --git a/lldb/source/Target/RegisterContextUnwind.cpp 
b/lldb/source/Target/RegisterContextUnwind.cpp
index 4c760b84e45a5..f56dda187e12a 100644
--- a/lldb/source/Target/RegisterContextUnwind.cpp
+++ b/lldb/source/Target/RegisterContextUnwind.cpp
@@ -279,7 +279,7 @@ void RegisterContextUnwind::InitializeZerothFrame() {
   call_site_unwind_plan = func_unwinders_sp->GetUnwindPlanAtCallSite(
   process->GetTarget(), m_thread);
 
-if (call_site_unwind_plan.get() != nullptr) {
+if (call_site_unwind_plan != nullptr) {
   m_fallback_unwind_plan_sp = call_site_unwind_plan;
   if (TryFallbackUnwindPlan())
 cfa_status = true;
@@ -1722,10 +1722,10 @@ RegisterContextUnwind::SavedLocationForRegister(
 // tricky frame and our usual techniques can continue to be used.
 
 bool RegisterContextUnwind::TryFallbackUnwindPlan() {
-  if (m_fallback_unwind_plan_sp.get() == nullptr)
+  if (m_fallback_unwind_plan_sp == nullptr)
 return false;
 
-  if (m_full_unwind_plan_sp.get() == nullptr)
+  if (m_full_unwind_plan_sp == nullptr)
 return false;
 
   if (m_full_unwind_plan_sp.get() == m_fallback_unwind_plan_sp.get() ||
@@ -1773,7 +1773,7 @@ bool RegisterContextUnwind::TryFallbackUnwindPlan() {
   // fallback UnwindPlan. We checked if m_fallback_unwind_plan_sp was nullptr
   // at the top -- the only way it became nullptr since then is via
   // SavedLocationForRegister().
-  if (m_fallback_unwind_plan_sp.get() == nullptr)
+  if (m_fallback_unwind_plan_sp == nullptr)
 return true;
 
   // Switch the full UnwindPlan to be the fallback UnwindPlan.  If we decide
@@ -1862,10 +1862,10 @@ bool RegisterContextUnwind::TryFallbackUnwindPlan() {
 }
 
 bool RegisterContextUnwind::ForceSwitchToFallbackUnwindPlan() {
-  if (m_fallback_unwind_plan_sp.get() == nullptr)
+  if (m_fallback_unwind_plan_sp == nullptr)
 return false;
 
-  if (m_full_unwind_plan_sp.get() == nullptr)
+  if (m_full_unwind_plan_sp == nullptr)
 return false;
 
   if (m_full_unwind_plan_sp.get() == m_fallback_unwind_plan_sp.get() ||



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


[Lldb-commits] [lldb] [lldb] Remove redundant calls to std::unique_ptr::get (NFC) (PR #139428)

2025-05-10 Thread Kazu Hirata via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Provide lr value in faulting frame on arm64 (PR #138805)

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

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

>From 4fc9acd03a58a3617b113352c48e5dd2fdb58eda Mon Sep 17 00:00:00 2001
From: Jason Molenda 
Date: Tue, 6 May 2025 22:37:17 -0700
Subject: [PATCH 01/12] [lldb] Provide lr value in faulting frame on arm64

When a frameless function faults or is interrupted asynchronously,
the UnwindPlan MAY have no register location rule for the return
address register (lr on arm64); the value is simply live in the
lr register when it was interrupted, and the frame below this on
the stack -- e.g. sigtramp on a Unix system -- has the full
register context, including that register.

RegisterContextUnwind::SavedLocationForRegister, when asked to find
the caller's pc value, will first see if there is a pc register
location.  If there isn't, on a Return Address Register architecture
like arm/mips/riscv, we rewrite the register request from "pc" to
"RA register", and search for a location.

On frame 0 (the live frame) and an interrupted frame, the UnwindPlan
may have no register location rule for the RA Reg, that is valid.
A frameless function that never calls another may simply keep the
return address in the live register the whole way.  Our instruction
emulation unwind plans explicitly add a rule (see Pavel's May 2024
change https://github.com/llvm/llvm-project/pull/91321 ), but an
UnwindPlan sourced from debug_frame may not.

I've got a case where this exactly happens - clang debug_frame for
arm64 where there is no register location for the lr in a frameless
function.  There is a fault in the middle of this frameless function
and we only get the lr value from the fault handler below this frame
if lr has a register location of `IsSame`, in line with Pavel's
2024 change.

Similar to how we see a request of the RA Reg from frame 0 after
failing to find an unwind location for the pc register, the same
style of special casing is needed when this is a function that
was interrupted.

Without this change, we can find the pc of the frame that was
executing when it was interrupted, but we need $lr to find its
caller, and we don't descend down to the trap handler to get that
value, truncating the stack.

rdar://145614545
---
 lldb/source/Target/RegisterContextUnwind.cpp | 19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/lldb/source/Target/RegisterContextUnwind.cpp 
b/lldb/source/Target/RegisterContextUnwind.cpp
index 3ed49e12476dd..23a86bee2518b 100644
--- a/lldb/source/Target/RegisterContextUnwind.cpp
+++ b/lldb/source/Target/RegisterContextUnwind.cpp
@@ -1377,6 +1377,7 @@ RegisterContextUnwind::SavedLocationForRegister(
 }
   }
 
+  // Check if the active_row has a register location listed.
   if (regnum.IsValid() &&
   
active_row->GetRegisterInfo(regnum.GetAsKind(unwindplan_registerkind),
   unwindplan_regloc)) {
@@ -1390,11 +1391,10 @@ RegisterContextUnwind::SavedLocationForRegister(
   // This is frame 0 and we're retrieving the PC and it's saved in a Return
   // Address register and it hasn't been saved anywhere yet -- that is,
   // it's still live in the actual register. Handle this specially.
-
   if (!have_unwindplan_regloc && return_address_reg.IsValid() &&
-  IsFrameZero()) {
-if (return_address_reg.GetAsKind(eRegisterKindLLDB) !=
-LLDB_INVALID_REGNUM) {
+  return_address_reg.GetAsKind(eRegisterKindLLDB) !=
+  LLDB_INVALID_REGNUM) {
+if (IsFrameZero()) {
   lldb_private::UnwindLLDB::ConcreteRegisterLocation new_regloc;
   new_regloc.type = UnwindLLDB::ConcreteRegisterLocation::
   eRegisterInLiveRegisterContext;
@@ -1408,6 +1408,17 @@ RegisterContextUnwind::SavedLocationForRegister(
return_address_reg.GetAsKind(eRegisterKindLLDB),
return_address_reg.GetAsKind(eRegisterKindLLDB));
   return UnwindLLDB::RegisterSearchResult::eRegisterFound;
+} else if (BehavesLikeZerothFrame()) {
+  // This function was interrupted asynchronously -- it faulted,
+  // an async interrupt, a timer fired, a debugger expression etc.
+  // The caller's pc is in the Return Address register, but the
+  // UnwindPlan for this function may have no location rule for
+  // the RA reg.
+  // This means that the caller's return address is in the RA reg
+  // when the function was interrupted--descend down one stack frame
+  // to retrieve it from the trap handler's saved context.
+  unwindplan_regloc.SetSame();
+  have_unwindplan_regloc = true;
 }
   }
 

>From b10162deb49ecddca6439665c2b8ea1995fdd81f Mon Sep 17 00:00:00 2001
From: Jason Molenda 
Date: Wed, 7 May 2025 23:24:17 -0700
Subject: [PATCH 02/12] Add the sources for an API test case to be written

---
 .../interrupt-and-trap-funcs.s| 92 +++

[Lldb-commits] [lldb] [lldb] Remove redundant calls to std::unique_ptr::get (NFC) (PR #139395)

2025-05-10 Thread via lldb-commits

fivemeyestoreserver wrote:

This is a well-structured codebase. I appreciate the clean separation of 
concerns.

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


[Lldb-commits] [lldb] [lldb] Remove redundant calls to std::unique_ptr::get (NFC) (PR #139395)

2025-05-10 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Kazu Hirata (kazutakahirata)


Changes



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


2 Files Affected:

- (modified) lldb/source/API/SBSaveCoreOptions.cpp (+1-1) 
- (modified) 
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h (+2-2) 


``diff
diff --git a/lldb/source/API/SBSaveCoreOptions.cpp 
b/lldb/source/API/SBSaveCoreOptions.cpp
index e101f6a25783c..15584abaac013 100644
--- a/lldb/source/API/SBSaveCoreOptions.cpp
+++ b/lldb/source/API/SBSaveCoreOptions.cpp
@@ -129,5 +129,5 @@ uint64_t SBSaveCoreOptions::GetCurrentSizeInBytes(SBError 
&error) {
 }
 
 lldb_private::SaveCoreOptions &SBSaveCoreOptions::ref() const {
-  return *m_opaque_up.get();
+  return *m_opaque_up;
 }
diff --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
index d8d519693f102..ea763b94fcc75 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
@@ -344,7 +344,7 @@ class ClangExpressionDeclMap : public ClangASTSource {
 
   /// Activate parser-specific variables
   void EnableParserVars() {
-if (!m_parser_vars.get())
+if (!m_parser_vars)
   m_parser_vars = std::make_unique();
   }
 
@@ -371,7 +371,7 @@ class ClangExpressionDeclMap : public ClangASTSource {
 
   /// Activate struct variables
   void EnableStructVars() {
-if (!m_struct_vars.get())
+if (!m_struct_vars)
   m_struct_vars.reset(new struct StructVars);
   }
 

``




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


[Lldb-commits] [lldb] [lldb] Remove redundant calls to std::unique_ptr::get (NFC) (PR #139395)

2025-05-10 Thread Kazu Hirata via lldb-commits

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

None



  



Rate limit · GitHub


  body {
background-color: #f6f8fa;
color: #24292e;
font-family: -apple-system,BlinkMacSystemFont,Segoe 
UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
font-size: 14px;
line-height: 1.5;
margin: 0;
  }

  .container { margin: 50px auto; max-width: 600px; text-align: center; 
padding: 0 24px; }

  a { color: #0366d6; text-decoration: none; }
  a:hover { text-decoration: underline; }

  h1 { line-height: 60px; font-size: 48px; font-weight: 300; margin: 0px; 
text-shadow: 0 1px 0 #fff; }
  p { color: rgba(0, 0, 0, 0.5); margin: 20px 0 40px; }

  ul { list-style: none; margin: 25px 0; padding: 0; }
  li { display: table-cell; font-weight: bold; width: 1%; }

  .logo { display: inline-block; margin-top: 35px; }
  .logo-img-2x { display: none; }
  @media
  only screen and (-webkit-min-device-pixel-ratio: 2),
  only screen and (   min--moz-device-pixel-ratio: 2),
  only screen and ( -o-min-device-pixel-ratio: 2/1),
  only screen and (min-device-pixel-ratio: 2),
  only screen and (min-resolution: 192dpi),
  only screen and (min-resolution: 2dppx) {
.logo-img-1x { display: none; }
.logo-img-2x { display: inline-block; }
  }

  #suggestions {
margin-top: 35px;
color: #ccc;
  }
  #suggestions a {
color: #66;
font-weight: 200;
font-size: 14px;
margin: 0 10px;
  }


  
  



  Whoa there!
  You have exceeded a secondary rate limit.
Please wait a few minutes before you try again;
in some cases this may take up to an hour.
  
  
https://support.github.com/contact";>Contact Support —
https://githubstatus.com";>GitHub Status —
https://twitter.com/githubstatus";>@githubstatus
  

  

  

  

  

  


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


[Lldb-commits] [lldb] [lldb] Remove redundant calls to std::unique_ptr::get (NFC) (PR #139395)

2025-05-10 Thread via lldb-commits

ayestoro wrote:

I'm impressed by the modularity of this codebase. Makes it very maintainable.

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


[Lldb-commits] [lldb] cb0f6d0 - [lldb] Simplify string comparisons (NFC) (#139394)

2025-05-10 Thread via lldb-commits

Author: Kazu Hirata
Date: 2025-05-10T10:44:04-07:00
New Revision: cb0f6d002918c6f7f02324638089d9821badcc3b

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

LOG: [lldb] Simplify string comparisons (NFC) (#139394)

Added: 


Modified: 
lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp
lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp 
b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
index a77155f6bf41e..ed6047f8f4ef3 100644
--- a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
+++ b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
@@ -818,7 +818,7 @@ class InstructionLLVMC : public lldb_private::Instruction {
 return std::make_pair(ret, osi);
   }
 case 'x':
-  if (!str.compare("0")) {
+  if (str == "0") {
 is_hex = true;
 str.push_back(*osi);
   } else {

diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp
index fd965d0127a2d..de4de0a7a22c5 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp
@@ -83,14 +83,14 @@ void ASTResultSynthesizer::TransformTopLevelDecl(Decl *D) {
   } else if (!m_top_level) {
 if (ObjCMethodDecl *method_decl = dyn_cast(D)) {
   if (m_ast_context &&
-  !method_decl->getSelector().getAsString().compare("$__lldb_expr:")) {
+  method_decl->getSelector().getAsString() == "$__lldb_expr:") {
 RecordPersistentTypes(method_decl);
 SynthesizeObjCMethodResult(method_decl);
   }
 } else if (FunctionDecl *function_decl = dyn_cast(D)) {
   // When completing user input the body of the function may be a nullptr.
   if (m_ast_context && function_decl->hasBody() &&
-  !function_decl->getNameInfo().getAsString().compare("$__lldb_expr")) 
{
+  function_decl->getNameInfo().getAsString() == "$__lldb_expr") {
 RecordPersistentTypes(function_decl);
 SynthesizeFunctionResult(function_decl);
   }

diff  --git a/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp 
b/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp
index a0cd0ee5025bd..c972c8e95f3b1 100644
--- a/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp
+++ b/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp
@@ -278,9 +278,9 @@ size_t ELFLinuxPrStatus::GetSize(const 
lldb_private::ArchSpec &arch) {
   if (arch.IsMIPS()) {
 std::string abi = arch.GetTargetABI();
 assert(!abi.empty() && "ABI is not set");
-if (!abi.compare("n64"))
+if (abi == "n64")
   return sizeof(ELFLinuxPrStatus);
-else if (!abi.compare("o32"))
+else if (abi == "o32")
   return mips_linux_pr_status_size_o32;
 // N32 ABI
 return mips_linux_pr_status_size_n32;



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


[Lldb-commits] [lldb] [lldb-dap] Move registration of requests into DAP (NFC) (PR #139397)

2025-05-10 Thread Ely Ronnen via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb] Simplify string comparisons (NFC) (PR #139394)

2025-05-10 Thread Kazu Hirata via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Remove redundant calls to std::unique_ptr::get (NFC) (PR #139395)

2025-05-10 Thread Iris Shi via lldb-commits

https://github.com/el-ev approved this pull request.


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


[Lldb-commits] [lldb] [lldb] Remove redundant calls to std::unique_ptr::get (NFC) (PR #139395)

2025-05-10 Thread Kazu Hirata via lldb-commits

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


[Lldb-commits] [lldb] d151ad6 - [lldb] Remove redundant calls to std::unique_ptr::get (NFC) (#139395)

2025-05-10 Thread via lldb-commits

Author: Kazu Hirata
Date: 2025-05-10T11:03:09-07:00
New Revision: d151ad650ccbab752f9c10c191dac24593e8198a

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

LOG: [lldb] Remove redundant calls to std::unique_ptr::get (NFC) (#139395)

Added: 


Modified: 
lldb/source/API/SBSaveCoreOptions.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h

Removed: 




diff  --git a/lldb/source/API/SBSaveCoreOptions.cpp 
b/lldb/source/API/SBSaveCoreOptions.cpp
index e101f6a25783c..15584abaac013 100644
--- a/lldb/source/API/SBSaveCoreOptions.cpp
+++ b/lldb/source/API/SBSaveCoreOptions.cpp
@@ -129,5 +129,5 @@ uint64_t SBSaveCoreOptions::GetCurrentSizeInBytes(SBError 
&error) {
 }
 
 lldb_private::SaveCoreOptions &SBSaveCoreOptions::ref() const {
-  return *m_opaque_up.get();
+  return *m_opaque_up;
 }

diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
index d8d519693f102..ea763b94fcc75 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
@@ -344,7 +344,7 @@ class ClangExpressionDeclMap : public ClangASTSource {
 
   /// Activate parser-specific variables
   void EnableParserVars() {
-if (!m_parser_vars.get())
+if (!m_parser_vars)
   m_parser_vars = std::make_unique();
   }
 
@@ -371,7 +371,7 @@ class ClangExpressionDeclMap : public ClangASTSource {
 
   /// Activate struct variables
   void EnableStructVars() {
-if (!m_struct_vars.get())
+if (!m_struct_vars)
   m_struct_vars.reset(new struct StructVars);
   }
 



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


[Lldb-commits] [lldb] [lldb] Simplify string comparisons (NFC) (PR #139394)

2025-05-10 Thread Kazu Hirata via lldb-commits

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

None

>From ab137cc177482af73941f2b4cf22aef886d500f6 Mon Sep 17 00:00:00 2001
From: Kazu Hirata 
Date: Mon, 28 Apr 2025 09:38:32 -0700
Subject: [PATCH] [lldb] Simplify string comparisons (NFC)

---
 lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp  | 2 +-
 .../Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp   | 4 ++--
 lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp| 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp 
b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
index a77155f6bf41e..ed6047f8f4ef3 100644
--- a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
+++ b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
@@ -818,7 +818,7 @@ class InstructionLLVMC : public lldb_private::Instruction {
 return std::make_pair(ret, osi);
   }
 case 'x':
-  if (!str.compare("0")) {
+  if (str == "0") {
 is_hex = true;
 str.push_back(*osi);
   } else {
diff --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp
index fd965d0127a2d..de4de0a7a22c5 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp
@@ -83,14 +83,14 @@ void ASTResultSynthesizer::TransformTopLevelDecl(Decl *D) {
   } else if (!m_top_level) {
 if (ObjCMethodDecl *method_decl = dyn_cast(D)) {
   if (m_ast_context &&
-  !method_decl->getSelector().getAsString().compare("$__lldb_expr:")) {
+  method_decl->getSelector().getAsString() == "$__lldb_expr:") {
 RecordPersistentTypes(method_decl);
 SynthesizeObjCMethodResult(method_decl);
   }
 } else if (FunctionDecl *function_decl = dyn_cast(D)) {
   // When completing user input the body of the function may be a nullptr.
   if (m_ast_context && function_decl->hasBody() &&
-  !function_decl->getNameInfo().getAsString().compare("$__lldb_expr")) 
{
+  function_decl->getNameInfo().getAsString() == "$__lldb_expr") {
 RecordPersistentTypes(function_decl);
 SynthesizeFunctionResult(function_decl);
   }
diff --git a/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp 
b/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp
index a0cd0ee5025bd..c972c8e95f3b1 100644
--- a/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp
+++ b/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp
@@ -278,9 +278,9 @@ size_t ELFLinuxPrStatus::GetSize(const 
lldb_private::ArchSpec &arch) {
   if (arch.IsMIPS()) {
 std::string abi = arch.GetTargetABI();
 assert(!abi.empty() && "ABI is not set");
-if (!abi.compare("n64"))
+if (abi == "n64")
   return sizeof(ELFLinuxPrStatus);
-else if (!abi.compare("o32"))
+else if (abi == "o32")
   return mips_linux_pr_status_size_o32;
 // N32 ABI
 return mips_linux_pr_status_size_n32;

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


[Lldb-commits] [lldb] [lldb] Simplify string comparisons (NFC) (PR #139394)

2025-05-10 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Kazu Hirata (kazutakahirata)


Changes



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


3 Files Affected:

- (modified) lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp 
(+1-1) 
- (modified) 
lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp (+2-2) 
- (modified) lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp (+2-2) 


``diff
diff --git a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp 
b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
index a77155f6bf41e..ed6047f8f4ef3 100644
--- a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
+++ b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
@@ -818,7 +818,7 @@ class InstructionLLVMC : public lldb_private::Instruction {
 return std::make_pair(ret, osi);
   }
 case 'x':
-  if (!str.compare("0")) {
+  if (str == "0") {
 is_hex = true;
 str.push_back(*osi);
   } else {
diff --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp
index fd965d0127a2d..de4de0a7a22c5 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp
@@ -83,14 +83,14 @@ void ASTResultSynthesizer::TransformTopLevelDecl(Decl *D) {
   } else if (!m_top_level) {
 if (ObjCMethodDecl *method_decl = dyn_cast(D)) {
   if (m_ast_context &&
-  !method_decl->getSelector().getAsString().compare("$__lldb_expr:")) {
+  method_decl->getSelector().getAsString() == "$__lldb_expr:") {
 RecordPersistentTypes(method_decl);
 SynthesizeObjCMethodResult(method_decl);
   }
 } else if (FunctionDecl *function_decl = dyn_cast(D)) {
   // When completing user input the body of the function may be a nullptr.
   if (m_ast_context && function_decl->hasBody() &&
-  !function_decl->getNameInfo().getAsString().compare("$__lldb_expr")) 
{
+  function_decl->getNameInfo().getAsString() == "$__lldb_expr") {
 RecordPersistentTypes(function_decl);
 SynthesizeFunctionResult(function_decl);
   }
diff --git a/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp 
b/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp
index a0cd0ee5025bd..c972c8e95f3b1 100644
--- a/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp
+++ b/lldb/source/Plugins/Process/elf-core/ThreadElfCore.cpp
@@ -278,9 +278,9 @@ size_t ELFLinuxPrStatus::GetSize(const 
lldb_private::ArchSpec &arch) {
   if (arch.IsMIPS()) {
 std::string abi = arch.GetTargetABI();
 assert(!abi.empty() && "ABI is not set");
-if (!abi.compare("n64"))
+if (abi == "n64")
   return sizeof(ELFLinuxPrStatus);
-else if (!abi.compare("o32"))
+else if (abi == "o32")
   return mips_linux_pr_status_size_o32;
 // N32 ABI
 return mips_linux_pr_status_size_n32;

``




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


[Lldb-commits] [lldb] [lldb-dap] Move registration of requests into DAP (NFC) (PR #139397)

2025-05-10 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere created 
https://github.com/llvm/llvm-project/pull/139397

Make the registration of request handlers a private implementation detail of 
the DAP class.

>From 019d481c18207b3726af24038804c71d3c4f939e Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Sat, 10 May 2025 10:22:43 -0700
Subject: [PATCH] [lldb-dap] Move registration of requests into DAP (NFC)

Make the registration of request handlers a private implementation
detail of the DAP class.
---
 lldb/tools/lldb-dap/DAP.cpp  | 43 +
 lldb/tools/lldb-dap/DAP.h| 15 ++-
 lldb/tools/lldb-dap/lldb-dap.cpp | 46 
 3 files changed, 52 insertions(+), 52 deletions(-)

diff --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp
index 9a3cc32d8c324..4feca1253be20 100644
--- a/lldb/tools/lldb-dap/DAP.cpp
+++ b/lldb/tools/lldb-dap/DAP.cpp
@@ -126,6 +126,7 @@ DAP::DAP(Log *log, const ReplMode default_repl_mode,
   [&](const ProgressEvent &event) { SendJSON(event.ToJSON()); }),
   reverse_request_seq(0), repl_mode(default_repl_mode) {
   configuration.preInitCommands = std::move(pre_init_commands);
+  RegisterRequests();
 }
 
 DAP::~DAP() = default;
@@ -1652,4 +1653,46 @@ void DAP::EventThread() {
   }
 }
 
+void DAP::RegisterRequests() {
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+
+  // Custom requests
+  RegisterRequest();
+  RegisterRequest();
+
+  // Testing requests
+  RegisterRequest();
+}
+
 } // namespace lldb_dap
diff --git a/lldb/tools/lldb-dap/DAP.h b/lldb/tools/lldb-dap/DAP.h
index cbda57d27e8d9..c2e4c2dea582e 100644
--- a/lldb/tools/lldb-dap/DAP.h
+++ b/lldb/tools/lldb-dap/DAP.h
@@ -188,7 +188,6 @@ struct DAP {
   // the old process here so we can detect this case and keep running.
   lldb::pid_t restarting_process_id;
   bool configuration_done;
-  llvm::StringMap> request_handlers;
   bool waiting_for_run_in_terminal;
   ProgressEventReporter progress_event_reporter;
   // Keep track of the last stop thread index IDs as threads won't go away
@@ -377,11 +376,6 @@ struct DAP {
 });
   }
 
-  /// Registers a request handler.
-  template  void RegisterRequest() {
-request_handlers[Handler::GetCommand()] = std::make_unique(*this);
-  }
-
   /// The set of capablities supported by this adapter.
   protocol::Capabilities GetCapabilities();
 
@@ -429,6 +423,15 @@ struct DAP {
   void StartProgressEventThread();
 
 private:
+  /// Registration of request handler.
+  /// @{
+  void RegisterRequests();
+  template  void RegisterRequest() {
+request_handlers[Handler::GetCommand()] = std::make_unique(*this);
+  }
+  llvm::StringMap> request_handlers;
+  /// @}
+
   /// Event threads.
   /// @{
   void EventThread();
diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp
index 6e17b13cc9e33..7a4cc70902a56 100644
--- a/lldb/tools/lldb-dap/lldb-dap.cpp
+++ b/lldb/tools/lldb-dap/lldb-dap.cpp
@@ -115,48 +115,6 @@ class LLDBDAPOptTable : public llvm::opt::GenericOptTable {
 };
 } // anonymous namespace
 
-static void RegisterRequestCallbacks(DAP &dap) {
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-
-  // Custom requests
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-
-  // Testing requests
-  dap.RegisterRequest();
-}
-
 static void PrintHelp(LLDBDAPOptTable &table, llvm::StringRef tool_name) {
   std::string usage_str = tool_name.str() + " options";
   table.printHelp(llvm::outs(), usage_str.c_str(), "LLDB DAP", false);
@@ -342,8 +300,6 @@ serveConnection(const Socket::

[Lldb-commits] [lldb] [lldb-dap] Move registration of requests into DAP (NFC) (PR #139397)

2025-05-10 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)


Changes

Make the registration of request handlers a private implementation detail of 
the DAP class.

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


3 Files Affected:

- (modified) lldb/tools/lldb-dap/DAP.cpp (+43) 
- (modified) lldb/tools/lldb-dap/DAP.h (+9-6) 
- (modified) lldb/tools/lldb-dap/lldb-dap.cpp (-46) 


``diff
diff --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp
index 9a3cc32d8c324..4feca1253be20 100644
--- a/lldb/tools/lldb-dap/DAP.cpp
+++ b/lldb/tools/lldb-dap/DAP.cpp
@@ -126,6 +126,7 @@ DAP::DAP(Log *log, const ReplMode default_repl_mode,
   [&](const ProgressEvent &event) { SendJSON(event.ToJSON()); }),
   reverse_request_seq(0), repl_mode(default_repl_mode) {
   configuration.preInitCommands = std::move(pre_init_commands);
+  RegisterRequests();
 }
 
 DAP::~DAP() = default;
@@ -1652,4 +1653,46 @@ void DAP::EventThread() {
   }
 }
 
+void DAP::RegisterRequests() {
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+
+  // Custom requests
+  RegisterRequest();
+  RegisterRequest();
+
+  // Testing requests
+  RegisterRequest();
+}
+
 } // namespace lldb_dap
diff --git a/lldb/tools/lldb-dap/DAP.h b/lldb/tools/lldb-dap/DAP.h
index cbda57d27e8d9..c2e4c2dea582e 100644
--- a/lldb/tools/lldb-dap/DAP.h
+++ b/lldb/tools/lldb-dap/DAP.h
@@ -188,7 +188,6 @@ struct DAP {
   // the old process here so we can detect this case and keep running.
   lldb::pid_t restarting_process_id;
   bool configuration_done;
-  llvm::StringMap> request_handlers;
   bool waiting_for_run_in_terminal;
   ProgressEventReporter progress_event_reporter;
   // Keep track of the last stop thread index IDs as threads won't go away
@@ -377,11 +376,6 @@ struct DAP {
 });
   }
 
-  /// Registers a request handler.
-  template  void RegisterRequest() {
-request_handlers[Handler::GetCommand()] = std::make_unique(*this);
-  }
-
   /// The set of capablities supported by this adapter.
   protocol::Capabilities GetCapabilities();
 
@@ -429,6 +423,15 @@ struct DAP {
   void StartProgressEventThread();
 
 private:
+  /// Registration of request handler.
+  /// @{
+  void RegisterRequests();
+  template  void RegisterRequest() {
+request_handlers[Handler::GetCommand()] = std::make_unique(*this);
+  }
+  llvm::StringMap> request_handlers;
+  /// @}
+
   /// Event threads.
   /// @{
   void EventThread();
diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp
index 6e17b13cc9e33..7a4cc70902a56 100644
--- a/lldb/tools/lldb-dap/lldb-dap.cpp
+++ b/lldb/tools/lldb-dap/lldb-dap.cpp
@@ -115,48 +115,6 @@ class LLDBDAPOptTable : public llvm::opt::GenericOptTable {
 };
 } // anonymous namespace
 
-static void RegisterRequestCallbacks(DAP &dap) {
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-
-  // Custom requests
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-
-  // Testing requests
-  dap.RegisterRequest();
-}
-
 static void PrintHelp(LLDBDAPOptTable &table, llvm::StringRef tool_name) {
   std::string usage_str = tool_name.str() + " options";
   table.printHelp(llvm::outs(), usage_str.c_str(), "LLDB DAP", false);
@@ -342,8 +300,6 @@ serveConnection(const Socket::SocketProtocol &protocol, 
const std::string &name,
 return;
   }
 
-  RegisterRequestCallbacks(dap);
-
   {
 std::scoped_lock lock(dap_sessions_mutex);
 dap_sessions[io.get()] = &dap;
@@ -597,8 +553,6 @@ int main(int argc, char *argv[]) {
 return 

[Lldb-commits] [lldb] [lldb] Simplify string comparisons (NFC) (PR #139394)

2025-05-10 Thread Jonas Devlieghere via lldb-commits

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


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


[Lldb-commits] [lldb] a92de02 - [lldb-dap] Move registration of requests into DAP (NFC) (#139397)

2025-05-10 Thread via lldb-commits

Author: Jonas Devlieghere
Date: 2025-05-10T11:53:46-07:00
New Revision: a92de02ea3553b7536187f57870b4c1da9b21b2e

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

LOG: [lldb-dap] Move registration of requests into DAP (NFC) (#139397)

Make the registration of request handlers a private implementation
detail of the DAP class.

Added: 


Modified: 
lldb/tools/lldb-dap/DAP.cpp
lldb/tools/lldb-dap/DAP.h
lldb/tools/lldb-dap/lldb-dap.cpp

Removed: 




diff  --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp
index 9a3cc32d8c324..4feca1253be20 100644
--- a/lldb/tools/lldb-dap/DAP.cpp
+++ b/lldb/tools/lldb-dap/DAP.cpp
@@ -126,6 +126,7 @@ DAP::DAP(Log *log, const ReplMode default_repl_mode,
   [&](const ProgressEvent &event) { SendJSON(event.ToJSON()); }),
   reverse_request_seq(0), repl_mode(default_repl_mode) {
   configuration.preInitCommands = std::move(pre_init_commands);
+  RegisterRequests();
 }
 
 DAP::~DAP() = default;
@@ -1652,4 +1653,46 @@ void DAP::EventThread() {
   }
 }
 
+void DAP::RegisterRequests() {
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+  RegisterRequest();
+
+  // Custom requests
+  RegisterRequest();
+  RegisterRequest();
+
+  // Testing requests
+  RegisterRequest();
+}
+
 } // namespace lldb_dap

diff  --git a/lldb/tools/lldb-dap/DAP.h b/lldb/tools/lldb-dap/DAP.h
index cbda57d27e8d9..c2e4c2dea582e 100644
--- a/lldb/tools/lldb-dap/DAP.h
+++ b/lldb/tools/lldb-dap/DAP.h
@@ -188,7 +188,6 @@ struct DAP {
   // the old process here so we can detect this case and keep running.
   lldb::pid_t restarting_process_id;
   bool configuration_done;
-  llvm::StringMap> request_handlers;
   bool waiting_for_run_in_terminal;
   ProgressEventReporter progress_event_reporter;
   // Keep track of the last stop thread index IDs as threads won't go away
@@ -377,11 +376,6 @@ struct DAP {
 });
   }
 
-  /// Registers a request handler.
-  template  void RegisterRequest() {
-request_handlers[Handler::GetCommand()] = std::make_unique(*this);
-  }
-
   /// The set of capablities supported by this adapter.
   protocol::Capabilities GetCapabilities();
 
@@ -429,6 +423,15 @@ struct DAP {
   void StartProgressEventThread();
 
 private:
+  /// Registration of request handler.
+  /// @{
+  void RegisterRequests();
+  template  void RegisterRequest() {
+request_handlers[Handler::GetCommand()] = std::make_unique(*this);
+  }
+  llvm::StringMap> request_handlers;
+  /// @}
+
   /// Event threads.
   /// @{
   void EventThread();

diff  --git a/lldb/tools/lldb-dap/lldb-dap.cpp 
b/lldb/tools/lldb-dap/lldb-dap.cpp
index 6e17b13cc9e33..7a4cc70902a56 100644
--- a/lldb/tools/lldb-dap/lldb-dap.cpp
+++ b/lldb/tools/lldb-dap/lldb-dap.cpp
@@ -115,48 +115,6 @@ class LLDBDAPOptTable : public llvm::opt::GenericOptTable {
 };
 } // anonymous namespace
 
-static void RegisterRequestCallbacks(DAP &dap) {
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-
-  // Custom requests
-  dap.RegisterRequest();
-  dap.RegisterRequest();
-
-  // Testing requests
-  dap.RegisterRequest();
-}
-
 static void PrintHelp(LLDBDAPOptTable &table, llvm::StringRef tool_name) {
   std::string usage_str = tool_name.str() + " options";
   table.printHelp(llvm::outs(), usage_str.c_str(), "LLDB DAP", false);
@@ -342,8 +300,6 @@ serveConnection(const Socket::SocketProtocol &protocol, 
const std::

[Lldb-commits] [lldb] [lldb-dap] Move registration of requests into DAP (NFC) (PR #139397)

2025-05-10 Thread Jonas Devlieghere via lldb-commits

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


[Lldb-commits] [lldb] [lldb-dap] Split lldb-dap into library and tool (NFC) (PR #139402)

2025-05-10 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere created 
https://github.com/llvm/llvm-project/pull/139402

Split lldb-dap into a library (lldbDAP) and a tool (lldb-dap). The motivation 
is being able to link parts of lldb-dap separately, for example to support unit 
testing and fizzing.

>From b0996a236d9eaf70de562ae2cf0e1900417cae93 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Sat, 10 May 2025 12:08:29 -0700
Subject: [PATCH] [lldb-dap] Split lldb-dap into library and tool (NFC)

Split lldb-dap into a library (lldbDAP) and a tool (lldb-dap). The
motivation is being able to link parts of lldb-dap separately, for
example to support unit testing and fizzing.
---
 lldb/tools/lldb-dap/CMakeLists.txt| 22 ++-
 lldb/tools/lldb-dap/tool/CMakeLists.txt   | 28 +++
 .../{ => tool}/lldb-dap-Info.plist.in |  0
 lldb/tools/lldb-dap/{ => tool}/lldb-dap.cpp   |  0
 4 files changed, 36 insertions(+), 14 deletions(-)
 create mode 100644 lldb/tools/lldb-dap/tool/CMakeLists.txt
 rename lldb/tools/lldb-dap/{ => tool}/lldb-dap-Info.plist.in (100%)
 rename lldb/tools/lldb-dap/{ => tool}/lldb-dap.cpp (100%)

diff --git a/lldb/tools/lldb-dap/CMakeLists.txt 
b/lldb/tools/lldb-dap/CMakeLists.txt
index a9dc19006293b..25bacd91fe581 100644
--- a/lldb/tools/lldb-dap/CMakeLists.txt
+++ b/lldb/tools/lldb-dap/CMakeLists.txt
@@ -1,20 +1,14 @@
-if(APPLE)
-  configure_file(
-${CMAKE_CURRENT_SOURCE_DIR}/lldb-dap-Info.plist.in
-${CMAKE_CURRENT_BINARY_DIR}/lldb-dap-Info.plist
-)
-  # Inline info plist in binary (use target_link_options for this as soon as 
CMake 3.13 is available)
-  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} 
-Wl,-sectcreate,__TEXT,__info_plist,${CMAKE_CURRENT_BINARY_DIR}/lldb-dap-Info.plist")
-endif()
-
 # We need to include the llvm components we depend on manually, as liblldb does
 # not re-export those.
 set(LLVM_LINK_COMPONENTS Support)
 set(LLVM_TARGET_DEFINITIONS Options.td)
 tablegen(LLVM Options.inc -gen-opt-parser-defs)
 add_public_tablegen_target(LLDBDAPOptionsTableGen)
-add_lldb_tool(lldb-dap
-  lldb-dap.cpp
+
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
+
+add_lldb_library(lldbDAP
   Breakpoint.cpp
   BreakpointBase.cpp
   DAP.cpp
@@ -85,10 +79,8 @@ add_lldb_tool(lldb-dap
 Support
   )
 
-target_include_directories(lldb-dap PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
-
 if(LLDB_DAP_WELCOME_MESSAGE)
-  target_compile_definitions(lldb-dap
+  target_compile_definitions(lldbDAP
 PRIVATE
 -DLLDB_DAP_WELCOME_MESSAGE=\"${LLDB_DAP_WELCOME_MESSAGE}\")
 endif()
@@ -105,3 +97,5 @@ if(LLDB_BUILD_FRAMEWORK)
   "@loader_path/../../Library/PrivateFrameworks"
   )
 endif()
+
+add_subdirectory(tool)
diff --git a/lldb/tools/lldb-dap/tool/CMakeLists.txt 
b/lldb/tools/lldb-dap/tool/CMakeLists.txt
new file mode 100644
index 0..e418737bc05b1
--- /dev/null
+++ b/lldb/tools/lldb-dap/tool/CMakeLists.txt
@@ -0,0 +1,28 @@
+if(APPLE)
+  configure_file(
+${CMAKE_CURRENT_SOURCE_DIR}/lldb-dap-Info.plist.in
+${CMAKE_CURRENT_BINARY_DIR}/lldb-dap-Info.plist
+)
+  # Inline info plist in binary (use target_link_options for this as soon as 
CMake 3.13 is available)
+  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} 
-Wl,-sectcreate,__TEXT,__info_plist,${CMAKE_CURRENT_BINARY_DIR}/lldb-dap-Info.plist")
+endif()
+
+add_lldb_tool(lldb-dap
+  lldb-dap.cpp
+
+  LINK_LIBS
+lldbDAP
+  )
+
+if(LLDB_BUILD_FRAMEWORK)
+  # In the build-tree, we know the exact path to the framework directory.
+  # The installed framework can be in different locations.
+  lldb_setup_rpaths(lldb-dap
+BUILD_RPATH
+  "${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}"
+INSTALL_RPATH
+  "@loader_path/../../../SharedFrameworks"
+  "@loader_path/../../System/Library/PrivateFrameworks"
+  "@loader_path/../../Library/PrivateFrameworks"
+  )
+endif()
diff --git a/lldb/tools/lldb-dap/lldb-dap-Info.plist.in 
b/lldb/tools/lldb-dap/tool/lldb-dap-Info.plist.in
similarity index 100%
rename from lldb/tools/lldb-dap/lldb-dap-Info.plist.in
rename to lldb/tools/lldb-dap/tool/lldb-dap-Info.plist.in
diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp 
b/lldb/tools/lldb-dap/tool/lldb-dap.cpp
similarity index 100%
rename from lldb/tools/lldb-dap/lldb-dap.cpp
rename to lldb/tools/lldb-dap/tool/lldb-dap.cpp

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


[Lldb-commits] [lldb] [lldb-dap] Split lldb-dap into library and tool (NFC) (PR #139402)

2025-05-10 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)


Changes

Split lldb-dap into a library (lldbDAP) and a tool (lldb-dap). The motivation 
is being able to link parts of lldb-dap separately, for example to support unit 
testing and fizzing.

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


4 Files Affected:

- (modified) lldb/tools/lldb-dap/CMakeLists.txt (+8-14) 
- (added) lldb/tools/lldb-dap/tool/CMakeLists.txt (+28) 
- (renamed) lldb/tools/lldb-dap/tool/lldb-dap-Info.plist.in () 
- (renamed) lldb/tools/lldb-dap/tool/lldb-dap.cpp () 


``diff
diff --git a/lldb/tools/lldb-dap/CMakeLists.txt 
b/lldb/tools/lldb-dap/CMakeLists.txt
index a9dc19006293b..25bacd91fe581 100644
--- a/lldb/tools/lldb-dap/CMakeLists.txt
+++ b/lldb/tools/lldb-dap/CMakeLists.txt
@@ -1,20 +1,14 @@
-if(APPLE)
-  configure_file(
-${CMAKE_CURRENT_SOURCE_DIR}/lldb-dap-Info.plist.in
-${CMAKE_CURRENT_BINARY_DIR}/lldb-dap-Info.plist
-)
-  # Inline info plist in binary (use target_link_options for this as soon as 
CMake 3.13 is available)
-  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} 
-Wl,-sectcreate,__TEXT,__info_plist,${CMAKE_CURRENT_BINARY_DIR}/lldb-dap-Info.plist")
-endif()
-
 # We need to include the llvm components we depend on manually, as liblldb does
 # not re-export those.
 set(LLVM_LINK_COMPONENTS Support)
 set(LLVM_TARGET_DEFINITIONS Options.td)
 tablegen(LLVM Options.inc -gen-opt-parser-defs)
 add_public_tablegen_target(LLDBDAPOptionsTableGen)
-add_lldb_tool(lldb-dap
-  lldb-dap.cpp
+
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
+
+add_lldb_library(lldbDAP
   Breakpoint.cpp
   BreakpointBase.cpp
   DAP.cpp
@@ -85,10 +79,8 @@ add_lldb_tool(lldb-dap
 Support
   )
 
-target_include_directories(lldb-dap PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
-
 if(LLDB_DAP_WELCOME_MESSAGE)
-  target_compile_definitions(lldb-dap
+  target_compile_definitions(lldbDAP
 PRIVATE
 -DLLDB_DAP_WELCOME_MESSAGE=\"${LLDB_DAP_WELCOME_MESSAGE}\")
 endif()
@@ -105,3 +97,5 @@ if(LLDB_BUILD_FRAMEWORK)
   "@loader_path/../../Library/PrivateFrameworks"
   )
 endif()
+
+add_subdirectory(tool)
diff --git a/lldb/tools/lldb-dap/tool/CMakeLists.txt 
b/lldb/tools/lldb-dap/tool/CMakeLists.txt
new file mode 100644
index 0..e418737bc05b1
--- /dev/null
+++ b/lldb/tools/lldb-dap/tool/CMakeLists.txt
@@ -0,0 +1,28 @@
+if(APPLE)
+  configure_file(
+${CMAKE_CURRENT_SOURCE_DIR}/lldb-dap-Info.plist.in
+${CMAKE_CURRENT_BINARY_DIR}/lldb-dap-Info.plist
+)
+  # Inline info plist in binary (use target_link_options for this as soon as 
CMake 3.13 is available)
+  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} 
-Wl,-sectcreate,__TEXT,__info_plist,${CMAKE_CURRENT_BINARY_DIR}/lldb-dap-Info.plist")
+endif()
+
+add_lldb_tool(lldb-dap
+  lldb-dap.cpp
+
+  LINK_LIBS
+lldbDAP
+  )
+
+if(LLDB_BUILD_FRAMEWORK)
+  # In the build-tree, we know the exact path to the framework directory.
+  # The installed framework can be in different locations.
+  lldb_setup_rpaths(lldb-dap
+BUILD_RPATH
+  "${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}"
+INSTALL_RPATH
+  "@loader_path/../../../SharedFrameworks"
+  "@loader_path/../../System/Library/PrivateFrameworks"
+  "@loader_path/../../Library/PrivateFrameworks"
+  )
+endif()
diff --git a/lldb/tools/lldb-dap/lldb-dap-Info.plist.in 
b/lldb/tools/lldb-dap/tool/lldb-dap-Info.plist.in
similarity index 100%
rename from lldb/tools/lldb-dap/lldb-dap-Info.plist.in
rename to lldb/tools/lldb-dap/tool/lldb-dap-Info.plist.in
diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp 
b/lldb/tools/lldb-dap/tool/lldb-dap.cpp
similarity index 100%
rename from lldb/tools/lldb-dap/lldb-dap.cpp
rename to lldb/tools/lldb-dap/tool/lldb-dap.cpp

``




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


[Lldb-commits] [lldb] [lldb-dap] Split lldb-dap into library and tool (NFC) (PR #139402)

2025-05-10 Thread Jonas Devlieghere via lldb-commits

JDevlieghere wrote:

In part motivated by #139393 

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


[Lldb-commits] [lldb] [lldb] Remove redundant calls to std::unique_ptr::get (NFC) (PR #139428)

2025-05-10 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Kazu Hirata (kazutakahirata)


Changes



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


1 Files Affected:

- (modified) lldb/source/Target/RegisterContextUnwind.cpp (+6-6) 


``diff
diff --git a/lldb/source/Target/RegisterContextUnwind.cpp 
b/lldb/source/Target/RegisterContextUnwind.cpp
index 4c760b84e45a5..f56dda187e12a 100644
--- a/lldb/source/Target/RegisterContextUnwind.cpp
+++ b/lldb/source/Target/RegisterContextUnwind.cpp
@@ -279,7 +279,7 @@ void RegisterContextUnwind::InitializeZerothFrame() {
   call_site_unwind_plan = func_unwinders_sp->GetUnwindPlanAtCallSite(
   process->GetTarget(), m_thread);
 
-if (call_site_unwind_plan.get() != nullptr) {
+if (call_site_unwind_plan != nullptr) {
   m_fallback_unwind_plan_sp = call_site_unwind_plan;
   if (TryFallbackUnwindPlan())
 cfa_status = true;
@@ -1722,10 +1722,10 @@ RegisterContextUnwind::SavedLocationForRegister(
 // tricky frame and our usual techniques can continue to be used.
 
 bool RegisterContextUnwind::TryFallbackUnwindPlan() {
-  if (m_fallback_unwind_plan_sp.get() == nullptr)
+  if (m_fallback_unwind_plan_sp == nullptr)
 return false;
 
-  if (m_full_unwind_plan_sp.get() == nullptr)
+  if (m_full_unwind_plan_sp == nullptr)
 return false;
 
   if (m_full_unwind_plan_sp.get() == m_fallback_unwind_plan_sp.get() ||
@@ -1773,7 +1773,7 @@ bool RegisterContextUnwind::TryFallbackUnwindPlan() {
   // fallback UnwindPlan. We checked if m_fallback_unwind_plan_sp was nullptr
   // at the top -- the only way it became nullptr since then is via
   // SavedLocationForRegister().
-  if (m_fallback_unwind_plan_sp.get() == nullptr)
+  if (m_fallback_unwind_plan_sp == nullptr)
 return true;
 
   // Switch the full UnwindPlan to be the fallback UnwindPlan.  If we decide
@@ -1862,10 +1862,10 @@ bool RegisterContextUnwind::TryFallbackUnwindPlan() {
 }
 
 bool RegisterContextUnwind::ForceSwitchToFallbackUnwindPlan() {
-  if (m_fallback_unwind_plan_sp.get() == nullptr)
+  if (m_fallback_unwind_plan_sp == nullptr)
 return false;
 
-  if (m_full_unwind_plan_sp.get() == nullptr)
+  if (m_full_unwind_plan_sp == nullptr)
 return false;
 
   if (m_full_unwind_plan_sp.get() == m_fallback_unwind_plan_sp.get() ||

``




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