[Lldb-commits] [PATCH] D136565: [clang] Instantiate alias templates with sugar

2022-11-18 Thread Alexander Kornienko via Phabricator via lldb-commits
alexfh added a comment.

And another problem with this patch: there's another pattern (or multiple 
different patterns?) in the code, that result in around 3x clang memory usage 
increase after this patch. The result of `-print-stats` doesn't make it clear 
where the additional allocations come from:

  --- at_culprit2022-11-10 13:16:52.0 +0100
  +++ before_culprit2022-11-10 13:21:44.0 +0100
  @@ -1,340 +1,338 @@
  -
   STATISTICS:
   
   *** Semantic Analysis Stats:
   0 SFINAE diagnostics trapped.
   
   Number of memory regions: 600
   Bytes used: 13579328
   Bytes allocated: 13631488
   Bytes wasted: 52160 (includes alignment, etc)
   
   *** Analysis Based Warnings Stats:
   168155 functions analyzed (0 w/o CFGs).
 697398 CFG blocks built.
 4 average CFG blocks per function.
 503 max CFG blocks per function.
   0 functions analyzed for uninitialiazed variables
 0 variables analyzed.
 0 average variables per function.
 0 max variables per function.
 0 block visits.
 0 average block visits per function.
 0 max block visits per function.
   
   *** AST Context Stats:
  -  19535407 types total.
  +  19808684 types total.
   30 Decayed types, 48 each (1440 bytes)
   585 ConstantArray types, 56 each (32760 bytes)
   2792 DependentSizedArray types, 64 each (178688 bytes)
  -96 IncompleteArray types, 40 each (3840 bytes)
  +90 IncompleteArray types, 40 each (3600 bytes)
   38 Atomic types, 40 each (1520 bytes)
   32 Attributed types, 48 each (1536 bytes)
   62 Builtin types, 24 each (1488 bytes)
   1 Complex types, 40 each (40 bytes)
   64274 Decltype types, 40 each (2570960 bytes)
   17491 Auto types, 48 each (839568 bytes)
   114 DeducedTemplateSpecialization types, 48 each (5472 bytes)
  -798961 DependentName types, 48 each (38350128 bytes)
  -527 DependentTemplateSpecialization types, 48 each (25296 bytes)
  -5241210 Elaborated types, 48 each (251578080 bytes)
  -588059 FunctionProto types, 40 each (23522360 bytes)
  +798160 DependentName types, 48 each (38311680 bytes)
  +467 DependentTemplateSpecialization types, 48 each (22416 bytes)
  +4735944 Elaborated types, 48 each (227325312 bytes)
  +585169 FunctionProto types, 40 each (23406760 bytes)
   5631 InjectedClassName types, 40 each (225240 bytes)
   4684 MemberPointer types, 48 each (224832 bytes)
   2 ObjCObjectPointer types, 40 each (80 bytes)
   2 ObjCObject types, 40 each (80 bytes)
   1 ObjCInterface types, 48 each (48 bytes)
  -30517 PackExpansion types, 40 each (1220680 bytes)
  -2700 Paren types, 40 each (108000 bytes)
  -393866 Pointer types, 40 each (15754640 bytes)
  -208529 LValueReference types, 40 each (8341160 bytes)
  -176267 RValueReference types, 40 each (7050680 bytes)
  -814 SubstTemplateTypeParmPack types, 48 each (39072 bytes)
  -3432531 SubstTemplateTypeParm types, 40 each (137301240 bytes)
  +30567 PackExpansion types, 40 each (1222680 bytes)
  +2694 Paren types, 40 each (107760 bytes)
  +395432 Pointer types, 40 each (15817280 bytes)
  +207973 LValueReference types, 40 each (8318920 bytes)
  +178946 RValueReference types, 40 each (7157840 bytes)
  +764 SubstTemplateTypeParmPack types, 48 each (36672 bytes)
  +4213429 SubstTemplateTypeParm types, 40 each (168537160 bytes)
   1596 Enum types, 32 each (51072 bytes)
   577336 Record types, 32 each (18474752 bytes)
   5892736 TemplateSpecialization types, 40 each (235709440 bytes)
   1776985 TemplateTypeParm types, 40 each (71079400 bytes)
   2 TypeOfExpr types, 32 each (64 bytes)
   188177 Typedef types, 40 each (7527080 bytes)
   124634 UnaryTransform types, 48 each (5982432 bytes)
  -4068 Using types, 40 each (162720 bytes)
  +1787 Using types, 40 each (71480 bytes)
   57 Vector types, 40 each (2280 bytes)
  -Total bytes = 826368168
  +Total bytes = 833249832
   5151/505661 implicit default constructors created
   21741/525877 implicit copy constructors created
   18531/522651 implicit move constructors created
   9247/526033 implicit copy assignment operators created
   5875/517861 implicit move assignment operators created
   23158/524964 implicit destructors created
   
  -Number of memory regions: 1846
  -Bytes used: 11780764491
  -Bytes allocated: 12214755831
  -Bytes wasted: 433991340 (includes alignment, etc)
  +Number of memory regions: 1697
  +Bytes used: 4995782175
  +Bytes allocated: 5403406263
  +Bytes wasted: 407624088 (includes alignment, etc)
   
   *** Decl Stats:
 4825242 decls total.
   21328 AccessSpec decls, 40 each (853120 bytes)
   2 Empty decls, 40 each (80 bytes)
   1 ExternCContext decls, 72 each (72 bytes)
   4 FileScopeAsm decls, 56 each (224 bytes)
   7779 Friend decls, 64 each (497856 bytes)
   6 LifetimeExtendedTemporary decls, 72 each (432 bytes)
   1721 Linkage

[Lldb-commits] [PATCH] D138271: Fix license header in TraceHTR.h

2022-11-18 Thread Pietro Albini via Phabricator via lldb-commits
pietroalbini created this revision.
Herald added a project: All.
pietroalbini requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

It seems like the license header got mangled somehow, joining multiple
lines together and splitting some lines across multiple ones. That is
causing errors in a license checker I'm using (called REUSE).

  

This commit restores the license header to the format used by the rest
of the files in the project.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D138271

Files:
  lldb/source/Plugins/TraceExporter/common/TraceHTR.h


Index: lldb/source/Plugins/TraceExporter/common/TraceHTR.h
===
--- lldb/source/Plugins/TraceExporter/common/TraceHTR.h
+++ lldb/source/Plugins/TraceExporter/common/TraceHTR.h
@@ -1,9 +1,8 @@
 //===-- TraceHTR.h 
===//
 //
-// Part of the LLVM Project, under the Apache
-// License v2.0 with LLVM Exceptions.// See https://llvm.org/LICENSE.txt for
-// license information.// SPDX-License-Identifier: Apache-2.0 WITH
-// LLVM-exception
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 
//===--===//
 


Index: lldb/source/Plugins/TraceExporter/common/TraceHTR.h
===
--- lldb/source/Plugins/TraceExporter/common/TraceHTR.h
+++ lldb/source/Plugins/TraceExporter/common/TraceHTR.h
@@ -1,9 +1,8 @@
 //===-- TraceHTR.h ===//
 //
-// Part of the LLVM Project, under the Apache
-// License v2.0 with LLVM Exceptions.// See https://llvm.org/LICENSE.txt for
-// license information.// SPDX-License-Identifier: Apache-2.0 WITH
-// LLVM-exception
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===--===//
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D138276: TableGen: require tablegen cl::opts to be registered explicitly

2022-11-18 Thread Nicolai Hähnle via Phabricator via lldb-commits
nhaehnle created this revision.
Herald added subscribers: libc-commits, Moerafaat, zero9178, bzcheeseman, 
sdasgup3, wenzhicui, wrengr, cota, teijeong, rdzhabarov, tatianashp, msifontes, 
jurahul, Kayjukh, grosul1, Joonsoo, liufengdb, aartbik, mgester, arpith-jacob, 
antiagainst, shauheen, rriddle, mehdi_amini, hiraditya.
Herald added projects: libc-project, All.
nhaehnle requested review of this revision.
Herald added subscribers: lldb-commits, cfe-commits, stephenneuendorffer, 
nicolasvasilache.
Herald added projects: clang, LLDB, MLIR, LLVM.

We plan to include the TableGen library into the LLVM shared library.
This is a preparatory change to avoid polluting the command-line options
space of non-tablegen tools.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D138276

Files:
  clang/utils/TableGen/TableGen.cpp
  libc/utils/HdrGen/Main.cpp
  libc/utils/HdrGen/PrototypeTestGen/PrototypeTestGen.cpp
  libc/utils/tools/WrapperGen/Main.cpp
  lldb/utils/TableGen/LLDBTableGen.cpp
  llvm/include/llvm/TableGen/Main.h
  llvm/lib/TableGen/Main.cpp
  llvm/tools/llvm-shlib/CMakeLists.txt
  llvm/utils/TableGen/TableGen.cpp
  mlir/lib/Tools/mlir-tblgen/MlirTblgenMain.cpp

Index: mlir/lib/Tools/mlir-tblgen/MlirTblgenMain.cpp
===
--- mlir/lib/Tools/mlir-tblgen/MlirTblgenMain.cpp
+++ mlir/lib/Tools/mlir-tblgen/MlirTblgenMain.cpp
@@ -129,6 +129,7 @@
   llvm::cl::opt generator(
   "", llvm::cl::desc("Generator to run"), cl::location(::generator));
 
+  llvm::registerTableGenOptions();
   cl::ParseCommandLineOptions(argc, argv);
 
   return TableGenMain(argv[0], &mlirTableGenMain);
