[Lldb-commits] [lldb] a2363c0 - Reland "[lldb] Set return status to failed when adding a command error"

2021-06-14 Thread David Spickett via lldb-commits

Author: David Spickett
Date: 2021-06-14T09:19:25Z
New Revision: a2363c0cf9b6a9a81c76ac652da667f73845d38b

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

LOG: Reland "[lldb] Set return status to failed when adding a command error"

This reverts commit db93e4e70aa453e5ba04ba0d9e01f581882b6c81.

This modifies TestRegsters.py to account for Darwin showing
AVX registers as part of "Floating Point Registers" instead
of in a separate "Advanced Vector Extensions" category.

Added: 
lldb/test/Shell/Commands/command-backtrace-parser-1.test
lldb/test/Shell/Commands/command-backtrace-parser-2.test

Modified: 
lldb/source/Interpreter/CommandReturnObject.cpp
lldb/test/API/commands/register/register/register_command/TestRegisters.py

Removed: 
lldb/test/Shell/Commands/command-backtrace.test



diff  --git a/lldb/source/Interpreter/CommandReturnObject.cpp 
b/lldb/source/Interpreter/CommandReturnObject.cpp
index c3f32a4c45a9..531c1f246bd8 100644
--- a/lldb/source/Interpreter/CommandReturnObject.cpp
+++ b/lldb/source/Interpreter/CommandReturnObject.cpp
@@ -44,6 +44,8 @@ CommandReturnObject::CommandReturnObject(bool colors)
 : m_out_stream(colors), m_err_stream(colors) {}
 
 void CommandReturnObject::AppendErrorWithFormat(const char *format, ...) {
+  SetStatus(eReturnStatusFailed);
+
   if (!format)
 return;
   va_list args;
@@ -98,6 +100,7 @@ void CommandReturnObject::AppendWarning(llvm::StringRef 
in_string) {
 void CommandReturnObject::AppendError(llvm::StringRef in_string) {
   if (in_string.empty())
 return;
+  SetStatus(eReturnStatusFailed);
   error(GetErrorStream()) << in_string.rtrim() << '\n';
 }
 
@@ -114,7 +117,6 @@ void CommandReturnObject::SetError(llvm::StringRef 
error_str) {
 return;
 
   AppendError(error_str);
-  SetStatus(eReturnStatusFailed);
 }
 
 // Similar to AppendError, but do not prepend 'Status: ' to message, and don't
@@ -124,6 +126,7 @@ void CommandReturnObject::AppendRawError(llvm::StringRef 
in_string) {
   if (in_string.empty())
 return;
   GetErrorStream() << in_string;
+  SetStatus(eReturnStatusFailed);
 }
 
 void CommandReturnObject::SetStatus(ReturnStatus status) { m_status = status; }

diff  --git 
a/lldb/test/API/commands/register/register/register_command/TestRegisters.py 
b/lldb/test/API/commands/register/register/register_command/TestRegisters.py
index 5ec46c175e62..7acf3a409875 100644
--- a/lldb/test/API/commands/register/register/register_command/TestRegisters.py
+++ b/lldb/test/API/commands/register/register/register_command/TestRegisters.py
@@ -41,13 +41,18 @@ def test_register_commands(self):
 self.expect("register read -a", MISSING_EXPECTED_REGISTERS,
 substrs=['registers were unavailable'], matching=False)
 
+all_registers = self.res.GetOutput()
+
 if self.getArchitecture() in ['amd64', 'i386', 'x86_64']:
 self.runCmd("register read xmm0")
-self.runCmd("register read ymm15")  # may be available
-self.runCmd("register read bnd0")  # may be available
+if "ymm15 = " in all_registers:
+  self.runCmd("register read ymm15")  # may be available
+if "bnd0 = " in all_registers:
+  self.runCmd("register read bnd0")  # may be available
 elif self.getArchitecture() in ['arm', 'armv7', 'armv7k', 'arm64', 
'arm64e', 'arm64_32']:
 self.runCmd("register read s0")
-self.runCmd("register read q15")  # may be available
+if "q15 = " in all_registers:
+  self.runCmd("register read q15")  # may be available
 
 self.expect(
 "register read -s 4",
@@ -413,7 +418,8 @@ def fp_register_write(self):
 self.write_and_read(currentFrame, "ymm7", new_value)
 self.expect("expr $ymm0", substrs=['vector_type'])
 else:
-self.runCmd("register read ymm0")
+self.expect("register read ymm0", substrs=["Invalid register 
name 'ymm0'"],
+error=True)
 
 if has_mpx:
 # Test write and read for bnd0.
@@ -428,7 +434,8 @@ def fp_register_write(self):
 self.write_and_read(currentFrame, "bndstatus", new_value)
 self.expect("expr $bndstatus", substrs = ['vector_type'])
 else:
-self.runCmd("register read bnd0")
+self.expect("register read bnd0", substrs=["Invalid register 
name 'bnd0'"],
+error=True)
 
 def convenience_registers(self):
 """Test convenience registers."""
@@ -450,7 +457,7 @@ def convenience_registers(self):
 # Now write rax with a unique bit pattern and test that eax indeed
 # represents the lower

[Lldb-commits] [lldb] 0f94d68 - [lldb] Add missing changes to a2363c0cf9b6a9a81c76ac652da667f73845d38b

2021-06-14 Thread David Spickett via lldb-commits

Author: David Spickett
Date: 2021-06-14T09:23:30Z
New Revision: 0f94d68a2e15d50796439f20bcb508b95931d2ae

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

LOG: [lldb] Add missing changes to a2363c0cf9b6a9a81c76ac652da667f73845d38b

Completely forgot to actually update the change before relanding it.
This adds the Darwin AVX changes.

Added: 


Modified: 
lldb/test/API/commands/register/register/register_command/TestRegisters.py

Removed: 




diff  --git 
a/lldb/test/API/commands/register/register/register_command/TestRegisters.py 
b/lldb/test/API/commands/register/register/register_command/TestRegisters.py
index 7acf3a409875..96e6c8065e82 100644
--- a/lldb/test/API/commands/register/register/register_command/TestRegisters.py
+++ b/lldb/test/API/commands/register/register/register_command/TestRegisters.py
@@ -402,8 +402,13 @@ def fp_register_write(self):
 # Returns an SBValueList.
 registerSets = currentFrame.GetRegisters()
 for registerSet in registerSets:
-if 'advanced vector extensions' in 
registerSet.GetName().lower():
+set_name = registerSet.GetName().lower()
+if 'advanced vector extensions' in set_name:
 has_avx = True
+# Darwin reports AVX registers as part of "Floating Point 
Registers"
+else if self.platformIsDarwin() and 'floating point registers' 
in set_name:
+has_avx = registerSet.GetFirstValueByName('ymm0').IsValid()
+
 # FreeBSD/NetBSD reports missing register sets 
diff erently
 # at the moment and triggers false positive here.
 # TODO: remove FreeBSD/NetBSD exception when we make 
unsupported



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


[Lldb-commits] [PATCH] D103701: [lldb] Set return status to failed when adding a command error

2021-06-14 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett added a comment.

Relanded in https://reviews.llvm.org/rGa2363c0cf9b6 / 
https://reviews.llvm.org/rG0f94d68a2e15 (because I have a case of the Monday 
Mornings). If this does the trick there are 2/3 other tests that use this 
tactic to check for AVX so I can update those too.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103701/new/

https://reviews.llvm.org/D103701

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


[Lldb-commits] [lldb] f583029 - [lldb] Correct "else if" to "elif" in TestRegisters

2021-06-14 Thread David Spickett via lldb-commits

Author: David Spickett
Date: 2021-06-14T09:36:00Z
New Revision: f583029da3d6dbabe82f48b160227eb0120abd33

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

LOG: [lldb] Correct "else if" to "elif" in TestRegisters

Added: 


Modified: 
lldb/test/API/commands/register/register/register_command/TestRegisters.py

Removed: 




diff  --git 
a/lldb/test/API/commands/register/register/register_command/TestRegisters.py 
b/lldb/test/API/commands/register/register/register_command/TestRegisters.py
index 96e6c8065e82..cd0cb6d46fc2 100644
--- a/lldb/test/API/commands/register/register/register_command/TestRegisters.py
+++ b/lldb/test/API/commands/register/register/register_command/TestRegisters.py
@@ -406,7 +406,7 @@ def fp_register_write(self):
 if 'advanced vector extensions' in set_name:
 has_avx = True
 # Darwin reports AVX registers as part of "Floating Point 
Registers"
-else if self.platformIsDarwin() and 'floating point registers' 
in set_name:
+elif self.platformIsDarwin() and 'floating point registers' in 
set_name:
 has_avx = registerSet.GetFirstValueByName('ymm0').IsValid()
 
 # FreeBSD/NetBSD reports missing register sets 
diff erently



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


[Lldb-commits] [PATCH] D103454: [lldb][docs] Document SBType

2021-06-14 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor updated this revision to Diff 351819.
teemperor added a comment.

- Make language more uniform
- Point out anonymous struct is a GNU extension.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103454/new/

https://reviews.llvm.org/D103454

Files:
  lldb/bindings/interface/SBType.i

Index: lldb/bindings/interface/SBType.i
===
--- lldb/bindings/interface/SBType.i
+++ lldb/bindings/interface/SBType.i
@@ -111,8 +111,24 @@
 };
 
 %feature("docstring",
-"Represents a data type in lldb.  The FindFirstType() method of SBTarget/SBModule
-returns a SBType.
+"Represents a data type in lldb.
+
+The actual characteristics of each type are defined by the semantics of the
+programming language and the specific language implementation that was used
+to compile the target program. See the language-specific notes in the
+documentation of each method.
+
+SBType instances can be obtained by a variety of methods.
+`SBTarget.FindFirstType` and `SBModule.FindFirstType` can be used to create
+`SBType` representations of types in executables/libraries with debug
+information. For some languages such as C, C++ and Objective-C it is possible
+to create new types by evaluating expressions that define a new type.
+
+Note that most `SBType` properties are computed independently of any runtime
+information so for dynamic languages the functionality can be very limited.
+`SBValue` can be used to represent runtime values which then can be more
+accurately queried for certain information such as byte size.
+
 
 SBType supports the eq/ne operator. For example,::
 
@@ -181,7 +197,7 @@
 # id_type and int_type should be the same type!
 self.assertTrue(id_type == int_type)
 
-...") SBType;
+") SBType;
 class SBType
 {
 public:
@@ -196,132 +212,649 @@
 
 explicit operator bool() const;
 
+
+%feature("docstring",
+"Returns the number of bytes a variable with the given types occupies in memory.
+
+Returns ``0`` if the size can't be determined.
+
+If a type occupies ``N`` bytes + ``M`` bits in memory, this function returns
+the rounded up amount of bytes (i.e., if ``M`` is ``0``,
+this function returns ``N`` and otherwise ``N + 1``).
+
+Language-specific behaviour:
+
+* C: The output is expected to match the value of ``sizeof(Type)``. If
+  ``sizeof(Type)`` is not a valid expression for the given type, the
+  function returns ``0``.
+* C++: Same as in C.
+* Objective-C: Same as in C. For Objective-C classes this always returns
+  `0`` as the actual size depends on runtime information.
+") GetByteSize;
 uint64_t
 GetByteSize();
 
+
+%feature("docstring",
+"Returns true if this type is a pointer type.
+
+Language-specific behaviour:
+
+* C: Returns true for C pointer types (or typedefs of these types).
+* C++: Pointer types include the C pointer types as well as pointers to data
+  mebers or member functions.
+* Objective-C: Pointer types include the C pointer types. ``id``, ``Class``
+  and pointers to blocks are also considered pointer types.
+") IsPointerType;
 bool
 IsPointerType();
 
+%feature("docstring",
+"Returns true if this type is a reference type.
+
+Language-specific behaviour:
+
+* C: Returns false for all types.
+* C++: Both l-value and r-value references are considered reference types.
+* Objective-C: Returns false for all types.
+") IsReferenceType;
 bool
 IsReferenceType();
 
+%feature("docstring",
+"Returns true if this type is a function type.
+
+Language-specific behaviour:
+
+* C: Returns true for types that represent functions. Note that function
+  pointers are not function types (but their `GetPointeeType()` are function
+  types).
+* C++: Same as in C.
+* Objective-C: Returns false for all types.
+") IsPolymorphicClass;
 bool
 IsFunctionType ();
 
+%feature("docstring",
+"Returns true if this type is a polymorphic type.
+
+Language-specific behaviour:
+
+* C: Returns false for all types.
+* C++: Returns true if the type is a class type that contains at least one
+  virtual member function or if at least one of its base classes is
+  considered a polymorphic type.
+* Objective-C: Returns false for all types.
+") IsPolymorphicClass;
 bool
 IsPolymorphicClass ();
 
+%feature("docstring",
+"Returns true if this type is an array type.
+
+Language-specific behaviour:
+
+* C: Returns true if the types is an array type. This includes incomplete
+  array types ``T[]`` and array types with integer (``T[1]``) or variable
+  length (``T[some_variable]``). Pointer types are not considered arrays.
+* C++: Includes C's array types and dependent array types (i.e., array types
+  in templates which size depends on template arguments).
+* Objective-C: Same as in C.
+")

[Lldb-commits] [lldb] 11e2922 - [lldb][docs] Document SBType

2021-06-14 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2021-06-14T13:19:19+02:00
New Revision: 11e2922bb7adbbca17c3a0f44779aa87dbc64b42

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

LOG: [lldb][docs] Document SBType

This documents the behaviour of the different SBType functions with notes for
the language-specific behaviour for C/C++/Objective-C. All of this reflects the
current behaviour of LLDB (even though that also means some functions behave
kinda weird but at least they are now documented to be weird)

Reviewed By: #lldb, mib

Differential Revision: https://reviews.llvm.org/D103454

Added: 


Modified: 
lldb/bindings/interface/SBType.i

Removed: 




diff  --git a/lldb/bindings/interface/SBType.i 
b/lldb/bindings/interface/SBType.i
index e7b3fd11e3380..500bc99ca8cd4 100644
--- a/lldb/bindings/interface/SBType.i
+++ b/lldb/bindings/interface/SBType.i
@@ -111,8 +111,24 @@ protected:
 };
 
 %feature("docstring",
-"Represents a data type in lldb.  The FindFirstType() method of 
SBTarget/SBModule
-returns a SBType.
+"Represents a data type in lldb.
+
+The actual characteristics of each type are defined by the semantics of the
+programming language and the specific language implementation that was used
+to compile the target program. See the language-specific notes in the
+documentation of each method.
+
+SBType instances can be obtained by a variety of methods.
+`SBTarget.FindFirstType` and `SBModule.FindFirstType` can be used to create
+`SBType` representations of types in executables/libraries with debug
+information. For some languages such as C, C++ and Objective-C it is possible
+to create new types by evaluating expressions that define a new type.
+
+Note that most `SBType` properties are computed independently of any runtime
+information so for dynamic languages the functionality can be very limited.
+`SBValue` can be used to represent runtime values which then can be more
+accurately queried for certain information such as byte size.
+
 
 SBType supports the eq/ne operator. For example,::
 
@@ -181,7 +197,7 @@ SBType supports the eq/ne operator. For example,::
 # id_type and int_type should be the same type!
 self.assertTrue(id_type == int_type)
 
-...") SBType;
+") SBType;
 class SBType
 {
 public:
@@ -196,132 +212,649 @@ public:
 
 explicit operator bool() const;
 
+
+%feature("docstring",
+"Returns the number of bytes a variable with the given types occupies in 
memory.
+
+Returns ``0`` if the size can't be determined.
+
+If a type occupies ``N`` bytes + ``M`` bits in memory, this function 
returns
+the rounded up amount of bytes (i.e., if ``M`` is ``0``,
+this function returns ``N`` and otherwise ``N + 1``).
+
+Language-specific behaviour:
+
+* C: The output is expected to match the value of ``sizeof(Type)``. If
+  ``sizeof(Type)`` is not a valid expression for the given type, the
+  function returns ``0``.
+* C++: Same as in C.
+* Objective-C: Same as in C. For Objective-C classes this always returns
+  `0`` as the actual size depends on runtime information.
+") GetByteSize;
 uint64_t
 GetByteSize();
 
+
+%feature("docstring",
+"Returns true if this type is a pointer type.
+
+Language-specific behaviour:
+
+* C: Returns true for C pointer types (or typedefs of these types).
+* C++: Pointer types include the C pointer types as well as pointers to 
data
+  mebers or member functions.
+* Objective-C: Pointer types include the C pointer types. ``id``, ``Class``
+  and pointers to blocks are also considered pointer types.
+") IsPointerType;
 bool
 IsPointerType();
 
+%feature("docstring",
+"Returns true if this type is a reference type.
+
+Language-specific behaviour:
+
+* C: Returns false for all types.
+* C++: Both l-value and r-value references are considered reference types.
+* Objective-C: Returns false for all types.
+") IsReferenceType;
 bool
 IsReferenceType();
 
+%feature("docstring",
+"Returns true if this type is a function type.
+
+Language-specific behaviour:
+
+* C: Returns true for types that represent functions. Note that function
+  pointers are not function types (but their `GetPointeeType()` are 
function
+  types).
+* C++: Same as in C.
+* Objective-C: Returns false for all types.
+") IsPolymorphicClass;
 bool
 IsFunctionType ();
 
+%feature("docstring",
+"Returns true if this type is a polymorphic type.
+
+Language-specific behaviour:
+
+* C: Returns false for all types.
+* C++: Returns true if the type is a class type that contains at least one
+  virtual member function or if at least one of its base classes is
+  considered a

[Lldb-commits] [PATCH] D103454: [lldb][docs] Document SBType

2021-06-14 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG11e2922bb7ad: [lldb][docs] Document SBType (authored by 
teemperor).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103454/new/

https://reviews.llvm.org/D103454

Files:
  lldb/bindings/interface/SBType.i

Index: lldb/bindings/interface/SBType.i
===
--- lldb/bindings/interface/SBType.i
+++ lldb/bindings/interface/SBType.i
@@ -111,8 +111,24 @@
 };
 
 %feature("docstring",
-"Represents a data type in lldb.  The FindFirstType() method of SBTarget/SBModule
-returns a SBType.
+"Represents a data type in lldb.
+
+The actual characteristics of each type are defined by the semantics of the
+programming language and the specific language implementation that was used
+to compile the target program. See the language-specific notes in the
+documentation of each method.
+
+SBType instances can be obtained by a variety of methods.
+`SBTarget.FindFirstType` and `SBModule.FindFirstType` can be used to create
+`SBType` representations of types in executables/libraries with debug
+information. For some languages such as C, C++ and Objective-C it is possible
+to create new types by evaluating expressions that define a new type.
+
+Note that most `SBType` properties are computed independently of any runtime
+information so for dynamic languages the functionality can be very limited.
+`SBValue` can be used to represent runtime values which then can be more
+accurately queried for certain information such as byte size.
+
 
 SBType supports the eq/ne operator. For example,::
 
@@ -181,7 +197,7 @@
 # id_type and int_type should be the same type!
 self.assertTrue(id_type == int_type)
 
-...") SBType;
+") SBType;
 class SBType
 {
 public:
@@ -196,132 +212,649 @@
 
 explicit operator bool() const;
 
+
+%feature("docstring",
+"Returns the number of bytes a variable with the given types occupies in memory.
+
+Returns ``0`` if the size can't be determined.
+
+If a type occupies ``N`` bytes + ``M`` bits in memory, this function returns
+the rounded up amount of bytes (i.e., if ``M`` is ``0``,
+this function returns ``N`` and otherwise ``N + 1``).
+
+Language-specific behaviour:
+
+* C: The output is expected to match the value of ``sizeof(Type)``. If
+  ``sizeof(Type)`` is not a valid expression for the given type, the
+  function returns ``0``.
+* C++: Same as in C.
+* Objective-C: Same as in C. For Objective-C classes this always returns
+  `0`` as the actual size depends on runtime information.
+") GetByteSize;
 uint64_t
 GetByteSize();
 
+
+%feature("docstring",
+"Returns true if this type is a pointer type.
+
+Language-specific behaviour:
+
+* C: Returns true for C pointer types (or typedefs of these types).
+* C++: Pointer types include the C pointer types as well as pointers to data
+  mebers or member functions.
+* Objective-C: Pointer types include the C pointer types. ``id``, ``Class``
+  and pointers to blocks are also considered pointer types.
+") IsPointerType;
 bool
 IsPointerType();
 
+%feature("docstring",
+"Returns true if this type is a reference type.
+
+Language-specific behaviour:
+
+* C: Returns false for all types.
+* C++: Both l-value and r-value references are considered reference types.
+* Objective-C: Returns false for all types.
+") IsReferenceType;
 bool
 IsReferenceType();
 
+%feature("docstring",
+"Returns true if this type is a function type.
+
+Language-specific behaviour:
+
+* C: Returns true for types that represent functions. Note that function
+  pointers are not function types (but their `GetPointeeType()` are function
+  types).
+* C++: Same as in C.
+* Objective-C: Returns false for all types.
+") IsPolymorphicClass;
 bool
 IsFunctionType ();
 
+%feature("docstring",
+"Returns true if this type is a polymorphic type.
+
+Language-specific behaviour:
+
+* C: Returns false for all types.
+* C++: Returns true if the type is a class type that contains at least one
+  virtual member function or if at least one of its base classes is
+  considered a polymorphic type.
+* Objective-C: Returns false for all types.
+") IsPolymorphicClass;
 bool
 IsPolymorphicClass ();
 
+%feature("docstring",
+"Returns true if this type is an array type.
+
+Language-specific behaviour:
+
+* C: Returns true if the types is an array type. This includes incomplete
+  array types ``T[]`` and array types with integer (``T[1]``) or variable
+  length (``T[some_variable]``). Pointer types are not considered arrays.
+* C++: Includes C's array types and dependent array types (i.e., array types
+ 

[Lldb-commits] [lldb] ac031c8 - Revert "[lldb] Set return status to failed when adding a command error" (and fixups)

2021-06-14 Thread David Spickett via lldb-commits

Author: David Spickett
Date: 2021-06-14T12:09:42Z
New Revision: ac031c8db2ce454a9b08f23192ce698e8bde4447

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

LOG: Revert "[lldb] Set return status to failed when adding a command error" 
(and fixups)

This reverts commit f583029da3d6dbabe82f48b160227eb0120abd33,
0f94d68a2e15d50796439f20bcb508b95931d2ae and
a2363c0cf9b6a9a81c76ac652da667f73845d38b.

Due to test failures from incorrect SB API usage.

Added: 
lldb/test/Shell/Commands/command-backtrace.test

Modified: 
lldb/source/Interpreter/CommandReturnObject.cpp
lldb/test/API/commands/register/register/register_command/TestRegisters.py

Removed: 
lldb/test/Shell/Commands/command-backtrace-parser-1.test
lldb/test/Shell/Commands/command-backtrace-parser-2.test



diff  --git a/lldb/source/Interpreter/CommandReturnObject.cpp 
b/lldb/source/Interpreter/CommandReturnObject.cpp
index 531c1f246bd86..c3f32a4c45a9e 100644
--- a/lldb/source/Interpreter/CommandReturnObject.cpp
+++ b/lldb/source/Interpreter/CommandReturnObject.cpp
@@ -44,8 +44,6 @@ CommandReturnObject::CommandReturnObject(bool colors)
 : m_out_stream(colors), m_err_stream(colors) {}
 
 void CommandReturnObject::AppendErrorWithFormat(const char *format, ...) {
-  SetStatus(eReturnStatusFailed);
-
   if (!format)
 return;
   va_list args;
@@ -100,7 +98,6 @@ void CommandReturnObject::AppendWarning(llvm::StringRef 
in_string) {
 void CommandReturnObject::AppendError(llvm::StringRef in_string) {
   if (in_string.empty())
 return;
-  SetStatus(eReturnStatusFailed);
   error(GetErrorStream()) << in_string.rtrim() << '\n';
 }
 
@@ -117,6 +114,7 @@ void CommandReturnObject::SetError(llvm::StringRef 
error_str) {
 return;
 
   AppendError(error_str);
+  SetStatus(eReturnStatusFailed);
 }
 
 // Similar to AppendError, but do not prepend 'Status: ' to message, and don't
@@ -126,7 +124,6 @@ void CommandReturnObject::AppendRawError(llvm::StringRef 
in_string) {
   if (in_string.empty())
 return;
   GetErrorStream() << in_string;
-  SetStatus(eReturnStatusFailed);
 }
 
 void CommandReturnObject::SetStatus(ReturnStatus status) { m_status = status; }

diff  --git 
a/lldb/test/API/commands/register/register/register_command/TestRegisters.py 
b/lldb/test/API/commands/register/register/register_command/TestRegisters.py
index cd0cb6d46fc2a..5ec46c175e621 100644
--- a/lldb/test/API/commands/register/register/register_command/TestRegisters.py
+++ b/lldb/test/API/commands/register/register/register_command/TestRegisters.py
@@ -41,18 +41,13 @@ def test_register_commands(self):
 self.expect("register read -a", MISSING_EXPECTED_REGISTERS,
 substrs=['registers were unavailable'], matching=False)
 
-all_registers = self.res.GetOutput()
-
 if self.getArchitecture() in ['amd64', 'i386', 'x86_64']:
 self.runCmd("register read xmm0")
-if "ymm15 = " in all_registers:
-  self.runCmd("register read ymm15")  # may be available
-if "bnd0 = " in all_registers:
-  self.runCmd("register read bnd0")  # may be available
+self.runCmd("register read ymm15")  # may be available
+self.runCmd("register read bnd0")  # may be available
 elif self.getArchitecture() in ['arm', 'armv7', 'armv7k', 'arm64', 
'arm64e', 'arm64_32']:
 self.runCmd("register read s0")
-if "q15 = " in all_registers:
-  self.runCmd("register read q15")  # may be available
+self.runCmd("register read q15")  # may be available
 
 self.expect(
 "register read -s 4",
@@ -402,13 +397,8 @@ def fp_register_write(self):
 # Returns an SBValueList.
 registerSets = currentFrame.GetRegisters()
 for registerSet in registerSets:
-set_name = registerSet.GetName().lower()
-if 'advanced vector extensions' in set_name:
+if 'advanced vector extensions' in 
registerSet.GetName().lower():
 has_avx = True
-# Darwin reports AVX registers as part of "Floating Point 
Registers"
-elif self.platformIsDarwin() and 'floating point registers' in 
set_name:
-has_avx = registerSet.GetFirstValueByName('ymm0').IsValid()
-
 # FreeBSD/NetBSD reports missing register sets 
diff erently
 # at the moment and triggers false positive here.
 # TODO: remove FreeBSD/NetBSD exception when we make 
unsupported
@@ -423,8 +413,7 @@ def fp_register_write(self):
 self.write_and_read(currentFrame, "ymm7", new_value)
 self.expect("expr $ymm0", substrs=['vector_type'])
 else:
- 

[Lldb-commits] [PATCH] D104221: [lldb][NFC] Remove redundant deleted constructors in HostInfoBase subclasses

2021-06-14 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor created this revision.
teemperor added a reviewer: LLDB.
teemperor added a project: LLDB.
Herald added a subscriber: JDevlieghere.
teemperor requested review of this revision.
Herald added a subscriber: lldb-commits.

HostInfoBase has a deleted dtor/ctor so there is no need to do the same for
all the classes inheriting from it.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104221

Files:
  lldb/include/lldb/Host/linux/HostInfoLinux.h
  lldb/include/lldb/Host/macosx/HostInfoMacOSX.h
  lldb/include/lldb/Host/windows/HostInfoWindows.h


Index: lldb/include/lldb/Host/windows/HostInfoWindows.h
===
--- lldb/include/lldb/Host/windows/HostInfoWindows.h
+++ lldb/include/lldb/Host/windows/HostInfoWindows.h
@@ -19,11 +19,6 @@
 class HostInfoWindows : public HostInfoBase {
   friend class HostInfoBase;
 
-private:
-  // Static class, unconstructable.
-  HostInfoWindows();
-  ~HostInfoWindows();
-
 public:
   static void Initialize(SharedLibraryDirectoryHelper *helper = nullptr);
   static void Terminate();
Index: lldb/include/lldb/Host/macosx/HostInfoMacOSX.h
===
--- lldb/include/lldb/Host/macosx/HostInfoMacOSX.h
+++ lldb/include/lldb/Host/macosx/HostInfoMacOSX.h
@@ -21,11 +21,6 @@
 class HostInfoMacOSX : public HostInfoPosix {
   friend class HostInfoBase;
 
-private:
-  // Static class, unconstructable.
-  HostInfoMacOSX() = delete;
-  ~HostInfoMacOSX() = delete;
-
 public:
   static llvm::VersionTuple GetOSVersion();
   static llvm::VersionTuple GetMacCatalystVersion();
Index: lldb/include/lldb/Host/linux/HostInfoLinux.h
===
--- lldb/include/lldb/Host/linux/HostInfoLinux.h
+++ lldb/include/lldb/Host/linux/HostInfoLinux.h
@@ -21,11 +21,6 @@
 class HostInfoLinux : public HostInfoPosix {
   friend class HostInfoBase;
 
-private:
-  // Static class, unconstructable.
-  HostInfoLinux();
-  ~HostInfoLinux();
-
 public:
   static void Initialize(SharedLibraryDirectoryHelper *helper = nullptr);
   static void Terminate();


Index: lldb/include/lldb/Host/windows/HostInfoWindows.h
===
--- lldb/include/lldb/Host/windows/HostInfoWindows.h
+++ lldb/include/lldb/Host/windows/HostInfoWindows.h
@@ -19,11 +19,6 @@
 class HostInfoWindows : public HostInfoBase {
   friend class HostInfoBase;
 
-private:
-  // Static class, unconstructable.
-  HostInfoWindows();
-  ~HostInfoWindows();
-
 public:
   static void Initialize(SharedLibraryDirectoryHelper *helper = nullptr);
   static void Terminate();
Index: lldb/include/lldb/Host/macosx/HostInfoMacOSX.h
===
--- lldb/include/lldb/Host/macosx/HostInfoMacOSX.h
+++ lldb/include/lldb/Host/macosx/HostInfoMacOSX.h
@@ -21,11 +21,6 @@
 class HostInfoMacOSX : public HostInfoPosix {
   friend class HostInfoBase;
 
-private:
-  // Static class, unconstructable.
-  HostInfoMacOSX() = delete;
-  ~HostInfoMacOSX() = delete;
-
 public:
   static llvm::VersionTuple GetOSVersion();
   static llvm::VersionTuple GetMacCatalystVersion();
Index: lldb/include/lldb/Host/linux/HostInfoLinux.h
===
--- lldb/include/lldb/Host/linux/HostInfoLinux.h
+++ lldb/include/lldb/Host/linux/HostInfoLinux.h
@@ -21,11 +21,6 @@
 class HostInfoLinux : public HostInfoPosix {
   friend class HostInfoBase;
 
-private:
-  // Static class, unconstructable.
-  HostInfoLinux();
-  ~HostInfoLinux();
-
 public:
   static void Initialize(SharedLibraryDirectoryHelper *helper = nullptr);
   static void Terminate();
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D104221: [lldb][NFC] Remove redundant deleted constructors in HostInfoBase subclasses

2021-06-14 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett accepted this revision.
DavidSpickett added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104221/new/

https://reviews.llvm.org/D104221

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


[Lldb-commits] [lldb] 31b9aca - Reland "[lldb] Set return status to failed when adding a command error"

2021-06-14 Thread David Spickett via lldb-commits

Author: David Spickett
Date: 2021-06-14T14:26:47+01:00
New Revision: 31b9acaec5797e409afb83d665fc8816d8a37940

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

LOG: Reland "[lldb] Set return status to failed when adding a command error"

This reverts commit ac031c8db2ce454a9b08f23192ce698e8bde4447.

SB API usage has been corrected.

Added: 
lldb/test/Shell/Commands/command-backtrace-parser-1.test
lldb/test/Shell/Commands/command-backtrace-parser-2.test

Modified: 
lldb/source/Interpreter/CommandReturnObject.cpp
lldb/test/API/commands/register/register/register_command/TestRegisters.py

Removed: 
lldb/test/Shell/Commands/command-backtrace.test



diff  --git a/lldb/source/Interpreter/CommandReturnObject.cpp 
b/lldb/source/Interpreter/CommandReturnObject.cpp
index c3f32a4c45a9e..531c1f246bd86 100644
--- a/lldb/source/Interpreter/CommandReturnObject.cpp
+++ b/lldb/source/Interpreter/CommandReturnObject.cpp
@@ -44,6 +44,8 @@ CommandReturnObject::CommandReturnObject(bool colors)
 : m_out_stream(colors), m_err_stream(colors) {}
 
 void CommandReturnObject::AppendErrorWithFormat(const char *format, ...) {
+  SetStatus(eReturnStatusFailed);
+
   if (!format)
 return;
   va_list args;
@@ -98,6 +100,7 @@ void CommandReturnObject::AppendWarning(llvm::StringRef 
in_string) {
 void CommandReturnObject::AppendError(llvm::StringRef in_string) {
   if (in_string.empty())
 return;
+  SetStatus(eReturnStatusFailed);
   error(GetErrorStream()) << in_string.rtrim() << '\n';
 }
 
@@ -114,7 +117,6 @@ void CommandReturnObject::SetError(llvm::StringRef 
error_str) {
 return;
 
   AppendError(error_str);
-  SetStatus(eReturnStatusFailed);
 }
 
 // Similar to AppendError, but do not prepend 'Status: ' to message, and don't
@@ -124,6 +126,7 @@ void CommandReturnObject::AppendRawError(llvm::StringRef 
in_string) {
   if (in_string.empty())
 return;
   GetErrorStream() << in_string;
+  SetStatus(eReturnStatusFailed);
 }
 
 void CommandReturnObject::SetStatus(ReturnStatus status) { m_status = status; }

diff  --git 
a/lldb/test/API/commands/register/register/register_command/TestRegisters.py 
b/lldb/test/API/commands/register/register/register_command/TestRegisters.py
index 5ec46c175e621..2b56ca262a1ff 100644
--- a/lldb/test/API/commands/register/register/register_command/TestRegisters.py
+++ b/lldb/test/API/commands/register/register/register_command/TestRegisters.py
@@ -41,13 +41,18 @@ def test_register_commands(self):
 self.expect("register read -a", MISSING_EXPECTED_REGISTERS,
 substrs=['registers were unavailable'], matching=False)
 
+all_registers = self.res.GetOutput()
+
 if self.getArchitecture() in ['amd64', 'i386', 'x86_64']:
 self.runCmd("register read xmm0")
-self.runCmd("register read ymm15")  # may be available
-self.runCmd("register read bnd0")  # may be available
+if "ymm15 = " in all_registers:
+  self.runCmd("register read ymm15")  # may be available
+if "bnd0 = " in all_registers:
+  self.runCmd("register read bnd0")  # may be available
 elif self.getArchitecture() in ['arm', 'armv7', 'armv7k', 'arm64', 
'arm64e', 'arm64_32']:
 self.runCmd("register read s0")
-self.runCmd("register read q15")  # may be available
+if "q15 = " in all_registers:
+  self.runCmd("register read q15")  # may be available
 
 self.expect(
 "register read -s 4",
@@ -397,8 +402,13 @@ def fp_register_write(self):
 # Returns an SBValueList.
 registerSets = currentFrame.GetRegisters()
 for registerSet in registerSets:
-if 'advanced vector extensions' in 
registerSet.GetName().lower():
+set_name = registerSet.GetName().lower()
+if 'advanced vector extensions' in set_name:
 has_avx = True
+# Darwin reports AVX registers as part of "Floating Point 
Registers"
+elif self.platformIsDarwin() and 'floating point registers' in 
set_name:
+has_avx = 
registerSet.GetChildMemberWithName('ymm0').IsValid()
+
 # FreeBSD/NetBSD reports missing register sets 
diff erently
 # at the moment and triggers false positive here.
 # TODO: remove FreeBSD/NetBSD exception when we make 
unsupported
@@ -413,7 +423,8 @@ def fp_register_write(self):
 self.write_and_read(currentFrame, "ymm7", new_value)
 self.expect("expr $ymm0", substrs=['vector_type'])
 else:
-self.runCmd("register read ymm0")
+self.expect("register read ymm0", substrs=["Invalid

[Lldb-commits] [lldb] e3d5e31 - [lldb][docs] Fix section name for InputReaderGranularity

2021-06-14 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2021-06-14T16:21:40+02:00
New Revision: e3d5e3193fd5a202a58652d28115f71d0a04a479

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

LOG: [lldb][docs] Fix section name for InputReaderGranularity

Added: 


Modified: 
lldb/docs/python_api_enums.rst

Removed: 




diff  --git a/lldb/docs/python_api_enums.rst b/lldb/docs/python_api_enums.rst
index 70bce246fc687..b6f27ddac4479 100644
--- a/lldb/docs/python_api_enums.rst
+++ b/lldb/docs/python_api_enums.rst
@@ -480,8 +480,8 @@ ValueType
 
Thread local storage variable.
 
-InputReader

+InputReaderGranularity
+--
 
 Token size/granularities for Input Readers.
 



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


[Lldb-commits] [lldb] d94ce1a - [lldb][docs] Add the missing rst anchors to the Python enum docs

2021-06-14 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2021-06-14T16:31:28+02:00
New Revision: d94ce1a391cbc85dab13ac6b6c4afbaef7684eec

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

LOG: [lldb][docs] Add the missing rst anchors to the Python enum docs

Added: 


Modified: 
lldb/docs/python_api_enums.rst

Removed: 




diff  --git a/lldb/docs/python_api_enums.rst b/lldb/docs/python_api_enums.rst
index b6f27ddac447..58100b2aa9a2 100644
--- a/lldb/docs/python_api_enums.rst
+++ b/lldb/docs/python_api_enums.rst
@@ -125,6 +125,9 @@ Miscellaneous constants
 Enumerators
 ***
 
+
+.. _State:
+
 State
 -
 
@@ -177,6 +180,9 @@ State
as the debugger is concerned while other processes
or threads get the chance to run.
 
+
+.. _LaunchFlag:
+
 LaunchFlag
 --
 
@@ -235,6 +241,9 @@ LaunchFlag
Don't make the inferior responsible for its own TCC
permissions but instead inherit them from its parent.
 
+
+.. _RunMode:
+
 RunMode
 ---
 .. py:data:: eOnlyThisThread
@@ -242,6 +251,8 @@ RunMode
 .. py:data:: eOnlyDuringStepping
 
 
+.. _ByteOrder:
+
 ByteOrder
 -
 
@@ -250,6 +261,9 @@ ByteOrder
 .. py:data:: eByteOrderPDP
 .. py:data:: eByteOrderLittle
 
+
+.. _Encoding:
+
 Encoding
 
 
@@ -259,6 +273,9 @@ Encoding
 .. py:data:: eEncodingIEEE754
 .. py:data:: eEncodingVector
 
+
+.. _Format:
+
 Format
 --
 
@@ -305,6 +322,9 @@ Format
 .. py:data:: eFormatVoid
 .. py:data:: eFormatUnicode8
 
+
+.. _DescriptionLevel:
+
 DescriptionLevel
 
 
@@ -313,6 +333,9 @@ DescriptionLevel
 .. py:data:: eDescriptionLevelVerbose
 .. py:data:: eDescriptionLevelInitial
 
+
+.. _ScriptLanguage:
+
 ScriptLanguage
 --
 
@@ -322,6 +345,9 @@ ScriptLanguage
 .. py:data:: eScriptLanguageUnknown
 .. py:data:: eScriptLanguageDefault
 
+
+.. _RegisterKind:
+
 RegisterKind
 
 
@@ -331,6 +357,9 @@ RegisterKind
 .. py:data:: eRegisterKindProcessPlugin
 .. py:data:: eRegisterKindLLDB
 
+
+.. _StopReason:
+
 StopReason
 --
 
@@ -349,6 +378,9 @@ StopReason
 .. py:data:: eStopReasonThreadExiting
 .. py:data:: eStopReasonInstrumentation
 
+
+.. _ReturnStatus:
+
 ReturnStatus
 
 
@@ -361,6 +393,9 @@ ReturnStatus
 .. py:data:: eReturnStatusFailed
 .. py:data:: eReturnStatusQuit
 
+
+.. _Expression:
+
 Expression
 --
 
@@ -377,6 +412,9 @@ The results of expression evaluation.
 .. py:data:: eExpressionStoppedForDebug
 .. py:data:: eExpressionThreadVanished
 
+
+.. _SearchDepth:
+
 SearchDepth
 ---
 
@@ -388,6 +426,9 @@ SearchDepth
 .. py:data:: eSearchDepthBlock
 .. py:data:: eSearchDepthAddress
 
+
+.. _ConnectionStatus:
+
 ConnectionStatus
 
 
@@ -419,6 +460,9 @@ ConnectionStatus
 
Interrupted read.
 
+
+.. _ErrorType:
+
 ErrorType
 -
 
@@ -444,6 +488,8 @@ ErrorType
Standard Win32 error codes.
 
 
+.. _ValueType:
+
 ValueType
 -
 
@@ -480,6 +526,9 @@ ValueType
 
Thread local storage variable.
 
+
+.. _InputReaderGranularity:
+
 InputReaderGranularity
 --
 
@@ -491,6 +540,9 @@ Token size/granularities for Input Readers.
 .. py:data:: eInputReaderGranularityLine
 .. py:data:: eInputReaderGranularityAll
 
+
+.. _SymbolContextItem:
+
 SymbolContextItem
 -
 
@@ -552,12 +604,18 @@ indicates that the member did get resolved.
from being used during frame PC lookups and many other
potential address to symbol context lookups.
 
+
+.. _Permissions:
+
 Permissions
 ---
 .. py:data:: ePermissionsWritable
 .. py:data:: ePermissionsReadable
 .. py:data:: ePermissionsExecutable
 
+
+.. _InputReader:
+
 InputReader
 ---
 
@@ -593,6 +651,9 @@ InputReader
 
Reader was just popped off the stack and is done.
 
+
+.. _BreakpointEventType:
+
 BreakpointEventType
 ---
 
@@ -610,6 +671,9 @@ BreakpointEventType
 .. py:data:: eBreakpointEventTypeThreadChanged
 .. py:data:: eBreakpointEventTypeAutoContinueChanged
 
+
+.. _WatchpointEventType:
+
 WatchpointEventType
 ---
 
@@ -624,6 +688,7 @@ WatchpointEventType
 .. py:data:: eWatchpointEventTypeThreadChanged
 .. py:data:: eWatchpointEventTypeTypeChanged
 
+
 .. _LanguageType:
 
 LanguageType
@@ -669,6 +734,9 @@ LanguageType
 .. py:data:: eLanguageTypeExtRenderScript
 .. py:data:: eNumLanguageTypes
 
+
+.. _InstrumentationRuntimeType:
+
 InstrumentationRuntimeType
 --
 
@@ -679,6 +747,9 @@ InstrumentationRuntimeType
 .. py:data:: eInstrumentationRuntimeTypeSwiftRuntimeReporting
 .. py:data:: eNumInstrumentationRuntimeTypes
 
+
+.. _DynamicValueType:
+
 DynamicValueType
 
 
@@ -686,6 +757,9 @@ DynamicValueType
 .. py:data:: eDynamicCanRunTarget
 .. py:data:: eDynamicDontRunTarget
 
+
+.. _StopShowColumn:
+
 StopShowColumn
 --

[Lldb-commits] [PATCH] D104231: [lldb] Deprecate the threading functionality in SBHostOS

2021-06-14 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor created this revision.
teemperor added a reviewer: LLDB.
teemperor requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

SBHostOS implements a threading framework that allows creating and manipulating
OS threads in the current process.

We usually don't deprecate SB APIs, but in this case I think it makes sense 
because:

- The framework is not implemented on all platforms (i.e. Windows and *BSD 
support seems to be incomplete)
- `ThreadCreated` is completely unimplemented..
- It hasn't been touched since the original check-in of the source code.
- I don't think it can even be used via the Python bindings as `ThreadCreate` 
seems impossible to call (it takes a function pointer and returns a OS specific 
struct).
- It's not tested.
- It's to my knowledge not used by Xcode or anyone that has their source code 
indexed by Google.
- It's the only reason why we (partially) implement a bunch of internal 
threading utilities in LLDB (which I'll remove in a follow-up patch).

I would propose deprecating it with the upcoming LLDB 13 release (which will be 
branched in about a month).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104231

Files:
  lldb/bindings/interface/SBHostOS.i
  lldb/include/lldb/API/SBHostOS.h


Index: lldb/include/lldb/API/SBHostOS.h
===
--- lldb/include/lldb/API/SBHostOS.h
+++ lldb/include/lldb/API/SBHostOS.h
@@ -24,15 +24,21 @@
 
   static lldb::SBFileSpec GetUserHomeDirectory();
 
-  static void ThreadCreated(const char *name);
+  /// \deprecated Deprecated since LLDB version 13.
+  static void ThreadCreated(const char *name) LLDB_API_IMPL_DEPRECATED;
 
+  /// \deprecated Deprecated since LLDB version 13.
   static lldb::thread_t ThreadCreate(const char *name,
  lldb::thread_func_t thread_function,
  void *thread_arg, lldb::SBError *err);
 
+  /// \deprecated Deprecated since LLDB version 13.
   static bool ThreadCancel(lldb::thread_t thread, lldb::SBError *err);
 
+  /// \deprecated Deprecated since LLDB version 13.
   static bool ThreadDetach(lldb::thread_t thread, lldb::SBError *err);
+
+  /// \deprecated Deprecated since LLDB version 13.
   static bool ThreadJoin(lldb::thread_t thread, lldb::thread_result_t *result,
  lldb::SBError *err);
 
Index: lldb/bindings/interface/SBHostOS.i
===
--- lldb/bindings/interface/SBHostOS.i
+++ lldb/bindings/interface/SBHostOS.i
@@ -27,22 +27,29 @@
 static lldb::SBFileSpec
 GetUserHomeDirectory ();
 
+
+%feature("docstring", " .. deprecated:: 13 ") ThreadCreated;
 static void
 ThreadCreated (const char *name);
 
+%feature("docstring", " .. deprecated:: 13 ") ThreadCreate;
 static lldb::thread_t
 ThreadCreate (const char *name,
   lldb::thread_func_t,
   void *thread_arg,
   lldb::SBError *err);
 
+%feature("docstring", " .. deprecated:: 13 ") ThreadCancel;
 static bool
 ThreadCancel (lldb::thread_t thread,
   lldb::SBError *err);
 
+%feature("docstring", " .. deprecated:: 13 ") ThreadDetach;
 static bool
 ThreadDetach (lldb::thread_t thread,
   lldb::SBError *err);
+
+%feature("docstring", " .. deprecated:: 13 ") ThreadJoin;
 static bool
 ThreadJoin (lldb::thread_t thread,
 lldb::thread_result_t *result,


Index: lldb/include/lldb/API/SBHostOS.h
===
--- lldb/include/lldb/API/SBHostOS.h
+++ lldb/include/lldb/API/SBHostOS.h
@@ -24,15 +24,21 @@
 
   static lldb::SBFileSpec GetUserHomeDirectory();
 
-  static void ThreadCreated(const char *name);
+  /// \deprecated Deprecated since LLDB version 13.
+  static void ThreadCreated(const char *name) LLDB_API_IMPL_DEPRECATED;
 
+  /// \deprecated Deprecated since LLDB version 13.
   static lldb::thread_t ThreadCreate(const char *name,
  lldb::thread_func_t thread_function,
  void *thread_arg, lldb::SBError *err);
 
+  /// \deprecated Deprecated since LLDB version 13.
   static bool ThreadCancel(lldb::thread_t thread, lldb::SBError *err);
 
+  /// \deprecated Deprecated since LLDB version 13.
   static bool ThreadDetach(lldb::thread_t thread, lldb::SBError *err);
+
+  /// \deprecated Deprecated since LLDB version 13.
   static bool ThreadJoin(lldb::thread_t thread, lldb::thread_result_t *result,
  lldb::SBError *err);
 
Index: lldb/bindings/interface/SBHostOS.i
===
--- lldb/bindings/interface/SBHostOS.i
+++ lldb/bindings/interface/SBHostOS.i
@@ -27,22 +27,29 @@
 static lldb::SBFileSpec
 GetUserHomeDirectory ();
 
+
+%fe

[Lldb-commits] [PATCH] D104231: [lldb] Deprecate the threading functionality in SBHostOS

2021-06-14 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor updated this revision to Diff 351882.
teemperor added a comment.
Herald added a subscriber: JDevlieghere.

- Remove the deprecation attribute that got inserted by accident.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104231/new/

https://reviews.llvm.org/D104231

Files:
  lldb/bindings/interface/SBHostOS.i
  lldb/include/lldb/API/SBHostOS.h


Index: lldb/include/lldb/API/SBHostOS.h
===
--- lldb/include/lldb/API/SBHostOS.h
+++ lldb/include/lldb/API/SBHostOS.h
@@ -24,15 +24,21 @@
 
   static lldb::SBFileSpec GetUserHomeDirectory();
 
+  /// \deprecated Deprecated since LLDB version 13.
   static void ThreadCreated(const char *name);
 
+  /// \deprecated Deprecated since LLDB version 13.
   static lldb::thread_t ThreadCreate(const char *name,
  lldb::thread_func_t thread_function,
  void *thread_arg, lldb::SBError *err);
 
+  /// \deprecated Deprecated since LLDB version 13.
   static bool ThreadCancel(lldb::thread_t thread, lldb::SBError *err);
 
+  /// \deprecated Deprecated since LLDB version 13.
   static bool ThreadDetach(lldb::thread_t thread, lldb::SBError *err);
+
+  /// \deprecated Deprecated since LLDB version 13.
   static bool ThreadJoin(lldb::thread_t thread, lldb::thread_result_t *result,
  lldb::SBError *err);
 
Index: lldb/bindings/interface/SBHostOS.i
===
--- lldb/bindings/interface/SBHostOS.i
+++ lldb/bindings/interface/SBHostOS.i
@@ -27,22 +27,29 @@
 static lldb::SBFileSpec
 GetUserHomeDirectory ();
 
+
+%feature("docstring", " .. deprecated:: 13 ") ThreadCreated;
 static void
 ThreadCreated (const char *name);
 
+%feature("docstring", " .. deprecated:: 13 ") ThreadCreate;
 static lldb::thread_t
 ThreadCreate (const char *name,
   lldb::thread_func_t,
   void *thread_arg,
   lldb::SBError *err);
 
+%feature("docstring", " .. deprecated:: 13 ") ThreadCancel;
 static bool
 ThreadCancel (lldb::thread_t thread,
   lldb::SBError *err);
 
+%feature("docstring", " .. deprecated:: 13 ") ThreadDetach;
 static bool
 ThreadDetach (lldb::thread_t thread,
   lldb::SBError *err);
+
+%feature("docstring", " .. deprecated:: 13 ") ThreadJoin;
 static bool
 ThreadJoin (lldb::thread_t thread,
 lldb::thread_result_t *result,


Index: lldb/include/lldb/API/SBHostOS.h
===
--- lldb/include/lldb/API/SBHostOS.h
+++ lldb/include/lldb/API/SBHostOS.h
@@ -24,15 +24,21 @@
 
   static lldb::SBFileSpec GetUserHomeDirectory();
 
+  /// \deprecated Deprecated since LLDB version 13.
   static void ThreadCreated(const char *name);
 
+  /// \deprecated Deprecated since LLDB version 13.
   static lldb::thread_t ThreadCreate(const char *name,
  lldb::thread_func_t thread_function,
  void *thread_arg, lldb::SBError *err);
 
+  /// \deprecated Deprecated since LLDB version 13.
   static bool ThreadCancel(lldb::thread_t thread, lldb::SBError *err);
 
+  /// \deprecated Deprecated since LLDB version 13.
   static bool ThreadDetach(lldb::thread_t thread, lldb::SBError *err);
+
+  /// \deprecated Deprecated since LLDB version 13.
   static bool ThreadJoin(lldb::thread_t thread, lldb::thread_result_t *result,
  lldb::SBError *err);
 
Index: lldb/bindings/interface/SBHostOS.i
===
--- lldb/bindings/interface/SBHostOS.i
+++ lldb/bindings/interface/SBHostOS.i
@@ -27,22 +27,29 @@
 static lldb::SBFileSpec
 GetUserHomeDirectory ();
 
+
+%feature("docstring", " .. deprecated:: 13 ") ThreadCreated;
 static void
 ThreadCreated (const char *name);
 
+%feature("docstring", " .. deprecated:: 13 ") ThreadCreate;
 static lldb::thread_t
 ThreadCreate (const char *name,
   lldb::thread_func_t,
   void *thread_arg,
   lldb::SBError *err);
 
+%feature("docstring", " .. deprecated:: 13 ") ThreadCancel;
 static bool
 ThreadCancel (lldb::thread_t thread,
   lldb::SBError *err);
 
+%feature("docstring", " .. deprecated:: 13 ") ThreadDetach;
 static bool
 ThreadDetach (lldb::thread_t thread,
   lldb::SBError *err);
+
+%feature("docstring", " .. deprecated:: 13 ") ThreadJoin;
 static bool
 ThreadJoin (lldb::thread_t thread,
 lldb::thread_result_t *result,
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D104231: [lldb] Deprecate the threading functionality in SBHostOS

2021-06-14 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment.

Not sure what else we should do to properly deprecate an API. LLVM's approach 
would be to put `[[deprecated("bla")]]` the C++ APIs (which would mean you need 
a C++14 compiler to use the SB API) and there is also the `lldb-versioning.h` 
header (which seems to be reserved for actual API breakages).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104231/new/

https://reviews.llvm.org/D104231

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


[Lldb-commits] [PATCH] D104041: [lldb] Replace default bodies of special member functions with = default;

2021-06-14 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor accepted this revision.
teemperor added a comment.
This revision is now accepted and ready to land.

Not sure what happened to my accept, but I'll LGTM this again. Thanks!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104041/new/

https://reviews.llvm.org/D104041

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


[Lldb-commits] [PATCH] D104041: [lldb] Replace default bodies of special member functions with = default;

2021-06-14 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik added a comment.

I am sure I could find  a bunch of other ends and odds but perhaps you have 
other checks that will cover these coming up.




Comment at: lldb/include/lldb/Core/ThreadSafeValue.h:21
   // Constructors and Destructors
   ThreadSafeValue() : m_value(), m_mutex() {}
 

We can also default this as well, we can use member initializers for these 
values.



Comment at: lldb/include/lldb/Core/UserSettingsController.h:35
 public:
   Properties() : m_collection_sp() {}
 

I believe this should be defaultable as well.



Comment at: lldb/include/lldb/DataFormatters/DumpValueObjectOptions.h:137
   PointerAsArraySettings m_pointer_as_array;
   bool m_use_synthetic : 1;
   bool m_scope_already_checked : 1;

It looks like these members somehow got missed in the last PR that changed to 
use in class member initializers.



Comment at: lldb/include/lldb/Host/HostNativeProcessBase.h:27
 public:
   HostNativeProcessBase() : m_process(LLDB_INVALID_PROCESS) {}
   explicit HostNativeProcessBase(lldb::process_t process)

This looks like another case that got missed in the last PR to change to use in 
class member init.



Comment at: lldb/include/lldb/Host/HostNativeThreadBase.h:30
 public:
   HostNativeThreadBase();
   explicit HostNativeThreadBase(lldb::thread_t thread);

I think we can switch this to `=default` as well.



Comment at: lldb/include/lldb/Host/HostNativeThreadBase.h:48
 
   lldb::thread_t m_thread;
   lldb::thread_result_t m_result = 0;

` lldb::thread_t m_thread = LLDB_INVALID_HOST_THREAD`


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104041/new/

https://reviews.llvm.org/D104041

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


[Lldb-commits] [PATCH] D104176: [libunwind] Define and use portable macro for checking for presence of ASAN

2021-06-14 Thread Daniel Levin via Phabricator via lldb-commits
daniel-levin updated this revision to Diff 351707.
daniel-levin added a comment.
Herald added subscribers: lldb-commits, dexonsmith, pengfei, delcypher, 
hiraditya, mgorny.
Herald added a project: LLDB.

[libunwind] Use most appropriate macro for checking for presence of ASan.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104176/new/

https://reviews.llvm.org/D104176

Files:
  libunwind/src/libunwind.cpp
  lldb/include/lldb/Utility/Timer.h
  lldb/source/Utility/Timer.cpp
  llvm/cmake/modules/AddLLVM.cmake
  llvm/include/llvm/CodeGen/TargetInstrInfo.h
  llvm/include/llvm/Support/Signposts.h
  llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
  llvm/lib/Support/Signposts.cpp
  llvm/lib/Support/Timer.cpp
  llvm/lib/Target/X86/X86FixupLEAs.cpp
  llvm/lib/Target/X86/X86InstrInfo.cpp
  llvm/lib/Target/X86/X86InstrInfo.h
  llvm/test/CodeGen/X86/2009-03-23-MultiUseSched.ll
  llvm/test/CodeGen/X86/lea-opt2.ll
  llvm/test/CodeGen/X86/vp2intersect_multiple_pairs.ll
  llvm/utils/lit/lit/discovery.py

Index: llvm/utils/lit/lit/discovery.py
===
--- llvm/utils/lit/lit/discovery.py
+++ llvm/utils/lit/lit/discovery.py
@@ -53,8 +53,7 @@
 config_map = litConfig.params.get('config_map')
 if config_map:
 cfgpath = os.path.realpath(cfgpath)
-cfgpath = os.path.normcase(cfgpath)
-target = config_map.get(cfgpath)
+target = config_map.get(os.path.normcase(cfgpath))
 if target:
 cfgpath = target
 
Index: llvm/test/CodeGen/X86/vp2intersect_multiple_pairs.ll
===
--- llvm/test/CodeGen/X86/vp2intersect_multiple_pairs.ll
+++ llvm/test/CodeGen/X86/vp2intersect_multiple_pairs.ll
@@ -53,9 +53,9 @@
 ; X86-NEXT:addl %ecx, %edx
 ; X86-NEXT:kmovw %k1, %ecx
 ; X86-NEXT:addl %edi, %ecx
-; X86-NEXT:addl %ecx, %eax
-; X86-NEXT:addl %edx, %eax
-; X86-NEXT:movw %ax, (%esi)
+; X86-NEXT:addl %eax, %ecx
+; X86-NEXT:addl %edx, %ecx
+; X86-NEXT:movw %cx, (%esi)
 ; X86-NEXT:leal -8(%ebp), %esp
 ; X86-NEXT:popl %esi
 ; X86-NEXT:popl %edi
@@ -107,10 +107,10 @@
 ; X64-NEXT:kmovw %k1, %ebx
 ; X64-NEXT:addl %edi, %eax
 ; X64-NEXT:addl %ecx, %edx
-; X64-NEXT:addl %ebx, %eax
-; X64-NEXT:addl %esi, %eax
-; X64-NEXT:addl %edx, %eax
-; X64-NEXT:movw %ax, (%r14)
+; X64-NEXT:leal (%rbx,%rsi), %ecx
+; X64-NEXT:addl %eax, %ecx
+; X64-NEXT:addl %edx, %ecx
+; X64-NEXT:movw %cx, (%r14)
 ; X64-NEXT:leaq -16(%rbp), %rsp
 ; X64-NEXT:popq %rbx
 ; X64-NEXT:popq %r14
Index: llvm/test/CodeGen/X86/lea-opt2.ll
===
--- llvm/test/CodeGen/X86/lea-opt2.ll
+++ llvm/test/CodeGen/X86/lea-opt2.ll
@@ -11,14 +11,15 @@
 ;subl%edx, %ecx
 ;subl%eax, %ecx
 
+; TODO: replace lea with sub.
 ; C - (A + B)   -->C - A - B
 define i32 @test1(i32* %p, i32 %a, i32 %b, i32 %c) {
 ; CHECK-LABEL: test1:
 ; CHECK:   # %bb.0: # %entry
 ; CHECK-NEXT:# kill: def $edx killed $edx def $rdx
 ; CHECK-NEXT:movl %esi, %eax
-; CHECK-NEXT:subl %edx, %ecx
-; CHECK-NEXT:subl %eax, %ecx
+; CHECK-NEXT:leal (%rdx,%rax), %esi
+; CHECK-NEXT:subl %esi, %ecx
 ; CHECK-NEXT:movl %ecx, (%rdi)
 ; CHECK-NEXT:subl %edx, %eax
 ; CHECK-NEXT:# kill: def $eax killed $eax killed $rax
@@ -31,15 +32,16 @@
   ret i32 %sub1
 }
 
+; TODO: replace lea with add.
 ; (A + B) + C   -->C + A + B
 define i32 @test2(i32* %p, i32 %a, i32 %b, i32 %c) {
 ; CHECK-LABEL: test2:
 ; CHECK:   # %bb.0: # %entry
 ; CHECK-NEXT:# kill: def $edx killed $edx def $rdx
 ; CHECK-NEXT:movl %esi, %eax
-; CHECK-NEXT:addl %eax, %ecx
-; CHECK-NEXT:addl %edx, %ecx
-; CHECK-NEXT:movl %ecx, (%rdi)
+; CHECK-NEXT:leal (%rax,%rdx), %esi
+; CHECK-NEXT:addl %ecx, %esi
+; CHECK-NEXT:movl %esi, (%rdi)
 ; CHECK-NEXT:subl %edx, %eax
 ; CHECK-NEXT:# kill: def $eax killed $eax killed $rax
 ; CHECK-NEXT:retq
@@ -51,15 +53,16 @@
   ret i32 %sub1
 }
 
+; TODO: replace lea with add.
 ; C + (A + B)   -->C + A + B
 define i32 @test3(i32* %p, i32 %a, i32 %b, i32 %c) {
 ; CHECK-LABEL: test3:
 ; CHECK:   # %bb.0: # %entry
 ; CHECK-NEXT:# kill: def $edx killed $edx def $rdx
 ; CHECK-NEXT:movl %esi, %eax
-; CHECK-NEXT:addl %eax, %ecx
-; CHECK-NEXT:addl %edx, %ecx
-; CHECK-NEXT:movl %ecx, (%rdi)
+; CHECK-NEXT:leal (%rax,%rdx), %esi
+; CHECK-NEXT:addl %ecx, %esi
+; CHECK-NEXT:movl %esi, (%rdi)
 ; CHECK-NEXT:subl %edx, %eax
 ; CHECK-NEXT:# kill: def $eax killed $eax killed $rax
 ; CHECK-NEXT:retq
@@ -92,12 +95,13 @@
   ret i32 %sub1
 }
 
+; TODO: replace lea with sub.
 define i64 @test5(i64* %p, i64 %a, i64 %b, i64 %c) {
 ; CHECK-LABEL: test5:
 ; CHECK:   # %bb.0: # %entry
 ; CHECK-NEXT:movq (%rdi

[Lldb-commits] [PATCH] D104221: [lldb][NFC] Remove redundant deleted constructors in HostInfoBase subclasses

2021-06-14 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision as: JDevlieghere.
JDevlieghere added a comment.

LGTM


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104221/new/

https://reviews.llvm.org/D104221

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


[Lldb-commits] [lldb] 03841ed - Allow signposts to take advantage of deferred string substitution

2021-06-14 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2021-06-14T14:19:41-07:00
New Revision: 03841edde7eee21d1d450041ab9a113a7e1be869

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

LOG: Allow signposts to take advantage of deferred string substitution

One nice feature of the os_signpost API is that format string
substitutions happen in the consumer, not the logging
application. LLVM's current Signpost class doesn't take advantage of
this though and instead always uses a static "Begin/End %s" format
string.

This patch uses variadic macros to allow the API to be used as
intended. Unfortunately, the primary use-case I had in mind (the
LLDB_SCOPED_TIMER() macro) does not get much better from this, because
__PRETTY_FUNCTION__ is *not* a macro, but a static string, so
signposts created by LLDB_SCOPED_TIMER() still use a static "%s"
format string. At least LLDB_SCOPED_TIMERF() works as intended.

This reapplies the previsously reverted patch with additional MachO.h
macro #undefs.

Differential Revision: https://reviews.llvm.org/D103575

Added: 


Modified: 
lldb/include/lldb/Utility/Timer.h
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/source/Utility/Timer.cpp
llvm/include/llvm/Support/Signposts.h
llvm/lib/Support/Signposts.cpp
llvm/lib/Support/Timer.cpp

Removed: 




diff  --git a/lldb/include/lldb/Utility/Timer.h 
b/lldb/include/lldb/Utility/Timer.h
index 2b39881de89ec..1e47ac7afc82b 100644
--- a/lldb/include/lldb/Utility/Timer.h
+++ b/lldb/include/lldb/Utility/Timer.h
@@ -10,10 +10,16 @@
 #define LLDB_UTILITY_TIMER_H
 
 #include "lldb/lldb-defines.h"
+#include "llvm/ADT/ScopeExit.h"
 #include "llvm/Support/Chrono.h"
+#include "llvm/Support/Signposts.h"
 #include 
 #include 
 
+namespace llvm {
+  class SignpostEmitter;
+}
+
 namespace lldb_private {
 class Stream;
 
@@ -72,15 +78,28 @@ class Timer {
   const Timer &operator=(const Timer &) = delete;
 };
 
+llvm::SignpostEmitter &GetSignposts();
+
 } // namespace lldb_private
 
 // Use a format string because LLVM_PRETTY_FUNCTION might not be a string
 // literal.
 #define LLDB_SCOPED_TIMER()
\
   static ::lldb_private::Timer::Category _cat(LLVM_PRETTY_FUNCTION);   
\
-  ::lldb_private::Timer _scoped_timer(_cat, "%s", LLVM_PRETTY_FUNCTION)
-#define LLDB_SCOPED_TIMERF(...)
\
+  ::lldb_private::Timer _scoped_timer(_cat, "%s", LLVM_PRETTY_FUNCTION);   
\
+  SIGNPOST_EMITTER_START_INTERVAL(::lldb_private::GetSignposts(),  
\
+  &_scoped_timer, "%s", LLVM_PRETTY_FUNCTION); 
\
+  auto _scoped_signpost = llvm::make_scope_exit([&_scoped_timer]() {   
\
+::lldb_private::GetSignposts().endInterval(&_scoped_timer);
\
+  })
+
+#define LLDB_SCOPED_TIMERF(FMT, ...)   
\
   static ::lldb_private::Timer::Category _cat(LLVM_PRETTY_FUNCTION);   
\
-  ::lldb_private::Timer _scoped_timer(_cat, __VA_ARGS__)
+  ::lldb_private::Timer _scoped_timer(_cat, FMT, __VA_ARGS__); 
\
+  SIGNPOST_EMITTER_START_INTERVAL(::lldb_private::GetSignposts(),  
\
+  &_scoped_timer, FMT, __VA_ARGS__);   
\
+  auto _scoped_signpost = llvm::make_scope_exit([&_scoped_timer]() {   
\
+::lldb_private::GetSignposts().endInterval(&_scoped_timer);
\
+  })
 
 #endif // LLDB_UTILITY_TIMER_H

diff  --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp 
b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index e015de5ba117c..bb745da3cf6a1 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -65,6 +65,63 @@
 #include 
 
 // Unfortunately the signpost header pulls in the system MachO header, too.
+#ifdef MH_MAGIC
+#undef MH_MAGIC
+#endif
+#ifdef MH_CIGAM
+#undef MH_CIGAM
+#endif
+#ifdef MH_MAGIC_64
+#undef MH_MAGIC_64
+#endif
+#ifdef MH_CIGAM_64
+#undef MH_CIGAM_64
+#endif
+#ifdef MH_OBJECT
+#undef MH_OBJECT
+#endif
+#ifdef MH_EXECUTE
+#undef MH_EXECUTE
+#endif
+#ifdef MH_FVMLIB
+#undef MH_FVMLIB
+#endif
+#ifdef MH_CORE
+#undef MH_CORE
+#endif
+#ifdef MH_PRELOAD
+#undef MH_PRELOAD
+#endif
+#ifdef MH_DYLIB
+#undef MH_DYLIB
+#endif
+#ifdef MH_DYLINKER
+#undef MH_DYLINKER
+#endif
+#ifdef MH_DYLIB_STUB
+#undef MH_DYLIB_STUB
+#endif
+#ifdef MH_DSYM
+#undef MH_DSYM
+#endif
+#ifdef MH_BUNDLE
+#undef MH_BUNDLE
+#endif
+#ifdef MH_KEXT_BUNDLE
+#undef MH_KEXT_BUNDLE
+#endif
+#ifdef MH_NOUNDEFS
+#undef MH_NOUNDEFS
+#endif
+#ifdef MH_INCRLINK
+#undef MH_INCRLINK
+#endif
+#ifdef MH_DYLDLINK
+#undef MH_DYLDLINK
+#endif
+#ifdef MH_BINDATLOAD
+#undef MH_BINDATLOA

[Lldb-commits] [lldb] 7a7c007 - Revert "Allow signposts to take advantage of deferred string substitution"

2021-06-14 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2021-06-14T16:09:04-07:00
New Revision: 7a7c00761f6294dc21c40cbe1737354e655cda9b

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

LOG: Revert "Allow signposts to take advantage of deferred string substitution"

This reverts commit 03841edde7eee21d1d450041ab9a113a7e1be869.

Unfortunately this still breaks the LLDB standalone bot.

Added: 


Modified: 
lldb/include/lldb/Utility/Timer.h
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/source/Utility/Timer.cpp
llvm/include/llvm/Support/Signposts.h
llvm/lib/Support/Signposts.cpp
llvm/lib/Support/Timer.cpp

Removed: 




diff  --git a/lldb/include/lldb/Utility/Timer.h 
b/lldb/include/lldb/Utility/Timer.h
index 1e47ac7afc82b..2b39881de89ec 100644
--- a/lldb/include/lldb/Utility/Timer.h
+++ b/lldb/include/lldb/Utility/Timer.h
@@ -10,16 +10,10 @@
 #define LLDB_UTILITY_TIMER_H
 
 #include "lldb/lldb-defines.h"
-#include "llvm/ADT/ScopeExit.h"
 #include "llvm/Support/Chrono.h"
-#include "llvm/Support/Signposts.h"
 #include 
 #include 
 
-namespace llvm {
-  class SignpostEmitter;
-}
-
 namespace lldb_private {
 class Stream;
 
@@ -78,28 +72,15 @@ class Timer {
   const Timer &operator=(const Timer &) = delete;
 };
 
-llvm::SignpostEmitter &GetSignposts();
-
 } // namespace lldb_private
 
 // Use a format string because LLVM_PRETTY_FUNCTION might not be a string
 // literal.
 #define LLDB_SCOPED_TIMER()
\
   static ::lldb_private::Timer::Category _cat(LLVM_PRETTY_FUNCTION);   
\
-  ::lldb_private::Timer _scoped_timer(_cat, "%s", LLVM_PRETTY_FUNCTION);   
\
-  SIGNPOST_EMITTER_START_INTERVAL(::lldb_private::GetSignposts(),  
\
-  &_scoped_timer, "%s", LLVM_PRETTY_FUNCTION); 
\
-  auto _scoped_signpost = llvm::make_scope_exit([&_scoped_timer]() {   
\
-::lldb_private::GetSignposts().endInterval(&_scoped_timer);
\
-  })
-
-#define LLDB_SCOPED_TIMERF(FMT, ...)   
\
+  ::lldb_private::Timer _scoped_timer(_cat, "%s", LLVM_PRETTY_FUNCTION)
+#define LLDB_SCOPED_TIMERF(...)
\
   static ::lldb_private::Timer::Category _cat(LLVM_PRETTY_FUNCTION);   
\
-  ::lldb_private::Timer _scoped_timer(_cat, FMT, __VA_ARGS__); 
\
-  SIGNPOST_EMITTER_START_INTERVAL(::lldb_private::GetSignposts(),  
\
-  &_scoped_timer, FMT, __VA_ARGS__);   
\
-  auto _scoped_signpost = llvm::make_scope_exit([&_scoped_timer]() {   
\
-::lldb_private::GetSignposts().endInterval(&_scoped_timer);
\
-  })
+  ::lldb_private::Timer _scoped_timer(_cat, __VA_ARGS__)
 
 #endif // LLDB_UTILITY_TIMER_H

diff  --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp 
b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index bb745da3cf6a1..e015de5ba117c 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -65,63 +65,6 @@
 #include 
 
 // Unfortunately the signpost header pulls in the system MachO header, too.
-#ifdef MH_MAGIC
-#undef MH_MAGIC
-#endif
-#ifdef MH_CIGAM
-#undef MH_CIGAM
-#endif
-#ifdef MH_MAGIC_64
-#undef MH_MAGIC_64
-#endif
-#ifdef MH_CIGAM_64
-#undef MH_CIGAM_64
-#endif
-#ifdef MH_OBJECT
-#undef MH_OBJECT
-#endif
-#ifdef MH_EXECUTE
-#undef MH_EXECUTE
-#endif
-#ifdef MH_FVMLIB
-#undef MH_FVMLIB
-#endif
-#ifdef MH_CORE
-#undef MH_CORE
-#endif
-#ifdef MH_PRELOAD
-#undef MH_PRELOAD
-#endif
-#ifdef MH_DYLIB
-#undef MH_DYLIB
-#endif
-#ifdef MH_DYLINKER
-#undef MH_DYLINKER
-#endif
-#ifdef MH_DYLIB_STUB
-#undef MH_DYLIB_STUB
-#endif
-#ifdef MH_DSYM
-#undef MH_DSYM
-#endif
-#ifdef MH_BUNDLE
-#undef MH_BUNDLE
-#endif
-#ifdef MH_KEXT_BUNDLE
-#undef MH_KEXT_BUNDLE
-#endif
-#ifdef MH_NOUNDEFS
-#undef MH_NOUNDEFS
-#endif
-#ifdef MH_INCRLINK
-#undef MH_INCRLINK
-#endif
-#ifdef MH_DYLDLINK
-#undef MH_DYLDLINK
-#endif
-#ifdef MH_BINDATLOAD
-#undef MH_BINDATLOAD
-#endif
 #ifdef CPU_TYPE_ARM
 #undef CPU_TYPE_ARM
 #endif

diff  --git a/lldb/source/Utility/Timer.cpp b/lldb/source/Utility/Timer.cpp
index b59ce3b9f5563..2f3afe4c87037 100644
--- a/lldb/source/Utility/Timer.cpp
+++ b/lldb/source/Utility/Timer.cpp
@@ -33,8 +33,6 @@ static std::atomic g_categories;
 /// Allows llvm::Timer to emit signposts when supported.
 static llvm::ManagedStatic Signposts;
 
-llvm::SignpostEmitter &lldb_private::GetSignposts() { return *Signposts; }
-
 std::atomic Timer::g_quiet(true);
 std::atomic Timer::g_display_depth(0);
 static std::mutex &GetFileMutex() {
@@ -61,6 +59,7 @@ void Timer::SetQuiet(bool value) { g_quiet = value; }
 

[Lldb-commits] [lldb] 035217f - Allow signposts to take advantage of deferred string substitution

2021-06-14 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2021-06-14T16:53:41-07:00
New Revision: 035217ff515b8ecdc871e39fa840f3cba1b9cec7

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

LOG: Allow signposts to take advantage of deferred string substitution

One nice feature of the os_signpost API is that format string
substitutions happen in the consumer, not the logging
application. LLVM's current Signpost class doesn't take advantage of
this though and instead always uses a static "Begin/End %s" format
string.

This patch uses variadic macros to allow the API to be used as
intended. Unfortunately, the primary use-case I had in mind (the
LLDB_SCOPED_TIMER() macro) does not get much better from this, because
__PRETTY_FUNCTION__ is *not* a macro, but a static string, so
signposts created by LLDB_SCOPED_TIMER() still use a static "%s"
format string. At least LLDB_SCOPED_TIMERF() works as intended.

This reapplies the previously reverted patch with additional include
order fixes for non-modular builds of LLDB.

Differential Revision: https://reviews.llvm.org/D103575

Added: 


Modified: 
lldb/include/lldb/Utility/Timer.h
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
lldb/source/Utility/Timer.cpp
llvm/include/llvm/Support/Signposts.h
llvm/lib/Support/Signposts.cpp
llvm/lib/Support/Timer.cpp

Removed: 




diff  --git a/lldb/include/lldb/Utility/Timer.h 
b/lldb/include/lldb/Utility/Timer.h
index 2b39881de89ec..ae30e719aa419 100644
--- a/lldb/include/lldb/Utility/Timer.h
+++ b/lldb/include/lldb/Utility/Timer.h
@@ -9,11 +9,17 @@
 #ifndef LLDB_UTILITY_TIMER_H
 #define LLDB_UTILITY_TIMER_H
 
-#include "lldb/lldb-defines.h"
+#include "llvm/Config/config.h"
+#include "llvm/ADT/ScopeExit.h"
 #include "llvm/Support/Chrono.h"
+#include "llvm/Support/Signposts.h"
 #include 
 #include 
 
+namespace llvm {
+  class SignpostEmitter;
+}
+
 namespace lldb_private {
 class Stream;
 
@@ -72,15 +78,28 @@ class Timer {
   const Timer &operator=(const Timer &) = delete;
 };
 
+llvm::SignpostEmitter &GetSignposts();
+
 } // namespace lldb_private
 
 // Use a format string because LLVM_PRETTY_FUNCTION might not be a string
 // literal.
 #define LLDB_SCOPED_TIMER()
\
   static ::lldb_private::Timer::Category _cat(LLVM_PRETTY_FUNCTION);   
\
-  ::lldb_private::Timer _scoped_timer(_cat, "%s", LLVM_PRETTY_FUNCTION)
-#define LLDB_SCOPED_TIMERF(...)
\
+  ::lldb_private::Timer _scoped_timer(_cat, "%s", LLVM_PRETTY_FUNCTION);   
\
+  SIGNPOST_EMITTER_START_INTERVAL(::lldb_private::GetSignposts(),  
\
+  &_scoped_timer, "%s", LLVM_PRETTY_FUNCTION); 
\
+  auto _scoped_signpost = llvm::make_scope_exit([&_scoped_timer]() {   
\
+::lldb_private::GetSignposts().endInterval(&_scoped_timer);
\
+  })
+
+#define LLDB_SCOPED_TIMERF(FMT, ...)   
\
   static ::lldb_private::Timer::Category _cat(LLVM_PRETTY_FUNCTION);   
\
-  ::lldb_private::Timer _scoped_timer(_cat, __VA_ARGS__)
+  ::lldb_private::Timer _scoped_timer(_cat, FMT, __VA_ARGS__); 
\
+  SIGNPOST_EMITTER_START_INTERVAL(::lldb_private::GetSignposts(),  
\
+  &_scoped_timer, FMT, __VA_ARGS__);   
\
+  auto _scoped_signpost = llvm::make_scope_exit([&_scoped_timer]() {   
\
+::lldb_private::GetSignposts().endInterval(&_scoped_timer);
\
+  })
 
 #endif // LLDB_UTILITY_TIMER_H

diff  --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp 
b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index e015de5ba117c..35898da280bde 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -21,6 +21,7 @@
 #include "lldb/Core/Section.h"
 #include "lldb/Core/StreamFile.h"
 #include "lldb/Host/Host.h"
+#include "lldb/Host/SafeMachO.h"
 #include "lldb/Symbol/DWARFCallFrameInfo.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Target/DynamicLoader.h"
@@ -42,8 +43,6 @@
 #include "lldb/Utility/Timer.h"
 #include "lldb/Utility/UUID.h"
 
-#include "lldb/Host/SafeMachO.h"
-
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/MemoryBuffer.h"
@@ -64,65 +63,48 @@
 
 #include 
 
+#if LLVM_SUPPORT_XCODE_SIGNPOSTS
 // Unfortunately the signpost header pulls in the system MachO header, too.
-#ifdef CPU_TYPE_ARM
 #undef CPU_TYPE_ARM
-#endif
-#ifdef CPU_TYPE_ARM64
 #undef CPU_TYPE_ARM64
-#endif
-#ifdef CPU_TYPE_ARM64_32
 #undef CPU_TYPE_ARM64_32
-#endif
-#

[Lldb-commits] [PATCH] D103575: Allow signposts to take advantage of deferred string substitution

2021-06-14 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova added a comment.

The Windows buildbot does not like signposts:

https://lab.llvm.org/buildbot/#/builders/83/builds/7271


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103575/new/

https://reviews.llvm.org/D103575

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


[Lldb-commits] [PATCH] D104281: [lldb][docs] Add reference docs for Lua scripting

2021-06-14 Thread Siger Young via Phabricator via lldb-commits
siger-young created this revision.
Herald added a subscriber: arphaman.
siger-young requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Add a basic reference page for Lua scripting, as a counterpart to section 
"Python Reference".


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104281

Files:
  lldb/docs/index.rst
  lldb/docs/use/lua-reference.rst

Index: lldb/docs/use/lua-reference.rst
===
--- /dev/null
+++ lldb/docs/use/lua-reference.rst
@@ -0,0 +1,190 @@
+Lua Reference
+
+
+.. default-role:: samp
+
+Lua is a lightweight but powerful language. At present, Lua is only serving as
+an embedded interpreter in LLDB.
+
+.. contents::
+   :local:
+
+Embedded Lua Interpreter
+---
+
+The embedded Lua interpreter can be accessed in a variety of ways from
+within LLDB. The easiest way is to use the lldb command script with no
+arguments at the lldb command prompt:
+
+::
+
+   (lldb) script
+   >>> t = { 1, 2, 3 }
+   >>> print(t[1])
+   1
+   >>> print(t[1] + t[2])
+   3
+   >>>
+
+This drops you into the embedded Lua interpreter. When running under the
+script command, lldb sets some convenience variables that give you quick access
+to the currently selected entities that characterize the program and debugger
+state. In each case, if there is no currently selected entity of the
+appropriate type, the variable's IsValid method will return false. These
+variables are:
+
++---+-+-+-+
+| Variable  | Type| Equivalent  | Description |
++---+-+-+-+
+| `lldb.debugger`   | `lldb.SBDebugger`   | `SBTarget:GetDebugger`  | Contains the debugger object whose `script` command was invoked.|
+|   | | | The `lldb.SBDebugger` object owns the command interpreter   |
+|   | | | and all the targets in your debug session.  There will always be a  |
+|   | | | Debugger in the embedded interpreter.   |
++---+-+-+-+
+| `lldb.target` | `lldb.SBTarget` | `SBDebugger:GetSelectedTarget`  | Contains the currently selected target - for instance the one made with the |
+|   | | | `file` or selected by the `target select ` command.   |
+|   | | `SBProcess:GetTarget`   | The `lldb.SBTarget` manages one running process, and all the executable |
+|   | | | and debug files for the process.|
++---+-+-+-+
+| `lldb.process`| `lldb.SBProcess`| `SBTarget:GetProcess`   | Contains the process of the currently selected target.  |
+|   | | | The `lldb.SBProcess` object manages the threads and allows access to|
+|   | | `SBThread:GetProcess`   | memory for the process. |
++---+-+-+-+
+| `lldb.thread` | `lldb.SBThread` | `SBProcess:GetSelectedThread`   | Contains the currently selected thread. |
+|   | | | The `lldb.SBThread` object manages the stack frames in that thread. |
+|   | | `SBFrame:GetThread` | A thread is always selected in the command interpreter when a target stops. |
+|   | |

[Lldb-commits] [PATCH] D104281: [lldb][docs] Add reference docs for Lua scripting

2021-06-14 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment.

Instead of copying the text from the Python page, I was actually thinking 
whether we should make the 'scripting' page more generic and just add the 
language-specific examples for Python and Lua there. I am not sure what's the 
best way to do that visually though with RST. We could just go for raw HTML and 
use a tab switcher like this:

F17403158: Screenshot 2021-06-15 at 08.45.14.png 


Also I don't think a lot of LLDB distributors include Lua at the moment, so I 
think that should be pointed out at some point, otherwise this leads to 
confusion.




Comment at: lldb/docs/use/lua-reference.rst:21
+
+   (lldb) script
+   >>> t = { 1, 2, 3 }

I think that only works if Lua is the default? `script -l lua --` seems what 
should work for all users independently of the default/config (unless Lua is 
disabled of course)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104281/new/

https://reviews.llvm.org/D104281

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