[Lldb-commits] [lldb] [LLDB] Add more helper functions to ValueObject class. (PR #87197)

2024-04-22 Thread via lldb-commits

cmtice wrote:

I've now addressed the comments for the "CreateValueObjectFrom..." functions (I 
think).

I will not be able to work on this for the next couple of weeks, but I'll get 
back to it and fix the rest as soon as I can.

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


[Lldb-commits] [lldb] [LLDB] Add more helper functions to ValueObject class. (PR #87197)

2024-04-22 Thread via lldb-commits

https://github.com/cmtice updated 
https://github.com/llvm/llvm-project/pull/87197

>From 68cb68d3f93aed6b3479fb305131b99ec599c9d8 Mon Sep 17 00:00:00 2001
From: Caroline Tice 
Date: Sun, 31 Mar 2024 10:59:38 -0700
Subject: [PATCH 1/3] [LLDB] Add more helper functions to ValueObject class.

Create additional helper functions for the ValueObject class, for:
  - returning the value as an APSInt or APFloat
  - additional type casting options
  - additional ways to create ValueObjects from various types of data
  - dereferencing a ValueObject

These helper functions are needed for implementing the Data Inspection
Language, described in
https://discourse.llvm.org/t/rfc-data-inspection-language/69893
---
 lldb/include/lldb/Core/ValueObject.h |  61 
 lldb/source/Core/ValueObject.cpp | 405 +++
 2 files changed, 466 insertions(+)

diff --git a/lldb/include/lldb/Core/ValueObject.h 
b/lldb/include/lldb/Core/ValueObject.h
index e7e35e2b2bffc0..0c8dbf384a326c 100644
--- a/lldb/include/lldb/Core/ValueObject.h
+++ b/lldb/include/lldb/Core/ValueObject.h
@@ -441,6 +441,19 @@ class ValueObject {
 
   virtual int64_t GetValueAsSigned(int64_t fail_value, bool *success = 
nullptr);
 
+  llvm::APSInt GetValueAsAPSInt();
+
+  llvm::APFloat GetValueAsFloat();
+
+  bool GetValueAsBool();
+
+  /// Update the value of the current object to be the integer in the 'value'
+  /// parameter.
+  void UpdateIntegerValue(const llvm::APInt );
+
+  /// Assign the integer value 'new_val_sp' to the current object.
+  void UpdateIntegerValue(lldb::ValueObjectSP new_val_sp);
+
   virtual bool SetValueFromCString(const char *value_str, Status );
 
   /// Return the module associated with this value object in case the value is
@@ -618,6 +631,24 @@ class ValueObject {
   virtual lldb::ValueObjectSP CastPointerType(const char *name,
   lldb::TypeSP _sp);
 
+  /// Return the target load address assocaited with this value object.
+  lldb::addr_t GetLoadAddress();
+
+  lldb::ValueObjectSP CastDerivedToBaseType(CompilerType type,
+const std::vector );
+
+  lldb::ValueObjectSP CastBaseToDerivedType(CompilerType type, uint64_t 
offset);
+
+  lldb::ValueObjectSP CastScalarToBasicType(CompilerType type, Status );
+
+  lldb::ValueObjectSP CastEnumToBasicType(CompilerType type);
+
+  lldb::ValueObjectSP CastPointerToBasicType(CompilerType type);
+
+  lldb::ValueObjectSP CastIntegerOrEnumToEnumType(CompilerType type);
+
+  lldb::ValueObjectSP CastFloatToEnumType(CompilerType type, Status );
+
   /// If this object represents a C++ class with a vtable, return an object
   /// that represents the virtual function table. If the object isn't a class
   /// with a vtable, return a valid ValueObject with the error set correctly.
@@ -668,6 +699,32 @@ class ValueObject {
   CreateValueObjectFromData(llvm::StringRef name, const DataExtractor ,
 const ExecutionContext _ctx, CompilerType 
type);
 
+  static lldb::ValueObjectSP
+  CreateValueObjectFromBytes(lldb::TargetSP target_sp, const void *bytes,
+ CompilerType type);
+
+  static lldb::ValueObjectSP CreateValueObjectFromBytes(lldb::TargetSP target,
+const void *bytes,
+lldb::BasicType type);
+
+  static lldb::ValueObjectSP CreateValueObjectFromAPInt(lldb::TargetSP target,
+const llvm::APInt ,
+CompilerType type);
+
+  static lldb::ValueObjectSP
+  CreateValueObjectFromAPFloat(lldb::TargetSP target, const llvm::APFloat ,
+   CompilerType type);
+
+  static lldb::ValueObjectSP CreateValueObjectFromPointer(lldb::TargetSP 
target,
+  uintptr_t addr,
+  CompilerType type);
+
+  static lldb::ValueObjectSP CreateValueObjectFromBool(lldb::TargetSP target,
+   bool value);
+
+  static lldb::ValueObjectSP CreateValueObjectFromNullptr(lldb::TargetSP 
target,
+  CompilerType type);
+
   lldb::ValueObjectSP Persist();
 
   /// Returns true if this is a char* or a char[] if it is a char* and
@@ -719,6 +776,10 @@ class ValueObject {
 ClearUserVisibleData(eClearUserVisibleDataItemsSummary);
   }
 
+  void SetDerefValobj(ValueObject *deref) { m_deref_valobj = deref; }
+
+  ValueObject *GetDerefValobj() { return m_deref_valobj; }
+
   void SetValueFormat(lldb::TypeFormatImplSP format) {
 m_type_format_sp = std::move(format);
 ClearUserVisibleData(eClearUserVisibleDataItemsValue);
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp
index 

[Lldb-commits] [lldb] [lldb] Fix typo in CumulativeSystemTimeIsValid check (PR #89680)

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

JDevlieghere wrote:

Can this be tested in `HostTest.cpp`? 

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


[Lldb-commits] [lldb] [lldb] Fix typo in CumulativeSystemTimeIsValid check (PR #89680)

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

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


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


[Lldb-commits] [lldb] [LLDB] Add more helper functions to ValueObject class. (PR #87197)

2024-04-22 Thread via lldb-commits


@@ -668,6 +699,32 @@ class ValueObject {
   CreateValueObjectFromData(llvm::StringRef name, const DataExtractor ,
 const ExecutionContext _ctx, CompilerType 
type);
 
+  static lldb::ValueObjectSP

cmtice wrote:

CreateValueObjectFromBytes was being called from 
CreateValueObjectfrom{APInt,Pointer,Bool,Nullptr}, receivng the pointer to the 
appropriate values in the input parameter, putting the bytes into a 
DataExtractor, then calling CreateValueObjectFromData with the DataExtractor. I 
thought that would handle things like correct endianness, etc.  However, I will 
move the "putting the bytes into the DataExtractor" into the callers for 
CreateValueObjectFromBytes & call CreateValueObjectFromData directly from each 
of them. This leads to a bit of code duplication, but I can see that it's 
safer. (This eliminates the CreateValueObjectFromBytes functions altogether).

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


[Lldb-commits] [lldb] af8445e - [lldb] Replace condition that always evaluates to false (#89685)

2024-04-22 Thread via lldb-commits

Author: Troy Butler
Date: 2024-04-22T20:17:51-07:00
New Revision: af8445e9ce4d9bd74775a68b694957640f29d28a

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

LOG: [lldb] Replace condition that always evaluates to false (#89685)

Addresses issue #87243. 

The current code incorrectly checks the validity of ```obj``` twice when
it should be checking the new ```str_obj``` pointer.

Signed-off-by: Troy-Butler 
Co-authored-by: Troy-Butler 

Added: 


Modified: 
lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp 
b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
index ea0a1cdff40f1e..7c7035e0c86c9e 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
@@ -61,7 +61,7 @@ Expected 
python::As(Expected &) {
   if (!obj)
 return obj.takeError();
   PyObject *str_obj = PyObject_Str(obj.get().get());
-  if (!obj)
+  if (!str_obj)
 return llvm::make_error();
   auto str = Take(str_obj);
   auto utf8 = str.AsUTF8();



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


[Lldb-commits] [lldb] [lldb] Replace condition that always evaluates to false (PR #89685)

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

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


[Lldb-commits] [lldb] [LLDB] Add more helper functions to ValueObject class. (PR #87197)

2024-04-22 Thread via lldb-commits


@@ -668,6 +699,32 @@ class ValueObject {
   CreateValueObjectFromData(llvm::StringRef name, const DataExtractor ,
 const ExecutionContext _ctx, CompilerType 
type);
 
+  static lldb::ValueObjectSP
+  CreateValueObjectFromBytes(lldb::TargetSP target_sp, const void *bytes,
+ CompilerType type);
+
+  static lldb::ValueObjectSP CreateValueObjectFromBytes(lldb::TargetSP target,
+const void *bytes,
+lldb::BasicType type);
+
+  static lldb::ValueObjectSP CreateValueObjectFromAPInt(lldb::TargetSP target,
+const llvm::APInt ,
+CompilerType type);
+
+  static lldb::ValueObjectSP
+  CreateValueObjectFromAPFloat(lldb::TargetSP target, const llvm::APFloat ,
+   CompilerType type);
+
+  static lldb::ValueObjectSP CreateValueObjectFromPointer(lldb::TargetSP 
target,

cmtice wrote:

"CreateValueObjectFromPointer" is different from 
"CreateValueObjectFromAddresss" In that the former creates a value object whose 
value is the pointer address; the latter creates a value object whose value is 
whatever the pointer points to (it dereferences the pointer).  I *can* update 
CreateValueObjectFromAddress to take a parameter telling it whether to 
dereference the pointer or use the pointer address as the value, if you would 
prefer.

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


[Lldb-commits] [lldb] [lldb][DAP] Fix test failure from #73393 (PR #89692)

2024-04-22 Thread Jordan Rupprecht via lldb-commits

https://github.com/rupprecht commented:

LGTM

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


[Lldb-commits] [lldb] [lldb][DAP] Fix test failure from #73393 (PR #89692)

2024-04-22 Thread Pranav Kant via lldb-commits

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


[Lldb-commits] [lldb] aa89c1b - [lldb][DAP] Fix test failure from #73393 (#89692)

2024-04-22 Thread via lldb-commits

Author: Pranav Kant
Date: 2024-04-22T17:47:17-07:00
New Revision: aa89c1bd78a0c49801193bec5e7f5c023448bd19

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

LOG: [lldb][DAP] Fix test failure from #73393 (#89692)

#73393 introduced a mandatory column field. Update test for that.

Added: 


Modified: 
lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py

Removed: 




diff  --git a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py 
b/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py
index 13190a50954ad7..cabaeafc4a6418 100644
--- a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py
+++ b/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py
@@ -25,6 +25,7 @@ def test_core_file(self):
 
 expected_frames = [
 {
+"column": 0,
 "id": 524288,
 "line": 4,
 "name": "bar",
@@ -32,6 +33,7 @@ def test_core_file(self):
 "instructionPointerReference": "0x40011C",
 },
 {
+"column": 0,
 "id": 524289,
 "line": 10,
 "name": "foo",
@@ -39,6 +41,7 @@ def test_core_file(self):
 "instructionPointerReference": "0x400142",
 },
 {
+"column": 0,
 "id": 524290,
 "line": 16,
 "name": "_start",



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


[Lldb-commits] [lldb] [lldb][DAP] Fix test failure from #73393 (PR #89692)

2024-04-22 Thread Pranav Kant via lldb-commits

pranavk wrote:

Merging this after self-review. Need this to unblock something internally for 
us. Hope you don't mind.

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


[Lldb-commits] [lldb] [lldb][DAP] Fix test failure from #73393 (PR #89692)

2024-04-22 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Pranav Kant (pranavk)


Changes

#73393 introduced a mandatory column field. Update test for that.

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


1 Files Affected:

- (modified) lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py (+3) 


``diff
diff --git a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py 
b/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py
index 13190a50954ad7..cabaeafc4a6418 100644
--- a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py
+++ b/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py
@@ -25,6 +25,7 @@ def test_core_file(self):
 
 expected_frames = [
 {
+"column": 0,
 "id": 524288,
 "line": 4,
 "name": "bar",
@@ -32,6 +33,7 @@ def test_core_file(self):
 "instructionPointerReference": "0x40011C",
 },
 {
+"column": 0,
 "id": 524289,
 "line": 10,
 "name": "foo",
@@ -39,6 +41,7 @@ def test_core_file(self):
 "instructionPointerReference": "0x400142",
 },
 {
+"column": 0,
 "id": 524290,
 "line": 16,
 "name": "_start",

``




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


[Lldb-commits] [lldb] [lldb][DAP] Fix test failure from #73393 (PR #89692)

2024-04-22 Thread Pranav Kant via lldb-commits

https://github.com/pranavk created 
https://github.com/llvm/llvm-project/pull/89692

#73393 introduced a mandatory column field. Update test for that.

>From dfe807c57b3cb9923c2b774f8f8a13ea3d8a4e6a Mon Sep 17 00:00:00 2001
From: Pranav Kant 
Date: Tue, 23 Apr 2024 00:26:56 +
Subject: [PATCH] [lldb][DAP] Fix test failure from #73393

---
 lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py 
b/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py
index 13190a50954ad7..cabaeafc4a6418 100644
--- a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py
+++ b/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py
@@ -25,6 +25,7 @@ def test_core_file(self):
 
 expected_frames = [
 {
+"column": 0,
 "id": 524288,
 "line": 4,
 "name": "bar",
@@ -32,6 +33,7 @@ def test_core_file(self):
 "instructionPointerReference": "0x40011C",
 },
 {
+"column": 0,
 "id": 524289,
 "line": 10,
 "name": "foo",
@@ -39,6 +41,7 @@ def test_core_file(self):
 "instructionPointerReference": "0x400142",
 },
 {
+"column": 0,
 "id": 524290,
 "line": 16,
 "name": "_start",

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


[Lldb-commits] [lldb] [lldb][nfc] Move broadcaster class strings away from ConstString (PR #89690)

2024-04-22 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Alex Langford (bulbazord)


Changes

These are hardcoded strings that are already present in the data section of the 
binary, no need to immediately place them in the ConstString StringPools. Lots 
of code still calls `GetBroadcasterClass` and places the return value into a 
ConstString. Changing that would be a good follow-up.

Additionally, calls to these functions are still wrapped in ConstStrings at the 
SBAPI layer. This is because we must guarantee the lifetime of all strings 
handed out publicly.

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


23 Files Affected:

- (modified) lldb/include/lldb/Core/Debugger.h (+1-1) 
- (modified) lldb/include/lldb/Core/ThreadedCommunication.h (+2-2) 
- (modified) lldb/include/lldb/Interpreter/CommandInterpreter.h (+2-2) 
- (modified) lldb/include/lldb/Target/Process.h (+2-2) 
- (modified) lldb/include/lldb/Target/Target.h (+2-2) 
- (modified) lldb/include/lldb/Target/TargetList.h (+2-2) 
- (modified) lldb/include/lldb/Target/Thread.h (+2-2) 
- (modified) lldb/include/lldb/Utility/Broadcaster.h (+4-4) 
- (modified) lldb/source/API/SBCommandInterpreter.cpp (+2-1) 
- (modified) lldb/source/API/SBCommunication.cpp (+2-1) 
- (modified) lldb/source/API/SBDebugger.cpp (+1-1) 
- (modified) lldb/source/API/SBEvent.cpp (+2-1) 
- (modified) lldb/source/API/SBProcess.cpp (+2-2) 
- (modified) lldb/source/API/SBTarget.cpp (+1-1) 
- (modified) lldb/source/API/SBThread.cpp (+1-1) 
- (modified) lldb/source/Core/Debugger.cpp (+3-3) 
- (modified) lldb/source/Core/ThreadedCommunication.cpp (+2-2) 
- (modified) lldb/source/Interpreter/CommandInterpreter.cpp (+3-3) 
- (modified) lldb/source/Target/Process.cpp (+3-3) 
- (modified) lldb/source/Target/Target.cpp (+3-3) 
- (modified) lldb/source/Target/TargetList.cpp (+3-3) 
- (modified) lldb/source/Target/Thread.cpp (+3-3) 
- (modified) lldb/source/Utility/Broadcaster.cpp (+2-2) 


``diff
diff --git a/lldb/include/lldb/Core/Debugger.h 
b/lldb/include/lldb/Core/Debugger.h
index 418c2403d020f4..49ff0737acef82 100644
--- a/lldb/include/lldb/Core/Debugger.h
+++ b/lldb/include/lldb/Core/Debugger.h
@@ -89,7 +89,7 @@ class Debugger : public 
std::enable_shared_from_this,
 
   using DebuggerList = std::vector;
 
-  static ConstString GetStaticBroadcasterClass();
+  static llvm::StringRef GetStaticBroadcasterClass();
 
   /// Get the public broadcaster for this debugger.
   Broadcaster () { return m_broadcaster; }
diff --git a/lldb/include/lldb/Core/ThreadedCommunication.h 
b/lldb/include/lldb/Core/ThreadedCommunication.h
index 7ebb77beb77f3d..24412b2027932d 100644
--- a/lldb/include/lldb/Core/ThreadedCommunication.h
+++ b/lldb/include/lldb/Core/ThreadedCommunication.h
@@ -216,9 +216,9 @@ class ThreadedCommunication : public Communication, public 
Broadcaster {
   ///
   void SynchronizeWithReadThread();
 
-  static ConstString ();
+  static llvm::StringRef GetStaticBroadcasterClass();
 
-  ConstString () const override {
+  llvm::StringRef GetBroadcasterClass() const override {
 return GetStaticBroadcasterClass();
   }
 
diff --git a/lldb/include/lldb/Interpreter/CommandInterpreter.h 
b/lldb/include/lldb/Interpreter/CommandInterpreter.h
index d190bcdcab4497..70a55a77465bfe 100644
--- a/lldb/include/lldb/Interpreter/CommandInterpreter.h
+++ b/lldb/include/lldb/Interpreter/CommandInterpreter.h
@@ -255,9 +255,9 @@ class CommandInterpreter : public Broadcaster,
 
   // These two functions fill out the Broadcaster interface:
 
-  static ConstString ();
+  static llvm::StringRef GetStaticBroadcasterClass();
 
-  ConstString () const override {
+  llvm::StringRef GetBroadcasterClass() const override {
 return GetStaticBroadcasterClass();
   }
 
diff --git a/lldb/include/lldb/Target/Process.h 
b/lldb/include/lldb/Target/Process.h
index 2f3a3c22422efe..aac0cf51680a9e 100644
--- a/lldb/include/lldb/Target/Process.h
+++ b/lldb/include/lldb/Target/Process.h
@@ -381,7 +381,7 @@ class Process : public 
std::enable_shared_from_this,
 
   // These two functions fill out the Broadcaster interface:
 
-  static ConstString ();
+  static llvm::StringRef GetStaticBroadcasterClass();
 
   static constexpr llvm::StringRef AttachSynchronousHijackListenerName =
   "lldb.internal.Process.AttachSynchronous.hijack";
@@ -390,7 +390,7 @@ class Process : public 
std::enable_shared_from_this,
   static constexpr llvm::StringRef ResumeSynchronousHijackListenerName =
   "lldb.internal.Process.ResumeSynchronous.hijack";
 
-  ConstString () const override {
+  llvm::StringRef GetBroadcasterClass() const override {
 return GetStaticBroadcasterClass();
   }
 
diff --git a/lldb/include/lldb/Target/Target.h 
b/lldb/include/lldb/Target/Target.h
index 2c2e6b2831ccee..cade60f3cc8cd9 100644
--- a/lldb/include/lldb/Target/Target.h
+++ b/lldb/include/lldb/Target/Target.h
@@ -499,9 +499,9 @@ class Target : public std::enable_shared_from_this,
 
   // These two functions fill out the 

[Lldb-commits] [lldb] [lldb][nfc] Move broadcaster class strings away from ConstString (PR #89690)

2024-04-22 Thread Alex Langford via lldb-commits

https://github.com/bulbazord created 
https://github.com/llvm/llvm-project/pull/89690

These are hardcoded strings that are already present in the data section of the 
binary, no need to immediately place them in the ConstString StringPools. Lots 
of code still calls `GetBroadcasterClass` and places the return value into a 
ConstString. Changing that would be a good follow-up.

Additionally, calls to these functions are still wrapped in ConstStrings at the 
SBAPI layer. This is because we must guarantee the lifetime of all strings 
handed out publicly.

>From 406ce4dc0151cf1afdc3ab0fa7b8743029b869f3 Mon Sep 17 00:00:00 2001
From: Alex Langford 
Date: Mon, 22 Apr 2024 17:07:57 -0700
Subject: [PATCH] [lldb][nfc] Move broadcaster class strings away from
 ConstString

These are hardcoded strings that are already present in the data section
of the binary, no need to immediately place them in the ConstString
StringPools. Lots of code still calls `GetBroadcasterClass` and places
the return value into a ConstString. Changing that would be a good
follow-up.

Additionally, calls to these functions are still wrapped in ConstStrings
at the SBAPI layer. This is because we must guarantee the lifetime of
all strings handed out publicly.
---
 lldb/include/lldb/Core/Debugger.h  | 2 +-
 lldb/include/lldb/Core/ThreadedCommunication.h | 4 ++--
 lldb/include/lldb/Interpreter/CommandInterpreter.h | 4 ++--
 lldb/include/lldb/Target/Process.h | 4 ++--
 lldb/include/lldb/Target/Target.h  | 4 ++--
 lldb/include/lldb/Target/TargetList.h  | 4 ++--
 lldb/include/lldb/Target/Thread.h  | 4 ++--
 lldb/include/lldb/Utility/Broadcaster.h| 8 
 lldb/source/API/SBCommandInterpreter.cpp   | 3 ++-
 lldb/source/API/SBCommunication.cpp| 3 ++-
 lldb/source/API/SBDebugger.cpp | 2 +-
 lldb/source/API/SBEvent.cpp| 3 ++-
 lldb/source/API/SBProcess.cpp  | 4 ++--
 lldb/source/API/SBTarget.cpp   | 2 +-
 lldb/source/API/SBThread.cpp   | 2 +-
 lldb/source/Core/Debugger.cpp  | 6 +++---
 lldb/source/Core/ThreadedCommunication.cpp | 4 ++--
 lldb/source/Interpreter/CommandInterpreter.cpp | 6 +++---
 lldb/source/Target/Process.cpp | 6 +++---
 lldb/source/Target/Target.cpp  | 6 +++---
 lldb/source/Target/TargetList.cpp  | 6 +++---
 lldb/source/Target/Thread.cpp  | 6 +++---
 lldb/source/Utility/Broadcaster.cpp| 4 ++--
 23 files changed, 50 insertions(+), 47 deletions(-)

diff --git a/lldb/include/lldb/Core/Debugger.h 
b/lldb/include/lldb/Core/Debugger.h
index 418c2403d020f4..49ff0737acef82 100644
--- a/lldb/include/lldb/Core/Debugger.h
+++ b/lldb/include/lldb/Core/Debugger.h
@@ -89,7 +89,7 @@ class Debugger : public 
std::enable_shared_from_this,
 
   using DebuggerList = std::vector;
 
-  static ConstString GetStaticBroadcasterClass();
+  static llvm::StringRef GetStaticBroadcasterClass();
 
   /// Get the public broadcaster for this debugger.
   Broadcaster () { return m_broadcaster; }
diff --git a/lldb/include/lldb/Core/ThreadedCommunication.h 
b/lldb/include/lldb/Core/ThreadedCommunication.h
index 7ebb77beb77f3d..24412b2027932d 100644
--- a/lldb/include/lldb/Core/ThreadedCommunication.h
+++ b/lldb/include/lldb/Core/ThreadedCommunication.h
@@ -216,9 +216,9 @@ class ThreadedCommunication : public Communication, public 
Broadcaster {
   ///
   void SynchronizeWithReadThread();
 
-  static ConstString ();
+  static llvm::StringRef GetStaticBroadcasterClass();
 
-  ConstString () const override {
+  llvm::StringRef GetBroadcasterClass() const override {
 return GetStaticBroadcasterClass();
   }
 
diff --git a/lldb/include/lldb/Interpreter/CommandInterpreter.h 
b/lldb/include/lldb/Interpreter/CommandInterpreter.h
index d190bcdcab4497..70a55a77465bfe 100644
--- a/lldb/include/lldb/Interpreter/CommandInterpreter.h
+++ b/lldb/include/lldb/Interpreter/CommandInterpreter.h
@@ -255,9 +255,9 @@ class CommandInterpreter : public Broadcaster,
 
   // These two functions fill out the Broadcaster interface:
 
-  static ConstString ();
+  static llvm::StringRef GetStaticBroadcasterClass();
 
-  ConstString () const override {
+  llvm::StringRef GetBroadcasterClass() const override {
 return GetStaticBroadcasterClass();
   }
 
diff --git a/lldb/include/lldb/Target/Process.h 
b/lldb/include/lldb/Target/Process.h
index 2f3a3c22422efe..aac0cf51680a9e 100644
--- a/lldb/include/lldb/Target/Process.h
+++ b/lldb/include/lldb/Target/Process.h
@@ -381,7 +381,7 @@ class Process : public 
std::enable_shared_from_this,
 
   // These two functions fill out the Broadcaster interface:
 
-  static ConstString ();
+  static llvm::StringRef GetStaticBroadcasterClass();
 
   static constexpr llvm::StringRef 

[Lldb-commits] [lldb] [lldb] Replace condition that always evaluates to false (PR #89685)

2024-04-22 Thread Troy Butler via lldb-commits

Troy-Butler wrote:

> Otherwise this LGTM!



> Even though you link the issue, I would recommend also summarizing the issue 
> in the commit. Something like "The current code is checking the validity of 
> `obj` twice, instead of checking the new `str_obj` pointer."
> 
> Otherwise this LGTM!

I appreciate the advice, thank you! 

Also, I do not have the ability to merge. If everything looks good on your end, 
can you please merge with main? Thank you again!

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


[Lldb-commits] [lldb] [lldb] Replace condition that always evaluates to false (PR #89685)

2024-04-22 Thread Troy Butler via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Replace condition that always evaluates to false (PR #89685)

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

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

Even though you link the issue, I would recommend also summarizing the issue in 
the commit. Something like "The current code is checking the validity of `obj` 
twice, instead of checking the new `str_obj` pointer." 

Otherwise this LGTM!

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


[Lldb-commits] [lldb] [lldb] Replace condition that always evaluates to false (PR #89685)

2024-04-22 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Troy Butler (Troy-Butler)


Changes

Addresses issue #87243. 

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


1 Files Affected:

- (modified) lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp 
(+1-1) 


``diff
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp 
b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
index ea0a1cdff40f1e..7c7035e0c86c9e 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
@@ -61,7 +61,7 @@ Expected 
python::As(Expected &) {
   if (!obj)
 return obj.takeError();
   PyObject *str_obj = PyObject_Str(obj.get().get());
-  if (!obj)
+  if (!str_obj)
 return llvm::make_error();
   auto str = Take(str_obj);
   auto utf8 = str.AsUTF8();

``




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


[Lldb-commits] [lldb] [lldb] Replace condition that always evaluates to false (PR #89685)

2024-04-22 Thread Troy Butler via lldb-commits

https://github.com/Troy-Butler created 
https://github.com/llvm/llvm-project/pull/89685

Addresses issue #87243. 

>From 20c093a1cd51adab9387e9a15fca7c8b592f3f21 Mon Sep 17 00:00:00 2001
From: Troy-Butler 
Date: Mon, 22 Apr 2024 19:17:08 -0400
Subject: [PATCH] [lldb] Replace always-false condition

Signed-off-by: Troy-Butler 
---
 .../Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp 
b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
index ea0a1cdff40f1e..7c7035e0c86c9e 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
@@ -61,7 +61,7 @@ Expected 
python::As(Expected &) {
   if (!obj)
 return obj.takeError();
   PyObject *str_obj = PyObject_Str(obj.get().get());
-  if (!obj)
+  if (!str_obj)
 return llvm::make_error();
   auto str = Take(str_obj);
   auto utf8 = str.AsUTF8();

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


[Lldb-commits] [lldb] [lldb] Fix typo in CumulativeSystemTimeIsValid check (PR #89680)

2024-04-22 Thread Marc Auberer via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Remove duplicate disjunction in CumulativeSystemTimeIsValid (PR #89680)

2024-04-22 Thread Marc Auberer via lldb-commits

https://github.com/marcauberer updated 
https://github.com/llvm/llvm-project/pull/89680

>From b626dc5e116fc6c566f8a3be50fac173aa5df653 Mon Sep 17 00:00:00 2001
From: Marc Auberer 
Date: Tue, 23 Apr 2024 00:05:53 +0200
Subject: [PATCH] [lldb] Fix typo in CumulativeSystemTimeIsValid check

---
 lldb/include/lldb/Utility/ProcessInfo.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/include/lldb/Utility/ProcessInfo.h 
b/lldb/include/lldb/Utility/ProcessInfo.h
index e9fe71e1b851d1..54ac000dc7fc28 100644
--- a/lldb/include/lldb/Utility/ProcessInfo.h
+++ b/lldb/include/lldb/Utility/ProcessInfo.h
@@ -234,7 +234,7 @@ class ProcessInstanceInfo : public ProcessInfo {
 
   bool CumulativeSystemTimeIsValid() const {
 return m_cumulative_system_time.tv_sec > 0 ||
-   m_cumulative_system_time.tv_sec > 0;
+   m_cumulative_system_time.tv_usec > 0;
   }
 
   void Dump(Stream , UserIDResolver ) const;

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


[Lldb-commits] [lldb] [lldb] Remove duplicate disjunction in CumulativeSystemTimeIsValid (PR #89680)

2024-04-22 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Marc Auberer (marcauberer)


Changes

Resolves #89674

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


1 Files Affected:

- (modified) lldb/include/lldb/Utility/ProcessInfo.h (+1-2) 


``diff
diff --git a/lldb/include/lldb/Utility/ProcessInfo.h 
b/lldb/include/lldb/Utility/ProcessInfo.h
index e9fe71e1b851d1..85489c0ef0a199 100644
--- a/lldb/include/lldb/Utility/ProcessInfo.h
+++ b/lldb/include/lldb/Utility/ProcessInfo.h
@@ -233,8 +233,7 @@ class ProcessInstanceInfo : public ProcessInfo {
   }
 
   bool CumulativeSystemTimeIsValid() const {
-return m_cumulative_system_time.tv_sec > 0 ||
-   m_cumulative_system_time.tv_sec > 0;
+return m_cumulative_system_time.tv_sec > 0;
   }
 
   void Dump(Stream , UserIDResolver ) const;

``




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


[Lldb-commits] [lldb] [lldb] Remove duplicate disjunction in CumulativeSystemTimeIsValid (PR #89680)

2024-04-22 Thread Marc Auberer via lldb-commits

https://github.com/marcauberer created 
https://github.com/llvm/llvm-project/pull/89680

Resolves #89674

>From d5bd3f32fa0d87c3bed1024857c3fae412702567 Mon Sep 17 00:00:00 2001
From: Marc Auberer 
Date: Tue, 23 Apr 2024 00:05:53 +0200
Subject: [PATCH] [lldb] Remove duplicate disjunction in
 ProcessInstanceInfo::CumulativeSystemTimeIsValid

---
 lldb/include/lldb/Utility/ProcessInfo.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lldb/include/lldb/Utility/ProcessInfo.h 
b/lldb/include/lldb/Utility/ProcessInfo.h
index e9fe71e1b851d1..85489c0ef0a199 100644
--- a/lldb/include/lldb/Utility/ProcessInfo.h
+++ b/lldb/include/lldb/Utility/ProcessInfo.h
@@ -233,8 +233,7 @@ class ProcessInstanceInfo : public ProcessInfo {
   }
 
   bool CumulativeSystemTimeIsValid() const {
-return m_cumulative_system_time.tv_sec > 0 ||
-   m_cumulative_system_time.tv_sec > 0;
+return m_cumulative_system_time.tv_sec > 0;
   }
 
   void Dump(Stream , UserIDResolver ) const;

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


[Lldb-commits] [clang] [clang-tools-extra] [compiler-rt] [flang] [libc] [libclc] [libcxx] [libcxxabi] [libunwind] [lld] [lldb] [llvm] [mlir] [openmp] [polly] [pstl] Update IDE Folders (PR #89153)

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

JDevlieghere wrote:

This looks like a nice improvement for folks using those generators. Even 
though most of these changes look straightforward, it would be a lot easier to 
review if this was broken up per subproject. Is there any reason that's not 
possible? 

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


[Lldb-commits] [lldb] [lldb][Core] Fix pointless if conditon (PR #89650)

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

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


[Lldb-commits] [lldb] 2987fca - [lldb][Core] Fix pointless if conditon (#89650)

2024-04-22 Thread via lldb-commits

Author: Troy Butler
Date: 2024-04-22T14:50:17-07:00
New Revision: 2987fca041caddead6655a34009b6a6517d0c7df

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

LOG: [lldb][Core] Fix pointless if conditon (#89650)

Addresses #85984

Signed-off-by: Troy-Butler 
Co-authored-by: Troy-Butler 

Added: 


Modified: 
lldb/source/Core/Debugger.cpp

Removed: 




diff  --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index ebd112110e5f2d..19b3cf3bbf46b1 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -1115,9 +1115,6 @@ void Debugger::RunIOHandlerSync(const IOHandlerSP 
_sp) {
   IOHandlerSP top_reader_sp = reader_sp;
 
   while (top_reader_sp) {
-if (!top_reader_sp)
-  break;
-
 top_reader_sp->Run();
 
 // Don't unwind past the starting point.



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


[Lldb-commits] [lldb] [lldb][Core] Fix pointless if conditon (PR #89650)

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

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

LGTM

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


[Lldb-commits] [clang] [clang-tools-extra] [compiler-rt] [flang] [libc] [libclc] [libcxx] [libcxxabi] [libunwind] [lld] [lldb] [llvm] [mlir] [openmp] [polly] [pstl] Update IDE Folders (PR #89153)

2024-04-22 Thread Michael Kruse via lldb-commits


@@ -406,5 +426,13 @@ function(llvm_ExternalProject_Add name source_dir)
   WORKING_DIRECTORY ${BINARY_DIR}
   VERBATIM
   USES_TERMINAL)
+if (ARG_FOLDER)
+  set_target_properties(${target} PROPERTIES FOLDER "${ARG_FOLDER}")
+endif ()
   endforeach()
+
+  #set_target_folder(
+  #  TARGETS ${name} install-${name} ${name}-clobber ${name}-clear 
${name}-clean ${ARG_EXTRA_TARGETS}
+  #  FOLDER "${ARG_FOLDE}"
+  #)

Meinersbur wrote:

thanks

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


[Lldb-commits] [clang] [clang-tools-extra] [compiler-rt] [flang] [libc] [libclc] [libcxx] [libcxxabi] [libunwind] [lld] [lldb] [llvm] [mlir] [openmp] [polly] [pstl] Update IDE Folders (PR #89153)

2024-04-22 Thread Michael Kruse via lldb-commits


@@ -56,11 +56,13 @@ endfunction()
 # Use provided strip tool instead of the default one.
 #   TARGET_TRIPLE triple
 # Optional target triple to pass to the compiler
+#   FOLDER
+# For IDEs, the Folder to put the targets into.=

Meinersbur wrote:

It's already called FOLDER in 
https://github.com/llvm/llvm-project/blob/main/llvm/cmake/modules/AddLLVM.cmake#L2080-L2083.
 I would prefer to keep it consistent.

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


[Lldb-commits] [lldb] [lldb/test] Add basic ld.lld --debug-names tests (PR #88335)

2024-04-22 Thread David Blaikie via lldb-commits

dwblaikie wrote:

looks approximately right to me, but wouldn't' mind a set of eyes more familiar 
with lldb to take a look

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


[Lldb-commits] [lldb] [lldb][dap] always add column field in StackFrame body (PR #73393)

2024-04-22 Thread Walter Erquinigo via lldb-commits

walter-erquinigo wrote:

@semensanyok, I've just merged this PR because it's very straightforward. If it 
breaks the buildbots, I'll just revert it and let the original author fix it.

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


[Lldb-commits] [lldb] [lldb][dap] always add column field in StackFrame body (PR #73393)

2024-04-22 Thread Walter Erquinigo via lldb-commits

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


[Lldb-commits] [lldb] 99f42e6 - [lldb][dap] always add column field in StackFrame body (#73393)

2024-04-22 Thread via lldb-commits

Author: Xu Jun
Date: 2024-04-22T15:51:11-04:00
New Revision: 99f42e6b88177328ebe725b5cb6d422106bbb3e6

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

LOG: [lldb][dap] always add column field in StackFrame body (#73393)

The `column` field is mandatory in StackTraceResponse, otherwise the
debugger client may raise error (e.g. VSCode can't correctly open an
editor without the column field)

-

Signed-off-by: Xu Jun <693788...@qq.com>

Added: 


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

Removed: 




diff  --git a/lldb/tools/lldb-dap/JSONUtils.cpp 
b/lldb/tools/lldb-dap/JSONUtils.cpp
index 878449a91aa66a..b4a2718bbb096e 100644
--- a/lldb/tools/lldb-dap/JSONUtils.cpp
+++ b/lldb/tools/lldb-dap/JSONUtils.cpp
@@ -748,9 +748,10 @@ llvm::json::Value CreateStackFrame(lldb::SBFrame ) {
 auto line = line_entry.GetLine();
 if (line && line != LLDB_INVALID_LINE_NUMBER)
   object.try_emplace("line", line);
+else
+  object.try_emplace("line", 0);
 auto column = line_entry.GetColumn();
-if (column && column != LLDB_INVALID_COLUMN_NUMBER)
-  object.try_emplace("column", column);
+object.try_emplace("column", column);
   } else {
 object.try_emplace("line", 0);
 object.try_emplace("column", 0);



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


[Lldb-commits] [lldb] [lldb][dap] always add column field in StackFrame body (PR #73393)

2024-04-22 Thread Semen Komissarov via lldb-commits

semensanyok wrote:

Bug confirmed. Its causing exception for nvim-dap plugin which expects column 
required in specification, but not sent by server.
pr contains log message, showing missing column case. closed by maintainer:

> Thanks for the PR, but I'm not going to merge this. column is a required 
> property of a StackFrame according to the specification:
> 
> https://microsoft.github.io/debug-adapter-protocol/specification#Types_StackFrame
> 
> This needs to be fixed in the debug adapter.

https://github.com/mfussenegger/nvim-dap/pull/1195



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


[Lldb-commits] [lldb] [lldb][Core] Fix pointless if conditon (PR #89650)

2024-04-22 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Troy Butler (Troy-Butler)


Changes

Addresses #85984 

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


1 Files Affected:

- (modified) lldb/source/Core/Debugger.cpp (-3) 


``diff
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index ebd112110e5f2d..19b3cf3bbf46b1 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -1115,9 +1115,6 @@ void Debugger::RunIOHandlerSync(const IOHandlerSP 
_sp) {
   IOHandlerSP top_reader_sp = reader_sp;
 
   while (top_reader_sp) {
-if (!top_reader_sp)
-  break;
-
 top_reader_sp->Run();
 
 // Don't unwind past the starting point.

``




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


[Lldb-commits] [lldb] [lldb][Core] Fix pointless if conditon (PR #89650)

2024-04-22 Thread Troy Butler via lldb-commits

https://github.com/Troy-Butler created 
https://github.com/llvm/llvm-project/pull/89650

Addresses #85984 

>From 8aed7cb301347db507de10106ed41f9c6be50b1b Mon Sep 17 00:00:00 2001
From: Troy-Butler 
Date: Mon, 22 Apr 2024 14:56:11 -0400
Subject: [PATCH] [lldb][Core] Fix pointless if conditon

Signed-off-by: Troy-Butler 
---
 lldb/source/Core/Debugger.cpp | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index ebd112110e5f2d..19b3cf3bbf46b1 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -1115,9 +1115,6 @@ void Debugger::RunIOHandlerSync(const IOHandlerSP 
_sp) {
   IOHandlerSP top_reader_sp = reader_sp;
 
   while (top_reader_sp) {
-if (!top_reader_sp)
-  break;
-
 top_reader_sp->Run();
 
 // Don't unwind past the starting point.

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


[Lldb-commits] [lldb] [lldb-dap] Report exit status message in lldb-dap, same as lldb cli (PR #89405)

2024-04-22 Thread Miro Bucko via lldb-commits

https://github.com/mbucko updated 
https://github.com/llvm/llvm-project/pull/89405

>From d0ed0c618aeaf81dd471fc31c9f14d4b207effaa Mon Sep 17 00:00:00 2001
From: Miro Bucko 
Date: Fri, 19 Apr 2024 08:08:02 -0700
Subject: [PATCH] Report exit status message in lldb-dap, same as lldb cli

Summary:
When the target inferior process that is being debugged exits in lldb command 
line, it emits following message:
Process 4049526 exited with status = -1 (0x) debugserver died with 
signal SIGTERM
lldb-dap on the other hand does not emit a similar message.
This PR adds the same status message to lldb-dap.

Test Plan:
In VSCode debug any target and hit stop mode, kill lldb-server and observe an 
exit status message similar to the following:
Process 2167677 exited with status = -1 (0x) debugserver died with 
signal SIGTERM

Reviewers:

Subscribers:

Tasks:
lldb-dap

Tags:
---
 lldb/include/lldb/API/SBProcess.h |  2 +
 lldb/source/API/SBProcess.cpp |  8 +++
 .../tools/lldb-dap/console/TestDAP_console.py | 58 +++
 lldb/tools/lldb-dap/lldb-dap.cpp  |  5 ++
 4 files changed, 73 insertions(+)

diff --git a/lldb/include/lldb/API/SBProcess.h 
b/lldb/include/lldb/API/SBProcess.h
index 7da3335a7234b7..f1b5d1fb92ce29 100644
--- a/lldb/include/lldb/API/SBProcess.h
+++ b/lldb/include/lldb/API/SBProcess.h
@@ -562,6 +562,8 @@ class LLDB_API SBProcess {
 
   lldb::SBScriptObject GetScriptedImplementation();
 
+  void GetStatus(SBStream );
+
 protected:
   friend class SBAddress;
   friend class SBBreakpoint;
diff --git a/lldb/source/API/SBProcess.cpp b/lldb/source/API/SBProcess.cpp
index b80664882ebcac..cf1ac1ae6b3377 100644
--- a/lldb/source/API/SBProcess.cpp
+++ b/lldb/source/API/SBProcess.cpp
@@ -928,6 +928,14 @@ size_t SBProcess::WriteMemory(addr_t addr, const void 
*src, size_t src_len,
   return bytes_written;
 }
 
+void SBProcess::GetStatus(SBStream ) {
+  LLDB_INSTRUMENT_VA(this, status);
+
+  ProcessSP process_sp(GetSP());
+  if (process_sp)
+process_sp->GetStatus(status.ref());
+}
+
 bool SBProcess::GetDescription(SBStream ) {
   LLDB_INSTRUMENT_VA(this, description);
 
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 ffa0dc943e0693..8f456aaf890c7f 100644
--- a/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py
+++ b/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py
@@ -4,11 +4,23 @@
 
 import dap_server
 import lldbdap_testcase
+import psutil
+from collections import deque
 from lldbsuite.test import lldbutil
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
 
 
+def get_subprocess(process_name):
+queue = deque([psutil.Process(os.getpid())])
+while queue:
+process = queue.popleft()
+if process.name() == process_name:
+return process
+queue.extend(process.children())
+
+self.assertTrue(False, "No subprocess with name %s found" % process_name)
+
 class TestDAP_console(lldbdap_testcase.DAPTestCaseBase):
 def check_lldb_command(
 self, lldb_command, contains_string, assert_msg, 
command_escape_prefix="`"
@@ -104,3 +116,49 @@ def test_empty_escape_prefix(self):
 "Help can be invoked",
 command_escape_prefix="",
 )
+
+@skipIfWindows
+@skipIfRemote
+def test_exit_status_message_sigterm(self):
+source = "main.cpp"
+program = self.getBuildArtifact("a.out")
+self.build_and_launch(program, commandEscapePrefix="")
+breakpoint1_line = line_number(source, "// breakpoint 1")
+breakpoint_ids = self.set_source_breakpoints(source, 
[breakpoint1_line])
+self.continue_to_breakpoints(breakpoint_ids)
+
+# Kill lldb-server process.
+process_name = (
+"debugserver" if platform.system() in ["Darwin"] else "lldb-server"
+)
+process = get_subprocess(process_name)
+process.terminate()
+process.wait()
+
+# Get the console output
+console_output = self.collect_console(1.0)
+
+# Verify the exit status message is printed.
+self.assertIn(
+"exited with status = -1 (0x) debugserver died with signal 
SIGTERM",
+console_output,
+"Exit status does not contain message 'exited with status'",
+)
+
+@skipIfWindows
+@skipIfRemote
+def test_exit_status_message_ok(self):
+source = "main.cpp"
+program = self.getBuildArtifact("a.out")
+self.build_and_launch(program, commandEscapePrefix="")
+self.continue_to_exit()
+
+# Get the console output
+console_output = self.collect_console(1.0)
+
+# Verify the exit status message is printed.
+self.assertIn(
+"exited with status = 0 (0x)",
+console_output,
+"Exit status does not contain message 'exited with status'",
+   

[Lldb-commits] [lldb] [lldb][NFC] Remove unused pexpect/ptyprocess (PR #89609)

2024-04-22 Thread Jordan Rupprecht via lldb-commits

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


[Lldb-commits] [clang] [clang-tools-extra] [compiler-rt] [flang] [libc] [libclc] [libcxx] [libcxxabi] [libunwind] [lld] [lldb] [llvm] [mlir] [openmp] [polly] [pstl] Update IDE Folders (PR #89153)

2024-04-22 Thread via lldb-commits


@@ -56,11 +56,13 @@ endfunction()
 # Use provided strip tool instead of the default one.
 #   TARGET_TRIPLE triple
 # Optional target triple to pass to the compiler
+#   FOLDER
+# For IDEs, the Folder to put the targets into.=

whisperity wrote:

Maybe if this is only affecting IDEs, then perhaps the property's name should 
reflect this, i.e., `IDE_FOLDER`? Unfortunately, directories are also called 
"folders" at least on Windows, so I see a slim chance of misunderstanding this 
as the path from which the external project is loaded.

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


[Lldb-commits] [lldb] [lldb-dap] Report exit status message in lldb-dap, same as lldb cli (PR #89405)

2024-04-22 Thread Miro Bucko via lldb-commits

https://github.com/mbucko updated 
https://github.com/llvm/llvm-project/pull/89405

>From 4c22c237dae73f3fbac22c0d725ae4fa449170df Mon Sep 17 00:00:00 2001
From: Miro Bucko 
Date: Fri, 19 Apr 2024 08:08:02 -0700
Subject: [PATCH] Report exit status message in lldb-dap, same as lldb cli

Summary:
When the target inferior process that is being debugged exits in lldb command 
line, it emits following message:
Process 4049526 exited with status = -1 (0x) debugserver died with 
signal SIGTERM
lldb-dap on the other hand does not emit a similar message.
This PR adds the same status message to lldb-dap.

Test Plan:
In VSCode debug any target and hit stop mode, kill lldb-server and observe an 
exit status message similar to the following:
Process 2167677 exited with status = -1 (0x) debugserver died with 
signal SIGTERM

Reviewers:

Subscribers:

Tasks:
lldb-dap

Tags:
---
 lldb/include/lldb/API/SBProcess.h |  2 +
 lldb/source/API/SBProcess.cpp |  8 +++
 .../tools/lldb-dap/console/TestDAP_console.py | 57 +++
 lldb/tools/lldb-dap/lldb-dap.cpp  |  5 ++
 4 files changed, 72 insertions(+)

diff --git a/lldb/include/lldb/API/SBProcess.h 
b/lldb/include/lldb/API/SBProcess.h
index 7da3335a7234b7..f1b5d1fb92ce29 100644
--- a/lldb/include/lldb/API/SBProcess.h
+++ b/lldb/include/lldb/API/SBProcess.h
@@ -562,6 +562,8 @@ class LLDB_API SBProcess {
 
   lldb::SBScriptObject GetScriptedImplementation();
 
+  void GetStatus(SBStream );
+
 protected:
   friend class SBAddress;
   friend class SBBreakpoint;
diff --git a/lldb/source/API/SBProcess.cpp b/lldb/source/API/SBProcess.cpp
index b80664882ebcac..cf1ac1ae6b3377 100644
--- a/lldb/source/API/SBProcess.cpp
+++ b/lldb/source/API/SBProcess.cpp
@@ -928,6 +928,14 @@ size_t SBProcess::WriteMemory(addr_t addr, const void 
*src, size_t src_len,
   return bytes_written;
 }
 
+void SBProcess::GetStatus(SBStream ) {
+  LLDB_INSTRUMENT_VA(this, status);
+
+  ProcessSP process_sp(GetSP());
+  if (process_sp)
+process_sp->GetStatus(status.ref());
+}
+
 bool SBProcess::GetDescription(SBStream ) {
   LLDB_INSTRUMENT_VA(this, description);
 
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 ffa0dc943e0693..8c71ca1777b9dd 100644
--- a/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py
+++ b/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py
@@ -4,10 +4,21 @@
 
 import dap_server
 import lldbdap_testcase
+import psutil
+from collections import deque
 from lldbsuite.test import lldbutil
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
 
+def get_subprocess(process_name):
+queue = deque([psutil.Process(os.getpid())])
+while queue:
+process = queue.popleft()
+if process.name() == process_name:
+return process
+queue.extend(process.children())
+
+self.assertTrue(False, "No subprocess with name %s found" % process_name)
 
 class TestDAP_console(lldbdap_testcase.DAPTestCaseBase):
 def check_lldb_command(
@@ -104,3 +115,49 @@ def test_empty_escape_prefix(self):
 "Help can be invoked",
 command_escape_prefix="",
 )
+
+@skipIfWindows
+@skipIfRemote
+def test_exit_status_message_sigterm(self):
+source = "main.cpp"
+program = self.getBuildArtifact("a.out")
+self.build_and_launch(program, commandEscapePrefix="")
+breakpoint1_line = line_number(source, "// breakpoint 1")
+breakpoint_ids = self.set_source_breakpoints(source, 
[breakpoint1_line])
+self.continue_to_breakpoints(breakpoint_ids)
+
+# Kill lldb-server process.
+process_name = (
+"debugserver" if platform.system() in ["Darwin"] else "lldb-server"
+)
+process = get_subprocess(process_name)
+process.terminate()
+process.wait()
+
+# Get the console output
+console_output = self.collect_console(1.0)
+
+# Verify the exit status message is printed.
+self.assertIn(
+"exited with status = -1 (0x) debugserver died with signal 
SIGTERM",
+console_output,
+"Exit status does not contain message 'exited with status'",
+)
+
+@skipIfWindows
+@skipIfRemote
+def test_exit_status_message_ok(self):
+source = "main.cpp"
+program = self.getBuildArtifact("a.out")
+self.build_and_launch(program, commandEscapePrefix="")
+self.continue_to_exit()
+
+# Get the console output
+console_output = self.collect_console(1.0)
+
+# Verify the exit status message is printed.
+self.assertIn(
+"exited with status = 0 (0x)",
+console_output,
+"Exit status does not contain message 'exited with status'",
+)
diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp 

[Lldb-commits] [clang] [clang-tools-extra] [compiler-rt] [flang] [libc] [libclc] [libcxx] [libcxxabi] [libunwind] [lld] [lldb] [llvm] [mlir] [openmp] [polly] [pstl] Update IDE Folders (PR #89153)

2024-04-22 Thread Felipe de Azevedo Piovezan via lldb-commits


@@ -406,5 +426,13 @@ function(llvm_ExternalProject_Add name source_dir)
   WORKING_DIRECTORY ${BINARY_DIR}
   VERBATIM
   USES_TERMINAL)
+if (ARG_FOLDER)
+  set_target_properties(${target} PROPERTIES FOLDER "${ARG_FOLDER}")
+endif ()
   endforeach()
+
+  #set_target_folder(
+  #  TARGETS ${name} install-${name} ${name}-clobber ${name}-clear 
${name}-clean ${ARG_EXTRA_TARGETS}
+  #  FOLDER "${ARG_FOLDE}"
+  #)

felipepiovezan wrote:

commented code?

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


[Lldb-commits] [clang] [clang-tools-extra] [compiler-rt] [flang] [libc] [libclc] [libcxx] [libcxxabi] [libunwind] [lld] [lldb] [llvm] [mlir] [openmp] [polly] [pstl] Update IDE Folders (PR #89153)

2024-04-22 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Michael Kruse (Meinersbur)


Changes

Update the folder titles for targets in the monorepository that have not seen 
taken care of for some time. These are the folders that targets are organized 
in Visual Studio and XCode (`set_property(TARGET target PROPERTY FOLDER 
"title")`) when using the respective CMake's IDE generator.

 * Ensure that every target is in a folder
 * Use a folder hierarchy with each LLVM subproject as a top-level folder
 * Use consistent folder names between subprojects
 * When using target-creating functions from AddLLVM.cmake, automatically 
deduce the folder. This reduces the number of 
`set_property`/`set_target_property`, but are still necessary when 
`add_custom_target`, `add_executable`, `add_library`, etc. are used.

Before:
img 
src="https://github.com/llvm/llvm-project/assets/2278807/ad47015e-8782-4a32-a69f-d2cff4990c9a;
 width="200" /

After:
img 
src="https://github.com/llvm/llvm-project/assets/2278807/aeee0fbd-2767-40da-9c15-baab034f2826;
 width="200" /

Visual Studio now supports CMake projects directly, but the Visual Studio 
solution generator still has advantages. One is that targets including entire 
folders can be hidden when not needed. This removes non-relevant items form 
code search and does not try to rebuild them. For instance, when hiding 
Tablegenning and Resources targets, an iterative build can be faster than using 
ninja. The other one is that the organization in folders is less cluttered than 
the CMake targets view or the startup item view[^1]:
img 
src="https://github.com/llvm/llvm-project/assets/2278807/7250fcf6-417e-4979-9c7c-0da6b093a7f7;
 width="150" /

[^1]: Items can be hidden from the dropdown menu, but the entire list is still 
flat with hundreds of executables.

---

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


195 Files Affected:

- (modified) bolt/CMakeLists.txt (+2) 
- (modified) bolt/cmake/modules/AddBOLT.cmake (-1) 
- (modified) bolt/docs/CMakeLists.txt (+1) 
- (modified) bolt/test/CMakeLists.txt (+1-2) 
- (modified) bolt/unittests/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/CMakeLists.txt (+2) 
- (modified) clang-tools-extra/clang-tidy/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-tidy/misc/CMakeLists.txt (+2) 
- (modified) clang-tools-extra/clangd/unittests/CMakeLists.txt (+1) 
- (modified) clang-tools-extra/docs/CMakeLists.txt (+1) 
- (modified) clang-tools-extra/include-cleaner/unittests/CMakeLists.txt (+1) 
- (modified) clang-tools-extra/pseudo/include/CMakeLists.txt (+1) 
- (modified) clang-tools-extra/pseudo/tool/CMakeLists.txt (+1) 
- (modified) clang-tools-extra/pseudo/unittests/CMakeLists.txt (+1) 
- (modified) clang-tools-extra/test/CMakeLists.txt (-1) 
- (modified) clang-tools-extra/unittests/CMakeLists.txt (+1-1) 
- (modified) clang/CMakeLists.txt (+5-3) 
- (modified) clang/bindings/python/tests/CMakeLists.txt (+1-1) 
- (modified) clang/cmake/modules/AddClang.cmake (-3) 
- (modified) clang/docs/CMakeLists.txt (+1) 
- (modified) clang/lib/Analysis/FlowSensitive/CMakeLists.txt (+1) 
- (modified) clang/lib/Headers/CMakeLists.txt (+2-2) 
- (modified) clang/lib/Tooling/CMakeLists.txt (+2) 
- (modified) clang/test/CMakeLists.txt (+2-3) 
- (modified) clang/tools/libclang/CMakeLists.txt (+1-1) 
- (modified) clang/unittests/CMakeLists.txt (+1-1) 
- (modified) clang/utils/ClangVisualizers/CMakeLists.txt (+1-1) 
- (modified) clang/utils/TableGen/CMakeLists.txt (-2) 
- (modified) clang/utils/hmaptool/CMakeLists.txt (+1-1) 
- (modified) compiler-rt/CMakeLists.txt (+2-1) 
- (modified) compiler-rt/cmake/Modules/AddCompilerRT.cmake (+11-10) 
- (modified) compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake (+2-2) 
- (modified) compiler-rt/cmake/Modules/CompilerRTUtils.cmake (+2-2) 
- (modified) compiler-rt/cmake/base-config-ix.cmake (+2-2) 
- (modified) compiler-rt/include/CMakeLists.txt (+1-1) 
- (modified) compiler-rt/lib/asan/tests/CMakeLists.txt (+4-4) 
- (modified) compiler-rt/lib/builtins/CMakeLists.txt (+1-1) 
- (modified) compiler-rt/lib/fuzzer/tests/CMakeLists.txt (+3-3) 
- (modified) compiler-rt/lib/gwp_asan/tests/CMakeLists.txt (+2-2) 
- (modified) compiler-rt/lib/interception/tests/CMakeLists.txt (+2-2) 
- (modified) compiler-rt/lib/memprof/tests/CMakeLists.txt (+2-2) 
- (modified) compiler-rt/lib/orc/tests/CMakeLists.txt (+3-3) 
- (modified) compiler-rt/lib/sanitizer_common/tests/CMakeLists.txt (+2-2) 
- (modified) compiler-rt/lib/stats/CMakeLists.txt (+1-1) 
- (modified) compiler-rt/lib/tsan/CMakeLists.txt (+1-1) 
- (modified) compiler-rt/lib/tsan/dd/CMakeLists.txt (+1-1) 
- (modified) compiler-rt/lib/tsan/rtl/CMakeLists.txt (+1-1) 
- (modified) compiler-rt/lib/xray/tests/CMakeLists.txt (+2-2) 
- (modified) compiler-rt/test/CMakeLists.txt (+1) 
- (modified) compiler-rt/test/asan/CMakeLists.txt (-3) 
- (modified) compiler-rt/test/asan_abi/CMakeLists.txt (-1) 
- (modified) 

[Lldb-commits] [clang] [clang-tools-extra] [compiler-rt] [flang] [libc] [libclc] [libcxx] [libcxxabi] [libunwind] [lld] [lldb] [llvm] [mlir] [openmp] [polly] [pstl] Update IDE Folders (PR #89153)

2024-04-22 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-libcxx

Author: Michael Kruse (Meinersbur)


Changes

Update the folder titles for targets in the monorepository that have not seen 
taken care of for some time. These are the folders that targets are organized 
in Visual Studio and XCode (`set_property(TARGET target PROPERTY FOLDER 
"title")`) when using the respective CMake's IDE generator.

 * Ensure that every target is in a folder
 * Use a folder hierarchy with each LLVM subproject as a top-level folder
 * Use consistent folder names between subprojects
 * When using target-creating functions from AddLLVM.cmake, automatically 
deduce the folder. This reduces the number of 
`set_property`/`set_target_property`, but are still necessary when 
`add_custom_target`, `add_executable`, `add_library`, etc. are used.

Before:
img 
src="https://github.com/llvm/llvm-project/assets/2278807/ad47015e-8782-4a32-a69f-d2cff4990c9a;
 width="200" /

After:
img 
src="https://github.com/llvm/llvm-project/assets/2278807/aeee0fbd-2767-40da-9c15-baab034f2826;
 width="200" /

Visual Studio now supports CMake projects directly, but the Visual Studio 
solution generator still has advantages. One is that targets including entire 
folders can be hidden when not needed. This removes non-relevant items form 
code search and does not try to rebuild them. For instance, when hiding 
Tablegenning and Resources targets, an iterative build can be faster than using 
ninja. The other one is that the organization in folders is less cluttered than 
the CMake targets view or the startup item view[^1]:
img 
src="https://github.com/llvm/llvm-project/assets/2278807/7250fcf6-417e-4979-9c7c-0da6b093a7f7;
 width="150" /

[^1]: Items can be hidden from the dropdown menu, but the entire list is still 
flat with hundreds of executables.

---

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


195 Files Affected:

- (modified) bolt/CMakeLists.txt (+2) 
- (modified) bolt/cmake/modules/AddBOLT.cmake (-1) 
- (modified) bolt/docs/CMakeLists.txt (+1) 
- (modified) bolt/test/CMakeLists.txt (+1-2) 
- (modified) bolt/unittests/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/CMakeLists.txt (+2) 
- (modified) clang-tools-extra/clang-tidy/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-tidy/misc/CMakeLists.txt (+2) 
- (modified) clang-tools-extra/clangd/unittests/CMakeLists.txt (+1) 
- (modified) clang-tools-extra/docs/CMakeLists.txt (+1) 
- (modified) clang-tools-extra/include-cleaner/unittests/CMakeLists.txt (+1) 
- (modified) clang-tools-extra/pseudo/include/CMakeLists.txt (+1) 
- (modified) clang-tools-extra/pseudo/tool/CMakeLists.txt (+1) 
- (modified) clang-tools-extra/pseudo/unittests/CMakeLists.txt (+1) 
- (modified) clang-tools-extra/test/CMakeLists.txt (-1) 
- (modified) clang-tools-extra/unittests/CMakeLists.txt (+1-1) 
- (modified) clang/CMakeLists.txt (+5-3) 
- (modified) clang/bindings/python/tests/CMakeLists.txt (+1-1) 
- (modified) clang/cmake/modules/AddClang.cmake (-3) 
- (modified) clang/docs/CMakeLists.txt (+1) 
- (modified) clang/lib/Analysis/FlowSensitive/CMakeLists.txt (+1) 
- (modified) clang/lib/Headers/CMakeLists.txt (+2-2) 
- (modified) clang/lib/Tooling/CMakeLists.txt (+2) 
- (modified) clang/test/CMakeLists.txt (+2-3) 
- (modified) clang/tools/libclang/CMakeLists.txt (+1-1) 
- (modified) clang/unittests/CMakeLists.txt (+1-1) 
- (modified) clang/utils/ClangVisualizers/CMakeLists.txt (+1-1) 
- (modified) clang/utils/TableGen/CMakeLists.txt (-2) 
- (modified) clang/utils/hmaptool/CMakeLists.txt (+1-1) 
- (modified) compiler-rt/CMakeLists.txt (+2-1) 
- (modified) compiler-rt/cmake/Modules/AddCompilerRT.cmake (+11-10) 
- (modified) compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake (+2-2) 
- (modified) compiler-rt/cmake/Modules/CompilerRTUtils.cmake (+2-2) 
- (modified) compiler-rt/cmake/base-config-ix.cmake (+2-2) 
- (modified) compiler-rt/include/CMakeLists.txt (+1-1) 
- (modified) compiler-rt/lib/asan/tests/CMakeLists.txt (+4-4) 
- (modified) compiler-rt/lib/builtins/CMakeLists.txt (+1-1) 
- (modified) compiler-rt/lib/fuzzer/tests/CMakeLists.txt (+3-3) 
- (modified) compiler-rt/lib/gwp_asan/tests/CMakeLists.txt (+2-2) 
- (modified) compiler-rt/lib/interception/tests/CMakeLists.txt (+2-2) 
- (modified) compiler-rt/lib/memprof/tests/CMakeLists.txt (+2-2) 
- (modified) compiler-rt/lib/orc/tests/CMakeLists.txt (+3-3) 
- (modified) compiler-rt/lib/sanitizer_common/tests/CMakeLists.txt (+2-2) 
- (modified) compiler-rt/lib/stats/CMakeLists.txt (+1-1) 
- (modified) compiler-rt/lib/tsan/CMakeLists.txt (+1-1) 
- (modified) compiler-rt/lib/tsan/dd/CMakeLists.txt (+1-1) 
- (modified) compiler-rt/lib/tsan/rtl/CMakeLists.txt (+1-1) 
- (modified) compiler-rt/lib/xray/tests/CMakeLists.txt (+2-2) 
- (modified) compiler-rt/test/CMakeLists.txt (+1) 
- (modified) compiler-rt/test/asan/CMakeLists.txt (-3) 
- (modified) compiler-rt/test/asan_abi/CMakeLists.txt (-1) 
- (modified) 

[Lldb-commits] [clang] [clang-tools-extra] [compiler-rt] [flang] [libc] [libclc] [libcxx] [libcxxabi] [libunwind] [lld] [lldb] [llvm] [mlir] [openmp] [polly] [pstl] Update IDE Folders (PR #89153)

2024-04-22 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lld

Author: Michael Kruse (Meinersbur)


Changes

Update the folder titles for targets in the monorepository that have not seen 
taken care of for some time. These are the folders that targets are organized 
in Visual Studio and XCode (`set_property(TARGET target PROPERTY FOLDER 
"title")`) when using the respective CMake's IDE generator.

 * Ensure that every target is in a folder
 * Use a folder hierarchy with each LLVM subproject as a top-level folder
 * Use consistent folder names between subprojects
 * When using target-creating functions from AddLLVM.cmake, automatically 
deduce the folder. This reduces the number of 
`set_property`/`set_target_property`, but are still necessary when 
`add_custom_target`, `add_executable`, `add_library`, etc. are used.

Before:
img 
src="https://github.com/llvm/llvm-project/assets/2278807/ad47015e-8782-4a32-a69f-d2cff4990c9a;
 width="200" /

After:
img 
src="https://github.com/llvm/llvm-project/assets/2278807/aeee0fbd-2767-40da-9c15-baab034f2826;
 width="200" /

Visual Studio now supports CMake projects directly, but the Visual Studio 
solution generator still has advantages. One is that targets including entire 
folders can be hidden when not needed. This removes non-relevant items form 
code search and does not try to rebuild them. For instance, when hiding 
Tablegenning and Resources targets, an iterative build can be faster than using 
ninja. The other one is that the organization in folders is less cluttered than 
the CMake targets view or the startup item view[^1]:
img 
src="https://github.com/llvm/llvm-project/assets/2278807/7250fcf6-417e-4979-9c7c-0da6b093a7f7;
 width="150" /

[^1]: Items can be hidden from the dropdown menu, but the entire list is still 
flat with hundreds of executables.

---

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


195 Files Affected:

- (modified) bolt/CMakeLists.txt (+2) 
- (modified) bolt/cmake/modules/AddBOLT.cmake (-1) 
- (modified) bolt/docs/CMakeLists.txt (+1) 
- (modified) bolt/test/CMakeLists.txt (+1-2) 
- (modified) bolt/unittests/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/CMakeLists.txt (+2) 
- (modified) clang-tools-extra/clang-tidy/CMakeLists.txt (+1-1) 
- (modified) clang-tools-extra/clang-tidy/misc/CMakeLists.txt (+2) 
- (modified) clang-tools-extra/clangd/unittests/CMakeLists.txt (+1) 
- (modified) clang-tools-extra/docs/CMakeLists.txt (+1) 
- (modified) clang-tools-extra/include-cleaner/unittests/CMakeLists.txt (+1) 
- (modified) clang-tools-extra/pseudo/include/CMakeLists.txt (+1) 
- (modified) clang-tools-extra/pseudo/tool/CMakeLists.txt (+1) 
- (modified) clang-tools-extra/pseudo/unittests/CMakeLists.txt (+1) 
- (modified) clang-tools-extra/test/CMakeLists.txt (-1) 
- (modified) clang-tools-extra/unittests/CMakeLists.txt (+1-1) 
- (modified) clang/CMakeLists.txt (+5-3) 
- (modified) clang/bindings/python/tests/CMakeLists.txt (+1-1) 
- (modified) clang/cmake/modules/AddClang.cmake (-3) 
- (modified) clang/docs/CMakeLists.txt (+1) 
- (modified) clang/lib/Analysis/FlowSensitive/CMakeLists.txt (+1) 
- (modified) clang/lib/Headers/CMakeLists.txt (+2-2) 
- (modified) clang/lib/Tooling/CMakeLists.txt (+2) 
- (modified) clang/test/CMakeLists.txt (+2-3) 
- (modified) clang/tools/libclang/CMakeLists.txt (+1-1) 
- (modified) clang/unittests/CMakeLists.txt (+1-1) 
- (modified) clang/utils/ClangVisualizers/CMakeLists.txt (+1-1) 
- (modified) clang/utils/TableGen/CMakeLists.txt (-2) 
- (modified) clang/utils/hmaptool/CMakeLists.txt (+1-1) 
- (modified) compiler-rt/CMakeLists.txt (+2-1) 
- (modified) compiler-rt/cmake/Modules/AddCompilerRT.cmake (+11-10) 
- (modified) compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake (+2-2) 
- (modified) compiler-rt/cmake/Modules/CompilerRTUtils.cmake (+2-2) 
- (modified) compiler-rt/cmake/base-config-ix.cmake (+2-2) 
- (modified) compiler-rt/include/CMakeLists.txt (+1-1) 
- (modified) compiler-rt/lib/asan/tests/CMakeLists.txt (+4-4) 
- (modified) compiler-rt/lib/builtins/CMakeLists.txt (+1-1) 
- (modified) compiler-rt/lib/fuzzer/tests/CMakeLists.txt (+3-3) 
- (modified) compiler-rt/lib/gwp_asan/tests/CMakeLists.txt (+2-2) 
- (modified) compiler-rt/lib/interception/tests/CMakeLists.txt (+2-2) 
- (modified) compiler-rt/lib/memprof/tests/CMakeLists.txt (+2-2) 
- (modified) compiler-rt/lib/orc/tests/CMakeLists.txt (+3-3) 
- (modified) compiler-rt/lib/sanitizer_common/tests/CMakeLists.txt (+2-2) 
- (modified) compiler-rt/lib/stats/CMakeLists.txt (+1-1) 
- (modified) compiler-rt/lib/tsan/CMakeLists.txt (+1-1) 
- (modified) compiler-rt/lib/tsan/dd/CMakeLists.txt (+1-1) 
- (modified) compiler-rt/lib/tsan/rtl/CMakeLists.txt (+1-1) 
- (modified) compiler-rt/lib/xray/tests/CMakeLists.txt (+2-2) 
- (modified) compiler-rt/test/CMakeLists.txt (+1) 
- (modified) compiler-rt/test/asan/CMakeLists.txt (-3) 
- (modified) compiler-rt/test/asan_abi/CMakeLists.txt (-1) 
- (modified) 

[Lldb-commits] [clang] [clang-tools-extra] [compiler-rt] [flang] [libc] [libclc] [libcxx] [libcxxabi] [libunwind] [lld] [lldb] [llvm] [mlir] [openmp] [polly] [pstl] Update IDE Folders (PR #89153)

2024-04-22 Thread Michael Kruse via lldb-commits

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


[Lldb-commits] [lldb] I left some commented code in. This test doesn't run reliably in the different build bots (PR #89637)

2024-04-22 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Fred Grim (feg208)


Changes

@jimingham I am wondering if you are ok removing this test? It caused 
failures in some of the build bots because the user time was less than a 
microsecond. Alternatively we can increase the number of loops or maybe I need 
some other approach? I had commented it out just to not impact others

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


1 Files Affected:

- (modified) lldb/unittests/Host/linux/HostTest.cpp (-14) 


``diff
diff --git a/lldb/unittests/Host/linux/HostTest.cpp 
b/lldb/unittests/Host/linux/HostTest.cpp
index 733909902474d7..5599e4349c8291 100644
--- a/lldb/unittests/Host/linux/HostTest.cpp
+++ b/lldb/unittests/Host/linux/HostTest.cpp
@@ -68,18 +68,4 @@ TEST_F(HostTest, GetProcessInfo) {
   EXPECT_TRUE(Info.GetArchitecture().IsValid());
   EXPECT_EQ(HostInfo::GetArchitecture(HostInfo::eArchKindDefault),
 Info.GetArchitecture());
-  // Test timings
-  /*
-   * This is flaky in the buildbots on all archs
-  ASSERT_TRUE(Host::GetProcessInfo(getpid(), Info));
-  ProcessInstanceInfo::timespec user_time = Info.GetUserTime();
-  static volatile unsigned u = 0;
-  for (unsigned i = 0; i < 10'000'000; i++) {
-u = i;
-  }
-  ASSERT_TRUE(Host::GetProcessInfo(getpid(), Info));
-  ProcessInstanceInfo::timespec next_user_time = Info.GetUserTime();
-  ASSERT_TRUE(user_time.tv_sec < next_user_time.tv_sec ||
-  user_time.tv_usec < next_user_time.tv_usec);
-  */
 }

``




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


[Lldb-commits] [lldb] I left some commented code in. This test doesn't run reliably in the different build bots (PR #89637)

2024-04-22 Thread Fred Grim via lldb-commits

https://github.com/feg208 created 
https://github.com/llvm/llvm-project/pull/89637

@jimingham I am wondering if you are ok removing this test? It caused failures 
in some of the build bots because the user time was less than a microsecond. 
Alternatively we can increase the number of loops or maybe I need some other 
approach? I had commented it out just to not impact others

>From 21ae49be17c829281a0f9b1beef95712f0b19046 Mon Sep 17 00:00:00 2001
From: Fred Grim 
Date: Mon, 22 Apr 2024 10:17:14 -0700
Subject: [PATCH] I left some commented code in. This test doesn't run reliably
 in the different build bots

---
 lldb/unittests/Host/linux/HostTest.cpp | 14 --
 1 file changed, 14 deletions(-)

diff --git a/lldb/unittests/Host/linux/HostTest.cpp 
b/lldb/unittests/Host/linux/HostTest.cpp
index 733909902474d7..5599e4349c8291 100644
--- a/lldb/unittests/Host/linux/HostTest.cpp
+++ b/lldb/unittests/Host/linux/HostTest.cpp
@@ -68,18 +68,4 @@ TEST_F(HostTest, GetProcessInfo) {
   EXPECT_TRUE(Info.GetArchitecture().IsValid());
   EXPECT_EQ(HostInfo::GetArchitecture(HostInfo::eArchKindDefault),
 Info.GetArchitecture());
-  // Test timings
-  /*
-   * This is flaky in the buildbots on all archs
-  ASSERT_TRUE(Host::GetProcessInfo(getpid(), Info));
-  ProcessInstanceInfo::timespec user_time = Info.GetUserTime();
-  static volatile unsigned u = 0;
-  for (unsigned i = 0; i < 10'000'000; i++) {
-u = i;
-  }
-  ASSERT_TRUE(Host::GetProcessInfo(getpid(), Info));
-  ProcessInstanceInfo::timespec next_user_time = Info.GetUserTime();
-  ASSERT_TRUE(user_time.tv_sec < next_user_time.tv_sec ||
-  user_time.tv_usec < next_user_time.tv_usec);
-  */
 }

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


[Lldb-commits] [lldb] [lldb][MinidumpFileBuilder] Fix addition of MemoryList steam (PR #88564)

2024-04-22 Thread via lldb-commits

github-actions[bot] wrote:



@mbucko Congratulations on having your first Pull Request (PR) merged into the 
LLVM Project!

Your changes will be combined with recent changes from other authors, then 
tested
by our [build bots](https://lab.llvm.org/buildbot/). If there is a problem with 
a build, you may receive a report in an email or a comment on this PR.

Please check whether problems have been caused by your change specifically, as
the builds can include changes from many authors. It is not uncommon for your
change to be included in a build that fails due to someone else's changes, or
infrastructure issues.

How to do this, and the rest of the post-merge process, is covered in detail 
[here](https://llvm.org/docs/MyFirstTypoFix.html#myfirsttypofix-issues-after-landing-your-pr).

If your change does cause a problem, it may be reverted, or you can revert it 
yourself.
This is a normal part of [LLVM 
development](https://llvm.org/docs/DeveloperPolicy.html#patch-reversion-policy).
 You can fix your changes and open a new PR to merge them again.

If you don't get any reports, no action is required from you. Your changes are 
working as expected, well done!


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


[Lldb-commits] [lldb] [lldb][MinidumpFileBuilder] Fix addition of MemoryList steam (PR #88564)

2024-04-22 Thread via lldb-commits

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


[Lldb-commits] [lldb] 92631a4 - [lldb][MinidumpFileBuilder] Fix addition of MemoryList steam (#88564)

2024-04-22 Thread via lldb-commits

Author: Miro Bucko
Date: 2024-04-22T10:40:06-07:00
New Revision: 92631a4824a91f3268a5716dd3459df8dc6bfb63

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

LOG: [lldb][MinidumpFileBuilder] Fix addition of MemoryList steam (#88564)

Summary:
AddMemoryList() was returning the last error status returned by
ReadMemory(). So if an invalid memory region was read last, the function
would return an error.

Test Plan:
./bin/llvm-lit -sv
~/src/llvm-project/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py

Reviewers:
kevinfrei,clayborg 

Subscribers:

Tasks:

Tags:

Added: 


Modified: 
lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
lldb/source/Target/Process.cpp

Removed: 




diff  --git a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp 
b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
index cefd4cb22b6bae..601f11d51d4282 100644
--- a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
+++ b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
@@ -21,6 +21,7 @@
 #include "lldb/Target/ThreadList.h"
 #include "lldb/Utility/DataExtractor.h"
 #include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/Log.h"
 #include "lldb/Utility/RegisterValue.h"
 
 #include "llvm/ADT/StringRef.h"
@@ -663,14 +664,20 @@ MinidumpFileBuilder::AddMemoryList(const lldb::ProcessSP 
_sp,
   DataBufferHeap helper_data;
   std::vector mem_descriptors;
   for (const auto _range : core_ranges) {
-// Skip empty memory regions or any regions with no permissions.
-if (core_range.range.empty() || core_range.lldb_permissions == 0)
+// Skip empty memory regions.
+if (core_range.range.empty())
   continue;
 const addr_t addr = core_range.range.start();
 const addr_t size = core_range.range.size();
 auto data_up = std::make_unique(size, 0);
 const size_t bytes_read =
 process_sp->ReadMemory(addr, data_up->GetBytes(), size, error);
+if (error.Fail()) {
+  Log *log = GetLog(LLDBLog::Object);
+  LLDB_LOGF(log, "Failed to read memory region. Bytes read: %zu, error: 
%s",
+bytes_read, error.AsCString());
+  error.Clear();
+}
 if (bytes_read == 0)
   continue;
 // We have a good memory region with valid bytes to store.

diff  --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index f02ec37cb0f08f..606518ca541267 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -6325,8 +6325,11 @@ static bool AddDirtyPages(const MemoryRegionInfo ,
 // ranges.
 static void AddRegion(const MemoryRegionInfo , bool try_dirty_pages,
   Process::CoreFileMemoryRanges ) {
-  // Don't add empty ranges or ranges with no permissions.
-  if (region.GetRange().GetByteSize() == 0 || region.GetLLDBPermissions() == 0)
+  // Don't add empty ranges.
+  if (region.GetRange().GetByteSize() == 0)
+return;
+  // Don't add ranges with no read permissions.
+  if ((region.GetLLDBPermissions() & lldb::ePermissionsReadable) == 0)
 return;
   if (try_dirty_pages && AddDirtyPages(region, ranges))
 return;



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


[Lldb-commits] [lldb] [lldb-dap] Report exit status message in lldb-dap, same as lldb cli (PR #89405)

2024-04-22 Thread Miro Bucko via lldb-commits


@@ -4,10 +4,30 @@
 
 import dap_server
 import lldbdap_testcase
+import psutil
+from collections import deque
 from lldbsuite.test import lldbutil
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
 
+def get_subprocess_pid(process_name):
+queue = deque([psutil.Process(os.getpid())])
+while queue:
+process = queue.popleft()
+if process.name() == process_name:
+return process.pid
+queue.extend(process.children())

mbucko wrote:

The lldb-server is not a direct subprocess of these tests. It's actually 
llvm-lit -> lldb-dap -> lldb-server. And also, lldb-dap has already been 
renamed once.

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


[Lldb-commits] [lldb] [lldb-dap] Report exit status message in lldb-dap, same as lldb cli (PR #89405)

2024-04-22 Thread via lldb-commits


@@ -104,3 +115,49 @@ def test_empty_escape_prefix(self):
 "Help can be invoked",
 command_escape_prefix="",
 )
+
+@skipIfWindows
+@skipIfRemote
+def test_exit_status_message_sigterm(self):
+source = "main.cpp"
+program = self.getBuildArtifact("a.out")
+self.build_and_launch(program, commandEscapePrefix="")
+breakpoint1_line = line_number(source, "// breakpoint 1")
+breakpoint_ids = self.set_source_breakpoints(source, 
[breakpoint1_line])
+self.continue_to_breakpoints(breakpoint_ids)
+
+# Kill lldb-server process.
+process_name = (
+"debugserver" if platform.platform() == "MacOS" else "lldb-server"
+)
+process = get_subprocess(process_name)
+process.terminate()

jeffreytan81 wrote:

I wish we can create a crash packet so that we can initiate 
lldb-server/debugserver crash for testing purpose without this kind of hack...

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


[Lldb-commits] [lldb] [lldb-dap] Report exit status message in lldb-dap, same as lldb cli (PR #89405)

2024-04-22 Thread via lldb-commits


@@ -503,6 +503,14 @@ void EventThreadFunction() {
 SendContinuedEvent();
 break;
   case lldb::eStateExited:
+const int exit_status = process.GetExitStatus();
+const char *const exit_description = process.GetExitDescription();
+g_dap.SendFormattedOutput(
+OutputType::Console,
+"Process %" PRIu64 " exited with status = %i (0x%8.8x) %s\n",
+process.GetProcessID(), exit_status, exit_status,
+exit_description ? exit_description : "");
+

jeffreytan81 wrote:

This code seems to be a duplication of `Process::GetStatus`. Maybe we should 
expose `Process::GetStatus` in SBPorcess to ensure lldb-dap and lldb output are 
not out of sync if future modification is added to `Process::GetStatus`. 

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


[Lldb-commits] [lldb] [lldb-dap] Report exit status message in lldb-dap, same as lldb cli (PR #89405)

2024-04-22 Thread via lldb-commits


@@ -104,3 +115,49 @@ def test_empty_escape_prefix(self):
 "Help can be invoked",
 command_escape_prefix="",
 )
+
+@skipIfWindows
+@skipIfRemote
+def test_exit_status_message_sigterm(self):
+source = "main.cpp"
+program = self.getBuildArtifact("a.out")
+self.build_and_launch(program, commandEscapePrefix="")
+breakpoint1_line = line_number(source, "// breakpoint 1")
+breakpoint_ids = self.set_source_breakpoints(source, 
[breakpoint1_line])
+self.continue_to_breakpoints(breakpoint_ids)
+
+# Kill lldb-server process.
+process_name = (
+"debugserver" if platform.platform() == "MacOS" else "lldb-server"
+)
+process = get_subprocess(process_name)
+process.terminate()
+process.wait(timeout=5)
+
+# Get the console output
+console_output = self.collect_console(1.0)

jeffreytan81 wrote:

I am not big fan of adding timeout in test for synchronization. It can always 
cause race condition in super busy machine. 

Instead, I would suggest wait for process to exit and get all the output which 
should guarantee to have all the output ready. This way also tests that 
exit/terminated events are sent after this exit message. 

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


[Lldb-commits] [lldb] [lldb][Docs] Make formatting regular in lldb-gdb-remote.txt (PR #89587)

2024-04-22 Thread Jason Molenda via lldb-commits

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

Yes please, very long overdue, I've felt bad about not trying to do something 
here myself.

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


[Lldb-commits] [lldb] [lldb][NFC] Remove unused pexpect/ptyprocess (PR #89609)

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

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

Thank you for seeing this all the way through, Jordan! 拾

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


[Lldb-commits] [lldb] [lldb-dap] Report exit status message in lldb-dap, same as lldb cli (PR #89405)

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

https://github.com/JDevlieghere requested changes to this pull request.


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


[Lldb-commits] [lldb] [lldb-dap] Report exit status message in lldb-dap, same as lldb cli (PR #89405)

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

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


[Lldb-commits] [lldb] [lldb-dap] Report exit status message in lldb-dap, same as lldb cli (PR #89405)

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


@@ -104,3 +115,49 @@ def test_empty_escape_prefix(self):
 "Help can be invoked",
 command_escape_prefix="",
 )
+
+@skipIfWindows
+@skipIfRemote
+def test_exit_status_message_sigterm(self):
+source = "main.cpp"
+program = self.getBuildArtifact("a.out")
+self.build_and_launch(program, commandEscapePrefix="")
+breakpoint1_line = line_number(source, "// breakpoint 1")
+breakpoint_ids = self.set_source_breakpoints(source, 
[breakpoint1_line])
+self.continue_to_breakpoints(breakpoint_ids)
+
+# Kill lldb-server process.
+process_name = (
+"debugserver" if platform.platform() == "MacOS" else "lldb-server"

JDevlieghere wrote:

On macOS, `platform.platform()` returns something like 
'macOS-14.5-arm64-arm-64bit'. What you want to check here is 
`platform.system()` and check that it's "Darwin":

```
"debugserver" if platform.system() in ["Darwin"] else "lldb-server"
```

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


[Lldb-commits] [lldb] [lldb][Docs] Make formatting regular in lldb-gdb-remote.txt (PR #89587)

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

JDevlieghere wrote:

+1 on making this available on the website. Unless the goal is to preserve both 
the textual and the markdown format, I'm not sure there's a whole lot of value 
in landing this. Maybe we can avoid churn and jump straight ahead to the 
markdown version? 

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


[Lldb-commits] [lldb] [lldb][Docs] Make formatting regular in lldb-gdb-remote.txt (PR #89587)

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

JDevlieghere wrote:

> Subsequent PRs will build on this:
> 
> * Enable Markdown support in the website build.

I added markdown support in 8b95bd3310c126e76e0714bea6003a9b1aa739fb but it was 
subsequently removed again in d03b04f211e73c2f59ba5dc6a6a8c777de001ad6 (I 
wasn't added as a reviewer, so I found out after the fact). We can probably 
just reland the original commit to make that work. 



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


[Lldb-commits] [lldb] [lldb-dap] Report exit status message in lldb-dap, same as lldb cli (PR #89405)

2024-04-22 Thread Miro Bucko via lldb-commits

https://github.com/mbucko updated 
https://github.com/llvm/llvm-project/pull/89405

>From b20ef7c68e23835ebf2c31f836407a0fb9f875a0 Mon Sep 17 00:00:00 2001
From: Miro Bucko 
Date: Fri, 19 Apr 2024 08:08:02 -0700
Subject: [PATCH] Report exit status message in lldb-dap, same as lldb cli

Summary:
When the target inferior process that is being debugged exits in lldb command 
line, it emits following message:
Process 4049526 exited with status = -1 (0x) debugserver died with 
signal SIGTERM
lldb-dap on the other hand does not emit a similar message.
This PR adds the same status message to lldb-dap.

Test Plan:
In VSCode debug any target and hit stop mode, kill lldb-server and observe an 
exit status message similar to the following:
Process 2167677 exited with status = -1 (0x) debugserver died with 
signal SIGTERM

Reviewers:

Subscribers:

Tasks:
lldb-dap

Tags:
---
 .../tools/lldb-dap/console/TestDAP_console.py | 57 +++
 lldb/tools/lldb-dap/lldb-dap.cpp  |  8 +++
 2 files changed, 65 insertions(+)

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 ffa0dc943e0693..2ffb67ac84c86c 100644
--- a/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py
+++ b/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py
@@ -4,10 +4,21 @@
 
 import dap_server
 import lldbdap_testcase
+import psutil
+from collections import deque
 from lldbsuite.test import lldbutil
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
 
+def get_subprocess(process_name):
+queue = deque([psutil.Process(os.getpid())])
+while queue:
+process = queue.popleft()
+if process.name() == process_name:
+return process
+queue.extend(process.children())
+
+self.assertTrue(False, "No subprocess with name %s found" % process_name)
 
 class TestDAP_console(lldbdap_testcase.DAPTestCaseBase):
 def check_lldb_command(
@@ -104,3 +115,49 @@ def test_empty_escape_prefix(self):
 "Help can be invoked",
 command_escape_prefix="",
 )
+
+@skipIfWindows
+@skipIfRemote
+def test_exit_status_message_sigterm(self):
+source = "main.cpp"
+program = self.getBuildArtifact("a.out")
+self.build_and_launch(program, commandEscapePrefix="")
+breakpoint1_line = line_number(source, "// breakpoint 1")
+breakpoint_ids = self.set_source_breakpoints(source, 
[breakpoint1_line])
+self.continue_to_breakpoints(breakpoint_ids)
+
+# Kill lldb-server process.
+process_name = (
+"debugserver" if platform.platform() == "MacOS" else "lldb-server"
+)
+process = get_subprocess(process_name)
+process.terminate()
+process.wait(timeout=5)
+
+# Get the console output
+console_output = self.collect_console(1.0)
+
+# Verify the exit status message is printed.
+self.assertIn(
+"exited with status = -1 (0x) debugserver died with signal 
SIGTERM",
+console_output,
+"Exit status does not contain message 'exited with status'",
+)
+
+@skipIfWindows
+@skipIfRemote
+def test_exit_status_message_ok(self):
+source = "main.cpp"
+program = self.getBuildArtifact("a.out")
+self.build_and_launch(program, commandEscapePrefix="")
+self.continue_to_exit()
+
+# Get the console output
+console_output = self.collect_console(1.0)
+
+# Verify the exit status message is printed.
+self.assertIn(
+"exited with status = 0 (0x)",
+console_output,
+"Exit status does not contain message 'exited with status'",
+)
diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp
index 25c5ad56e3d6fe..124e5a087618a7 100644
--- a/lldb/tools/lldb-dap/lldb-dap.cpp
+++ b/lldb/tools/lldb-dap/lldb-dap.cpp
@@ -503,6 +503,14 @@ void EventThreadFunction() {
 SendContinuedEvent();
 break;
   case lldb::eStateExited:
+const int exit_status = process.GetExitStatus();
+const char *const exit_description = process.GetExitDescription();
+g_dap.SendFormattedOutput(
+OutputType::Console,
+"Process %" PRIu64 " exited with status = %i (0x%8.8x) %s\n",
+process.GetProcessID(), exit_status, exit_status,
+exit_description ? exit_description : "");
+
 // When restarting, we can get an "exited" event for the process we
 // just killed with the old PID, or even with no PID. In that case
 // we don't have to terminate the session.

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


[Lldb-commits] [lldb] [lldb-dap] Report exit status message in lldb-dap, same as lldb cli (PR #89405)

2024-04-22 Thread via lldb-commits

github-actions[bot] wrote:




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



You can test this locally with the following command:


``bash
darker --check --diff -r 
3a4bc11b675c0511319c2843221133e986825b3b...5e270c26adbb1e8febb72fc74d348d4f9619c7bf
 lldb/test/API/tools/lldb-dap/console/TestDAP_console.py
``





View the diff from darker here.


``diff
--- TestDAP_console.py  2024-04-22 14:41:55.00 +
+++ TestDAP_console.py  2024-04-22 14:58:08.749412 +
@@ -7,10 +7,11 @@
 import psutil
 from collections import deque
 from lldbsuite.test import lldbutil
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
+
 
 def get_subprocess(process_name):
 queue = deque([psutil.Process(os.getpid())])
 while queue:
 process = queue.popleft()
@@ -125,11 +126,13 @@
 breakpoint1_line = line_number(source, "// breakpoint 1")
 breakpoint_ids = self.set_source_breakpoints(source, 
[breakpoint1_line])
 self.continue_to_breakpoints(breakpoint_ids)
 
 # Kill lldb-server process.
-process_name = "debugserver" if platform.platform() == "MacOS" else 
"lldb-server"
+process_name = (
+"debugserver" if platform.platform() == "MacOS" else "lldb-server"
+)
 process = get_subprocess(process_name)
 process.terminate()
 process.wait(timeout=5)
 
 # Get the console output
@@ -137,11 +140,11 @@
 
 # Verify the exit status message is printed.
 self.assertIn(
 "exited with status = -1 (0x) debugserver died with signal 
SIGTERM",
 console_output,
-"Exit status does not contain message 'exited with status'"
+"Exit status does not contain message 'exited with status'",
 )
 
 @skipIfWindows
 @skipIfRemote
 def test_exit_status_message_ok(self):
@@ -155,7 +158,7 @@
 
 # Verify the exit status message is printed.
 self.assertIn(
 "exited with status = 0 (0x)",
 console_output,
-"Exit status does not contain message 'exited with status'"
+"Exit status does not contain message 'exited with status'",
 )

``




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


[Lldb-commits] [lldb] [lldb-dap] Report exit status message in lldb-dap, same as lldb cli (PR #89405)

2024-04-22 Thread Walter Erquinigo via lldb-commits

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


[Lldb-commits] [lldb] Report exit status message in lldb-dap, same as lldb cli (PR #89405)

2024-04-22 Thread Walter Erquinigo via lldb-commits

https://github.com/walter-erquinigo approved this pull request.

lgtm. Thank you!

I've wanted this feature for a while, tbh, because the user doesn't know if the 
program terminated successfully or if the debugger crashed.

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


[Lldb-commits] [lldb] Report exit status message in lldb-dap, same as lldb cli (PR #89405)

2024-04-22 Thread Miro Bucko via lldb-commits

https://github.com/mbucko updated 
https://github.com/llvm/llvm-project/pull/89405

>From 5e270c26adbb1e8febb72fc74d348d4f9619c7bf Mon Sep 17 00:00:00 2001
From: Miro Bucko 
Date: Fri, 19 Apr 2024 08:08:02 -0700
Subject: [PATCH] Report exit status message in lldb-dap, same as lldb cli

Summary:
When the target inferior process that is being debugged exits in lldb command 
line, it emits following message:
Process 4049526 exited with status = -1 (0x) debugserver died with 
signal SIGTERM
lldb-dap on the other hand does not emit a similar message.
This PR adds the same status message to lldb-dap.

Test Plan:
In VSCode debug any target and hit stop mode, kill lldb-server and observe an 
exit status message similar to the following:
Process 2167677 exited with status = -1 (0x) debugserver died with 
signal SIGTERM

Reviewers:

Subscribers:

Tasks:
lldb-dap

Tags:
---
 .../tools/lldb-dap/console/TestDAP_console.py | 55 +++
 lldb/tools/lldb-dap/lldb-dap.cpp  |  8 +++
 2 files changed, 63 insertions(+)

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 ffa0dc943e0693..5312cceb205830 100644
--- a/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py
+++ b/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py
@@ -4,10 +4,21 @@
 
 import dap_server
 import lldbdap_testcase
+import psutil
+from collections import deque
 from lldbsuite.test import lldbutil
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
 
+def get_subprocess(process_name):
+queue = deque([psutil.Process(os.getpid())])
+while queue:
+process = queue.popleft()
+if process.name() == process_name:
+return process
+queue.extend(process.children())
+
+self.assertTrue(False, "No subprocess with name %s found" % process_name)
 
 class TestDAP_console(lldbdap_testcase.DAPTestCaseBase):
 def check_lldb_command(
@@ -104,3 +115,47 @@ def test_empty_escape_prefix(self):
 "Help can be invoked",
 command_escape_prefix="",
 )
+
+@skipIfWindows
+@skipIfRemote
+def test_exit_status_message_sigterm(self):
+source = "main.cpp"
+program = self.getBuildArtifact("a.out")
+self.build_and_launch(program, commandEscapePrefix="")
+breakpoint1_line = line_number(source, "// breakpoint 1")
+breakpoint_ids = self.set_source_breakpoints(source, 
[breakpoint1_line])
+self.continue_to_breakpoints(breakpoint_ids)
+
+# Kill lldb-server process.
+process_name = "debugserver" if platform.platform() == "MacOS" else 
"lldb-server"
+process = get_subprocess(process_name)
+process.terminate()
+process.wait(timeout=5)
+
+# Get the console output
+console_output = self.collect_console(1.0)
+
+# Verify the exit status message is printed.
+self.assertIn(
+"exited with status = -1 (0x) debugserver died with signal 
SIGTERM",
+console_output,
+"Exit status does not contain message 'exited with status'"
+)
+
+@skipIfWindows
+@skipIfRemote
+def test_exit_status_message_ok(self):
+source = "main.cpp"
+program = self.getBuildArtifact("a.out")
+self.build_and_launch(program, commandEscapePrefix="")
+self.continue_to_exit()
+
+# Get the console output
+console_output = self.collect_console(1.0)
+
+# Verify the exit status message is printed.
+self.assertIn(
+"exited with status = 0 (0x)",
+console_output,
+"Exit status does not contain message 'exited with status'"
+)
diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp
index 25c5ad56e3d6fe..124e5a087618a7 100644
--- a/lldb/tools/lldb-dap/lldb-dap.cpp
+++ b/lldb/tools/lldb-dap/lldb-dap.cpp
@@ -503,6 +503,14 @@ void EventThreadFunction() {
 SendContinuedEvent();
 break;
   case lldb::eStateExited:
+const int exit_status = process.GetExitStatus();
+const char *const exit_description = process.GetExitDescription();
+g_dap.SendFormattedOutput(
+OutputType::Console,
+"Process %" PRIu64 " exited with status = %i (0x%8.8x) %s\n",
+process.GetProcessID(), exit_status, exit_status,
+exit_description ? exit_description : "");
+
 // When restarting, we can get an "exited" event for the process we
 // just killed with the old PID, or even with no PID. In that case
 // we don't have to terminate the session.

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


[Lldb-commits] [lldb] [lldb][NFC] Remove unused pexpect/ptyprocess (PR #89609)

2024-04-22 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jordan Rupprecht (rupprecht)


Changes



---

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


35 Files Affected:

- (removed) lldb/third_party/Python/module/pexpect-4.6/.gitignore (-11) 
- (removed) lldb/third_party/Python/module/pexpect-4.6/.travis.yml (-31) 
- (removed) lldb/third_party/Python/module/pexpect-4.6/DEVELOPERS.rst (-12) 
- (removed) lldb/third_party/Python/module/pexpect-4.6/LICENSE (-20) 
- (removed) lldb/third_party/Python/module/pexpect-4.6/MANIFEST.in (-6) 
- (removed) lldb/third_party/Python/module/pexpect-4.6/README.rst (-55) 
- (removed) lldb/third_party/Python/module/pexpect-4.6/pexpect/ANSI.py (-351) 
- (removed) lldb/third_party/Python/module/pexpect-4.6/pexpect/FSM.py (-334) 
- (removed) lldb/third_party/Python/module/pexpect-4.6/pexpect/__init__.py 
(-85) 
- (removed) lldb/third_party/Python/module/pexpect-4.6/pexpect/_async.py (-87) 
- (removed) lldb/third_party/Python/module/pexpect-4.6/pexpect/bashrc.sh (-16) 
- (removed) lldb/third_party/Python/module/pexpect-4.6/pexpect/exceptions.py 
(-35) 
- (removed) lldb/third_party/Python/module/pexpect-4.6/pexpect/expect.py (-306) 
- (removed) lldb/third_party/Python/module/pexpect-4.6/pexpect/fdpexpect.py 
(-148) 
- (removed) lldb/third_party/Python/module/pexpect-4.6/pexpect/popen_spawn.py 
(-188) 
- (removed) lldb/third_party/Python/module/pexpect-4.6/pexpect/pty_spawn.py 
(-833) 
- (removed) lldb/third_party/Python/module/pexpect-4.6/pexpect/pxssh.py (-499) 
- (removed) lldb/third_party/Python/module/pexpect-4.6/pexpect/replwrap.py 
(-122) 
- (removed) lldb/third_party/Python/module/pexpect-4.6/pexpect/run.py (-157) 
- (removed) lldb/third_party/Python/module/pexpect-4.6/pexpect/screen.py (-431) 
- (removed) lldb/third_party/Python/module/pexpect-4.6/pexpect/spawnbase.py 
(-522) 
- (removed) lldb/third_party/Python/module/pexpect-4.6/pexpect/utils.py (-187) 
- (removed) lldb/third_party/Python/module/pexpect-4.6/requirements-testing.txt 
(-5) 
- (removed) lldb/third_party/Python/module/pexpect-4.6/setup.cfg (-5) 
- (removed) lldb/third_party/Python/module/pexpect-4.6/setup.py (-71) 
- (removed) lldb/third_party/Python/module/ptyprocess-0.6.0/.gitignore (-7) 
- (removed) lldb/third_party/Python/module/ptyprocess-0.6.0/.travis.yml (-9) 
- (removed) lldb/third_party/Python/module/ptyprocess-0.6.0/LICENSE (-16) 
- (removed) lldb/third_party/Python/module/ptyprocess-0.6.0/README.rst (-15) 
- (removed) 
lldb/third_party/Python/module/ptyprocess-0.6.0/ptyprocess/__init__.py (-4) 
- (removed) 
lldb/third_party/Python/module/ptyprocess-0.6.0/ptyprocess/_fork_pty.py (-78) 
- (removed) 
lldb/third_party/Python/module/ptyprocess-0.6.0/ptyprocess/ptyprocess.py (-836) 
- (removed) lldb/third_party/Python/module/ptyprocess-0.6.0/ptyprocess/util.py 
(-71) 
- (removed) lldb/third_party/Python/module/ptyprocess-0.6.0/pyproject.toml 
(-24) 
- (removed) lldb/third_party/Python/module/ptyprocess-0.6.0/readthedocs.yml 
(-2) 


``diff
diff --git a/lldb/third_party/Python/module/pexpect-4.6/.gitignore 
b/lldb/third_party/Python/module/pexpect-4.6/.gitignore
deleted file mode 100644
index 22cd4785f715dc..00
--- a/lldb/third_party/Python/module/pexpect-4.6/.gitignore
+++ /dev/null
@@ -1,11 +0,0 @@
-*.pyc
-doc/_build
-tests/log
-build/
-dist/
-MANIFEST
-*~
-.coverage*
-htmlcov
-*.egg-info/
-.cache/
diff --git a/lldb/third_party/Python/module/pexpect-4.6/.travis.yml 
b/lldb/third_party/Python/module/pexpect-4.6/.travis.yml
deleted file mode 100644
index 40d962295012bc..00
--- a/lldb/third_party/Python/module/pexpect-4.6/.travis.yml
+++ /dev/null
@@ -1,31 +0,0 @@
-language: python
-
-python:
-  - 2.7
-  - 3.3
-  - 3.4
-  - 3.5
-  - 3.6
-  - pypy
-  - nightly
-
-matrix:
-  allow_failures:
-# PyPy on Travis is currently incompatible with Cryptography.
-- python: pypy
-
-install:
-  - export PYTHONIOENCODING=UTF8
-  - pip install coveralls pytest-cov ptyprocess
-
-script:
-- ./tools/display-sighandlers.py
-- ./tools/display-terminalinfo.py
-- py.test --cov pexpect --cov-config .coveragerc
-
-after_success:
-  - coverage combine
-  - coveralls
-
-# Use new Travis stack, should be faster
-sudo: false
diff --git a/lldb/third_party/Python/module/pexpect-4.6/DEVELOPERS.rst 
b/lldb/third_party/Python/module/pexpect-4.6/DEVELOPERS.rst
deleted file mode 100644
index bf2bb9f30f8af0..00
--- a/lldb/third_party/Python/module/pexpect-4.6/DEVELOPERS.rst
+++ /dev/null
@@ -1,12 +0,0 @@
-To run the tests, use `py.test `_::
-
-py.test tests
-
-The tests are all located in the tests/ directory. To add a new unit
-test all you have to do is create the file in the tests/ directory with a
-filename in this format::
-
-test_*.py
-
-New test case classes may wish to inherit from 
``PexpectTestCase.PexpectTestCase``
-in the tests directory, which sets up some 

[Lldb-commits] [lldb] [lldb][DWARF] Remove m_forward_decl_die_to_compiler_type as it never actually being used. (PR #89427)

2024-04-22 Thread Zequan Wu via lldb-commits

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


[Lldb-commits] [lldb] 9ef9db7 - [lldb][DWARF] Remove m_forward_decl_die_to_compiler_type as it never actually being used. (#89427)

2024-04-22 Thread via lldb-commits

Author: Zequan Wu
Date: 2024-04-22T10:17:26-04:00
New Revision: 9ef9db7087fe6ce00a84f1456fce9f2e98db0769

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

LOG: [lldb][DWARF] Remove m_forward_decl_die_to_compiler_type as it never 
actually being used. (#89427)

This removes `m_forward_decl_die_to_compiler_type` which is a map from
`const DWARFDebugInfoEntry *` to `lldb::opaque_compiler_type_t`. This
map is currently used in `DWARFASTParserClang::ParseEnum` and
`DWARFASTParserClang::ParseStructureLikeDIE` to avoid creating duplicate
CompilerType for the specific DIE. But before entering these two
functions in `DWARFASTParserClang::ParseTypeFromDWARF`, we already
checked with `SymbolFileDWARF::GetDIEToType()` if we have a Type created
from this DIE to avoid trying to parse the same DIE twice. So, this map
is unnecessary and not useful.

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 54d06b1115a229..41d81fbcf1b087 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -854,36 +854,26 @@ TypeSP DWARFASTParserClang::ParseEnum(const SymbolContext 
,
DW_TAG_value_to_name(tag), type_name_cstr);
 
   CompilerType enumerator_clang_type;
-  CompilerType clang_type;
-  clang_type = CompilerType(
-  m_ast.weak_from_this(),
-  dwarf->GetForwardDeclDIEToCompilerType().lookup(die.GetDIE()));
-  if (!clang_type) {
-if (attrs.type.IsValid()) {
-  Type *enumerator_type =
-  dwarf->ResolveTypeUID(attrs.type.Reference(), true);
-  if (enumerator_type)
-enumerator_clang_type = enumerator_type->GetFullCompilerType();
-}
+  if (attrs.type.IsValid()) {
+Type *enumerator_type = dwarf->ResolveTypeUID(attrs.type.Reference(), 
true);
+if (enumerator_type)
+  enumerator_clang_type = enumerator_type->GetFullCompilerType();
+  }
 
-if (!enumerator_clang_type) {
-  if (attrs.byte_size) {
-enumerator_clang_type = m_ast.GetBuiltinTypeForDWARFEncodingAndBitSize(
-"", DW_ATE_signed, *attrs.byte_size * 8);
-  } else {
-enumerator_clang_type = m_ast.GetBasicType(eBasicTypeInt);
-  }
+  if (!enumerator_clang_type) {
+if (attrs.byte_size) {
+  enumerator_clang_type = m_ast.GetBuiltinTypeForDWARFEncodingAndBitSize(
+  "", DW_ATE_signed, *attrs.byte_size * 8);
+} else {
+  enumerator_clang_type = m_ast.GetBasicType(eBasicTypeInt);
 }
-
-clang_type = m_ast.CreateEnumerationType(
-attrs.name.GetStringRef(),
-GetClangDeclContextContainingDIE(die, nullptr),
-GetOwningClangModule(die), attrs.decl, enumerator_clang_type,
-attrs.is_scoped_enum);
-  } else {
-enumerator_clang_type = m_ast.GetEnumerationIntegerType(clang_type);
   }
 
+  CompilerType clang_type = m_ast.CreateEnumerationType(
+  attrs.name.GetStringRef(), GetClangDeclContextContainingDIE(die, 
nullptr),
+  GetOwningClangModule(die), attrs.decl, enumerator_clang_type,
+  attrs.is_scoped_enum);
+
   LinkDeclContextToDIE(TypeSystemClang::GetDeclContextForType(clang_type), 
die);
 
   type_sp =
@@ -1781,65 +1771,59 @@ DWARFASTParserClang::ParseStructureLikeDIE(const 
SymbolContext ,
   assert(tag_decl_kind != -1);
   UNUSED_IF_ASSERT_DISABLED(tag_decl_kind);
   bool clang_type_was_created = false;
-  clang_type = CompilerType(
-  m_ast.weak_from_this(),
-  dwarf->GetForwardDeclDIEToCompilerType().lookup(die.GetDIE()));
-  if (!clang_type) {
-clang::DeclContext *decl_ctx =
-GetClangDeclContextContainingDIE(die, nullptr);
-
-PrepareContextToReceiveMembers(m_ast, GetClangASTImporter(), decl_ctx, die,
-   attrs.name.GetCString());
-
-if (attrs.accessibility == eAccessNone && decl_ctx) {
-  // Check the decl context that contains this class/struct/union. If
-  // it is a class we must give it an accessibility.
-  const clang::Decl::Kind containing_decl_kind = decl_ctx->getDeclKind();
-  if (DeclKindIsCXXClass(containing_decl_kind))
-attrs.accessibility = default_accessibility;
-}
-
-ClangASTMetadata metadata;
-metadata.SetUserID(die.GetID());
-metadata.SetIsDynamicCXXType(dwarf->ClassOrStructIsVirtual(die));
-
-TypeSystemClang::TemplateParameterInfos template_param_infos;
-if (ParseTemplateParameterInfos(die, 

[Lldb-commits] [lldb] Report exit status message in lldb-dap, same as lldb cli (PR #89405)

2024-04-22 Thread Walter Erquinigo via lldb-commits


@@ -4,10 +4,30 @@
 
 import dap_server
 import lldbdap_testcase
+import psutil
+from collections import deque
 from lldbsuite.test import lldbutil
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
 
+def get_subprocess_pid(process_name):
+queue = deque([psutil.Process(os.getpid())])
+while queue:
+process = queue.popleft()
+if process.name() == process_name:
+return process.pid
+queue.extend(process.children())

walter-erquinigo wrote:

this is a bit of an overkill, but it's correct anyway, so I'm okay with it

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


[Lldb-commits] [lldb] Report exit status message in lldb-dap, same as lldb cli (PR #89405)

2024-04-22 Thread Walter Erquinigo via lldb-commits


@@ -104,3 +124,27 @@ def test_empty_escape_prefix(self):
 "Help can be invoked",
 command_escape_prefix="",
 )
+
+@skipIfWindows
+@skipIfRemote
+def test_exit_status_message(self):
+source = "main.cpp"
+program = self.getBuildArtifact("a.out")
+self.build_and_launch(program, commandEscapePrefix="")
+breakpoint1_line = line_number(source, "// breakpoint 1")
+breakpoint_ids = self.set_source_breakpoints(source, 
[breakpoint1_line])
+self.continue_to_breakpoints(breakpoint_ids)
+
+# Kill lldb-server process.
+process_name = "lldb-server"

walter-erquinigo wrote:

on mac, the process is called debugserver, so you need something like

  proces_name = "debugserver" if platform.platform() == "MacOS" else 
"lldb-server" 

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


[Lldb-commits] [lldb] Report exit status message in lldb-dap, same as lldb cli (PR #89405)

2024-04-22 Thread Walter Erquinigo via lldb-commits


@@ -4,10 +4,30 @@
 
 import dap_server
 import lldbdap_testcase
+import psutil
+from collections import deque
 from lldbsuite.test import lldbutil
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
 
+def get_subprocess_pid(process_name):
+queue = deque([psutil.Process(os.getpid())])
+while queue:
+process = queue.popleft()
+if process.name() == process_name:
+return process.pid
+queue.extend(process.children())
+
+print(f"No subprocess with name {process_name} found", flush=True, 
file=sys.stderr)
+return None

walter-erquinigo wrote:

this should be an assert that makes the test fail right away, because that 
child has to exist

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


[Lldb-commits] [lldb] Report exit status message in lldb-dap, same as lldb cli (PR #89405)

2024-04-22 Thread Walter Erquinigo via lldb-commits


@@ -104,3 +124,27 @@ def test_empty_escape_prefix(self):
 "Help can be invoked",
 command_escape_prefix="",
 )
+
+@skipIfWindows
+@skipIfRemote
+def test_exit_status_message(self):
+source = "main.cpp"
+program = self.getBuildArtifact("a.out")
+self.build_and_launch(program, commandEscapePrefix="")
+breakpoint1_line = line_number(source, "// breakpoint 1")
+breakpoint_ids = self.set_source_breakpoints(source, 
[breakpoint1_line])
+self.continue_to_breakpoints(breakpoint_ids)
+
+# Kill lldb-server process.
+process_name = "lldb-server"
+pid = get_subprocess_pid(process_name)
+killProcess(pid, process_name)
+# Get the console output
+console_output = self.collect_console(1.0)
+
+# Verify the exit status message is printed.
+self.assertIn(
+"exited with status = -1 (0x) debugserver died with signal 
SIGTERM",
+console_output,
+"Exit status does not contain message 'exited with status'"
+)

walter-erquinigo wrote:

could you also add another test in which a successful exit (i.e. exit code = 0) 
is printed as well?

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


[Lldb-commits] [lldb] Report exit status message in lldb-dap, same as lldb cli (PR #89405)

2024-04-22 Thread Walter Erquinigo via lldb-commits


@@ -4,10 +4,30 @@
 
 import dap_server
 import lldbdap_testcase
+import psutil
+from collections import deque
 from lldbsuite.test import lldbutil
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
 
+def get_subprocess_pid(process_name):
+queue = deque([psutil.Process(os.getpid())])
+while queue:
+process = queue.popleft()
+if process.name() == process_name:
+return process.pid
+queue.extend(process.children())
+
+print(f"No subprocess with name {process_name} found", flush=True, 
file=sys.stderr)
+return None
+
+def killProcess(pid, process_name):
+process = psutil.Process(pid)
+process.terminate()
+try:
+process.wait(timeout=5)
+except psutil.TimeoutExpired:
+self.assertTrue(False, process_name + " process should have exited by 
now")

walter-erquinigo wrote:

you don't need an assert here if you want the test to fail, you can just let 
the exception bubble up

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


[Lldb-commits] [lldb] Report exit status message in lldb-dap, same as lldb cli (PR #89405)

2024-04-22 Thread Miro Bucko via lldb-commits

https://github.com/mbucko updated 
https://github.com/llvm/llvm-project/pull/89405

>From 91a4fa40c9fdaee1794fedb3c49707130c22a06b Mon Sep 17 00:00:00 2001
From: Miro Bucko 
Date: Fri, 19 Apr 2024 08:08:02 -0700
Subject: [PATCH] Report exit status message in lldb-dap, same as lldb cli

Summary:
When the target inferior process that is being debugged exits in lldb command 
line, it emits following message:
Process 4049526 exited with status = -1 (0x) debugserver died with 
signal SIGTERM
lldb-dap on the other hand does not emit a similar message.
This PR adds the same status message to lldb-dap.

Test Plan:
In VSCode debug any target and hit stop mode, kill lldb-server and observe an 
exit status message similar to the following:
Process 2167677 exited with status = -1 (0x) debugserver died with 
signal SIGTERM

Reviewers:

Subscribers:

Tasks:
lldb-dap

Tags:
---
 .../tools/lldb-dap/console/TestDAP_console.py | 44 +++
 lldb/tools/lldb-dap/lldb-dap.cpp  |  8 
 2 files changed, 52 insertions(+)

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 ffa0dc943e0693..481e6c9eaa5bfc 100644
--- a/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py
+++ b/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py
@@ -4,10 +4,30 @@
 
 import dap_server
 import lldbdap_testcase
+import psutil
+from collections import deque
 from lldbsuite.test import lldbutil
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
 
+def get_subprocess_pid(process_name):
+queue = deque([psutil.Process(os.getpid())])
+while queue:
+process = queue.popleft()
+if process.name() == process_name:
+return process.pid
+queue.extend(process.children())
+
+print(f"No subprocess with name {process_name} found", flush=True, 
file=sys.stderr)
+return None
+
+def killProcess(pid, process_name):
+process = psutil.Process(pid)
+process.terminate()
+try:
+process.wait(timeout=5)
+except psutil.TimeoutExpired:
+self.assertTrue(False, process_name + " process should have exited by 
now")
 
 class TestDAP_console(lldbdap_testcase.DAPTestCaseBase):
 def check_lldb_command(
@@ -104,3 +124,27 @@ def test_empty_escape_prefix(self):
 "Help can be invoked",
 command_escape_prefix="",
 )
+
+@skipIfWindows
+@skipIfRemote
+def test_exit_status_message(self):
+source = "main.cpp"
+program = self.getBuildArtifact("a.out")
+self.build_and_launch(program, commandEscapePrefix="")
+breakpoint1_line = line_number(source, "// breakpoint 1")
+breakpoint_ids = self.set_source_breakpoints(source, 
[breakpoint1_line])
+self.continue_to_breakpoints(breakpoint_ids)
+
+# Kill lldb-server process.
+process_name = "lldb-server"
+pid = get_subprocess_pid(process_name)
+killProcess(pid, process_name)
+# Get the console output
+console_output = self.collect_console(1.0)
+
+# Verify the exit status message is printed.
+self.assertIn(
+"exited with status = -1 (0x) debugserver died with signal 
SIGTERM",
+console_output,
+"Exit status does not contain message 'exited with status'"
+)
diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp
index 25c5ad56e3d6fe..124e5a087618a7 100644
--- a/lldb/tools/lldb-dap/lldb-dap.cpp
+++ b/lldb/tools/lldb-dap/lldb-dap.cpp
@@ -503,6 +503,14 @@ void EventThreadFunction() {
 SendContinuedEvent();
 break;
   case lldb::eStateExited:
+const int exit_status = process.GetExitStatus();
+const char *const exit_description = process.GetExitDescription();
+g_dap.SendFormattedOutput(
+OutputType::Console,
+"Process %" PRIu64 " exited with status = %i (0x%8.8x) %s\n",
+process.GetProcessID(), exit_status, exit_status,
+exit_description ? exit_description : "");
+
 // When restarting, we can get an "exited" event for the process we
 // just killed with the old PID, or even with no PID. In that case
 // we don't have to terminate the session.

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


[Lldb-commits] [lldb] [llvm] [lldb][FreeBSD][AArch64] Enable register field detection (PR #85058)

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

DavidSpickett wrote:

@emaste ping!

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


[Lldb-commits] [lldb] [lldb][Docs] Document vFile:exists and vFile:MD5 (PR #89357)

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


@@ -429,7 +429,43 @@ incompatible with the flags that gdb specifies.
 //
 //  Response is F, followed by the number of bytes written (base 16)
 
+//--
+// vFile:MD5:
+//
+// BRIEF
+//  Generate an MD5 hash of the file at the given path.
+//
+// EXAMPLE
+//
+//  receive: vFile:MD5:2f746d702f61
+//  send (success): F,
+//  send (failure): F,x
+//
+//  request packet contains the ASCII hex encoded filename
+//
+//  If the hash succeeded, the response is "F," followed by the low 64
+//  bits of the result, then the high 64 bits of the result. Both are hex

DavidSpickett wrote:

Done.

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


[Lldb-commits] [lldb] [lldb][Docs] Document vFile:exists and vFile:MD5 (PR #89357)

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

https://github.com/DavidSpickett updated 
https://github.com/llvm/llvm-project/pull/89357

>From 518cb052ee364192fc5c813a2962f80f39345cd5 Mon Sep 17 00:00:00 2001
From: David Spickett 
Date: Fri, 19 Apr 2024 09:15:54 +
Subject: [PATCH 1/2] [lldb][Docs] Document vFile:exists and vFile:MD5

These are extensions the lldb platform has to:
https://sourceware.org/gdb/current/onlinedocs/gdb.html/Host-I_002fO-Packets.html#Host-I_002fO-Packets
---
 lldb/docs/lldb-platform-packets.txt | 36 +
 1 file changed, 36 insertions(+)

diff --git a/lldb/docs/lldb-platform-packets.txt 
b/lldb/docs/lldb-platform-packets.txt
index 4cf575e5ee8adb..fa6ec720c7ed42 100644
--- a/lldb/docs/lldb-platform-packets.txt
+++ b/lldb/docs/lldb-platform-packets.txt
@@ -429,7 +429,43 @@ incompatible with the flags that gdb specifies.
 //
 //  Response is F, followed by the number of bytes written (base 16)
 
+//--
+// vFile:MD5:
+//
+// BRIEF
+//  Generate an MD5 hash of the file at the given path.
+//
+// EXAMPLE
+//
+//  receive: vFile:MD5:2f746d702f61
+//  send (success): F,
+//  send (failure): F,x
+//
+//  request packet contains the ASCII hex encoded filename
+//
+//  If the hash succeeded, the response is "F," followed by the low 64
+//  bits of the result, then the high 64 bits of the result. Both are hex
+//  without a prefix.
+//
+//  The response is "F,", followed by "x" if the file did not exist
+//  or failed to hash.
 
+//--
+// vFile:exists:
+//
+// BRIEF
+//  Check whether the file at the given path exists.
+//
+// EXAMPLE
+//
+//  receive: vFile:exists:2f746d702f61
+//  send (exists): F,1
+//  send (does not exist): F,0
+//
+//  request packet contains the ASCII hex encoded filename
+//
+//  The response is a return code where 1 means the file exists
+//  and 0 means it does not.
 
 
 

>From b88a1159bdbb4b4d93f3b5ef10741abd4ef935ee Mon Sep 17 00:00:00 2001
From: David Spickett 
Date: Mon, 22 Apr 2024 11:58:55 +
Subject: [PATCH 2/2] Wording

---
 lldb/docs/lldb-platform-packets.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lldb/docs/lldb-platform-packets.txt 
b/lldb/docs/lldb-platform-packets.txt
index fa6ec720c7ed42..1be369910fa4db 100644
--- a/lldb/docs/lldb-platform-packets.txt
+++ b/lldb/docs/lldb-platform-packets.txt
@@ -444,8 +444,8 @@ incompatible with the flags that gdb specifies.
 //  request packet contains the ASCII hex encoded filename
 //
 //  If the hash succeeded, the response is "F," followed by the low 64
-//  bits of the result, then the high 64 bits of the result. Both are hex
-//  without a prefix.
+//  bits of the result, and finally the high 64 bits of the result. Both are in
+//  hex format without a prefix.
 //
 //  The response is "F,", followed by "x" if the file did not exist
 //  or failed to hash.

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


[Lldb-commits] [lldb] [lldb][Docs] Document vFile:exists and vFile:MD5 (PR #89357)

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


@@ -429,7 +429,43 @@ incompatible with the flags that gdb specifies.
 //
 //  Response is F, followed by the number of bytes written (base 16)
 
+//--
+// vFile:MD5:
+//
+// BRIEF
+//  Generate an MD5 hash of the file at the given path.
+//
+// EXAMPLE
+//
+//  receive: vFile:MD5:2f746d702f61
+//  send (success): F,
+//  send (failure): F,x
+//
+//  request packet contains the ASCII hex encoded filename
+//
+//  If the hash succeeded, the response is "F," followed by the low 64

DavidSpickett wrote:

We do:
```
auto Result = llvm::sys::fs::md5_contents(path);
```
Then if we look into that, I see:
```
uint64_t low() const {
  // Our MD5 implementation returns the result in little endian, so the low
  // word is first.
```
I guess that `md5sum` shows the result as a 128 bit number in the usual "big 
endian" style.

As to why the result might be entirely different, perhaps you were seeing the 
little endian difference but if not, no idea why. As you say if it's incorrect 
then it's been so for a long time.

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


[Lldb-commits] [lldb] [lldb][DWARF] Remove m_forward_decl_die_to_compiler_type as it never actually being used. (PR #89427)

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

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


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


[Lldb-commits] [lldb] [lldb][DWARF] Remove m_forward_decl_die_to_compiler_type as it never actually being used. (PR #89427)

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

Michael137 wrote:

LGTM thanks for the cleanup!

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


[Lldb-commits] [lldb] [lldb][Docs] Make formatting regular in lldb-gdb-remote.txt (PR #89587)

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

DavidSpickett wrote:

Subsequent PRs will build on this:
* Enable Markdown support in the website build.
* Use a script to convert this file to Markdown.
* Hand correct the result.

So we:
1. Have this on the website, just like GDB's protocol specs and
2. It's in a format that's easier to contribute to.

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


[Lldb-commits] [lldb] [lldb][Docs] Make formatting regular in lldb-gdb-remote.txt (PR #89587)

2024-04-22 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: David Spickett (DavidSpickett)


Changes

If someone (aka me) wanted to convert this into another format (aka Markdown), 
these changes mean you can more easily script that conversion.

---

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


1 Files Affected:

- (modified) lldb/docs/lldb-gdb-remote.txt (+960-933) 


``diff
diff --git a/lldb/docs/lldb-gdb-remote.txt b/lldb/docs/lldb-gdb-remote.txt
index 6c29de61daba7e..15e32153354962 100644
--- a/lldb/docs/lldb-gdb-remote.txt
+++ b/lldb/docs/lldb-gdb-remote.txt
@@ -25,18 +25,20 @@ added above and beyond the standard GDB remote protocol 
packets.
 //  High. Any GDB remote server that can implement this should if the
 //  connection is reliable. This improves packet throughput and increases
 //  the performance of the connection.
+//
+// DESCRIPTION
+//  Having to send an ACK/NACK after every packet slows things down a bit, so 
we
+//  have a way to disable ACK packets to minimize the traffic for reliable
+//  communication interfaces (like sockets). Below GDB or LLDB will send this
+//  packet to try and disable ACKs. All lines that start with "send packet: " 
are
+//  from GDB/LLDB, and all lines that start with "read packet: " are from the 
GDB
+//  remote server:
+//
+//  send packet: $QStartNoAckMode#b0
+//  read packet: +
+//  read packet: $OK#9a
+//  send packet: +
 //--
-Having to send an ACK/NACK after every packet slows things down a bit, so we
-have a way to disable ACK packets to minimize the traffic for reliable
-communication interfaces (like sockets). Below GDB or LLDB will send this
-packet to try and disable ACKs. All lines that start with "send packet: " are
-from GDB/LLDB, and all lines that start with "read packet: " are from the GDB
-remote server:
-
-send packet: $QStartNoAckMode#b0
-read packet: +
-read packet: $OK#9a
-send packet: +
 
 //--
 // "QSupported"
@@ -46,38 +48,39 @@ send packet: +
 //
 // PRIORITY TO IMPLEMENT
 //  Optional.
+//
+// DESCRIPTION
+//  QSupported is a standard GDB Remote Serial Protocol packet, but
+//  there are several additions to the response that lldb can parse.
+//  They are not all listed here.
+//
+//  An example exchange:
+//
+//  send packet: 
qSupported:xmlRegisters=i386,arm,mips,arc;multiprocess+;fork-events+;vfork-events+
+//
+//  read packet: 
qXfer:features:read+;PacketSize=2;qEcho+;native-signals+;SupportedCompressions=lzfse,zlib-deflate,lz4,lzma;SupportedWatchpointTypes=aarch64-mask,aarch64-bas;
+//
+//  In the example above, three lldb extensions are shown:
+//
+//PacketSize=2
+//  The base 16 maximum packet size that the stub can handle.
+//SupportedCompressions=
+//  A list of compression types that the stub can use to compress packets
+//  when the QEnableCompression packet is used to request one of them.
+//SupportedWatchpointTypes=
+//  A list of watchpoint types that this stub can manage.
+//  Currently defined names are:
+//  x86_64   64-bit x86-64 watchpoints
+//   (1, 2, 4, 8 byte watchpoints aligned to those amounts)
+//  aarch64-bas  AArch64 Byte Address Select watchpoints
+//   (any number of contiguous bytes within a doubleword)
+//  aarch64-mask AArch64 MASK watchpoints
+//   (any power-of-2 region of memory from 8 to 2GB, 
aligned)
+//  If nothing is specified, lldb will default to sending power-of-2
+//  watchpoints, up to a pointer size, `sizeof(void*)`, a reasonable
+//  baseline assumption.
 //--
 
-QSupported is a standard GDB Remote Serial Protocol packet, but
-there are several additions to the response that lldb can parse.
-They are not all listed here.
-
-An example exchange:
-
-send packet: 
qSupported:xmlRegisters=i386,arm,mips,arc;multiprocess+;fork-events+;vfork-events+
-
-read packet: 
qXfer:features:read+;PacketSize=2;qEcho+;native-signals+;SupportedCompressions=lzfse,zlib-deflate,lz4,lzma;SupportedWatchpointTypes=aarch64-mask,aarch64-bas;
-
-In the example above, three lldb extensions are shown:
-
-  PacketSize=2
-The base 16 maximum packet size that the stub can handle.
-  SupportedCompressions=
-A list of compression types that the stub can use to compress packets 
-when the QEnableCompression packet is used to request one of them.
-  SupportedWatchpointTypes=
-A list of watchpoint types that this stub can manage.
-Currently defined names are:
-x86_64   64-bit x86-64 watchpoints
- (1, 2, 4, 8 byte watchpoints aligned to those amounts)
-aarch64-bas  AArch64 Byte Address Select watchpoints
- (any number of