Index: llvm/utils/TableGen/TableGen.cpp
===
--- llvm/utils/TableGen/TableGen.cpp
+++ llvm/utils/TableGen/TableGen.cpp
@@ -286,6 +286,7 @@
 
 int main(int argc, char **argv) {
   InitLLVM X(argc, argv);
+  registerTableGenOptions();
   cl::ParseCommandLineOptions(argc, argv);
 
   return TableGenMain(argv[0], &LLVMTableGenMain);
Index: llvm/tools/llvm-shlib/CMakeLists.txt
===
--- llvm/tools/llvm-shlib/CMakeLists.txt
+++ llvm/tools/llvm-shlib/CMakeLists.txt
@@ -19,7 +19,6 @@
 
   # Exclude libLLVMTableGen for the following reasons:
   #  - it is only used by internal *-tblgen utilities;
-  #  - it pollutes the global options space.
   list(REMOVE_ITEM LIB_NAMES "LLVMTableGen")
 
   if(LLVM_DYLIB_EXPORTED_SYMBOL_FILE)
Index: llvm/lib/TableGen/Main.cpp
===
--- llvm/lib/TableGen/Main.cpp
+++ llvm/lib/TableGen/Main.cpp
@@ -26,36 +26,45 @@
 #include 
 using namespace llvm;
 
-static cl::opt
-OutputFilename("o", cl::desc("Output filename"), cl::value_desc("filename"),
-   cl::init("-"));
+namespace {
 
-static cl::opt
-DependFilename("d",
-   cl::desc("Dependency filename"),
-   cl::value_desc("filename"),
-   cl::init(""));
+struct TableGenOptions {
+  cl::opt OutputFilename{"o", cl::desc("Output filename"),
+  cl::value_desc("filename"),
+  cl::init("-")};
 
-static cl::opt
-InputFilename(cl::Positional, cl::desc(""), cl::init("-"));
+  cl::opt DependFilename{"d", cl::desc("Dependency filename"),
+  cl::value_desc("filename"), cl::init("")};
 
-static cl::list
-IncludeDirs("I", cl::desc("Directory of include files"),
-cl::value_desc("directory"), cl::Prefix);
+  cl::opt InputFilename{cl::Positional, cl::desc(""),
+ cl::init("-")};
 
-static cl::list
-MacroNames("D", cl::desc("Name of the macro to be defined"),
-cl::value_desc("macro name"), cl::Prefix);
+  cl::list IncludeDirs{"I", cl::desc("Directory of include files"),
+cl::value_desc("directory"), cl::Prefix};
 
-static cl::opt
-WriteIfChanged("write-if-changed", cl::desc("Only write output if it changed"));
+  cl::list MacroNames{"D",
+   cl::desc("Name of the macro to be defined"),
+   cl::value_desc("macro name"), cl::Prefix};
 
-static cl::opt
-TimePhases("time-phases", cl::desc("Time phases of parser and backend"));
+  cl::opt WriteIfChanged{"write-if-changed",
+   cl::desc("Only write output if it changed")};
 
-static cl::opt NoWarnOnUnusedTemplateArgs(
-"no-warn-on-unused-template-args",
-cl::desc("Disable unused template argument warnings."));
+  cl::opt TimePhases{"time-phases",
+   cl::desc("Time phases of parser and backend")};
+
+  cl::opt NoWarnOnUnusedTemplateArgs{
+  "no-warn-on-unused-template-args",
+  cl::desc("Disable unused template argument warnings.")};
+};
+
+TableGenOptions &getOpts() {
+  static TableGenOptions Opts;
+  return

[Lldb-commits] [lldb] a8bec61 - [lldb] Fix that empty target.run-args are not actually used when launching process

2022-11-18 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2022-11-18T16:48:56+01:00
New Revision: a8bec6117998cd4a9ff6798381cd0df9c9edb982

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

LOG: [lldb] Fix that empty target.run-args are not actually used when launching 
process

`GetPropertyAtIndexAsArgs` returns true on success and false on failure. Right
now it returns the converted `size_t` returned from `GetArgs` which describes
the number of arguments in the argument list. So for empty argument lists
(`(size_t)0` -> `(bool)false`) this function always fails.

The only observable effect of this seems to be that empty arguments are never
propagated to the internal LaunchInfo for a process. This causes that once any
argument has been added to `target.run-args`, clearing `target.run-args` doesn't
have any effect.

Fixes issue #55568

Reviewed By: JDevlieghere, jingham

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

Added: 


Modified: 
lldb/source/Interpreter/OptionValueProperties.cpp
lldb/test/API/python_api/target/TestTargetAPI.py

Removed: 




diff  --git a/lldb/source/Interpreter/OptionValueProperties.cpp 
b/lldb/source/Interpreter/OptionValueProperties.cpp
index c2c13ba97baa..62590bb18869 100644
--- a/lldb/source/Interpreter/OptionValueProperties.cpp
+++ b/lldb/source/Interpreter/OptionValueProperties.cpp
@@ -248,16 +248,22 @@ bool OptionValueProperties::GetPropertyAtIndexAsArgs(
 return false;
 
   const OptionValueArgs *arguments = value->GetAsArgs();
-  if (arguments)
-return arguments->GetArgs(args);
+  if (arguments) {
+arguments->GetArgs(args);
+return true;
+  }
 
   const OptionValueArray *array = value->GetAsArray();
-  if (array)
-return array->GetArgs(args);
+  if (array) {
+array->GetArgs(args);
+return true;
+  }
 
   const OptionValueDictionary *dict = value->GetAsDictionary();
-  if (dict)
-return dict->GetArgs(args);
+  if (dict) {
+dict->GetArgs(args);
+return true;
+  }
 
   return false;
 }

diff  --git a/lldb/test/API/python_api/target/TestTargetAPI.py 
b/lldb/test/API/python_api/target/TestTargetAPI.py
index 0b2514416bed..f1a379bc2f30 100644
--- a/lldb/test/API/python_api/target/TestTargetAPI.py
+++ b/lldb/test/API/python_api/target/TestTargetAPI.py
@@ -191,6 +191,15 @@ def test_launch_simple(self):
 self.assertIn('arg: foo', output)
 self.assertIn('env: bar=baz', output)
 
+# Clear all the run args set above.
+self.runCmd("setting clear target.run-args")
+process = target.LaunchSimple(None, None,
+  self.get_process_working_directory())
+process.Continue()
+self.assertEqual(process.GetState(), lldb.eStateExited)
+output = process.GetSTDOUT()
+self.assertNotIn('arg: foo', output)
+
 self.runCmd("settings set target.disable-stdio true")
 process = target.LaunchSimple(
 None, None, self.get_process_working_directory())



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


[Lldb-commits] [PATCH] D126057: [lldb] Fix that empty target.run-args are not actually used when launching process

2022-11-18 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa8bec6117998: [lldb] Fix that empty target.run-args are not 
actually used when launching… (authored by teemperor).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126057

Files:
  lldb/source/Interpreter/OptionValueProperties.cpp
  lldb/test/API/python_api/target/TestTargetAPI.py


Index: lldb/test/API/python_api/target/TestTargetAPI.py
===
--- lldb/test/API/python_api/target/TestTargetAPI.py
+++ lldb/test/API/python_api/target/TestTargetAPI.py
@@ -191,6 +191,15 @@
 self.assertIn('arg: foo', output)
 self.assertIn('env: bar=baz', output)
 
+# Clear all the run args set above.
+self.runCmd("setting clear target.run-args")
+process = target.LaunchSimple(None, None,
+  self.get_process_working_directory())
+process.Continue()
+self.assertEqual(process.GetState(), lldb.eStateExited)
+output = process.GetSTDOUT()
+self.assertNotIn('arg: foo', output)
+
 self.runCmd("settings set target.disable-stdio true")
 process = target.LaunchSimple(
 None, None, self.get_process_working_directory())
Index: lldb/source/Interpreter/OptionValueProperties.cpp
===
--- lldb/source/Interpreter/OptionValueProperties.cpp
+++ lldb/source/Interpreter/OptionValueProperties.cpp
@@ -248,16 +248,22 @@
 return false;
 
   const OptionValueArgs *arguments = value->GetAsArgs();
-  if (arguments)
-return arguments->GetArgs(args);
+  if (arguments) {
+arguments->GetArgs(args);
+return true;
+  }
 
   const OptionValueArray *array = value->GetAsArray();
-  if (array)
-return array->GetArgs(args);
+  if (array) {
+array->GetArgs(args);
+return true;
+  }
 
   const OptionValueDictionary *dict = value->GetAsDictionary();
-  if (dict)
-return dict->GetArgs(args);
+  if (dict) {
+dict->GetArgs(args);
+return true;
+  }
 
   return false;
 }


Index: lldb/test/API/python_api/target/TestTargetAPI.py
===
--- lldb/test/API/python_api/target/TestTargetAPI.py
+++ lldb/test/API/python_api/target/TestTargetAPI.py
@@ -191,6 +191,15 @@
 self.assertIn('arg: foo', output)
 self.assertIn('env: bar=baz', output)
 
+# Clear all the run args set above.
+self.runCmd("setting clear target.run-args")
+process = target.LaunchSimple(None, None,
+  self.get_process_working_directory())
+process.Continue()
+self.assertEqual(process.GetState(), lldb.eStateExited)
+output = process.GetSTDOUT()
+self.assertNotIn('arg: foo', output)
+
 self.runCmd("settings set target.disable-stdio true")
 process = target.LaunchSimple(
 None, None, self.get_process_working_directory())
Index: lldb/source/Interpreter/OptionValueProperties.cpp
===
--- lldb/source/Interpreter/OptionValueProperties.cpp
+++ lldb/source/Interpreter/OptionValueProperties.cpp
@@ -248,16 +248,22 @@
 return false;
 
   const OptionValueArgs *arguments = value->GetAsArgs();
-  if (arguments)
-return arguments->GetArgs(args);
+  if (arguments) {
+arguments->GetArgs(args);
+return true;
+  }
 
   const OptionValueArray *array = value->GetAsArray();
-  if (array)
-return array->GetArgs(args);
+  if (array) {
+array->GetArgs(args);
+return true;
+  }
 
   const OptionValueDictionary *dict = value->GetAsDictionary();
-  if (dict)
-return dict->GetArgs(args);
+  if (dict) {
+dict->GetArgs(args);
+return true;
+  }
 
   return false;
 }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D138176: [dsymutil] Fix assertion: (Ref > InputDIE.getOffset()), function cloneDieReferenceAttribute

2022-11-18 Thread Alexey Lapshin via Phabricator via lldb-commits
avl requested changes to this revision.
avl added a comment.
This revision now requires changes to proceed.

I think we need to create a test case. I tried(still trying) to create one, but 
it seems this assertions should always be satisfied : "assert(Ref > 
InputDIE.getOffset());". That might be an error if referenced DIE is not cloned.


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

https://reviews.llvm.org/D138176

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


[Lldb-commits] [lldb] 5704598 - [LLDB][AArch64] Add BF16BF16, SME2p1 and SVE2p1 to disassembler test

2022-11-18 Thread David Spickett via lldb-commits

Author: David Spickett
Date: 2022-11-18T16:17:40Z
New Revision: 57045982e92eeff7b52402eee3fba72dda0274c8

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

LOG: [LLDB][AArch64] Add BF16BF16, SME2p1 and SVE2p1 to disassembler test

See:
https://reviews.llvm.org/rGcf69895ab31b
https://reviews.llvm.org/D136352
https://reviews.llvm.org/D137410

Added: 


Modified: 
lldb/test/Shell/Commands/command-disassemble-aarch64-extensions.s

Removed: 




diff  --git a/lldb/test/Shell/Commands/command-disassemble-aarch64-extensions.s 
b/lldb/test/Shell/Commands/command-disassemble-aarch64-extensions.s
index 762eef4ef7792..89a771d5b05c0 100644
--- a/lldb/test/Shell/Commands/command-disassemble-aarch64-extensions.s
+++ b/lldb/test/Shell/Commands/command-disassemble-aarch64-extensions.s
@@ -31,6 +31,8 @@ fn:
   sm4e z0.s, z0.s, z0.s   // SVE2SM4
   rax1 z0.d, z0.d, z0.d   // SVE2SHA3
   bdep z0.b, z1.b, z31.b  // SVE2BITPERM
