[Lldb-commits] [lldb] 4b6c608 - [lldb-dap] Use structured types for stepInTargets request (#142439)

2025-06-04 Thread via lldb-commits

Author: Ebuka Ezike
Date: 2025-06-04T08:05:31+01:00
New Revision: 4b6c608615a285d81132acf8e33b81b2ec2c9bf9

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

LOG: [lldb-dap] Use structured types for stepInTargets request (#142439)

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
lldb/test/API/tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py
lldb/tools/lldb-dap/EventHelper.cpp
lldb/tools/lldb-dap/EventHelper.h
lldb/tools/lldb-dap/Handler/ConfigurationDoneRequestHandler.cpp
lldb/tools/lldb-dap/Handler/RequestHandler.h
lldb/tools/lldb-dap/Handler/StepInTargetsRequestHandler.cpp
lldb/tools/lldb-dap/Protocol/ProtocolRequests.cpp
lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp
lldb/tools/lldb-dap/Protocol/ProtocolTypes.h
lldb/unittests/DAP/ProtocolTypesTest.cpp

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
index 6b41aef2bb5b8..f1e3cab06ccde 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
@@ -153,7 +153,7 @@ def __init__(
 self.recv_thread = threading.Thread(target=self._read_packet_thread)
 self.process_event_body = None
 self.exit_status: Optional[int] = None
-self.initialize_body = None
+self.initialize_body: dict[str, Any] = {}
 self.progress_events: list[Event] = []
 self.reverse_requests = []
 self.sequence = 1
@@ -300,6 +300,9 @@ def _handle_recv_packet(self, packet: 
Optional[ProtocolMessage]) -> bool:
 elif event == "breakpoint":
 # Breakpoint events are sent when a breakpoint is resolved
 self._update_verified_breakpoints([body["breakpoint"]])
+elif event == "capabilities":
+# update the capabilities with new ones from the event.
+self.initialize_body.update(body["capabilities"])
 
 elif packet_type == "response":
 if packet["command"] == "disconnect":
@@ -494,7 +497,7 @@ def get_initialize_value(self, key):
 """
 if self.initialize_body and key in self.initialize_body:
 return self.initialize_body[key]
-return None
+raise ValueError(f"no value for key: {key} in {self.initialize_body}")
 
 def get_threads(self):
 if self.threads is None:

diff  --git 
a/lldb/test/API/tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py 
b/lldb/test/API/tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py
index 07acfe07c9ffc..af698074f3479 100644
--- a/lldb/test/API/tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py
+++ b/lldb/test/API/tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py
@@ -78,3 +78,49 @@ def test_basic(self):
 leaf_frame = self.dap_server.get_stackFrame()
 self.assertIsNotNone(leaf_frame, "expect a leaf frame")
 self.assertEqual(step_in_targets[1]["label"], leaf_frame["name"])
+
+@skipIf(archs=no_match(["x86", "x86_64"]))
+def test_supported_capability_x86_arch(self):
+program = self.getBuildArtifact("a.out")
+self.build_and_launch(program)
+source = "main.cpp"
+bp_lines = [line_number(source, "// set breakpoint here")]
+breakpoint_ids = self.set_source_breakpoints(source, bp_lines)
+self.assertEqual(
+len(breakpoint_ids), len(bp_lines), "expect correct number of 
breakpoints"
+)
+is_supported = self.dap_server.get_initialize_value(
+"supportsStepInTargetsRequest"
+)
+
+self.assertEqual(
+is_supported,
+True,
+f"expect capability `stepInTarget` is supported with architecture 
{self.getArchitecture()}",
+)
+# clear breakpoints.
+self.set_source_breakpoints(source, [])
+self.continue_to_exit()
+
+@skipIf(archs=["x86", "x86_64"])
+def test_supported_capability_other_archs(self):
+program = self.getBuildArtifact("a.out")
+self.build_and_launch(program)
+source = "main.cpp"
+bp_lines = [line_number(source, "// set breakpoint here")]
+breakpoint_ids = self.set_source_breakpoints(source, bp_lines)
+self.assertEqual(
+len(breakpoint_ids), len(bp_lines), "expect correct number of 
breakpoints"
+)
+is_supported = self.dap_server.get_initialize_value(
+"supportsStepInTargetsRequest"
+)
+
+self.assertEqual(
+is_supported,
+False,
+f"expect capability `stepInTarget` is

[Lldb-commits] [lldb] [lldb][test] Free buffers in demangling tests to avoid leaks (PR #142676)

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

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

thanks! i keep forgetting

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


[Lldb-commits] [lldb] [lldb-dap] Use structured types for stepInTargets request (PR #142439)

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

llvm-ci wrote:

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

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


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

```
Step 6 (test) failure: build (failure)
...
PASS: lldb-api :: source-manager/TestSourceManager.py (1165 of 2248)
UNSUPPORTED: lldb-api :: 
tools/lldb-dap/breakpoint-events/TestDAP_breakpointEvents.py (1166 of 2248)
PASS: lldb-api :: python_api/watchpoint/watchlocation/TestSetWatchlocation.py 
(1167 of 2248)
PASS: lldb-api :: python_api/process/cancel_attach/TestCancelAttach.py (1168 of 
2248)
PASS: lldb-api :: python_api/watchpoint/watchlocation/TestTargetWatchAddress.py 
(1169 of 2248)
UNSUPPORTED: lldb-api :: 
tools/lldb-dap/breakpoint/TestDAP_setExceptionBreakpoints.py (1170 of 2248)
PASS: lldb-api :: terminal/TestEditline.py (1171 of 2248)
PASS: lldb-api :: terminal/TestEditlineCompletions.py (1172 of 2248)
PASS: lldb-api :: tools/lldb-dap/commands/TestDAP_commands.py (1173 of 2248)
TIMEOUT: lldb-api :: tools/lldb-dap/attach/TestDAP_attach.py (1174 of 2248)
 TEST 'lldb-api :: tools/lldb-dap/attach/TestDAP_attach.py' 
FAILED 
Script:
--
/usr/bin/python3.10 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/dotest.py
 -u CXXFLAGS -u CFLAGS --env 
LLVM_LIBS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib --env 
LLVM_INCLUDE_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/include 
--env LLVM_TOOLS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin 
--arch aarch64 --build-dir 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex 
--lldb-module-cache-dir 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api
 --clang-module-cache-dir 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api
 --executable /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/lldb 
--compiler /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/clang 
--dsymutil /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/dsymutil 
--make /usr/bin/gmake --llvm-tools-dir 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --lldb-obj-root 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/tools/lldb --lldb-libs-dir 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib --cmake-build-type 
Release 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/tools/lldb-dap/attach
 -p TestDAP_attach.py
--
Exit Code: -9
Timeout: Reached timeout of 600 seconds

Command Output (stdout):
--
lldb version 21.0.0git (https://github.com/llvm/llvm-project.git revision 
4b6c608615a285d81132acf8e33b81b2ec2c9bf9)
  clang revision 4b6c608615a285d81132acf8e33b81b2ec2c9bf9
  llvm revision 4b6c608615a285d81132acf8e33b81b2ec2c9bf9

--
Command Output (stderr):
--
= DEBUG ADAPTER PROTOCOL LOGS =
1749021834.214866877 --> (stdio) 
{"command":"initialize","type":"request","arguments":{"adapterID":"lldb-native","clientID":"vscode","columnsStartAt1":true,"linesStartAt1":true,"locale":"en-us","pathFormat":"path","supportsRunInTerminalRequest":true,"supportsVariablePaging":true,"supportsVariableType":true,"supportsStartDebuggingRequest":true,"supportsProgressReporting":true,"$__lldb_sourceInitFile":false},"seq":1}
1749021834.217045546 <-- (stdio) {"body":{"$__lldb_version":"lldb version 
21.0.0git (https://github.com/llvm/llvm-project.git revision 
4b6c608615a285d81132acf8e33b81b2ec2c9bf9)\n  clang revision 
4b6c608615a285d81132acf8e33b81b2ec2c9bf9\n  llvm revision 
4b6c608615a285d81132acf8e33b81b2ec2c9bf9","completionTriggerCharacters":["."," 
","\t"],"exceptionBreakpointFilters":[{"default":false,"filter":"cpp_catch","label":"C++
 Catch"},{"default":false,"filter":"cpp_throw","label":"C++ 
Throw"},{"default":false,"filter":"objc_catch","label":"Objective-C 
Catch"},{"default":false,"filter":"objc_throw","label":"Objective-C 
Throw"}],"supportTerminateDebuggee":true,"supportsBreakpointLocationsRequest":true,"supportsCancelRequest":true,"supportsCompletionsRequest":true,"supportsConditionalBreakpoints":true,"supportsConfigurationDoneRequest":true,"supportsDataBreakpoints":true,"supportsDelayedStackTraceLoading":true,"supportsDisassembleRequest":true,"supportsEvaluateForHovers":true,"supportsExceptionInfoRequest":true,"supportsExceptionOptions":true,"supportsFunctionBreakpoints":true,"supportsHitConditionalBreakpoints":true,"supportsInstructionBreakpoints":true,"supportsLogPoints":true,"supportsModulesRequest":true,"supportsReadMemoryRequest":true,"supportsRestartRequest":true,"supportsSetVariable":true,"supportsStepInTargetsRequest":true,"supportsSteppingGranularity":true,"supportsValueFormattingOptions":true},"command":"initialize","request_seq":1,"seq":0,"succ

[Lldb-commits] [lldb] [llvm] [lldb][llvm][AIX] Added support for getProcFile with TID (PR #142586)

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

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


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


[Lldb-commits] [lldb] [llvm] support in LLDB for the DWARF operations `DW_OP_GNU_implicit_pointer/DW_OP_implicit_pointer`. (PR #142747)

2025-06-04 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/142747
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [llvm] support in LLDB for the DWARF operations `DW_OP_GNU_implicit_pointer/DW_OP_implicit_pointer`. (PR #142747)

2025-06-04 Thread via lldb-commits

https://github.com/Thrrr created 
https://github.com/llvm/llvm-project/pull/142747

This Pull Request introduces support in LLDB for the DWARF operations 
`DW_OP_GNU_implicit_pointer` and `DW_OP_implicit_pointer`.
These operators are commonly found in debug information and are used to enhance 
the debugging experience by improving how variable expressions are represented. 
By introducing handling for these operations, LLDB will be able to interpret 
and display variable values more accurately when debugging binaries that 
contain such DWARF expressions. This update improves LLDB's compatibility and 
correctness when working with debug information generated by GCC, Clang, and 
other DWARF-compliant toolchains, and helps ensure a more robust debugging 
experience.

>From 89afdb666cb0ad669e3e0a489969ba0bf4e4315c Mon Sep 17 00:00:00 2001
From: jinruiShi <1379998...@qq.com>
Date: Wed, 4 Jun 2025 16:24:53 +0800
Subject: [PATCH] LLDB support for
 DW_OP_GNU_implicit_pointer/DW_OP_implicit_pointer operation

---
 lldb/include/lldb/Core/Value.h| 10 +++
 lldb/include/lldb/Symbol/Variable.h   |  6 +-
 .../Commands/CommandObjectDWIMPrint.cpp   |  9 ++-
 lldb/source/Core/Value.cpp| 21 +-
 lldb/source/Expression/DWARFExpression.cpp| 20 -
 .../source/Expression/DWARFExpressionList.cpp | 73 ++-
 lldb/source/Expression/Materializer.cpp   | 40 --
 .../ValueObject/ValueObjectVariable.cpp   | 17 +++--
 llvm/include/llvm/BinaryFormat/Dwarf.def  |  2 +
 llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp  |  2 +
 .../DebugInfo/LogicalView/Core/LVLocation.cpp |  1 +
 11 files changed, 178 insertions(+), 23 deletions(-)

diff --git a/lldb/include/lldb/Core/Value.h b/lldb/include/lldb/Core/Value.h
index 3714621b469ec..b5411e2377c93 100644
--- a/lldb/include/lldb/Core/Value.h
+++ b/lldb/include/lldb/Core/Value.h
@@ -82,6 +82,10 @@ class Value {
 
   ValueType GetValueType() const;
 
+  void setImplictPointerDIEoffset(uint64_t offset);
+  void setImplictPointerOffset(int64_t offset);
+  uint64_t getImplictPointerDIEoffset() const;
+  int64_t getImplictPointerOffset() const;
   AddressType GetValueAddressType() const;
 
   ContextType GetContextType() const { return m_context_type; }
@@ -182,6 +186,12 @@ class Value {
   ValueType m_value_type = ValueType::Scalar;
   ContextType m_context_type = ContextType::Invalid;
   DataBufferHeap m_data_buffer;
+  struct {
+/* 4- or 8-byte offset of DIE  */
+uint64_t die_offset = 0;
+/* The byte offset into the resulting data.  */
+int64_t result_offset;
+  } implicit_pointer;
 };
 
 class ValueList {
diff --git a/lldb/include/lldb/Symbol/Variable.h 
b/lldb/include/lldb/Symbol/Variable.h
index c437624d1ea6d..81e0ce30448fa 100644
--- a/lldb/include/lldb/Symbol/Variable.h
+++ b/lldb/include/lldb/Symbol/Variable.h
@@ -97,6 +97,9 @@ class Variable : public UserID, public 
std::enable_shared_from_this {
 
   void SetLocationIsConstantValueData(bool b) { m_loc_is_const_data = b; }
 
+  bool GetIsImplicitPointer() const { return m_is_implicit_pointer; }
+
+  void SetIsImplicitPointer(bool b) { m_is_implicit_pointer = b; }
   typedef size_t (*GetVariableCallback)(void *baton, const char *name,
 VariableList &var_list);
 
@@ -140,7 +143,8 @@ class Variable : public UserID, public 
std::enable_shared_from_this {
   unsigned m_loc_is_const_data : 1;
   /// Non-zero if variable is static member of a class or struct.
   unsigned m_static_member : 1;
-
+  /// Non-zero if the variable is a implicit pointer type.
+  unsigned m_is_implicit_pointer : 1;
 private:
   Variable(const Variable &rhs) = delete;
   Variable &operator=(const Variable &rhs) = delete;
diff --git a/lldb/source/Commands/CommandObjectDWIMPrint.cpp 
b/lldb/source/Commands/CommandObjectDWIMPrint.cpp
index 17c60297a521e..e3dd4f08d4e10 100644
--- a/lldb/source/Commands/CommandObjectDWIMPrint.cpp
+++ b/lldb/source/Commands/CommandObjectDWIMPrint.cpp
@@ -19,6 +19,7 @@
 #include "lldb/Target/StackFrame.h"
 #include "lldb/Utility/ConstString.h"
 #include "lldb/ValueObject/ValueObject.h"
+#include "lldb/Symbol/Variable.h"
 #include "lldb/lldb-defines.h"
 #include "lldb/lldb-enumerations.h"
 #include "lldb/lldb-forward.h"
@@ -174,7 +175,13 @@ void CommandObjectDWIMPrint::DoExecute(StringRef command,
 if (auto persisted_valobj = valobj_sp->Persist())
   valobj_sp = persisted_valobj;
   }
-
+  // FIXME: LLDB haven't implemented "optimization out" output.
+  if (valobj_sp->GetVariable()->GetIsImplicitPointer()) {
+result.AppendMessageWithFormatv("expression `{0}` is an implicit "
+"pointer, value has been optimized 
out",
+expr);
+return;
+  }
   if (verbosity == eDWIMPrintVerbosityFull) {
 StringRef flags;
 if (args.HasArgs())
diff --git a/lldb/source/Core/Value.

[Lldb-commits] [lldb] [llvm] [lldb][llvm][AIX] Added support for getProcFile with TID (PR #142586)

2025-06-04 Thread Dhruv Srivastava via lldb-commits

DhruvSrivastavaX wrote:

Thanks @HemangGadhavi , just add a link to the ibm doc link for reference. 

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


[Lldb-commits] [lldb] [llvm] support in LLDB for the DWARF operations `DW_OP_GNU_implicit_pointer/DW_OP_implicit_pointer`. (PR #142747)

2025-06-04 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-debuginfo

Author: Thrrr (Thrrr)


Changes

This Pull Request introduces support in LLDB for the DWARF operations 
`DW_OP_GNU_implicit_pointer` and `DW_OP_implicit_pointer`.
These operators are commonly found in debug information and are used to enhance 
the debugging experience by improving how variable expressions are represented. 
By introducing handling for these operations, LLDB will be able to interpret 
and display variable values more accurately when debugging binaries that 
contain such DWARF expressions. This update improves LLDB's compatibility and 
correctness when working with debug information generated by GCC, Clang, and 
other DWARF-compliant toolchains, and helps ensure a more robust debugging 
experience.

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


11 Files Affected:

- (modified) lldb/include/lldb/Core/Value.h (+10) 
- (modified) lldb/include/lldb/Symbol/Variable.h (+5-1) 
- (modified) lldb/source/Commands/CommandObjectDWIMPrint.cpp (+8-1) 
- (modified) lldb/source/Core/Value.cpp (+20-1) 
- (modified) lldb/source/Expression/DWARFExpression.cpp (+16-4) 
- (modified) lldb/source/Expression/DWARFExpressionList.cpp (+70-3) 
- (modified) lldb/source/Expression/Materializer.cpp (+33-7) 
- (modified) lldb/source/ValueObject/ValueObjectVariable.cpp (+11-6) 
- (modified) llvm/include/llvm/BinaryFormat/Dwarf.def (+2) 
- (modified) llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp (+2) 
- (modified) llvm/lib/DebugInfo/LogicalView/Core/LVLocation.cpp (+1) 


``diff
diff --git a/lldb/include/lldb/Core/Value.h b/lldb/include/lldb/Core/Value.h
index 3714621b469ec..b5411e2377c93 100644
--- a/lldb/include/lldb/Core/Value.h
+++ b/lldb/include/lldb/Core/Value.h
@@ -82,6 +82,10 @@ class Value {
 
   ValueType GetValueType() const;
 
+  void setImplictPointerDIEoffset(uint64_t offset);
+  void setImplictPointerOffset(int64_t offset);
+  uint64_t getImplictPointerDIEoffset() const;
+  int64_t getImplictPointerOffset() const;
   AddressType GetValueAddressType() const;
 
   ContextType GetContextType() const { return m_context_type; }
@@ -182,6 +186,12 @@ class Value {
   ValueType m_value_type = ValueType::Scalar;
   ContextType m_context_type = ContextType::Invalid;
   DataBufferHeap m_data_buffer;
+  struct {
+/* 4- or 8-byte offset of DIE  */
+uint64_t die_offset = 0;
+/* The byte offset into the resulting data.  */
+int64_t result_offset;
+  } implicit_pointer;
 };
 
 class ValueList {
diff --git a/lldb/include/lldb/Symbol/Variable.h 
b/lldb/include/lldb/Symbol/Variable.h
index c437624d1ea6d..81e0ce30448fa 100644
--- a/lldb/include/lldb/Symbol/Variable.h
+++ b/lldb/include/lldb/Symbol/Variable.h
@@ -97,6 +97,9 @@ class Variable : public UserID, public 
std::enable_shared_from_this {
 
   void SetLocationIsConstantValueData(bool b) { m_loc_is_const_data = b; }
 
+  bool GetIsImplicitPointer() const { return m_is_implicit_pointer; }
+
+  void SetIsImplicitPointer(bool b) { m_is_implicit_pointer = b; }
   typedef size_t (*GetVariableCallback)(void *baton, const char *name,
 VariableList &var_list);
 
@@ -140,7 +143,8 @@ class Variable : public UserID, public 
std::enable_shared_from_this {
   unsigned m_loc_is_const_data : 1;
   /// Non-zero if variable is static member of a class or struct.
   unsigned m_static_member : 1;
-
+  /// Non-zero if the variable is a implicit pointer type.
+  unsigned m_is_implicit_pointer : 1;
 private:
   Variable(const Variable &rhs) = delete;
   Variable &operator=(const Variable &rhs) = delete;
diff --git a/lldb/source/Commands/CommandObjectDWIMPrint.cpp 
b/lldb/source/Commands/CommandObjectDWIMPrint.cpp
index 17c60297a521e..e3dd4f08d4e10 100644
--- a/lldb/source/Commands/CommandObjectDWIMPrint.cpp
+++ b/lldb/source/Commands/CommandObjectDWIMPrint.cpp
@@ -19,6 +19,7 @@
 #include "lldb/Target/StackFrame.h"
 #include "lldb/Utility/ConstString.h"
 #include "lldb/ValueObject/ValueObject.h"
+#include "lldb/Symbol/Variable.h"
 #include "lldb/lldb-defines.h"
 #include "lldb/lldb-enumerations.h"
 #include "lldb/lldb-forward.h"
@@ -174,7 +175,13 @@ void CommandObjectDWIMPrint::DoExecute(StringRef command,
 if (auto persisted_valobj = valobj_sp->Persist())
   valobj_sp = persisted_valobj;
   }
-
+  // FIXME: LLDB haven't implemented "optimization out" output.
+  if (valobj_sp->GetVariable()->GetIsImplicitPointer()) {
+result.AppendMessageWithFormatv("expression `{0}` is an implicit "
+"pointer, value has been optimized 
out",
+expr);
+return;
+  }
   if (verbosity == eDWIMPrintVerbosityFull) {
 StringRef flags;
 if (args.HasArgs())
diff --git a/lldb/source/Core/Value.cpp b/lldb/source/Core/Value.cpp
index c91b3f852f986..4e7956c7894b5 100644
--- a/lldb/source/Core/Value.cpp
+++ b/lldb/source/Core/Value.cpp

[Lldb-commits] [lldb] [llvm] support in LLDB for the DWARF operations `DW_OP_GNU_implicit_pointer/DW_OP_implicit_pointer`. (PR #142747)

2025-06-04 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Thrrr (Thrrr)


Changes

This Pull Request introduces support in LLDB for the DWARF operations 
`DW_OP_GNU_implicit_pointer` and `DW_OP_implicit_pointer`.
These operators are commonly found in debug information and are used to enhance 
the debugging experience by improving how variable expressions are represented. 
By introducing handling for these operations, LLDB will be able to interpret 
and display variable values more accurately when debugging binaries that 
contain such DWARF expressions. This update improves LLDB's compatibility and 
correctness when working with debug information generated by GCC, Clang, and 
other DWARF-compliant toolchains, and helps ensure a more robust debugging 
experience.

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


11 Files Affected:

- (modified) lldb/include/lldb/Core/Value.h (+10) 
- (modified) lldb/include/lldb/Symbol/Variable.h (+5-1) 
- (modified) lldb/source/Commands/CommandObjectDWIMPrint.cpp (+8-1) 
- (modified) lldb/source/Core/Value.cpp (+20-1) 
- (modified) lldb/source/Expression/DWARFExpression.cpp (+16-4) 
- (modified) lldb/source/Expression/DWARFExpressionList.cpp (+70-3) 
- (modified) lldb/source/Expression/Materializer.cpp (+33-7) 
- (modified) lldb/source/ValueObject/ValueObjectVariable.cpp (+11-6) 
- (modified) llvm/include/llvm/BinaryFormat/Dwarf.def (+2) 
- (modified) llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp (+2) 
- (modified) llvm/lib/DebugInfo/LogicalView/Core/LVLocation.cpp (+1) 


``diff
diff --git a/lldb/include/lldb/Core/Value.h b/lldb/include/lldb/Core/Value.h
index 3714621b469ec..b5411e2377c93 100644
--- a/lldb/include/lldb/Core/Value.h
+++ b/lldb/include/lldb/Core/Value.h
@@ -82,6 +82,10 @@ class Value {
 
   ValueType GetValueType() const;
 
+  void setImplictPointerDIEoffset(uint64_t offset);
+  void setImplictPointerOffset(int64_t offset);
+  uint64_t getImplictPointerDIEoffset() const;
+  int64_t getImplictPointerOffset() const;
   AddressType GetValueAddressType() const;
 
   ContextType GetContextType() const { return m_context_type; }
@@ -182,6 +186,12 @@ class Value {
   ValueType m_value_type = ValueType::Scalar;
   ContextType m_context_type = ContextType::Invalid;
   DataBufferHeap m_data_buffer;
+  struct {
+/* 4- or 8-byte offset of DIE  */
+uint64_t die_offset = 0;
+/* The byte offset into the resulting data.  */
+int64_t result_offset;
+  } implicit_pointer;
 };
 
 class ValueList {
diff --git a/lldb/include/lldb/Symbol/Variable.h 
b/lldb/include/lldb/Symbol/Variable.h
index c437624d1ea6d..81e0ce30448fa 100644
--- a/lldb/include/lldb/Symbol/Variable.h
+++ b/lldb/include/lldb/Symbol/Variable.h
@@ -97,6 +97,9 @@ class Variable : public UserID, public 
std::enable_shared_from_this {
 
   void SetLocationIsConstantValueData(bool b) { m_loc_is_const_data = b; }
 
+  bool GetIsImplicitPointer() const { return m_is_implicit_pointer; }
+
+  void SetIsImplicitPointer(bool b) { m_is_implicit_pointer = b; }
   typedef size_t (*GetVariableCallback)(void *baton, const char *name,
 VariableList &var_list);
 
@@ -140,7 +143,8 @@ class Variable : public UserID, public 
std::enable_shared_from_this {
   unsigned m_loc_is_const_data : 1;
   /// Non-zero if variable is static member of a class or struct.
   unsigned m_static_member : 1;
-
+  /// Non-zero if the variable is a implicit pointer type.
+  unsigned m_is_implicit_pointer : 1;
 private:
   Variable(const Variable &rhs) = delete;
   Variable &operator=(const Variable &rhs) = delete;
diff --git a/lldb/source/Commands/CommandObjectDWIMPrint.cpp 
b/lldb/source/Commands/CommandObjectDWIMPrint.cpp
index 17c60297a521e..e3dd4f08d4e10 100644
--- a/lldb/source/Commands/CommandObjectDWIMPrint.cpp
+++ b/lldb/source/Commands/CommandObjectDWIMPrint.cpp
@@ -19,6 +19,7 @@
 #include "lldb/Target/StackFrame.h"
 #include "lldb/Utility/ConstString.h"
 #include "lldb/ValueObject/ValueObject.h"
+#include "lldb/Symbol/Variable.h"
 #include "lldb/lldb-defines.h"
 #include "lldb/lldb-enumerations.h"
 #include "lldb/lldb-forward.h"
@@ -174,7 +175,13 @@ void CommandObjectDWIMPrint::DoExecute(StringRef command,
 if (auto persisted_valobj = valobj_sp->Persist())
   valobj_sp = persisted_valobj;
   }
-
+  // FIXME: LLDB haven't implemented "optimization out" output.
+  if (valobj_sp->GetVariable()->GetIsImplicitPointer()) {
+result.AppendMessageWithFormatv("expression `{0}` is an implicit "
+"pointer, value has been optimized 
out",
+expr);
+return;
+  }
   if (verbosity == eDWIMPrintVerbosityFull) {
 StringRef flags;
 if (args.HasArgs())
diff --git a/lldb/source/Core/Value.cpp b/lldb/source/Core/Value.cpp
index c91b3f852f986..4e7956c7894b5 100644
--- a/lldb/source/Core/Value.cpp
+++ b/lldb/source/Core/Value.cpp
@@ -5

[Lldb-commits] [lldb] [llvm] [lldb][llvm][AIX] Added support for getProcFile with TID (PR #142586)

2025-06-04 Thread Dhruv Srivastava via lldb-commits

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


[Lldb-commits] [lldb] 41841e6 - [lldb][llvm][AIX] Added support for getProcFile with TID (#142586)

2025-06-04 Thread via lldb-commits

Author: Hemang Gadhavi
Date: 2025-06-04T14:44:57+05:30
New Revision: 41841e625db8d14d6701e7cb211b2fcab6a32a50

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

LOG: [lldb][llvm][AIX] Added support for getProcFile with TID (#142586)

This PR is in reference to porting LLDB on AIX.
Link to discussions on llvm discourse and github:

1. https://discourse.llvm.org/t/port-lldb-to-ibm-aix/80640
2. https://github.com/llvm/llvm-project/issues/101657
The complete changes for porting are present in this draft PR:
https://github.com/llvm/llvm-project/pull/102601

- Added changes to getProcFile() with threadID, including testcase for
AIX.
- Added support for AIX to get_threadid() from llvm.

Added: 
lldb/include/lldb/Host/aix/Support.h
lldb/source/Host/aix/Support.cpp

Modified: 
lldb/source/Host/CMakeLists.txt
lldb/unittests/Host/posix/SupportTest.cpp
llvm/lib/Support/Unix/Threading.inc

Removed: 




diff  --git a/lldb/include/lldb/Host/aix/Support.h 
b/lldb/include/lldb/Host/aix/Support.h
new file mode 100644
index 0..f02a1904b09fa
--- /dev/null
+++ b/lldb/include/lldb/Host/aix/Support.h
@@ -0,0 +1,23 @@
+//===-- Support.h ---*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef LLDB_HOST_AIX_SUPPORT_H
+#define LLDB_HOST_AIX_SUPPORT_H
+
+#include "llvm/Support/ErrorOr.h"
+#include "llvm/Support/MemoryBuffer.h"
+#include 
+
+namespace lldb_private {
+
+llvm::ErrorOr>
+getProcFile(::pid_t pid, ::pid_t tid, const llvm::Twine &file);
+
+} // namespace lldb_private
+
+#endif // #ifndef LLDB_HOST_AIX_SUPPORT_H

diff  --git a/lldb/source/Host/CMakeLists.txt b/lldb/source/Host/CMakeLists.txt
index 90814b1bed4c8..d19e4edd4cf56 100644
--- a/lldb/source/Host/CMakeLists.txt
+++ b/lldb/source/Host/CMakeLists.txt
@@ -142,6 +142,7 @@ else()
 add_host_subdirectory(aix
   aix/Host.cpp
   aix/HostInfoAIX.cpp
+  aix/Support.cpp
   )
   endif()
 endif()

diff  --git a/lldb/source/Host/aix/Support.cpp 
b/lldb/source/Host/aix/Support.cpp
new file mode 100644
index 0..afd975565ff2f
--- /dev/null
+++ b/lldb/source/Host/aix/Support.cpp
@@ -0,0 +1,24 @@
+//===-- Support.cpp 
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "lldb/Host/aix/Support.h"
+#include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/Log.h"
+#include "llvm/Support/MemoryBuffer.h"
+
+llvm::ErrorOr>
+lldb_private::getProcFile(::pid_t pid, ::pid_t tid, const llvm::Twine &file) {
+  Log *log = GetLog(LLDBLog::Host);
+  std::string File =
+  ("/proc/" + llvm::Twine(pid) + "/lwp/" + llvm::Twine(tid) + "/" + file)
+  .str();
+  auto Ret = llvm::MemoryBuffer::getFileAsStream(File);
+  if (!Ret)
+LLDB_LOG(log, "Failed to open {0}: {1}", File, Ret.getError().message());
+  return Ret;
+}

diff  --git a/lldb/unittests/Host/posix/SupportTest.cpp 
b/lldb/unittests/Host/posix/SupportTest.cpp
index f3976db755943..e4d7ba89fece6 100644
--- a/lldb/unittests/Host/posix/SupportTest.cpp
+++ b/lldb/unittests/Host/posix/SupportTest.cpp
@@ -7,6 +7,7 @@
 
//===--===//
 
 #include "lldb/Host/posix/Support.h"
+#include "lldb/Host/aix/Support.h"
 #include "llvm/Support/Threading.h"
 #include "gtest/gtest.h"
 
@@ -19,3 +20,11 @@ TEST(Support, getProcFile_Pid) {
   ASSERT_TRUE(*BufferOrError);
 }
 #endif // #ifndef __APPLE__
+
+#if defined(_AIX) && defined(LLVM_ENABLE_THREADING)
+TEST(Support, getProcFile_Tid) {
+  auto BufferOrError = getProcFile(getpid(), llvm::get_threadid(), 
"lwpstatus");
+  ASSERT_TRUE(BufferOrError);
+  ASSERT_TRUE(*BufferOrError);
+}
+#endif // #ifdef _AIX && LLVM_ENABLE_THREADING

diff  --git a/llvm/lib/Support/Unix/Threading.inc 
b/llvm/lib/Support/Unix/Threading.inc
index 15a5b008604c3..742660d5bea75 100644
--- a/llvm/lib/Support/Unix/Threading.inc
+++ b/llvm/lib/Support/Unix/Threading.inc
@@ -142,6 +142,8 @@ uint64_t llvm::get_threadid() {
   return uint64_t(gettid());
 #elif defined(__linux__)
   return uint64_t(syscall(__NR_gettid));
+#elif defined(_AIX)
+  return uint64_t(thread_self());
 #else
   return uint64_t(pthread_self());
 #endif



_

[Lldb-commits] [lldb] [llvm] [lldb][llvm][AIX] Added support for getProcFile with TID (PR #142586)

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

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


[Lldb-commits] [lldb] [llvm] [lldb][llvm][AIX] Added support for getProcFile with TID (PR #142586)

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

HemangGadhavi wrote:

> Thanks @HemangGadhavi , just add a link to the ibm doc for reference.

Thanks @DhruvSrivastavaX updated in description.  

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


[Lldb-commits] [lldb] [lldb-dap] Add missing key for capabilities event. (PR #142751)

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

https://github.com/da-viper created 
https://github.com/llvm/llvm-project/pull/142751

fixes the failed tests on arch64.

complements #142439

>From ed06cb782cca2a7433ae2dc81e1838009ca6e6d8 Mon Sep 17 00:00:00 2001
From: Ebuka Ezike 
Date: Wed, 4 Jun 2025 10:18:54 +0100
Subject: [PATCH] [lldb-dap] add missing key for capabilities event.

fixes the failed tests on arch64.

complements #142439
---
 lldb/tools/lldb-dap/EventHelper.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lldb/tools/lldb-dap/EventHelper.cpp 
b/lldb/tools/lldb-dap/EventHelper.cpp
index 0dd0b61b1e2ae..33bc7c2cbef11 100644
--- a/lldb/tools/lldb-dap/EventHelper.cpp
+++ b/lldb/tools/lldb-dap/EventHelper.cpp
@@ -46,7 +46,9 @@ void SendTargetBasedCapabilities(DAP &dap) {
 
   protocol::Event event;
   event.event = "capabilities";
-  event.body = llvm::json::Object{{"supportsStepInTargetsRequest", false}};
+  event.body = llvm::json::Object{
+  {"capabilities",
+   llvm::json::Object{{"supportsStepInTargetsRequest", false;
   dap.Send(event);
 }
 // "ProcessEvent": {

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


[Lldb-commits] [lldb] [lldb-dap] Add missing key for capabilities event. (PR #142751)

2025-06-04 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Ebuka Ezike (da-viper)


Changes

fixes the failed tests on arch64.

complements #142439

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


1 Files Affected:

- (modified) lldb/tools/lldb-dap/EventHelper.cpp (+3-1) 


``diff
diff --git a/lldb/tools/lldb-dap/EventHelper.cpp 
b/lldb/tools/lldb-dap/EventHelper.cpp
index 0dd0b61b1e2ae..33bc7c2cbef11 100644
--- a/lldb/tools/lldb-dap/EventHelper.cpp
+++ b/lldb/tools/lldb-dap/EventHelper.cpp
@@ -46,7 +46,9 @@ void SendTargetBasedCapabilities(DAP &dap) {
 
   protocol::Event event;
   event.event = "capabilities";
-  event.body = llvm::json::Object{{"supportsStepInTargetsRequest", false}};
+  event.body = llvm::json::Object{
+  {"capabilities",
+   llvm::json::Object{{"supportsStepInTargetsRequest", false;
   dap.Send(event);
 }
 // "ProcessEvent": {

``




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


[Lldb-commits] [lldb] [lldb-dap] Add missing key for capabilities event. (PR #142751)

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

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


[Lldb-commits] [lldb] [llvm] [lldb][llvm][AIX] Added support for getProcFile with TID (PR #142586)

2025-06-04 Thread Dhruv Srivastava via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb-dap] Add missing key for capabilities event. (PR #142751)

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

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


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


[Lldb-commits] [lldb] [lldb-dap] Add missing key for capabilities event. (PR #142751)

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

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


[Lldb-commits] [lldb] [lldb/cmake] Implicitly pass arguments to llvm_add_library (PR #142583)

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

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


[Lldb-commits] [lldb] [lldb] Do not accept invalid `process save-core` plugins (PR #142684)

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

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


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


[Lldb-commits] [lldb] 2c4f677 - [lldb/cmake] Implicitly pass arguments to llvm_add_library (#142583)

2025-06-04 Thread via lldb-commits

Author: Pavel Labath
Date: 2025-06-04T11:33:37+02:00
New Revision: 2c4f67794bff4df984b43db453fc0f5241ee72c8

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

LOG: [lldb/cmake] Implicitly pass arguments to llvm_add_library (#142583)

If we're not touching them, we don't need to do anything special to pass
them along -- with one important caveat: due to how cmake arguments
work, the implicitly passed arguments need to be specified before
arguments that we handle.

This isn't particularly nice, but the alternative is enumerating all
arguments that can be used by llvm_add_library and the macros it calls
(it also relies on implicit passing of some arguments to
llvm_process_sources).

Added: 


Modified: 
lldb/cmake/modules/AddLLDB.cmake
lldb/source/API/CMakeLists.txt
lldb/source/Breakpoint/CMakeLists.txt
lldb/source/Commands/CMakeLists.txt
lldb/source/Core/CMakeLists.txt
lldb/source/DataFormatters/CMakeLists.txt
lldb/source/Expression/CMakeLists.txt
lldb/source/Host/CMakeLists.txt
lldb/source/Host/macosx/objcxx/CMakeLists.txt
lldb/source/Initialization/CMakeLists.txt
lldb/source/Interpreter/CMakeLists.txt
lldb/source/Interpreter/Interfaces/CMakeLists.txt
lldb/source/Plugins/ABI/AArch64/CMakeLists.txt
lldb/source/Plugins/ABI/ARC/CMakeLists.txt
lldb/source/Plugins/ABI/ARM/CMakeLists.txt
lldb/source/Plugins/ABI/Hexagon/CMakeLists.txt
lldb/source/Plugins/ABI/LoongArch/CMakeLists.txt
lldb/source/Plugins/ABI/MSP430/CMakeLists.txt
lldb/source/Plugins/ABI/Mips/CMakeLists.txt
lldb/source/Plugins/ABI/PowerPC/CMakeLists.txt
lldb/source/Plugins/ABI/RISCV/CMakeLists.txt
lldb/source/Plugins/ABI/SystemZ/CMakeLists.txt
lldb/source/Plugins/ABI/X86/CMakeLists.txt
lldb/source/Plugins/Architecture/AArch64/CMakeLists.txt
lldb/source/Plugins/Architecture/Arm/CMakeLists.txt
lldb/source/Plugins/Architecture/Mips/CMakeLists.txt
lldb/source/Plugins/Architecture/PPC64/CMakeLists.txt
lldb/source/Plugins/Disassembler/LLVMC/CMakeLists.txt
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/CMakeLists.txt
lldb/source/Plugins/DynamicLoader/POSIX-DYLD/CMakeLists.txt
lldb/source/Plugins/DynamicLoader/Windows-DYLD/CMakeLists.txt
lldb/source/Plugins/DynamicLoader/wasm-DYLD/CMakeLists.txt
lldb/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
lldb/source/Plugins/Instruction/ARM/CMakeLists.txt
lldb/source/Plugins/Instruction/ARM64/CMakeLists.txt
lldb/source/Plugins/Instruction/LoongArch/CMakeLists.txt
lldb/source/Plugins/Instruction/MIPS/CMakeLists.txt
lldb/source/Plugins/Instruction/MIPS64/CMakeLists.txt
lldb/source/Plugins/Instruction/PPC64/CMakeLists.txt
lldb/source/Plugins/Instruction/RISCV/CMakeLists.txt
lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/CMakeLists.txt
lldb/source/Plugins/InstrumentationRuntime/UBSan/CMakeLists.txt
lldb/source/Plugins/JITLoader/GDB/CMakeLists.txt
lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
lldb/source/Plugins/Language/ClangCommon/CMakeLists.txt
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/CMakeLists.txt
lldb/source/Plugins/LanguageRuntime/ObjC/GNUstepObjCRuntime/CMakeLists.txt
lldb/source/Plugins/ObjectContainer/BSD-Archive/CMakeLists.txt
lldb/source/Plugins/ObjectFile/Breakpad/CMakeLists.txt
lldb/source/Plugins/ObjectFile/COFF/CMakeLists.txt
lldb/source/Plugins/ObjectFile/ELF/CMakeLists.txt
lldb/source/Plugins/ObjectFile/JSON/CMakeLists.txt
lldb/source/Plugins/ObjectFile/Mach-O/CMakeLists.txt
lldb/source/Plugins/ObjectFile/Minidump/CMakeLists.txt
lldb/source/Plugins/ObjectFile/PDB/CMakeLists.txt
lldb/source/Plugins/ObjectFile/PECOFF/CMakeLists.txt
lldb/source/Plugins/ObjectFile/Placeholder/CMakeLists.txt
lldb/source/Plugins/ObjectFile/XCOFF/CMakeLists.txt
lldb/source/Plugins/ObjectFile/wasm/CMakeLists.txt
lldb/source/Plugins/Platform/Android/CMakeLists.txt
lldb/source/Plugins/Platform/FreeBSD/CMakeLists.txt
lldb/source/Plugins/Platform/MacOSX/CMakeLists.txt
lldb/source/Plugins/Platform/MacOSX/objcxx/CMakeLists.txt
lldb/source/Plugins/Platform/QemuUser/CMakeLists.txt
lldb/source/Plugins/Platform/Windows/CMakeLists.txt
lldb/source/Plugins/Process/AIX/CMakeLists.txt
lldb/source/Plugins/Process/FreeBSD/CMakeLists.txt
lldb/source/Plugins/Process/FreeBSDKernel/CMakeLists.txt
lldb/source/Plugins/Process/Linux/CMakeLists.txt
lldb/source/Plugins/Process/NetBSD/CMakeLists.txt
lldb/source/Plugins/Process/POSIX/CMakeLists.txt
lldb/source/Plugins/Process/Utility/CMakeLists.txt
lldb/source/Plugins/Process/Windows/Common/CMakeLists.txt
lldb/source/Plugins/Process/elf-core/CMakeLists.txt
lldb/source/Plugins/Process/gdb-remote/CMakeLists.txt
lldb/source/Pl

[Lldb-commits] [lldb] 7214a3d - [lldb] Do not accept invalid `process save-core` plugins (#142684)

2025-06-04 Thread via lldb-commits

Author: Ebuka Ezike
Date: 2025-06-04T11:33:35+01:00
New Revision: 7214a3d3da851018a96ac85060a2f9aeb7715f7f

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

LOG: [lldb] Do not accept invalid `process save-core` plugins (#142684)

Fixes #142581

Added: 
lldb/test/Shell/Commands/command-process-save-core-not-a-plugin.test

Modified: 
lldb/source/Commands/CommandObjectProcess.cpp
lldb/source/Symbol/SaveCoreOptions.cpp

Removed: 




diff  --git a/lldb/source/Commands/CommandObjectProcess.cpp 
b/lldb/source/Commands/CommandObjectProcess.cpp
index d0f5eaf2dfd9a..b1f243c9e2777 100644
--- a/lldb/source/Commands/CommandObjectProcess.cpp
+++ b/lldb/source/Commands/CommandObjectProcess.cpp
@@ -1303,7 +1303,7 @@ class CommandObjectProcessSaveCore : public 
CommandObjectParsed {
 llvm_unreachable("Unimplemented option");
   }
 
-  return {};
+  return error;
 }
 
 void OptionParsingStarting(ExecutionContext *execution_context) override {

diff  --git a/lldb/source/Symbol/SaveCoreOptions.cpp 
b/lldb/source/Symbol/SaveCoreOptions.cpp
index e51ae27954934..d884b00a47b00 100644
--- a/lldb/source/Symbol/SaveCoreOptions.cpp
+++ b/lldb/source/Symbol/SaveCoreOptions.cpp
@@ -24,7 +24,6 @@ Status SaveCoreOptions::SetPluginName(const char *name) {
   if (!PluginManager::IsRegisteredObjectFilePluginName(name)) {
 return Status::FromErrorStringWithFormat(
 "plugin name '%s' is not a valid ObjectFile plugin name", name);
-return error;
   }
 
   m_plugin_name = name;

diff  --git 
a/lldb/test/Shell/Commands/command-process-save-core-not-a-plugin.test 
b/lldb/test/Shell/Commands/command-process-save-core-not-a-plugin.test
new file mode 100644
index 0..c034c8ebbf87d
--- /dev/null
+++ b/lldb/test/Shell/Commands/command-process-save-core-not-a-plugin.test
@@ -0,0 +1,19 @@
+# This checks that lldb returns an error if process save-core is called
+# with a plugin that does not exist.
+
+# RUN: %clang_host -g %S/Inputs/main.c -o %t
+# RUN: %lldb %t -s %s -o exit 2>&1 | FileCheck %s
+
+b main
+# CHECK-LABEL: b main
+# CHECK: Breakpoint 1: where = {{.*}}`main
+
+run
+# CHECK-LABEL: run
+# CHECK: Process {{.*}} stopped
+# CHECK: stop reason = breakpoint 1
+# CHECK:   frame #0: {{.*}}`main at main.c
+
+process save-core --plugin-name=notaplugin dump
+# CHECK-LABEL: process save-core --plugin-name=notaplugin dump
+# CHECK: error: plugin name 'notaplugin' is not a valid ObjectFile plugin name



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


[Lldb-commits] [lldb] [lldb] Do not accept invalid `process save-core` plugins (PR #142684)

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

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


[Lldb-commits] [lldb] [lldb] Do not accept invalid `process save-core` plugins (PR #142684)

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

DavidSpickett wrote:

Thanks!

Cleaning up small things like this has a bigger impact than you'd think. 

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


[Lldb-commits] [lldb] [lldb] Do not accept invalid `process save-core` plugins (PR #142684)

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

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `fuchsia-x86_64-linux` 
running on `fuchsia-debian-64-us-central1-a-1` while building `lldb` at step 4 
"annotate".

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


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

```
Step 4 (annotate) failure: 'python 
../llvm-zorg/zorg/buildbot/builders/annotated/fuchsia-linux.py ...' (failure)
...
[191/2505] Copying CXX header __ranges/lazy_split_view.h
[192/2505] Copying CXX header __ranges/movable_box.h
[193/2505] Copying CXX header __ranges/non_propagating_cache.h
[194/2505] Copying CXX header __ranges/owning_view.h
[195/2505] Copying CXX header __ranges/range_adaptor.h
[196/2505] Copying CXX header __ranges/rbegin.h
[197/2505] Copying CXX header __ranges/ref_view.h
[198/2505] Copying CXX header __algorithm/out_value_result.h
[199/2505] Building CXX object 
libc/src/stdlib/baremetal/CMakeFiles/libc.src.stdlib.baremetal.abort.dir/abort.cpp.obj
[200/2505] Building CXX object 
libc/startup/baremetal/CMakeFiles/libc.startup.baremetal.fini.dir/fini.cpp.obj
FAILED: 
libc/startup/baremetal/CMakeFiles/libc.startup.baremetal.fini.dir/fini.cpp.obj 
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v37n2aa1/./bin/clang++ 
--target=armv7em-none-eabi -DLIBC_NAMESPACE=__llvm_libc_21_0_0_git 
-I/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/libc -isystem 
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v37n2aa1/include/armv7em-unknown-none-eabi
 --target=armv7em-none-eabi -Wno-atomic-alignment "-Dvfprintf(stream, format, 
vlist)=vprintf(format, vlist)" "-Dfprintf(stream, format, ...)=printf(format)" 
-D_LIBCPP_PRINT=1 -mthumb -fPIC -fno-semantic-interposition 
-fvisibility-inlines-hidden -Werror=date-time 
-Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter 
-Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough 
-Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor 
-Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion 
-Wmisleading-indentation -Wctad-maybe-unsupported -ffunction-sections 
-fdata-sections 
-ffile-prefix-map=/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-v37n2aa1/runtimes/runtimes-armv7em-none-eabi-bins=../../../../llvm-project
 -ffile-prefix-map=/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/= 
-no-canonical-prefixes -Os -DNDEBUG --target=armv7em-none-eabi 
-DLIBC_QSORT_IMPL=LIBC_QSORT_HEAP_SORT -DLIBC_TYPES_TIME_T_IS_32_BIT 
-DLIBC_ADD_NULL_CHECKS "-DLIBC_MATH=(LIBC_MATH_SKIP_ACCURATE_PASS | 
LIBC_MATH_SMALL_TABLES)" -fpie -ffreestanding -DLIBC_FULL_BUILD -nostdlibinc 
-ffixed-point -fno-builtin -fno-exceptions -fno-lax-vector-conversions 
-fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti 
-ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -Wall -Wextra -Werror 
-Wconversion -Wno-sign-conversion -Wdeprecated -Wno-c99-extensions 
-Wno-gnu-imaginary-constant -Wno-pedantic -Wimplicit-fallthrough 
-Wwrite-strings -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path 
-Wstrict-prototypes -Wthread-safety -Wglobal-constructors 
-DLIBC_COPT_PUBLIC_PACKAGING -MD -MT 
libc/startup/baremetal/CMakeFiles/libc.startup.baremetal.fini.dir/fini.cpp.obj 
-MF 
libc/startup/baremetal/CMakeFiles/libc.startup.baremetal.fini.dir/fini.cpp.obj.d
 -o 
libc/startup/baremetal/CMakeFiles/libc.startup.baremetal.fini.dir/fini.cpp.obj 
-c 
/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/libc/startup/baremetal/fini.cpp
/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/libc/startup/baremetal/fini.cpp:16:8:
 error: unknown type name 'uintptr_t'
   16 | extern uintptr_t __fini_array_start[];
  |^
/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/libc/startup/baremetal/fini.cpp:17:8:
 error: unknown type name 'uintptr_t'
   17 | extern uintptr_t __fini_array_end[];
  |^
2 errors generated.
[201/2505] Building CXX object 
libc/src/string/CMakeFiles/libc.src.string.memrchr.dir/memrchr.cpp.obj
[202/2505] Building CXX object 
libc/src/string/CMakeFiles/libc.src.string.memccpy.dir/memccpy.cpp.obj
[203/2505] Generating header errno.h from 
/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/runtimes/../libc/include/errno.yaml
[204/2505] Generating header assert.h from 
/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/runtimes/../libc/include/assert.yaml
[205/2505] Copying CXX header __algorithm/partial_sort.h
[206/2505] Copying CXX header __algorithm/partial_sort_copy.h
[207/2505] Copying CXX header __algorithm/ranges_find_if.h
[208/2505] Generating header float.h from 
/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/runtimes/../libc/include/float.yaml
[209/2505] Building CXX object 
libc/src/string/CMakeFiles/libc.src.string.strcoll.dir/strcoll.cpp.obj
[210/2505] Generating header features.h from 
/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/runtimes/../libc/include/features.yaml
[211/2505] Building CXX object 
libc/s

[Lldb-commits] [lldb] 159de36 - [lldb-dap] Add missing key for capabilities event. (#142751)

2025-06-04 Thread via lldb-commits

Author: Ebuka Ezike
Date: 2025-06-04T10:26:39+01:00
New Revision: 159de3633640a5cb2d322ebe8cc4ec0c1c9a896d

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

LOG: [lldb-dap] Add missing key for capabilities event. (#142751)

fixes the failed tests on aarch64.

complements #142439

Added: 


Modified: 
lldb/tools/lldb-dap/EventHelper.cpp

Removed: 




diff  --git a/lldb/tools/lldb-dap/EventHelper.cpp 
b/lldb/tools/lldb-dap/EventHelper.cpp
index 0dd0b61b1e2ae..33bc7c2cbef11 100644
--- a/lldb/tools/lldb-dap/EventHelper.cpp
+++ b/lldb/tools/lldb-dap/EventHelper.cpp
@@ -46,7 +46,9 @@ void SendTargetBasedCapabilities(DAP &dap) {
 
   protocol::Event event;
   event.event = "capabilities";
-  event.body = llvm::json::Object{{"supportsStepInTargetsRequest", false}};
+  event.body = llvm::json::Object{
+  {"capabilities",
+   llvm::json::Object{{"supportsStepInTargetsRequest", false;
   dap.Send(event);
 }
 // "ProcessEvent": {



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


[Lldb-commits] [lldb] [lldb][headers] Create script to fix up versioning (PR #141116)

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


@@ -290,6 +290,45 @@ else()
   endif()
 endif()
 
+# Stage all headers in the include directory in the build dir.
+file(GLOB public_headers ${LLDB_SOURCE_DIR}/include/lldb/API/*.h)
+set(lldb_header_staging_dir ${CMAKE_BINARY_DIR}/include/lldb)
+file(GLOB root_public_headers ${LLDB_SOURCE_DIR}/include/lldb/lldb-*.h)
+file(GLOB root_private_headers ${LLDB_SOURCE_DIR}/include/lldb/lldb-private*.h)
+list(REMOVE_ITEM root_public_headers ${root_private_headers})
+
+find_program(unifdef_EXECUTABLE unifdef)
+
+foreach(header
+${public_headers}
+${generated_public_headers}
+${root_public_headers})
+  get_filename_component(basename ${header} NAME)
+  set(staged_header ${lldb_header_staging_dir}/${basename})
+
+  if(unifdef_EXECUTABLE)
+# unifdef returns 0 when the file is unchanged and 1 if something was 
changed.
+# That means if we successfully remove SWIG code, the build system believes
+# that the command has failed and stops. This is undesirable.
+set(copy_command ${unifdef_EXECUTABLE} -USWIG -o ${staged_header} 
${header} || (exit 0))

HemangGadhavi wrote:

@chelcassanova
For the `unifdef` binary, -o option is not available in some of the system like 
AIX, and its giving warning while building.
Is there any way to generate the output file ? may be using > operation ?
```
[362/3610] LLDB headers: stage LLDB headers in include directory
/usr/bin/unifdef: 1286-201 -o is not a recognized flag.
Usage: /usr/bin/unifdef [-t] [-l] [-c]
[[-DSymbol] [-USymbol] [-idSymbol] [-iuSymbol]] ... [File]
At least one parameter from [-D -U -id -iu] is required.
```

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


[Lldb-commits] [lldb] [lldb][headers] Create script to fix up versioning (PR #141116)

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

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


[Lldb-commits] [lldb] [lldb][headers] Create script to fix up versioning (PR #141116)

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

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


[Lldb-commits] [lldb] [lldb-dap] Use structured types for stepInTargets request (PR #142439)

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

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


[Lldb-commits] [lldb] [lldb][headers] Create script to fix up versioning (PR #141116)

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

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


[Lldb-commits] [lldb] [llvm] [lldb][llvm][AIX] Added support for getProcFile with TID (PR #142586)

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

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder 
`sanitizer-x86_64-linux-fast` running on `sanitizer-buildbot4` while building 
`lldb,llvm` at step 2 "annotate".

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


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

```
Step 2 (annotate) failure: 'python 
../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py'
 (failure)
...
llvm-lit: 
/home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520:
 note: using lld-link: 
/home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/lld-link
llvm-lit: 
/home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520:
 note: using ld64.lld: 
/home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/ld64.lld
llvm-lit: 
/home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520:
 note: using wasm-ld: 
/home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/wasm-ld
llvm-lit: 
/home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520:
 note: using ld.lld: 
/home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/ld.lld
llvm-lit: 
/home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520:
 note: using lld-link: 
/home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/lld-link
llvm-lit: 
/home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520:
 note: using ld64.lld: 
/home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/ld64.lld
llvm-lit: 
/home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520:
 note: using wasm-ld: 
/home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/wasm-ld
llvm-lit: 
/home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/utils/lit/lit/main.py:73:
 note: The test suite configuration requested an individual test timeout of 0 
seconds but a timeout of 900 seconds was requested on the command line. Forcing 
timeout to be 900 seconds.
-- Testing: 90043 tests, 88 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.
FAIL: LLVM :: 
ExecutionEngine/JITLink/x86-64/COFF_directive_alternatename_fail.s (67639 of 
90043)
 TEST 'LLVM :: 
ExecutionEngine/JITLink/x86-64/COFF_directive_alternatename_fail.s' FAILED 

Exit Code: 1

Command Output (stderr):
--
/home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llvm-mc 
-filetype=obj -triple=x86_64-windows-msvc 
/home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_directive_alternatename_fail.s
 -o 
/home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/COFF_directive_alternatename_fail.s.tmp
 # RUN: at line 1
+ /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llvm-mc 
-filetype=obj -triple=x86_64-windows-msvc 
/home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_directive_alternatename_fail.s
 -o 
/home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/COFF_directive_alternatename_fail.s.tmp
not 
/home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llvm-jitlink
 -noexec 
/home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/COFF_directive_alternatename_fail.s.tmp
 2>&1 | 
/home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/FileCheck 
/home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_directive_alternatename_fail.s
 # RUN: at line 2
+ not 
/home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/llvm-jitlink
 -noexec 
/home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/test/ExecutionEngine/JITLink/x86-64/Output/COFF_directive_alternatename_fail.s.tmp
+ /home/b/sanitizer-x86_64-linux-fast/build/llvm_build_asan_ubsan/bin/FileCheck 
/home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_directive_alternatename_fail.s

--


Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..
Slowest Tests:
--
587.17s: LLVM :: CodeGen/AMDGPU/sched-group-barrier-pipeline-solver.mir
395.33s: Clang :: Driver/fsanitize.c
347.26s: LLVM :: CodeGen/AMDGPU/amdgcn.bitcast.1024bit.ll
313.62s: Clang :: Preprocessor/riscv-target-features.c
252.67s: LLVM :: CodeGen/AMDGPU/memintrinsic-unroll.ll
238.73s: Clang :: Driver/arm-cortex-cpus-2.c
238.50s: Clang :: OpenMP/target_defaultmap_codegen_01.cpp
231.41s: Clang :: Driver/arm-cortex-cpus-1.c
230.79s: Clang :: OpenMP/target_update_codegen.cpp
227.65s:

[Lldb-commits] [lldb] [lldb-dap] Migrating 'threads' request to structured types. (PR #142510)

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


@@ -116,78 +119,78 @@ void SendProcessEvent(DAP &dap, LaunchMethod 
launch_method) {
 
 // Send a thread stopped event for all threads as long as the process
 // is stopped.
-void SendThreadStoppedEvent(DAP &dap) {
+llvm::Error SendThreadStoppedEvent(DAP &dap, bool on_entry) {
+  lldb::SBMutex lock = dap.GetAPIMutex();
+  std::lock_guard guard(lock);
+
   lldb::SBProcess process = dap.target.GetProcess();
-  if (process.IsValid()) {
-auto state = process.GetState();
-if (state == lldb::eStateStopped) {
-  llvm::DenseSet old_thread_ids;
-  old_thread_ids.swap(dap.thread_ids);
-  uint32_t stop_id = process.GetStopID();
-  const uint32_t num_threads = process.GetNumThreads();
-
-  // First make a pass through the threads to see if the focused thread
-  // has a stop reason. In case the focus thread doesn't have a stop
-  // reason, remember the first thread that has a stop reason so we can
-  // set it as the focus thread if below if needed.
-  lldb::tid_t first_tid_with_reason = LLDB_INVALID_THREAD_ID;
-  uint32_t num_threads_with_reason = 0;
-  bool focus_thread_exists = false;
-  for (uint32_t thread_idx = 0; thread_idx < num_threads; ++thread_idx) {
-lldb::SBThread thread = process.GetThreadAtIndex(thread_idx);
-const lldb::tid_t tid = thread.GetThreadID();
-const bool has_reason = ThreadHasStopReason(thread);
-// If the focus thread doesn't have a stop reason, clear the thread ID
-if (tid == dap.focus_tid) {
-  focus_thread_exists = true;
-  if (!has_reason)
-dap.focus_tid = LLDB_INVALID_THREAD_ID;
-}
-if (has_reason) {
-  ++num_threads_with_reason;
-  if (first_tid_with_reason == LLDB_INVALID_THREAD_ID)
-first_tid_with_reason = tid;
-}
-  }
+  if (!process.IsValid())
+return make_error("invalid process");
+
+  lldb::StateType state = process.GetState();
+  if (!lldb::SBDebugger::StateIsStoppedState(state))
+return make_error();
+
+  llvm::DenseSet old_thread_ids;
+  old_thread_ids.swap(dap.thread_ids);
+  uint32_t stop_id = on_entry ? 0 : process.GetStopID();

da-viper wrote:

```suggestion
  uint32_t stop_id = on_entry ? LLDB_INVALID_STOP_ID : process.GetStopID();
```
I assume the `0` is for an invalid stop id ? 

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


[Lldb-commits] [lldb] [lldb-dap] Migrating 'threads' request to structured types. (PR #142510)

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


@@ -110,4 +116,48 @@ std::string GetLoadAddressString(const lldb::addr_t addr) {
   return "0x" + llvm::utohexstr(addr, false, 16);
 }
 
+protocol::Thread CreateThread(lldb::SBThread &thread, lldb::SBFormat &format) {
+  std::string name;
+  lldb::SBStream stream;
+  if (format && thread.GetDescriptionWithFormat(format, stream).Success()) {
+name = stream.GetData();
+  } else {
+llvm::StringRef thread_name(thread.GetName());
+llvm::StringRef queue_name(thread.GetQueueName());
+
+if (!thread_name.empty()) {
+  name = thread_name.str();
+} else if (!queue_name.empty()) {
+  auto kind = thread.GetQueue().GetKind();
+  std::string queue_kind_label = "";
+  if (kind == lldb::eQueueKindSerial) {
+queue_kind_label = " (serial)";
+  } else if (kind == lldb::eQueueKindConcurrent) {
+queue_kind_label = " (concurrent)";
+  }
+
+  name = llvm::formatv("Thread {0} Queue: {1}{2}", thread.GetIndexID(),
+   queue_name, queue_kind_label)
+ .str();
+} else {
+  name = llvm::formatv("Thread {0}", thread.GetIndexID()).str();
+}
+  }
+  return protocol::Thread{thread.GetThreadID(), name};
+}
+
+std::vector GetThreads(lldb::SBProcess process,
+ lldb::SBFormat &format) {
+  lldb::SBMutex lock = process.GetTarget().GetAPIMutex();
+  std::lock_guard guard(lock);
+
+  std::vector threads;

da-viper wrote:

since we know the size we can reserve it. 

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


[Lldb-commits] [lldb] [lldb-dap] Migrating 'threads' request to structured types. (PR #142510)

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

https://github.com/da-viper approved this pull request.


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


[Lldb-commits] [lldb] [lldb-dap] Migrating 'threads' request to structured types. (PR #142510)

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


@@ -8,10 +8,11 @@
 
 #include "EventHelper.h"
 #include "DAP.h"
-#include "DAPLog.h"
+#include "DAPERror.h"

da-viper wrote:

```suggestion
#include "DAPError.h"
```

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


[Lldb-commits] [lldb] a48e1ab - [lldb-dap][test] Fix DAP disassemble test (#142129)

2025-06-04 Thread via lldb-commits

Author: Ebuka Ezike
Date: 2025-06-04T12:56:10+01:00
New Revision: a48e1aba63b8cb20de32a8db7ea29bb4d54cf3a1

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

LOG: [lldb-dap][test] Fix DAP disassemble test (#142129)

compare the instructions before and after setting breakpoint to make
sure they are the same.

Added: 


Modified: 
lldb/test/API/tools/lldb-dap/disassemble/TestDAP_disassemble.py
lldb/test/API/tools/lldb-dap/disassemble/main.c

Removed: 




diff  --git a/lldb/test/API/tools/lldb-dap/disassemble/TestDAP_disassemble.py 
b/lldb/test/API/tools/lldb-dap/disassemble/TestDAP_disassemble.py
index a8b51864d118b..0562f20335a23 100644
--- a/lldb/test/API/tools/lldb-dap/disassemble/TestDAP_disassemble.py
+++ b/lldb/test/API/tools/lldb-dap/disassemble/TestDAP_disassemble.py
@@ -2,13 +2,9 @@
 Test lldb-dap disassemble request
 """
 
-
-import dap_server
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
+from lldbsuite.test.decorators import skipIfWindows
+from lldbsuite.test.lldbtest import line_number
 import lldbdap_testcase
-import os
 
 
 class TestDAP_disassemble(lldbdap_testcase.DAPTestCaseBase):
@@ -20,18 +16,35 @@ def test_disassemble(self):
 program = self.getBuildArtifact("a.out")
 self.build_and_launch(program)
 source = "main.c"
-self.set_source_breakpoints(source, [line_number(source, "// 
breakpoint 1")])
+bp_line_no = line_number(source, "// breakpoint 1")
+self.set_source_breakpoints(source, [bp_line_no])
 self.continue_to_next_stop()
 
-_, pc_assembly = self.disassemble(frameIndex=0)
-self.assertIn("location", pc_assembly, "Source location missing.")
-self.assertIn("instruction", pc_assembly, "Assembly instruction 
missing.")
+insts_with_bp, pc_with_bp_assembly = self.disassemble(frameIndex=0)
+self.assertIn("location", pc_with_bp_assembly, "Source location 
missing.")
+self.assertEqual(
+pc_with_bp_assembly["line"], bp_line_no, "Expects the same line 
number"
+)
+no_bp = self.set_source_breakpoints(source, [])
+self.assertEqual(len(no_bp), 0, "Expects no breakpoints.")
+self.assertIn(
+"instruction", pc_with_bp_assembly, "Assembly instruction missing."
+)
+
+insts_no_bp, pc_no_bp_assembly = self.disassemble(frameIndex=0)
+self.assertIn("location", pc_no_bp_assembly, "Source location 
missing.")
+self.assertEqual(
+pc_with_bp_assembly["line"], bp_line_no, "Expects the same line 
number"
+)
+# the disassembly instructions should be the same with breakpoint and 
no breakpoint;
+self.assertDictEqual(
+insts_with_bp,
+insts_no_bp,
+"Expects instructions are the same after removing breakpoints.",
+)
+self.assertIn("instruction", pc_no_bp_assembly, "Assembly instruction 
missing.")
 
-# The calling frame (qsort) is coming from a system library, as a 
result
-# we should not have a source location.
-_, qsort_assembly = self.disassemble(frameIndex=1)
-self.assertNotIn("location", qsort_assembly, "Source location not 
expected.")
-self.assertIn("instruction", pc_assembly, "Assembly instruction 
missing.")
+self.continue_to_exit()
 
 @skipIfWindows
 def test_disassemble_backwards(self):
@@ -74,3 +87,7 @@ def test_disassemble_backwards(self):
 backwards_instructions,
 f"requested instruction should be preceeded by 
{backwards_instructions} instructions. Actual index: {frame_instruction_index}",
 )
+
+# clear breakpoints
+self.set_source_breakpoints(source, [])
+self.continue_to_exit()

diff  --git a/lldb/test/API/tools/lldb-dap/disassemble/main.c 
b/lldb/test/API/tools/lldb-dap/disassemble/main.c
index 9da119ef70262..b4927db10e949 100644
--- a/lldb/test/API/tools/lldb-dap/disassemble/main.c
+++ b/lldb/test/API/tools/lldb-dap/disassemble/main.c
@@ -6,9 +6,7 @@ int compare_ints(const void *a, const void *b) {
   int arg1 = *(const int *)a;
   int arg2 = *(const int *)b;
 
-  // breakpoint 1
-
-  if (arg1 < arg2)
+  if (arg1 < arg2) // breakpoint 1
 return -1;
   if (arg1 > arg2)
 return 1;



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


[Lldb-commits] [lldb] [lldb-dap][test] Fix DAP disassemble test (PR #142129)

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

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


[Lldb-commits] [lldb] c9e1c52 - [lldb] Fix a warning

2025-06-04 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2025-06-04T07:00:25-07:00
New Revision: c9e1c52e2e75a91a44a98df818cc9bd11655e51d

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

LOG: [lldb] Fix a warning

This patch fixes:

  lldb/tools/lldb-dap/Handler/StepInTargetsRequestHandler.cpp:89:2:
  error: extra ';' outside of a function is incompatible with C++98
  [-Werror,-Wc++98-compat-extra-semi]

Added: 


Modified: 
lldb/tools/lldb-dap/Handler/StepInTargetsRequestHandler.cpp

Removed: 




diff  --git a/lldb/tools/lldb-dap/Handler/StepInTargetsRequestHandler.cpp 
b/lldb/tools/lldb-dap/Handler/StepInTargetsRequestHandler.cpp
index 1a76371be2d58..9295b6ceae36d 100644
--- a/lldb/tools/lldb-dap/Handler/StepInTargetsRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/StepInTargetsRequestHandler.cpp
@@ -86,6 +86,6 @@ StepInTargetsRequestHandler::Run(const StepInTargetsArguments 
&args) const {
 }
   }
   return body;
-};
+}
 
 } // namespace lldb_dap



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


[Lldb-commits] [lldb] da8271e - [lldb][test] Disable TestCxxFrameFormatRecursive on Linux

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

Author: David Spickett
Date: 2025-06-04T14:01:46Z
New Revision: da8271e88793909b738e2afdf17d0ae11dade455

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

LOG: [lldb][test] Disable TestCxxFrameFormatRecursive on Linux

It was always expected to fail and now it sometimes times out instead.

See https://github.com/llvm/llvm-project/issues/142726.

Added: 


Modified: 
lldb/test/Shell/Settings/TestCxxFrameFormatRecursive.test

Removed: 




diff  --git a/lldb/test/Shell/Settings/TestCxxFrameFormatRecursive.test 
b/lldb/test/Shell/Settings/TestCxxFrameFormatRecursive.test
index 887de882886ed..465b1bb28e327 100644
--- a/lldb/test/Shell/Settings/TestCxxFrameFormatRecursive.test
+++ b/lldb/test/Shell/Settings/TestCxxFrameFormatRecursive.test
@@ -1,3 +1,5 @@
+# Flaky on Linux, see https://github.com/llvm/llvm-project/issues/142726
+# UNSUPPORTED: system-linux
 # XFAIL: *
 
 # Test disallowed variables inside the



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


[Lldb-commits] [lldb] [WIP] [lldb] Add fetching of source files used in modules. (PR #141773)

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

https://github.com/da-viper updated 
https://github.com/llvm/llvm-project/pull/141773

>From 429c656be7e8176c1c4d6f7c4339b7c6d76fa56c Mon Sep 17 00:00:00 2001
From: Ebuka Ezike 
Date: Wed, 28 May 2025 09:04:08 +0100
Subject: [PATCH] [lldb] Inital implementation of fetching source files used in
 modules.

Rough implementation of a source locator plugin for LLDB.
---
 lldb/include/lldb/Core/PluginManager.h|  4 +++
 lldb/include/lldb/lldb-private-interfaces.h   |  2 ++
 lldb/source/Core/PluginManager.cpp| 25 +--
 lldb/source/Core/SourceManager.cpp| 26 +++
 .../Debuginfod/SymbolLocatorDebuginfod.cpp| 32 ++-
 .../Debuginfod/SymbolLocatorDebuginfod.h  |  7 
 6 files changed, 93 insertions(+), 3 deletions(-)

diff --git a/lldb/include/lldb/Core/PluginManager.h 
b/lldb/include/lldb/Core/PluginManager.h
index e2f709ecd2ff7..1cff17e8146a2 100644
--- a/lldb/include/lldb/Core/PluginManager.h
+++ b/lldb/include/lldb/Core/PluginManager.h
@@ -373,6 +373,7 @@ class PluginManager {
   SymbolLocatorDownloadObjectAndSymbolFile download_object_symbol_file =
   nullptr,
   SymbolLocatorFindSymbolFileInBundle find_symbol_file_in_bundle = nullptr,
+  SymbolLocatorLocateSourceFile locate_source_file = nullptr,
   DebuggerInitializeCallback debugger_init_callback = nullptr);
 
   static bool UnregisterPlugin(SymbolLocatorCreateInstance create_callback);
@@ -388,6 +389,9 @@ class PluginManager {
  const FileSpecList &default_search_paths,
  StatisticsMap &map);
 
+  static std::optional LocateSourceFile(const ModuleSpec 
&module_spec,
+  const FileSpec &file_spec);
+
   static bool DownloadObjectAndSymbolFile(ModuleSpec &module_spec,
   Status &error,
   bool force_lookup = true,
diff --git a/lldb/include/lldb/lldb-private-interfaces.h 
b/lldb/include/lldb/lldb-private-interfaces.h
index d366dbd1d7832..7860d1ab639ed 100644
--- a/lldb/include/lldb/lldb-private-interfaces.h
+++ b/lldb/include/lldb/lldb-private-interfaces.h
@@ -97,6 +97,8 @@ typedef std::optional 
(*SymbolLocatorFindSymbolFileInBundle)(
 const FileSpec &dsym_bundle_fspec, const UUID *uuid, const ArchSpec *arch);
 typedef std::optional (*SymbolLocatorLocateExecutableSymbolFile)(
 const ModuleSpec &module_spec, const FileSpecList &default_search_paths);
+typedef std::optional (*SymbolLocatorLocateSourceFile)(
+const ModuleSpec &module_spec, const FileSpec &file_spec);
 typedef bool (*SymbolLocatorDownloadObjectAndSymbolFile)(
 ModuleSpec &module_spec, Status &error, bool force_lookup,
 bool copy_executable);
diff --git a/lldb/source/Core/PluginManager.cpp 
b/lldb/source/Core/PluginManager.cpp
index de815e6308838..5b4044f3c208c 100644
--- a/lldb/source/Core/PluginManager.cpp
+++ b/lldb/source/Core/PluginManager.cpp
@@ -1173,18 +1173,21 @@ struct SymbolLocatorInstance
   SymbolLocatorLocateExecutableSymbolFile locate_executable_symbol_file,
   SymbolLocatorDownloadObjectAndSymbolFile download_object_symbol_file,
   SymbolLocatorFindSymbolFileInBundle find_symbol_file_in_bundle,
+  SymbolLocatorLocateSourceFile locate_source_file,
   DebuggerInitializeCallback debugger_init_callback)
   : PluginInstance(
 name, description, create_callback, debugger_init_callback),
 locate_executable_object_file(locate_executable_object_file),
 locate_executable_symbol_file(locate_executable_symbol_file),
 download_object_symbol_file(download_object_symbol_file),
-find_symbol_file_in_bundle(find_symbol_file_in_bundle) {}
+find_symbol_file_in_bundle(find_symbol_file_in_bundle),
+locate_source_file(locate_source_file) {}
 
   SymbolLocatorLocateExecutableObjectFile locate_executable_object_file;
   SymbolLocatorLocateExecutableSymbolFile locate_executable_symbol_file;
   SymbolLocatorDownloadObjectAndSymbolFile download_object_symbol_file;
   SymbolLocatorFindSymbolFileInBundle find_symbol_file_in_bundle;
+  SymbolLocatorLocateSourceFile locate_source_file;
 };
 typedef PluginInstances SymbolLocatorInstances;
 
@@ -1200,11 +1203,12 @@ bool PluginManager::RegisterPlugin(
 SymbolLocatorLocateExecutableSymbolFile locate_executable_symbol_file,
 SymbolLocatorDownloadObjectAndSymbolFile download_object_symbol_file,
 SymbolLocatorFindSymbolFileInBundle find_symbol_file_in_bundle,
+SymbolLocatorLocateSourceFile locate_source_file,
 DebuggerInitializeCallback debugger_init_callback) {
   return GetSymbolLocatorInstances().RegisterPlugin(
   name, description, create_callback, locate_executable_object_file,
   locate_executable_symbol_file, download_object_symbol_file,
-  find_symbol_file_in_bundle, debugger_init_callback);
+  find_symbol_file_in_bundle, locate_source_file, d

[Lldb-commits] [lldb] [llvm] support in LLDB for the DWARF operations `DW_OP_GNU_implicit_pointer/DW_OP_implicit_pointer`. (PR #142747)

2025-06-04 Thread via lldb-commits

https://github.com/Thrrr updated 
https://github.com/llvm/llvm-project/pull/142747

>From 64785ba97f670ace37c3d1e43aef1141a232c00c Mon Sep 17 00:00:00 2001
From: jinruiShi <1379998...@qq.com>
Date: Wed, 4 Jun 2025 16:24:53 +0800
Subject: [PATCH] LLDB support for
 DW_OP_GNU_implicit_pointer/DW_OP_implicit_pointer operation

---
 lldb/include/lldb/Core/Value.h| 10 +++
 lldb/include/lldb/Symbol/Variable.h   |  8 +-
 .../Commands/CommandObjectDWIMPrint.cpp   |  9 ++-
 lldb/source/Core/Value.cpp| 21 +-
 lldb/source/Expression/DWARFExpression.cpp| 20 -
 .../source/Expression/DWARFExpressionList.cpp | 73 ++-
 lldb/source/Expression/Materializer.cpp   | 40 --
 lldb/source/Symbol/Variable.cpp   |  4 +-
 .../ValueObject/ValueObjectVariable.cpp   | 17 +++--
 llvm/include/llvm/BinaryFormat/Dwarf.def  |  2 +
 llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp  |  2 +
 .../DebugInfo/LogicalView/Core/LVLocation.cpp |  1 +
 12 files changed, 181 insertions(+), 26 deletions(-)

diff --git a/lldb/include/lldb/Core/Value.h b/lldb/include/lldb/Core/Value.h
index 3714621b469ec..b5411e2377c93 100644
--- a/lldb/include/lldb/Core/Value.h
+++ b/lldb/include/lldb/Core/Value.h
@@ -82,6 +82,10 @@ class Value {
 
   ValueType GetValueType() const;
 
+  void setImplictPointerDIEoffset(uint64_t offset);
+  void setImplictPointerOffset(int64_t offset);
+  uint64_t getImplictPointerDIEoffset() const;
+  int64_t getImplictPointerOffset() const;
   AddressType GetValueAddressType() const;
 
   ContextType GetContextType() const { return m_context_type; }
@@ -182,6 +186,12 @@ class Value {
   ValueType m_value_type = ValueType::Scalar;
   ContextType m_context_type = ContextType::Invalid;
   DataBufferHeap m_data_buffer;
+  struct {
+/* 4- or 8-byte offset of DIE  */
+uint64_t die_offset = 0;
+/* The byte offset into the resulting data.  */
+int64_t result_offset;
+  } implicit_pointer;
 };
 
 class ValueList {
diff --git a/lldb/include/lldb/Symbol/Variable.h 
b/lldb/include/lldb/Symbol/Variable.h
index c437624d1ea6d..d38945f32f89e 100644
--- a/lldb/include/lldb/Symbol/Variable.h
+++ b/lldb/include/lldb/Symbol/Variable.h
@@ -34,7 +34,7 @@ class Variable : public UserID, public 
std::enable_shared_from_this {
SymbolContextScope *owner_scope, const RangeList &scope_range,
Declaration *decl, const DWARFExpressionList &location,
bool external, bool artificial, bool location_is_constant_data,
-   bool static_member = false);
+   bool static_member = false, bool is_implicit_pointer = false);
 
   virtual ~Variable();
 
@@ -97,6 +97,9 @@ class Variable : public UserID, public 
std::enable_shared_from_this {
 
   void SetLocationIsConstantValueData(bool b) { m_loc_is_const_data = b; }
 
+  bool IsImplicitPointer() const { return m_is_implicit_pointer; }
+
+  void SetIsImplicitPointer(bool b) { m_is_implicit_pointer = b; }
   typedef size_t (*GetVariableCallback)(void *baton, const char *name,
 VariableList &var_list);
 
@@ -140,7 +143,8 @@ class Variable : public UserID, public 
std::enable_shared_from_this {
   unsigned m_loc_is_const_data : 1;
   /// Non-zero if variable is static member of a class or struct.
   unsigned m_static_member : 1;
-
+  /// Non-zero if the variable is a implicit pointer type.
+  unsigned m_is_implicit_pointer : 1;
 private:
   Variable(const Variable &rhs) = delete;
   Variable &operator=(const Variable &rhs) = delete;
diff --git a/lldb/source/Commands/CommandObjectDWIMPrint.cpp 
b/lldb/source/Commands/CommandObjectDWIMPrint.cpp
index 17c60297a521e..1cf82dfb780a4 100644
--- a/lldb/source/Commands/CommandObjectDWIMPrint.cpp
+++ b/lldb/source/Commands/CommandObjectDWIMPrint.cpp
@@ -19,6 +19,7 @@
 #include "lldb/Target/StackFrame.h"
 #include "lldb/Utility/ConstString.h"
 #include "lldb/ValueObject/ValueObject.h"
+#include "lldb/Symbol/Variable.h"
 #include "lldb/lldb-defines.h"
 #include "lldb/lldb-enumerations.h"
 #include "lldb/lldb-forward.h"
@@ -174,7 +175,13 @@ void CommandObjectDWIMPrint::DoExecute(StringRef command,
 if (auto persisted_valobj = valobj_sp->Persist())
   valobj_sp = persisted_valobj;
   }
-
+  // FIXME: LLDB haven't implemented "optimization out" output.
+  if (valobj_sp->GetVariable()->IsImplicitPointer()) {
+result.AppendMessageWithFormatv("expression `{0}` is an implicit "
+"pointer, value has been optimized 
out",
+expr);
+return;
+  }
   if (verbosity == eDWIMPrintVerbosityFull) {
 StringRef flags;
 if (args.HasArgs())
diff --git a/lldb/source/Core/Value.cpp b/lldb/source/Core/Value.cpp
index c91b3f852f986..4e7956c7894b5 100644
--- a/lldb/source/Core/Value.cpp
+++ b/lldb/source/Core/Value.cpp
@@ -55,7 +55,8 @@ Value::Value(const void *bytes

[Lldb-commits] [lldb] [lldb] Set default object format to `MachO` in `ObjectFileMachO` (PR #142704)

2025-06-04 Thread via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Set default object format to `MachO` in `ObjectFileMachO` (PR #142704)

2025-06-04 Thread via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Set default object format to `MachO` in `ObjectFileMachO` (PR #142704)

2025-06-04 Thread via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Set default object format to `MachO` in `ObjectFileMachO` (PR #142704)

2025-06-04 Thread via lldb-commits

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


[Lldb-commits] [lldb] [lldb][test] Free buffers in demangling tests to avoid leaks (PR #142676)

2025-06-04 Thread Jordan Rupprecht via lldb-commits

rupprecht wrote:

> TrackingOutputBufferDeleter

Yes, that would be a good improvement, especially since the test method here 
has an early return.

I'd like to land this as-is to plug the leak, but I'll start a new branch now 
w/ that suggestion.

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


[Lldb-commits] [lldb] 79f298e - [lldb][test] Free buffers in demangling tests to avoid leaks (#142676)

2025-06-04 Thread via lldb-commits

Author: Jordan Rupprecht
Date: 2025-06-04T10:34:16-05:00
New Revision: 79f298e7e5ac88bc0041b1bd03e5210b8583cf03

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

LOG: [lldb][test] Free buffers in demangling tests to avoid leaks (#142676)

Test case added by f669b9c3eca9438d33259aefb8156f977f1df382 / #137793.
Note that the `DemanglingParts` case above also frees the buffer; this
new test case is inconsistent.

Added: 


Modified: 
lldb/unittests/Core/MangledTest.cpp

Removed: 




diff  --git a/lldb/unittests/Core/MangledTest.cpp 
b/lldb/unittests/Core/MangledTest.cpp
index dfdc026521379..e9dfd05459642 100644
--- a/lldb/unittests/Core/MangledTest.cpp
+++ b/lldb/unittests/Core/MangledTest.cpp
@@ -642,8 +642,10 @@ TEST_P(DemanglingInfoCorrectnessTestFixutre, Correctness) {
   // function names.
   if (Root->getKind() !=
   llvm::itanium_demangle::Node::Kind::KFunctionEncoding &&
-  Root->getKind() != llvm::itanium_demangle::Node::Kind::KDotSuffix)
+  Root->getKind() != llvm::itanium_demangle::Node::Kind::KDotSuffix) {
+std::free(OB.getBuffer());
 return;
+  }
 
   ASSERT_TRUE(OB.NameInfo.hasBasename());
 
@@ -670,6 +672,7 @@ TEST_P(DemanglingInfoCorrectnessTestFixutre, Correctness) {
return_right, qualifiers, suffix);
 
   EXPECT_EQ(reconstructed_name, demangled);
+  std::free(OB.getBuffer());
 }
 
 INSTANTIATE_TEST_SUITE_P(



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


[Lldb-commits] [lldb] [lldb][test] Free buffers in demangling tests to avoid leaks (PR #142676)

2025-06-04 Thread Jordan Rupprecht via lldb-commits

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


[Lldb-commits] [lldb] [lldb-dap] Migrating 'threads' request to structured types. (PR #142510)

2025-06-04 Thread John Harrison via lldb-commits


@@ -116,78 +119,78 @@ void SendProcessEvent(DAP &dap, LaunchMethod 
launch_method) {
 
 // Send a thread stopped event for all threads as long as the process
 // is stopped.
-void SendThreadStoppedEvent(DAP &dap) {
+llvm::Error SendThreadStoppedEvent(DAP &dap, bool on_entry) {
+  lldb::SBMutex lock = dap.GetAPIMutex();
+  std::lock_guard guard(lock);
+
   lldb::SBProcess process = dap.target.GetProcess();
-  if (process.IsValid()) {
-auto state = process.GetState();
-if (state == lldb::eStateStopped) {
-  llvm::DenseSet old_thread_ids;
-  old_thread_ids.swap(dap.thread_ids);
-  uint32_t stop_id = process.GetStopID();
-  const uint32_t num_threads = process.GetNumThreads();
-
-  // First make a pass through the threads to see if the focused thread
-  // has a stop reason. In case the focus thread doesn't have a stop
-  // reason, remember the first thread that has a stop reason so we can
-  // set it as the focus thread if below if needed.
-  lldb::tid_t first_tid_with_reason = LLDB_INVALID_THREAD_ID;
-  uint32_t num_threads_with_reason = 0;
-  bool focus_thread_exists = false;
-  for (uint32_t thread_idx = 0; thread_idx < num_threads; ++thread_idx) {
-lldb::SBThread thread = process.GetThreadAtIndex(thread_idx);
-const lldb::tid_t tid = thread.GetThreadID();
-const bool has_reason = ThreadHasStopReason(thread);
-// If the focus thread doesn't have a stop reason, clear the thread ID
-if (tid == dap.focus_tid) {
-  focus_thread_exists = true;
-  if (!has_reason)
-dap.focus_tid = LLDB_INVALID_THREAD_ID;
-}
-if (has_reason) {
-  ++num_threads_with_reason;
-  if (first_tid_with_reason == LLDB_INVALID_THREAD_ID)
-first_tid_with_reason = tid;
-}
-  }
+  if (!process.IsValid())
+return make_error("invalid process");
+
+  lldb::StateType state = process.GetState();
+  if (!lldb::SBDebugger::StateIsStoppedState(state))
+return make_error();
+
+  llvm::DenseSet old_thread_ids;
+  old_thread_ids.swap(dap.thread_ids);
+  uint32_t stop_id = on_entry ? 0 : process.GetStopID();

ashgti wrote:

In `CreateThreadStopped` we check if the `stop_id` is '0' for marking that as 
the 'entry' stop reason (e.g. the app launched).

I could use `LLDB_INVALID_STOP_ID` but that feels a little off, since this 
isn't invalid per-say just.

Maybe to make it more clear, I'll pass `on_entry` to the `CreateThreadStopped` 
helper instead.

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


[Lldb-commits] [lldb] [lldb-dap] Migrating 'threads' request to structured types. (PR #142510)

2025-06-04 Thread John Harrison via lldb-commits

https://github.com/ashgti updated 
https://github.com/llvm/llvm-project/pull/142510

>From 2fd86de03cbb207420ee45334639f82d19dbbc28 Mon Sep 17 00:00:00 2001
From: John Harrison 
Date: Mon, 2 Jun 2025 18:07:52 -0700
Subject: [PATCH 1/3] [lldb-dap] Migrating 'threads' request to structured
 types.

Moving `threads` request to structured types. Adding helper types for this and 
moving helpers from JSONUtils to ProtocolUtils.
---
 .../test/tools/lldb-dap/dap_server.py |   4 +-
 .../tools/lldb-dap/threads/TestDAP_threads.py |   2 +-
 lldb/tools/lldb-dap/DAP.h |   2 +-
 lldb/tools/lldb-dap/EventHelper.cpp   | 132 +-
 lldb/tools/lldb-dap/EventHelper.h |   2 +-
 .../ConfigurationDoneRequestHandler.cpp   |   3 +-
 lldb/tools/lldb-dap/Handler/RequestHandler.h  |   9 +-
 .../Handler/RestartRequestHandler.cpp |   2 +-
 .../Handler/ThreadsRequestHandler.cpp |  75 +++---
 lldb/tools/lldb-dap/JSONUtils.cpp |  64 -
 lldb/tools/lldb-dap/JSONUtils.h   |  24 
 .../lldb-dap/Protocol/ProtocolRequests.cpp| 118 +++-
 .../lldb-dap/Protocol/ProtocolRequests.h  |  10 ++
 .../tools/lldb-dap/Protocol/ProtocolTypes.cpp |   9 ++
 lldb/tools/lldb-dap/Protocol/ProtocolTypes.h  |  10 ++
 lldb/tools/lldb-dap/ProtocolUtils.cpp |  50 +++
 lldb/tools/lldb-dap/ProtocolUtils.h   |  26 
 17 files changed, 258 insertions(+), 284 deletions(-)

diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
index 6b41aef2bb5b8..71bae5c4ea035 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
@@ -308,7 +308,6 @@ def _handle_recv_packet(self, packet: 
Optional[ProtocolMessage]) -> bool:
 return keepGoing
 
 def _process_continued(self, all_threads_continued: bool):
-self.threads = None
 self.frame_scopes = {}
 if all_threads_continued:
 self.thread_stop_reasons = {}
@@ -1180,6 +1179,9 @@ def request_threads(self):
 with information about all threads"""
 command_dict = {"command": "threads", "type": "request", "arguments": 
{}}
 response = self.send_recv(command_dict)
+if not response["success"]:
+self.threads = None
+return response
 body = response["body"]
 # Fill in "self.threads" correctly so that clients that call
 # self.get_threads() or self.get_thread_id(...) can get information
diff --git a/lldb/test/API/tools/lldb-dap/threads/TestDAP_threads.py 
b/lldb/test/API/tools/lldb-dap/threads/TestDAP_threads.py
index acd6108853787..15bae3cc83daf 100644
--- a/lldb/test/API/tools/lldb-dap/threads/TestDAP_threads.py
+++ b/lldb/test/API/tools/lldb-dap/threads/TestDAP_threads.py
@@ -33,7 +33,7 @@ def test_correct_thread(self):
 self.dap_server.request_continue()
 stopped_event = self.dap_server.wait_for_stopped()
 # Verify that the description is the relevant breakpoint,
-# preserveFocusHint is False and threadCausedFocus is True
+# preserveFocusHint is False.
 self.assertTrue(
 stopped_event[0]["body"]["description"].startswith(
 "breakpoint %s." % breakpoint_ids[0]
diff --git a/lldb/tools/lldb-dap/DAP.h b/lldb/tools/lldb-dap/DAP.h
index 1bd94fab402ca..0bde0ba0c9830 100644
--- a/lldb/tools/lldb-dap/DAP.h
+++ b/lldb/tools/lldb-dap/DAP.h
@@ -152,7 +152,7 @@ struct DAP {
   llvm::DenseSet clientFeatures;
 
   /// The initial thread list upon attaching.
-  std::optional initial_thread_list;
+  std::optional> initial_thread_list;
 
   /// Keep track of all the modules our client knows about: either through the
   /// modules request or the module events.
diff --git a/lldb/tools/lldb-dap/EventHelper.cpp 
b/lldb/tools/lldb-dap/EventHelper.cpp
index c698084836e2f..6b5274ea8997b 100644
--- a/lldb/tools/lldb-dap/EventHelper.cpp
+++ b/lldb/tools/lldb-dap/EventHelper.cpp
@@ -116,77 +116,79 @@ void SendProcessEvent(DAP &dap, LaunchMethod 
launch_method) {
 
 // Send a thread stopped event for all threads as long as the process
 // is stopped.
-void SendThreadStoppedEvent(DAP &dap) {
+void SendThreadStoppedEvent(DAP &dap, bool on_entry) {
   lldb::SBProcess process = dap.target.GetProcess();
-  if (process.IsValid()) {
-auto state = process.GetState();
-if (state == lldb::eStateStopped) {
-  llvm::DenseSet old_thread_ids;
-  old_thread_ids.swap(dap.thread_ids);
-  uint32_t stop_id = process.GetStopID();
-  const uint32_t num_threads = process.GetNumThreads();
-
-  // First make a pass through the threads to see if the focused thread
-  // has a stop reason. In case the focus thread doesn't have a stop
-  // reason, remember the first thread that has a stop reason so we can
-  // set it 

[Lldb-commits] [lldb] [lldb] Remove USE_ALLOCATE_MEMORY_CACHE (PR #142689)

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

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


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


[Lldb-commits] [lldb] [lldb][RPC] Upstream LLDB to RPC converstion Python script (PR #138028)

2025-06-04 Thread Chelsea Cassanova via lldb-commits

https://github.com/chelcassanova updated 
https://github.com/llvm/llvm-project/pull/138028

>From 4f818cc2d9933a21adb845f9e020dd3fd1177b13 Mon Sep 17 00:00:00 2001
From: Chelsea Cassanova 
Date: Wed, 30 Apr 2025 13:37:15 -0700
Subject: [PATCH] [lldb][RPC] Upstream LLDB to RPC converstion Python script

As part of upstreaming LLDB RPC, this commit adds a python script that
is used by LLDB RPC to modify the public lldb header files for use with
RPC.

https://discourse.llvm.org/t/rfc-upstreaming-lldb-rpc/85804
---
 .../convert-lldb-header-to-rpc-header.py  | 107 ++
 .../TestConvertScript/CheckLLDBDefines.test   |  22 
 .../CheckLLDBEnumerations.test|  17 +++
 .../TestConvertScript/CheckLLDBTypes.test |  24 
 .../TestConvertScript/CheckSBDefines.test |  22 
 .../TestConvertScript/Inputs/SBDefines.h  |  22 
 .../TestConvertScript/Inputs/lldb-defines.h   |  23 
 .../Inputs/lldb-enumerations.h|  17 +++
 .../TestConvertScript/Inputs/lldb-types.h |  23 
 9 files changed, 277 insertions(+)
 create mode 100755 lldb/scripts/convert-lldb-header-to-rpc-header.py
 create mode 100644 
lldb/test/Shell/RPC/Scripts/TestConvertScript/CheckLLDBDefines.test
 create mode 100644 
lldb/test/Shell/RPC/Scripts/TestConvertScript/CheckLLDBEnumerations.test
 create mode 100644 
lldb/test/Shell/RPC/Scripts/TestConvertScript/CheckLLDBTypes.test
 create mode 100644 
lldb/test/Shell/RPC/Scripts/TestConvertScript/CheckSBDefines.test
 create mode 100644 
lldb/test/Shell/RPC/Scripts/TestConvertScript/Inputs/SBDefines.h
 create mode 100644 
lldb/test/Shell/RPC/Scripts/TestConvertScript/Inputs/lldb-defines.h
 create mode 100644 
lldb/test/Shell/RPC/Scripts/TestConvertScript/Inputs/lldb-enumerations.h
 create mode 100644 
lldb/test/Shell/RPC/Scripts/TestConvertScript/Inputs/lldb-types.h

diff --git a/lldb/scripts/convert-lldb-header-to-rpc-header.py 
b/lldb/scripts/convert-lldb-header-to-rpc-header.py
new file mode 100755
index 0..a50e8d214cc36
--- /dev/null
+++ b/lldb/scripts/convert-lldb-header-to-rpc-header.py
@@ -0,0 +1,107 @@
+#!/usr/bin/env python3
+"""
+Usage: convert-lldb-header-to-rpc-header.py  

+
+This scripts takes common LLDB headers (such as lldb-defines.h) and replaces 
references to LLDB
+with those for RPC. This happens for:
+- namespace definitions
+- namespace usage
+- version string macros
+- ifdef/ifndef lines
+"""
+
+import argparse
+import os
+import re
+
+
+INCLUDES_TO_REMOVE_REGEX = re.compile(
+r'#include "lldb/lldb-forward.h"|#include "lldb/lldb-versioning.h"'
+)
+LLDB_GUARD_REGEX = re.compile(r"(?P#.+)LLDB_LLDB_\s*", re.M)
+LLDB_API_GUARD_REGEX = re.compile(r"(?P#.+)LLDB_API_\s*", re.M)
+LLDB_VERSION_REGEX = re.compile(r"#define LLDB_VERSION", re.M)
+LLDB_REVISION_REGEX = re.compile(r"#define LLDB_REVISION", re.M)
+LLDB_VERSION_STRING_REGEX = re.compile(r"#define LLDB_VERSION_STRING", re.M)
+LLDB_LOCAL_INCLUDE_REGEX = re.compile(r'#include "lldb/lldb-\s*', re.M)
+LLDB_NAMESPACE_DEFINITION_REGEX = re.compile(
+r"(?P//\s*){,1}namespace lldb\s{1}", re.M
+)
+LLDB_NAMESPACE_REGEX = re.compile(r"\s*.+lldb::\s*", re.M)
+
+
+def main():
+parser = argparse.ArgumentParser()
+parser.add_argument("input")
+parser.add_argument("output")
+args = parser.parse_args()
+input_path = str(args.input)
+output_path = str(args.output)
+with open(input_path, "r") as input_file:
+lines = input_file.readlines()
+file_buffer = "".join(lines)
+
+with open(output_path, "w") as output_file:
+# NOTE: We do not use lldb-forward.h or lldb-versioning.h in RPC, so 
remove
+# all includes that are found for these files.
+file_buffer = re.sub(INCLUDES_TO_REMOVE_REGEX, r"", file_buffer)
+
+# For lldb-rpc-defines.h, replace the ifndef LLDB_LLDB_ portion with 
LLDB_RPC_ as we're not
+# using LLDB private definitions in RPC.
+lldb_guard_matches = LLDB_GUARD_REGEX.finditer(file_buffer)
+for match in lldb_guard_matches:
+file_buffer = re.sub(
+match.group(),
+r"{0}LLDB_RPC_".format(match.group("guard_type")),
+file_buffer,
+)
+
+# Similarly to lldb-rpc-defines.h, replace the ifndef for LLDB_API in 
SBDefines.h to LLDB_RPC_API_ for the same reason.
+lldb_api_guard_matches = LLDB_API_GUARD_REGEX.finditer(file_buffer)
+for match in lldb_api_guard_matches:
+file_buffer = re.sub(
+match.group(),
+r"{0}LLDB_RPC_API_".format(match.group("guard_type")),
+file_buffer,
+)
+
+# Replace the references for the macros that define the versioning 
strings in
+# lldb-rpc-defines.h.
+# NOTE: Here we assume that the versioning info has already been 
uncommented and
+# populated from the original lldb-defines.h.
+file_buffer = re.sub(
+LLDB_VERSION_R

[Lldb-commits] [lldb] [lldb] Set default object format to `MachO` in `ObjectFileMachO` (PR #142704)

2025-06-04 Thread David Peixotto via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Set default object format to `MachO` in `ObjectFileMachO` (PR #142704)

2025-06-04 Thread David Peixotto via lldb-commits

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

LGTM with one nit.

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


[Lldb-commits] [lldb] [lldb] Set default object format to `MachO` in `ObjectFileMachO` (PR #142704)

2025-06-04 Thread David Peixotto via lldb-commits


@@ -94,4 +94,59 @@ TEST_F(ObjectFileMachOTest, IndirectSymbolsInTheSharedCache) 
{
   for (size_t i = 0; i < 10; i++)
 OF->ParseSymtab(symtab);
 }
+
+TEST_F(ObjectFileMachOTest, ObjectFileFormatWithoutLoadCommand) {

dmpots wrote:

The test name is a bit misleading because there is a load command 
(LC_SEGMENT_64). I suggest we either remove that load command to make the name 
match or change it to something like `ObjectFileFormatWithoutVersionLoadCommand`

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


[Lldb-commits] [lldb] [lldb][RPC] Upstream LLDB to RPC converstion Python script (PR #138028)

2025-06-04 Thread via lldb-commits

github-actions[bot] wrote:




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



You can test this locally with the following command:


``bash
darker --check --diff -r HEAD~1...HEAD 
lldb/scripts/convert-lldb-header-to-rpc-header.py
``





View the diff from darker here.


``diff
--- convert-lldb-header-to-rpc-header.py2025-06-04 16:23:57.00 +
+++ convert-lldb-header-to-rpc-header.py2025-06-04 16:26:42.071029 +
@@ -101,7 +101,8 @@
 # Rename the lldb namespace definition to lldb-rpc.
 file_buffer = re.sub(LLDB_NAMESPACE_REGEX, r"lldb_rpc::", file_buffer)
 
 output_file.write(file_buffer)
 
+
 if __name__ == "__main__":
 main()

``




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


[Lldb-commits] [lldb] [lldb] Set default object format to `MachO` in `ObjectFileMachO` (PR #142704)

2025-06-04 Thread via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Set default object format to `MachO` in `ObjectFileMachO` (PR #142704)

2025-06-04 Thread via lldb-commits

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


[Lldb-commits] [lldb] [lldb][RPC] Upstream LLDB to RPC converstion Python script (PR #138028)

2025-06-04 Thread Chelsea Cassanova via lldb-commits

https://github.com/chelcassanova updated 
https://github.com/llvm/llvm-project/pull/138028

>From ba96f130307617d150fad215025509835cbca4f0 Mon Sep 17 00:00:00 2001
From: Chelsea Cassanova 
Date: Wed, 30 Apr 2025 13:37:15 -0700
Subject: [PATCH] [lldb][RPC] Upstream LLDB to RPC converstion Python script

As part of upstreaming LLDB RPC, this commit adds a python script that
is used by LLDB RPC to modify the public lldb header files for use with
RPC.

https://discourse.llvm.org/t/rfc-upstreaming-lldb-rpc/85804
---
 .../convert-lldb-header-to-rpc-header.py  | 108 ++
 .../TestConvertScript/CheckLLDBDefines.test   |  22 
 .../CheckLLDBEnumerations.test|  17 +++
 .../TestConvertScript/CheckLLDBTypes.test |  24 
 .../TestConvertScript/CheckSBDefines.test |  22 
 .../TestConvertScript/Inputs/SBDefines.h  |  22 
 .../TestConvertScript/Inputs/lldb-defines.h   |  23 
 .../Inputs/lldb-enumerations.h|  17 +++
 .../TestConvertScript/Inputs/lldb-types.h |  23 
 9 files changed, 278 insertions(+)
 create mode 100755 lldb/scripts/convert-lldb-header-to-rpc-header.py
 create mode 100644 
lldb/test/Shell/RPC/Scripts/TestConvertScript/CheckLLDBDefines.test
 create mode 100644 
lldb/test/Shell/RPC/Scripts/TestConvertScript/CheckLLDBEnumerations.test
 create mode 100644 
lldb/test/Shell/RPC/Scripts/TestConvertScript/CheckLLDBTypes.test
 create mode 100644 
lldb/test/Shell/RPC/Scripts/TestConvertScript/CheckSBDefines.test
 create mode 100644 
lldb/test/Shell/RPC/Scripts/TestConvertScript/Inputs/SBDefines.h
 create mode 100644 
lldb/test/Shell/RPC/Scripts/TestConvertScript/Inputs/lldb-defines.h
 create mode 100644 
lldb/test/Shell/RPC/Scripts/TestConvertScript/Inputs/lldb-enumerations.h
 create mode 100644 
lldb/test/Shell/RPC/Scripts/TestConvertScript/Inputs/lldb-types.h

diff --git a/lldb/scripts/convert-lldb-header-to-rpc-header.py 
b/lldb/scripts/convert-lldb-header-to-rpc-header.py
new file mode 100755
index 0..d7734280076ff
--- /dev/null
+++ b/lldb/scripts/convert-lldb-header-to-rpc-header.py
@@ -0,0 +1,108 @@
+#!/usr/bin/env python3
+"""
+Usage: convert-lldb-header-to-rpc-header.py  

+
+This scripts takes common LLDB headers (such as lldb-defines.h) and replaces 
references to LLDB
+with those for RPC. This happens for:
+- namespace definitions
+- namespace usage
+- version string macros
+- ifdef/ifndef lines
+"""
+
+import argparse
+import os
+import re
+
+
+INCLUDES_TO_REMOVE_REGEX = re.compile(
+r'#include "lldb/lldb-forward.h"|#include "lldb/lldb-versioning.h"'
+)
+LLDB_GUARD_REGEX = re.compile(r"(?P#.+)LLDB_LLDB_\s*", re.M)
+LLDB_API_GUARD_REGEX = re.compile(r"(?P#.+)LLDB_API_\s*", re.M)
+LLDB_VERSION_REGEX = re.compile(r"#define LLDB_VERSION", re.M)
+LLDB_REVISION_REGEX = re.compile(r"#define LLDB_REVISION", re.M)
+LLDB_VERSION_STRING_REGEX = re.compile(r"#define LLDB_VERSION_STRING", re.M)
+LLDB_LOCAL_INCLUDE_REGEX = re.compile(r'#include "lldb/lldb-\s*', re.M)
+LLDB_NAMESPACE_DEFINITION_REGEX = re.compile(
+r"(?P//\s*){,1}namespace lldb\s{1}", re.M
+)
+LLDB_NAMESPACE_REGEX = re.compile(r"\s*.+lldb::\s*", re.M)
+
+
+def main():
+parser = argparse.ArgumentParser()
+parser.add_argument("input")
+parser.add_argument("output")
+args = parser.parse_args()
+input_path = str(args.input)
+output_path = str(args.output)
+with open(input_path, "r") as input_file:
+lines = input_file.readlines()
+file_buffer = "".join(lines)
+
+with open(output_path, "w") as output_file:
+# NOTE: We do not use lldb-forward.h or lldb-versioning.h in RPC, so 
remove
+# all includes that are found for these files.
+file_buffer = re.sub(INCLUDES_TO_REMOVE_REGEX, r"", file_buffer)
+
+# For lldb-rpc-defines.h, replace the ifndef LLDB_LLDB_ portion with 
LLDB_RPC_ as we're not
+# using LLDB private definitions in RPC.
+lldb_guard_matches = LLDB_GUARD_REGEX.finditer(file_buffer)
+for match in lldb_guard_matches:
+file_buffer = re.sub(
+match.group(),
+r"{0}LLDB_RPC_".format(match.group("guard_type")),
+file_buffer,
+)
+
+# Similarly to lldb-rpc-defines.h, replace the ifndef for LLDB_API in 
SBDefines.h to LLDB_RPC_API_ for the same reason.
+lldb_api_guard_matches = LLDB_API_GUARD_REGEX.finditer(file_buffer)
+for match in lldb_api_guard_matches:
+file_buffer = re.sub(
+match.group(),
+r"{0}LLDB_RPC_API_".format(match.group("guard_type")),
+file_buffer,
+)
+
+# Replace the references for the macros that define the versioning 
strings in
+# lldb-rpc-defines.h.
+# NOTE: Here we assume that the versioning info has already been 
uncommented and
+# populated from the original lldb-defines.h.
+file_buffer = re.sub(
+LLDB_VERSION_R

[Lldb-commits] [lldb] [lldb][RPC] Upstream LLDB to RPC converstion Python script (PR #138028)

2025-06-04 Thread Chelsea Cassanova via lldb-commits

chelcassanova wrote:

> Might be worth making this match the other scripts and doing this once 
> instead of line-by-line.

Updated the patch to do this 👍🏾 


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


[Lldb-commits] [lldb] [lldb] Set default object format to `MachO` in `ObjectFileMachO` (PR #142704)

2025-06-04 Thread via lldb-commits

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


[Lldb-commits] [lldb] [lldb-dap] Migrating 'threads' request to structured types. (PR #142510)

2025-06-04 Thread John Harrison via lldb-commits

https://github.com/ashgti updated 
https://github.com/llvm/llvm-project/pull/142510

>From 2fd86de03cbb207420ee45334639f82d19dbbc28 Mon Sep 17 00:00:00 2001
From: John Harrison 
Date: Mon, 2 Jun 2025 18:07:52 -0700
Subject: [PATCH 1/4] [lldb-dap] Migrating 'threads' request to structured
 types.

Moving `threads` request to structured types. Adding helper types for this and 
moving helpers from JSONUtils to ProtocolUtils.
---
 .../test/tools/lldb-dap/dap_server.py |   4 +-
 .../tools/lldb-dap/threads/TestDAP_threads.py |   2 +-
 lldb/tools/lldb-dap/DAP.h |   2 +-
 lldb/tools/lldb-dap/EventHelper.cpp   | 132 +-
 lldb/tools/lldb-dap/EventHelper.h |   2 +-
 .../ConfigurationDoneRequestHandler.cpp   |   3 +-
 lldb/tools/lldb-dap/Handler/RequestHandler.h  |   9 +-
 .../Handler/RestartRequestHandler.cpp |   2 +-
 .../Handler/ThreadsRequestHandler.cpp |  75 +++---
 lldb/tools/lldb-dap/JSONUtils.cpp |  64 -
 lldb/tools/lldb-dap/JSONUtils.h   |  24 
 .../lldb-dap/Protocol/ProtocolRequests.cpp| 118 +++-
 .../lldb-dap/Protocol/ProtocolRequests.h  |  10 ++
 .../tools/lldb-dap/Protocol/ProtocolTypes.cpp |   9 ++
 lldb/tools/lldb-dap/Protocol/ProtocolTypes.h  |  10 ++
 lldb/tools/lldb-dap/ProtocolUtils.cpp |  50 +++
 lldb/tools/lldb-dap/ProtocolUtils.h   |  26 
 17 files changed, 258 insertions(+), 284 deletions(-)

diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
index 6b41aef2bb5b8..71bae5c4ea035 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
@@ -308,7 +308,6 @@ def _handle_recv_packet(self, packet: 
Optional[ProtocolMessage]) -> bool:
 return keepGoing
 
 def _process_continued(self, all_threads_continued: bool):
-self.threads = None
 self.frame_scopes = {}
 if all_threads_continued:
 self.thread_stop_reasons = {}
@@ -1180,6 +1179,9 @@ def request_threads(self):
 with information about all threads"""
 command_dict = {"command": "threads", "type": "request", "arguments": 
{}}
 response = self.send_recv(command_dict)
+if not response["success"]:
+self.threads = None
+return response
 body = response["body"]
 # Fill in "self.threads" correctly so that clients that call
 # self.get_threads() or self.get_thread_id(...) can get information
diff --git a/lldb/test/API/tools/lldb-dap/threads/TestDAP_threads.py 
b/lldb/test/API/tools/lldb-dap/threads/TestDAP_threads.py
index acd6108853787..15bae3cc83daf 100644
--- a/lldb/test/API/tools/lldb-dap/threads/TestDAP_threads.py
+++ b/lldb/test/API/tools/lldb-dap/threads/TestDAP_threads.py
@@ -33,7 +33,7 @@ def test_correct_thread(self):
 self.dap_server.request_continue()
 stopped_event = self.dap_server.wait_for_stopped()
 # Verify that the description is the relevant breakpoint,
-# preserveFocusHint is False and threadCausedFocus is True
+# preserveFocusHint is False.
 self.assertTrue(
 stopped_event[0]["body"]["description"].startswith(
 "breakpoint %s." % breakpoint_ids[0]
diff --git a/lldb/tools/lldb-dap/DAP.h b/lldb/tools/lldb-dap/DAP.h
index 1bd94fab402ca..0bde0ba0c9830 100644
--- a/lldb/tools/lldb-dap/DAP.h
+++ b/lldb/tools/lldb-dap/DAP.h
@@ -152,7 +152,7 @@ struct DAP {
   llvm::DenseSet clientFeatures;
 
   /// The initial thread list upon attaching.
-  std::optional initial_thread_list;
+  std::optional> initial_thread_list;
 
   /// Keep track of all the modules our client knows about: either through the
   /// modules request or the module events.
diff --git a/lldb/tools/lldb-dap/EventHelper.cpp 
b/lldb/tools/lldb-dap/EventHelper.cpp
index c698084836e2f..6b5274ea8997b 100644
--- a/lldb/tools/lldb-dap/EventHelper.cpp
+++ b/lldb/tools/lldb-dap/EventHelper.cpp
@@ -116,77 +116,79 @@ void SendProcessEvent(DAP &dap, LaunchMethod 
launch_method) {
 
 // Send a thread stopped event for all threads as long as the process
 // is stopped.
-void SendThreadStoppedEvent(DAP &dap) {
+void SendThreadStoppedEvent(DAP &dap, bool on_entry) {
   lldb::SBProcess process = dap.target.GetProcess();
-  if (process.IsValid()) {
-auto state = process.GetState();
-if (state == lldb::eStateStopped) {
-  llvm::DenseSet old_thread_ids;
-  old_thread_ids.swap(dap.thread_ids);
-  uint32_t stop_id = process.GetStopID();
-  const uint32_t num_threads = process.GetNumThreads();
-
-  // First make a pass through the threads to see if the focused thread
-  // has a stop reason. In case the focus thread doesn't have a stop
-  // reason, remember the first thread that has a stop reason so we can
-  // set it 

[Lldb-commits] [lldb] [lldb] Revive TestSimulatorPlatform.py (PR #142244)

2025-06-04 Thread Adrian Prantl via lldb-commits


@@ -56,11 +56,14 @@ def run_with(self, arch, os, vers, env, 
expected_load_command):
 sdk_root = lldbutil.get_xcode_sdk_root(sdk)
 clang = lldbutil.get_xcode_clang(sdk)
 
+print(triple)

adrian-prantl wrote:

```suggestion
 if self.TraceOn():
print(triple)
```

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


[Lldb-commits] [lldb] [lldb-dap] Migrating 'threads' request to structured types. (PR #142510)

2025-06-04 Thread John Harrison via lldb-commits


@@ -110,4 +116,48 @@ std::string GetLoadAddressString(const lldb::addr_t addr) {
   return "0x" + llvm::utohexstr(addr, false, 16);
 }
 
+protocol::Thread CreateThread(lldb::SBThread &thread, lldb::SBFormat &format) {
+  std::string name;
+  lldb::SBStream stream;
+  if (format && thread.GetDescriptionWithFormat(format, stream).Success()) {
+name = stream.GetData();
+  } else {
+llvm::StringRef thread_name(thread.GetName());
+llvm::StringRef queue_name(thread.GetQueueName());
+
+if (!thread_name.empty()) {
+  name = thread_name.str();
+} else if (!queue_name.empty()) {
+  auto kind = thread.GetQueue().GetKind();
+  std::string queue_kind_label = "";
+  if (kind == lldb::eQueueKindSerial) {
+queue_kind_label = " (serial)";
+  } else if (kind == lldb::eQueueKindConcurrent) {
+queue_kind_label = " (concurrent)";
+  }
+
+  name = llvm::formatv("Thread {0} Queue: {1}{2}", thread.GetIndexID(),
+   queue_name, queue_kind_label)
+ .str();
+} else {
+  name = llvm::formatv("Thread {0}", thread.GetIndexID()).str();
+}
+  }
+  return protocol::Thread{thread.GetThreadID(), name};
+}
+
+std::vector GetThreads(lldb::SBProcess process,
+ lldb::SBFormat &format) {
+  lldb::SBMutex lock = process.GetTarget().GetAPIMutex();
+  std::lock_guard guard(lock);
+
+  std::vector threads;

ashgti wrote:

Done.

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


[Lldb-commits] [lldb] [lldb] Revive TestSimulatorPlatform.py (PR #142244)

2025-06-04 Thread via lldb-commits

royitaqi wrote:

FWIW, the tvOS tests fails on my macOS machine with the following error ([full 
log](https://pastebin.com/3gDZU0Xb)):
> AssertionError: No value is not true : Could not create a valid process for 
> a.out: no valid simulator instance

I think this is because I don't have the "tvOS" component installed in Xcode 
(hence no tvOS simulator).

If this is indeed the root cause, then it seems to me the test should skip by 
observing the unavailability of the tvOS simulator. LMK if that makes sense.


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


[Lldb-commits] [lldb] [lldb-dap] Migrating 'threads' request to structured types. (PR #142510)

2025-06-04 Thread John Harrison via lldb-commits


@@ -116,78 +119,78 @@ void SendProcessEvent(DAP &dap, LaunchMethod 
launch_method) {
 
 // Send a thread stopped event for all threads as long as the process
 // is stopped.
-void SendThreadStoppedEvent(DAP &dap) {
+llvm::Error SendThreadStoppedEvent(DAP &dap, bool on_entry) {
+  lldb::SBMutex lock = dap.GetAPIMutex();
+  std::lock_guard guard(lock);
+
   lldb::SBProcess process = dap.target.GetProcess();
-  if (process.IsValid()) {
-auto state = process.GetState();
-if (state == lldb::eStateStopped) {
-  llvm::DenseSet old_thread_ids;
-  old_thread_ids.swap(dap.thread_ids);
-  uint32_t stop_id = process.GetStopID();
-  const uint32_t num_threads = process.GetNumThreads();
-
-  // First make a pass through the threads to see if the focused thread
-  // has a stop reason. In case the focus thread doesn't have a stop
-  // reason, remember the first thread that has a stop reason so we can
-  // set it as the focus thread if below if needed.
-  lldb::tid_t first_tid_with_reason = LLDB_INVALID_THREAD_ID;
-  uint32_t num_threads_with_reason = 0;
-  bool focus_thread_exists = false;
-  for (uint32_t thread_idx = 0; thread_idx < num_threads; ++thread_idx) {
-lldb::SBThread thread = process.GetThreadAtIndex(thread_idx);
-const lldb::tid_t tid = thread.GetThreadID();
-const bool has_reason = ThreadHasStopReason(thread);
-// If the focus thread doesn't have a stop reason, clear the thread ID
-if (tid == dap.focus_tid) {
-  focus_thread_exists = true;
-  if (!has_reason)
-dap.focus_tid = LLDB_INVALID_THREAD_ID;
-}
-if (has_reason) {
-  ++num_threads_with_reason;
-  if (first_tid_with_reason == LLDB_INVALID_THREAD_ID)
-first_tid_with_reason = tid;
-}
-  }
+  if (!process.IsValid())
+return make_error("invalid process");
+
+  lldb::StateType state = process.GetState();
+  if (!lldb::SBDebugger::StateIsStoppedState(state))
+return make_error();
+
+  llvm::DenseSet old_thread_ids;
+  old_thread_ids.swap(dap.thread_ids);
+  uint32_t stop_id = on_entry ? 0 : process.GetStopID();

ashgti wrote:

Instead, I'll follow up with a new PR that migrates the 'stopped' event to a 
protocol type and update this then.

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


[Lldb-commits] [lldb] [lldb] Revive TestSimulatorPlatform.py (PR #142244)

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


@@ -56,11 +56,14 @@ def run_with(self, arch, os, vers, env, 
expected_load_command):
 sdk_root = lldbutil.get_xcode_sdk_root(sdk)
 clang = lldbutil.get_xcode_clang(sdk)
 
+print(triple)

JDevlieghere wrote:

This can go altogether, this was a leftover debug statement and not 
particularly helpful in general.

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


[Lldb-commits] [lldb] [llvm] [NFC] Separate high-level-dependent portions of DWARFExpression (PR #139175)

2025-06-04 Thread via lldb-commits

Sterling-Augustine wrote:

Anyone?

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


[Lldb-commits] [lldb] [lldb] Provide TrackingOutputBufferDeleter for custom unique_ptr deleter (PR #142815)

2025-06-04 Thread Jordan Rupprecht via lldb-commits

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

Suggested in #142676 as a way to automatically free the buffer in tests

>From 14a5860c98b5c0c067c8b12ccbaf32bfa45b1a66 Mon Sep 17 00:00:00 2001
From: Jordan Rupprecht 
Date: Wed, 4 Jun 2025 09:53:12 -0700
Subject: [PATCH 1/2] [lldb] Provide TrackingOutputBufferDeleter for custom
 unique_ptr deleter

---
 lldb/include/lldb/Core/DemangledNameInfo.h | 10 +++
 lldb/unittests/Core/MangledTest.cpp| 72 +++---
 2 files changed, 46 insertions(+), 36 deletions(-)

diff --git a/lldb/include/lldb/Core/DemangledNameInfo.h 
b/lldb/include/lldb/Core/DemangledNameInfo.h
index 4b5ba5e42b3b1..8d730efbc44d8 100644
--- a/lldb/include/lldb/Core/DemangledNameInfo.h
+++ b/lldb/include/lldb/Core/DemangledNameInfo.h
@@ -13,6 +13,7 @@
 #include "llvm/Demangle/Utility.h"
 
 #include 
+#include 
 #include 
 
 namespace lldb_private {
@@ -159,4 +160,13 @@ struct TrackingOutputBuffer : public 
llvm::itanium_demangle::OutputBuffer {
 };
 } // namespace lldb_private
 
+struct TrackingOutputBufferDeleter {
+  void operator()(TrackingOutputBuffer *TOB) {
+if (!TOB)
+  return;
+std::free(TOB->getBuffer());
+delete TOB;
+  }
+};
+
 #endif // LLDB_CORE_DEMANGLEDNAMEINFO_H
diff --git a/lldb/unittests/Core/MangledTest.cpp 
b/lldb/unittests/Core/MangledTest.cpp
index e9dfd05459642..42e732b79dedf 100644
--- a/lldb/unittests/Core/MangledTest.cpp
+++ b/lldb/unittests/Core/MangledTest.cpp
@@ -26,6 +26,8 @@
 
 #include "gtest/gtest.h"
 
+#include 
+
 using namespace lldb;
 using namespace lldb_private;
 
@@ -589,25 +591,25 @@ TEST_P(DemanglingPartsTestFixture, DemanglingParts) {
 
   ASSERT_NE(nullptr, Root);
 
-  TrackingOutputBuffer OB;
-  Root->print(OB);
-  auto demangled = std::string_view(OB);
+  auto OB = std::unique_ptr(
+  new TrackingOutputBuffer());
+  Root->print(*OB);
+  auto demangled = std::string_view(*OB);
 
-  ASSERT_EQ(OB.NameInfo.hasBasename(), valid_basename);
+  ASSERT_EQ(OB->NameInfo.hasBasename(), valid_basename);
 
-  EXPECT_EQ(OB.NameInfo.BasenameRange, info.BasenameRange);
-  EXPECT_EQ(OB.NameInfo.ScopeRange, info.ScopeRange);
-  EXPECT_EQ(OB.NameInfo.ArgumentsRange, info.ArgumentsRange);
-  EXPECT_EQ(OB.NameInfo.QualifiersRange, info.QualifiersRange);
+  EXPECT_EQ(OB->NameInfo.BasenameRange, info.BasenameRange);
+  EXPECT_EQ(OB->NameInfo.ScopeRange, info.ScopeRange);
+  EXPECT_EQ(OB->NameInfo.ArgumentsRange, info.ArgumentsRange);
+  EXPECT_EQ(OB->NameInfo.QualifiersRange, info.QualifiersRange);
 
   auto get_part = [&](const std::pair &loc) {
 return demangled.substr(loc.first, loc.second - loc.first);
   };
 
-  EXPECT_EQ(get_part(OB.NameInfo.BasenameRange), basename);
-  EXPECT_EQ(get_part(OB.NameInfo.ScopeRange), scope);
-  EXPECT_EQ(get_part(OB.NameInfo.QualifiersRange), qualifiers);
-  std::free(OB.getBuffer());
+  EXPECT_EQ(get_part(OB->NameInfo.BasenameRange), basename);
+  EXPECT_EQ(get_part(OB->NameInfo.ScopeRange), scope);
+  EXPECT_EQ(get_part(OB->NameInfo.QualifiersRange), qualifiers);
 }
 
 INSTANTIATE_TEST_SUITE_P(DemanglingPartsTests, DemanglingPartsTestFixture,
@@ -635,36 +637,35 @@ TEST_P(DemanglingInfoCorrectnessTestFixutre, Correctness) 
{
 
   ASSERT_NE(nullptr, Root);
 
-  TrackingOutputBuffer OB;
-  Root->print(OB);
+  auto OB = std::unique_ptr(
+  new TrackingOutputBuffer());
+  Root->print(*OB);
 
   // Filter out cases which would never show up in frames. We only care about
   // function names.
   if (Root->getKind() !=
   llvm::itanium_demangle::Node::Kind::KFunctionEncoding &&
-  Root->getKind() != llvm::itanium_demangle::Node::Kind::KDotSuffix) {
-std::free(OB.getBuffer());
+  Root->getKind() != llvm::itanium_demangle::Node::Kind::KDotSuffix)
 return;
-  }
 
-  ASSERT_TRUE(OB.NameInfo.hasBasename());
-
-  auto tracked_name = llvm::StringRef(OB);
-
-  auto return_left = tracked_name.slice(0, OB.NameInfo.ScopeRange.first);
-  auto scope = tracked_name.slice(OB.NameInfo.ScopeRange.first,
-  OB.NameInfo.ScopeRange.second);
-  auto basename = tracked_name.slice(OB.NameInfo.BasenameRange.first,
- OB.NameInfo.BasenameRange.second);
-  auto template_args = tracked_name.slice(OB.NameInfo.BasenameRange.second,
-  OB.NameInfo.ArgumentsRange.first);
-  auto args = tracked_name.slice(OB.NameInfo.ArgumentsRange.first,
- OB.NameInfo.ArgumentsRange.second);
-  auto return_right = tracked_name.slice(OB.NameInfo.ArgumentsRange.second,
- OB.NameInfo.QualifiersRange.first);
-  auto qualifiers = tracked_name.slice(OB.NameInfo.QualifiersRange.first,
-   OB.NameInfo.QualifiersRange.second);
-  auto suffix = tracked_name.slice(OB.NameInfo.QualifiersRange.second,
+  ASSERT_TRUE(OB->NameInfo.hasBasename());
+
+  auto tracked_name = llvm::StringR

[Lldb-commits] [lldb] [lldb] Revive TestSimulatorPlatform.py (PR #142244)

2025-06-04 Thread Adrian Prantl via lldb-commits


@@ -198,7 +202,7 @@ def test_ios_backdeploy_apple_silicon(self):
 self.run_with(
 arch=self.getArchitecture(),
 os="ios",
-vers="11.0",
+vers="14.0",

adrian-prantl wrote:

Ah, but that's the arm64 test, so this is fine!

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


[Lldb-commits] [lldb] [lldb] Revive TestSimulatorPlatform.py (PR #142244)

2025-06-04 Thread Adrian Prantl via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb][test] Free buffers in demangling tests to avoid leaks (PR #142676)

2025-06-04 Thread Jordan Rupprecht via lldb-commits

rupprecht wrote:

> LGTM. Maybe an opportunity to use a unique_ptr with a custom deleter? 
> Something like:
> 
> ```
> struct TrackingOutputBufferDeleter {
>   void operator()(TrackingOutputBuffer* TOB) {
> if (!TOB)
>   return;
> std::free(TOB->getBuffer());
> std::free(TOB);
>   }
> };
> ```

Sent #142815. The suggestion is almost perfect. The buffer can be free'd, but 
TOB must be deleted, otherwise there's a mismatch: `alloc-dealloc-mismatch 
(operator new vs free)`.

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


[Lldb-commits] [lldb] [lldb] Revive TestSimulatorPlatform.py (PR #142244)

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


@@ -198,7 +202,7 @@ def test_ios_backdeploy_apple_silicon(self):
 self.run_with(
 arch=self.getArchitecture(),
 os="ios",
-vers="11.0",
+vers="14.0",

JDevlieghere wrote:

I kept 11.0 for the non-Apple Silicon test. On AS it's not possible to test 
this as the linker automatically upgrades to the first supported AS version 
(14.0)

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


[Lldb-commits] [lldb] [lldb] Revive TestSimulatorPlatform.py (PR #142244)

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

JDevlieghere wrote:

> If this is indeed the root cause, then it seems to me the test should skip by 
> observing the unavailability of the tvOS simulator. LMK if that makes sense.

Yes, `TestAppleSimulatorOSType` seems to be doing this correctly but we should 
have the same logic here. I'll see if we can hoist it up. 

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


[Lldb-commits] [lldb] [lldb] Provide TrackingOutputBufferDeleter for custom unique_ptr deleter (PR #142815)

2025-06-04 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jordan Rupprecht (rupprecht)


Changes

Suggested in #142676 as a way to automatically free the buffer in tests

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


2 Files Affected:

- (modified) lldb/include/lldb/Core/DemangledNameInfo.h (+20) 
- (modified) lldb/unittests/Core/MangledTest.cpp (+36-36) 


``diff
diff --git a/lldb/include/lldb/Core/DemangledNameInfo.h 
b/lldb/include/lldb/Core/DemangledNameInfo.h
index 4b5ba5e42b3b1..a3edb3e034eb1 100644
--- a/lldb/include/lldb/Core/DemangledNameInfo.h
+++ b/lldb/include/lldb/Core/DemangledNameInfo.h
@@ -13,6 +13,7 @@
 #include "llvm/Demangle/Utility.h"
 
 #include 
+#include 
 #include 
 
 namespace lldb_private {
@@ -159,4 +160,23 @@ struct TrackingOutputBuffer : public 
llvm::itanium_demangle::OutputBuffer {
 };
 } // namespace lldb_private
 
+/// Custom deleter to use with unique_ptr.
+///
+/// Usage:
+/// \code{.cpp}
+///
+/// auto OB =
+/// std::unique_ptr(
+/// new TrackingOutputBuffer());
+///
+/// \endcode
+struct TrackingOutputBufferDeleter {
+  void operator()(TrackingOutputBuffer *TOB) {
+if (!TOB)
+  return;
+std::free(TOB->getBuffer());
+delete TOB;
+  }
+};
+
 #endif // LLDB_CORE_DEMANGLEDNAMEINFO_H
diff --git a/lldb/unittests/Core/MangledTest.cpp 
b/lldb/unittests/Core/MangledTest.cpp
index e9dfd05459642..42e732b79dedf 100644
--- a/lldb/unittests/Core/MangledTest.cpp
+++ b/lldb/unittests/Core/MangledTest.cpp
@@ -26,6 +26,8 @@
 
 #include "gtest/gtest.h"
 
+#include 
+
 using namespace lldb;
 using namespace lldb_private;
 
@@ -589,25 +591,25 @@ TEST_P(DemanglingPartsTestFixture, DemanglingParts) {
 
   ASSERT_NE(nullptr, Root);
 
-  TrackingOutputBuffer OB;
-  Root->print(OB);
-  auto demangled = std::string_view(OB);
+  auto OB = std::unique_ptr(
+  new TrackingOutputBuffer());
+  Root->print(*OB);
+  auto demangled = std::string_view(*OB);
 
-  ASSERT_EQ(OB.NameInfo.hasBasename(), valid_basename);
+  ASSERT_EQ(OB->NameInfo.hasBasename(), valid_basename);
 
-  EXPECT_EQ(OB.NameInfo.BasenameRange, info.BasenameRange);
-  EXPECT_EQ(OB.NameInfo.ScopeRange, info.ScopeRange);
-  EXPECT_EQ(OB.NameInfo.ArgumentsRange, info.ArgumentsRange);
-  EXPECT_EQ(OB.NameInfo.QualifiersRange, info.QualifiersRange);
+  EXPECT_EQ(OB->NameInfo.BasenameRange, info.BasenameRange);
+  EXPECT_EQ(OB->NameInfo.ScopeRange, info.ScopeRange);
+  EXPECT_EQ(OB->NameInfo.ArgumentsRange, info.ArgumentsRange);
+  EXPECT_EQ(OB->NameInfo.QualifiersRange, info.QualifiersRange);
 
   auto get_part = [&](const std::pair &loc) {
 return demangled.substr(loc.first, loc.second - loc.first);
   };
 
-  EXPECT_EQ(get_part(OB.NameInfo.BasenameRange), basename);
-  EXPECT_EQ(get_part(OB.NameInfo.ScopeRange), scope);
-  EXPECT_EQ(get_part(OB.NameInfo.QualifiersRange), qualifiers);
-  std::free(OB.getBuffer());
+  EXPECT_EQ(get_part(OB->NameInfo.BasenameRange), basename);
+  EXPECT_EQ(get_part(OB->NameInfo.ScopeRange), scope);
+  EXPECT_EQ(get_part(OB->NameInfo.QualifiersRange), qualifiers);
 }
 
 INSTANTIATE_TEST_SUITE_P(DemanglingPartsTests, DemanglingPartsTestFixture,
@@ -635,36 +637,35 @@ TEST_P(DemanglingInfoCorrectnessTestFixutre, Correctness) 
{
 
   ASSERT_NE(nullptr, Root);
 
-  TrackingOutputBuffer OB;
-  Root->print(OB);
+  auto OB = std::unique_ptr(
+  new TrackingOutputBuffer());
+  Root->print(*OB);
 
   // Filter out cases which would never show up in frames. We only care about
   // function names.
   if (Root->getKind() !=
   llvm::itanium_demangle::Node::Kind::KFunctionEncoding &&
-  Root->getKind() != llvm::itanium_demangle::Node::Kind::KDotSuffix) {
-std::free(OB.getBuffer());
+  Root->getKind() != llvm::itanium_demangle::Node::Kind::KDotSuffix)
 return;
-  }
 
-  ASSERT_TRUE(OB.NameInfo.hasBasename());
-
-  auto tracked_name = llvm::StringRef(OB);
-
-  auto return_left = tracked_name.slice(0, OB.NameInfo.ScopeRange.first);
-  auto scope = tracked_name.slice(OB.NameInfo.ScopeRange.first,
-  OB.NameInfo.ScopeRange.second);
-  auto basename = tracked_name.slice(OB.NameInfo.BasenameRange.first,
- OB.NameInfo.BasenameRange.second);
-  auto template_args = tracked_name.slice(OB.NameInfo.BasenameRange.second,
-  OB.NameInfo.ArgumentsRange.first);
-  auto args = tracked_name.slice(OB.NameInfo.ArgumentsRange.first,
- OB.NameInfo.ArgumentsRange.second);
-  auto return_right = tracked_name.slice(OB.NameInfo.ArgumentsRange.second,
- OB.NameInfo.QualifiersRange.first);
-  auto qualifiers = tracked_name.slice(OB.NameInfo.QualifiersRange.first,
-   OB.NameInfo.QualifiersRange.second);
-  auto suffix = tracked_name.slice(OB.NameInfo.QualifiersRange.second,
+  ASSERT_TRUE(OB->NameInfo.hasBasename());
+
+  auto tracked_name = llvm

[Lldb-commits] [lldb] [lldb-dap] Migrating 'threads' request to structured types. (PR #142510)

2025-06-04 Thread John Harrison via lldb-commits

ashgti wrote:

> I was trying to avoid putting JSON in the test because I find it hard to 
> maintain (your editor/IDE doesn't understand it's JSON, refactoring tools 
> don't work, no automatic formatting, etc) but if we think this is easier to 
> maintain (and means folks write more tests) then I'm all for it. I also 
> really like the checks for the parsing errors.

While updating the test for the 'DisassembledInstruction' type I noticed it 
handled the 'address' a bit poorly, so I updated that as well with some 
improved error reporting.

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


[Lldb-commits] [lldb] [lldb] Revive TestSimulatorPlatform.py (PR #142244)

2025-06-04 Thread Adrian Prantl via lldb-commits


@@ -198,7 +202,7 @@ def test_ios_backdeploy_apple_silicon(self):
 self.run_with(
 arch=self.getArchitecture(),
 os="ios",
-vers="11.0",
+vers="14.0",

adrian-prantl wrote:

The version 11 here is (I believe) significant. Prior to 12 there was no 
`x86_64-apple-ios-simulator` triple, instead simulator binaries used load 
commands that produced a `x86_64-apple-ios` triple, which was assumed to mean 
simulator, due to the combination of `x86` and `iOS`.

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


[Lldb-commits] [lldb] [lldb][RPC] Upstream RPC server interface emitters (PR #138032)

2025-06-04 Thread Chelsea Cassanova via lldb-commits

chelcassanova wrote:

@DavidSpickett I think I've address any previous comments to this point and 
that this patch is ready to land (contingent on the rpc-gen tool itself landing 
first). If possible, could you give this another once over?

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


[Lldb-commits] [lldb] [lldb][RPC] Upstream lldb-rpc-gen tool (PR #138031)

2025-06-04 Thread Chelsea Cassanova via lldb-commits


@@ -0,0 +1,549 @@
+//===-- lldb-rpc-gen.cpp *- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+#include "RPCBindingsHarnessEmitter.h"
+#include "RPCClientCallbacksSourceEmitter.h"
+#include "RPCCommon.h"
+#include "RPCLibraryHeaderEmitter.h"
+#include "RPCLibrarySourceEmitter.h"
+#include "RPCServerHeaderEmitter.h"
+#include "RPCServerSourceEmitter.h"
+
+#include "clang/AST/AST.h"
+#include "clang/AST/ASTConsumer.h"
+#include "clang/AST/ASTContext.h"
+#include "clang/AST/RecursiveASTVisitor.h"
+#include "clang/Basic/SourceManager.h"
+#include "clang/CodeGen/ObjectFilePCHContainerWriter.h"
+#include "clang/Frontend/CompilerInstance.h"
+#include "clang/Frontend/FrontendAction.h"
+#include "clang/Frontend/FrontendActions.h"
+#include "clang/Serialization/ObjectFilePCHContainerReader.h"
+#include "clang/Tooling/CommonOptionsParser.h"
+#include "clang/Tooling/Tooling.h"
+
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Path.h"
+#include "llvm/Support/ToolOutputFile.h"
+#include "llvm/Support/raw_ostream.h"
+
+using namespace clang;
+using namespace clang::driver;
+using namespace clang::tooling;
+
+static llvm::cl::OptionCategory RPCGenCategory("Tool for generating LLDBRPC");
+
+static llvm::cl::opt
+OutputDir("output-dir",
+  llvm::cl::desc("Directory to output generated files to"),
+  llvm::cl::init(""), llvm::cl::cat(RPCGenCategory));
+
+static std::string GetLibraryOutputDirectory() {
+  llvm::SmallString<128> Path(OutputDir.getValue());
+  llvm::sys::path::append(Path, "lib");
+  return std::string(Path);
+}
+
+static std::string GetServerOutputDirectory() {
+  llvm::SmallString<128> Path(OutputDir.getValue());
+  llvm::sys::path::append(Path, "server");
+  return std::string(Path);
+}
+
+static std::unique_ptr
+CreateOutputFile(llvm::StringRef OutputDir, llvm::StringRef Filename) {
+  llvm::SmallString<128> Path(OutputDir);
+  llvm::sys::path::append(Path, Filename);
+
+  std::error_code EC;
+  auto OutputFile =
+  std::make_unique(Path, EC, llvm::sys::fs::OF_None);
+  if (EC) {
+llvm::errs() << "Failed to create output file: " << Path << "!\n";
+return nullptr;
+  }
+  return OutputFile;
+}
+
+struct GeneratedByproducts {
+  std::set ClassNames;
+  std::set MangledMethodNames;
+  std::set SkippedMethodNames;
+  std::set CallbackMethods;
+};
+
+enum SupportLevel {
+  eUnsupported,
+  eUnimplemented,
+  eImplemented,
+};
+
+class SBVisitor : public RecursiveASTVisitor {
+public:
+  SBVisitor(
+  GeneratedByproducts &Byproducts, SourceManager &Manager,
+  ASTContext &Context,
+  std::unique_ptr &&ServerMethodOutputFile,
+  std::unique_ptr &&ServerHeaderOutputFile,
+  std::unique_ptr &&LibrarySourceOutputFile,
+  std::unique_ptr &&LibraryHeaderOutputFile,
+  lldb_rpc_gen::RPCClientCallbacksSourceEmitter &UserClientSourceEmitter,
+  lldb_rpc_gen::RPCBindingsHarnessEmitter &BindingsHarnessEmitter)
+  : Byproducts(Byproducts), Manager(Manager), Context(Context),
+ServerSourceEmitter(std::move(ServerMethodOutputFile)),
+ServerHeaderEmitter(std::move(ServerHeaderOutputFile)),
+LibrarySourceEmitter(std::move(LibrarySourceOutputFile)),
+LibraryHeaderEmitter(std::move(LibraryHeaderOutputFile)),
+ClientCallbacksSourceEmitter(UserClientSourceEmitter),
+BindingsHarnessEmitter(BindingsHarnessEmitter) {}
+
+  ~SBVisitor() {}
+
+  bool VisitCXXRecordDecl(CXXRecordDecl *RDecl) {
+if (ShouldSkipRecord(RDecl))
+  return true;
+
+const std::string ClassName = RDecl->getNameAsString();
+Byproducts.ClassNames.insert(ClassName);
+
+// Print 'bool' instead of '_Bool'.
+PrintingPolicy Policy(Context.getLangOpts());
+Policy.Bool = true;
+
+LibraryHeaderEmitter.StartClass(ClassName);
+LibrarySourceEmitter.StartClass(ClassName);
+BindingsHarnessEmitter.StartClass(ClassName);
+for (Decl *D : RDecl->decls())
+  if (auto *E = dyn_cast_or_null(D))
+LibraryHeaderEmitter.EmitEnum(E);
+
+for (CXXMethodDecl *MDecl : RDecl->methods()) {
+  const std::string MangledName =
+  lldb_rpc_gen::GetMangledName(Context, MDecl);
+  const bool IsDisallowed =
+  lldb_rpc_gen::MethodIsDisallowed(Context, MDecl);
+  const bool HasCallbackParameter =
+  lldb_rpc_gen::HasCallbackParameter(MDecl);
+  SupportLevel MethodSupportLevel = GetMethodSupportLevel(MDecl);
+  if (MethodSupportLevel == eImplemented && !IsDisallowed) {
+const lldb_rpc_gen::Method Method(MDecl, Policy, Context);
+ServerSourceEmitter.EmitMethod(Method);
+ServerHeaderEmitter.Emi

[Lldb-commits] [lldb] [lldb] Revive TestSimulatorPlatform.py (PR #142244)

2025-06-04 Thread Adrian Prantl via lldb-commits


@@ -198,7 +202,7 @@ def test_ios_backdeploy_apple_silicon(self):
 self.run_with(
 arch=self.getArchitecture(),
 os="ios",
-vers="11.0",
+vers="14.0",

adrian-prantl wrote:

Apple silicon and/or macCatalyst made the dedicated `-simulator` environment 
(and matching load commands) necessary.

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


[Lldb-commits] [lldb] [lldb] Provide TrackingOutputBufferDeleter for custom unique_ptr deleter (PR #142815)

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


@@ -159,4 +160,23 @@ struct TrackingOutputBuffer : public 
llvm::itanium_demangle::OutputBuffer {
 };
 } // namespace lldb_private
 
+/// Custom deleter to use with unique_ptr.
+///
+/// Usage:
+/// \code{.cpp}
+///
+/// auto OB =
+/// std::unique_ptr(
+/// new TrackingOutputBuffer());
+///
+/// \endcode
+struct TrackingOutputBufferDeleter {

Michael137 wrote:

Can we just put it into the test file for now? And put it back into the header 
once we actually need it elsewhere?

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


[Lldb-commits] [lldb] [lldb][RPC] Upstream lldb-rpc-gen tool (PR #138031)

2025-06-04 Thread Chelsea Cassanova via lldb-commits


@@ -0,0 +1,107 @@
+//===-- RPCCommon.h 
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef LLDB_RPC_GEN_RPCCOMMON_H
+#define LLDB_RPC_GEN_RPCCOMMON_H
+
+#include "clang/AST/AST.h"
+#include "clang/AST/ASTContext.h"
+#include "clang/AST/DeclCXX.h"
+#include "llvm/Support/ToolOutputFile.h"
+#include "llvm/Support/raw_ostream.h"
+
+#include 
+
+using namespace clang;
+
+namespace lldb_rpc_gen {
+QualType GetUnderlyingType(QualType T);
+QualType GetUnqualifiedUnderlyingType(QualType T);
+std::string GetMangledName(ASTContext &Context, CXXMethodDecl *MDecl);
+
+bool TypeIsFromLLDBPrivate(QualType T);
+bool TypeIsSBClass(QualType T);
+bool TypeIsConstCharPtr(QualType T);
+bool TypeIsConstCharPtrPtr(QualType T);
+bool TypeIsDisallowedClass(QualType T);
+bool TypeIsCallbackFunctionPointer(QualType T);
+
+bool MethodIsDisallowed(ASTContext &Context, CXXMethodDecl *MDecl);
+bool HasCallbackParameter(CXXMethodDecl *MDecl);
+
+std::string ReplaceLLDBNamespaceWithRPCNamespace(std::string Name);
+std::string StripLLDBNamespace(std::string Name);
+bool SBClassRequiresDefaultCtor(const std::string &ClassName);
+bool SBClassRequiresCopyCtorAssign(const std::string &ClassName);
+bool SBClassInheritsFromObjectRef(const std::string &ClassName);
+std::string GetSBClassNameFromType(QualType T);
+struct Param {
+  std::string Name;
+  QualType Type;
+  std::string DefaultValueText;
+  bool IsFollowedByLen;
+};
+
+enum GenerationKind : bool { eServer, eLibrary };
+
+struct Method {
+  enum Type { eOther, eConstructor, eDestructor };
+
+  Method(CXXMethodDecl *MDecl, const PrintingPolicy &Policy,
+ ASTContext &Context);
+
+  // Adding a '<' allows us to use Methods in ordered containers.
+  bool operator<(const lldb_rpc_gen::Method &rhs) const;
+  const PrintingPolicy &Policy;
+  const ASTContext &Context;
+  std::string QualifiedName;
+  std::string BaseName;
+  std::string MangledName;
+  QualType ReturnType;
+  QualType ThisType;
+  std::vector Params;
+  bool IsConst = false;
+  bool IsInstance = false;
+  bool IsCtor = false;
+  bool IsCopyCtor = false;
+  bool IsCopyAssign = false;
+  bool IsMoveCtor = false;
+  bool IsMoveAssign = false;
+  bool IsDtor = false;
+  bool IsConversionMethod = false;
+  bool IsExplicitCtorOrConversionMethod = false;
+  bool ContainsFunctionPointerParameter = false;
+
+  std::string CreateParamListAsString(GenerationKind Generation,
+  bool IncludeDefaultValue = false) const;
+
+  bool RequiresConnectionParameter() const;
+};
+
+std::string
+GetDefaultArgumentsForConstructor(std::string ClassName,
+  const lldb_rpc_gen::Method &method);
+
+class FileEmitter {
+protected:
+  FileEmitter(std::unique_ptr &&OutputFile)

chelcassanova wrote:

The `FileEmitter` class is used in the emitter classes, like the server emitter 
(https://github.com/llvm/llvm-project/pull/138032) so I think should stay.

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


[Lldb-commits] [lldb] [lldb][RPC] Upstream lldb-rpc-gen tool (PR #138031)

2025-06-04 Thread Chelsea Cassanova via lldb-commits


@@ -0,0 +1,502 @@
+//===-- RPCCommon.cpp 
-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "RPCCommon.h"
+
+#include "clang/AST/AST.h"
+#include "clang/AST/Attr.h"
+#include "clang/AST/DeclBase.h"
+#include "clang/AST/Mangle.h"
+#include "clang/Lex/Lexer.h"
+
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/raw_ostream.h"
+
+using namespace clang;
+
+// We intentionally do not generate some classes because they are currently
+// inconvenient, they aren't really used by most consumers, or we're not sure
+// why they exist.
+static constexpr llvm::StringRef DisallowedClasses[] = {
+"SBCommunication",  // What is this used for?
+"SBInputReader",// What is this used for?
+"SBCommandPluginInterface", // This is hard to support, we can do it if
+// really needed though.
+"SBCommand", // There's nothing too difficult about this one, but many of
+ // its methods take a SBCommandPluginInterface pointer so
+ // there's no reason to support this.
+};
+
+// We intentionally avoid generating certain methods either because they are
+// difficult to support correctly or they aren't really used much from C++.
+// NOTE: These methods are marked as deprecated using LLDB_DEPRECATED.
+// Normally this macro defines to the deprecated annotation, but this
+// functionality is removed in SBDefines.h when generating SWIG bindings which
+// we use for testing. Because of this, there is no annotation for the tool to
+// pick up on so this list will be used while we have this restriction in
+// SBDefines.h.
+static constexpr llvm::StringRef DisallowedMethods[] = {

chelcassanova wrote:

Good point, I'll add this in.

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


[Lldb-commits] [lldb] [lldb-dap] Adjust the stepInTargets tests on non-intel platforms. (PR #142820)

2025-06-04 Thread John Harrison via lldb-commits

https://github.com/ashgti created 
https://github.com/llvm/llvm-project/pull/142820

This test is failing for me on arm64 due to the capabilities not being sent 
until 'configurationDone' is called.

I adjusted the test to ensure we call 'configurationDone' so the value is sent 
to the test correctly.

>From 0fc2c8223ecb0888c15152331474f4ffb63c142b Mon Sep 17 00:00:00 2001
From: John Harrison 
Date: Wed, 4 Jun 2025 10:29:33 -0700
Subject: [PATCH] [lldb-dap] Adjust the stepInTargets tests on non-intel
 platforms.

This test is failing for me on arm64 due to the capabilities not being sent 
until 'configurationDone' is called.

I adjusted the test to ensure we call 'configurationDone' so the value is sent 
to the test correctly.
---
 .../stepInTargets/TestDAP_stepInTargets.py  | 17 +++--
 lldb/tools/lldb-dap/Handler/RequestHandler.h|  3 ---
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git 
a/lldb/test/API/tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py 
b/lldb/test/API/tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py
index af698074f3479..333812a61bebc 100644
--- a/lldb/test/API/tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py
+++ b/lldb/test/API/tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py
@@ -89,13 +89,16 @@ def test_supported_capability_x86_arch(self):
 self.assertEqual(
 len(breakpoint_ids), len(bp_lines), "expect correct number of 
breakpoints"
 )
+# Dynamic capability is sent in 'configurationDone' which is called
+# prior to continue.
+self.continue_to_breakpoints(breakpoint_ids)
+
 is_supported = self.dap_server.get_initialize_value(
 "supportsStepInTargetsRequest"
 )
 
-self.assertEqual(
+self.assertTrue(
 is_supported,
-True,
 f"expect capability `stepInTarget` is supported with architecture 
{self.getArchitecture()}",
 )
 # clear breakpoints.
@@ -112,15 +115,17 @@ def test_supported_capability_other_archs(self):
 self.assertEqual(
 len(breakpoint_ids), len(bp_lines), "expect correct number of 
breakpoints"
 )
+# Dynamic capability is sent in 'configurationDone' which is called
+# prior to continue.
+self.continue_to_breakpoints(breakpoint_ids)
+
 is_supported = self.dap_server.get_initialize_value(
 "supportsStepInTargetsRequest"
 )
 
-self.assertEqual(
+self.assertFalse(
 is_supported,
-False,
-f"expect capability `stepInTarget` is not supported with 
architecture {self.getArchitecture()}",
+f"expect capability `stepInTarget` is supported with architecture 
{self.getArchitecture()}",
 )
 # clear breakpoints.
-self.set_source_breakpoints(source, [])
 self.continue_to_exit()
diff --git a/lldb/tools/lldb-dap/Handler/RequestHandler.h 
b/lldb/tools/lldb-dap/Handler/RequestHandler.h
index 559929ffb21e8..14f9d462b3d1d 100644
--- a/lldb/tools/lldb-dap/Handler/RequestHandler.h
+++ b/lldb/tools/lldb-dap/Handler/RequestHandler.h
@@ -363,9 +363,6 @@ class StepInTargetsRequestHandler
 public:
   using RequestHandler::RequestHandler;
   static llvm::StringLiteral GetCommand() { return "stepInTargets"; }
-  FeatureSet GetSupportedFeatures() const override {
-return {protocol::eAdapterFeatureStepInTargetsRequest};
-  }
   llvm::Expected
   Run(const protocol::StepInTargetsArguments &args) const override;
 };

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


[Lldb-commits] [lldb] [lldb-dap] Adjust the stepInTargets tests on non-intel platforms. (PR #142820)

2025-06-04 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: John Harrison (ashgti)


Changes

This test is failing for me on arm64 due to the capabilities not being sent 
until 'configurationDone' is called.

I adjusted the test to ensure we call 'configurationDone' so the value is sent 
to the test correctly.

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


2 Files Affected:

- (modified) 
lldb/test/API/tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py (+11-6) 
- (modified) lldb/tools/lldb-dap/Handler/RequestHandler.h (-3) 


``diff
diff --git 
a/lldb/test/API/tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py 
b/lldb/test/API/tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py
index af698074f3479..333812a61bebc 100644
--- a/lldb/test/API/tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py
+++ b/lldb/test/API/tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py
@@ -89,13 +89,16 @@ def test_supported_capability_x86_arch(self):
 self.assertEqual(
 len(breakpoint_ids), len(bp_lines), "expect correct number of 
breakpoints"
 )
+# Dynamic capability is sent in 'configurationDone' which is called
+# prior to continue.
+self.continue_to_breakpoints(breakpoint_ids)
+
 is_supported = self.dap_server.get_initialize_value(
 "supportsStepInTargetsRequest"
 )
 
-self.assertEqual(
+self.assertTrue(
 is_supported,
-True,
 f"expect capability `stepInTarget` is supported with architecture 
{self.getArchitecture()}",
 )
 # clear breakpoints.
@@ -112,15 +115,17 @@ def test_supported_capability_other_archs(self):
 self.assertEqual(
 len(breakpoint_ids), len(bp_lines), "expect correct number of 
breakpoints"
 )
+# Dynamic capability is sent in 'configurationDone' which is called
+# prior to continue.
+self.continue_to_breakpoints(breakpoint_ids)
+
 is_supported = self.dap_server.get_initialize_value(
 "supportsStepInTargetsRequest"
 )
 
-self.assertEqual(
+self.assertFalse(
 is_supported,
-False,
-f"expect capability `stepInTarget` is not supported with 
architecture {self.getArchitecture()}",
+f"expect capability `stepInTarget` is supported with architecture 
{self.getArchitecture()}",
 )
 # clear breakpoints.
-self.set_source_breakpoints(source, [])
 self.continue_to_exit()
diff --git a/lldb/tools/lldb-dap/Handler/RequestHandler.h 
b/lldb/tools/lldb-dap/Handler/RequestHandler.h
index 559929ffb21e8..14f9d462b3d1d 100644
--- a/lldb/tools/lldb-dap/Handler/RequestHandler.h
+++ b/lldb/tools/lldb-dap/Handler/RequestHandler.h
@@ -363,9 +363,6 @@ class StepInTargetsRequestHandler
 public:
   using RequestHandler::RequestHandler;
   static llvm::StringLiteral GetCommand() { return "stepInTargets"; }
-  FeatureSet GetSupportedFeatures() const override {
-return {protocol::eAdapterFeatureStepInTargetsRequest};
-  }
   llvm::Expected
   Run(const protocol::StepInTargetsArguments &args) const override;
 };

``




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


[Lldb-commits] [lldb] [lldb-dap] Adjust the stepInTargets tests on non-intel platforms. (PR #142820)

2025-06-04 Thread John Harrison via lldb-commits

https://github.com/ashgti updated 
https://github.com/llvm/llvm-project/pull/142820

>From 0fc2c8223ecb0888c15152331474f4ffb63c142b Mon Sep 17 00:00:00 2001
From: John Harrison 
Date: Wed, 4 Jun 2025 10:29:33 -0700
Subject: [PATCH 1/2] [lldb-dap] Adjust the stepInTargets tests on non-intel
 platforms.

This test is failing for me on arm64 due to the capabilities not being sent 
until 'configurationDone' is called.

I adjusted the test to ensure we call 'configurationDone' so the value is sent 
to the test correctly.
---
 .../stepInTargets/TestDAP_stepInTargets.py  | 17 +++--
 lldb/tools/lldb-dap/Handler/RequestHandler.h|  3 ---
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git 
a/lldb/test/API/tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py 
b/lldb/test/API/tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py
index af698074f3479..333812a61bebc 100644
--- a/lldb/test/API/tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py
+++ b/lldb/test/API/tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py
@@ -89,13 +89,16 @@ def test_supported_capability_x86_arch(self):
 self.assertEqual(
 len(breakpoint_ids), len(bp_lines), "expect correct number of 
breakpoints"
 )
+# Dynamic capability is sent in 'configurationDone' which is called
+# prior to continue.
+self.continue_to_breakpoints(breakpoint_ids)
+
 is_supported = self.dap_server.get_initialize_value(
 "supportsStepInTargetsRequest"
 )
 
-self.assertEqual(
+self.assertTrue(
 is_supported,
-True,
 f"expect capability `stepInTarget` is supported with architecture 
{self.getArchitecture()}",
 )
 # clear breakpoints.
@@ -112,15 +115,17 @@ def test_supported_capability_other_archs(self):
 self.assertEqual(
 len(breakpoint_ids), len(bp_lines), "expect correct number of 
breakpoints"
 )
+# Dynamic capability is sent in 'configurationDone' which is called
+# prior to continue.
+self.continue_to_breakpoints(breakpoint_ids)
+
 is_supported = self.dap_server.get_initialize_value(
 "supportsStepInTargetsRequest"
 )
 
-self.assertEqual(
+self.assertFalse(
 is_supported,
-False,
-f"expect capability `stepInTarget` is not supported with 
architecture {self.getArchitecture()}",
+f"expect capability `stepInTarget` is supported with architecture 
{self.getArchitecture()}",
 )
 # clear breakpoints.
-self.set_source_breakpoints(source, [])
 self.continue_to_exit()
diff --git a/lldb/tools/lldb-dap/Handler/RequestHandler.h 
b/lldb/tools/lldb-dap/Handler/RequestHandler.h
index 559929ffb21e8..14f9d462b3d1d 100644
--- a/lldb/tools/lldb-dap/Handler/RequestHandler.h
+++ b/lldb/tools/lldb-dap/Handler/RequestHandler.h
@@ -363,9 +363,6 @@ class StepInTargetsRequestHandler
 public:
   using RequestHandler::RequestHandler;
   static llvm::StringLiteral GetCommand() { return "stepInTargets"; }
-  FeatureSet GetSupportedFeatures() const override {
-return {protocol::eAdapterFeatureStepInTargetsRequest};
-  }
   llvm::Expected
   Run(const protocol::StepInTargetsArguments &args) const override;
 };

>From de597cbbffa9c06a791a9eb16106f9144f2560e7 Mon Sep 17 00:00:00 2001
From: John Harrison 
Date: Wed, 4 Jun 2025 10:33:17 -0700
Subject: [PATCH 2/2] Tweaking comment to improve clarity.

---
 .../lldb-dap/stepInTargets/TestDAP_stepInTargets.py| 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git 
a/lldb/test/API/tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py 
b/lldb/test/API/tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py
index 333812a61bebc..6138ab4d82616 100644
--- a/lldb/test/API/tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py
+++ b/lldb/test/API/tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py
@@ -30,6 +30,8 @@ def test_basic(self):
 self.assertEqual(
 len(breakpoint_ids), len(lines), "expect correct number of 
breakpoints"
 )
+# Dynamic capability 'supportsStepInTargetsRequest' is sent in
+# 'configurationDone' which is called prior to continue.
 self.continue_to_breakpoints(breakpoint_ids)
 
 threads = self.dap_server.get_threads()
@@ -89,8 +91,8 @@ def test_supported_capability_x86_arch(self):
 self.assertEqual(
 len(breakpoint_ids), len(bp_lines), "expect correct number of 
breakpoints"
 )
-# Dynamic capability is sent in 'configurationDone' which is called
-# prior to continue.
+# Dynamic capability 'supportsStepInTargetsRequest' is sent in
+# 'configurationDone' which is called prior to continue.
 self.continue_to_breakpoints(breakpoint_ids)
 
 is_supported = self.dap_server.get_initialize_value(
@@ -115,8 +117,8 @@ def test_supported_capabili

[Lldb-commits] [lldb] [lldb] Remove USE_ALLOCATE_MEMORY_CACHE (PR #142689)

2025-06-04 Thread Alex Langford via lldb-commits

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


[Lldb-commits] [lldb] db54719 - [lldb] Remove USE_ALLOCATE_MEMORY_CACHE (#142689)

2025-06-04 Thread via lldb-commits

Author: Alex Langford
Date: 2025-06-04T10:43:36-07:00
New Revision: db5471945b7e36f55c66dfa74e218390c0329dd4

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

LOG: [lldb] Remove USE_ALLOCATE_MEMORY_CACHE (#142689)

This is always on, and has been since at least 2011 from what I can
tell. The code in the `#else` clauses are effectively dead code.

Added: 


Modified: 
lldb/source/Target/Process.cpp

Removed: 




diff  --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 84299f5f9a775..58edf972ddbe7 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -2281,7 +2281,6 @@ size_t Process::WriteMemoryPrivate(addr_t addr, const 
void *buf, size_t size,
   return bytes_written;
 }
 
-#define USE_ALLOCATE_MEMORY_CACHE 1
 size_t Process::WriteMemory(addr_t addr, const void *buf, size_t size,
 Status &error) {
   if (ABISP abi_sp = GetABI())
@@ -2292,12 +2291,8 @@ size_t Process::WriteMemory(addr_t addr, const void 
*buf, size_t size,
   if (buf == nullptr || size == 0)
 return 0;
 
-#if defined(USE_ALLOCATE_MEMORY_CACHE)
   if (TrackMemoryCacheChanges() || !m_allocated_memory_cache.IsInCache(addr))
 m_mod_id.BumpMemoryID();
-#else
-  m_mod_id.BumpMemoryID();
-#endif
 
   // We need to write any data that would go where any current software traps
   // (enabled software breakpoints) any software traps (breakpoints) that we
@@ -2434,20 +2429,7 @@ addr_t Process::AllocateMemory(size_t size, uint32_t 
permissions,
 return LLDB_INVALID_ADDRESS;
   }
 
-#if defined(USE_ALLOCATE_MEMORY_CACHE)
   return m_allocated_memory_cache.AllocateMemory(size, permissions, error);
-#else
-  addr_t allocated_addr = DoAllocateMemory(size, permissions, error);
-  Log *log = GetLog(LLDBLog::Process);
-  LLDB_LOGF(log,
-"Process::AllocateMemory(size=%" PRIu64
-", permissions=%s) => 0x%16.16" PRIx64
-" (m_stop_id = %u m_memory_id = %u)",
-(uint64_t)size, GetPermissionsAsCString(permissions),
-(uint64_t)allocated_addr, m_mod_id.GetStopID(),
-m_mod_id.GetMemoryID());
-  return allocated_addr;
-#endif
 }
 
 addr_t Process::CallocateMemory(size_t size, uint32_t permissions,
@@ -2500,21 +2482,10 @@ void Process::SetCanRunCode(bool can_run_code) {
 
 Status Process::DeallocateMemory(addr_t ptr) {
   Status error;
-#if defined(USE_ALLOCATE_MEMORY_CACHE)
   if (!m_allocated_memory_cache.DeallocateMemory(ptr)) {
 error = Status::FromErrorStringWithFormat(
 "deallocation of memory at 0x%" PRIx64 " failed.", (uint64_t)ptr);
   }
-#else
-  error = DoDeallocateMemory(ptr);
-
-  Log *log = GetLog(LLDBLog::Process);
-  LLDB_LOGF(log,
-"Process::DeallocateMemory(addr=0x%16.16" PRIx64
-") => err = %s (m_stop_id = %u, m_memory_id = %u)",
-ptr, error.AsCString("SUCCESS"), m_mod_id.GetStopID(),
-m_mod_id.GetMemoryID());
-#endif
   return error;
 }
 



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


[Lldb-commits] [lldb] [lldb][RPC] Upstream lldb-rpc-gen tool (PR #138031)

2025-06-04 Thread Chelsea Cassanova via lldb-commits


@@ -0,0 +1,502 @@
+//===-- RPCCommon.cpp 
-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "RPCCommon.h"
+
+#include "clang/AST/AST.h"
+#include "clang/AST/Attr.h"
+#include "clang/AST/DeclBase.h"
+#include "clang/AST/Mangle.h"
+#include "clang/Lex/Lexer.h"
+
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/raw_ostream.h"
+
+using namespace clang;
+
+// We intentionally do not generate some classes because they are currently
+// inconvenient, they aren't really used by most consumers, or we're not sure
+// why they exist.
+static constexpr llvm::StringRef DisallowedClasses[] = {
+"SBCommunication",  // What is this used for?
+"SBInputReader",// What is this used for?
+"SBCommandPluginInterface", // This is hard to support, we can do it if
+// really needed though.
+"SBCommand", // There's nothing too difficult about this one, but many of
+ // its methods take a SBCommandPluginInterface pointer so
+ // there's no reason to support this.
+};
+
+// We intentionally avoid generating certain methods either because they are
+// difficult to support correctly or they aren't really used much from C++.
+// NOTE: These methods are marked as deprecated using LLDB_DEPRECATED.
+// Normally this macro defines to the deprecated annotation, but this
+// functionality is removed in SBDefines.h when generating SWIG bindings which
+// we use for testing. Because of this, there is no annotation for the tool to
+// pick up on so this list will be used while we have this restriction in
+// SBDefines.h.
+static constexpr llvm::StringRef DisallowedMethods[] = {
+// The threading functionality in SBHostOS is deprecated and thus we do not
+// generate them. It would be ideal to add the annotations to the methods
+// and then support not generating deprecated methods. However, without
+// annotations the generator generates most things correctly. This one is
+// problematic because it returns a pointer to an "opaque" structure
+// (thread_t) that is not `void *`, so special casing it is more effort 
than
+// it's worth.
+"_ZN4lldb8SBHostOS10ThreadJoinEP17_opaque_pthread_tPPvPNS_7SBErrorE",
+"_ZN4lldb8SBHostOS12ThreadCancelEP17_opaque_pthread_tPNS_7SBErrorE",
+"_ZN4lldb8SBHostOS12ThreadCreateEPKcPFPvS3_ES3_PNS_7SBErrorE",
+"_ZN4lldb8SBHostOS12ThreadDetachEP17_opaque_pthread_tPNS_7SBErrorE",
+"_ZN4lldb8SBHostOS13ThreadCreatedEPKc",
+};
+
+static constexpr llvm::StringRef ClassesWithoutDefaultCtor[] = {
+"SBHostOS",
+"SBReproducer",
+};
+
+static constexpr llvm::StringRef ClassesWithoutCopyOperations[] = {
+"SBHostOS",
+"SBReproducer",
+"SBStream",
+"SBProgress",
+};
+
+static constexpr llvm::StringRef MethodsWithPointerPlusLen[] = {
+"_ZN4lldb6SBData11ReadRawDataERNS_7SBErrorEyPvm",
+"_ZN4lldb6SBData7SetDataERNS_7SBErrorEPKvmNS_9ByteOrderEh",
+"_ZN4lldb6SBData20SetDataWithOwnershipERNS_7SBErrorEPKvmNS_9ByteOrderEh",
+"_ZN4lldb6SBData25CreateDataFromUInt64ArrayENS_9ByteOrderEjPym",
+"_ZN4lldb6SBData25CreateDataFromUInt32ArrayENS_9ByteOrderEjPjm",
+"_ZN4lldb6SBData25CreateDataFromSInt64ArrayENS_9ByteOrderEjPxm",
+"_ZN4lldb6SBData25CreateDataFromSInt32ArrayENS_9ByteOrderEjPim",
+"_ZN4lldb6SBData25CreateDataFromDoubleArrayENS_9ByteOrderEjPdm",
+"_ZN4lldb6SBData22SetDataFromUInt64ArrayEPym",
+"_ZN4lldb6SBData22SetDataFromUInt32ArrayEPjm",
+"_ZN4lldb6SBData22SetDataFromSInt64ArrayEPxm",
+"_ZN4lldb6SBData22SetDataFromSInt32ArrayEPim",
+"_ZN4lldb6SBData22SetDataFromDoubleArrayEPdm",
+"_ZN4lldb10SBDebugger22GetDefaultArchitectureEPcm",
+"_ZN4lldb10SBDebugger13DispatchInputEPvPKvm",
+"_ZN4lldb10SBDebugger13DispatchInputEPKvm",
+"_ZN4lldb6SBFile4ReadEPhmPm",
+"_ZN4lldb6SBFile5WriteEPKhmPm",
+"_ZNK4lldb10SBFileSpec7GetPathEPcm",
+"_ZN4lldb10SBFileSpec11ResolvePathEPKcPcm",
+"_ZN4lldb8SBModule10GetVersionEPjj",
+"_ZN4lldb12SBModuleSpec12SetUUIDBytesEPKhm",
+"_ZNK4lldb9SBProcess9GetSTDOUTEPcm",
+"_ZNK4lldb9SBProcess9GetSTDERREPcm",
+"_ZNK4lldb9SBProcess19GetAsyncProfileDataEPcm",
+"_ZN4lldb9SBProcess10ReadMemoryEyPvmRNS_7SBErrorE",
+"_ZN4lldb9SBProcess11WriteMemoryEyPKvmRNS_7SBErrorE",
+"_ZN4lldb9SBProcess21ReadCStringFromMemoryEyPvmRNS_7SBErrorE",
+"_ZNK4lldb16SBStructuredData14GetStringValueEPcm",
+"_ZN4lldb8SBTarget23BreakpointCreateByNamesEPPKcjjRKNS_"
+"14SBFileSpecListES6_",
+"_ZN4lldb8SBTarget10ReadMemoryENS_9S

[Lldb-commits] [lldb] [lldb][RPC] Upstream lldb-rpc-gen tool (PR #138031)

2025-06-04 Thread Chelsea Cassanova via lldb-commits


@@ -0,0 +1,502 @@
+//===-- RPCCommon.cpp 
-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "RPCCommon.h"
+
+#include "clang/AST/AST.h"
+#include "clang/AST/Attr.h"
+#include "clang/AST/DeclBase.h"
+#include "clang/AST/Mangle.h"
+#include "clang/Lex/Lexer.h"
+
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/raw_ostream.h"
+
+using namespace clang;
+
+// We intentionally do not generate some classes because they are currently
+// inconvenient, they aren't really used by most consumers, or we're not sure
+// why they exist.
+static constexpr llvm::StringRef DisallowedClasses[] = {
+"SBCommunication",  // What is this used for?
+"SBInputReader",// What is this used for?
+"SBCommandPluginInterface", // This is hard to support, we can do it if
+// really needed though.
+"SBCommand", // There's nothing too difficult about this one, but many of
+ // its methods take a SBCommandPluginInterface pointer so
+ // there's no reason to support this.
+};
+
+// We intentionally avoid generating certain methods either because they are
+// difficult to support correctly or they aren't really used much from C++.
+// NOTE: These methods are marked as deprecated using LLDB_DEPRECATED.
+// Normally this macro defines to the deprecated annotation, but this
+// functionality is removed in SBDefines.h when generating SWIG bindings which
+// we use for testing. Because of this, there is no annotation for the tool to
+// pick up on so this list will be used while we have this restriction in
+// SBDefines.h.
+static constexpr llvm::StringRef DisallowedMethods[] = {
+// The threading functionality in SBHostOS is deprecated and thus we do not
+// generate them. It would be ideal to add the annotations to the methods
+// and then support not generating deprecated methods. However, without
+// annotations the generator generates most things correctly. This one is
+// problematic because it returns a pointer to an "opaque" structure
+// (thread_t) that is not `void *`, so special casing it is more effort 
than
+// it's worth.
+"_ZN4lldb8SBHostOS10ThreadJoinEP17_opaque_pthread_tPPvPNS_7SBErrorE",
+"_ZN4lldb8SBHostOS12ThreadCancelEP17_opaque_pthread_tPNS_7SBErrorE",
+"_ZN4lldb8SBHostOS12ThreadCreateEPKcPFPvS3_ES3_PNS_7SBErrorE",
+"_ZN4lldb8SBHostOS12ThreadDetachEP17_opaque_pthread_tPNS_7SBErrorE",
+"_ZN4lldb8SBHostOS13ThreadCreatedEPKc",
+};
+
+static constexpr llvm::StringRef ClassesWithoutDefaultCtor[] = {
+"SBHostOS",
+"SBReproducer",
+};
+
+static constexpr llvm::StringRef ClassesWithoutCopyOperations[] = {
+"SBHostOS",
+"SBReproducer",
+"SBStream",
+"SBProgress",
+};
+
+static constexpr llvm::StringRef MethodsWithPointerPlusLen[] = {
+"_ZN4lldb6SBData11ReadRawDataERNS_7SBErrorEyPvm",
+"_ZN4lldb6SBData7SetDataERNS_7SBErrorEPKvmNS_9ByteOrderEh",
+"_ZN4lldb6SBData20SetDataWithOwnershipERNS_7SBErrorEPKvmNS_9ByteOrderEh",
+"_ZN4lldb6SBData25CreateDataFromUInt64ArrayENS_9ByteOrderEjPym",
+"_ZN4lldb6SBData25CreateDataFromUInt32ArrayENS_9ByteOrderEjPjm",
+"_ZN4lldb6SBData25CreateDataFromSInt64ArrayENS_9ByteOrderEjPxm",
+"_ZN4lldb6SBData25CreateDataFromSInt32ArrayENS_9ByteOrderEjPim",
+"_ZN4lldb6SBData25CreateDataFromDoubleArrayENS_9ByteOrderEjPdm",
+"_ZN4lldb6SBData22SetDataFromUInt64ArrayEPym",
+"_ZN4lldb6SBData22SetDataFromUInt32ArrayEPjm",
+"_ZN4lldb6SBData22SetDataFromSInt64ArrayEPxm",
+"_ZN4lldb6SBData22SetDataFromSInt32ArrayEPim",
+"_ZN4lldb6SBData22SetDataFromDoubleArrayEPdm",
+"_ZN4lldb10SBDebugger22GetDefaultArchitectureEPcm",
+"_ZN4lldb10SBDebugger13DispatchInputEPvPKvm",
+"_ZN4lldb10SBDebugger13DispatchInputEPKvm",
+"_ZN4lldb6SBFile4ReadEPhmPm",
+"_ZN4lldb6SBFile5WriteEPKhmPm",
+"_ZNK4lldb10SBFileSpec7GetPathEPcm",
+"_ZN4lldb10SBFileSpec11ResolvePathEPKcPcm",
+"_ZN4lldb8SBModule10GetVersionEPjj",
+"_ZN4lldb12SBModuleSpec12SetUUIDBytesEPKhm",
+"_ZNK4lldb9SBProcess9GetSTDOUTEPcm",
+"_ZNK4lldb9SBProcess9GetSTDERREPcm",
+"_ZNK4lldb9SBProcess19GetAsyncProfileDataEPcm",
+"_ZN4lldb9SBProcess10ReadMemoryEyPvmRNS_7SBErrorE",
+"_ZN4lldb9SBProcess11WriteMemoryEyPKvmRNS_7SBErrorE",
+"_ZN4lldb9SBProcess21ReadCStringFromMemoryEyPvmRNS_7SBErrorE",
+"_ZNK4lldb16SBStructuredData14GetStringValueEPcm",
+"_ZN4lldb8SBTarget23BreakpointCreateByNamesEPPKcjjRKNS_"
+"14SBFileSpecListES6_",
+"_ZN4lldb8SBTarget10ReadMemoryENS_9S

[Lldb-commits] [lldb] [lldb-dap] Adjust the stepInTargets tests on non-intel platforms. (PR #142820)

2025-06-04 Thread John Harrison via lldb-commits

ashgti wrote:

Looking at this, I think I'll take a different approach to fixing this and 
close this PR for now.

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


[Lldb-commits] [lldb] [lldb] Set default object format to `MachO` in `ObjectFileMachO` (PR #142704)

2025-06-04 Thread via lldb-commits

royitaqi wrote:

> > It's not clear if there are legitimate production use cases where the 
> > Mach-O files don't have said load commands. If there is, then what is their 
> > expected object format? Without this patch, they are currently ELF. With 
> > this patch, they will become MachO
> 
> At the point in the code where you made your change we already assume that we 
> have a Mach-O file because we are passing in and examining the header. I 
> think it makes sense to set the triple to be Mach-O here.
> 
> Even if we have Mach-O files in the wild that don't have the version load 
> commands, it seems those still must be treated as Mach-O files to make any 
> sense of them.

I agree. In a sense, this patch is fixing this bug for those Mach-O files.

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


[Lldb-commits] [lldb] [lldb-dap] Adjust the stepInTargets tests on non-intel platforms. (PR #142820)

2025-06-04 Thread John Harrison via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Set default object format to `MachO` in `ObjectFileMachO` (PR #142704)

2025-06-04 Thread via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Set default object format to `MachO` in `ObjectFileMachO` (PR #142704)

2025-06-04 Thread via lldb-commits

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


[Lldb-commits] [lldb] [lldb-dap] Use structured types for stepInTargets request (PR #142439)

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

JDevlieghere wrote:

This broke the macOS bot: 
https://ci.swift.org/view/all/job/llvm.org/view/LLDB/job/as-lldb-cmake/27030/

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


[Lldb-commits] [lldb] [lldb-dap] Use structured types for stepInTargets request (PR #142439)

2025-06-04 Thread John Harrison via lldb-commits

ashgti wrote:

I'm working on a fix

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


[Lldb-commits] [lldb] [lldb/cmake] Implicitly pass arguments to llvm_add_library (PR #142583)

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

JDevlieghere wrote:

This appears to have broken the standalone build. I think we're no longer 
passing up the `ENTITLEMENTS` argument:

```
[2025-06-04T13:26:59.289Z] ld: library 'ENTITLEMENTS' not found
[2025-06-04T13:26:59.289Z] c++: error: linker command failed with exit code 1 
(use -v to see invocation)
```

https://ci.swift.org/view/all/job/llvm.org/view/LLDB/job/lldb-cmake-standalone/1782/

I'll take a look today.

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


  1   2   >