[Lldb-commits] [lldb] [Support] [lldb] Fix thread jump #45326 (PR #135778)

2025-05-13 Thread Ebuka Ezike via lldb-commits

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



  



Rate limit · GitHub


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

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

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

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

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

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

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


  
  



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

  

  

  

  

  


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


[Lldb-commits] [lldb] [Support] [lldb] Fix thread jump #45326 (PR #135778)

2025-05-13 Thread Ebuka Ezike via lldb-commits

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

>From 8070e1a391d876ccbab25dac6d2a6d2d77f16069 Mon Sep 17 00:00:00 2001
From: Ebuka Ezike 
Date: Tue, 15 Apr 2025 12:25:41 +0100
Subject: [PATCH 1/4] [lldb] Add test for jumping by offset

Signed-off-by: Ebuka Ezike 
---
 .../thread/jump/TestThreadJump.py | 70 ++-
 1 file changed, 69 insertions(+), 1 deletion(-)

diff --git a/lldb/test/API/functionalities/thread/jump/TestThreadJump.py 
b/lldb/test/API/functionalities/thread/jump/TestThreadJump.py
index 3c13a969bc3fd..d603580ac6f36 100644
--- a/lldb/test/API/functionalities/thread/jump/TestThreadJump.py
+++ b/lldb/test/API/functionalities/thread/jump/TestThreadJump.py
@@ -10,9 +10,12 @@
 
 
 class ThreadJumpTestCase(TestBase):
+def setUp(self):
+TestBase.setUp(self)
+self.build()
+
 def test(self):
 """Test thread jump handling."""
-self.build()
 exe = self.getBuildArtifact("a.out")
 self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
@@ -62,6 +65,71 @@ def test(self):
 substrs=["error"],
 )
 
+def test_jump_offset(self):
+"""Test Thread Jump by negative or positive offset"""
+exe = self.getBuildArtifact("a.out")
+file_name = "main.cpp"
+self.runCmd(f"target create {exe}", CURRENT_EXECUTABLE_SET)
+
+pos_jump = line_number(file_name, "// jump_offset 1")
+neg_jump = line_number(file_name, "// jump_offset 2")
+pos_breakpoint = line_number(file_name, "// breakpoint 1")
+neg_breakpoint = line_number(file_name, "// breakpoint 2")
+pos_jump_offset = pos_jump - pos_breakpoint
+neg_jump_offset = neg_jump - neg_breakpoint
+
+var_1, var_1_value = ("var_1", "10")
+var_2, var_2_value = ("var_2", "40")
+var_3, var_3_value = ("var_3", "10")
+
+# create pos_breakpoint and neg_breakpoint
+lldbutil.run_break_set_by_file_and_line(
+self, file_name, pos_breakpoint, num_expected_locations=1
+)
+lldbutil.run_break_set_by_file_and_line(
+self, file_name, neg_breakpoint, num_expected_locations=1
+)
+
+self.runCmd("run", RUN_SUCCEEDED)
+
+# test positive jump
+# The stop reason of the thread should be breakpoint 1.
+self.expect(
+"thread list",
+STOPPED_DUE_TO_BREAKPOINT + " 1",
+substrs=[
+"stopped",
+f"{file_name}:{pos_breakpoint}",
+"stop reason = breakpoint 1",
+],
+)
+
+self.runCmd(f"thread jump --by +{pos_jump_offset}")
+self.expect("process status", substrs=[f"at {file_name}:{pos_jump}"])
+self.expect(f"print {var_1}", substrs=[var_1_value])
+
+self.runCmd("thread step-over")
+self.expect(f"print {var_2}", substrs=[var_2_value])
+
+self.runCmd("continue")
+
+# test negative jump
+# The stop reason of the thread should be breakpoint 1.
+self.expect(
+"thread list",
+STOPPED_DUE_TO_BREAKPOINT + " 2",
+substrs=[
+"stopped",
+f"{file_name}:{neg_breakpoint}",
+"stop reason = breakpoint 2",
+],
+)
+
+self.runCmd(f"thread jump --by {neg_jump_offset}")
+self.expect("process status", substrs=[f"at {file_name}:{neg_jump}"])
+self.runCmd("thread step-over")
+self.expect(f"print {var_3}", substrs=[var_3_value])
+
 def do_min_test(self, start, jump, var, value):
 # jump to the start marker
 self.runCmd("j %i" % start)

>From e413cc9cc0967d0db256cc3c5e53fa0d221ba5b9 Mon Sep 17 00:00:00 2001
From: Ebuka Ezike 
Date: Tue, 15 Apr 2025 12:33:52 +0100
Subject: [PATCH 2/4] [lldb] Add test main.cpp file

Signed-off-by: Ebuka Ezike 
---
 .../API/functionalities/thread/jump/main.cpp| 17 +
 1 file changed, 17 insertions(+)

diff --git a/lldb/test/API/functionalities/thread/jump/main.cpp 
b/lldb/test/API/functionalities/thread/jump/main.cpp
index d3c0de2af4bf4..9c7f0bcb3b732 100644
--- a/lldb/test/API/functionalities/thread/jump/main.cpp
+++ b/lldb/test/API/functionalities/thread/jump/main.cpp
@@ -13,6 +13,21 @@ T min(T a, T b)
 }
 }
 
+int jump_positive_offset() {
+  int var_1 = 10;
+  var_1 = 20; // breakpoint 1
+
+  int var_2 = 40; // jump_offset 1
+  return var_2;
+}
+
+int jump_negative_offset() {
+  int var_3 = 10; // jump_offset 2
+  var_3 = 99;
+
+  return var_3; // breakpoint 2
+}
+
 int main ()
 {
 int i;
@@ -22,5 +37,7 @@ int main ()
 i = min(min_i_a, min_i_b); // 3rd marker
 j = min(min_j_a, min_j_b); // 4th marker
 
+jump_positive_offset();
+jump_negative_offset();
 return 0;
 }

>From a84c26af67cd0b78dd83ceef89293dba02aeffbb Mon Sep 17 00:00:00 2001
From: Ebuka Ezike 
Date: Tue, 13 May 2025 22:26:18 +0100
Subject: [PATCH 3/

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

2025-05-13 Thread Chelsea Cassanova via lldb-commits


@@ -0,0 +1,535 @@
+//===-- 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/Mangle.h"
+#include "clang/Lex/Lexer.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++.
+// FIXME: We should be able to annotate these methods instead of maintaining a
+// list in the generator itself.
+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_9SBAddressEPvmRNS_7SBErrorE",
+"_ZN4lldb8SBTarget15GetInstructionsENS_9SBAddressEPKvm",
+"_ZN4lldb8SBTarget25GetInstructionsWithFlavorENS_9SBAddressEPKcPKvm",
+"_ZN4lldb8SBTarget15GetInstructionsEyPKvm",
+"_ZN4lldb8SBTarget25GetInstructionsWithFlavorEyPKcPKvm",
+"_ZN4lldb8SBThread18GetStopDescriptionEPcm",
+// The below mangled names are used for dummy

[Lldb-commits] [lldb] [lldb][RPC] Upstream Python scripts (PR #138028)

2025-05-13 Thread Chelsea Cassanova via lldb-commits


@@ -0,0 +1,13 @@
+// Generate a dummy SB API file using lldb-rpc-gen.
+# RUN: mkdir -p %t/server
+# RUN: mkdir -p %t/lib

chelcassanova wrote:

> I don't see anything that would need job control, I'm wondering if a stray 
> character is causing the shell to think that.

It could be the "%" in `RUN: mkdir -p %t/lib`? That itself would be strange 
since the previous line creates a directory in the same way and the other shell 
tests here pass in that run 🤔 

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] [Support] [lldb] Fix thread jump #45326 (PR #135778)

2025-05-13 Thread Ebuka Ezike via lldb-commits

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


[Lldb-commits] [lldb] [Support] [lldb] Fix thread jump #45326 (PR #135778)

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


@@ -62,6 +65,71 @@ def test(self):
 substrs=["error"],
 )
 
+def test_jump_offset(self):
+"""Test Thread Jump by negative or positive offset"""
+exe = self.getBuildArtifact("a.out")
+file_name = "main.cpp"
+self.runCmd(f"target create {exe}", CURRENT_EXECUTABLE_SET)
+
+pos_jump = line_number(file_name, "// jump_offset 1")
+neg_jump = line_number(file_name, "// jump_offset 2")
+pos_breakpoint = line_number(file_name, "// breakpoint 1")
+neg_breakpoint = line_number(file_name, "// breakpoint 2")
+pos_jump_offset = pos_jump - pos_breakpoint
+neg_jump_offset = neg_jump - neg_breakpoint
+
+var_1, var_1_value = ("var_1", "10")
+var_2, var_2_value = ("var_2", "40")
+var_3, var_3_value = ("var_3", "10")
+
+# create pos_breakpoint and neg_breakpoint
+lldbutil.run_break_set_by_file_and_line(
+self, file_name, pos_breakpoint, num_expected_locations=1
+)
+lldbutil.run_break_set_by_file_and_line(
+self, file_name, neg_breakpoint, num_expected_locations=1
+)
+
+self.runCmd("run", RUN_SUCCEEDED)
+
+# test positive jump
+# The stop reason of the thread should be breakpoint 1.
+self.expect(
+"thread list",
+STOPPED_DUE_TO_BREAKPOINT + " 1",
+substrs=[
+"stopped",
+f"{file_name}:{pos_breakpoint}",
+"stop reason = breakpoint 1",
+],
+)
+
+self.runCmd(f"thread jump --by +{pos_jump_offset}")

ashgti wrote:

If the `+` prefix is optional, should we also test that this works without the 
prefix?

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


[Lldb-commits] [lldb] [Support] [lldb] Fix thread jump #45326 (PR #135778)

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