+  addqv   v0.8h, p0, z0.h // SVE2p1 / SME2p1
+  bfadd z23.h, p3/m, z23.h, z13.h // B16B16
   ldaprb w0, [x0, #0] // RCPC
   mrs x0, rndr// RAND
   irg x0, x0  // MTE
@@ -78,6 +80,8 @@ lbl:
 # CHECK: sm4e   z0.s, z0.s, z0.s
 # CHECK: rax1   z0.d, z0.d, z0.d
 # CHECK: bdep   z0.b, z1.b, z31.b
+# CHECK: addqv  v0.8h, p0, z0.h
+# CHECK: bfadd  z23.h, p3/m, z23.h, z13.h
 # CHECK: ldaprb w0, [x0]
 # CHECK: mrsx0, RNDR
 # CHECK: irgx0, x0
@@ -97,6 +101,6 @@ lbl:
 # CHECK: fmopa  za0.d, p0/m, p0/m, z0.d, z0.d
 # CHECK: addha  za0.d, p0/m, p0/m, z0.d
 # CHECK: add{ z0.h, z1.h }, { z0.h, z1.h }, z0.h
-# CHECK: bc.eq  0x9c
+# CHECK: bc.eq  0xa4
 # CHECK: cpyfp  [x0]!, [x1]!, x2!
 # CHECK: mrsx0, PMCCNTR_EL0



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


[Lldb-commits] [PATCH] D137217: [LTO][COFF] Use bitcode file names in lto native object file names.

2022-11-18 Thread Teresa Johnson via Phabricator via lldb-commits
tejohnson accepted this revision.
tejohnson 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/D137217/new/

https://reviews.llvm.org/D137217

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


[Lldb-commits] [PATCH] D138310: [NFC] Make headers self-contained.

2022-11-18 Thread Jordan Rupprecht via Phabricator via lldb-commits
rupprecht created this revision.
Herald added subscribers: frasercrmck, luismarques, apazos, sameer.abuasal, 
s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, 
edward-jones, zzheng, jrtc27, niosHD, sabuasal, simoncook, johnrusso, rbar, 
asb, arichardson.
Herald added a project: All.
rupprecht requested review of this revision.
Herald added subscribers: lldb-commits, pcwang-thead.
Herald added a project: LLDB.

Some headers in LLDB work only when considered as textual inclusion, but not if 
one attempts to use them on their own or with a different context.

- python-typemaps.h: uses Python definitions without using "Python.h".
- RISCVCInstructions.h uses RISC-V register enums without including the enums 
header.
- RISCVInstructions.h includes EmulateInstructionRISCV.h, but is unnecessary 
since we forward-declare EmulateInstructionRISCV anyway. Including the header 
is problematic because EmulateInstructionRISCV.h uses DecodeResult which isn't 
defined until later in RISCVInstructions.h.

This makes LLDB build cleanly with the "parse_headers" feature [1]. I'm not 
sure what the analagous CMake option is.

[1] I didn't find public documentation but @MaskRay wrote this up: 
https://maskray.me/blog/2022-09-25-layering-check-with-clang#parse_headers


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D138310

Files:
  lldb/bindings/python/python-typemaps.h
  lldb/source/Plugins/Instruction/RISCV/RISCVCInstructions.h
  lldb/source/Plugins/Instruction/RISCV/RISCVInstructions.h


Index: lldb/source/Plugins/Instruction/RISCV/RISCVInstructions.h
===
--- lldb/source/Plugins/Instruction/RISCV/RISCVInstructions.h
+++ lldb/source/Plugins/Instruction/RISCV/RISCVInstructions.h
@@ -12,7 +12,6 @@
 #include 
 #include 
 
-#include "EmulateInstructionRISCV.h"
 #include "llvm/ADT/Optional.h"
 
 namespace lldb_private {
Index: lldb/source/Plugins/Instruction/RISCV/RISCVCInstructions.h
===
--- lldb/source/Plugins/Instruction/RISCV/RISCVCInstructions.h
+++ lldb/source/Plugins/Instruction/RISCV/RISCVCInstructions.h
@@ -12,6 +12,7 @@
 #include 
 #include 
 
+#include "Plugins/Process/Utility/lldb-riscv-register-enums.h"
 #include "RISCVInstructions.h"
 #include "llvm/ADT/Optional.h"
 
Index: lldb/bindings/python/python-typemaps.h
===
--- lldb/bindings/python/python-typemaps.h
+++ lldb/bindings/python/python-typemaps.h
@@ -1,6 +1,8 @@
 #ifndef LLDB_BINDINGS_PYTHON_PYTHON_TYPEMAPS_H
 #define LLDB_BINDINGS_PYTHON_PYTHON_TYPEMAPS_H
 
+#include 
+
 // Defined here instead of a .swig file because SWIG 2 doesn't support
 // explicit deleted functions.
 struct Py_buffer_RAII {


Index: lldb/source/Plugins/Instruction/RISCV/RISCVInstructions.h
===
--- lldb/source/Plugins/Instruction/RISCV/RISCVInstructions.h
+++ lldb/source/Plugins/Instruction/RISCV/RISCVInstructions.h
@@ -12,7 +12,6 @@
 #include 
 #include 
 
-#include "EmulateInstructionRISCV.h"
 #include "llvm/ADT/Optional.h"
 
 namespace lldb_private {
Index: lldb/source/Plugins/Instruction/RISCV/RISCVCInstructions.h
===
--- lldb/source/Plugins/Instruction/RISCV/RISCVCInstructions.h
+++ lldb/source/Plugins/Instruction/RISCV/RISCVCInstructions.h
@@ -12,6 +12,7 @@
 #include 
 #include 
 
+#include "Plugins/Process/Utility/lldb-riscv-register-enums.h"
 #include "RISCVInstructions.h"
 #include "llvm/ADT/Optional.h"
 
Index: lldb/bindings/python/python-typemaps.h
===
--- lldb/bindings/python/python-typemaps.h
+++ lldb/bindings/python/python-typemaps.h
@@ -1,6 +1,8 @@
 #ifndef LLDB_BINDINGS_PYTHON_PYTHON_TYPEMAPS_H
 #define LLDB_BINDINGS_PYTHON_PYTHON_TYPEMAPS_H
 
+#include 
+
 // Defined here instead of a .swig file because SWIG 2 doesn't support
 // explicit deleted functions.
 struct Py_buffer_RAII {
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 58d38b3 - [lldb] Restore default setting of LLDB_INCLUDE_TESTS in standalone builds

2022-11-18 Thread Alex Langford via lldb-commits

Author: Alex Langford
Date: 2022-11-18T09:05:08-08:00
New Revision: 58d38b3ff8c3c4dd816d2047acf65fa97c0b6fb8

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

LOG: [lldb] Restore default setting of LLDB_INCLUDE_TESTS in standalone builds

In 52f39853abd46495a6d636c4b035e1b92cf4b833 the option LLDB_INCLUDE_TESTS was
moved above the inclusion of LLDBStandalone. This isn't a problem per-se, but
it changes the default value of LLDB_INCLUDE_TESTS in standalone builds.
LLDBStandalone explicitly sets LLVM_INCLUDE_TESTS to true, indicating that
for standalone builds this is considered the default behavior.
This patch restores said default behavior.

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

Added: 


Modified: 
lldb/CMakeLists.txt
lldb/cmake/modules/LLDBStandalone.cmake

Removed: 




diff  --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt
index 6f314634d23b1..110c7b09326d8 100644
--- a/lldb/CMakeLists.txt
+++ b/lldb/CMakeLists.txt
@@ -18,6 +18,7 @@ set(CMAKE_MODULE_PATH
 if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
   project(lldb)
   set(LLDB_BUILT_STANDALONE TRUE)
+  set(LLVM_INCLUDE_TESTS ON CACHE INTERNAL "")
 endif()
 
 # Must go below project(..)

diff  --git a/lldb/cmake/modules/LLDBStandalone.cmake 
b/lldb/cmake/modules/LLDBStandalone.cmake
index 81304723f0f40..6dfb459b5b498 100644
--- a/lldb/cmake/modules/LLDBStandalone.cmake
+++ b/lldb/cmake/modules/LLDBStandalone.cmake
@@ -89,7 +89,6 @@ include(CheckAtomic)
 include(LLVMDistributionSupport)
 
 set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
-set(LLVM_INCLUDE_TESTS ON CACHE INTERNAL "")
 
 set(CMAKE_INCLUDE_CURRENT_DIR ON)
 include_directories(



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


[Lldb-commits] [PATCH] D138237: [lldb] Restore default setting of LLDB_INCLUDE_TESTS in standalone builds

2022-11-18 Thread Alex Langford via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG58d38b3ff8c3: [lldb] Restore default setting of 
LLDB_INCLUDE_TESTS in standalone builds (authored by bulbazord).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138237

Files:
  lldb/CMakeLists.txt
  lldb/cmake/modules/LLDBStandalone.cmake


Index: lldb/cmake/modules/LLDBStandalone.cmake
===
--- lldb/cmake/modules/LLDBStandalone.cmake
+++ lldb/cmake/modules/LLDBStandalone.cmake
@@ -89,7 +89,6 @@
 include(LLVMDistributionSupport)
 
 set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
-set(LLVM_INCLUDE_TESTS ON CACHE INTERNAL "")
 
 set(CMAKE_INCLUDE_CURRENT_DIR ON)
 include_directories(
Index: lldb/CMakeLists.txt
===
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -18,6 +18,7 @@
 if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
   project(lldb)
   set(LLDB_BUILT_STANDALONE TRUE)
+  set(LLVM_INCLUDE_TESTS ON CACHE INTERNAL "")
 endif()
 
 # Must go below project(..)


Index: lldb/cmake/modules/LLDBStandalone.cmake
===
--- lldb/cmake/modules/LLDBStandalone.cmake
+++ lldb/cmake/modules/LLDBStandalone.cmake
@@ -89,7 +89,6 @@
 include(LLVMDistributionSupport)
 
 set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
-set(LLVM_INCLUDE_TESTS ON CACHE INTERNAL "")
 
 set(CMAKE_INCLUDE_CURRENT_DIR ON)
 include_directories(
Index: lldb/CMakeLists.txt
===
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -18,6 +18,7 @@
 if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
   project(lldb)
   set(LLDB_BUILT_STANDALONE TRUE)
+  set(LLVM_INCLUDE_TESTS ON CACHE INTERNAL "")
 endif()
 
 # Must go below project(..)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D129898: [test] Allow libc++ namespaces besides `__1`

2022-11-18 Thread Jordan Rupprecht via Phabricator via lldb-commits
rupprecht added a comment.

In D129898#3656303 , @rupprecht wrote:

> In D129898#3656268 , @JDevlieghere 
> wrote:
>
>> Seems like there's another instance of this in 
>> `TestForwardDeclFromStdModule.py`.
>
> Added that one too.
>
> There is also this one: 
> https://github.com/llvm/llvm-project/blob/09531ede6d5622da68941902072dbca517d31318/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp#L222
> But updating it didn't have the effect I was expecting, so there might be 
> something more involved. I'll save that for a later patch.

I looked at this one again and feeling more sure that it will be a more 
complicated fix. `FindLibCppStdFunctionCallableInfo` there is looking at `__f_` 
and assuming the type looks like `__value_func`. However, when using unstable 
libc++ ABI (and IIUC `std::__1` is an indication that unstable libc++ is *not* 
being used), that enables `_LIBCPP_ABI_OPTIMIZED_FUNCTION` which changes `__f_` 
to `__policy_func` with an entirely different layout. The fact that it hard 
codes `std::__1` is the least of its problems w.r.t using a non-vanilla libc++.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129898

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


[Lldb-commits] [PATCH] D138315: [lldb] Introduce dwim-print command

2022-11-18 Thread Dave Lee via Phabricator via lldb-commits
kastiglione created this revision.
kastiglione added reviewers: JDevlieghere, aprantl, jingham, labath, werat, 
cmtice.
Herald added a project: All.
kastiglione requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Implements `dwim-print`, a printing command that chooses the most direct, 
efficient, and resilient means of printing a given expression.

DWIM is an acronym for Do What I Mean. From Wikipedia, DWIM is described as:

  > attempt to anticipate what users intend to do, correcting trivial errors
  > automatically rather than blindly executing users' explicit but
  > potentially incorrect input

The `dwim-print` command serves as a single print command for users who don't 
yet know, or prefer not to know, the various lldb commands that can be used to 
print, and when to use them.

This initial implementation is the base foundation for `dwim-print`. It accepts 
no flags, only an expression. If the expression is the name of a variable in 
the frame, then effectively `frame variable` is used to get, and print, its 
value. Otherwise, printing falls back to using `expression` evaluation. In this 
initial version, frame variable paths will be handled with `expression`.

Following this, there are a number of improvements that can be made. Some 
improvements include supporting `frame variable` expressions or registers.

To provide transparency, especially as the `dwim-print` command evolves, a new 
setting is also introduced: `dwim-print-verbosity`. This setting instructs 
`dwim-print` optionally to print a message showing the effective command being 
run. For example `dwim-print var.meth()` can print a message such as: "note: 
ran `expression var.meth()`.

See https://discourse.llvm.org/t/dwim-print-command/66078 for the proposal and 
discussion.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D138315

Files:
  lldb/include/lldb/Core/Debugger.h
  lldb/include/lldb/lldb-enumerations.h
  lldb/source/Commands/CMakeLists.txt
  lldb/source/Commands/CommandObjectDWIMPrint.cpp
  lldb/source/Commands/CommandObjectDWIMPrint.h
  lldb/source/Core/CoreProperties.td
  lldb/source/Core/Debugger.cpp
  lldb/source/Interpreter/CommandInterpreter.cpp
  lldb/test/API/commands/dwim-print/Makefile
  lldb/test/API/commands/dwim-print/TestDWIMPrint.py
  lldb/test/API/commands/dwim-print/main.c

Index: lldb/test/API/commands/dwim-print/main.c
===
--- /dev/null
+++ lldb/test/API/commands/dwim-print/main.c
@@ -0,0 +1,3 @@
+int main(int argc, char **argv) {
+  return 0;
+}
Index: lldb/test/API/commands/dwim-print/TestDWIMPrint.py
===
--- /dev/null
+++ lldb/test/API/commands/dwim-print/TestDWIMPrint.py
@@ -0,0 +1,68 @@
+"""
+Test dwim-print with variables, variable paths, and expressions.
+"""
+
+import re
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+import lldbsuite.test.lldbutil as lldbutil
+
+
+class TestCase(TestBase):
+def setUp(self):
+TestBase.setUp(self)
+self.build()
+lldbutil.run_to_name_breakpoint(self, "main")
+
+def _run_cmd(self, cmd: str) -> str:
+"""Run the given lldb command and return its output."""
+result = lldb.SBCommandReturnObject()
+self.ci.HandleCommand(cmd, result)
+return result.GetOutput().rstrip()
+
+PERSISTENT_VAR = re.compile(r"\$\d+")
+
+def _mask_persistent_var(self, string: str) -> str:
+"""
+Replace persistent result variables (ex '$0', '$1', etc) with a regex
+that matches any persistent result (r'\$\d+'). The returned string can
+be matched against other `expression` results.
+"""
+before, after = self.PERSISTENT_VAR.split(string, maxsplit=1)
+return re.escape(before) + r"\$\d+" + re.escape(after)
+
+def _expect_cmd(self, expr: str, base_cmd: str) -> None:
+"""Run dwim-print and verify the output against the expected command."""
+cmd = f"{base_cmd} {expr}"
+cmd_output = self._run_cmd(cmd)
+
+# Verify dwim-print chose the expected command.
+self.runCmd("settings set dwim-print-verbosity full")
+substrs = [f"note: ran `{cmd}`"]
+patterns = []
+
+if base_cmd == "expression" and self.PERSISTENT_VAR.search(cmd_output):
+patterns.append(self._mask_persistent_var(cmd_output))
+else:
+substrs.append(cmd_output)
+
+self.expect(f"dwim-print {expr}", substrs=substrs, patterns=patterns)
+
+def test_variables(self):
+"""Test dwim-print with variables."""
+vars = ("argc", "argv")
+for var in vars:
+self._expect_cmd(var, "frame variable")
+
+def test_variable_paths(self):
+"""Test dwim-print with variable path expressions."""
+exprs = ("&argc", "*argv", "argv[0]")
+for e

[Lldb-commits] [PATCH] D138315: [lldb] Introduce dwim-print command

2022-11-18 Thread Arthur Eubanks via Phabricator via lldb-commits
aeubanks added inline comments.



Comment at: lldb/source/Commands/CommandObjectDWIMPrint.h:1
+#include "lldb/Interpreter/CommandObject.h"
+

license?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138315

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


[Lldb-commits] [PATCH] D138315: [lldb] Introduce dwim-print command

2022-11-18 Thread Dave Lee via Phabricator via lldb-commits
kastiglione updated this revision to Diff 476549.
kastiglione added a comment.

Add license.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138315

Files:
  lldb/include/lldb/Core/Debugger.h
  lldb/include/lldb/lldb-enumerations.h
  lldb/source/Commands/CMakeLists.txt
  lldb/source/Commands/CommandObjectDWIMPrint.cpp
  lldb/source/Commands/CommandObjectDWIMPrint.h
  lldb/source/Core/CoreProperties.td
  lldb/source/Core/Debugger.cpp
  lldb/source/Interpreter/CommandInterpreter.cpp
  lldb/test/API/commands/dwim-print/Makefile
  lldb/test/API/commands/dwim-print/TestDWIMPrint.py
  lldb/test/API/commands/dwim-print/main.c

Index: lldb/test/API/commands/dwim-print/main.c
===
--- /dev/null
+++ lldb/test/API/commands/dwim-print/main.c
@@ -0,0 +1,3 @@
+int main(int argc, char **argv) {
+  return 0;
+}
Index: lldb/test/API/commands/dwim-print/TestDWIMPrint.py
===
--- /dev/null
+++ lldb/test/API/commands/dwim-print/TestDWIMPrint.py
@@ -0,0 +1,68 @@
+"""
+Test dwim-print with variables, variable paths, and expressions.
+"""
+
+import re
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+import lldbsuite.test.lldbutil as lldbutil
+
+
+class TestCase(TestBase):
+def setUp(self):
+TestBase.setUp(self)
+self.build()
+lldbutil.run_to_name_breakpoint(self, "main")
+
+def _run_cmd(self, cmd: str) -> str:
+"""Run the given lldb command and return its output."""
+result = lldb.SBCommandReturnObject()
+self.ci.HandleCommand(cmd, result)
+return result.GetOutput().rstrip()
+
+PERSISTENT_VAR = re.compile(r"\$\d+")
+
+def _mask_persistent_var(self, string: str) -> str:
+"""
+Replace persistent result variables (ex '$0', '$1', etc) with a regex
+that matches any persistent result (r'\$\d+'). The returned string can
+be matched against other `expression` results.
+"""
+before, after = self.PERSISTENT_VAR.split(string, maxsplit=1)
+return re.escape(before) + r"\$\d+" + re.escape(after)
+
+def _expect_cmd(self, expr: str, base_cmd: str) -> None:
+"""Run dwim-print and verify the output against the expected command."""
+cmd = f"{base_cmd} {expr}"
+cmd_output = self._run_cmd(cmd)
+
+# Verify dwim-print chose the expected command.
+self.runCmd("settings set dwim-print-verbosity full")
+substrs = [f"note: ran `{cmd}`"]
+patterns = []
+
+if base_cmd == "expression" and self.PERSISTENT_VAR.search(cmd_output):
+patterns.append(self._mask_persistent_var(cmd_output))
+else:
+substrs.append(cmd_output)
+
+self.expect(f"dwim-print {expr}", substrs=substrs, patterns=patterns)
+
+def test_variables(self):
+"""Test dwim-print with variables."""
+vars = ("argc", "argv")
+for var in vars:
+self._expect_cmd(var, "frame variable")
+
+def test_variable_paths(self):
+"""Test dwim-print with variable path expressions."""
+exprs = ("&argc", "*argv", "argv[0]")
+for expr in exprs:
+self._expect_cmd(expr, "expression")
+
+def test_expressions(self):
+"""Test dwim-print with expressions."""
+exprs = ("argc + 1", "(void)argc", "(int)abs(argc)")
+for expr in exprs:
+self._expect_cmd(expr, "expression")
Index: lldb/test/API/commands/dwim-print/Makefile
===
--- /dev/null
+++ lldb/test/API/commands/dwim-print/Makefile
@@ -0,0 +1,3 @@
+C_SOURCES := main.c
+
+include Makefile.rules
Index: lldb/source/Interpreter/CommandInterpreter.cpp
===
--- lldb/source/Interpreter/CommandInterpreter.cpp
+++ lldb/source/Interpreter/CommandInterpreter.cpp
@@ -15,6 +15,7 @@
 #include "Commands/CommandObjectApropos.h"
 #include "Commands/CommandObjectBreakpoint.h"
 #include "Commands/CommandObjectCommands.h"
+#include "Commands/CommandObjectDWIMPrint.h"
 #include "Commands/CommandObjectDiagnostics.h"
 #include "Commands/CommandObjectDisassemble.h"
 #include "Commands/CommandObjectExpression.h"
@@ -532,6 +533,7 @@
   REGISTER_COMMAND_OBJECT("command", CommandObjectMultiwordCommands);
   REGISTER_COMMAND_OBJECT("diagnostics", CommandObjectDiagnostics);
   REGISTER_COMMAND_OBJECT("disassemble", CommandObjectDisassemble);
+  REGISTER_COMMAND_OBJECT("dwim-print", CommandObjectDWIMPrint);
   REGISTER_COMMAND_OBJECT("expression", CommandObjectExpression);
   REGISTER_COMMAND_OBJECT("frame", CommandObjectMultiwordFrame);
   REGISTER_COMMAND_OBJECT("gui", CommandObjectGUI);
Index: lldb/source/Core/Debugger.cpp
===

[Lldb-commits] [PATCH] D138315: [lldb] Introduce dwim-print command

2022-11-18 Thread Dave Lee via Phabricator via lldb-commits
kastiglione updated this revision to Diff 476550.
kastiglione added a comment.

Add license in .cpp too.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138315

Files:
  lldb/include/lldb/Core/Debugger.h
  lldb/include/lldb/lldb-enumerations.h
  lldb/source/Commands/CMakeLists.txt
  lldb/source/Commands/CommandObjectDWIMPrint.cpp
  lldb/source/Commands/CommandObjectDWIMPrint.h
  lldb/source/Core/CoreProperties.td
  lldb/source/Core/Debugger.cpp
  lldb/source/Interpreter/CommandInterpreter.cpp
  lldb/test/API/commands/dwim-print/Makefile
  lldb/test/API/commands/dwim-print/TestDWIMPrint.py
  lldb/test/API/commands/dwim-print/main.c

Index: lldb/test/API/commands/dwim-print/main.c
===
--- /dev/null
+++ lldb/test/API/commands/dwim-print/main.c
@@ -0,0 +1,3 @@
+int main(int argc, char **argv) {
+  return 0;
+}
Index: lldb/test/API/commands/dwim-print/TestDWIMPrint.py
===
--- /dev/null
+++ lldb/test/API/commands/dwim-print/TestDWIMPrint.py
@@ -0,0 +1,68 @@
+"""
+Test dwim-print with variables, variable paths, and expressions.
+"""
+
+import re
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+import lldbsuite.test.lldbutil as lldbutil
+
+
+class TestCase(TestBase):
+def setUp(self):
+TestBase.setUp(self)
+self.build()
+lldbutil.run_to_name_breakpoint(self, "main")
+
+def _run_cmd(self, cmd: str) -> str:
+"""Run the given lldb command and return its output."""
+result = lldb.SBCommandReturnObject()
+self.ci.HandleCommand(cmd, result)
+return result.GetOutput().rstrip()
+
+PERSISTENT_VAR = re.compile(r"\$\d+")
+
+def _mask_persistent_var(self, string: str) -> str:
+"""
+Replace persistent result variables (ex '$0', '$1', etc) with a regex
+that matches any persistent result (r'\$\d+'). The returned string can
+be matched against other `expression` results.
+"""
+before, after = self.PERSISTENT_VAR.split(string, maxsplit=1)
+return re.escape(before) + r"\$\d+" + re.escape(after)
+
+def _expect_cmd(self, expr: str, base_cmd: str) -> None:
+"""Run dwim-print and verify the output against the expected command."""
+cmd = f"{base_cmd} {expr}"
+cmd_output = self._run_cmd(cmd)
+
+# Verify dwim-print chose the expected command.
+self.runCmd("settings set dwim-print-verbosity full")
+substrs = [f"note: ran `{cmd}`"]
+patterns = []
+
+if base_cmd == "expression" and self.PERSISTENT_VAR.search(cmd_output):
+patterns.append(self._mask_persistent_var(cmd_output))
+else:
+substrs.append(cmd_output)
+
+self.expect(f"dwim-print {expr}", substrs=substrs, patterns=patterns)
+
+def test_variables(self):
+"""Test dwim-print with variables."""
+vars = ("argc", "argv")
+for var in vars:
+self._expect_cmd(var, "frame variable")
+
+def test_variable_paths(self):
+"""Test dwim-print with variable path expressions."""
+exprs = ("&argc", "*argv", "argv[0]")
+for expr in exprs:
+self._expect_cmd(expr, "expression")
+
+def test_expressions(self):
+"""Test dwim-print with expressions."""
+exprs = ("argc + 1", "(void)argc", "(int)abs(argc)")
+for expr in exprs:
+self._expect_cmd(expr, "expression")
Index: lldb/test/API/commands/dwim-print/Makefile
===
--- /dev/null
+++ lldb/test/API/commands/dwim-print/Makefile
@@ -0,0 +1,3 @@
+C_SOURCES := main.c
+
+include Makefile.rules
Index: lldb/source/Interpreter/CommandInterpreter.cpp
===
--- lldb/source/Interpreter/CommandInterpreter.cpp
+++ lldb/source/Interpreter/CommandInterpreter.cpp
@@ -15,6 +15,7 @@
 #include "Commands/CommandObjectApropos.h"
 #include "Commands/CommandObjectBreakpoint.h"
 #include "Commands/CommandObjectCommands.h"
+#include "Commands/CommandObjectDWIMPrint.h"
 #include "Commands/CommandObjectDiagnostics.h"
 #include "Commands/CommandObjectDisassemble.h"
 #include "Commands/CommandObjectExpression.h"
@@ -532,6 +533,7 @@
   REGISTER_COMMAND_OBJECT("command", CommandObjectMultiwordCommands);
   REGISTER_COMMAND_OBJECT("diagnostics", CommandObjectDiagnostics);
   REGISTER_COMMAND_OBJECT("disassemble", CommandObjectDisassemble);
+  REGISTER_COMMAND_OBJECT("dwim-print", CommandObjectDWIMPrint);
   REGISTER_COMMAND_OBJECT("expression", CommandObjectExpression);
   REGISTER_COMMAND_OBJECT("frame", CommandObjectMultiwordFrame);
   REGISTER_COMMAND_OBJECT("gui", CommandObjectGUI);
Index: lldb/source/Core/Debugger.cpp
===

[Lldb-commits] [PATCH] D137983: [lldb] Disable looking at pointee types to find synthetic value for non-ObjC

2022-11-18 Thread Arthur Eubanks via Phabricator via lldb-commits
aeubanks added a comment.

would somebody be willing to lgtm the workaround while we investigate further 
since this is currently breaking a fairly typical debugging session?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137983

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


[Lldb-commits] [lldb] 288843a - [lldb/Python] Make use of PythonObject and PythonFormat in callbacks (NFC)

2022-11-18 Thread Med Ismail Bennani via lldb-commits

Author: Med Ismail Bennani
Date: 2022-11-18T13:56:48-08:00
New Revision: 288843a161f71148d7028e5153038006dd87e363

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

LOG: [lldb/Python] Make use of PythonObject and PythonFormat in callbacks (NFC)

This patch extends the template specialization of PythonFormat structs
and makes use of the pre-existing PythonObject class to format arguments
and pass them to the right method, before calling it.

This is a preparatory patch to merge PythonFormat with SWIGPythonBridge's
GetPythonValueFormatString methods.

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

Signed-off-by: Med Ismail Bennani 

Added: 


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

Removed: 




diff  --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h 
b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
index 76ad47f2907e6..365d499bead86 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
@@ -185,22 +185,34 @@ inline const char *py2_const_cast(const char *s) { return 
s; }
 
 enum class PyInitialValue { Invalid, Empty };
 
+// DOC: https://docs.python.org/3/c-api/arg.html#building-values
 template  struct PythonFormat;
 
-template <> struct PythonFormat {
-  static constexpr char format = 'K';
-  static auto get(unsigned long long value) { return value; }
+template  struct PassthroughFormat {
+  static constexpr char format = F;
+  static constexpr T get(T t) { return t; }
 };
 
-template <> struct PythonFormat {
-  static constexpr char format = 'L';
-  static auto get(long long value) { return value; }
-};
-
-template <> struct PythonFormat {
-  static constexpr char format = 'O';
-  static auto get(PyObject *value) { return value; }
-};
+template <> struct PythonFormat : PassthroughFormat {};
+template <> struct PythonFormat : PassthroughFormat {};
+template <>
+struct PythonFormat : PassthroughFormat {};
+template <> struct PythonFormat : PassthroughFormat {};
+template <>
+struct PythonFormat : PassthroughFormat 
{};
+template <> struct PythonFormat : PassthroughFormat {};
+template <>
+struct PythonFormat : PassthroughFormat {};
+template <> struct PythonFormat : PassthroughFormat {};
+template <>
+struct PythonFormat : PassthroughFormat {};
+template <>
+struct PythonFormat : PassthroughFormat {};
+template <>
+struct PythonFormat
+: PassthroughFormat {};
+template <>
+struct PythonFormat : PassthroughFormat {};
 
 template 
 struct PythonFormat<

diff  --git 
a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp 
b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
index 37e3c94df870a..810c77925f5b7 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -1501,50 +1501,29 @@ StructuredData::DictionarySP 
ScriptInterpreterPythonImpl::OSPlugin_RegisterInfo(
 StructuredData::ObjectSP os_plugin_object_sp) {
   Locker py_lock(this, Locker::AcquireLock | Locker::NoSTDIN, 
Locker::FreeLock);
 
-  static char callee_name[] = "get_register_info";
-
   if (!os_plugin_object_sp)
-return StructuredData::DictionarySP();
+return {};
 
   StructuredData::Generic *generic = os_plugin_object_sp->GetAsGeneric();
   if (!generic)
-return nullptr;
+return {};
 
   PythonObject implementor(PyRefType::Borrowed,
(PyObject *)generic->GetValue());
 
   if (!implementor.IsAllocated())
-return StructuredData::DictionarySP();
-
-  PythonObject pmeth(PyRefType::Owned,
- PyObject_GetAttrString(implementor.get(), callee_name));
-
-  if (PyErr_Occurred())
-PyErr_Clear();
-
-  if (!pmeth.IsAllocated())
-return StructuredData::DictionarySP();
+return {};
 
-  if (PyCallable_Check(pmeth.get()) == 0) {
-if (PyErr_Occurred())
-  PyErr_Clear();
+  llvm::Expected expected_py_return =
+  implementor.CallMethod("get_register_info");
 
-return StructuredData::DictionarySP();
+  if (!expected_py_return) {
+llvm::consumeError(expected_py_return.takeError());
+return {};
   }
 
-  if (PyErr_Occurred())
-PyErr_Clear();
-
-  // right now we know this function exists and is callable..
-  PythonObject py_return(
-  PyRefType::Owned,
-  PyObject_CallMethod(implementor.get(), callee_name, nullptr));
+  PythonObject py_return = std::move(expected_py_return.get());
 
-  // if it fails, print the error but otherwise go on
-  if (PyErr_Occurred()) {
-PyErr_Print();
-PyErr_Clear();
-  }
   if 

[Lldb-commits] [lldb] 7e01924 - [lldb/Plugins] Improve error reporting with reading memory in Scripted Process

2022-11-18 Thread Med Ismail Bennani via lldb-commits

Author: Med Ismail Bennani
Date: 2022-11-18T13:56:48-08:00
New Revision: 7e01924e4e5634a6fa7d500574aeca58c8f36873

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

LOG: [lldb/Plugins] Improve error reporting with reading memory in Scripted 
Process

This patch improves the ScriptedPythonInterface::Dispatch method to
support passing lldb_private types to the python implementation.

This will allow, for instance, the Scripted Process python implementation
to report errors when reading memory back to lldb.

To do so, the Dispatch method will transform the private types in the
parameter pack into `PythonObject`s to be able to pass them down to the
python methods.

Then, if the call succeeded, the transformed arguments will be converted
back to their original type and re-assigned in the parameter pack, to
ensure pointers and references behaviours are preserved.

This patch also updates various scripted process python class and tests
to reflect this change.

rdar://100030995

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

Signed-off-by: Med Ismail Bennani 

Added: 


Modified: 
lldb/bindings/python/python-swigsafecast.swig
lldb/examples/python/scripted_process/crashlog_scripted_process.py
lldb/examples/python/scripted_process/scripted_process.py
lldb/include/lldb/API/SBError.h
lldb/source/API/SBError.cpp
lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h

lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp
lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp
lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h
lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
lldb/test/API/functionalities/scripted_process/dummy_scripted_process.py
lldb/test/API/functionalities/scripted_process/invalid_scripted_process.py

lldb/test/API/functionalities/scripted_process/stack_core_scripted_process.py
lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp

Removed: 




diff  --git a/lldb/bindings/python/python-swigsafecast.swig 
b/lldb/bindings/python/python-swigsafecast.swig
index aa5e8e50a2d92..a1e883b3b19d5 100644
--- a/lldb/bindings/python/python-swigsafecast.swig
+++ b/lldb/bindings/python/python-swigsafecast.swig
@@ -5,28 +5,6 @@ PythonObject ToSWIGHelper(void *obj, swig_type_info *info) {
   return {PyRefType::Owned, SWIG_NewPointerObj(obj, info, SWIG_POINTER_OWN)};
 }
 
-/// A class that automatically clears an SB object when it goes out of scope.
-/// Use for cases where the SB object points to a temporary/unowned entity.
-template  class ScopedPythonObject : PythonObject {
-public:
-  ScopedPythonObject(T *sb, swig_type_info *info)
-  : PythonObject(ToSWIGHelper(sb, info)), m_sb(sb) {}
-  ~ScopedPythonObject() {
-if (m_sb)
-  *m_sb = T();
-  }
-  ScopedPythonObject(ScopedPythonObject &&rhs)
-  : PythonObject(std::move(rhs)), m_sb(std::exchange(rhs.m_sb, nullptr)) {}
-  ScopedPythonObject(const ScopedPythonObject &) = delete;
-  ScopedPythonObject &operator=(const ScopedPythonObject &) = delete;
-  ScopedPythonObject &operator=(ScopedPythonObject &&) = delete;
-
-  const PythonObject &obj() const { return *this; }
-
-private:
-  T *m_sb;
-};
-
 PythonObject ToSWIGWrapper(std::unique_ptr value_sb) {
   return ToSWIGHelper(value_sb.release(), SWIGTYPE_p_lldb__SBValue);
 }
@@ -55,6 +33,10 @@ PythonObject ToSWIGWrapper(lldb::BreakpointSP breakpoint_sp) 
{
   SWIGTYPE_p_lldb__SBBreakpoint);
 }
 
+PythonObject ToSWIGWrapper(const Status& status) {
+  return ToSWIGHelper(new lldb::SBError(status), SWIGTYPE_p_lldb__SBError);
+}
+
 PythonObject ToSWIGWrapper(std::unique_ptr stream_sb) {
   return ToSWIGHelper(stream_sb.release(), SWIGTYPE_p_lldb__SBStream);
 }

diff  --git 
a/lldb/examples/python/scripted_process/crashlog_scripted_process.py 
b/lldb/examples/python/scripted_process/crashlog_scripted_process.py
index 7ed5cc930da72..71cfff2ac5b03 100644
--- a/lldb/examples/python/scripted_process/crashlog_scripted_process.py
+++ b/lldb/examples/python/scripted_process/crashlog_scripted_process.py
@@ -103,7 +103,7 @@ def get_thread_with_id(self, tid: int):
 def get_registers_for_thread(self, tid: int):
 return {}
 
-def read_memory_at_address(self, addr: int, size: int) -> lldb.SBData:
+def read_memory_at_address(self, addr: int, size: int, error: 
lldb.SBError) -> lldb.SBData:
 # NOTE: CrashLogs don't contain any memory.
 return lldb.SBData()
 

diff  --git a/lldb/examples/python/scripted_process/scripted_process.py 
b/lldb/examples/python/scripted_process/scripted_process.py
index 86ec1db893a27..cc886c6ff467e 100644
--- a/lldb/examples/python/scripted_process/scripted_p

[Lldb-commits] [lldb] 27a26e7 - [lldb/Python] Unify PythonFormat & GetPythonValueFormatString (NFC)

2022-11-18 Thread Med Ismail Bennani via lldb-commits

Author: Med Ismail Bennani
Date: 2022-11-18T13:56:48-08:00
New Revision: 27a26e7ab7d8a8b47c63f68bd1801fc2f9342637

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

LOG: [lldb/Python] Unify PythonFormat & GetPythonValueFormatString (NFC)

This patch removes all occurences to GetPythonValueFormatString and
use the template specialization of PythonFormat structs instead.

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

Signed-off-by: Med Ismail Bennani 

Added: 


Modified: 
lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h

Removed: 
lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.cpp



diff  --git a/lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt 
b/lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
index ed62a692a2fb..f828796b326e 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
@@ -20,7 +20,6 @@ add_lldb_library(lldbPluginScriptInterpreterPython PLUGIN
   ScriptedPythonInterface.cpp
   ScriptedProcessPythonInterface.cpp
   ScriptedThreadPythonInterface.cpp
-  SWIGPythonBridge.cpp
 
   LINK_LIBS
 lldbBreakpoint

diff  --git a/lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.cpp 
b/lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.cpp
deleted file mode 100644
index 7c7c5d73680a..
--- a/lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-//===-- SWIGPythonBridge.cpp 
--===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-
-#include "lldb/Host/Config.h"
-#include "lldb/lldb-enumerations.h"
-
-#if LLDB_ENABLE_PYTHON
-
-// LLDB Python header must be included first
-#include "lldb-python.h"
-
-#include "SWIGPythonBridge.h"
-
-using namespace lldb;
-
-namespace lldb_private {
-
-template  const char *GetPythonValueFormatString(T t);
-template <> const char *GetPythonValueFormatString(char *) { return "s"; }
-template <> const char *GetPythonValueFormatString(char) { return "b"; }
-template <> const char *GetPythonValueFormatString(unsigned char) {
-  return "B";
-}
-template <> const char *GetPythonValueFormatString(short) { return "h"; }
-template <> const char *GetPythonValueFormatString(unsigned short) {
-  return "H";
-}
-template <> const char *GetPythonValueFormatString(int) { return "i"; }
-template <> const char *GetPythonValueFormatString(unsigned int) { return "I"; 
}
-template <> const char *GetPythonValueFormatString(long) { return "l"; }
-template <> const char *GetPythonValueFormatString(unsigned long) {
-  return "k";
-}
-template <> const char *GetPythonValueFormatString(long long) { return "L"; }
-template <> const char *GetPythonValueFormatString(unsigned long long) {
-  return "K";
-}
-template <> const char *GetPythonValueFormatString(float) { return "f"; }
-template <> const char *GetPythonValueFormatString(double) { return "d"; }
-
-} // namespace lldb_private
-
-#endif // LLDB_ENABLE_PYTHON

diff  --git a/lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h 
b/lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h
index 30634c8e96f4..6ee645024ed7 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h
@@ -86,27 +86,6 @@ python::ScopedPythonObject 
ToSWIGWrapper(Event *event);
 
 } // namespace python
 
-// GetPythonValueFormatString provides a system independent type safe way to
-// convert a variable's type into a python value format. Python value formats
-// are defined in terms of builtin C types and could change from system to as
-// the underlying typedef for uint* types, size_t, off_t and other values
-// change.
-
-template  const char *GetPythonValueFormatString(T t);
-template <> const char *GetPythonValueFormatString(char *);
-template <> const char *GetPythonValueFormatString(char);
-template <> const char *GetPythonValueFormatString(unsigned char);
-template <> const char *GetPythonValueFormatString(short);
-template <> const char *GetPythonValueFormatString(unsigned short);
-template <> const char *GetPythonValueFormatString(int);
-template <> const char *GetPythonValueFormatString(unsigned int);
-template <> const char *GetPythonValueFormatString(long);
-template <> const char *GetPythonValueFormatString(unsigned long);
-template <> const char *GetPythonValu

[Lldb-commits] [PATCH] D134033: [lldb/Plugins] Improve error reporting when reading memory in Scripted Process

2022-11-18 Thread Med Ismail Bennani via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
mib marked an inline comment as done.
Closed by commit rG7e01924e4e56: [lldb/Plugins] Improve error reporting with 
reading memory in Scripted Process (authored by mib).

Changed prior to commit:
  https://reviews.llvm.org/D134033?vs=476299&id=476598#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134033

Files:
  lldb/bindings/python/python-swigsafecast.swig
  lldb/examples/python/scripted_process/crashlog_scripted_process.py
  lldb/examples/python/scripted_process/scripted_process.py
  lldb/include/lldb/API/SBError.h
  lldb/source/API/SBError.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h
  
lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h
  lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
  lldb/test/API/functionalities/scripted_process/dummy_scripted_process.py
  lldb/test/API/functionalities/scripted_process/invalid_scripted_process.py
  lldb/test/API/functionalities/scripted_process/stack_core_scripted_process.py
  lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp

Index: lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
===
--- lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
+++ lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
@@ -270,3 +270,7 @@
 lldb::StreamSP stream) {
   return false;
 }
+
+python::PythonObject lldb_private::python::ToSWIGWrapper(const Status &status) {
+  return python::PythonObject();
+}
Index: lldb/test/API/functionalities/scripted_process/stack_core_scripted_process.py
===
--- lldb/test/API/functionalities/scripted_process/stack_core_scripted_process.py
+++ lldb/test/API/functionalities/scripted_process/stack_core_scripted_process.py
@@ -65,9 +65,8 @@
 def get_registers_for_thread(self, tid: int):
 return {}
 
-def read_memory_at_address(self, addr: int, size: int) -> lldb.SBData:
+def read_memory_at_address(self, addr: int, size: int, error: lldb.SBError) -> lldb.SBData:
 data = lldb.SBData()
-error = lldb.SBError()
 bytes_read = self.corefile_process.ReadMemory(addr, size, error)
 
 if error.Fail():
Index: lldb/test/API/functionalities/scripted_process/invalid_scripted_process.py
===
--- lldb/test/API/functionalities/scripted_process/invalid_scripted_process.py
+++ lldb/test/API/functionalities/scripted_process/invalid_scripted_process.py
@@ -20,8 +20,9 @@
 def get_registers_for_thread(self, tid: int):
 return {}
 
-def read_memory_at_address(self, addr: int, size: int) -> lldb.SBData:
-return None
+def read_memory_at_address(self, addr: int, size: int, error: lldb.SBError) -> lldb.SBData:
+error.SetErrorString("This is an invalid scripted process!")
+return lldb.SBData()
 
 def get_loaded_images(self):
 return self.loaded_images
Index: lldb/test/API/functionalities/scripted_process/dummy_scripted_process.py
===
--- lldb/test/API/functionalities/scripted_process/dummy_scripted_process.py
+++ lldb/test/API/functionalities/scripted_process/dummy_scripted_process.py
@@ -20,11 +20,12 @@
 def get_registers_for_thread(self, tid: int):
 return {}
 
-def read_memory_at_address(self, addr: int, size: int) -> lldb.SBData:
+def read_memory_at_address(self, addr: int, size: int, error: lldb.SBError) -> lldb.SBData:
 data = lldb.SBData().CreateDataFromCString(
 self.target.GetByteOrder(),
 self.target.GetCodeByteSize(),
 "Hello, world!")
+
 return data
 
 def get_loaded_images(self):
Index: lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
===
--- lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
+++ lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
@@ -77,6 +77,12 @@
 self.assertEqual(process.GetProcessID(), 666)
 self.assertEqual(process.GetNumThreads(), 0)
 
+addr = 0x5
+buff = process.ReadMemory(addr, 4, error)
+self.assertEqual(buff, None)
+self.assertTrue(error.Fail())
+self.assertEqual(error.GetCString(), "This is an invalid scripted process!")
+
 with open(log_file, 'r') as f:
 log = f.read()
 
@@ -109,9 +115,14 @@
 process = target.Launch

[Lldb-commits] [PATCH] D138248: [lldb/Python] Make use of PythonObject and PythonFormat in callbacks (NFC)

2022-11-18 Thread Med Ismail Bennani via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG288843a161f7: [lldb/Python] Make use of PythonObject and 
PythonFormat in callbacks (NFC) (authored by mib).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138248

Files:
  lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp

Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -1501,50 +1501,29 @@
 StructuredData::ObjectSP os_plugin_object_sp) {
   Locker py_lock(this, Locker::AcquireLock | Locker::NoSTDIN, Locker::FreeLock);
 
-  static char callee_name[] = "get_register_info";
-
   if (!os_plugin_object_sp)
-return StructuredData::DictionarySP();
+return {};
 
   StructuredData::Generic *generic = os_plugin_object_sp->GetAsGeneric();
   if (!generic)
-return nullptr;
+return {};
 
   PythonObject implementor(PyRefType::Borrowed,
(PyObject *)generic->GetValue());
 
   if (!implementor.IsAllocated())
-return StructuredData::DictionarySP();
-
-  PythonObject pmeth(PyRefType::Owned,
- PyObject_GetAttrString(implementor.get(), callee_name));
-
-  if (PyErr_Occurred())
-PyErr_Clear();
-
-  if (!pmeth.IsAllocated())
-return StructuredData::DictionarySP();
+return {};
 
-  if (PyCallable_Check(pmeth.get()) == 0) {
-if (PyErr_Occurred())
-  PyErr_Clear();
+  llvm::Expected expected_py_return =
+  implementor.CallMethod("get_register_info");
 
-return StructuredData::DictionarySP();
+  if (!expected_py_return) {
+llvm::consumeError(expected_py_return.takeError());
+return {};
   }
 
-  if (PyErr_Occurred())
-PyErr_Clear();
-
-  // right now we know this function exists and is callable..
-  PythonObject py_return(
-  PyRefType::Owned,
-  PyObject_CallMethod(implementor.get(), callee_name, nullptr));
+  PythonObject py_return = std::move(expected_py_return.get());
 
-  // if it fails, print the error but otherwise go on
-  if (PyErr_Occurred()) {
-PyErr_Print();
-PyErr_Clear();
-  }
   if (py_return.get()) {
 PythonDictionary result_dict(PyRefType::Borrowed, py_return.get());
 return result_dict.CreateStructuredDictionary();
@@ -1555,51 +1534,28 @@
 StructuredData::ArraySP ScriptInterpreterPythonImpl::OSPlugin_ThreadsInfo(
 StructuredData::ObjectSP os_plugin_object_sp) {
   Locker py_lock(this, Locker::AcquireLock | Locker::NoSTDIN, Locker::FreeLock);
-
-  static char callee_name[] = "get_thread_info";
-
   if (!os_plugin_object_sp)
-return StructuredData::ArraySP();
+return {};
 
   StructuredData::Generic *generic = os_plugin_object_sp->GetAsGeneric();
   if (!generic)
-return nullptr;
+return {};
 
   PythonObject implementor(PyRefType::Borrowed,
(PyObject *)generic->GetValue());
 
   if (!implementor.IsAllocated())
-return StructuredData::ArraySP();
-
-  PythonObject pmeth(PyRefType::Owned,
- PyObject_GetAttrString(implementor.get(), callee_name));
-
-  if (PyErr_Occurred())
-PyErr_Clear();
-
-  if (!pmeth.IsAllocated())
-return StructuredData::ArraySP();
+return {};
 
-  if (PyCallable_Check(pmeth.get()) == 0) {
-if (PyErr_Occurred())
-  PyErr_Clear();
+  llvm::Expected expected_py_return =
+  implementor.CallMethod("get_thread_info");
 
-return StructuredData::ArraySP();
+  if (!expected_py_return) {
+llvm::consumeError(expected_py_return.takeError());
+return {};
   }
 
-  if (PyErr_Occurred())
-PyErr_Clear();
-
-  // right now we know this function exists and is callable..
-  PythonObject py_return(
-  PyRefType::Owned,
-  PyObject_CallMethod(implementor.get(), callee_name, nullptr));
-
-  // if it fails, print the error but otherwise go on
-  if (PyErr_Occurred()) {
-PyErr_Print();
-PyErr_Clear();
-  }
+  PythonObject py_return = std::move(expected_py_return.get());
 
   if (py_return.get()) {
 PythonList result_list(PyRefType::Borrowed, py_return.get());
@@ -1613,56 +1569,33 @@
 StructuredData::ObjectSP os_plugin_object_sp, lldb::tid_t tid) {
   Locker py_lock(this, Locker::AcquireLock | Locker::NoSTDIN, Locker::FreeLock);
 
-  static char callee_name[] = "get_register_data";
-  static char *param_format =
-  const_cast(GetPythonValueFormatString(tid));
-
   if (!os_plugin_object_sp)
-return StructuredData::StringSP();
+return {};
 
   StructuredData::Generic *generic = os_plugin_object_sp->GetAsGeneric();
   if (!generic)
-return nullptr;
+return {};
   PythonObject implementor(PyRefType::Borrowed,
  

[Lldb-commits] [PATCH] D138259: Add the ability to see when a type in incomplete.

2022-11-18 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

The next step for this is to modify the 
ValueObject::MaybeCalculateCompleteType() to see if we get a type that has been 
forcefully completed and if it has, replace it with the real type. But that 
will require that Module::FindFirstType() works reliably and it currently 
doesn't (fix for this issue is in this patch: https://reviews.llvm.org/D137900).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138259

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


[Lldb-commits] [PATCH] D138344: [test][lldb-vscode] Relax assertion to allow multiple compile units returned.

2022-11-18 Thread Jordan Rupprecht via Phabricator via lldb-commits
rupprecht created this revision.
rupprecht added reviewers: wallace, clayborg.
Herald added a project: All.
rupprecht requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

I don't think the intent of this test is to make sure we only have one compile 
unit; it's to make sure request_compileUnits returns something sensible. Relax 
the test case to just make sure that the main source file is one of the compile 
units returned, even if there are others.

Fixes llvm.org/pr49418.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D138344

Files:
  lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py


Index: lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py
===
--- lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py
+++ lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py
@@ -73,7 +73,6 @@
 
 @skipIfWindows
 @skipIfRemote
-@expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr49418")
 def test_compile_units(self):
 program = self.getBuildArtifact("a.out")
 self.build_and_launch(program)
@@ -86,7 +85,5 @@
 moduleId = self.vscode.get_modules()['a.out']['id']
 response = self.vscode.request_compileUnits(moduleId)
 self.assertTrue(response['body'])
-self.assertEqual(len(response['body']['compileUnits']), 1,
-'Only one source file should exist')
-
self.assertEqual(response['body']['compileUnits'][0]['compileUnitPath'], 
main_source_path,
-'Real path to main.cpp matches')
+cu_paths = [cu['compileUnitPath'] for cu in 
response['body']['compileUnits']]
+self.assertIn(main_source_path, cu_paths, 'Real path to main.cpp 
matches')


Index: lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py
===
--- lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py
+++ lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py
@@ -73,7 +73,6 @@
 
 @skipIfWindows
 @skipIfRemote
-@expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr49418")
 def test_compile_units(self):
 program = self.getBuildArtifact("a.out")
 self.build_and_launch(program)
@@ -86,7 +85,5 @@
 moduleId = self.vscode.get_modules()['a.out']['id']
 response = self.vscode.request_compileUnits(moduleId)
 self.assertTrue(response['body'])
-self.assertEqual(len(response['body']['compileUnits']), 1,
-'Only one source file should exist')
-self.assertEqual(response['body']['compileUnits'][0]['compileUnitPath'], main_source_path,
-'Real path to main.cpp matches')
+cu_paths = [cu['compileUnitPath'] for cu in response['body']['compileUnits']]
+self.assertIn(main_source_path, cu_paths, 'Real path to main.cpp matches')
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D138345: [test][lldb-vscode] Un-realpath coreFile test.

2022-11-18 Thread Jordan Rupprecht via Phabricator via lldb-commits
rupprecht created this revision.
rupprecht added a reviewer: wallace.
Herald added a project: All.
rupprecht requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

TestVSCode_coreFile looks for an exe/core file in the same directory as the 
test. It first calls `realpath`, but I don't think it's necessary. Using 
`realpath` prevents this test from working when run as part of a build system 
that uses content-addressed-storage, i.e. all the files might all be symlinks 
in the same directory pointing to files in different directories elsewhere. If 
some amount of normalization is needed, maybe `os.path.normpath()` would be 
useful, although I wouldn't see why that's needed either.

(This is a fairly trivial patch, but I'm mailing it to see if there is a reason 
we need to keep `realpath`, and if so, if there's some other workaround we can 
do).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D138345

Files:
  lldb/test/API/tools/lldb-vscode/coreFile/TestVSCode_coreFile.py


Index: lldb/test/API/tools/lldb-vscode/coreFile/TestVSCode_coreFile.py
===
--- lldb/test/API/tools/lldb-vscode/coreFile/TestVSCode_coreFile.py
+++ lldb/test/API/tools/lldb-vscode/coreFile/TestVSCode_coreFile.py
@@ -17,7 +17,7 @@
 @skipIfRemote
 @skipIfLLVMTargetMissing("X86")
 def test_core_file(self):
-current_dir = os.path.dirname(os.path.realpath(__file__))
+current_dir = os.path.dirname(__file__)
 exe_file = os.path.join(current_dir, "linux-x86_64.out")
 core_file = os.path.join(current_dir, "linux-x86_64.core")
 
@@ -44,7 +44,7 @@
 @skipIfLLVMTargetMissing("X86")
 def test_core_file_source_mapping(self):
 ''' Test that sourceMap property is correctly applied when loading a 
core '''
-current_dir = os.path.dirname(os.path.realpath(__file__))
+current_dir = os.path.dirname(__file__)
 exe_file = os.path.join(current_dir, "linux-x86_64.out")
 core_file = os.path.join(current_dir, "linux-x86_64.core")
 


Index: lldb/test/API/tools/lldb-vscode/coreFile/TestVSCode_coreFile.py
===
--- lldb/test/API/tools/lldb-vscode/coreFile/TestVSCode_coreFile.py
+++ lldb/test/API/tools/lldb-vscode/coreFile/TestVSCode_coreFile.py
@@ -17,7 +17,7 @@
 @skipIfRemote
 @skipIfLLVMTargetMissing("X86")
 def test_core_file(self):
-current_dir = os.path.dirname(os.path.realpath(__file__))
+current_dir = os.path.dirname(__file__)
 exe_file = os.path.join(current_dir, "linux-x86_64.out")
 core_file = os.path.join(current_dir, "linux-x86_64.core")
 
@@ -44,7 +44,7 @@
 @skipIfLLVMTargetMissing("X86")
 def test_core_file_source_mapping(self):
 ''' Test that sourceMap property is correctly applied when loading a core '''
-current_dir = os.path.dirname(os.path.realpath(__file__))
+current_dir = os.path.dirname(__file__)
 exe_file = os.path.join(current_dir, "linux-x86_64.out")
 core_file = os.path.join(current_dir, "linux-x86_64.core")
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D137900: Make only one function that needs to be implemented when searching for types.

2022-11-18 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

I still have a few more questions about the interface design here. May main 
goal is to eliminate as much mutable state and objects being passed by 
reference as makes sense (and no more :-).
In that vain I'm trying to get rid of all Set...() methods and all places where 
we pass a mutable reference to something. The accumulating TypeMap may be a 
good example where that isn't possible, though I wonder how common global 
exhaustive searches are and if we usually wouldn't stop in most cases after we 
found the first match?

I appreciate splitting it up into

`FindTypes(match, results);`

My hope was for `match` to be completely immutable and passed by value (const 
reference if need be), so I wonder if the  m_searched_symbol_files dictionary 
shouldn't be part of the result object?
Are all the setters really necessary? Could we just have a bunch of static 
"create...()" members that instantiate an immutable search specification?

As far as the naming is concerned, what's currently called TypeMatch should 
maybe be called TypeQuery, since match seems to imply a result?

Why is FindFirstType a member of TypeMatch? I would have expected a function 
called FindFirstType to take a TypeMatch search specification as an argument?




Comment at: lldb/include/lldb/Symbol/CompilerDecl.h:93
+  void GetCompilerContext(
+  llvm::SmallVectorImpl &context) const;
+

Why can't this be a return value? The context objects are tiny.



Comment at: lldb/include/lldb/Symbol/CompilerDeclContext.h:66
+  void GetCompilerContext(
+  llvm::SmallVectorImpl &context) const;
+

same here



Comment at: lldb/include/lldb/Symbol/Type.h:185
+  /// context, false if this is normal type lookup.
+  TypeMatch(const llvm::ArrayRef &context,
+bool module_search);

An ArrayRef is meant to be passed by value.



Comment at: lldb/include/lldb/Symbol/Type.h:197
+
+  /// Check of a CompilerContext array from matching type from a symbol file
+  /// matches the \a m_context.

if?



Comment at: lldb/include/lldb/Symbol/Type.h:241
+  /// Add a language family to the list of languages that should produce a 
match.
+  void AddLanguage(lldb::LanguageType language);
+

Is this necessary, or could this be rolled into the constructor?



Comment at: lldb/include/lldb/Symbol/Type.h:306
+  /// more complete are are used when lookup up types in a clang module's debug
+  /// information.
+  bool m_module_search = false;

This sentence is missing at least one word. (I also don't quite understand the 
purpose of this flag)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137900

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


[Lldb-commits] [PATCH] D138348: [lldb] Fix SBFileSpec.fullpath

2022-11-18 Thread Dave Lee via Phabricator via lldb-commits
kastiglione created this revision.
kastiglione added reviewers: mib, labath.
Herald added a project: All.
kastiglione requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Reimplement of `SBFileSpec.fullpath` to (indirectly) use `FileSpec::GetPath`.

Instead of hardcoding a `/` separator, use `GetPath`. This makes use of the 
`FileSpec`'s internal style, which for example allows for backslash on Windows 
where required.

It's not obvious from looking at the source, but the `fullpath` property is 
implemented with `str`, which calls `GetDescription`, which in finally calls 
`GetPath`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D138348

Files:
  lldb/bindings/interface/SBFileSpec.i


Index: lldb/bindings/interface/SBFileSpec.i
===
--- lldb/bindings/interface/SBFileSpec.i
+++ lldb/bindings/interface/SBFileSpec.i
@@ -84,18 +84,7 @@
 
 #ifdef SWIGPYTHON
 %pythoncode %{
-def __get_fullpath__(self):
-spec_dir = self.GetDirectory()
-spec_file = self.GetFilename()
-if spec_dir and spec_file:
-return '%s/%s' % (spec_dir, spec_file)
-elif spec_dir:
-return spec_dir
-elif spec_file:
-return spec_file
-return None
-
-fullpath = property(__get_fullpath__, None, doc='''A read only 
property that returns the fullpath as a python string.''')
+fullpath = property(str, None, doc='''A read only property that 
returns the fullpath as a python string.''')
 basename = property(GetFilename, None, doc='''A read only property 
that returns the path basename as a python string.''')
 dirname = property(GetDirectory, None, doc='''A read only property 
that returns the path directory name as a python string.''')
 exists = property(Exists, None, doc='''A read only property that 
returns a boolean value that indicates if the file exists.''')


Index: lldb/bindings/interface/SBFileSpec.i
===
--- lldb/bindings/interface/SBFileSpec.i
+++ lldb/bindings/interface/SBFileSpec.i
@@ -84,18 +84,7 @@
 
 #ifdef SWIGPYTHON
 %pythoncode %{
-def __get_fullpath__(self):
-spec_dir = self.GetDirectory()
-spec_file = self.GetFilename()
-if spec_dir and spec_file:
-return '%s/%s' % (spec_dir, spec_file)
-elif spec_dir:
-return spec_dir
-elif spec_file:
-return spec_file
-return None
-
-fullpath = property(__get_fullpath__, None, doc='''A read only property that returns the fullpath as a python string.''')
+fullpath = property(str, None, doc='''A read only property that returns the fullpath as a python string.''')
 basename = property(GetFilename, None, doc='''A read only property that returns the path basename as a python string.''')
 dirname = property(GetDirectory, None, doc='''A read only property that returns the path directory name as a python string.''')
 exists = property(Exists, None, doc='''A read only property that returns a boolean value that indicates if the file exists.''')
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D133366: [lldb] Fix SBFileSpec.fullpath for Windows

2022-11-18 Thread Dave Lee via Phabricator via lldb-commits
kastiglione added a comment.

@labath thanks, I believe a more correct fix here 
https://reviews.llvm.org/D138348


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133366

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


[Lldb-commits] [PATCH] D138259: Add the ability to see when a type in incomplete.

2022-11-18 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added inline comments.



Comment at: lldb/include/lldb/API/SBType.h:212
+  /// Returns true for types that were incomplete in the debug information but
+  /// should have been a complete. When the debugger constructs types, we must
+  /// have enough information to reconstruct a type in a language specific AST

a complete? (missing word)



Comment at: lldb/include/lldb/API/SBType.h:223
+  /// of the debug information in a debug session, possibly even in another
+  /// executable or shared library's debug information. If we require a full
+  /// definition for a type but we can't find ony, we must forcefully complete

Could you replace all instances of "we" with something more concrete? It sounds 
like this paragraph really describes behaviors of TypeSystemClang?



Comment at: lldb/include/lldb/API/SBType.h:237
+  /// need to be forcefully completed
+  bool IsTypeForcefullyCompleted();
+

Why not `IsIncomplete()`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138259

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


[Lldb-commits] [PATCH] D138348: [lldb] Fix SBFileSpec.fullpath

2022-11-18 Thread Dave Lee via Phabricator via lldb-commits
kastiglione updated this revision to Diff 476652.
kastiglione added a comment.

Fix commit wording


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138348

Files:
  lldb/bindings/interface/SBFileSpec.i


Index: lldb/bindings/interface/SBFileSpec.i
===
--- lldb/bindings/interface/SBFileSpec.i
+++ lldb/bindings/interface/SBFileSpec.i
@@ -84,18 +84,7 @@
 
 #ifdef SWIGPYTHON
 %pythoncode %{
-def __get_fullpath__(self):
-spec_dir = self.GetDirectory()
-spec_file = self.GetFilename()
-if spec_dir and spec_file:
-return '%s/%s' % (spec_dir, spec_file)
-elif spec_dir:
-return spec_dir
-elif spec_file:
-return spec_file
-return None
-
-fullpath = property(__get_fullpath__, None, doc='''A read only 
property that returns the fullpath as a python string.''')
+fullpath = property(str, None, doc='''A read only property that 
returns the fullpath as a python string.''')
 basename = property(GetFilename, None, doc='''A read only property 
that returns the path basename as a python string.''')
 dirname = property(GetDirectory, None, doc='''A read only property 
that returns the path directory name as a python string.''')
 exists = property(Exists, None, doc='''A read only property that 
returns a boolean value that indicates if the file exists.''')


Index: lldb/bindings/interface/SBFileSpec.i
===
--- lldb/bindings/interface/SBFileSpec.i
+++ lldb/bindings/interface/SBFileSpec.i
@@ -84,18 +84,7 @@
 
 #ifdef SWIGPYTHON
 %pythoncode %{
-def __get_fullpath__(self):
-spec_dir = self.GetDirectory()
-spec_file = self.GetFilename()
-if spec_dir and spec_file:
-return '%s/%s' % (spec_dir, spec_file)
-elif spec_dir:
-return spec_dir
-elif spec_file:
-return spec_file
-return None
-
-fullpath = property(__get_fullpath__, None, doc='''A read only property that returns the fullpath as a python string.''')
+fullpath = property(str, None, doc='''A read only property that returns the fullpath as a python string.''')
 basename = property(GetFilename, None, doc='''A read only property that returns the path basename as a python string.''')
 dirname = property(GetDirectory, None, doc='''A read only property that returns the path directory name as a python string.''')
 exists = property(Exists, None, doc='''A read only property that returns a boolean value that indicates if the file exists.''')
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D138259: Add the ability to see when a type in incomplete.

2022-11-18 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

Generally, I think this can be useful information. I don't have any better 
suggestion, but I'd like to ask the room if we think that `` 
is a good message for the end users. (`Forward-declared type`, `type missing 
from debug info`, ...?)




Comment at: lldb/source/Core/ValueObject.cpp:601
+  if (GetCompilerType().IsForcefullyCompleted()) {
+  destination = "";
+  return true;

I don't ha


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138259

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


[Lldb-commits] [PATCH] D138345: [test][lldb-vscode] Un-realpath coreFile test.

2022-11-18 Thread walter erquinigo via Phabricator via lldb-commits
wallace accepted this revision.
wallace added a comment.
This revision is now accepted and ready to land.

yep, there's no need for the realpath
Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138345

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