@@ -1649,11 +1649,14 @@ class CommandObjectThreadJump : public 
CommandObjectParsed {
   return Status::FromErrorStringWithFormat("invalid line number: 
'%s'.",
option_arg.str().c_str());
 break;
-  case 'b':
+  case 'b': {
+option_arg.consume_front("+");

ashgti wrote:

Should this be documented that an optional `+` can be specified?

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


[Lldb-commits] [lldb] [Support] [lldb] Fix thread jump #45326 (PR #135778)

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

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


[Lldb-commits] [lldb] [Support] [lldb] Fix thread jump #45326 (PR #135778)

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

https://github.com/ashgti commented:

I'm less familiar with this part of lldb, so I'd defer to others here.

https://github.com/llvm/llvm-project/pull/135778
___
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 Python scripts (PR #138028)

2025-05-13 Thread Chelsea Cassanova via lldb-commits


@@ -0,0 +1,18 @@
+// Copy lldb-rpc-defines.h from source.
+# RUN: mkdir -p %t/input
+# RUN: mkdir -p %t/output
+# RUN: cp %p/../../../../../include/lldb/lldb-defines.h %t/input
+
+// Run the convert script on it, then run the framework include fix on it. The 
framework version fix script
+// expects that all lldb references have been renamed to lldb-rpc in order for 
it to modify the includes
+// to go into the framework.
+# RUN: %python %p/../../../../../scripts/convert-lldb-header-to-rpc-header.py 
%t/input/lldb-defines.h %t/output/lldb-rpc-defines.h
+# RUN: %python %p/../../../../../scripts/framework-header-version-fix.py 
%t/output/lldb-rpc-defines.h %t/output/lldb-rpc-defines.h 17 0 0
+
+// Check the output
+# RUN: cat %t/output/lldb-rpc-defines.h | FileCheck %s
+
+// The LLDB version defines must be uncommented and filled in with the values 
passed into the script.
+# CHECK: #define LLDB_RPC_VERSION 17
+# CHECK: #define LLDB_RPC_REVISION 0
+# CHECK: #define LLDB_RPC_VERSION_STRING "17.0.0"

chelcassanova wrote:

This did in fact pass when checking lines that have been commented, I'll fix 
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][RPC] Upstream Python scripts (PR #138028)

2025-05-13 Thread Chelsea Cassanova via lldb-commits


@@ -0,0 +1,13 @@
+// Generate a dummy SB API file using lldb-rpc-gen.
+# RUN: mkdir -p %t/server
+# RUN: mkdir -p %t/lib

chelcassanova wrote:

I just checked on macOS and got the same error. The error is a bit misleading, 
it's actually happening because I'm using `%lldb-rpc-gen` which expects that 
this binary exists in the build which it doesn't (since the tool hasn't landed 
yet).

If you're ok it, I can XFAIL this test until the `lldb-rpc-gen` itself lands: 
https://github.com/llvm/llvm-project/pull/138031

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][RPC] Upstream Python scripts (PR #138028)

2025-05-13 Thread Chelsea Cassanova via lldb-commits

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

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

As part of upstreaming LLDB RPC, this commit adds python scripts that
are 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  | 65 +++
 lldb/scripts/framework-header-include-fix.py  | 43 
 lldb/scripts/framework-header-version-fix.py  | 65 +++
 .../TestConvertScript/CheckLLDBDefines.test   | 20 ++
 .../CheckLLDBEnumerations.test| 23 +++
 .../TestConvertScript/CheckLLDBTypes.test | 26 
 .../TestConvertScript/CheckSBDefines.test | 22 +++
 .../CheckLLDBDefines.test | 16 +
 .../CheckLLDBTypes.test   | 16 +
 .../CheckSBClass.test | 15 +
 .../CheckSBDefines.test   | 18 +
 .../Inputs/SBRPC-FrameworkFix.h   | 13 
 .../CheckLLDBDefines.test | 18 +
 13 files changed, 360 insertions(+)
 create mode 100755 lldb/scripts/convert-lldb-header-to-rpc-header.py
 create mode 100755 lldb/scripts/framework-header-include-fix.py
 create mode 100755 lldb/scripts/framework-header-version-fix.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/TestFrameworkIncludeFixScript/CheckLLDBDefines.test
 create mode 100644 
lldb/test/Shell/RPC/Scripts/TestFrameworkIncludeFixScript/CheckLLDBTypes.test
 create mode 100644 
lldb/test/Shell/RPC/Scripts/TestFrameworkIncludeFixScript/CheckSBClass.test
 create mode 100644 
lldb/test/Shell/RPC/Scripts/TestFrameworkIncludeFixScript/CheckSBDefines.test
 create mode 100644 
lldb/test/Shell/RPC/Scripts/TestFrameworkIncludeFixScript/Inputs/SBRPC-FrameworkFix.h
 create mode 100644 
lldb/test/Shell/RPC/Scripts/TestVersionFixScript/CheckLLDBDefines.test

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..fe23ef029dcf1
--- /dev/null
+++ b/lldb/scripts/convert-lldb-header-to-rpc-header.py
@@ -0,0 +1,65 @@
+#!/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
+
+
+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()
+
+with open(output_path, "w") as output_file:
+for line in lines:
+# NOTE: We do not use lldb-forward.h or lldb-versioning.h in RPC, 
so remove
+# all includes that are found for these files.
+if re.match(
+r'#include "lldb/lldb-forward|#include "lldb/lldb-versioning', 
line
+):
+continue
+# For lldb-rpc-defines.h, replace the ifndef LLDB_LLDB_ portion 
with LLDB_RPC_ as we're not
+# using LLDB private definitions in RPC.
+elif re.match(r".+LLDB_LLDB_", line):
+output_file.write(re.sub(r"LLDB_LLDB_", r"LLDB_RPC_", line))
+# Similarly to lldb-rpc-defines.h, replace the ifndef for LLDB_API 
in SBDefines.h to LLDB_RPC_API_ for the same reason.
+elif re.match(r".+LLDB_API_", line):
+output_file.write(re.sub(r"LLDB_API_", r"LLDB_RPC_API_", line))
+# Replace the references for the macros that define the versioning 
strings in
+# lldb-rpc-defines.h.
+elif re.match(r".+LLDB_VERSION", line):
+output_file.write(re.sub(r"LLDB_VERSION", r"LLDB_RPC_VERSION", 
line))
+elif re.match(r".+LLDB_REVISION", line):
+output_file.write(re.sub(r"LLDB_REVISION", 
r"LLDB_RPC_REVISION", line))
+elif re.match(r".+LLDB_VERSION_STRING", line):
+output_file.write(
+re.sub(r"LLDB_VERSION_STRING", r"LLDB_RPC_VERSION_STRING", 
line)
+)
+# For local #includes
+  

[Lldb-commits] [lldb] [lldb] Fix ForwardListFrontEnd::CalculateNumChildren (PR #139805)

2025-05-13 Thread Dave Lee via lldb-commits

https://github.com/kastiglione created 
https://github.com/llvm/llvm-project/pull/139805

Fixes the calculation of the number of children for `std::forward_list` to no 
longer be
capped. The calculation was capped by the value of `target.max-children-count`.

This resulted in at least the following problems:

1. The summary formatter would display the incorrect size when the size was 
greater than
   `max-child-count`.
2. The elision marker (`...`) would not be shown when the number of elements 
was greater
   than `max-child-count`.


>From beeb0d9d29e098e4a7063541f657e4ec65db285d Mon Sep 17 00:00:00 2001
From: Dave Lee 
Date: Tue, 13 May 2025 15:45:44 -0700
Subject: [PATCH] [lldb] Fix ForwardListFrontEnd::CalculateNumChildren

Fixes the calculation of the number of children for `std::forward_list` to no 
longer be
capped. The calculation was capped by the value of `target.max-children-count`.

This resulted in at least the following problems:

1. The summary formatter would display the incorrect size when the size was 
greater than
   `max-child-count`.
2. The elision marker (`...`) would not be shown when the number of elements 
was greater
   than `max-child-count`.
---
 lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp |  2 +-
 .../TestDataFormatterGenericForwardList.py| 11 ++-
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp
index 30db5f15c388f..e3c200da6a0f5 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp
@@ -251,7 +251,7 @@ llvm::Expected 
ForwardListFrontEnd::CalculateNumChildren() {
 
   ListEntry current(m_head);
   m_count = 0;
-  while (current && m_count < m_list_capping_size) {
+  while (current) {
 ++m_count;
 current = current.next();
   }
diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/forward_list/TestDataFormatterGenericForwardList.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/forward_list/TestDataFormatterGenericForwardList.py
index 185a24cf6dce3..1639d7275b407 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/forward_list/TestDataFormatterGenericForwardList.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/forward_list/TestDataFormatterGenericForwardList.py
@@ -53,13 +53,14 @@ def do_test(self, stdlib_type):
 substrs=["target.max-children-count (unsigned) = 256"],
 )
 
+self.runCmd("settings set target.max-children-count 256", check=False)
 self.expect(
 "frame variable thousand_elts",
 matching=False,
-substrs=["[256]", "[333]", "[444]", "[555]", "[666]", "..."],
+substrs=["[256]", "[333]", "[444]", "[555]", "[666]"],
 )
-self.runCmd("settings set target.max-children-count 3", check=False)
 
+self.runCmd("settings set target.max-children-count 3", check=False)
 self.expect(
 "frame variable thousand_elts",
 matching=False,
@@ -73,7 +74,7 @@ def do_test(self, stdlib_type):
 self.expect(
 "frame variable thousand_elts",
 matching=True,
-substrs=["size=256", "[0]", "[1]", "[2]", "..."],
+substrs=["size=1000", "[0]", "[1]", "[2]", "..."],
 )
 
 def do_test_ptr_and_ref(self, stdlib_type):
@@ -138,7 +139,7 @@ def do_test_ptr_and_ref(self, stdlib_type):
 "frame variable ref",
 matching=True,
 substrs=[
-"size=256",
+"size=1000",
 "[0] = 999",
 "[1] = 998",
 "[2] = 997",
@@ -149,7 +150,7 @@ def do_test_ptr_and_ref(self, stdlib_type):
 "frame variable *ptr",
 matching=True,
 substrs=[
-"size=256",
+"size=1000",
 "[0] = 999",
 "[1] = 998",
 "[2] = 997",

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


[Lldb-commits] [lldb] [lldb] Fix ForwardListFrontEnd::CalculateNumChildren (PR #139805)

2025-05-13 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Dave Lee (kastiglione)


Changes

Fixes the calculation of the number of children for `std::forward_list` to no 
longer be
capped. The calculation was capped by the value of `target.max-children-count`.

This resulted in at least the following problems:

1. The summary formatter would display the incorrect size when the size was 
greater than
   `max-child-count`.
2. The elision marker (`...`) would not be shown when the number of elements 
was greater
   than `max-child-count`.


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


2 Files Affected:

- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp (+1-1) 
- (modified) 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/forward_list/TestDataFormatterGenericForwardList.py
 (+6-5) 


``diff
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp
index 30db5f15c388f..e3c200da6a0f5 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp
@@ -251,7 +251,7 @@ llvm::Expected 
ForwardListFrontEnd::CalculateNumChildren() {
 
   ListEntry current(m_head);
   m_count = 0;
-  while (current && m_count < m_list_capping_size) {
+  while (current) {
 ++m_count;
 current = current.next();
   }
diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/forward_list/TestDataFormatterGenericForwardList.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/forward_list/TestDataFormatterGenericForwardList.py
index 185a24cf6dce3..1639d7275b407 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/forward_list/TestDataFormatterGenericForwardList.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/forward_list/TestDataFormatterGenericForwardList.py
@@ -53,13 +53,14 @@ def do_test(self, stdlib_type):
 substrs=["target.max-children-count (unsigned) = 256"],
 )
 
+self.runCmd("settings set target.max-children-count 256", check=False)
 self.expect(
 "frame variable thousand_elts",
 matching=False,
-substrs=["[256]", "[333]", "[444]", "[555]", "[666]", "..."],
+substrs=["[256]", "[333]", "[444]", "[555]", "[666]"],
 )
-self.runCmd("settings set target.max-children-count 3", check=False)
 
+self.runCmd("settings set target.max-children-count 3", check=False)
 self.expect(
 "frame variable thousand_elts",
 matching=False,
@@ -73,7 +74,7 @@ def do_test(self, stdlib_type):
 self.expect(
 "frame variable thousand_elts",
 matching=True,
-substrs=["size=256", "[0]", "[1]", "[2]", "..."],
+substrs=["size=1000", "[0]", "[1]", "[2]", "..."],
 )
 
 def do_test_ptr_and_ref(self, stdlib_type):
@@ -138,7 +139,7 @@ def do_test_ptr_and_ref(self, stdlib_type):
 "frame variable ref",
 matching=True,
 substrs=[
-"size=256",
+"size=1000",
 "[0] = 999",
 "[1] = 998",
 "[2] = 997",
@@ -149,7 +150,7 @@ def do_test_ptr_and_ref(self, stdlib_type):
 "frame variable *ptr",
 matching=True,
 substrs=[
-"size=256",
+"size=1000",
 "[0] = 999",
 "[1] = 998",
 "[2] = 997",

``




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


[Lldb-commits] [lldb] 85bbf8c - [lldb] Use llvm::is_contained (NFC) (#139758)

2025-05-13 Thread via lldb-commits

Author: Kazu Hirata
Date: 2025-05-13T15:53:20-07:00
New Revision: 85bbf8c887615b6b2c70353761fad8139d6ecbe8

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

LOG: [lldb] Use llvm::is_contained (NFC) (#139758)

Added: 


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

Removed: 




diff  --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp
index 4feca1253be20..51f9da854f4b6 100644
--- a/lldb/tools/lldb-dap/DAP.cpp
+++ b/lldb/tools/lldb-dap/DAP.cpp
@@ -1194,8 +1194,7 @@ bool SendEventRequestHandler::DoExecute(lldb::SBDebugger 
debugger,
"exited", "initialize",   
"loadedSource",
"module", "process",  "stopped",
"terminated", "thread"};
-  if (std::find(internal_events.begin(), internal_events.end(), name) !=
-  std::end(internal_events)) {
+  if (llvm::is_contained(internal_events, name)) {
 std::string msg =
 llvm::formatv("Invalid use of lldb-dap send-event, event \"{0}\" "
   "should be handled by lldb-dap internally.",



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


[Lldb-commits] [lldb] [lldb] Use llvm::is_contained (NFC) (PR #139758)

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

https://github.com/kazutakahirata closed 
https://github.com/llvm/llvm-project/pull/139758
___
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 Python scripts (PR #138028)

2025-05-13 Thread Chelsea Cassanova via lldb-commits

chelcassanova wrote:

@DavidSpickett I pushed here to address most of the outstanding changes I 
needed to make from your comments, and this change should also fix the CI issue 
on BuildKite. Could you give this patch another pass over?

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] cc2bedd - [lldb] Use std:::string::find with std::string_view (NFC) (#139679)

2025-05-13 Thread via lldb-commits

Author: Kazu Hirata
Date: 2025-05-13T15:48:50-07:00
New Revision: cc2beddaa44fb1f0e0ca9eb51c5feaca368c00b0

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

LOG: [lldb] Use std:::string::find with std::string_view (NFC) (#139679)

std::string::find accepts anything that can be converted to
std::string_view starting in C++17.  Since StringRef can be converted
to std::string_view, we do not need to create a temporary instance of
std::string here.

Added: 


Modified: 
lldb/source/Interpreter/Options.cpp

Removed: 




diff  --git a/lldb/source/Interpreter/Options.cpp 
b/lldb/source/Interpreter/Options.cpp
index fdadba62987d3..4cf68db466158 100644
--- a/lldb/source/Interpreter/Options.cpp
+++ b/lldb/source/Interpreter/Options.cpp
@@ -1076,7 +1076,7 @@ llvm::Expected Options::ParseAlias(const Args &args,
 
 if (!input_line.empty()) {
   llvm::StringRef tmp_arg = args_copy[idx].ref();
-  size_t pos = input_line.find(std::string(tmp_arg));
+  size_t pos = input_line.find(tmp_arg);
   if (pos != std::string::npos)
 input_line.erase(pos, tmp_arg.size());
 }



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


[Lldb-commits] [lldb] [lldb] Use std:::string::find with std::string_view (NFC) (PR #139679)

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

https://github.com/kazutakahirata closed 
https://github.com/llvm/llvm-project/pull/139679
___
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 Python scripts (PR #138028)

2025-05-13 Thread Chelsea Cassanova via lldb-commits

https://github.com/chelcassanova reopened 
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][RPC] Upstream Python scripts (PR #138028)

2025-05-13 Thread Chelsea Cassanova via lldb-commits

https://github.com/chelcassanova closed 
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][lldb-dap] Migrate ScopesRequest to structured types (PR #138116)

2025-05-13 Thread Ebuka Ezike via lldb-commits

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

>From 559eb1a020e94c09ccfeda0e4cb5e16df145d4aa Mon Sep 17 00:00:00 2001
From: Ebuka Ezike 
Date: Tue, 29 Apr 2025 18:19:18 +0100
Subject: [PATCH 1/4] [lldb][lldb-dap] Migrate 'Scopes' to structured types.

---
 lldb/tools/lldb-dap/DAP.cpp   |  11 --
 lldb/tools/lldb-dap/DAP.h |   2 -
 lldb/tools/lldb-dap/Handler/RequestHandler.h  |  10 +-
 .../lldb-dap/Handler/ScopesRequestHandler.cpp | 121 --
 lldb/tools/lldb-dap/JSONUtils.h   |  21 ---
 .../lldb-dap/Protocol/ProtocolRequests.cpp|  14 ++
 .../lldb-dap/Protocol/ProtocolRequests.h  |  13 ++
 .../tools/lldb-dap/Protocol/ProtocolTypes.cpp |  71 --
 lldb/tools/lldb-dap/Protocol/ProtocolTypes.h  |  81 +++-
 9 files changed, 224 insertions(+), 120 deletions(-)

diff --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp
index 4feca1253be20..baaf9950b79db 100644
--- a/lldb/tools/lldb-dap/DAP.cpp
+++ b/lldb/tools/lldb-dap/DAP.cpp
@@ -559,17 +559,6 @@ lldb::SBFrame DAP::GetLLDBFrame(const llvm::json::Object 
&arguments) {
   return GetLLDBFrame(frame_id);
 }
 
-llvm::json::Value DAP::CreateTopLevelScopes() {
-  llvm::json::Array scopes;
-  scopes.emplace_back(
-  CreateScope("Locals", VARREF_LOCALS, variables.locals.GetSize(), false));
-  scopes.emplace_back(CreateScope("Globals", VARREF_GLOBALS,
-  variables.globals.GetSize(), false));
-  scopes.emplace_back(CreateScope("Registers", VARREF_REGS,
-  variables.registers.GetSize(), false));
-  return llvm::json::Value(std::move(scopes));
-}
-
 ReplMode DAP::DetectReplMode(lldb::SBFrame frame, std::string &expression,
  bool partial_expression) {
   // Check for the escape hatch prefix.
diff --git a/lldb/tools/lldb-dap/DAP.h b/lldb/tools/lldb-dap/DAP.h
index c2e4c2dea582e..f66cb40451484 100644
--- a/lldb/tools/lldb-dap/DAP.h
+++ b/lldb/tools/lldb-dap/DAP.h
@@ -285,8 +285,6 @@ struct DAP {
   lldb::SBFrame GetLLDBFrame(uint64_t frame_id);
   lldb::SBFrame GetLLDBFrame(const llvm::json::Object &arguments);
 
-  llvm::json::Value CreateTopLevelScopes();
-
   void PopulateExceptionBreakpoints();
 
   /// Attempt to determine if an expression is a variable expression or
diff --git a/lldb/tools/lldb-dap/Handler/RequestHandler.h 
b/lldb/tools/lldb-dap/Handler/RequestHandler.h
index b0002440cf72e..eaebaf6619bbd 100644
--- a/lldb/tools/lldb-dap/Handler/RequestHandler.h
+++ b/lldb/tools/lldb-dap/Handler/RequestHandler.h
@@ -452,11 +452,15 @@ class PauseRequestHandler : public LegacyRequestHandler {
   void operator()(const llvm::json::Object &request) const override;
 };
 
-class ScopesRequestHandler : public LegacyRequestHandler {
+class ScopesRequestHandler final
+: public RequestHandler> {
 public:
-  using LegacyRequestHandler::LegacyRequestHandler;
+  using RequestHandler::RequestHandler;
   static llvm::StringLiteral GetCommand() { return "scopes"; }
-  void operator()(const llvm::json::Object &request) const override;
+
+  llvm::Expected
+  Run(const protocol::ScopesArguments &args) const override;
 };
 
 class SetVariableRequestHandler final
diff --git a/lldb/tools/lldb-dap/Handler/ScopesRequestHandler.cpp 
b/lldb/tools/lldb-dap/Handler/ScopesRequestHandler.cpp
index 7d1608f59f9a4..d9dd29f7269f2 100644
--- a/lldb/tools/lldb-dap/Handler/ScopesRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/ScopesRequestHandler.cpp
@@ -7,69 +7,55 @@
 
//===--===//
 
 #include "DAP.h"
-#include "EventHelper.h"
-#include "JSONUtils.h"
 #include "RequestHandler.h"
 
+using namespace lldb_dap::protocol;
 namespace lldb_dap {
 
-// "ScopesRequest": {
-//   "allOf": [ { "$ref": "#/definitions/Request" }, {
-// "type": "object",
-// "description": "Scopes request; value of command field is 'scopes'. The
-// request returns the variable scopes for a given stackframe ID.",
-// "properties": {
-//   "command": {
-// "type": "string",
-// "enum": [ "scopes" ]
-//   },
-//   "arguments": {
-// "$ref": "#/definitions/ScopesArguments"
-//   }
-// },
-// "required": [ "command", "arguments"  ]
-//   }]
-// },
-// "ScopesArguments": {
-//   "type": "object",
-//   "description": "Arguments for 'scopes' request.",
-//   "properties": {
-// "frameId": {
-//   "type": "integer",
-//   "description": "Retrieve the scopes for this stackframe."
-// }
-//   },
-//   "required": [ "frameId" ]
-// },
-// "ScopesResponse": {
-//   "allOf": [ { "$ref": "#/definitions/Response" }, {
-// "type": "object",
-// "description": "Response to 'scopes' request.",
-// "properties": {
-//   "body": {
-// "type": "object",
-// "properties": {
-//   "scopes": {
-// "type": "array",
-//  

[Lldb-commits] [lldb] [lldb][lldb-dap] Migrate ScopesRequest to structured types (PR #138116)

2025-05-13 Thread Ebuka Ezike via lldb-commits

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

>From 559eb1a020e94c09ccfeda0e4cb5e16df145d4aa Mon Sep 17 00:00:00 2001
From: Ebuka Ezike 
Date: Tue, 29 Apr 2025 18:19:18 +0100
Subject: [PATCH 1/5] [lldb][lldb-dap] Migrate 'Scopes' to structured types.

---
 lldb/tools/lldb-dap/DAP.cpp   |  11 --
 lldb/tools/lldb-dap/DAP.h |   2 -
 lldb/tools/lldb-dap/Handler/RequestHandler.h  |  10 +-
 .../lldb-dap/Handler/ScopesRequestHandler.cpp | 121 --
 lldb/tools/lldb-dap/JSONUtils.h   |  21 ---
 .../lldb-dap/Protocol/ProtocolRequests.cpp|  14 ++
 .../lldb-dap/Protocol/ProtocolRequests.h  |  13 ++
 .../tools/lldb-dap/Protocol/ProtocolTypes.cpp |  71 --
 lldb/tools/lldb-dap/Protocol/ProtocolTypes.h  |  81 +++-
 9 files changed, 224 insertions(+), 120 deletions(-)

diff --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp
index 4feca1253be20..baaf9950b79db 100644
--- a/lldb/tools/lldb-dap/DAP.cpp
+++ b/lldb/tools/lldb-dap/DAP.cpp
@@ -559,17 +559,6 @@ lldb::SBFrame DAP::GetLLDBFrame(const llvm::json::Object 
&arguments) {
   return GetLLDBFrame(frame_id);
 }
 
-llvm::json::Value DAP::CreateTopLevelScopes() {
-  llvm::json::Array scopes;
-  scopes.emplace_back(
-  CreateScope("Locals", VARREF_LOCALS, variables.locals.GetSize(), false));
-  scopes.emplace_back(CreateScope("Globals", VARREF_GLOBALS,
-  variables.globals.GetSize(), false));
-  scopes.emplace_back(CreateScope("Registers", VARREF_REGS,
-  variables.registers.GetSize(), false));
-  return llvm::json::Value(std::move(scopes));
-}
-
 ReplMode DAP::DetectReplMode(lldb::SBFrame frame, std::string &expression,
  bool partial_expression) {
   // Check for the escape hatch prefix.
diff --git a/lldb/tools/lldb-dap/DAP.h b/lldb/tools/lldb-dap/DAP.h
index c2e4c2dea582e..f66cb40451484 100644
--- a/lldb/tools/lldb-dap/DAP.h
+++ b/lldb/tools/lldb-dap/DAP.h
@@ -285,8 +285,6 @@ struct DAP {
   lldb::SBFrame GetLLDBFrame(uint64_t frame_id);
   lldb::SBFrame GetLLDBFrame(const llvm::json::Object &arguments);
 
-  llvm::json::Value CreateTopLevelScopes();
-
   void PopulateExceptionBreakpoints();
 
   /// Attempt to determine if an expression is a variable expression or
diff --git a/lldb/tools/lldb-dap/Handler/RequestHandler.h 
b/lldb/tools/lldb-dap/Handler/RequestHandler.h
index b0002440cf72e..eaebaf6619bbd 100644
--- a/lldb/tools/lldb-dap/Handler/RequestHandler.h
+++ b/lldb/tools/lldb-dap/Handler/RequestHandler.h
@@ -452,11 +452,15 @@ class PauseRequestHandler : public LegacyRequestHandler {
   void operator()(const llvm::json::Object &request) const override;
 };
 
-class ScopesRequestHandler : public LegacyRequestHandler {
+class ScopesRequestHandler final
+: public RequestHandler> {
 public:
-  using LegacyRequestHandler::LegacyRequestHandler;
+  using RequestHandler::RequestHandler;
   static llvm::StringLiteral GetCommand() { return "scopes"; }
-  void operator()(const llvm::json::Object &request) const override;
+
+  llvm::Expected
+  Run(const protocol::ScopesArguments &args) const override;
 };
 
 class SetVariableRequestHandler final
diff --git a/lldb/tools/lldb-dap/Handler/ScopesRequestHandler.cpp 
b/lldb/tools/lldb-dap/Handler/ScopesRequestHandler.cpp
index 7d1608f59f9a4..d9dd29f7269f2 100644
--- a/lldb/tools/lldb-dap/Handler/ScopesRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/ScopesRequestHandler.cpp
@@ -7,69 +7,55 @@
 
//===--===//
 
 #include "DAP.h"
-#include "EventHelper.h"
-#include "JSONUtils.h"
 #include "RequestHandler.h"
 
+using namespace lldb_dap::protocol;
 namespace lldb_dap {
 
-// "ScopesRequest": {
-//   "allOf": [ { "$ref": "#/definitions/Request" }, {
-// "type": "object",
-// "description": "Scopes request; value of command field is 'scopes'. The
-// request returns the variable scopes for a given stackframe ID.",
-// "properties": {
-//   "command": {
-// "type": "string",
-// "enum": [ "scopes" ]
-//   },
-//   "arguments": {
-// "$ref": "#/definitions/ScopesArguments"
-//   }
-// },
-// "required": [ "command", "arguments"  ]
-//   }]
-// },
-// "ScopesArguments": {
-//   "type": "object",
-//   "description": "Arguments for 'scopes' request.",
-//   "properties": {
-// "frameId": {
-//   "type": "integer",
-//   "description": "Retrieve the scopes for this stackframe."
-// }
-//   },
-//   "required": [ "frameId" ]
-// },
-// "ScopesResponse": {
-//   "allOf": [ { "$ref": "#/definitions/Response" }, {
-// "type": "object",
-// "description": "Response to 'scopes' request.",
-// "properties": {
-//   "body": {
-// "type": "object",
-// "properties": {
-//   "scopes": {
-// "type": "array",
-//  

[Lldb-commits] [lldb] Reapply "[lldb] Inherit DuplicateFileAction(HANDLE, HANDLE) handles on windows (#137978)" (PR #138896)

2025-05-13 Thread Pavel Labath via lldb-commits

labath wrote:

Thanks. I think I can fix that. Let me whip something up.

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


[Lldb-commits] [lldb] [lldb] Fix compilation errors from #138896 (PR #139711)

2025-05-13 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Pavel Labath (labath)


Changes

- s/size_t/SIZE_T to match the windows API
- case HANDLE to int64_t to avoid cast-to-int-of-different-size errors/warnings

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


3 Files Affected:

- (modified) lldb/source/Host/windows/ProcessLauncherWindows.cpp (+1-1) 
- (modified) lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp 
(+1-1) 
- (modified) lldb/tools/lldb-server/lldb-platform.cpp (+2-2) 


``diff
diff --git a/lldb/source/Host/windows/ProcessLauncherWindows.cpp 
b/lldb/source/Host/windows/ProcessLauncherWindows.cpp
index bc35667ea9a23..f5adadaf061bf 100644
--- a/lldb/source/Host/windows/ProcessLauncherWindows.cpp
+++ b/lldb/source/Host/windows/ProcessLauncherWindows.cpp
@@ -99,7 +99,7 @@ ProcessLauncherWindows::LaunchProcess(const ProcessLaunchInfo 
&launch_info,
   if (startupinfo.hStdOutput)
 inherited_handles.push_back(startupinfo.hStdOutput);
 
-  size_t attributelist_size = 0;
+  SIZE_T attributelist_size = 0;
   InitializeProcThreadAttributeList(/*lpAttributeList=*/nullptr,
 /*dwAttributeCount=*/1, /*dwFlags=*/0,
 &attributelist_size);
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index 332b9255f226f..b37b35d3a50f8 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -924,7 +924,7 @@ Status GDBRemoteCommunication::StartDebugserverProcess(
 debugserver_args.AppendArgument(fd_arg.GetString());
 // Send "pass_comm_fd" down to the inferior so it can use it to
 // communicate back with this process. Ignored on Windows.
-launch_info.AppendDuplicateFileAction((int)pass_comm_fd, 
(int)pass_comm_fd);
+launch_info.AppendDuplicateFileAction((int64_t)pass_comm_fd, 
(int64_t)pass_comm_fd);
   }
 
   // use native registers, not the GDB registers
diff --git a/lldb/tools/lldb-server/lldb-platform.cpp 
b/lldb/tools/lldb-server/lldb-platform.cpp
index 5b0a8ade01025..37ec8455c63a7 100644
--- a/lldb/tools/lldb-server/lldb-platform.cpp
+++ b/lldb/tools/lldb-server/lldb-platform.cpp
@@ -274,8 +274,8 @@ static Status spawn_process(const char *progname, const 
FileSpec &prog,
   self_args.AppendArgument(llvm::StringRef("platform"));
   self_args.AppendArgument(llvm::StringRef("--child-platform-fd"));
   self_args.AppendArgument(llvm::to_string(shared_socket.GetSendableFD()));
-  launch_info.AppendDuplicateFileAction((int)shared_socket.GetSendableFD(),
-(int)shared_socket.GetSendableFD());
+  launch_info.AppendDuplicateFileAction((int64_t)shared_socket.GetSendableFD(),
+
(int64_t)shared_socket.GetSendableFD());
   if (gdb_port) {
 self_args.AppendArgument(llvm::StringRef("--gdbserver-port"));
 self_args.AppendArgument(llvm::to_string(gdb_port));

``




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


[Lldb-commits] [lldb] [lldb][lldb-dap] Migrate ScopesRequest to structured types (PR #138116)

2025-05-13 Thread Ebuka Ezike via lldb-commits

da-viper wrote:

This means also adding serialisation or de-serialisation for types that do not 
use it except for test.

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


[Lldb-commits] [lldb] [lldb] Fix compilation errors from #138896 (PR #139711)

2025-05-13 Thread Pavel Labath via lldb-commits

https://github.com/labath created 
https://github.com/llvm/llvm-project/pull/139711

- s/size_t/SIZE_T to match the windows API
- case HANDLE to int64_t to avoid cast-to-int-of-different-size errors/warnings



  



Rate limit · GitHub


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

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

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

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

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

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

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


  
  



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

  

  

  

  

  


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


[Lldb-commits] [lldb] [lldb] Fix compilation errors from #138896 (PR #139711)

2025-05-13 Thread Pavel Labath via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Fix compilation errors from #138896 (PR #139711)

2025-05-13 Thread Martin Storsjö via lldb-commits

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

LGTM, thanks! I can confirm that this fixes compilation on mingw targets, on 
both 32 and 64 bit.

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


[Lldb-commits] [lldb] [lldb] Use std:::string::find with std::string_view (NFC) (PR #139679)

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

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


[Lldb-commits] [lldb] [LLDB] Add field member operators to DIL (PR #138093)

2025-05-13 Thread Pavel Labath via lldb-commits


@@ -272,4 +272,66 @@ Interpreter::Visit(const UnaryOpNode *node) {
   m_expr, "invalid ast: unexpected binary operator", node->GetLocation());
 }
 
+llvm::Expected
+Interpreter::Visit(const MemberOfNode *node) {
+  Status error;
+  auto base_or_err = Evaluate(node->GetBase());
+  if (!base_or_err) {
+return base_or_err;
+  }
+  lldb::ValueObjectSP base = *base_or_err;
+
+  // Perform basic type checking.
+  CompilerType base_type = base->GetCompilerType();
+  // When using an arrow, make sure the base is a pointer or array type.
+  // When using a period, make sure the base type is NOT a pointer type.
+  if (node->GetIsArrow() && !base_type.IsPointerType() &&
+  !base_type.IsArrayType()) {

labath wrote:

Because we want to let the values (and their type systems) decide whether they 
are dereferencable or not. That's what we did for the implementation of the `*` 
operator.

I could be convinced by the "status quo" argument, but this doesn't look like 
an equivalent implementation to that (for one, you're adding support for 
dereferencing arrays), which is why I want to turn this around: if `*` does not 
check for types, then why should `->` (which is defined as `(*x).`) do that?

What I can imagine is doing something on the error handling path -- if 
dereferencing failed, we look at the value to provide a better error message 
about why it failed. However, even in this case, I'd try to avoid looking at 
the type too much and instead try to reuse the error message from the 
Dereference operation (changing it, if needed) so that we can be sure it makes 
sense regardless of how the value depends to implement dereferencing.

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


[Lldb-commits] [lldb] [lldb][test] Fix beginning/end of file test failed on Windows (PR #139278)

2025-05-13 Thread David Spickett via lldb-commits

DavidSpickett wrote:

Seems fine, my only question is does the source actually need to be doing this 
much?

Or in other words: the example should be as complex as it needs to be to show 
the bug. If that means just calling the same do-nothing function over and over 
to create more lines, that would be preferable.

(but I see that you chose something generic that will compile everywhere, thank 
you for that and that aspect is spot on)

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


[Lldb-commits] [lldb] [lldb-dap] Refactor lldb-dap event handling. (PR #139669)

2025-05-13 Thread Pavel Labath via lldb-commits

labath wrote:

I also haven't looked at it in detail yet, but I think it makes sense overall. 
I'm not saying it has to be done -- it depends on where we want to take this. 
Doing everything on one thread makes it easy to avoid races and it's a strategy 
I generally like, but it also kind of goes against some of our other goals of 
making things faster by doing work in parallel. But then again, it's only "kind 
of" since it's still possible to introduce more controlled parallelism to -- I 
don't know -- fetch inferior threads in parallel if it makes sense. And that 
may actually be better in the long run.

Since I'm not going to be doing this work, I'll let you figure out the 
direction here.

I think the patch could use some splitting up. There's a bunch of typo fixes 
and other things that could go separately. And what's up with all the test 
changes -- shouldn't this be "NFC" ?

Jonas is right that class isn't (completely) thread safe. That's because it 
originally started out as a completely single-process thing -- which means 
there are no threads to synchronise. It's grown beyond that now though, and now 
it has some synchronization. Specifically, `AddPendingCallback` is thread-safe 
(but not async-signal-safe -- I think that's the part that Jonas is 
remembering). The thing that's not thread-safe is `RegisterReadObject`. Right 
now it's possible to work around that by doing something like 
`loop.AddPendingCallback([&] { loop.RegisterReadObject(); });` but if you find 
yourself needing to do that, maybe we can add that directly to the MainLoop 
class.

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


[Lldb-commits] [lldb] [LLDB] Add field member operators to DIL (PR #138093)

2025-05-13 Thread Pavel Labath via lldb-commits


@@ -272,4 +272,66 @@ Interpreter::Visit(const UnaryOpNode *node) {
   m_expr, "invalid ast: unexpected binary operator", node->GetLocation());
 }
 
+llvm::Expected
+Interpreter::Visit(const MemberOfNode *node) {
+  Status error;
+  auto base_or_err = Evaluate(node->GetBase());
+  if (!base_or_err) {
+return base_or_err;
+  }
+  lldb::ValueObjectSP base = *base_or_err;
+
+  // Perform basic type checking.
+  CompilerType base_type = base->GetCompilerType();
+  // When using an arrow, make sure the base is a pointer or array type.
+  // When using a period, make sure the base type is NOT a pointer type.
+  if (node->GetIsArrow() && !base_type.IsPointerType() &&
+  !base_type.IsArrayType()) {
+lldb::ValueObjectSP deref_sp = base->Dereference(error);
+if (error.Success()) {
+  base = deref_sp;
+  base_type = deref_sp->GetCompilerType().GetPointerType();
+} else {
+  std::string errMsg =
+  llvm::formatv("member reference type {0} is not a pointer; "
+"did you mean to use '.'?",
+base_type.TypeDescription());
+  return llvm::make_error(
+  m_expr, errMsg, node->GetLocation(), node->GetFieldName().size());
+}
+  } else if (!node->GetIsArrow() && base_type.IsPointerType()) {
+std::string errMsg =
+llvm::formatv("member reference type {0} is a pointer; "
+  "did you mean to use '->'?",
+  base_type.TypeDescription());
+return llvm::make_error(
+m_expr, errMsg, node->GetLocation(), node->GetFieldName().size());
+  }
+
+  // User specified array->elem; need to get to element[0] to look for fields.
+  if (node->GetIsArrow() && base_type.IsArrayType())
+base = base->GetChildAtIndex(0);
+
+  // Now look for the member with the specified name.
+  lldb::ValueObjectSP field_obj =
+  base->GetChildMemberWithName(llvm::StringRef(node->GetFieldName()));
+  if (field_obj && field_obj->GetName().GetString() == node->GetFieldName()) {
+if (field_obj->GetCompilerType().IsReferenceType()) {
+  lldb::ValueObjectSP tmp_obj = field_obj->Dereference(error);
+  if (error.Fail())
+return error.ToError();
+  return tmp_obj;
+}
+return field_obj;
+  }
+
+  if (node->GetIsArrow() && base_type.IsPointerType())
+base_type = base_type.GetPointeeType();
+  std::string errMsg =
+  llvm::formatv("no member named '{0}' in {1}", node->GetFieldName(),

labath wrote:

Okay, sounds good then.

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


[Lldb-commits] [lldb] [lldb] Use std:::string::find with a std::string_view (NFC) (PR #139679)

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

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

std::string::find accepts anything that can be converted to
std::string_view starting in C++17.  Since StringRef can be converted
to std::string_view, we do not need to create a temporary instance of
std::string here.




  



Rate limit · GitHub


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

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

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

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

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

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

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


  
  



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

  

  

  

  

  


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


[Lldb-commits] [lldb] [lldb] Use std:::string::find with a std::string_view (NFC) (PR #139679)

2025-05-13 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Kazu Hirata (kazutakahirata)


Changes

std::string::find accepts anything that can be converted to
std::string_view starting in C++17.  Since StringRef can be converted
to std::string_view, we do not need to create a temporary instance of
std::string here.


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


1 Files Affected:

- (modified) lldb/source/Interpreter/Options.cpp (+1-1) 


``diff
diff --git a/lldb/source/Interpreter/Options.cpp 
b/lldb/source/Interpreter/Options.cpp
index fdadba62987d3..4cf68db466158 100644
--- a/lldb/source/Interpreter/Options.cpp
+++ b/lldb/source/Interpreter/Options.cpp
@@ -1076,7 +1076,7 @@ llvm::Expected Options::ParseAlias(const Args &args,
 
 if (!input_line.empty()) {
   llvm::StringRef tmp_arg = args_copy[idx].ref();
-  size_t pos = input_line.find(std::string(tmp_arg));
+  size_t pos = input_line.find(tmp_arg);
   if (pos != std::string::npos)
 input_line.erase(pos, tmp_arg.size());
 }

``




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


[Lldb-commits] [lldb] Reapply "[lldb] Inherit DuplicateFileAction(HANDLE, HANDLE) handles on windows (#137978)" (PR #138896)

2025-05-13 Thread Martin Storsjö via lldb-commits

mstorsjo wrote:

Hi Pavel!

Unfortunately, it seems like this change has broken compilation of LLDB for 
mingw, on all architectures. With MSVC and clang-cl, it is broken for 32 bit 
platforms, while the issue only shows up as a warning for 64 bit architectures 
there.

On 64 bit mingw:
```
llvm-project/llvm/tools/lldb/tools/lldb-server/lldb-platform.cpp:277:41: error: 
cast from pointer to smaller type 'int' loses information
  277 |   
launch_info.AppendDuplicateFileAction((int)shared_socket.GetSendableFD(),
  | 
^~
llvm-project/llvm/tools/lldb/tools/lldb-server/lldb-platform.cpp:278:41: error: 
cast from pointer to smaller type 'int' loses information
  278 | 
(int)shared_socket.GetSendableFD());
  | 
^~
2 errors generated.
```

On 32 bit mingw:
```
llvm-project/llvm/tools/lldb/source/Host/windows/ProcessLauncherWindows.cpp:103:3:
 error: no matching function for call to 'InitializeProcThreadAttributeList'
  103 |   InitializeProcThreadAttributeList(/*lpAttributeList=*/nullptr,
  |   ^
llvm-mingw/i686-w64-mingw32/include/processthreadsapi.h:242:29: note: candidate 
function not viable: no known conversion from 'size_t *' (aka 'unsigned int *') 
to 'PSIZE_T' (aka 'unsigned long *') for 4th argument
  242 |   WINBASEAPI WINBOOL WINAPI InitializeProcThreadAttributeList 
(LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList, DWORD dwAttributeCount, DWORD 
dwFlags, PSIZE_T lpSize);
  | ^   

~~
llvm-project/llvm/tools/lldb/source/Host/windows/ProcessLauncherWindows.cpp:111:8:
 error: no matching function for call to 'InitializeProcThreadAttributeList'
  111 |   if (!InitializeProcThreadAttributeList(startupinfoex.lpAttributeList,
  |^
llvm-mingw/i686-w64-mingw32/include/processthreadsapi.h:242:29: note: candidate 
function not viable: no known conversion from 'size_t *' (aka 'unsigned int *') 
to 'PSIZE_T' (aka 'unsigned long *') for 4th argument
  242 |   WINBASEAPI WINBOOL WINAPI InitializeProcThreadAttributeList 
(LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList, DWORD dwAttributeCount, DWORD 
dwFlags, PSIZE_T lpSize);
  | ^   

~~
2 errors generated.
```

On 32 bit clang-cl:
```
llvm-project\lldb\source\Host\windows\ProcessLauncherWindows.cpp(103,3): error: 
no matching function for call to 'InitializeProcThreadAttributeList'
  InitializeProcThreadAttributeList(/*lpAttributeList=*/nullptr,
  ^
C:\Program Files (x86)\Windows 
Kits\10\\include\10.0.19041.0\\um\processthreadsapi.h(673,1): note: candidate 
function not viable: no known conversion from 'size_t *' (aka 'unsigned int *') 
to 'PSIZE_T' (aka 'unsigned long *') for 4th argument
InitializeProcThreadAttributeList(
^
llvm-project\lldb\source\Host\windows\ProcessLauncherWindows.cpp(111,8): error: 
no matching function for call to 'InitializeProcThreadAttributeList'
  if (!InitializeProcThreadAttributeList(startupinfoex.lpAttributeList,
   ^
C:\Program Files (x86)\Windows 
Kits\10\\include\10.0.19041.0\\um\processthreadsapi.h(673,1): note: candidate 
function not viable: no known conversion from 'size_t *' (aka 'unsigned int *') 
to 'PSIZE_T' (aka 'unsigned long *') for 4th argument
InitializeProcThreadAttributeList(
^
2 errors generated.
```

32 bit MSVC:
```
llvm-project\lldb\source\Host\windows\ProcessLauncherWindows.cpp(103): error 
C2664: 'BOOL 
InitializeProcThreadAttributeList(LPPROC_THREAD_ATTRIBUTE_LIST,DWORD,DWORD,PSIZE_T)':
 cannot convert argument 4 from 'size_t *' to 'PSIZE_T'
llvm-project\lldb\source\Host\windows\ProcessLauncherWindows.cpp(105): note: 
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style 
cast or parenthesized function-style cast
C:\Program Files (x86)\Windows 
Kits\10\\include\10.0.19041.0\\um\processthreadsapi.h(673): note: see 
declaration of 'InitializeProcThreadAttributeList'
llvm-project\lldb\source\Host\windows\ProcessLauncherWindows.cpp(103): note: 
while trying to match the argument list '(nullptr, int, int, size_t *)'
llvm-project\lldb\source\Host\windows\ProcessLauncherWindows.cpp(111): error 
C2664: 'BOOL 
InitializeProcThreadAttributeList(LPPROC_THREAD_ATTRIBUTE_LIST,DWORD,DWORD,PSIZE_T)':
 cannot convert argument 4 from 'size_t *' to 'PSIZE_T'
llvm-project\lldb\source\Host\windows\ProcessLauncherWindows.cpp(113): note: 
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style 
cast or parenthesized function-style cast
C:\Progr

[Lldb-commits] [lldb] [lldb][plugin] Use counter directly for number of readers (PR #139252)

2025-05-13 Thread Jacques Pienaar via lldb-commits

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


[Lldb-commits] [lldb] c78e65c - [lldb][plugin] Use counter directly for number of readers (#139252)

2025-05-13 Thread via lldb-commits

Author: Jacques Pienaar
Date: 2025-05-13T01:52:36-07:00
New Revision: c78e65cc980db9542b32049a5d96b00c64cbc47d

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

LOG: [lldb][plugin] Use counter directly for number of readers (#139252)

Here we were initializing & locking a shared_mutex in a thread, while
releasing it in the parent which may/often turned out to be a different
thread (shared_mutex::unlock_shared is undefined behavior if called from
a thread that doesn't hold the lock).

Switch to counter to more simply keep track of number of readers and
simply lock/unlock rather than utilizing reader mutex to verify last
freed (and so requiring this matching thread init/destroy behavior).

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
lldb/test/API/tools/lldb-dap/console/TestDAP_console.py

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
index 7d0afc04ac3b6..ffd6f1dd52aff 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -189,21 +189,20 @@ DWARFUnit::ScopedExtractDIEs 
DWARFUnit::ExtractDIEsScoped() {
 }
 
 DWARFUnit::ScopedExtractDIEs::ScopedExtractDIEs(DWARFUnit &cu) : m_cu(&cu) {
-  m_cu->m_die_array_scoped_mutex.lock_shared();
+  llvm::sys::ScopedLock lock(m_cu->m_die_array_scoped_mutex);
+  ++m_cu->m_die_array_scoped_count;
 }
 
 DWARFUnit::ScopedExtractDIEs::~ScopedExtractDIEs() {
   if (!m_cu)
 return;
-  m_cu->m_die_array_scoped_mutex.unlock_shared();
-  if (!m_clear_dies || m_cu->m_cancel_scopes)
-return;
-  // Be sure no other ScopedExtractDIEs is running anymore.
-  llvm::sys::ScopedWriter lock_scoped(m_cu->m_die_array_scoped_mutex);
-  llvm::sys::ScopedWriter lock(m_cu->m_die_array_mutex);
-  if (m_cu->m_cancel_scopes)
-return;
-  m_cu->ClearDIEsRWLocked();
+  llvm::sys::ScopedLock lock(m_cu->m_die_array_scoped_mutex);
+  --m_cu->m_die_array_scoped_count;
+  if (m_cu->m_die_array_scoped_count == 0 && m_clear_dies &&
+  !m_cu->m_cancel_scopes) {
+llvm::sys::ScopedWriter lock(m_cu->m_die_array_mutex);
+m_cu->ClearDIEsRWLocked();
+  }
 }
 
 DWARFUnit::ScopedExtractDIEs::ScopedExtractDIEs(ScopedExtractDIEs &&rhs)

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
index 75a003e0a663c..c05bba36ed74b 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
@@ -17,6 +17,7 @@
 #include "llvm/DebugInfo/DWARF/DWARFAddressRange.h"
 #include "llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h"
 #include "llvm/DebugInfo/DWARF/DWARFDebugRnglists.h"
+#include "llvm/Support/Mutex.h"
 #include "llvm/Support/RWMutex.h"
 #include 
 #include 
@@ -328,7 +329,8 @@ class DWARFUnit : public DWARFExpression::Delegate, public 
UserID {
   DWARFDebugInfoEntry::collection m_die_array;
   mutable llvm::sys::RWMutex m_die_array_mutex;
   // It is used for tracking of ScopedExtractDIEs instances.
-  mutable llvm::sys::RWMutex m_die_array_scoped_mutex;
+  mutable llvm::sys::Mutex m_die_array_scoped_mutex;
+  mutable int m_die_array_scoped_count = 0;
   // ScopedExtractDIEs instances should not call ClearDIEsRWLocked()
   // as someone called ExtractDIEsIfNeeded().
   std::atomic m_cancel_scopes;

diff  --git a/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py 
b/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py
index 8642e317f9b3a..9cdb978368cc1 100644
--- a/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py
+++ b/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py
@@ -176,7 +176,7 @@ def test_diagnositcs(self):
 f"target create --core  {core}", context="repl"
 )
 
-output = self.get_important()
+output = self.get_important(timeout=2.0)
 self.assertIn(
 "warning: unable to retrieve process ID from minidump file",
 output,



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


[Lldb-commits] [lldb] 89826f0 - [lldb] Fix compilation errors from #138896 (#139711)

2025-05-13 Thread via lldb-commits

Author: Pavel Labath
Date: 2025-05-13T15:05:53+02:00
New Revision: 89826f04589af9d309319b3651b609fdd8978631

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

LOG: [lldb] Fix compilation errors from #138896 (#139711)

- s/size_t/SIZE_T to match the windows API
- case HANDLE to int64_t to avoid cast-to-int-of-different-size
errors/warnings

Added: 


Modified: 
lldb/source/Host/windows/ProcessLauncherWindows.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
lldb/tools/lldb-server/lldb-platform.cpp

Removed: 




diff  --git a/lldb/source/Host/windows/ProcessLauncherWindows.cpp 
b/lldb/source/Host/windows/ProcessLauncherWindows.cpp
index bc35667ea9a23..f5adadaf061bf 100644
--- a/lldb/source/Host/windows/ProcessLauncherWindows.cpp
+++ b/lldb/source/Host/windows/ProcessLauncherWindows.cpp
@@ -99,7 +99,7 @@ ProcessLauncherWindows::LaunchProcess(const ProcessLaunchInfo 
&launch_info,
   if (startupinfo.hStdOutput)
 inherited_handles.push_back(startupinfo.hStdOutput);
 
-  size_t attributelist_size = 0;
+  SIZE_T attributelist_size = 0;
   InitializeProcThreadAttributeList(/*lpAttributeList=*/nullptr,
 /*dwAttributeCount=*/1, /*dwFlags=*/0,
 &attributelist_size);

diff  --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index 332b9255f226f..2aea7c6b781d7 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -924,7 +924,8 @@ Status GDBRemoteCommunication::StartDebugserverProcess(
 debugserver_args.AppendArgument(fd_arg.GetString());
 // Send "pass_comm_fd" down to the inferior so it can use it to
 // communicate back with this process. Ignored on Windows.
-launch_info.AppendDuplicateFileAction((int)pass_comm_fd, 
(int)pass_comm_fd);
+launch_info.AppendDuplicateFileAction((int64_t)pass_comm_fd,
+  (int64_t)pass_comm_fd);
   }
 
   // use native registers, not the GDB registers

diff  --git a/lldb/tools/lldb-server/lldb-platform.cpp 
b/lldb/tools/lldb-server/lldb-platform.cpp
index 5b0a8ade01025..37ec8455c63a7 100644
--- a/lldb/tools/lldb-server/lldb-platform.cpp
+++ b/lldb/tools/lldb-server/lldb-platform.cpp
@@ -274,8 +274,8 @@ static Status spawn_process(const char *progname, const 
FileSpec &prog,
   self_args.AppendArgument(llvm::StringRef("platform"));
   self_args.AppendArgument(llvm::StringRef("--child-platform-fd"));
   self_args.AppendArgument(llvm::to_string(shared_socket.GetSendableFD()));
-  launch_info.AppendDuplicateFileAction((int)shared_socket.GetSendableFD(),
-(int)shared_socket.GetSendableFD());
+  launch_info.AppendDuplicateFileAction((int64_t)shared_socket.GetSendableFD(),
+
(int64_t)shared_socket.GetSendableFD());
   if (gdb_port) {
 self_args.AppendArgument(llvm::StringRef("--gdbserver-port"));
 self_args.AppendArgument(llvm::to_string(gdb_port));



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


[Lldb-commits] [lldb] [lldb] Don't create instance of `SymbolFileDWARFDebugMap` for non-Mach-O files (PR #139170)

2025-05-13 Thread Pavel Labath via lldb-commits

labath wrote:

> To answer your last question: because the plugins (which is really a 
> misnomer), as I understand it, are there to provide abstraction: the caller 
> shouldn't have to know what concrete instance an `ObjectFile` is. The 
> no-plugins-dependency enforces that at compile/link time.

This is my problem with that. You're saying the "caller shouldn't have to 
*know*" -- which is a statement about his state of mind. We can't enforce the 
state of mind through syntactic restrictions. We can prevent the caller from 
*saying* he expects a specific subclass, but there's not way to prevent code 
from expecting that implicitly (perhaps even without it knowing). Functions 
like `SupportsDebugMap` make it worse because they encourage writing code like 
that and that makes the plugin system (the abstractions created by it) less 
useful as a whole. Like, if I now wanted to create a new symbol file plugin 
that works only with a specific object file, do I add `SupportsPsym` to every 
object file plugin? Or we don't have to look at new plugins, we have two good 
examples already: SymbolFileBreakpad and SymbolFileJSON. Both of these 
currently depend on the their respective object file plugin. Should that be 
replaced by something else (and would the result be better if we did)?

Nonetheless, I agree that plugins should create abstractions, but I think it's 
important to think about who are those abstractions directed at. The core code 
definitely shouldn't need to "look behind the curtain" (ideally not even 
through calls like `SupportsDebugMap`), but I don't think that means that noone 
else isn't allowed to do that. This situation is really simple, so it doesn't 
demonstrate the full scope of the problem, which is why I want to go back to 
the ProcessCore->ObjectFile example.

ProcessElfCore needs to extract a lot of detailed information from 
ObjectFileELF. Same goes for ProcessMachCore. At some level, the information 
these two pairs are exchanging is the same (threads, registers, ...), so one 
could imagine a generic interface to pass this -- but would that help anything? 
I say "no", because you still want to have the two plugins to work in pair -- 
if you didn't, then you wouldn't need separate process core plugins. This setup 
would make sense if we had a generic ProcessCore class (not a plugin) which 
works off of information provided by the object plugins -- but that's not the 
situation we're in now. You can make the same case for dynamic loaders -- 
should MacOSX-DYLD work with ObjectFilePECOFF?


> TL;DR: My stance is that if there's a way to enforce the DAG, I'm totally 
> fine with allowing inter-plugin dependencies where they make sense. Barring 
> that I think the current rule, albeit overly strict, is the easiest way to 
> enforce we don't regress inter-plugin dependencies in general.

Enforcement is tricky, because "where it makes sense" is obviously a judgement 
call. It's also complicated by the fact that current graph is not a DAG. Linux 
linkers actually kind of enforce the graph implicitly, but since it's not a DAG 
now, we have a 
[workaround](https://github.com/llvm/llvm-project/blob/5c7bc6a0e6a5093812e6aa9719f7d98d14bb0015/lldb/source/Core/CMakeLists.txt#L92)
 and that prevents us catching any new bad deps. I guess it would be possible 
to do something similar to `NO_PLUGIN_DEPENDENCIES` in cmake, which only allows 
dependencies that we consider acceptable, though it's not foolproof: for 
example SymbolFileJSON doesn't list ObjectFileJSON in its cmake dependencies 
even though it definitely needs it.

I think the best we can do is some cmake check plus some documentation about 
which dependencies we consider "okay".
I don't think this can be foolproof though. Going by the examples above, I 
would say that we should permit dependencies on object file plugins from 
SymbolFiles, DynamicLoaders and Processes -- but there are still exceptions to 
that. For example, ProcessGdbRemote and DynamicLoaderStatic (and *maybe* 
SymbolFileDWARF) probably shouldn't depend on any specific ObjectFile plugin 
since they're meant to work with more than one (I guess that could be a general 
rule -- but it's not enforcable one).

A rule like "there shall be no inter-plugin dependencies" is easy to enforce 
and that makes it appealing, but I think it will be very hard for us to come 
into compliance with that (and I don't think we'd like the result even if we 
did). If we say some deps are okay, then a lot of things become automatically 
compliant, and we can focus on the high-value high-complexity deps like 
SymbolFile<->TypeSystem.

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


[Lldb-commits] [lldb] [lldb-dap] While handling events, grab the APIMutex for consistency. (PR #139596)

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

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


[Lldb-commits] [lldb] [lldb][plugin] Clear in same thread as set (PR #139252)

2025-05-13 Thread Jacques Pienaar via lldb-commits

https://github.com/jpienaar updated 
https://github.com/llvm/llvm-project/pull/139252

>From c5ffbd84f8b68bae2112e8cec68803cefe571a72 Mon Sep 17 00:00:00 2001
From: Jacques Pienaar 
Date: Fri, 9 May 2025 05:23:00 -0700
Subject: [PATCH 1/5] [lldb][plugin] Clear in same thread as set

Here we were initializing & locking a mutex in a thread, while releasing it in 
the parent which may/often turned out to be a different thread 
(shared_mutex::unlock_shared is undefined behavior if called from a thread that 
doesn't hold the lock).

I'm not quite sure what the expectation is here as the variable is never used, 
so instead I've just reset in same thread as which it was set to ensure its 
freed in thread holding lock.
---
 lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
index 523820874752a..0f0226ea9650c 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
@@ -121,6 +121,7 @@ void ManualDWARFIndex::Index() {
   units_to_index.size());
   for_each_unit([&clear_cu_dies](size_t, size_t idx, DWARFUnit *unit) {
 clear_cu_dies[idx] = unit->ExtractDIEsScoped();
+ckear_cu_duex[idx].reset();
   });
 
   // Now index all DWARF unit in parallel.

>From 5f5b8dc0deae4f63ddb83e0dfab96ab3a9e0cc80 Mon Sep 17 00:00:00 2001
From: Jacques Pienaar 
Date: Fri, 9 May 2025 08:15:26 -0700
Subject: [PATCH 2/5] Fix typo

---
 lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
index 0f0226ea9650c..6139d005b4f2e 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
@@ -121,7 +121,7 @@ void ManualDWARFIndex::Index() {
   units_to_index.size());
   for_each_unit([&clear_cu_dies](size_t, size_t idx, DWARFUnit *unit) {
 clear_cu_dies[idx] = unit->ExtractDIEsScoped();
-ckear_cu_duex[idx].reset();
+ckear_cu_dies[idx].reset();
   });
 
   // Now index all DWARF unit in parallel.

>From 6d8c69c480ce214772cb84a27da645b428916ecb Mon Sep 17 00:00:00 2001
From: Jacques Pienaar 
Date: Mon, 12 May 2025 13:19:45 +
Subject: [PATCH 3/5] Use plain reader counter

---
 lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp   | 12 +---
 lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h |  4 +++-
 .../Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp|  1 -
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
index 7d0afc04ac3b6..3a8409b1c3b66 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -189,17 +189,23 @@ DWARFUnit::ScopedExtractDIEs 
DWARFUnit::ExtractDIEsScoped() {
 }
 
 DWARFUnit::ScopedExtractDIEs::ScopedExtractDIEs(DWARFUnit &cu) : m_cu(&cu) {
-  m_cu->m_die_array_scoped_mutex.lock_shared();
+  llvm::sys::ScopedLock lock(m_cu->m_die_array_scoped_mutex);
+  ++m_cu->m_die_array_scoped_count;
 }
 
 DWARFUnit::ScopedExtractDIEs::~ScopedExtractDIEs() {
   if (!m_cu)
 return;
-  m_cu->m_die_array_scoped_mutex.unlock_shared();
+  {
+llvm::sys::ScopedLock lock(m_cu->m_die_array_scoped_mutex);
+--m_cu->m_die_array_scoped_count;
+if (m_cu->m_die_array_scoped_count == 0)
+  return;
+  }
   if (!m_clear_dies || m_cu->m_cancel_scopes)
 return;
   // Be sure no other ScopedExtractDIEs is running anymore.
-  llvm::sys::ScopedWriter lock_scoped(m_cu->m_die_array_scoped_mutex);
+  llvm::sys::ScopedLock lock_scoped(m_cu->m_die_array_scoped_mutex);
   llvm::sys::ScopedWriter lock(m_cu->m_die_array_mutex);
   if (m_cu->m_cancel_scopes)
 return;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
index 75a003e0a663c..c05bba36ed74b 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
@@ -17,6 +17,7 @@
 #include "llvm/DebugInfo/DWARF/DWARFAddressRange.h"
 #include "llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h"
 #include "llvm/DebugInfo/DWARF/DWARFDebugRnglists.h"
+#include "llvm/Support/Mutex.h"
 #include "llvm/Support/RWMutex.h"
 #include 
 #include 
@@ -328,7 +329,8 @@ class DWARFUnit : public DWARFExpression::Delegate, public 
UserID {
   DWARFDebugInfoEntry::collection m_die_array;
   mutable llvm::sys::RWMutex m_die_array_mutex;
   // It is used for tracking of ScopedExtractDIEs instances.
-  mutable llvm::sys::RWMutex m_die_array_scoped_mutex;
+  mutable llvm::sys::Mutex m_die_array_scoped_mutex;
+  mutable int m_die_array_scoped_count = 0;
   // ScopedExtractDIEs ins

[Lldb-commits] [lldb] [lldb][plugin] Use counter directly for number of readers (PR #139252)

2025-05-13 Thread Jacques Pienaar via lldb-commits

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


[Lldb-commits] [lldb] [lldb][plugin] Clear in same thread as set (PR #139252)

2025-05-13 Thread Jacques Pienaar via lldb-commits

https://github.com/jpienaar edited 
https://github.com/llvm/llvm-project/pull/139252
___
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-05-13 Thread Chelsea Cassanova via lldb-commits


@@ -0,0 +1,535 @@
+//===-- 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/Mangle.h"
+#include "clang/Lex/Lexer.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++.
+// FIXME: We should be able to annotate these methods instead of maintaining a
+// list in the generator itself.
+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_9SBAddressEPvmRNS_7SBErrorE",
+"_ZN4lldb8SBTarget15GetInstructionsENS_9SBAddressEPKvm",
+"_ZN4lldb8SBTarget25GetInstructionsWithFlavorENS_9SBAddressEPKcPKvm",
+"_ZN4lldb8SBTarget15GetInstructionsEyPKvm",
+"_ZN4lldb8SBTarget25GetInstructionsWithFlavorEyPKcPKvm",
+"_ZN4lldb8SBThread18GetStopDescriptionEPcm",
+// The below mangled names are used for dummy

[Lldb-commits] [lldb] Support stepping through Darwin "branch islands" (PR #139301)

2025-05-13 Thread via lldb-commits

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



  



Rate limit · GitHub


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

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

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

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

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

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

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


  
  



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

  

  

  

  

  


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


[Lldb-commits] [lldb] Support stepping through Darwin "branch islands" (PR #139301)

2025-05-13 Thread via lldb-commits

jimingham wrote:

I used `skipTest` which you can call midway through a test, and will show the 
skip reason.

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


[Lldb-commits] [lldb] 91ea494 - [lldb] Move lldb_enable_attach from test_common to a separate header (#139550)

2025-05-13 Thread via lldb-commits

Author: Pavel Labath
Date: 2025-05-13T17:52:23+02:00
New Revision: 91ea49499325aeff8426135721b1bd432e5b7780

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

LOG: [lldb] Move lldb_enable_attach from test_common to a separate header 
(#139550)

test_common is force-included into every compilation, which causes
problems when we're compiling assembly code, as we were in #138805.

This avoids that as we can include the header only when it's needed.

Added: 
lldb/packages/Python/lldbsuite/test/make/attach.h

Modified: 
lldb/packages/Python/lldbsuite/test/make/test_common.h
lldb/test/API/commands/process/attach-resume/main.cpp
lldb/test/API/commands/process/attach/main.cpp
lldb/test/API/commands/process/detach-resumes/main.cpp
lldb/test/API/commands/register/register/register_command/main.cpp
lldb/test/API/driver/batch_mode/main.c
lldb/test/API/functionalities/deleted-executable/main.cpp
lldb/test/API/functionalities/load_after_attach/main.cpp
lldb/test/API/functionalities/process_group/main.c
lldb/test/API/functionalities/thread/create_after_attach/main.cpp
lldb/test/API/iohandler/completion/main.c
lldb/test/API/python_api/hello_world/main.c
lldb/test/API/tools/lldb-dap/attach/main.c
lldb/test/API/tools/lldb-dap/disconnect/main.cpp
lldb/test/API/tools/lldb-server/attach-wait/shim.cpp
lldb/test/API/tools/lldb-server/main.cpp

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/make/attach.h 
b/lldb/packages/Python/lldbsuite/test/make/attach.h
new file mode 100644
index 0..decd3ea986a4b
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/make/attach.h
@@ -0,0 +1,34 @@
+#ifndef LLDB_TEST_ATTACH_H
+#define LLDB_TEST_ATTACH_H
+
+// On some systems (e.g., some versions of linux) it is not possible to attach
+// to a process without it giving us special permissions. This defines the
+// lldb_enable_attach macro, which should perform any such actions, if needed 
by
+// the platform.
+#if defined(__linux__)
+#include 
+
+// Android API <= 16 does not have these defined.
+#ifndef PR_SET_PTRACER
+#define PR_SET_PTRACER 0x59616d61
+#endif
+#ifndef PR_SET_PTRACER_ANY
+#define PR_SET_PTRACER_ANY ((unsigned long)-1)
+#endif
+
+// For now we execute on best effort basis.  If this fails for some reason, so
+// be it.
+#define lldb_enable_attach()   
\
+  do { 
\
+const int prctl_result =   
\
+prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY, 0, 0, 0);
\
+(void)prctl_result;
\
+  } while (0)
+
+#else // not linux
+
+#define lldb_enable_attach()
+
+#endif // defined(__linux__)
+
+#endif // LLDB_TEST_ATTACH_H

diff  --git a/lldb/packages/Python/lldbsuite/test/make/test_common.h 
b/lldb/packages/Python/lldbsuite/test/make/test_common.h
index aa8960e1c0aea..5082e41987020 100644
--- a/lldb/packages/Python/lldbsuite/test/make/test_common.h
+++ b/lldb/packages/Python/lldbsuite/test/make/test_common.h
@@ -20,33 +20,3 @@
 #else
 #define LLVM_PRETTY_FUNCTION LLVM_PRETTY_FUNCTION
 #endif
-
-
-// On some systems (e.g., some versions of linux) it is not possible to attach 
to a process
-// without it giving us special permissions. This defines the 
lldb_enable_attach macro, which
-// should perform any such actions, if needed by the platform. This is a macro 
instead of a
-// function to avoid the need for complex linking of the test programs.
-#if defined(__linux__)
-#include 
-
-// Android API <= 16 does not have these defined.
-#ifndef PR_SET_PTRACER
-#define PR_SET_PTRACER 0x59616d61
-#endif
-#ifndef PR_SET_PTRACER_ANY
-#define PR_SET_PTRACER_ANY ((unsigned long)-1)
-#endif
-
-// For now we execute on best effort basis.  If this fails for some reason, so 
be it.
-#define lldb_enable_attach()   
   \
-do 
   \
-{  
   \
-const int prctl_result = prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY, 0, 
0, 0);  \
-(void)prctl_result;
   \
-} while (0)
-
-#else // not linux
-
-#define lldb_enable_attach()
-
-#endif

diff  --git a/lldb/test/API/commands/process/attach-resume/main.cpp 
b/lldb/test/API/commands/process/attach-resume/main.cpp
index 82aad70eed560..3fe54d1e45601 100644
--- a/lldb/test/API/commands/process/attach-resume/main.cpp
+++ b/lldb/test/API/commands/process/attach-resume/main.cpp
@@ -1,7 +

[Lldb-commits] [lldb] [lldb] Move lldb_enable_attach from test_common to a separate header (PR #139550)

2025-05-13 Thread Pavel Labath via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Use llvm::is_contained (NFC) (PR #139758)

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

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

None

>From dbe2a85661292455f0c6c141bb6d61d938212cc6 Mon Sep 17 00:00:00 2001
From: Kazu Hirata 
Date: Tue, 13 May 2025 08:56:44 -0700
Subject: [PATCH] [lldb] Use llvm::is_contained (NFC)

---
 lldb/tools/lldb-dap/DAP.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp
index 4feca1253be20..51f9da854f4b6 100644
--- a/lldb/tools/lldb-dap/DAP.cpp
+++ b/lldb/tools/lldb-dap/DAP.cpp
@@ -1194,8 +1194,7 @@ bool SendEventRequestHandler::DoExecute(lldb::SBDebugger 
debugger,
"exited", "initialize",   
"loadedSource",
"module", "process",  "stopped",
"terminated", "thread"};
-  if (std::find(internal_events.begin(), internal_events.end(), name) !=
-  std::end(internal_events)) {
+  if (llvm::is_contained(internal_events, name)) {
 std::string msg =
 llvm::formatv("Invalid use of lldb-dap send-event, event \"{0}\" "
   "should be handled by lldb-dap internally.",

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


[Lldb-commits] [lldb] [lldb] Use llvm::is_contained (NFC) (PR #139758)

2025-05-13 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Kazu Hirata (kazutakahirata)


Changes



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


1 Files Affected:

- (modified) lldb/tools/lldb-dap/DAP.cpp (+1-2) 


``diff
diff --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp
index 4feca1253be20..51f9da854f4b6 100644
--- a/lldb/tools/lldb-dap/DAP.cpp
+++ b/lldb/tools/lldb-dap/DAP.cpp
@@ -1194,8 +1194,7 @@ bool SendEventRequestHandler::DoExecute(lldb::SBDebugger 
debugger,
"exited", "initialize",   
"loadedSource",
"module", "process",  "stopped",
"terminated", "thread"};
-  if (std::find(internal_events.begin(), internal_events.end(), name) !=
-  std::end(internal_events)) {
+  if (llvm::is_contained(internal_events, name)) {
 std::string msg =
 llvm::formatv("Invalid use of lldb-dap send-event, event \"{0}\" "
   "should be handled by lldb-dap internally.",

``




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


[Lldb-commits] [lldb] [lldb] Move lldb_enable_attach from test_common to a separate header (PR #139550)

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

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


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


[Lldb-commits] [lldb] [lldb][lldb-dap] Migrate ScopesRequest to structured types (PR #138116)

2025-05-13 Thread Ebuka Ezike via lldb-commits

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



  



Rate limit · GitHub


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

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

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

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

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

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

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


  
  



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

  

  

  

  

  


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


[Lldb-commits] [lldb] [lldb-dap] Improving tests logging to understand CI failures. (PR #139311)

2025-05-13 Thread Ebuka Ezike via lldb-commits

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


https://github.com/llvm/llvm-project/pull/139311
___
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 unit test for breakpoint types (PR #139792)

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

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

Looks good!

https://github.com/llvm/llvm-project/pull/139792
___
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 unit test for breakpoint types (PR #139792)

2025-05-13 Thread Ebuka Ezike via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb-dap] Refactor lldb-dap event handling. (PR #139669)

2025-05-13 Thread Pavel Labath via lldb-commits

labath wrote:

> I can split out some of the type fixes and some other changes I ended up 
> lumping in here.

That would be great. Thanks.


> This isn't really a NFC because this is forcing some things to be serial that 
> were previously not serial. We previously could trigger an event in the 
> middle of a request handler and now we cannot. That forced some tests to 
> change behavior slightly to figure out some synchronization points in tests.

I believe you, but I don't understand. Since this restricts the set of possible 
message orderings (does it?), I would naively expect that a test which worked 
previously (with the wider set of orderings) would continue to work afterwards.

The only way I can imagine this not being true is if the tests weren't 100% 
correct (i.e., they were flaky), but whereas previously the "bad" case would 
happen 0.1% of the time, this patch now makes it the 100% case. And it's easier 
to make the test always expect the (previously) bad case than it is to accept 
all of the technically legal orderings. Is that's what happening? Maybe an 
example would help...

> Right now, I'm not actually using any read objects, just using the `MainLoop` 
> to handle dispatching events. I think we can't use the MainLoop for reading 
> from `stdin` on Windows yet. If it did work with `stdin` on Windows then we 
> could use `RegisterReadObject` for handling events and remove a thread.

Yeah, that unfortunately doesn't work right now. I would like to make that work 
one day, but my priority right now is for making it work with pipes (insomuch 
as you can call this a priority).

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


[Lldb-commits] [lldb] 2d57b61 - [lldb-dap] Add unit test for breakpoint types (#139792)

2025-05-13 Thread via lldb-commits

Author: Jonas Devlieghere
Date: 2025-05-13T17:02:13-07:00
New Revision: 2d57b6132588cd1676d817d120c2f49916227414

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

LOG: [lldb-dap] Add unit test for breakpoint types (#139792)

- Add unit test for breakpoint types for SourceBreakpoint,
  FunctionBreakpoint and DataBreakpoint.
- Rename DataBreakpointInfo to DataBreakpoint.
- Fix some mapOptions for optional fields.

Added: 


Modified: 
lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp
lldb/tools/lldb-dap/Protocol/ProtocolTypes.h
lldb/tools/lldb-dap/Watchpoint.cpp
lldb/tools/lldb-dap/Watchpoint.h
lldb/unittests/DAP/ProtocolTypesTest.cpp

Removed: 




diff  --git a/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h 
b/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
index c6456b4113320..710fa5d2c57ed 100644
--- a/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
+++ b/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
@@ -693,7 +693,7 @@ llvm::json::Value toJSON(const 
DataBreakpointInfoResponseBody &);
 struct SetDataBreakpointsArguments {
   /// The contents of this array replaces all existing data breakpoints. An
   /// empty array clears all data breakpoints.
-  std::vector breakpoints;
+  std::vector breakpoints;
 };
 bool fromJSON(const llvm::json::Value &, SetDataBreakpointsArguments &,
   llvm::json::Path);

diff  --git a/lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp 
b/lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp
index 7c2f4b20f4956..8d95687e00e53 100644
--- a/lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp
+++ b/lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp
@@ -446,18 +446,48 @@ bool fromJSON(const llvm::json::Value &Params, Breakpoint 
&BP,
 
 bool fromJSON(const llvm::json::Value &Params, SourceBreakpoint &SB,
   llvm::json::Path P) {
-  json::ObjectMapper O(Params, P);
-  return O && O.map("line", SB.line) && O.map("column", SB.column) &&
- O.map("condition", SB.condition) &&
- O.map("hitCondition", SB.hitCondition) &&
- O.map("logMessage", SB.logMessage) && O.map("mode", SB.mode);
+  llvm::json::ObjectMapper O(Params, P);
+  return O && O.map("line", SB.line) && O.mapOptional("column", SB.column) &&
+ O.mapOptional("condition", SB.condition) &&
+ O.mapOptional("hitCondition", SB.hitCondition) &&
+ O.mapOptional("logMessage", SB.logMessage) &&
+ O.mapOptional("mode", SB.mode);
+}
+
+llvm::json::Value toJSON(const SourceBreakpoint &SB) {
+  llvm::json::Object result{{"line", SB.line}};
+
+  if (SB.column)
+result.insert({"column", *SB.column});
+  if (SB.condition)
+result.insert({"condition", *SB.condition});
+  if (SB.hitCondition)
+result.insert({"hitCondition", *SB.hitCondition});
+  if (SB.logMessage)
+result.insert({"logMessage", *SB.logMessage});
+  if (SB.mode)
+result.insert({"mode", *SB.mode});
+
+  return result;
 }
 
 bool fromJSON(const llvm::json::Value &Params, FunctionBreakpoint &FB,
   llvm::json::Path P) {
-  json::ObjectMapper O(Params, P);
-  return O && O.map("name", FB.name) && O.map("condition", FB.condition) &&
- O.map("hitCondition", FB.hitCondition);
+  llvm::json::ObjectMapper O(Params, P);
+  return O && O.map("name", FB.name) &&
+ O.mapOptional("condition", FB.condition) &&
+ O.mapOptional("hitCondition", FB.hitCondition);
+}
+
+llvm::json::Value toJSON(const FunctionBreakpoint &FB) {
+  llvm::json::Object result{{"name", FB.name}};
+
+  if (FB.condition)
+result.insert({"condition", *FB.condition});
+  if (FB.hitCondition)
+result.insert({"hitCondition", *FB.hitCondition});
+
+  return result;
 }
 
 bool fromJSON(const llvm::json::Value &Params, DataBreakpointAccessType &DBAT,
@@ -493,21 +523,36 @@ llvm::json::Value toJSON(const DataBreakpointAccessType 
&DBAT) {
   llvm_unreachable("unhandled data breakpoint access type.");
 }
 
-bool fromJSON(const llvm::json::Value &Params, DataBreakpointInfo &DBI,
+bool fromJSON(const llvm::json::Value &Params, DataBreakpoint &DBI,
   llvm::json::Path P) {
-  json::ObjectMapper O(Params, P);
+  llvm::json::ObjectMapper O(Params, P);
   return O && O.map("dataId", DBI.dataId) &&
- O.map("accessType", DBI.accessType) &&
- O.map("condition", DBI.condition) &&
- O.map("hitCondition", DBI.hitCondition);
+ O.mapOptional("accessType", DBI.accessType) &&
+ O.mapOptional("condition", DBI.condition) &&
+ O.mapOptional("hitCondition", DBI.hitCondition);
+}
+
+llvm::json::Value toJSON(const DataBreakpoint &DBI) {
+  llvm::json::Object result{{"dataId", DBI.dataId}};
+
+  if (DBI.accessType)
+result.insert({"accessType", *DBI.accessType});
+  if (DBI.con

[Lldb-commits] [lldb] [lldb-dap] Add unit test for breakpoint types (PR #139792)

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

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


[Lldb-commits] [lldb] [lldb-dap] Refactor lldb-dap event handling. (PR #139669)

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

ashgti wrote:

> I believe you, but I don't understand. Since this restricts the set of 
> possible message orderings (does it?), I would naively expect that a test 
> which worked previously (with the wider set of orderings) would continue to 
> work afterwards.
> 
> The only way I can imagine this not being true is if the tests weren't 100% 
> correct (i.e., they were flaky), but whereas previously the "bad" case would 
> happen 0.1% of the time, this patch now makes it the 100% case. And it's 
> easier to make the test always expect the (previously) bad case than it is to 
> accept all of the technically legal orderings. Is that's what happening? 
> Maybe an example would help...

I think our tests are not fully specifying their expected state. For example, 
lldb/test/API/tools/lldb-dap/console/TestDAP_console.py 
`TestDAP_console.test_diagnositcs` was performing an evaluate and then using 
`get_important` to fetch output events with category 'important'. 

With the change, the `important` output was always coming after the request was 
handled. I updated the test to use a `self.collect_important` instead of 
`get_important`. Previously, this could have been emitted while the request was 
being handled, but now the output would only ever be emitted after the request 
handler is finished.

https://github.com/llvm/llvm-project/pull/139669
___
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 unit test for ColumnDescriptor, BreakpointMode and Breakpoint (PR #139627)

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

JDevlieghere wrote:

low-priority ping (I'm doing this in the background and dealign with stacked 
PRs is a nuisance)

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


[Lldb-commits] [lldb] 8193294 - [lldb-dap] Add unit test for ColumnDescriptor, BreakpointMode and Breakpoint (#139627)

2025-05-13 Thread via lldb-commits

Author: Jonas Devlieghere
Date: 2025-05-13T12:23:22-07:00
New Revision: 81932945d76a49a4dd222da39afbc18435e66fb0

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

LOG: [lldb-dap] Add unit test for ColumnDescriptor, BreakpointMode and 
Breakpoint (#139627)

Implement `fromJSON` for `ColumnDescriptor`, `BreakpointMode` and
`Breakpoint` and use it to implement the corresponding unit tests.

Added: 


Modified: 
lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp
lldb/tools/lldb-dap/Protocol/ProtocolTypes.h
lldb/unittests/DAP/ProtocolTypesTest.cpp

Removed: 




diff  --git a/lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp 
b/lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp
index c9cab350f9f12..7c2f4b20f4956 100644
--- a/lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp
+++ b/lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp
@@ -94,6 +94,28 @@ json::Value toJSON(const ExceptionBreakpointsFilter &EBF) {
   return result;
 }
 
+bool fromJSON(const json::Value &Params, ColumnType &CT, json::Path P) {
+  auto rawColumnType = Params.getAsString();
+  if (!rawColumnType) {
+P.report("expected a string");
+return false;
+  }
+  std::optional columnType =
+  StringSwitch>(*rawColumnType)
+  .Case("string", eColumnTypeString)
+  .Case("number", eColumnTypeNumber)
+  .Case("boolean", eColumnTypeBoolean)
+  .Case("unixTimestampUTC ", eColumnTypeTimestamp)
+  .Default(std::nullopt);
+  if (!columnType) {
+P.report("unexpected value, expected 'string', 'number',  'boolean', or "
+ "'unixTimestampUTC'");
+return false;
+  }
+  CT = *columnType;
+  return true;
+}
+
 json::Value toJSON(const ColumnType &T) {
   switch (T) {
   case eColumnTypeString:
@@ -108,6 +130,14 @@ json::Value toJSON(const ColumnType &T) {
   llvm_unreachable("unhandled column type.");
 }
 
+bool fromJSON(const llvm::json::Value &Params, ColumnDescriptor &CD,
+  llvm::json::Path P) {
+  llvm::json::ObjectMapper O(Params, P);
+  return O && O.map("attributeName", CD.attributeName) &&
+ O.map("label", CD.label) && O.mapOptional("format", CD.format) &&
+ O.mapOptional("type", CD.type) && O.mapOptional("width", CD.width);
+}
+
 json::Value toJSON(const ColumnDescriptor &CD) {
   json::Object result{{"attributeName", CD.attributeName}, {"label", 
CD.label}};
 
@@ -149,6 +179,30 @@ json::Value toJSON(const BreakpointModeApplicability &BMA) 
{
   llvm_unreachable("unhandled breakpoint mode applicability.");
 }
 
+bool fromJSON(const llvm::json::Value &Params, BreakpointModeApplicability 
&BMA,
+  llvm::json::Path P) {
+  auto rawApplicability = Params.getAsString();
+  if (!rawApplicability) {
+P.report("expected a string");
+return false;
+  }
+  std::optional applicability =
+  llvm::StringSwitch>(
+  *rawApplicability)
+  .Case("source", eBreakpointModeApplicabilitySource)
+  .Case("exception", eBreakpointModeApplicabilityException)
+  .Case("data", eBreakpointModeApplicabilityData)
+  .Case("instruction", eBreakpointModeApplicabilityInstruction)
+  .Default(std::nullopt);
+  if (!applicability) {
+P.report("unexpected value, expected 'source', 'exception', 'data', or "
+ "'instruction'");
+return false;
+  }
+  BMA = *applicability;
+  return true;
+}
+
 json::Value toJSON(const BreakpointMode &BM) {
   json::Object result{
   {"mode", BM.mode},
@@ -162,6 +216,14 @@ json::Value toJSON(const BreakpointMode &BM) {
   return result;
 }
 
+bool fromJSON(const llvm::json::Value &Params, BreakpointMode &BM,
+  llvm::json::Path P) {
+  llvm::json::ObjectMapper O(Params, P);
+  return O && O.map("mode", BM.mode) && O.map("label", BM.label) &&
+ O.mapOptional("description", BM.description) &&
+ O.map("appliesTo", BM.appliesTo);
+}
+
 static llvm::StringLiteral ToString(AdapterFeature feature) {
   switch (feature) {
   case eAdapterFeatureANSIStyling:
@@ -320,6 +382,26 @@ llvm::json::Value toJSON(const BreakpointReason &BR) {
   llvm_unreachable("unhandled breakpoint reason.");
 }
 
+bool fromJSON(const llvm::json::Value &Params, BreakpointReason &BR,
+  llvm::json::Path P) {
+  auto rawReason = Params.getAsString();
+  if (!rawReason) {
+P.report("expected a string");
+return false;
+  }
+  std::optional reason =
+  llvm::StringSwitch>(*rawReason)
+  .Case("pending", BreakpointReason::eBreakpointReasonPending)
+  .Case("failed", BreakpointReason::eBreakpointReasonFailed)
+  .Default(std::nullopt);
+  if (!reason) {
+P.report("unexpected value, expected 'pending' or 'failed'");
+return false;
+  }
+  BR = *reason;
+  return true;
+}
+
 json::Value toJSON(const Breakp

[Lldb-commits] [lldb] [lldb-dap] Add unit test for ColumnDescriptor, BreakpointMode and Breakpoint (PR #139627)

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

https://github.com/JDevlieghere closed 
https://github.com/llvm/llvm-project/pull/139627
___
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-05-13 Thread Alex Langford via lldb-commits


@@ -0,0 +1,535 @@
+//===-- 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/Mangle.h"
+#include "clang/Lex/Lexer.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++.
+// FIXME: We should be able to annotate these methods instead of maintaining a
+// list in the generator itself.
+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[] = {

bulbazord wrote:

I see. I think something like that could work, but it'd be a larger change that 
would require buy-in from the larger community and an audit of the SBAPI in 
general.

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-05-13 Thread Alex Langford via lldb-commits


@@ -0,0 +1,535 @@
+//===-- 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/Mangle.h"
+#include "clang/Lex/Lexer.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++.
+// FIXME: We should be able to annotate these methods instead of maintaining a
+// list in the generator itself.
+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_9SBAddressEPvmRNS_7SBErrorE",
+"_ZN4lldb8SBTarget15GetInstructionsENS_9SBAddressEPKvm",
+"_ZN4lldb8SBTarget25GetInstructionsWithFlavorENS_9SBAddressEPKcPKvm",
+"_ZN4lldb8SBTarget15GetInstructionsEyPKvm",
+"_ZN4lldb8SBTarget25GetInstructionsWithFlavorEyPKcPKvm",
+"_ZN4lldb8SBThread18GetStopDescriptionEPcm",
+// The below mangled names are used for dummy

[Lldb-commits] [lldb] [lldb-dap] Add unit test for breakpoint types (PR #139792)

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

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

 - Add unit test for breakpoint types for SourceBreakpoint, FunctionBreakpoint 
and DataBreakpoint.
 - Rename DataBreakpointInfo to DataBreakpoint.
 - Fix some mapOptions for optional fields.

>From 653ea8956bb48c1b6e3ad1c6a861c57a84f72c02 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Tue, 13 May 2025 13:45:49 -0700
Subject: [PATCH] [lldb-dap] Add unit test for breakpoint types

 - Add unit test for breakpoint types for SourceBreakpoint, FunctionBreakpoint 
and DataBreakpoint.
 - Rename DataBreakpointInfo to DataBreakpoint.
 - Fix some mapOptions for optional fields.
---
 .../lldb-dap/Protocol/ProtocolRequests.h  |  2 +-
 .../tools/lldb-dap/Protocol/ProtocolTypes.cpp | 77 +++
 lldb/tools/lldb-dap/Protocol/ProtocolTypes.h  |  8 +-
 lldb/tools/lldb-dap/Watchpoint.cpp|  2 +-
 lldb/tools/lldb-dap/Watchpoint.h  |  2 +-
 lldb/unittests/DAP/ProtocolTypesTest.cpp  | 62 +++
 6 files changed, 131 insertions(+), 22 deletions(-)

diff --git a/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h 
b/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
index c6456b4113320..710fa5d2c57ed 100644
--- a/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
+++ b/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
@@ -693,7 +693,7 @@ llvm::json::Value toJSON(const 
DataBreakpointInfoResponseBody &);
 struct SetDataBreakpointsArguments {
   /// The contents of this array replaces all existing data breakpoints. An
   /// empty array clears all data breakpoints.
-  std::vector breakpoints;
+  std::vector breakpoints;
 };
 bool fromJSON(const llvm::json::Value &, SetDataBreakpointsArguments &,
   llvm::json::Path);
diff --git a/lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp 
b/lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp
index 7c2f4b20f4956..8d95687e00e53 100644
--- a/lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp
+++ b/lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp
@@ -446,18 +446,48 @@ bool fromJSON(const llvm::json::Value &Params, Breakpoint 
&BP,
 
 bool fromJSON(const llvm::json::Value &Params, SourceBreakpoint &SB,
   llvm::json::Path P) {
-  json::ObjectMapper O(Params, P);
-  return O && O.map("line", SB.line) && O.map("column", SB.column) &&
- O.map("condition", SB.condition) &&
- O.map("hitCondition", SB.hitCondition) &&
- O.map("logMessage", SB.logMessage) && O.map("mode", SB.mode);
+  llvm::json::ObjectMapper O(Params, P);
+  return O && O.map("line", SB.line) && O.mapOptional("column", SB.column) &&
+ O.mapOptional("condition", SB.condition) &&
+ O.mapOptional("hitCondition", SB.hitCondition) &&
+ O.mapOptional("logMessage", SB.logMessage) &&
+ O.mapOptional("mode", SB.mode);
+}
+
+llvm::json::Value toJSON(const SourceBreakpoint &SB) {
+  llvm::json::Object result{{"line", SB.line}};
+
+  if (SB.column)
+result.insert({"column", *SB.column});
+  if (SB.condition)
+result.insert({"condition", *SB.condition});
+  if (SB.hitCondition)
+result.insert({"hitCondition", *SB.hitCondition});
+  if (SB.logMessage)
+result.insert({"logMessage", *SB.logMessage});
+  if (SB.mode)
+result.insert({"mode", *SB.mode});
+
+  return result;
 }
 
 bool fromJSON(const llvm::json::Value &Params, FunctionBreakpoint &FB,
   llvm::json::Path P) {
-  json::ObjectMapper O(Params, P);
-  return O && O.map("name", FB.name) && O.map("condition", FB.condition) &&
- O.map("hitCondition", FB.hitCondition);
+  llvm::json::ObjectMapper O(Params, P);
+  return O && O.map("name", FB.name) &&
+ O.mapOptional("condition", FB.condition) &&
+ O.mapOptional("hitCondition", FB.hitCondition);
+}
+
+llvm::json::Value toJSON(const FunctionBreakpoint &FB) {
+  llvm::json::Object result{{"name", FB.name}};
+
+  if (FB.condition)
+result.insert({"condition", *FB.condition});
+  if (FB.hitCondition)
+result.insert({"hitCondition", *FB.hitCondition});
+
+  return result;
 }
 
 bool fromJSON(const llvm::json::Value &Params, DataBreakpointAccessType &DBAT,
@@ -493,21 +523,36 @@ llvm::json::Value toJSON(const DataBreakpointAccessType 
&DBAT) {
   llvm_unreachable("unhandled data breakpoint access type.");
 }
 
-bool fromJSON(const llvm::json::Value &Params, DataBreakpointInfo &DBI,
+bool fromJSON(const llvm::json::Value &Params, DataBreakpoint &DBI,
   llvm::json::Path P) {
-  json::ObjectMapper O(Params, P);
+  llvm::json::ObjectMapper O(Params, P);
   return O && O.map("dataId", DBI.dataId) &&
- O.map("accessType", DBI.accessType) &&
- O.map("condition", DBI.condition) &&
- O.map("hitCondition", DBI.hitCondition);
+ O.mapOptional("accessType", DBI.accessType) &&
+ O.mapOptional("condition", DBI.condition) &&
+ O.mapOptional("hitCondition", DBI.hitCondition);
+}
+
+llvm::json::Value toJSON(const DataBreakpoint &DBI) {
+  llvm::

[Lldb-commits] [lldb] [lldb-dap] Add unit test for breakpoint types (PR #139792)

2025-05-13 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)


Changes

 - Add unit test for breakpoint types for SourceBreakpoint, FunctionBreakpoint 
and DataBreakpoint.
 - Rename DataBreakpointInfo to DataBreakpoint.
 - Fix some mapOptions for optional fields.

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


6 Files Affected:

- (modified) lldb/tools/lldb-dap/Protocol/ProtocolRequests.h (+1-1) 
- (modified) lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp (+61-16) 
- (modified) lldb/tools/lldb-dap/Protocol/ProtocolTypes.h (+5-3) 
- (modified) lldb/tools/lldb-dap/Watchpoint.cpp (+1-1) 
- (modified) lldb/tools/lldb-dap/Watchpoint.h (+1-1) 
- (modified) lldb/unittests/DAP/ProtocolTypesTest.cpp (+62) 


``diff
diff --git a/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h 
b/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
index c6456b4113320..710fa5d2c57ed 100644
--- a/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
+++ b/lldb/tools/lldb-dap/Protocol/ProtocolRequests.h
@@ -693,7 +693,7 @@ llvm::json::Value toJSON(const 
DataBreakpointInfoResponseBody &);
 struct SetDataBreakpointsArguments {
   /// The contents of this array replaces all existing data breakpoints. An
   /// empty array clears all data breakpoints.
-  std::vector breakpoints;
+  std::vector breakpoints;
 };
 bool fromJSON(const llvm::json::Value &, SetDataBreakpointsArguments &,
   llvm::json::Path);
diff --git a/lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp 
b/lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp
index 7c2f4b20f4956..8d95687e00e53 100644
--- a/lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp
+++ b/lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp
@@ -446,18 +446,48 @@ bool fromJSON(const llvm::json::Value &Params, Breakpoint 
&BP,
 
 bool fromJSON(const llvm::json::Value &Params, SourceBreakpoint &SB,
   llvm::json::Path P) {
-  json::ObjectMapper O(Params, P);
-  return O && O.map("line", SB.line) && O.map("column", SB.column) &&
- O.map("condition", SB.condition) &&
- O.map("hitCondition", SB.hitCondition) &&
- O.map("logMessage", SB.logMessage) && O.map("mode", SB.mode);
+  llvm::json::ObjectMapper O(Params, P);
+  return O && O.map("line", SB.line) && O.mapOptional("column", SB.column) &&
+ O.mapOptional("condition", SB.condition) &&
+ O.mapOptional("hitCondition", SB.hitCondition) &&
+ O.mapOptional("logMessage", SB.logMessage) &&
+ O.mapOptional("mode", SB.mode);
+}
+
+llvm::json::Value toJSON(const SourceBreakpoint &SB) {
+  llvm::json::Object result{{"line", SB.line}};
+
+  if (SB.column)
+result.insert({"column", *SB.column});
+  if (SB.condition)
+result.insert({"condition", *SB.condition});
+  if (SB.hitCondition)
+result.insert({"hitCondition", *SB.hitCondition});
+  if (SB.logMessage)
+result.insert({"logMessage", *SB.logMessage});
+  if (SB.mode)
+result.insert({"mode", *SB.mode});
+
+  return result;
 }
 
 bool fromJSON(const llvm::json::Value &Params, FunctionBreakpoint &FB,
   llvm::json::Path P) {
-  json::ObjectMapper O(Params, P);
-  return O && O.map("name", FB.name) && O.map("condition", FB.condition) &&
- O.map("hitCondition", FB.hitCondition);
+  llvm::json::ObjectMapper O(Params, P);
+  return O && O.map("name", FB.name) &&
+ O.mapOptional("condition", FB.condition) &&
+ O.mapOptional("hitCondition", FB.hitCondition);
+}
+
+llvm::json::Value toJSON(const FunctionBreakpoint &FB) {
+  llvm::json::Object result{{"name", FB.name}};
+
+  if (FB.condition)
+result.insert({"condition", *FB.condition});
+  if (FB.hitCondition)
+result.insert({"hitCondition", *FB.hitCondition});
+
+  return result;
 }
 
 bool fromJSON(const llvm::json::Value &Params, DataBreakpointAccessType &DBAT,
@@ -493,21 +523,36 @@ llvm::json::Value toJSON(const DataBreakpointAccessType 
&DBAT) {
   llvm_unreachable("unhandled data breakpoint access type.");
 }
 
-bool fromJSON(const llvm::json::Value &Params, DataBreakpointInfo &DBI,
+bool fromJSON(const llvm::json::Value &Params, DataBreakpoint &DBI,
   llvm::json::Path P) {
-  json::ObjectMapper O(Params, P);
+  llvm::json::ObjectMapper O(Params, P);
   return O && O.map("dataId", DBI.dataId) &&
- O.map("accessType", DBI.accessType) &&
- O.map("condition", DBI.condition) &&
- O.map("hitCondition", DBI.hitCondition);
+ O.mapOptional("accessType", DBI.accessType) &&
+ O.mapOptional("condition", DBI.condition) &&
+ O.mapOptional("hitCondition", DBI.hitCondition);
+}
+
+llvm::json::Value toJSON(const DataBreakpoint &DBI) {
+  llvm::json::Object result{{"dataId", DBI.dataId}};
+
+  if (DBI.accessType)
+result.insert({"accessType", *DBI.accessType});
+  if (DBI.condition)
+result.insert({"condition", *DBI.condition});
+  if (DBI.hitCondition)
+result.insert({"hitCondition", *DBI.hitCondition});
+
+  return result;
 }
 
 bool fromJSON(c

[Lldb-commits] [lldb] [lldb-dap] Add unit test for ColumnDescriptor, BreakpointMode and Breakpoint (PR #139627)

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

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

LGTM!

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


[Lldb-commits] [lldb] Support stepping through Darwin "branch islands" (PR #139301)

2025-05-13 Thread Felipe de Azevedo Piovezan via lldb-commits

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

LGTM!

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


[Lldb-commits] [lldb] [lldb-dap] Improving tests logging to understand CI failures. (PR #139311)

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

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



  



Rate limit · GitHub


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

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

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

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

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

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

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


  
  



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

  

  

  

  

  


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


[Lldb-commits] [lldb] 952b680 - Support stepping through Darwin "branch islands" (#139301)

2025-05-13 Thread via lldb-commits

Author: jimingham
Date: 2025-05-13T13:32:53-07:00
New Revision: 952b680fd1a283883ee2075146a7b10ea9510e8a

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

LOG: Support stepping through Darwin "branch islands" (#139301)

When an intra-module jump doesn't fit in the immediate branch slot, the
Darwin linker inserts "branch island" symbols, and emits code to jump
from branch island to branch island till it makes it to the actual
function.

The previous submissions failed because in that environment the linker
was putting the `foo.island` symbol at the same address as the `padding`
symbol we we emitting to make our faked-up large binary. This submission
jams a byte after the padding symbol so that the other symbols can't
overlap it.

Added: 
lldb/test/API/macosx/branch-islands/Makefile
lldb/test/API/macosx/branch-islands/TestBranchIslands.py
lldb/test/API/macosx/branch-islands/foo.c
lldb/test/API/macosx/branch-islands/main.c
lldb/test/API/macosx/branch-islands/padding1.s
lldb/test/API/macosx/branch-islands/padding2.s
lldb/test/API/macosx/branch-islands/padding3.s
lldb/test/API/macosx/branch-islands/padding4.s

Modified: 
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp 
b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
index e25c4ff55e408..578ab12268ea3 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
@@ -26,6 +26,7 @@
 #include "lldb/Target/Thread.h"
 #include "lldb/Target/ThreadPlanCallFunction.h"
 #include "lldb/Target/ThreadPlanRunToAddress.h"
+#include "lldb/Target/ThreadPlanStepInstruction.h"
 #include "lldb/Utility/DataBuffer.h"
 #include "lldb/Utility/DataBufferHeap.h"
 #include "lldb/Utility/LLDBLog.h"
@@ -923,15 +924,15 @@ DynamicLoaderDarwin::GetStepThroughTrampolinePlan(Thread 
&thread,
   if (current_symbol != nullptr) {
 std::vector addresses;
 
+ConstString current_name =
+current_symbol->GetMangled().GetName(Mangled::ePreferMangled);
 if (current_symbol->IsTrampoline()) {
-  ConstString trampoline_name =
-  current_symbol->GetMangled().GetName(Mangled::ePreferMangled);
 
-  if (trampoline_name) {
+  if (current_name) {
 const ModuleList &images = target_sp->GetImages();
 
 SymbolContextList code_symbols;
-images.FindSymbolsWithNameAndType(trampoline_name, eSymbolTypeCode,
+images.FindSymbolsWithNameAndType(current_name, eSymbolTypeCode,
   code_symbols);
 for (const SymbolContext &context : code_symbols) {
   Address addr = context.GetFunctionOrSymbolAddress();
@@ -945,8 +946,8 @@ DynamicLoaderDarwin::GetStepThroughTrampolinePlan(Thread 
&thread,
 }
 
 SymbolContextList reexported_symbols;
-images.FindSymbolsWithNameAndType(
-trampoline_name, eSymbolTypeReExported, reexported_symbols);
+images.FindSymbolsWithNameAndType(current_name, eSymbolTypeReExported,
+  reexported_symbols);
 for (const SymbolContext &context : reexported_symbols) {
   if (context.symbol) {
 Symbol *actual_symbol =
@@ -968,7 +969,7 @@ DynamicLoaderDarwin::GetStepThroughTrampolinePlan(Thread 
&thread,
 }
 
 SymbolContextList indirect_symbols;
-images.FindSymbolsWithNameAndType(trampoline_name, eSymbolTypeResolver,
+images.FindSymbolsWithNameAndType(current_name, eSymbolTypeResolver,
   indirect_symbols);
 
 for (const SymbolContext &context : indirect_symbols) {
@@ -1028,6 +1029,23 @@ DynamicLoaderDarwin::GetStepThroughTrampolinePlan(Thread 
&thread,
   thread_plan_sp = std::make_shared(
   thread, load_addrs, stop_others);
 }
+// One more case we have to consider is "branch islands".  These are 
regular
+// TEXT symbols but their names end in .island plus maybe a .digit suffix.
+// They are to allow arm64 code to branch further than the size of the
+// address slot allows.  We just need to single-instruction step in that
+// case.
+static const char *g_branch_island_pattern = "\\.island\\.?[0-9]*$";
+static RegularExpression g_branch_island_regex(g_branch_island_pattern);
+
+bool is_branch_island = g_branch_island_regex.Execute(current_name);
+if (!thread_plan_sp && is_branch_island) {
+  thread_plan_sp = std::make_shared(
+  thread,
+  /* step_over= */ false, /* stop_others */ false, eVoteNoOpinion,
+  eVoteNoOpinion);
+  

[Lldb-commits] [lldb] Support stepping through Darwin "branch islands" (PR #139301)

2025-05-13 Thread via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Use std:::string::find with std::string_view (NFC) (PR #139679)

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

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


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


[Lldb-commits] [lldb] b8ba963 - [lldb] don't run TestUnwindFramelessFaulted.py on Linux

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

Author: Jason Molenda
Date: 2025-05-13T18:14:57-07:00
New Revision: b8ba9636f0f46a02ebe3ab369fe6b47703f45ba6

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

LOG: [lldb] don't run TestUnwindFramelessFaulted.py on Linux

I thought I could call $(CPP) to preprocess the assembly
file, but the aarch64-ubuntu bot runs this as clang -E and
it issues a warning and no output file, apparently,

build/bin/clang -E -o interrupt-and-trap-funcs.s 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted/interrupt-and-trap-funcs.s
clang: warning: 
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted/interrupt-and-trap-funcs.s:
 'assembler' input unused [-Wunused-command-line-argument]

/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang -g -O0 -c -o 
interrupt-and-trap-funcs.o interrupt-and-trap-funcs.s
clang: error: no such file or directory: 'interrupt-and-trap-funcs.s'
clang: error: no input files

Added: 


Modified: 

lldb/test/API/functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py

Removed: 




diff  --git 
a/lldb/test/API/functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py
 
b/lldb/test/API/functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py
index 03af87fcf32f6..483a487d76899 100644
--- 
a/lldb/test/API/functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py
+++ 
b/lldb/test/API/functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py
@@ -10,7 +10,7 @@
 class TestUnwindFramelessFaulted(TestBase):
 NO_DEBUG_INFO_TESTCASE = True
 
-@skipIf(oslist=no_match([lldbplatformutil.getDarwinOSTriples(), "linux"]))
+@skipIf(oslist=no_match([lldbplatformutil.getDarwinOSTriples()]))
 @skipIf(archs=no_match(["aarch64", "arm64", "arm64e"]))
 
 # The static linker in Xcode 15.0-15.2 on macOS 14 will mislink



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


[Lldb-commits] [lldb] [lldb][NFC] Split RegisterContextUnwind::SavedLocationForRegister (PR #139817)

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

jasonmolenda wrote:

to be clear: The diff for the first half of the old SavedLocationForRegister is 
entirely pointless to look at.  Reading 
RegisterContextUnwind::GetAbstractRegisterLocation in the "new" version of the 
file is the way to go, and I'm pretty comfortable with everything that I've 
kept in here, I think the behaviors are easy to reason as correct when I read 
it.

The diff for the second half -- taking an AbstractRegisterLocation and 
converting it into a ConcreteRegisterLocation -- involved very few changes and 
is readable.

I've run it through our testsuite on macOS and it shows no issues, but I look 
forward to all the CI bots getting their hands on it & seeing that result 
confirmed.

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


[Lldb-commits] [lldb] [lldb][NFC] Split RegisterContextUnwind::SavedLocationForRegister (PR #139817)

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

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

>From e63e53adc0909f481a165eca958a3ac2ca4374ee Mon Sep 17 00:00:00 2001
From: Jason Molenda 
Date: Tue, 13 May 2025 17:11:08 -0700
Subject: [PATCH 1/4] [lldb][NFC] Split
 RegisterContextUnwind::SavedLocationForRegister

RegisterContextUnwind::SavedLocationForRegister is around 450 lines
that first find an abstract register location (e.g. "CFA-8") for a
register by looking in the UnwindPlans.  Then it evaluates the
abstract register location to create a concrete register location
(e.g. "stored at address 0x...", "live in register at frame 0").
There are some complicated cases in the first half of the method
to handle return address register architectures correctly, in
particular.

Looking at the two halves, they're both exactly 226 lines long and
there's little involvement between them except for passing an
abstract register location along.

(there were some parts in the "abstract register location" code
that would set the concrete register location, unnecessarily)

It's also a complex enough method that there are some bits of code
that aren't actually doing anything at this point.

This patch adds a RegisterContextUnwind::GetAbstractRegisterLocation
method, which does the first half, and has a clearly defined return
values.

The code to convert an AbstractRegisterLocation into a
ConcreteRegisterLocation remains in SavedLocationForRegister.

It's a bit of a tricky patch to visually inspect, despite it not
changing functionality, the reorganizations and rewrites make the
diff unreadable.  Nearly all the real changes are in the
"find the abstract register location" first half of the method.
I think reading the new code in its new form is the easiest way
to inspect this PR.  With a defined interface between the two of
what is expected, it's pretty easy to look at the code and reason
about whether it is written correctly.

(whereas before, that was very difficult, for me at least.)
---
 .../lldb/Target/RegisterContextUnwind.h   |   3 +
 lldb/source/Target/RegisterContextUnwind.cpp  | 530 +-
 lldb/source/Target/RegisterNumber.cpp |   1 +
 3 files changed, 259 insertions(+), 275 deletions(-)

diff --git a/lldb/include/lldb/Target/RegisterContextUnwind.h 
b/lldb/include/lldb/Target/RegisterContextUnwind.h
index 044a387fe5aa2..b10a364823b83 100644
--- a/lldb/include/lldb/Target/RegisterContextUnwind.h
+++ b/lldb/include/lldb/Target/RegisterContextUnwind.h
@@ -151,6 +151,9 @@ class RegisterContextUnwind : public 
lldb_private::RegisterContext {
   uint32_t lldb_regnum,
   lldb_private::UnwindLLDB::ConcreteRegisterLocation ®loc);
 
+  std::optional
+  GetAbstractRegisterLocation(uint32_t lldb_regnum, lldb::RegisterKind &kind);
+
   bool ReadRegisterValueFromRegisterLocation(
   lldb_private::UnwindLLDB::ConcreteRegisterLocation regloc,
   const lldb_private::RegisterInfo *reg_info,
diff --git a/lldb/source/Target/RegisterContextUnwind.cpp 
b/lldb/source/Target/RegisterContextUnwind.cpp
index cf4b96c6eda9f..a3931abefb054 100644
--- a/lldb/source/Target/RegisterContextUnwind.cpp
+++ b/lldb/source/Target/RegisterContextUnwind.cpp
@@ -1243,247 +1243,194 @@ bool RegisterContextUnwind::IsTrapHandlerSymbol(
   return false;
 }
 
-// Answer the question: Where did THIS frame save the CALLER frame ("previous"
-// frame)'s register value?
-
-enum UnwindLLDB::RegisterSearchResult
-RegisterContextUnwind::SavedLocationForRegister(
-uint32_t lldb_regnum,
-lldb_private::UnwindLLDB::ConcreteRegisterLocation ®loc) {
+// Search this stack frame's UnwindPlans for the AbstractRegisterLocation
+// for this register.
+//
+// When an AbstractRegisterLocation is found in an UnwindPlan, that is
+// returned, regardless of the ABI rules for volatile/non-volatile registers
+// in effect.
+//
+// If there is no unwind rule for a volatile (caller-preserved) register
+// the returned AbstractRegisterLocation will be IsUndefined,
+// indicating that we should stop searching.
+//
+// If there is no unwind rule for a non-volatile (callee-preserved)
+// register, the returned AbstractRegisterLocation will be IsSame.
+// In frame 0, IsSame means get the  value from the live register context.
+// Else it means to continue descending down the stack to more-live frames
+// looking for a location/value.
+//
+// An empty optional indicates that there was an error in processing.
+std::optional
+RegisterContextUnwind::GetAbstractRegisterLocation(uint32_t lldb_regnum,
+   lldb::RegisterKind &kind) {
   RegisterNumber regnum(m_thread, eRegisterKindLLDB, lldb_regnum);
   Log *log = GetLog(LLDBLog::Unwind);
 
-  // Have we already found this register location?
-  if (!m_registers.empty()) {
-std::map::const_iterator
-iterator;
-iterator = m_registers.find(regnum.GetAsKind(eRegisterKindLLDB));
-if (iterator != m_registers.end()) {
-  regloc = iterator

[Lldb-commits] [lldb] [lldb-dap] Add unit test for capabilities (PR #139835)

2025-05-13 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)


Changes

Add unit a test for the capabilities types.

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


3 Files Affected:

- (modified) lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp (+130) 
- (modified) lldb/tools/lldb-dap/Protocol/ProtocolTypes.h (+8-1) 
- (modified) lldb/unittests/DAP/ProtocolTypesTest.cpp (+97) 


``diff
diff --git a/lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp 
b/lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp
index 8d95687e00e53..fafd061334bc9 100644
--- a/lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp
+++ b/lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp
@@ -165,6 +165,32 @@ json::Value toJSON(const ChecksumAlgorithm &CA) {
   llvm_unreachable("unhandled checksum algorithm.");
 }
 
+bool fromJSON(const llvm::json::Value &Params, ChecksumAlgorithm &CA,
+  llvm::json::Path P) {
+  auto rawAlgorithm = Params.getAsString();
+  if (!rawAlgorithm) {
+P.report("expected a string");
+return false;
+  }
+
+  std::optional algorithm =
+  llvm::StringSwitch>(*rawAlgorithm)
+  .Case("MD5", eChecksumAlgorithmMD5)
+  .Case("SHA1", eChecksumAlgorithmSHA1)
+  .Case("SHA256", eChecksumAlgorithmSHA256)
+  .Case("timestamp", eChecksumAlgorithmTimestamp)
+  .Default(std::nullopt);
+
+  if (!algorithm) {
+P.report(
+"unexpected value, expected 'MD5', 'SHA1', 'SHA256', or 'timestamp'");
+return false;
+  }
+
+  CA = *algorithm;
+  return true;
+}
+
 json::Value toJSON(const BreakpointModeApplicability &BMA) {
   switch (BMA) {
   case eBreakpointModeApplicabilitySource:
@@ -304,6 +330,84 @@ static llvm::StringLiteral ToString(AdapterFeature 
feature) {
   llvm_unreachable("unhandled adapter feature.");
 }
 
+llvm::json::Value toJSON(const AdapterFeature &feature) {
+  return ToString(feature);
+}
+
+bool fromJSON(const llvm::json::Value &Params, AdapterFeature &feature,
+  llvm::json::Path P) {
+  auto rawFeature = Params.getAsString();
+  if (!rawFeature) {
+P.report("expected a string");
+return false;
+  }
+
+  std::optional parsedFeature =
+  llvm::StringSwitch>(*rawFeature)
+  .Case("supportsANSIStyling", eAdapterFeatureANSIStyling)
+  .Case("supportsBreakpointLocationsRequest",
+eAdapterFeatureBreakpointLocationsRequest)
+  .Case("supportsCancelRequest", eAdapterFeatureCancelRequest)
+  .Case("supportsClipboardContext", eAdapterFeatureClipboardContext)
+  .Case("supportsCompletionsRequest", 
eAdapterFeatureCompletionsRequest)
+  .Case("supportsConditionalBreakpoints",
+eAdapterFeatureConditionalBreakpoints)
+  .Case("supportsConfigurationDoneRequest",
+eAdapterFeatureConfigurationDoneRequest)
+  .Case("supportsDataBreakpointBytes",
+eAdapterFeatureDataBreakpointBytes)
+  .Case("supportsDataBreakpoints", eAdapterFeatureDataBreakpoints)
+  .Case("supportsDelayedStackTraceLoading",
+eAdapterFeatureDelayedStackTraceLoading)
+  .Case("supportsDisassembleRequest", 
eAdapterFeatureDisassembleRequest)
+  .Case("supportsEvaluateForHovers", eAdapterFeatureEvaluateForHovers)
+  .Case("supportsExceptionFilterOptions",
+eAdapterFeatureExceptionFilterOptions)
+  .Case("supportsExceptionInfoRequest",
+eAdapterFeatureExceptionInfoRequest)
+  .Case("supportsExceptionOptions", eAdapterFeatureExceptionOptions)
+  .Case("supportsFunctionBreakpoints",
+eAdapterFeatureFunctionBreakpoints)
+  .Case("supportsGotoTargetsRequest", 
eAdapterFeatureGotoTargetsRequest)
+  .Case("supportsHitConditionalBreakpoints",
+eAdapterFeatureHitConditionalBreakpoints)
+  .Case("supportsInstructionBreakpoints",
+eAdapterFeatureInstructionBreakpoints)
+  .Case("supportsLoadedSourcesRequest",
+eAdapterFeatureLoadedSourcesRequest)
+  .Case("supportsLogPoints", eAdapterFeatureLogPoints)
+  .Case("supportsModulesRequest", eAdapterFeatureModulesRequest)
+  .Case("supportsReadMemoryRequest", eAdapterFeatureReadMemoryRequest)
+  .Case("supportsRestartFrame", eAdapterFeatureRestartFrame)
+  .Case("supportsRestartRequest", eAdapterFeatureRestartRequest)
+  .Case("supportsSetExpression", eAdapterFeatureSetExpression)
+  .Case("supportsSetVariable", eAdapterFeatureSetVariable)
+  .Case("supportsSingleThreadExecutionRequests",
+eAdapterFeatureSingleThreadExecutionRequests)
+  .Case("supportsStepBack", eAdapterFeatureStepBack)
+  .Case("supportsStepInTargetsRequest",
+eAdapterFeatureStepInTargetsRequest)
+  .Case("supportsSteppingGranularity",
+eAdapterFeatureSteppingGran

[Lldb-commits] [lldb] [lldb-dap] Add unit test for capabilities (PR #139835)

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

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

Add unit a test for the capabilities types.



  



Rate limit · GitHub


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

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

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

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

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

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

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


  
  



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

  

  

  

  

  


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


[Lldb-commits] [lldb] [lldb][AIX] Adding NativeThreadAIX (PR #139537)

2025-05-13 Thread Dhruv Srivastava via lldb-commits

https://github.com/DhruvSrivastavaX updated 
https://github.com/llvm/llvm-project/pull/139537

>From 05aef7d40097d9a554c648fa2be75530f23ca05c Mon Sep 17 00:00:00 2001
From: DhruvSrivastavaX 
Date: Mon, 12 May 2025 03:23:49 -0500
Subject: [PATCH 1/2] Added NativeThreadAIX

---
 .../source/Plugins/Process/AIX/CMakeLists.txt |  1 +
 .../Plugins/Process/AIX/NativeThreadAIX.cpp   | 71 +++
 .../Plugins/Process/AIX/NativeThreadAIX.h | 53 ++
 3 files changed, 125 insertions(+)
 create mode 100644 lldb/source/Plugins/Process/AIX/NativeThreadAIX.cpp
 create mode 100644 lldb/source/Plugins/Process/AIX/NativeThreadAIX.h

diff --git a/lldb/source/Plugins/Process/AIX/CMakeLists.txt 
b/lldb/source/Plugins/Process/AIX/CMakeLists.txt
index 9a3c77bd2ffeb..911f30349ef52 100644
--- a/lldb/source/Plugins/Process/AIX/CMakeLists.txt
+++ b/lldb/source/Plugins/Process/AIX/CMakeLists.txt
@@ -1,5 +1,6 @@
 add_lldb_library(lldbPluginProcessAIX
   NativeProcessAIX.cpp
+  NativeThreadAIX.cpp
 
   LINK_LIBS
 lldbCore
diff --git a/lldb/source/Plugins/Process/AIX/NativeThreadAIX.cpp 
b/lldb/source/Plugins/Process/AIX/NativeThreadAIX.cpp
new file mode 100644
index 0..c9593fbf08441
--- /dev/null
+++ b/lldb/source/Plugins/Process/AIX/NativeThreadAIX.cpp
@@ -0,0 +1,71 @@
+//===-- NativeThreadAIX.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 "NativeThreadAIX.h"
+#include "NativeProcessAIX.h"
+#include "lldb/Utility/State.h"
+#include 
+#include 
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace lldb_private::process_aix;
+
+NativeThreadAIX::NativeThreadAIX(NativeProcessAIX &process, lldb::tid_t tid)
+: NativeThreadProtocol(process, tid), m_state(StateType::eStateInvalid) {}
+
+std::string NativeThreadAIX::GetName() {
+  NativeProcessAIX &process = GetProcess();
+  auto BufferOrError = getProcFile(process.GetID(), "psinfo");
+  if (!BufferOrError)
+return "";
+  auto &Buffer = *BufferOrError;
+  if (Buffer->getBufferSize() < sizeof(psinfo_t))
+return "";
+  const psinfo_t *psinfo =
+  reinterpret_cast(Buffer->getBufferStart());
+  return std::string(psinfo->pr_fname);
+}
+
+lldb::StateType NativeThreadAIX::GetState() { return m_state; }
+
+bool NativeThreadAIX::GetStopReason(ThreadStopInfo &stop_info,
+std::string &description) {
+  return false;
+}
+
+Status NativeThreadAIX::SetWatchpoint(lldb::addr_t addr, size_t size,
+  uint32_t watch_flags, bool hardware) {
+  return Status();
+}
+
+Status NativeThreadAIX::RemoveWatchpoint(lldb::addr_t addr) {
+  return Status("Clearing hardware watchpoint failed.");
+}
+
+Status NativeThreadAIX::SetHardwareBreakpoint(lldb::addr_t addr, size_t size) {
+  return Status();
+}
+
+Status NativeThreadAIX::RemoveHardwareBreakpoint(lldb::addr_t addr) {
+  return Status("Clearing hardware breakpoint failed.");
+}
+
+NativeProcessAIX &NativeThreadAIX::GetProcess() {
+  return static_cast(m_process);
+}
+
+const NativeProcessAIX &NativeThreadAIX::GetProcess() const {
+  return static_cast(m_process);
+}
+
+llvm::Expected>
+NativeThreadAIX::GetSiginfo() const {
+  return llvm::createStringError(llvm::inconvertibleErrorCode(),
+ "Not implemented");
+}
diff --git a/lldb/source/Plugins/Process/AIX/NativeThreadAIX.h 
b/lldb/source/Plugins/Process/AIX/NativeThreadAIX.h
new file mode 100644
index 0..e32d3db2c5fa2
--- /dev/null
+++ b/lldb/source/Plugins/Process/AIX/NativeThreadAIX.h
@@ -0,0 +1,53 @@
+//===-- NativeThreadAIX.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_SOURCE_PLUGINS_PROCESS_AIX_NATIVETHREADAIX_H_
+#define LLDB_SOURCE_PLUGINS_PROCESS_AIX_NATIVETHREADAIX_H_
+
+#include "lldb/Host/common/NativeThreadProtocol.h"
+
+namespace lldb_private::process_aix {
+
+class NativeProcessAIX;
+
+class NativeThreadAIX : public NativeThreadProtocol {
+  friend class NativeProcessAIX;
+
+public:
+  NativeThreadAIX(NativeProcessAIX &process, lldb::tid_t tid);
+
+  // NativeThreadProtocol Interface
+  std::string GetName() override;
+
+  lldb::StateType GetState() override;
+
+  bool GetStopReason(ThreadStopInfo &stop_info,
+ std::string &description) override;
+
+  Status SetWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags,
+   bool hardware) overrid

[Lldb-commits] [lldb] [lldb][AIX] Adding NativeThreadAIX (PR #139537)

2025-05-13 Thread Dhruv Srivastava via lldb-commits

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


[Lldb-commits] [lldb] [lldb][AIX] Adding NativeThreadAIX (PR #139537)

2025-05-13 Thread Dhruv Srivastava via lldb-commits

https://github.com/DhruvSrivastavaX edited 
https://github.com/llvm/llvm-project/pull/139537
___
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 unit test for protocol enum types (PR #139848)

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


@@ -105,7 +105,7 @@ bool fromJSON(const json::Value &Params, ColumnType &CT, 
json::Path P) {
   .Case("string", eColumnTypeString)
   .Case("number", eColumnTypeNumber)
   .Case("boolean", eColumnTypeBoolean)
-  .Case("unixTimestampUTC ", eColumnTypeTimestamp)
+  .Case("unixTimestampUTC", eColumnTypeTimestamp)

JDevlieghere wrote:

My unit test found an actual bug/typo :-) 

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


[Lldb-commits] [lldb] [lldb][NFC] Split RegisterContextUnwind::SavedLocationForRegister (PR #139817)

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

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

>From e63e53adc0909f481a165eca958a3ac2ca4374ee Mon Sep 17 00:00:00 2001
From: Jason Molenda 
Date: Tue, 13 May 2025 17:11:08 -0700
Subject: [PATCH 1/6] [lldb][NFC] Split
 RegisterContextUnwind::SavedLocationForRegister

RegisterContextUnwind::SavedLocationForRegister is around 450 lines
that first find an abstract register location (e.g. "CFA-8") for a
register by looking in the UnwindPlans.  Then it evaluates the
abstract register location to create a concrete register location
(e.g. "stored at address 0x...", "live in register at frame 0").
There are some complicated cases in the first half of the method
to handle return address register architectures correctly, in
particular.

Looking at the two halves, they're both exactly 226 lines long and
there's little involvement between them except for passing an
abstract register location along.

(there were some parts in the "abstract register location" code
that would set the concrete register location, unnecessarily)

It's also a complex enough method that there are some bits of code
that aren't actually doing anything at this point.

This patch adds a RegisterContextUnwind::GetAbstractRegisterLocation
method, which does the first half, and has a clearly defined return
values.

The code to convert an AbstractRegisterLocation into a
ConcreteRegisterLocation remains in SavedLocationForRegister.

It's a bit of a tricky patch to visually inspect, despite it not
changing functionality, the reorganizations and rewrites make the
diff unreadable.  Nearly all the real changes are in the
"find the abstract register location" first half of the method.
I think reading the new code in its new form is the easiest way
to inspect this PR.  With a defined interface between the two of
what is expected, it's pretty easy to look at the code and reason
about whether it is written correctly.

(whereas before, that was very difficult, for me at least.)
---
 .../lldb/Target/RegisterContextUnwind.h   |   3 +
 lldb/source/Target/RegisterContextUnwind.cpp  | 530 +-
 lldb/source/Target/RegisterNumber.cpp |   1 +
 3 files changed, 259 insertions(+), 275 deletions(-)

diff --git a/lldb/include/lldb/Target/RegisterContextUnwind.h 
b/lldb/include/lldb/Target/RegisterContextUnwind.h
index 044a387fe5aa2..b10a364823b83 100644
--- a/lldb/include/lldb/Target/RegisterContextUnwind.h
+++ b/lldb/include/lldb/Target/RegisterContextUnwind.h
@@ -151,6 +151,9 @@ class RegisterContextUnwind : public 
lldb_private::RegisterContext {
   uint32_t lldb_regnum,
   lldb_private::UnwindLLDB::ConcreteRegisterLocation ®loc);
 
+  std::optional
+  GetAbstractRegisterLocation(uint32_t lldb_regnum, lldb::RegisterKind &kind);
+
   bool ReadRegisterValueFromRegisterLocation(
   lldb_private::UnwindLLDB::ConcreteRegisterLocation regloc,
   const lldb_private::RegisterInfo *reg_info,
diff --git a/lldb/source/Target/RegisterContextUnwind.cpp 
b/lldb/source/Target/RegisterContextUnwind.cpp
index cf4b96c6eda9f..a3931abefb054 100644
--- a/lldb/source/Target/RegisterContextUnwind.cpp
+++ b/lldb/source/Target/RegisterContextUnwind.cpp
@@ -1243,247 +1243,194 @@ bool RegisterContextUnwind::IsTrapHandlerSymbol(
   return false;
 }
 
-// Answer the question: Where did THIS frame save the CALLER frame ("previous"
-// frame)'s register value?
-
-enum UnwindLLDB::RegisterSearchResult
-RegisterContextUnwind::SavedLocationForRegister(
-uint32_t lldb_regnum,
-lldb_private::UnwindLLDB::ConcreteRegisterLocation ®loc) {
+// Search this stack frame's UnwindPlans for the AbstractRegisterLocation
+// for this register.
+//
+// When an AbstractRegisterLocation is found in an UnwindPlan, that is
+// returned, regardless of the ABI rules for volatile/non-volatile registers
+// in effect.
+//
+// If there is no unwind rule for a volatile (caller-preserved) register
+// the returned AbstractRegisterLocation will be IsUndefined,
+// indicating that we should stop searching.
+//
+// If there is no unwind rule for a non-volatile (callee-preserved)
+// register, the returned AbstractRegisterLocation will be IsSame.
+// In frame 0, IsSame means get the  value from the live register context.
+// Else it means to continue descending down the stack to more-live frames
+// looking for a location/value.
+//
+// An empty optional indicates that there was an error in processing.
+std::optional
+RegisterContextUnwind::GetAbstractRegisterLocation(uint32_t lldb_regnum,
+   lldb::RegisterKind &kind) {
   RegisterNumber regnum(m_thread, eRegisterKindLLDB, lldb_regnum);
   Log *log = GetLog(LLDBLog::Unwind);
 
-  // Have we already found this register location?
-  if (!m_registers.empty()) {
-std::map::const_iterator
-iterator;
-iterator = m_registers.find(regnum.GetAsKind(eRegisterKindLLDB));
-if (iterator != m_registers.end()) {
-  regloc = iterator

[Lldb-commits] [lldb] [lldb] Fix typos in documentation (PR #139839)

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

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


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


[Lldb-commits] [lldb] [lldb][AIX] Adding NativeThreadAIX (PR #139537)

2025-05-13 Thread Dhruv Srivastava via lldb-commits

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


[Lldb-commits] [lldb] [lldb][AIX] Adding NativeThreadAIX (PR #139537)

2025-05-13 Thread Dhruv Srivastava via lldb-commits


@@ -0,0 +1,71 @@
+//===-- NativeThreadAIX.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 "NativeThreadAIX.h"
+#include "NativeProcessAIX.h"
+#include "lldb/Utility/State.h"
+#include 
+#include 
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace lldb_private::process_aix;
+
+NativeThreadAIX::NativeThreadAIX(NativeProcessAIX &process, lldb::tid_t tid)
+: NativeThreadProtocol(process, tid), m_state(StateType::eStateInvalid) {}
+
+std::string NativeThreadAIX::GetName() {
+  NativeProcessAIX &process = GetProcess();
+  auto BufferOrError = getProcFile(process.GetID(), "psinfo");
+  if (!BufferOrError)
+return "";
+  auto &Buffer = *BufferOrError;
+  if (Buffer->getBufferSize() < sizeof(psinfo_t))
+return "";
+  const psinfo_t *psinfo =
+  reinterpret_cast(Buffer->getBufferStart());
+  return std::string(psinfo->pr_fname);
+}
+
+lldb::StateType NativeThreadAIX::GetState() { return m_state; }
+
+bool NativeThreadAIX::GetStopReason(ThreadStopInfo &stop_info,
+std::string &description) {
+  return false;
+}
+
+Status NativeThreadAIX::SetWatchpoint(lldb::addr_t addr, size_t size,
+  uint32_t watch_flags, bool hardware) {
+  return Status();

DhruvSrivastavaX wrote:

Done.

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


[Lldb-commits] [lldb] [lldb][NFC] Split RegisterContextUnwind::SavedLocationForRegister (PR #139817)

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

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

>From e63e53adc0909f481a165eca958a3ac2ca4374ee Mon Sep 17 00:00:00 2001
From: Jason Molenda 
Date: Tue, 13 May 2025 17:11:08 -0700
Subject: [PATCH 1/5] [lldb][NFC] Split
 RegisterContextUnwind::SavedLocationForRegister

RegisterContextUnwind::SavedLocationForRegister is around 450 lines
that first find an abstract register location (e.g. "CFA-8") for a
register by looking in the UnwindPlans.  Then it evaluates the
abstract register location to create a concrete register location
(e.g. "stored at address 0x...", "live in register at frame 0").
There are some complicated cases in the first half of the method
to handle return address register architectures correctly, in
particular.

Looking at the two halves, they're both exactly 226 lines long and
there's little involvement between them except for passing an
abstract register location along.

(there were some parts in the "abstract register location" code
that would set the concrete register location, unnecessarily)

It's also a complex enough method that there are some bits of code
that aren't actually doing anything at this point.

This patch adds a RegisterContextUnwind::GetAbstractRegisterLocation
method, which does the first half, and has a clearly defined return
values.

The code to convert an AbstractRegisterLocation into a
ConcreteRegisterLocation remains in SavedLocationForRegister.

It's a bit of a tricky patch to visually inspect, despite it not
changing functionality, the reorganizations and rewrites make the
diff unreadable.  Nearly all the real changes are in the
"find the abstract register location" first half of the method.
I think reading the new code in its new form is the easiest way
to inspect this PR.  With a defined interface between the two of
what is expected, it's pretty easy to look at the code and reason
about whether it is written correctly.

(whereas before, that was very difficult, for me at least.)
---
 .../lldb/Target/RegisterContextUnwind.h   |   3 +
 lldb/source/Target/RegisterContextUnwind.cpp  | 530 +-
 lldb/source/Target/RegisterNumber.cpp |   1 +
 3 files changed, 259 insertions(+), 275 deletions(-)

diff --git a/lldb/include/lldb/Target/RegisterContextUnwind.h 
b/lldb/include/lldb/Target/RegisterContextUnwind.h
index 044a387fe5aa2..b10a364823b83 100644
--- a/lldb/include/lldb/Target/RegisterContextUnwind.h
+++ b/lldb/include/lldb/Target/RegisterContextUnwind.h
@@ -151,6 +151,9 @@ class RegisterContextUnwind : public 
lldb_private::RegisterContext {
   uint32_t lldb_regnum,
   lldb_private::UnwindLLDB::ConcreteRegisterLocation ®loc);
 
+  std::optional
+  GetAbstractRegisterLocation(uint32_t lldb_regnum, lldb::RegisterKind &kind);
+
   bool ReadRegisterValueFromRegisterLocation(
   lldb_private::UnwindLLDB::ConcreteRegisterLocation regloc,
   const lldb_private::RegisterInfo *reg_info,
diff --git a/lldb/source/Target/RegisterContextUnwind.cpp 
b/lldb/source/Target/RegisterContextUnwind.cpp
index cf4b96c6eda9f..a3931abefb054 100644
--- a/lldb/source/Target/RegisterContextUnwind.cpp
+++ b/lldb/source/Target/RegisterContextUnwind.cpp
@@ -1243,247 +1243,194 @@ bool RegisterContextUnwind::IsTrapHandlerSymbol(
   return false;
 }
 
-// Answer the question: Where did THIS frame save the CALLER frame ("previous"
-// frame)'s register value?
-
-enum UnwindLLDB::RegisterSearchResult
-RegisterContextUnwind::SavedLocationForRegister(
-uint32_t lldb_regnum,
-lldb_private::UnwindLLDB::ConcreteRegisterLocation ®loc) {
+// Search this stack frame's UnwindPlans for the AbstractRegisterLocation
+// for this register.
+//
+// When an AbstractRegisterLocation is found in an UnwindPlan, that is
+// returned, regardless of the ABI rules for volatile/non-volatile registers
+// in effect.
+//
+// If there is no unwind rule for a volatile (caller-preserved) register
+// the returned AbstractRegisterLocation will be IsUndefined,
+// indicating that we should stop searching.
+//
+// If there is no unwind rule for a non-volatile (callee-preserved)
+// register, the returned AbstractRegisterLocation will be IsSame.
+// In frame 0, IsSame means get the  value from the live register context.
+// Else it means to continue descending down the stack to more-live frames
+// looking for a location/value.
+//
+// An empty optional indicates that there was an error in processing.
+std::optional
+RegisterContextUnwind::GetAbstractRegisterLocation(uint32_t lldb_regnum,
+   lldb::RegisterKind &kind) {
   RegisterNumber regnum(m_thread, eRegisterKindLLDB, lldb_regnum);
   Log *log = GetLog(LLDBLog::Unwind);
 
-  // Have we already found this register location?
-  if (!m_registers.empty()) {
-std::map::const_iterator
-iterator;
-iterator = m_registers.find(regnum.GetAsKind(eRegisterKindLLDB));
-if (iterator != m_registers.end()) {
-  regloc = iterator

[Lldb-commits] [lldb] [lldb-dap] Add unit test for capabilities (PR #139835)

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

JDevlieghere wrote:

> Should we also have some tests for invalid enum cases?

Sounds good, let me cover the enum cases in a separate PR.

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


[Lldb-commits] [lldb] ad2f703 - [lldb-dap] Add unit test for capabilities (#139835)

2025-05-13 Thread via lldb-commits

Author: Jonas Devlieghere
Date: 2025-05-13T22:51:03-07:00
New Revision: ad2f7034a2823f2366e55a5758c1c623b9348746

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

LOG: [lldb-dap] Add unit test for capabilities (#139835)

Add unit a test for the capabilities type.

Added: 


Modified: 
lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp
lldb/tools/lldb-dap/Protocol/ProtocolTypes.h
lldb/unittests/DAP/ProtocolTypesTest.cpp

Removed: 




diff  --git a/lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp 
b/lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp
index 8d95687e00e53..fafd061334bc9 100644
--- a/lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp
+++ b/lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp
@@ -165,6 +165,32 @@ json::Value toJSON(const ChecksumAlgorithm &CA) {
   llvm_unreachable("unhandled checksum algorithm.");
 }
 
+bool fromJSON(const llvm::json::Value &Params, ChecksumAlgorithm &CA,
+  llvm::json::Path P) {
+  auto rawAlgorithm = Params.getAsString();
+  if (!rawAlgorithm) {
+P.report("expected a string");
+return false;
+  }
+
+  std::optional algorithm =
+  llvm::StringSwitch>(*rawAlgorithm)
+  .Case("MD5", eChecksumAlgorithmMD5)
+  .Case("SHA1", eChecksumAlgorithmSHA1)
+  .Case("SHA256", eChecksumAlgorithmSHA256)
+  .Case("timestamp", eChecksumAlgorithmTimestamp)
+  .Default(std::nullopt);
+
+  if (!algorithm) {
+P.report(
+"unexpected value, expected 'MD5', 'SHA1', 'SHA256', or 'timestamp'");
+return false;
+  }
+
+  CA = *algorithm;
+  return true;
+}
+
 json::Value toJSON(const BreakpointModeApplicability &BMA) {
   switch (BMA) {
   case eBreakpointModeApplicabilitySource:
@@ -304,6 +330,84 @@ static llvm::StringLiteral ToString(AdapterFeature 
feature) {
   llvm_unreachable("unhandled adapter feature.");
 }
 
+llvm::json::Value toJSON(const AdapterFeature &feature) {
+  return ToString(feature);
+}
+
+bool fromJSON(const llvm::json::Value &Params, AdapterFeature &feature,
+  llvm::json::Path P) {
+  auto rawFeature = Params.getAsString();
+  if (!rawFeature) {
+P.report("expected a string");
+return false;
+  }
+
+  std::optional parsedFeature =
+  llvm::StringSwitch>(*rawFeature)
+  .Case("supportsANSIStyling", eAdapterFeatureANSIStyling)
+  .Case("supportsBreakpointLocationsRequest",
+eAdapterFeatureBreakpointLocationsRequest)
+  .Case("supportsCancelRequest", eAdapterFeatureCancelRequest)
+  .Case("supportsClipboardContext", eAdapterFeatureClipboardContext)
+  .Case("supportsCompletionsRequest", 
eAdapterFeatureCompletionsRequest)
+  .Case("supportsConditionalBreakpoints",
+eAdapterFeatureConditionalBreakpoints)
+  .Case("supportsConfigurationDoneRequest",
+eAdapterFeatureConfigurationDoneRequest)
+  .Case("supportsDataBreakpointBytes",
+eAdapterFeatureDataBreakpointBytes)
+  .Case("supportsDataBreakpoints", eAdapterFeatureDataBreakpoints)
+  .Case("supportsDelayedStackTraceLoading",
+eAdapterFeatureDelayedStackTraceLoading)
+  .Case("supportsDisassembleRequest", 
eAdapterFeatureDisassembleRequest)
+  .Case("supportsEvaluateForHovers", eAdapterFeatureEvaluateForHovers)
+  .Case("supportsExceptionFilterOptions",
+eAdapterFeatureExceptionFilterOptions)
+  .Case("supportsExceptionInfoRequest",
+eAdapterFeatureExceptionInfoRequest)
+  .Case("supportsExceptionOptions", eAdapterFeatureExceptionOptions)
+  .Case("supportsFunctionBreakpoints",
+eAdapterFeatureFunctionBreakpoints)
+  .Case("supportsGotoTargetsRequest", 
eAdapterFeatureGotoTargetsRequest)
+  .Case("supportsHitConditionalBreakpoints",
+eAdapterFeatureHitConditionalBreakpoints)
+  .Case("supportsInstructionBreakpoints",
+eAdapterFeatureInstructionBreakpoints)
+  .Case("supportsLoadedSourcesRequest",
+eAdapterFeatureLoadedSourcesRequest)
+  .Case("supportsLogPoints", eAdapterFeatureLogPoints)
+  .Case("supportsModulesRequest", eAdapterFeatureModulesRequest)
+  .Case("supportsReadMemoryRequest", eAdapterFeatureReadMemoryRequest)
+  .Case("supportsRestartFrame", eAdapterFeatureRestartFrame)
+  .Case("supportsRestartRequest", eAdapterFeatureRestartRequest)
+  .Case("supportsSetExpression", eAdapterFeatureSetExpression)
+  .Case("supportsSetVariable", eAdapterFeatureSetVariable)
+  .Case("supportsSingleThreadExecutionRequests",
+eAdapterFeatureSingleThreadExecutionRequests)
+  .Case("supportsS

[Lldb-commits] [lldb] [lldb-dap] Add unit test for protocol enum types (PR #139848)

2025-05-13 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)


Changes

Add dedicated unit tests for the protocol enum types.

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


3 Files Affected:

- (modified) lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp (+13-1) 
- (modified) lldb/tools/lldb-dap/Protocol/ProtocolTypes.h (+1) 
- (modified) lldb/unittests/DAP/ProtocolTypesTest.cpp (+198) 


``diff
diff --git a/lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp 
b/lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp
index fafd061334bc9..857503b3a0084 100644
--- a/lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp
+++ b/lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp
@@ -105,7 +105,7 @@ bool fromJSON(const json::Value &Params, ColumnType &CT, 
json::Path P) {
   .Case("string", eColumnTypeString)
   .Case("number", eColumnTypeNumber)
   .Case("boolean", eColumnTypeBoolean)
-  .Case("unixTimestampUTC ", eColumnTypeTimestamp)
+  .Case("unixTimestampUTC", eColumnTypeTimestamp)
   .Default(std::nullopt);
   if (!columnType) {
 P.report("unexpected value, expected 'string', 'number',  'boolean', or "
@@ -482,6 +482,18 @@ bool fromJSON(const llvm::json::Value &Params, 
SteppingGranularity &SG,
   return true;
 }
 
+llvm::json::Value toJSON(const SteppingGranularity &SG) {
+  switch (SG) {
+  case eSteppingGranularityStatement:
+return "statement";
+  case eSteppingGranularityLine:
+return "line";
+  case eSteppingGranularityInstruction:
+return "instruction";
+  }
+  llvm_unreachable("unhandled stepping granularity.");
+}
+
 bool fromJSON(const llvm::json::Value &Params, ValueFormat &VF,
   llvm::json::Path P) {
   json::ObjectMapper O(Params, P);
diff --git a/lldb/tools/lldb-dap/Protocol/ProtocolTypes.h 
b/lldb/tools/lldb-dap/Protocol/ProtocolTypes.h
index f8d2b35ce3e14..757037a7b6ed2 100644
--- a/lldb/tools/lldb-dap/Protocol/ProtocolTypes.h
+++ b/lldb/tools/lldb-dap/Protocol/ProtocolTypes.h
@@ -339,6 +339,7 @@ enum SteppingGranularity : unsigned {
 };
 bool fromJSON(const llvm::json::Value &, SteppingGranularity &,
   llvm::json::Path);
+llvm::json::Value toJSON(const SteppingGranularity &);
 
 /// Provides formatting information for a value.
 struct ValueFormat {
diff --git a/lldb/unittests/DAP/ProtocolTypesTest.cpp 
b/lldb/unittests/DAP/ProtocolTypesTest.cpp
index fd3e3be073183..d97bbaffa2bc0 100644
--- a/lldb/unittests/DAP/ProtocolTypesTest.cpp
+++ b/lldb/unittests/DAP/ProtocolTypesTest.cpp
@@ -291,3 +291,201 @@ TEST(ProtocolTypesTest, Capabilities) {
   EXPECT_EQ(capabilities.lldbExtVersion,
 deserialized_capabilities->lldbExtVersion);
 }
+
+TEST(ProtocolTypesTest, PresentationHint) {
+  // Test all PresentationHint values.
+  std::vector> test_cases = {
+  {ePresentationHintNormal, "normal"},
+  {ePresentationHintEmphasize, "emphasize"},
+  {ePresentationHintDeemphasize, "deemphasize"}};
+
+  for (const auto &test_case : test_cases) {
+// Serialize the PresentationHint to JSON.
+llvm::json::Value serialized = toJSON(test_case.first);
+ASSERT_EQ(serialized.kind(), llvm::json::Value::Kind::String);
+EXPECT_EQ(serialized.getAsString(), test_case.second);
+
+// Deserialize the JSON back to PresentationHint.
+PresentationHint deserialized;
+llvm::json::Path::Root root;
+ASSERT_TRUE(fromJSON(serialized, deserialized, root))
+<< llvm::toString(root.getError());
+EXPECT_EQ(deserialized, test_case.first);
+  }
+
+  // Test invalid value.
+  llvm::json::Value invalid_value = "invalid_hint";
+  PresentationHint deserialized_invalid;
+  llvm::json::Path::Root root;
+  EXPECT_FALSE(fromJSON(invalid_value, deserialized_invalid, root));
+}
+
+TEST(ProtocolTypesTest, SteppingGranularity) {
+  // Test all SteppingGranularity values.
+  std::vector> test_cases = {
+  {eSteppingGranularityStatement, "statement"},
+  {eSteppingGranularityLine, "line"},
+  {eSteppingGranularityInstruction, "instruction"}};
+
+  for (const auto &test_case : test_cases) {
+// Serialize the SteppingGranularity to JSON.
+llvm::json::Value serialized = toJSON(test_case.first);
+ASSERT_EQ(serialized.kind(), llvm::json::Value::Kind::String);
+EXPECT_EQ(serialized.getAsString(), test_case.second);
+
+// Deserialize the JSON back to SteppingGranularity.
+SteppingGranularity deserialized;
+llvm::json::Path::Root root;
+ASSERT_TRUE(fromJSON(serialized, deserialized, root))
+<< llvm::toString(root.getError());
+EXPECT_EQ(deserialized, test_case.first);
+  }
+
+  // Test invalid value.
+  llvm::json::Value invalid_value = "invalid_granularity";
+  SteppingGranularity deserialized_invalid;
+  llvm::json::Path::Root root;
+  EXPECT_FALSE(fromJSON(invalid_value, deserialized_invalid, root));
+}
+
+TEST(ProtocolTypesTest, BreakpointReason) {
+  // Test all BreakpointReason values.
+  std::vector> test_cases = {
+ 

[Lldb-commits] [lldb] [lldb-dap] Add unit test for protocol enum types (PR #139848)

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

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

Add dedicated unit tests for the protocol enum types.



  



Rate limit · GitHub


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

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

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

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

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

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

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


  
  



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

  

  

  

  

  


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


[Lldb-commits] [lldb] [lldb-dap] Add unit test for capabilities (PR #139835)

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

https://github.com/JDevlieghere closed 
https://github.com/llvm/llvm-project/pull/139835
___
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 unit test for protocol enum types (PR #139848)

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

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

LGTM!

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


[Lldb-commits] [lldb] bdf8c99 - [lldb] Fix typos in documentation (#139839)

2025-05-13 Thread via lldb-commits

Author: Kazu Hirata
Date: 2025-05-13T23:34:28-07:00
New Revision: bdf8c9984ae325b9934ec6051a853a29830af9e2

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

LOG: [lldb] Fix typos in documentation (#139839)

Added: 


Modified: 
lldb/docs/resources/build.rst
lldb/docs/resources/contributing.rst
lldb/docs/resources/debugging.rst
lldb/docs/resources/qemu-testing.rst
lldb/docs/use/variable.rst

Removed: 




diff  --git a/lldb/docs/resources/build.rst b/lldb/docs/resources/build.rst
index e59dcc1972418..480430fede928 100644
--- a/lldb/docs/resources/build.rst
+++ b/lldb/docs/resources/build.rst
@@ -100,7 +100,7 @@ Windows
 * The Active Template Library (ATL).
 * `GnuWin32 `_ for CoreUtils and Make.
 * `Python 3 `_.  Make sure to (1) 
get
-  the x64 variant if that's what you're targetting and (2) install the debug
+  the x64 variant if that's what you're targeting and (2) install the debug
   library if you want to build a debug lldb. The standalone installer is the
   easiest way to get the debug library.
 * `Python Tools for Visual Studio

diff  --git a/lldb/docs/resources/contributing.rst 
b/lldb/docs/resources/contributing.rst
index d3d467533c9ea..48fd000765f66 100644
--- a/lldb/docs/resources/contributing.rst
+++ b/lldb/docs/resources/contributing.rst
@@ -39,7 +39,7 @@ in a few ways. The 2 main ones are:
 * `Use of asserts 
`_:
   See the :ref:`section below`.
 
-For any other contradications, consider the
+For any other contradictions, consider the
 `golden rule `_
 before choosing to update the style of existing code.
 

diff  --git a/lldb/docs/resources/debugging.rst 
b/lldb/docs/resources/debugging.rst
index ba23759b44cf5..ee3e45a49cbde 100644
--- a/lldb/docs/resources/debugging.rst
+++ b/lldb/docs/resources/debugging.rst
@@ -130,7 +130,7 @@ The inferior will stop, you place the breakpoint and then 
``continue``. Go back
 to the inferior and input the command that should trigger the breakpoint.
 
 If you are running debugger and inferior in the same window, input ``ctrl+c``
-instead of ``process interrupt`` and then folllow the rest of the steps.
+instead of ``process interrupt`` and then follow the rest of the steps.
 
 If you are doing this with ``lldb-server`` and find your breakpoint is never
 hit, check that you are breaking in code that is actually run by
@@ -187,7 +187,7 @@ predictable way, or change the prompt of one or both copies 
of ``lldb``.
 If you are debugging a scenario where the ``lldb-server`` starts in 
``platform``
 mode, but you want to debug the ``gdbserver`` mode you'll have to work out what
 subprocess it's starting for the ``gdbserver`` part. One way is to look at the
-list of runninng processes and take the command line from there.
+list of running processes and take the command line from there.
 
 In theory it should be possible to use LLDB's
 ``target.process.follow-fork-mode`` or GDB's ``follow-fork-mode`` to
@@ -387,8 +387,8 @@ an issue or asking for help. This is simply inspiration.
 Reduction
 *
 
-The first step is to reduce uneeded compexity where it is cheap to do so. If
-something is easily removed or frozen to a cerain value, do so. The goal is to
+The first step is to reduce unneeded complexity where it is cheap to do so. If
+something is easily removed or frozen to a certain value, do so. The goal is to
 keep the failure mode the same, with fewer dependencies.
 
 This includes, but is not limited to:
@@ -396,11 +396,11 @@ This includes, but is not limited to:
 * Removing test cases that don't crash.
 * Replacing dynamic lookups with constant values.
 * Replace supporting functions with stubs that do nothing.
-* Moving the test case to less unqiue system. If your machine has an exotic
+* Moving the test case to less unique system. If your machine has an exotic
   extension, try it on a readily available commodity machine.
 * Removing irrelevant parts of the test program.
 * Reproducing the issue without using the LLDB test runner.
-* Converting a remote debuging scenario into a local one.
+* Converting a remote debugging scenario into a local one.
 
 Now we hopefully have a smaller reproducer than we started with. Next we need 
to
 find out what components of the software stack might be failing.
@@ -578,14 +578,14 @@ Doing it this way instead of exactly copying what LLDB 
does will save a few
 ptrace calls. The AArch64 example program shows how to do this.
 
 * The inferior contains ``BRK #0`` then ``NOP``.
-* 2 4 byte instructins means 8 bytes of data to replace, which matches the
+* 2 4-byte instructions means 8 bytes 

[Lldb-commits] [lldb] [lldb] Fix typos in documentation (PR #139839)

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

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


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


[Lldb-commits] [lldb] [lldb][AIX] Adding NativeThreadAIX (PR #139537)

2025-05-13 Thread Dhruv Srivastava via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Fix typos in documentation (PR #139839)

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

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