[Lldb-commits] [PATCH] D137191: [lldb] Add information on type systems to statistics dump command

2022-11-02 Thread Thorsten via Phabricator via lldb-commits
tschuett added inline comments.



Comment at: lldb/include/lldb/Core/Module.h:818
 
+  void ForEachTypeSystem(llvm::function_ref const 
&callback);
+

Nit: the `const &`is redundant. It is a function reference.


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

https://reviews.llvm.org/D137191

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


[Lldb-commits] [lldb] d839f65 - [wasm] Always treat DWARF expression addresses as load addresses

2022-11-02 Thread Philip Pfaffe via lldb-commits

Author: Philip Pfaffe
Date: 2022-11-02T12:11:53Z
New Revision: d839f654586a4f3a84b334fcc2c986343a1d7f98

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

LOG: [wasm] Always treat DWARF expression addresses as load addresses

When resolving absolute addresses for DW_OP_addr or DW_OP_addrx, these are 
always load addresses rather than file addresses in wasm.

Reviewed By: DavidSpickett

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

Added: 


Modified: 
lldb/source/Expression/DWARFExpression.cpp
lldb/unittests/Expression/DWARFExpressionTest.cpp

Removed: 




diff  --git a/lldb/source/Expression/DWARFExpression.cpp 
b/lldb/source/Expression/DWARFExpression.cpp
index 1ccda944cd013..3f302e53c00e1 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -847,10 +847,12 @@ bool DWARFExpression::Evaluate(
 
   Process *process = nullptr;
   StackFrame *frame = nullptr;
+  Target *target = nullptr;
 
   if (exe_ctx) {
 process = exe_ctx->GetProcessPtr();
 frame = exe_ctx->GetFramePtr();
+target = exe_ctx->GetTargetPtr();
   }
   if (reg_ctx == nullptr && frame)
 reg_ctx = frame->GetRegisterContext().get();
@@ -906,12 +908,19 @@ bool DWARFExpression::Evaluate(
 // address and whose size is the size of an address on the target machine.
 case DW_OP_addr:
   stack.push_back(Scalar(opcodes.GetAddress(&offset)));
-  stack.back().SetValueType(Value::ValueType::FileAddress);
-  // Convert the file address to a load address, so subsequent
-  // DWARF operators can operate on it.
-  if (frame)
-stack.back().ConvertToLoadAddress(module_sp.get(),
-  frame->CalculateTarget().get());
+  if (target &&
+  target->GetArchitecture().GetCore() == ArchSpec::eCore_wasm32) {
+// wasm file sections aren't mapped into memory, therefore addresses 
can
+// never point into a file section and are always LoadAddresses.
+stack.back().SetValueType(Value::ValueType::LoadAddress);
+  } else {
+stack.back().SetValueType(Value::ValueType::FileAddress);
+// Convert the file address to a load address, so subsequent
+// DWARF operators can operate on it.
+if (frame)
+  stack.back().ConvertToLoadAddress(module_sp.get(),
+frame->CalculateTarget().get());
+  }
   break;
 
 // The DW_OP_addr_sect_offset4 is used for any location expressions in
@@ -2507,7 +2516,14 @@ bool DWARFExpression::Evaluate(
   uint64_t index = opcodes.GetULEB128(&offset);
   lldb::addr_t value = dwarf_cu->ReadAddressFromDebugAddrSection(index);
   stack.push_back(Scalar(value));
-  stack.back().SetValueType(Value::ValueType::FileAddress);
+  if (target &&
+  target->GetArchitecture().GetCore() == ArchSpec::eCore_wasm32) {
+// wasm file sections aren't mapped into memory, therefore addresses 
can
+// never point into a file section and are always LoadAddresses.
+stack.back().SetValueType(Value::ValueType::LoadAddress);
+  } else {
+stack.back().SetValueType(Value::ValueType::FileAddress);
+  }
 } break;
 
 // OPCODE: DW_OP_GNU_const_index

diff  --git a/lldb/unittests/Expression/DWARFExpressionTest.cpp 
b/lldb/unittests/Expression/DWARFExpressionTest.cpp
index 35a064fc14bd8..4251eb0aecda9 100644
--- a/lldb/unittests/Expression/DWARFExpressionTest.cpp
+++ b/lldb/unittests/Expression/DWARFExpressionTest.cpp
@@ -8,6 +8,7 @@
 
 #include "lldb/Expression/DWARFExpression.h"
 #include "Plugins/Platform/Linux/PlatformLinux.h"
+#include "Plugins/SymbolFile/DWARF/DWARFDebugInfo.h"
 #include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
 #include "TestingSupport/Symbol/YAMLModuleTester.h"
 #include "lldb/Core/Debugger.h"
@@ -401,3 +402,115 @@ TEST_F(DWARFExpressionMockProcessTest, DW_OP_deref) {
   Evaluate({DW_OP_lit4, DW_OP_deref, DW_OP_stack_value}, {}, {}, &exe_ctx),
   llvm::HasValue(GetScalar(32, 0x07060504, false)));
 }
+
+TEST_F(DWARFExpressionMockProcessTest, WASM_DW_OP_addr) {
+  // Set up a wasm target
+  ArchSpec arch("wasm32-unknown-unknown-wasm");
+  lldb::PlatformSP host_platform_sp =
+  platform_linux::PlatformLinux::CreateInstance(true, &arch);
+  ASSERT_TRUE(host_platform_sp);
+  Platform::SetHostPlatform(host_platform_sp);
+  lldb::DebuggerSP debugger_sp = Debugger::CreateInstance();
+  ASSERT_TRUE(debugger_sp);
+  lldb::TargetSP target_sp;
+  lldb::PlatformSP platform_sp;
+  debugger_sp->GetTargetList().CreateTarget(*debugger_sp, "", arch,
+lldb_private::eLoadDependentsNo,
+platform_sp

[Lldb-commits] [PATCH] D135664: [wasm] Always treat DWARF expression addresses as load addresses

2022-11-02 Thread Philip Pfaffe via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd839f654586a: [wasm] Always treat DWARF expression addresses 
as load addresses (authored by pfaffe).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135664

Files:
  lldb/source/Expression/DWARFExpression.cpp
  lldb/unittests/Expression/DWARFExpressionTest.cpp

Index: lldb/unittests/Expression/DWARFExpressionTest.cpp
===
--- lldb/unittests/Expression/DWARFExpressionTest.cpp
+++ lldb/unittests/Expression/DWARFExpressionTest.cpp
@@ -8,6 +8,7 @@
 
 #include "lldb/Expression/DWARFExpression.h"
 #include "Plugins/Platform/Linux/PlatformLinux.h"
+#include "Plugins/SymbolFile/DWARF/DWARFDebugInfo.h"
 #include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
 #include "TestingSupport/Symbol/YAMLModuleTester.h"
 #include "lldb/Core/Debugger.h"
@@ -401,3 +402,115 @@
   Evaluate({DW_OP_lit4, DW_OP_deref, DW_OP_stack_value}, {}, {}, &exe_ctx),
   llvm::HasValue(GetScalar(32, 0x07060504, false)));
 }
+
+TEST_F(DWARFExpressionMockProcessTest, WASM_DW_OP_addr) {
+  // Set up a wasm target
+  ArchSpec arch("wasm32-unknown-unknown-wasm");
+  lldb::PlatformSP host_platform_sp =
+  platform_linux::PlatformLinux::CreateInstance(true, &arch);
+  ASSERT_TRUE(host_platform_sp);
+  Platform::SetHostPlatform(host_platform_sp);
+  lldb::DebuggerSP debugger_sp = Debugger::CreateInstance();
+  ASSERT_TRUE(debugger_sp);
+  lldb::TargetSP target_sp;
+  lldb::PlatformSP platform_sp;
+  debugger_sp->GetTargetList().CreateTarget(*debugger_sp, "", arch,
+lldb_private::eLoadDependentsNo,
+platform_sp, target_sp);
+
+  ExecutionContext exe_ctx(target_sp, false);
+  // DW_OP_addr takes a single operand of address size width:
+  uint8_t expr[] = {DW_OP_addr, 0x40, 0x0, 0x0, 0x0};
+  DataExtractor extractor(expr, sizeof(expr), lldb::eByteOrderLittle,
+  /*addr_size*/ 4);
+  Value result;
+  Status status;
+  ASSERT_TRUE(DWARFExpression::Evaluate(
+  &exe_ctx, /*reg_ctx*/ nullptr, /*module_sp*/ {}, extractor,
+  /*unit*/ nullptr, lldb::eRegisterKindLLDB,
+  /*initial_value_ptr*/ nullptr,
+  /*object_address_ptr*/ nullptr, result, &status))
+  << status.ToError();
+
+  ASSERT_EQ(result.GetValueType(), Value::ValueType::LoadAddress);
+}
+
+TEST_F(DWARFExpressionMockProcessTest, WASM_DW_OP_addr_index) {
+  const char *yamldata = R"(
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:ELFDATA2LSB
+  Type:ET_EXEC
+  Machine: EM_386
+DWARF:
+  debug_abbrev:
+- Table:
+- Code:0x0001
+  Tag: DW_TAG_compile_unit
+  Children:DW_CHILDREN_no
+  Attributes:
+- Attribute:   DW_AT_addr_base
+  Form:DW_FORM_sec_offset
+
+  debug_info:
+- Version: 5
+  AddrSize:4
+  UnitType:DW_UT_compile
+  Entries:
+- AbbrCode:0x0001
+  Values:
+- Value:   0x8 # Offset of the first Address past the header
+- AbbrCode:0x0
+
+  debug_addr:
+- Version: 5
+  AddressSize: 4
+  Entries:
+- Address: 0x1234
+- Address: 0x5678
+)";
+
+  // Can't use DWARFExpressionTester from above because subsystems overlap with
+  // the fixture.
+  SubsystemRAII subsystems;
+  llvm::Expected file = TestFile::fromYaml(yamldata);
+  EXPECT_THAT_EXPECTED(file, llvm::Succeeded());
+  auto module_sp = std::make_shared(file->moduleSpec());
+  auto *dwarf_cu = llvm::cast(module_sp->GetSymbolFile())
+   ->DebugInfo()
+   .GetUnitAtIndex(0);
+  ASSERT_TRUE(dwarf_cu);
+  dwarf_cu->ExtractDIEsIfNeeded();
+
+  // Set up a wasm target
+  ArchSpec arch("wasm32-unknown-unknown-wasm");
+  lldb::PlatformSP host_platform_sp =
+  platform_linux::PlatformLinux::CreateInstance(true, &arch);
+  ASSERT_TRUE(host_platform_sp);
+  Platform::SetHostPlatform(host_platform_sp);
+  lldb::DebuggerSP debugger_sp = Debugger::CreateInstance();
+  ASSERT_TRUE(debugger_sp);
+  lldb::TargetSP target_sp;
+  lldb::PlatformSP platform_sp;
+  debugger_sp->GetTargetList().CreateTarget(*debugger_sp, "", arch,
+lldb_private::eLoadDependentsNo,
+platform_sp, target_sp);
+
+  ExecutionContext exe_ctx(target_sp, false);
+  // DW_OP_addrx takes a single leb128 operand, the index in the addr table:
+  uint8_t expr[] = {DW_OP_addrx, 0x01};
+  DataExtractor extractor(expr, sizeof(expr), lldb::eByteOrderLittle,
+  /*addr_size*/ 4);
+  Value result;
+  Status status;
+  ASSERT_TRUE(DWARFExpression::Evaluate(
+  &exe_ctx, /*reg_ctx*/ nullptr, /*module_sp*/ {}, extractor

[Lldb-commits] [PATCH] D137247: [lldb] Allow plugins to extend DWARF expression parsing for vendor extensions

2022-11-02 Thread Philip Pfaffe via Phabricator via lldb-commits
pfaffe created this revision.
pfaffe added reviewers: labath, DavidSpickett.
Herald added a project: All.
pfaffe requested review of this revision.
Herald added subscribers: lldb-commits, aheejin.
Herald added a project: LLDB.

Parsing DWARF expressions currently does not support DW_OPs that are vendor
extensions. With this change expression parsing calls into SymbolFileDWARF for
unknown opcodes, which is the semantically "closest" plugin that we have right
now. Plugins can then extend SymbolFileDWARF to add support for vendor
extensions.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D137247

Files:
  lldb/include/lldb/Expression/DWARFExpression.h
  lldb/include/lldb/Target/Platform.h
  lldb/source/Expression/DWARFExpression.cpp
  lldb/source/Expression/DWARFExpressionList.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
  lldb/unittests/Expression/DWARFExpressionTest.cpp

Index: lldb/unittests/Expression/DWARFExpressionTest.cpp
===
--- lldb/unittests/Expression/DWARFExpressionTest.cpp
+++ lldb/unittests/Expression/DWARFExpressionTest.cpp
@@ -9,9 +9,11 @@
 #include "lldb/Expression/DWARFExpression.h"
 #include "Plugins/Platform/Linux/PlatformLinux.h"
 #include "Plugins/SymbolFile/DWARF/DWARFDebugInfo.h"
+#include "Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h"
 #include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
 #include "TestingSupport/Symbol/YAMLModuleTester.h"
 #include "lldb/Core/Debugger.h"
+#include "lldb/Core/PluginManager.h"
 #include "lldb/Core/Value.h"
 #include "lldb/Core/dwarf.h"
 #include "lldb/Host/HostInfo.h"
@@ -514,3 +516,251 @@
   ASSERT_EQ(result.GetValueType(), Value::ValueType::LoadAddress);
   ASSERT_EQ(result.GetScalar().UInt(), 0x5678u);
 }
+
+class CustomSymbolFileDWARF : public SymbolFileDWARF {
+  static char ID;
+
+public:
+  using SymbolFileDWARF::SymbolFileDWARF;
+
+  bool isA(const void *ClassID) const override {
+return ClassID == &ID || SymbolFile::isA(ClassID);
+  }
+  static bool classof(const SymbolFile *obj) { return obj->isA(&ID); }
+
+  static llvm::StringRef GetPluginNameStatic() { return "custom_dwarf"; }
+
+  static llvm::StringRef GetPluginDescriptionStatic() {
+return "Symbol file reader with expression extensions.";
+  }
+
+  static void Initialize() {
+PluginManager::RegisterPlugin(GetPluginNameStatic(),
+  GetPluginDescriptionStatic(), CreateInstance,
+  SymbolFileDWARF::DebuggerInitialize);
+  }
+
+  static void Terminate() { PluginManager::UnregisterPlugin(CreateInstance); }
+
+  static lldb_private::SymbolFile *
+  CreateInstance(lldb::ObjectFileSP objfile_sp) {
+return new CustomSymbolFileDWARF(std::move(objfile_sp),
+ /*dwo_section_list*/ nullptr);
+  }
+
+  lldb::offset_t
+  GetVendorDWARFOpcodeSize(const lldb_private::DataExtractor &data,
+   const lldb::offset_t data_offset,
+   const uint8_t op) const final {
+auto offset = data_offset;
+if (op != DW_OP_WASM_location) {
+  return LLDB_INVALID_OFFSET;
+}
+
+// DW_OP_WASM_location WASM_GLOBAL:0x03 index:u32
+// Called with "arguments" 0x03, 0x04, 0x00, 0x00, 0x00
+// Location type:
+if (data.GetU8(&offset) != /* global */ 0x03) {
+  return LLDB_INVALID_OFFSET;
+}
+
+// Index
+if (data.GetU32(&offset) != 0x04) {
+  return LLDB_INVALID_OFFSET;
+}
+
+// Report the skipped distance:
+return offset - data_offset;
+  }
+
+  bool
+  ParseVendorDWARFOpcode(uint8_t op, const lldb_private::DataExtractor &opcodes,
+ lldb::offset_t &offset,
+ std::vector &stack) const final {
+if (op != DW_OP_WASM_location) {
+  return false;
+}
+
+// DW_OP_WASM_location WASM_GLOBAL:0x03 index:u32
+// Called with "arguments" 0x03, 0x04, 0x00, 0x00, 0x00
+// Location type:
+if (opcodes.GetU8(&offset) != /* global */ 0x03) {
+  return false;
+}
+
+// Index:
+if (opcodes.GetU32(&offset) != 0x04) {
+  return false;
+}
+
+// Return some value:
+stack.push_back({GetScalar(32, 42, false)});
+return true;
+  }
+};
+
+char CustomSymbolFileDWARF::ID;
+
+TEST(DWARFExpression, Extensions) {
+  const char *yamldata = R"(
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:ELFDATA2LSB
+  Type:ET_EXEC
+  Machine: EM_386
+DWARF:
+  debug_abbrev:
+- Table:
+- Code:0x0001
+  Tag: DW_TAG_compile_unit
+  Children:DW_CHILDREN_no
+  debug_info:
+- Version: 4
+  AddrSize:4
+  Entries:
+- AbbrCode:0x1
+- AbbrCode:0x0
+)";
+
+  SubsystemRAII
+  subsystems;
+
+  llvm::Expect

[Lldb-commits] [PATCH] D137098: [lldb] Support simplified template names in the manual index

2022-11-02 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Why is it that the other indexes don't need an equivalent fix? Could it be that 
you just haven't tried those code paths?

If they do need it, then it'd be good if we could make the fix in a single 
place. Possibly by putting the retry logic at a higher level?

In D137098#3897322 , @dblaikie wrote:

> In D137098#3897289 , @aeubanks 
> wrote:
>
>> updated description with why this doesn't produce false positives with 
>> breakpoints
>>
>> this doesn't support regex function name lookup, not sure if we care enough 
>> about the interaction between regexes/function names under simple template 
>> names. if we do, we could instead add template parameters to the names we 
>> put in the manual index. I did take a quick look at doing that but it'd 
>> require more work
>
> Presumably that'd then lead to divergence between manual and automatic index 
> - which would be bad. So if this behavior is the same between automatic and 
> manual index with simplified template names, that's probably good.

In addition to the divergence, the building the manual index is possibly the 
most performance-critical part of lldb, so doing all this extra work to 
reconstruct the templated names is probably a non-starter. If we wanted to 
support that, then we'd have to come up with a completely different way to 
achieve implement this functionality.




Comment at: lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp:450
   }
   if (name_type_mask & eFunctionNameTypeBase) {
 if (!m_set.function_basenames.Find(

Are you sure this doesn't need to be repeated for `eFunctionNameTypeBase`? 
that's where non-member functions end up...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137098

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


Re: [Lldb-commits] [lldb] 3e03873 - [lldb][Test] Fix TestFrameFormatNameWithArgs.test on Windows/Linux

2022-11-02 Thread Pavel Labath via lldb-commits

On 01/11/2022 06:59, Michael Buch via lldb-commits wrote:


Author: Michael Buch
Date: 2022-10-31T22:59:16-07:00
New Revision: 3e03873e363b5aa90e4488da63a6de0648d11aba

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

LOG: [lldb][Test] Fix TestFrameFormatNameWithArgs.test on Windows/Linux

* Windows doesn't support setting these breakpoints by basename
* On Linux std::function arguments aren't formatted as such


The windows issue seems problematic (Zequan might be interested in 
that), but the non-pretty-printing of std::function is most likely 
caused by our lack of a pretty-printer for libstdc++'s (default for 
linux) std::function. It doesn't seem ideal that a fairly generic test 
would depend on the existence of a (very complicated) pretty printer.


Is there a specific edge case that this particular check was trying to 
hit? Could it be moved into a separate test case, or ideally replaced by 
a something simpler? For example the type `const char *` also has a 
summary provider, and I'd hope that this feature does not depend on the 
specific way in which that summary is computed.




Added:
 


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

Removed:
 




diff  --git a/lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test 
b/lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test
index ab16c656624d8..d990114f57845 100644
--- a/lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test
+++ b/lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test
@@ -1,3 +1,4 @@
+# REQUIRES: system-darwin
  # RUN: %clangxx_host -g -O0 %S/Inputs/names.cpp -std=c++17 -o %t.out
  # RUN: %lldb -b -s %s %t.out | FileCheck %s
  settings set -f frame-format "frame ${function.name-with-args}\n"


 
___

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


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


[Lldb-commits] [PATCH] D137000: [lldb] Make callback-based formatter matching available from the CLI.

2022-11-02 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D137000#3897878 , @jgorbe wrote:

> I'm looking at the option of using a non-printable character for the short 
> flag, and at the same time make `--regex` and `--recognizer-function` 
> mutually exclusive using option groups. One problem I see is that the command 
> help gets pretty confusing. Using a non-printable character as the short 
> option name makes the option completely disappear from the "Command Options 
> Usage" summary part of the help.
>
> For example, for `disassemble` the `--force` option is defined with 
> `Groups[2,3,4,5,7]` but there's no indication in the usage summary that 
> `--force` is only usable in some of the groups:

Hmm.. you're right, I didn't know that.  I'll leave it up to you, but 
personally I wouldn't consider it a blocker, as I think that the way we print 
our option group help needs an overhaul anyway. I mean, the idea is kinda nice, 
but after a certain number of options (and groups) it just becomes ridiculous. 
For example, I'd like to meet the person who can make sense of this:

  Command Options Usage:
breakpoint set [-DHd] -l  [-G ] [-C ] [-c 
] [-i ] [-o ] [-q ] [-t ] [-x 
] [-T ] [-R ] [-N ] [-u 
] [-f ] [-m ] [-s ] [-K ]
breakpoint set [-DHd] -a  [-G ] [-C ] 
[-c ] [-i ] [-o ] [-q ] [-t ] [-x 
] [-T ] [-N ] [-s ]
breakpoint set [-DHd] -n  [-G ] [-C ] [-c 
] [-i ] [-o ] [-q ] [-t ] [-x 
] [-T ] [-R ] [-N ] [-f 
] [-L ] [-s ] [-K ]
breakpoint set [-DHd] -F  [-G ] [-C ] [-c 
] [-i ] [-o ] [-q ] [-t ] [-x 
] [-T ] [-R ] [-N ] [-f 
] [-L ] [-s ] [-K ]
breakpoint set [-DHd] -S  [-G ] [-C ] [-c 
] [-i ] [-o ] [-q ] [-t ] [-x 
] [-T ] [-R ] [-N ] [-f 
] [-L ] [-s ] [-K ]
breakpoint set [-DHd] -M  [-G ] [-C ] [-c ] 
[-i ] [-o ] [-q ] [-t ] [-x 
] [-T ] [-R ] [-N ] [-f 
] [-L ] [-s ] [-K ]
breakpoint set [-DHd] -r  [-G ] [-C ] 
[-c ] [-i ] [-o ] [-q ] [-t ] [-x 
] [-T ] [-R ] [-N ] [-f 
] [-L ] [-s ] [-K ]
breakpoint set [-DHd] -b  [-G ] [-C ] [-c 
] [-i ] [-o ] [-q ] [-t ] [-x 
] [-T ] [-R ] [-N ] [-f 
] [-L ] [-s ] [-K ]
breakpoint set [-ADHd] -p  [-G ] [-C 
] [-c ] [-i ] [-o ] [-q ] [-t 
] [-x ] [-T ] [-N ] [-f 
] [-m ] [-s ] [-X ]
breakpoint set [-DHd] -E  [-G ] [-C ] 
[-c ] [-i ] [-o ] [-q ] [-t ] [-x 
] [-T ] [-N ] [-h ] [-w 
]
breakpoint set [-DHd] -P  [-k ] [-v ] [-G 
] [-C ] [-c ] [-i ] [-o ] [-q 
] [-t ] [-x ] [-T ] [-N 
] [-f ] [-s ]
breakpoint set [-DHd] -y  [-G ] [-C ] [-c 
] [-i ] [-o ] [-q ] [-t ] [-x 
] [-T ] [-R ] [-N ] [-m 
] [-s ] [-K ]


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

https://reviews.llvm.org/D137000

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


[Lldb-commits] [PATCH] D137247: [lldb] Allow plugins to extend DWARF expression parsing for vendor extensions

2022-11-02 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett added a comment.

I'm missing some context here I think.

I assume the use case is that, for example, we don't want to be adding a bunch 
of WASM specific DWARF operations to the generic operations. If those can live 
in a WASM (the "vendor") plugin then we know where to look and they can use any 
vendor specific knowledge to do their job.

Along the right lines? I think I saw some talk about this on a previous diff 
but don't remember now.




Comment at: lldb/include/lldb/Target/Platform.h:959
   const FileSpecList *module_search_paths_ptr);
-
 private:

stray change



Comment at: lldb/source/Expression/DWARFExpressionList.cpp:93
   const DWARFExpression &expr = m_exprs.GetEntryRef(0).data;
-  return expr.ContainsThreadLocalStorage();
+  return expr.ContainsThreadLocalStorage(*m_dwarf_cu);
 }

I'm not sure that `m_dwarf_cu` is always non null. It might be in practice but 
for example one use ends up in `UpdateValueTypeFromLocationDescription` which 
checks that it is not null before use.

Maybe it is reasonable to assume it is never null (and if it is and you have 
the time, a preparatory patch to make it a ref would be great).



Comment at: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h:343
+  ParseVendorDWARFOpcode(uint8_t op,
+ const lldb_private::DataExtractor &opcodes,
+ lldb::offset_t &offset,

Seems like clang-format missed a bit here.



Comment at: lldb/unittests/Expression/DWARFExpressionTest.cpp:571
+}
+
+// Report the skipped distance:

Is there not 3 more arguments to read off here? The `0x00 0x00 0x00` from above.



Comment at: lldb/unittests/Expression/DWARFExpressionTest.cpp:751-765
+  // Test that expression extensions can be evaluated, for example
+  // DW_OP_WASM_location which is not currently handled by DWARFExpression:
+  // DW_OP_WASM_location WASM_GLOBAL:0x03 index:u32
+  EXPECT_THAT_EXPECTED(Evaluate({DW_OP_WASM_location, 0x03, 0x04, 0x00, 0x00,
+ 0x00, DW_OP_stack_value},
+dwo_module_sp, dwo_dwarf_unit),
+   llvm::HasValue(GetScalar(32, 42, false)));

Can you dedeupe this section of both tests? Appears to be the same.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137247

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


[Lldb-commits] [PATCH] D137247: [lldb] Allow plugins to extend DWARF expression parsing for vendor extensions

2022-11-02 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett added inline comments.



Comment at: lldb/unittests/Expression/DWARFExpressionTest.cpp:719
+  Type:ET_EXEC
+  Machine: EM_386
+Sections:

I know it's just a test but is there an `EM_WASM` you could use?

Maybe lldb doesn't understand that name yet so it makes no difference anyway.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137247

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


[Lldb-commits] [PATCH] D136650: Make CompilerType safe [Was: Add a check for TypeSystem use-after-free problems]

2022-11-02 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Well... like they say, there's no software engineering problem that can't be 
solved by adding an extra layer of indirection.

In this case, that's "adding an extra layer and leaking it", so I'm wondering 
if we can drop the second part. I'm going to assume that we want to preserve 
`sizeof(ptr)`, even though I'm not entirely convinced that this 
would cause a significant increase in our memory footprint.

An ideal solution for this would be a `IntrusiveRefCntPtr`, but with weak 
pointer support. That doesn't exist right now, but since we're already adding a 
layer of indirection, I think that layer could be used to introduce weak 
semantics. Instead of this "canonical" `TypeSystemWP *`, we could pass around a 
`IntrusiveRefCntPtr`, where `TypeSystemHolder` is essentially 
a `TypeSystemWP` wrapped in a `ThreadSafeRefCountedBase`. I think this doesn't 
increase the number of dereferences (it's still takes two derefs to get from 
this funky representation to an actual type system), but it has the advantage 
that the type system holder will go away when/if all references to it are gone. 
Another advantage (I hope) could be that we don't see this funky double deref 
(`TypeSystemWP *`) pattern everywhere, as it's helpfully hidden in the holder 
class.


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

https://reviews.llvm.org/D136650

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


[Lldb-commits] [PATCH] D137247: [lldb] Allow plugins to extend DWARF expression parsing for vendor extensions

2022-11-02 Thread Philip Pfaffe via Phabricator via lldb-commits
pfaffe added a comment.

Yes, you got the context right! Although technically speaking this change isn't 
limited to wasm, plugins can implement any vendor extension on top of this 
change.




Comment at: lldb/source/Expression/DWARFExpressionList.cpp:93
   const DWARFExpression &expr = m_exprs.GetEntryRef(0).data;
-  return expr.ContainsThreadLocalStorage();
+  return expr.ContainsThreadLocalStorage(*m_dwarf_cu);
 }

DavidSpickett wrote:
> I'm not sure that `m_dwarf_cu` is always non null. It might be in practice 
> but for example one use ends up in `UpdateValueTypeFromLocationDescription` 
> which checks that it is not null before use.
> 
> Maybe it is reasonable to assume it is never null (and if it is and you have 
> the time, a preparatory patch to make it a ref would be great).
I think it's worth checking in general. Before 
https://reviews.llvm.org/D125509, the DWARFExpression used to be assiciated 
with its dwarf_cu. I was considering bringing that back, what do you think? 



Comment at: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h:343
+  ParseVendorDWARFOpcode(uint8_t op,
+ const lldb_private::DataExtractor &opcodes,
+ lldb::offset_t &offset,

DavidSpickett wrote:
> Seems like clang-format missed a bit here.
Curious, I would have assumed the linter at the very least would have caught 
that.



Comment at: lldb/unittests/Expression/DWARFExpressionTest.cpp:571
+}
+
+// Report the skipped distance:

DavidSpickett wrote:
> Is there not 3 more arguments to read off here? The `0x00 0x00 0x00` from 
> above.
No, the second argument to this opcode is of type uint32_t, the zeros are the 
last three bytes of that. Should I maybe use a simpler/fake opcode? Might be 
dangerous if that fake opcode ever got occupied/implemented.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137247

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


[Lldb-commits] [lldb] 4b21ecf - [lldb] Update TestDump.test for gnuwin32's 'file' command output

2022-11-02 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2022-11-02T09:33:25-07:00
New Revision: 4b21ecf10c8a0abb977bf11edf939cc708902cd3

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

LOG: [lldb] Update TestDump.test for gnuwin32's 'file' command output

Remove the colon from the CHECK line for the output of the file command.
On macOS and Linux, the file command uses a colon as the separator
between the path and the file type, but gnuwin32's file command uses a
semicolon.

Added: 


Modified: 
lldb/test/Shell/Diagnostics/TestDump.test

Removed: 




diff  --git a/lldb/test/Shell/Diagnostics/TestDump.test 
b/lldb/test/Shell/Diagnostics/TestDump.test
index 9bb34aafc8c3a..2adde6b86d35a 100644
--- a/lldb/test/Shell/Diagnostics/TestDump.test
+++ b/lldb/test/Shell/Diagnostics/TestDump.test
@@ -12,4 +12,4 @@
 # RUN: %lldb -o 'diagnostics dump -d %t.nonexisting'
 # RUN: file %t.nonexisting | FileCheck %s
 
-# CHECK: : directory
+# CHECK: directory



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


[Lldb-commits] [PATCH] D137247: [lldb] Allow plugins to extend DWARF expression parsing for vendor extensions

2022-11-02 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett added inline comments.



Comment at: lldb/source/Expression/DWARFExpressionList.cpp:93
   const DWARFExpression &expr = m_exprs.GetEntryRef(0).data;
-  return expr.ContainsThreadLocalStorage();
+  return expr.ContainsThreadLocalStorage(*m_dwarf_cu);
 }

pfaffe wrote:
> DavidSpickett wrote:
> > I'm not sure that `m_dwarf_cu` is always non null. It might be in practice 
> > but for example one use ends up in `UpdateValueTypeFromLocationDescription` 
> > which checks that it is not null before use.
> > 
> > Maybe it is reasonable to assume it is never null (and if it is and you 
> > have the time, a preparatory patch to make it a ref would be great).
> I think it's worth checking in general. Before 
> https://reviews.llvm.org/D125509, the DWARFExpression used to be assiciated 
> with its dwarf_cu. I was considering bringing that back, what do you think? 
I think you should ask the author of that change :)

On the surface that change makes sense but I'm no expert. If that's the case 
then you'll just want to sprinkle some `if not nullptr` around wherever you use 
it.

(nullptrs are fine if there is a reason to use the null state)



Comment at: lldb/unittests/Expression/DWARFExpressionTest.cpp:571
+}
+
+// Report the skipped distance:

pfaffe wrote:
> DavidSpickett wrote:
> > Is there not 3 more arguments to read off here? The `0x00 0x00 0x00` from 
> > above.
> No, the second argument to this opcode is of type uint32_t, the zeros are the 
> last three bytes of that. Should I maybe use a simpler/fake opcode? Might be 
> dangerous if that fake opcode ever got occupied/implemented.
It was the comment misleading me:
```
// Called with "arguments" 0x03, 0x04, 0x00, 0x00, 0x00
```

So I'm thinking there is an operation that is called with arguments 3, 4, 0, 0, 
0.

Just reword the comment and it'll be fine.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137247

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


[Lldb-commits] [PATCH] D137191: [lldb] Add information on type systems to statistics dump command

2022-11-02 Thread Alex Langford via Phabricator via lldb-commits
bulbazord updated this revision to Diff 472672.
bulbazord added a comment.

Remove `const &` from argument to `Module::ForEachTypeSystem`


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

https://reviews.llvm.org/D137191

Files:
  lldb/include/lldb/Core/Module.h
  lldb/include/lldb/Symbol/TypeSystem.h
  lldb/include/lldb/Target/Statistics.h
  lldb/source/Core/Module.cpp
  lldb/source/Symbol/TypeSystem.cpp
  lldb/source/Target/Statistics.cpp

Index: lldb/source/Target/Statistics.cpp
===
--- lldb/source/Target/Statistics.cpp
+++ lldb/source/Target/Statistics.cpp
@@ -75,6 +75,17 @@
   symfile_ids.emplace_back(symfile_id);
 module.try_emplace("symbolFileModuleIdentifiers", std::move(symfile_ids));
   }
+
+  if (!type_system_stats.empty()) {
+json::Array type_systems;
+for (const auto &entry : type_system_stats) {
+  json::Object obj;
+  obj.try_emplace(entry.first().str(), entry.second);
+  type_systems.emplace_back(std::move(obj));
+}
+module.try_emplace("typeSystemInfo", std::move(type_systems));
+  }
+
   return module;
 }
 
@@ -256,6 +267,11 @@
 debug_parse_time += module_stat.debug_parse_time;
 debug_index_time += module_stat.debug_index_time;
 debug_info_size += module_stat.debug_info_size;
+module->ForEachTypeSystem([&](TypeSystem *ts) {
+  if (auto stats = ts->ReportStatistics())
+module_stat.type_system_stats.insert({ts->GetPluginName(), *stats});
+  return true;
+});
 json_modules.emplace_back(module_stat.ToJSON());
   }
 
Index: lldb/source/Symbol/TypeSystem.cpp
===
--- lldb/source/Symbol/TypeSystem.cpp
+++ lldb/source/Symbol/TypeSystem.cpp
@@ -178,6 +178,10 @@
   return {};
 }
 
+llvm::Optional TypeSystem::ReportStatistics() {
+  return llvm::None;
+}
+
 #pragma mark TypeSystemMap
 
 TypeSystemMap::TypeSystemMap() : m_mutex(), m_map() {}
Index: lldb/source/Core/Module.cpp
===
--- lldb/source/Core/Module.cpp
+++ lldb/source/Core/Module.cpp
@@ -369,6 +369,11 @@
   return m_type_system_map.GetTypeSystemForLanguage(language, this, true);
 }
 
+void Module::ForEachTypeSystem(
+llvm::function_ref callback) {
+  m_type_system_map.ForEach(callback);
+}
+
 void Module::ParseAllDebugSymbols() {
   std::lock_guard guard(m_mutex);
   size_t num_comp_units = GetNumCompileUnits();
Index: lldb/include/lldb/Target/Statistics.h
===
--- lldb/include/lldb/Target/Statistics.h
+++ lldb/include/lldb/Target/Statistics.h
@@ -12,6 +12,7 @@
 #include "lldb/Utility/ConstString.h"
 #include "lldb/Utility/Stream.h"
 #include "lldb/lldb-forward.h"
+#include "llvm/ADT/StringMap.h"
 #include "llvm/Support/JSON.h"
 #include 
 #include 
@@ -107,6 +108,7 @@
   // identifiers of these modules in the global module list. This allows us to
   // track down all of the stats that contribute to this module.
   std::vector symfile_modules;
+  llvm::StringMap type_system_stats;
   double symtab_parse_time = 0.0;
   double symtab_index_time = 0.0;
   double debug_parse_time = 0.0;
Index: lldb/include/lldb/Symbol/TypeSystem.h
===
--- lldb/include/lldb/Symbol/TypeSystem.h
+++ lldb/include/lldb/Symbol/TypeSystem.h
@@ -19,6 +19,7 @@
 #include "llvm/ADT/SmallBitVector.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/Error.h"
+#include "llvm/Support/JSON.h"
 
 #include "lldb/Core/PluginInterface.h"
 #include "lldb/Expression/Expression.h"
@@ -508,6 +509,8 @@
   // meaningless type itself, instead preferring to use the dynamic type
   virtual bool IsMeaninglessWithoutDynamicResolution(void *type);
 
+  virtual llvm::Optional ReportStatistics();
+
 protected:
   SymbolFile *m_sym_file = nullptr;
 };
Index: lldb/include/lldb/Core/Module.h
===
--- lldb/include/lldb/Core/Module.h
+++ lldb/include/lldb/Core/Module.h
@@ -29,6 +29,7 @@
 #include "lldb/lldb-types.h"
 
 #include "llvm/ADT/DenseSet.h"
+#include "llvm/ADT/STLFunctionalExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Chrono.h"
 
@@ -814,6 +815,8 @@
   llvm::Expected
   GetTypeSystemForLanguage(lldb::LanguageType language);
 
+  void ForEachTypeSystem(llvm::function_ref callback);
+
   // Special error functions that can do printf style formatting that will
   // prepend the message with something appropriate for this module (like the
   // architecture, path and object name (if any)). This centralizes code so
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D137272: [lldb][Test] Make TestFrameFormatNameWithArgs.test more compatible across platforms

2022-11-02 Thread Michael Buch via Phabricator via lldb-commits
Michael137 created this revision.
Michael137 added a reviewer: labath.
Herald added a project: All.
Michael137 requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

On Linux the `std::function` behaved differently to that on Darwin.

This patch removes usage of `std::function` in the test but attempts
to retain the test-coverage. We mainly want function types appearing
in the template argument and function argument lists.

Also add a `char const*` overload to one of the test functions to
cover the "format function argument using ValueObject formatter" code-path.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D137272

Files:
  lldb/test/Shell/Settings/Inputs/names.cpp
  lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test


Index: lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test
===
--- lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test
+++ lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test
@@ -1,4 +1,4 @@
-# REQUIRES: system-darwin
+# UNSUPPORTED: system-windows
 # RUN: %clangxx_host -g -O0 %S/Inputs/names.cpp -std=c++17 -o %t.out
 # RUN: %lldb -b -s %s %t.out | FileCheck %s
 settings set -f frame-format "frame ${function.name-with-args}\n"
@@ -8,21 +8,19 @@
 run
 # CHECK: frame int ns::foo(t={{.*}})
 c
-# CHECK: frame int ns::foo>(t= Function = bar() )
+# CHECK: frame int ns::foo(str="bar")
 c
-# CHECK: frame int ns::foo<(anonymous namespace)::$_0>(t={{.*}})
+# CHECK: frame int ns::foo<(anonymous namespace)::$_0>(t=(anonymous 
namespace)::(unnamed class) @ {{.*}})
 c
-# CHECK: frame int ns::foo>(t= Function = 
(anonymous namespace)::anon_bar() )
+# CHECK: frame int ns::foo(t=({{.*}}`(anonymous 
namespace)::anon_bar() at {{.*}}))
 c
-# CHECK: frame int ns::foo 
const&) const noexcept>(t={{.*}})
+# CHECK: frame int ns::foo(str="method")
 c
 # CHECK: frame ns::returns_func_ptr((null)={{.*}})
 c
-# CHECK: frame void Foo::foo>(this={{.*}}, t= 
Function = bar() ) const
+# CHECK: frame void Foo::foo(this={{.*}}, arg=({{.*}}`(anonymous 
namespace)::anon_bar() at {{.*}}))
 c
-# CHECK: frame void Foo::foo>(this={{.*}}, t= 
Function = (anonymous namespace)::anon_bar() ) const
-c
-# CHECK: frame void Foo::operator<<<1ul>(this={{.*}}, (null)=0)
+# CHECK: frame void Foo::operator<<<1>(this={{.*}}, (null)=0)
 c
 # CHECK: frame Foo::returns_func_ptr(this={{.*}}, (null)={{.*}})
 q
Index: lldb/test/Shell/Settings/Inputs/names.cpp
===
--- lldb/test/Shell/Settings/Inputs/names.cpp
+++ lldb/test/Shell/Settings/Inputs/names.cpp
@@ -1,5 +1,3 @@
-#include 
-
 namespace detail {
 template  struct Quux {};
 } // namespace detail
@@ -7,15 +5,16 @@
 using FuncPtr = detail::Quux (*(*)(int))(float);
 
 struct Foo {
-  template  void foo(T const &t) const noexcept(true) {}
+  template  void foo(T arg) const noexcept(true) {}
 
-  template  void operator<<(size_t) {}
+  template  void operator<<(int) {}
 
   template  FuncPtr returns_func_ptr(detail::Quux &&) const 
noexcept(false) { return nullptr; }
 };
 
 namespace ns {
-template  int foo(T const &t) noexcept(false) { return 0; }
+template  int foo(char const *str) noexcept(false) { return 0; }
+template  int foo(T t) { return 1; }
 
 template  FuncPtr returns_func_ptr(detail::Quux &&) { return 
nullptr; }
 } // namespace ns
@@ -24,20 +23,20 @@
 
 namespace {
 int anon_bar() { return 1; }
-auto anon_lambda = [](std::function) mutable {};
+auto anon_lambda = [] {};
 } // namespace
 
 int main() {
-  ns::foo(bar);
-  ns::foo(std::function{bar});
+  ns::foo(bar);
+  ns::foo("bar");
   ns::foo(anon_lambda);
-  ns::foo(std::function{anon_bar});
-  ns::foo(&Foo::foo>);
+  ns::foo(anon_bar);
+  ns::foo)>("method");
   ns::returns_func_ptr(detail::Quux{});
   Foo f;
-  f.foo(std::function{bar});
-  f.foo(std::function{anon_bar});
+  f.foo(anon_bar);
   f.operator<< <(2 > 1)>(0);
   f.returns_func_ptr(detail::Quux{});
+
   return 0;
 }


Index: lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test
===
--- lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test
+++ lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test
@@ -1,4 +1,4 @@
-# REQUIRES: system-darwin
+# UNSUPPORTED: system-windows
 # RUN: %clangxx_host -g -O0 %S/Inputs/names.cpp -std=c++17 -o %t.out
 # RUN: %lldb -b -s %s %t.out | FileCheck %s
 settings set -f frame-format "frame ${function.name-with-args}\n"
@@ -8,21 +8,19 @@
 run
 # CHECK: frame int ns::foo(t={{.*}})
 c
-# CHECK: frame int ns::foo>(t= Function = bar() )
+# CHECK: frame int ns::foo(str="bar")
 c
-# CHECK: frame int ns::foo<(anonymous namespace)::$_0>(t={{.*}})
+# CHECK: frame int ns::foo<(anonymous namespace)::$_0>(t=(anonymous namespace)::(unnamed class) @ {{.*}})
 c
-# CHECK: frame int ns::foo>(t= Function = (anonymous namespace)::anon_bar() )
+# CHECK: frame int ns::

[Lldb-commits] [PATCH] D137272: [lldb][Test] Make TestFrameFormatNameWithArgs.test more compatible across platforms

2022-11-02 Thread Michael Buch via Phabricator via lldb-commits
Michael137 added a comment.
Herald added a subscriber: JDevlieghere.

Thanks for pointing this out @labath 
I think this should be enough to get it working on Linux (though unfortunately 
I don't have a Linux machine handy to test this on)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137272

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


[Lldb-commits] [lldb] 13cd390 - [lldb] Add information on type systems to statistics dump command

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

Author: Alex Langford
Date: 2022-11-02T10:45:56-07:00
New Revision: 13cd39017de07a116c8901904fd4cf7aa290a47c

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

LOG: [lldb] Add information on type systems to statistics dump command

Context: I plan on using this change primarily downstream in the apple
fork of llvm to track swift module loading time.

Reviewed By: clayborg, tschuett

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

Added: 


Modified: 
lldb/include/lldb/Core/Module.h
lldb/include/lldb/Symbol/TypeSystem.h
lldb/include/lldb/Target/Statistics.h
lldb/source/Core/Module.cpp
lldb/source/Symbol/TypeSystem.cpp
lldb/source/Target/Statistics.cpp

Removed: 




diff  --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h
index e877a14dcda10..523e04c6e6b4c 100644
--- a/lldb/include/lldb/Core/Module.h
+++ b/lldb/include/lldb/Core/Module.h
@@ -29,6 +29,7 @@
 #include "lldb/lldb-types.h"
 
 #include "llvm/ADT/DenseSet.h"
+#include "llvm/ADT/STLFunctionalExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Chrono.h"
 
@@ -814,6 +815,8 @@ class Module : public std::enable_shared_from_this,
   llvm::Expected
   GetTypeSystemForLanguage(lldb::LanguageType language);
 
+  void ForEachTypeSystem(llvm::function_ref callback);
+
   // Special error functions that can do printf style formatting that will
   // prepend the message with something appropriate for this module (like the
   // architecture, path and object name (if any)). This centralizes code so

diff  --git a/lldb/include/lldb/Symbol/TypeSystem.h 
b/lldb/include/lldb/Symbol/TypeSystem.h
index fd31b130c4ffd..0da0e35a4f9ca 100644
--- a/lldb/include/lldb/Symbol/TypeSystem.h
+++ b/lldb/include/lldb/Symbol/TypeSystem.h
@@ -19,6 +19,7 @@
 #include "llvm/ADT/SmallBitVector.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/Error.h"
+#include "llvm/Support/JSON.h"
 
 #include "lldb/Core/PluginInterface.h"
 #include "lldb/Expression/Expression.h"
@@ -508,6 +509,8 @@ class TypeSystem : public PluginInterface {
   // meaningless type itself, instead preferring to use the dynamic type
   virtual bool IsMeaninglessWithoutDynamicResolution(void *type);
 
+  virtual llvm::Optional ReportStatistics();
+
 protected:
   SymbolFile *m_sym_file = nullptr;
 };

diff  --git a/lldb/include/lldb/Target/Statistics.h 
b/lldb/include/lldb/Target/Statistics.h
index db6494ce7899e..4bf2f3a69c9b1 100644
--- a/lldb/include/lldb/Target/Statistics.h
+++ b/lldb/include/lldb/Target/Statistics.h
@@ -12,6 +12,7 @@
 #include "lldb/Utility/ConstString.h"
 #include "lldb/Utility/Stream.h"
 #include "lldb/lldb-forward.h"
+#include "llvm/ADT/StringMap.h"
 #include "llvm/Support/JSON.h"
 #include 
 #include 
@@ -107,6 +108,7 @@ struct ModuleStats {
   // identifiers of these modules in the global module list. This allows us to
   // track down all of the stats that contribute to this module.
   std::vector symfile_modules;
+  llvm::StringMap type_system_stats;
   double symtab_parse_time = 0.0;
   double symtab_index_time = 0.0;
   double debug_parse_time = 0.0;

diff  --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index d5b4621880dcd..20bd02f101fcc 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -369,6 +369,11 @@ Module::GetTypeSystemForLanguage(LanguageType language) {
   return m_type_system_map.GetTypeSystemForLanguage(language, this, true);
 }
 
+void Module::ForEachTypeSystem(
+llvm::function_ref callback) {
+  m_type_system_map.ForEach(callback);
+}
+
 void Module::ParseAllDebugSymbols() {
   std::lock_guard guard(m_mutex);
   size_t num_comp_units = GetNumCompileUnits();

diff  --git a/lldb/source/Symbol/TypeSystem.cpp 
b/lldb/source/Symbol/TypeSystem.cpp
index 412373533aaba..ae5ae5cbd659a 100644
--- a/lldb/source/Symbol/TypeSystem.cpp
+++ b/lldb/source/Symbol/TypeSystem.cpp
@@ -178,6 +178,10 @@ TypeSystem::CreateUtilityFunction(std::string text, 
std::string name) {
   return {};
 }
 
+llvm::Optional TypeSystem::ReportStatistics() {
+  return llvm::None;
+}
+
 #pragma mark TypeSystemMap
 
 TypeSystemMap::TypeSystemMap() : m_mutex(), m_map() {}

diff  --git a/lldb/source/Target/Statistics.cpp 
b/lldb/source/Target/Statistics.cpp
index 0ea09743d1300..118d6c396172c 100644
--- a/lldb/source/Target/Statistics.cpp
+++ b/lldb/source/Target/Statistics.cpp
@@ -75,6 +75,17 @@ json::Value ModuleStats::ToJSON() const {
   symfile_ids.emplace_back(symfile_id);
 module.try_emplace("symbolFileModuleIdentifiers", std::move(symfile_ids));
   }
+
+  if (!type_system_stats.empty()) {
+json::Array type_systems;
+for (const auto &entry : type_system_stats) {
+  json::Object obj;
+  obj.try_emplace(entry.first().str(), entry.second);

[Lldb-commits] [PATCH] D137191: [lldb] Add information on type systems to statistics dump command

2022-11-02 Thread Alex Langford via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG13cd39017de0: [lldb] Add information on type systems to 
statistics dump command (authored by bulbazord).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137191

Files:
  lldb/include/lldb/Core/Module.h
  lldb/include/lldb/Symbol/TypeSystem.h
  lldb/include/lldb/Target/Statistics.h
  lldb/source/Core/Module.cpp
  lldb/source/Symbol/TypeSystem.cpp
  lldb/source/Target/Statistics.cpp

Index: lldb/source/Target/Statistics.cpp
===
--- lldb/source/Target/Statistics.cpp
+++ lldb/source/Target/Statistics.cpp
@@ -75,6 +75,17 @@
   symfile_ids.emplace_back(symfile_id);
 module.try_emplace("symbolFileModuleIdentifiers", std::move(symfile_ids));
   }
+
+  if (!type_system_stats.empty()) {
+json::Array type_systems;
+for (const auto &entry : type_system_stats) {
+  json::Object obj;
+  obj.try_emplace(entry.first().str(), entry.second);
+  type_systems.emplace_back(std::move(obj));
+}
+module.try_emplace("typeSystemInfo", std::move(type_systems));
+  }
+
   return module;
 }
 
@@ -256,6 +267,11 @@
 debug_parse_time += module_stat.debug_parse_time;
 debug_index_time += module_stat.debug_index_time;
 debug_info_size += module_stat.debug_info_size;
+module->ForEachTypeSystem([&](TypeSystem *ts) {
+  if (auto stats = ts->ReportStatistics())
+module_stat.type_system_stats.insert({ts->GetPluginName(), *stats});
+  return true;
+});
 json_modules.emplace_back(module_stat.ToJSON());
   }
 
Index: lldb/source/Symbol/TypeSystem.cpp
===
--- lldb/source/Symbol/TypeSystem.cpp
+++ lldb/source/Symbol/TypeSystem.cpp
@@ -178,6 +178,10 @@
   return {};
 }
 
+llvm::Optional TypeSystem::ReportStatistics() {
+  return llvm::None;
+}
+
 #pragma mark TypeSystemMap
 
 TypeSystemMap::TypeSystemMap() : m_mutex(), m_map() {}
Index: lldb/source/Core/Module.cpp
===
--- lldb/source/Core/Module.cpp
+++ lldb/source/Core/Module.cpp
@@ -369,6 +369,11 @@
   return m_type_system_map.GetTypeSystemForLanguage(language, this, true);
 }
 
+void Module::ForEachTypeSystem(
+llvm::function_ref callback) {
+  m_type_system_map.ForEach(callback);
+}
+
 void Module::ParseAllDebugSymbols() {
   std::lock_guard guard(m_mutex);
   size_t num_comp_units = GetNumCompileUnits();
Index: lldb/include/lldb/Target/Statistics.h
===
--- lldb/include/lldb/Target/Statistics.h
+++ lldb/include/lldb/Target/Statistics.h
@@ -12,6 +12,7 @@
 #include "lldb/Utility/ConstString.h"
 #include "lldb/Utility/Stream.h"
 #include "lldb/lldb-forward.h"
+#include "llvm/ADT/StringMap.h"
 #include "llvm/Support/JSON.h"
 #include 
 #include 
@@ -107,6 +108,7 @@
   // identifiers of these modules in the global module list. This allows us to
   // track down all of the stats that contribute to this module.
   std::vector symfile_modules;
+  llvm::StringMap type_system_stats;
   double symtab_parse_time = 0.0;
   double symtab_index_time = 0.0;
   double debug_parse_time = 0.0;
Index: lldb/include/lldb/Symbol/TypeSystem.h
===
--- lldb/include/lldb/Symbol/TypeSystem.h
+++ lldb/include/lldb/Symbol/TypeSystem.h
@@ -19,6 +19,7 @@
 #include "llvm/ADT/SmallBitVector.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/Error.h"
+#include "llvm/Support/JSON.h"
 
 #include "lldb/Core/PluginInterface.h"
 #include "lldb/Expression/Expression.h"
@@ -508,6 +509,8 @@
   // meaningless type itself, instead preferring to use the dynamic type
   virtual bool IsMeaninglessWithoutDynamicResolution(void *type);
 
+  virtual llvm::Optional ReportStatistics();
+
 protected:
   SymbolFile *m_sym_file = nullptr;
 };
Index: lldb/include/lldb/Core/Module.h
===
--- lldb/include/lldb/Core/Module.h
+++ lldb/include/lldb/Core/Module.h
@@ -29,6 +29,7 @@
 #include "lldb/lldb-types.h"
 
 #include "llvm/ADT/DenseSet.h"
+#include "llvm/ADT/STLFunctionalExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Chrono.h"
 
@@ -814,6 +815,8 @@
   llvm::Expected
   GetTypeSystemForLanguage(lldb::LanguageType language);
 
+  void ForEachTypeSystem(llvm::function_ref callback);
+
   // Special error functions that can do printf style formatting that will
   // prepend the message with something appropriate for this module (like the
   // architecture, path and object name (if any)). This centralizes code so
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D137284: Override CalculateFrameVariableError in SymbolFileOnDemand

2022-11-02 Thread Yubo Hu via Phabricator via lldb-commits
GeorgeHuyubo created this revision.
Herald added a project: All.
GeorgeHuyubo requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D137284

Files:
  lldb/include/lldb/Symbol/SymbolFileOnDemand.h
  lldb/source/Symbol/SymbolFileOnDemand.cpp


Index: lldb/source/Symbol/SymbolFileOnDemand.cpp
===
--- lldb/source/Symbol/SymbolFileOnDemand.cpp
+++ lldb/source/Symbol/SymbolFileOnDemand.cpp
@@ -274,6 +274,10 @@
   return m_sym_file_impl->ResolveSymbolContext(so_addr, resolve_scope, sc);
 }
 
+Status SymbolFileOnDemand::CalculateFrameVariableError(StackFrame &frame) {
+  return m_sym_file_impl->CalculateFrameVariableError(frame);
+}
+
 uint32_t SymbolFileOnDemand::ResolveSymbolContext(
 const SourceLocationSpec &src_location_spec,
 SymbolContextItem resolve_scope, SymbolContextList &sc_list) {
Index: lldb/include/lldb/Symbol/SymbolFileOnDemand.h
===
--- lldb/include/lldb/Symbol/SymbolFileOnDemand.h
+++ lldb/include/lldb/Symbol/SymbolFileOnDemand.h
@@ -117,6 +117,9 @@
 lldb::SymbolContextItem resolve_scope,
 lldb_private::SymbolContext &sc) override;
 
+  lldb_private::Status
+  CalculateFrameVariableError(lldb_private::StackFrame &frame) override;
+
   uint32_t ResolveSymbolContext(
   const lldb_private::SourceLocationSpec &src_location_spec,
   lldb::SymbolContextItem resolve_scope,


Index: lldb/source/Symbol/SymbolFileOnDemand.cpp
===
--- lldb/source/Symbol/SymbolFileOnDemand.cpp
+++ lldb/source/Symbol/SymbolFileOnDemand.cpp
@@ -274,6 +274,10 @@
   return m_sym_file_impl->ResolveSymbolContext(so_addr, resolve_scope, sc);
 }
 
+Status SymbolFileOnDemand::CalculateFrameVariableError(StackFrame &frame) {
+  return m_sym_file_impl->CalculateFrameVariableError(frame);
+}
+
 uint32_t SymbolFileOnDemand::ResolveSymbolContext(
 const SourceLocationSpec &src_location_spec,
 SymbolContextItem resolve_scope, SymbolContextList &sc_list) {
Index: lldb/include/lldb/Symbol/SymbolFileOnDemand.h
===
--- lldb/include/lldb/Symbol/SymbolFileOnDemand.h
+++ lldb/include/lldb/Symbol/SymbolFileOnDemand.h
@@ -117,6 +117,9 @@
 lldb::SymbolContextItem resolve_scope,
 lldb_private::SymbolContext &sc) override;
 
+  lldb_private::Status
+  CalculateFrameVariableError(lldb_private::StackFrame &frame) override;
+
   uint32_t ResolveSymbolContext(
   const lldb_private::SourceLocationSpec &src_location_spec,
   lldb::SymbolContextItem resolve_scope,
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D137284: Override CalculateFrameVariableError in SymbolFileOnDemand

2022-11-02 Thread Wanyi Ye via Phabricator via lldb-commits
kusmour added a comment.

It'd be great to put some background in the summary.

The issue is introduced when adding Symbol OnDemand feature. We added a wrapper 
that ignore the error. And this affected the ability to populate the error when 
we have this feature turned on :D

(something like this, would be nice to link back to the symbol OnDemand patch 
as well)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137284

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


[Lldb-commits] [PATCH] D126260: [lldb/crashlog] Add support for Application Specific Backtraces & Information

2022-11-02 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib updated this revision to Diff 472756.
mib added a comment.

Update tests following changes in D135547 


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

https://reviews.llvm.org/D126260

Files:
  lldb/examples/python/crashlog.py
  lldb/examples/python/scripted_process/crashlog_scripted_process.py
  lldb/examples/python/scripted_process/scripted_process.py
  lldb/include/lldb/Interpreter/ScriptedProcessInterface.h
  lldb/include/lldb/Target/Process.h
  lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
  lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
  lldb/source/Plugins/Process/scripted/ScriptedProcess.h
  lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
  lldb/source/Plugins/Process/scripted/ScriptedThread.h
  
lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.h
  lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
  lldb/test/API/functionalities/process_crash_info/TestProcessCrashInfo.py
  
lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/application_specific_info/asi.ips
  
lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/application_specific_info/asi.yaml
  
lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/application_specific_info/main.m
  
lldb/test/Shell/ScriptInterpreter/Python/Crashlog/app_specific_backtrace_crashlog.test

Index: lldb/test/Shell/ScriptInterpreter/Python/Crashlog/app_specific_backtrace_crashlog.test
===
--- /dev/null
+++ lldb/test/Shell/ScriptInterpreter/Python/Crashlog/app_specific_backtrace_crashlog.test
@@ -0,0 +1,52 @@
+# REQUIRES: python, native && target-aarch64 && system-darwin
+
+# RUN: mkdir -p %t.dir
+# RUN: yaml2obj %S/Inputs/application_specific_info/asi.yaml > %t.dir/asi
+# RUN: %lldb -o 'command script import lldb.macosx.crashlog' \
+# RUN: -o 'crashlog -a -i -t %t.dir/asi %S/Inputs/application_specific_info/asi.ips' \
+# RUN: -o "thread list" -o "bt all" 2>&1 | FileCheck %s
+
+# CHECK: "crashlog" {{.*}} commands have been installed, use the "--help" options on these commands
+
+# CHECK: (lldb) process status --verbose
+# CHECK-NEXT: Process 96535 stopped
+# CHECK-NEXT: * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_CRASH (code=0, subcode=0x0)
+# CHECK-NEXT: frame #0: 0x0001a08c7224{{.*}}[artificial]
+# CHECK: Extended Crash Information:
+# CHECK:   Application Specific Information:
+# CHECK-NEXT: CoreFoundation: *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** __boundsFail: index 10 beyond bounds [0 .. 3]'
+# CHECK-NEXT: libc++abi.dylib: terminating with uncaught exception of type NSException
+# CHECK-NEXT: libsystem_c.dylib: abort() called
+
+
+# CHECK: (lldb) thread backtrace --extended true
+# CHECK-NEXT: * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_CRASH (code=0, subcode=0x0)
+# CHECK-NEXT:   * frame #0: 0x0001a08c7224{{.*}}[artificial]
+# CHECK-NEXT: frame #1: 0x0001a08fdceb{{.*}}[artificial]
+# CHECK-NEXT: frame #2: 0x0001a08372c7{{.*}}[artificial]
+# CHECK-NEXT: frame #3: 0x0001a08b7b17{{.*}}[artificial]
+# CHECK-NEXT: frame #4: 0x0001a08a7a0b{{.*}}[artificial]
+# CHECK-NEXT: frame #5: 0x0001a05ab763{{.*}}[artificial]
+# CHECK-NEXT: frame #6: 0x0001a08b6eb3{{.*}}[artificial]
+# CHECK-NEXT: frame #7: 0x0001a08b9c2b{{.*}}[artificial]
+# CHECK-NEXT: frame #8: 0x0001a08b9bd7{{.*}}[artificial]
+# CHECK-NEXT: frame #9: 0x0001a05a3007{{.*}}[artificial]
+# CHECK-NEXT: frame #10: 0x0001a0b3dcc3{{.*}}[artificial]
+# CHECK-NEXT: frame #11: 0x0001a0b46af3{{.*}}[artificial]
+# CHECK-NEXT: frame #12: 0x0001a09a12a3{{.*}}[artificial]
+# CHECK-NEXT: frame #13: 0x0001047e3ecf asi`main{{.*}}[artificial]
+# CHECK-NEXT: frame #14: 0x0001a05d3e4f{{.*}}[artificial]
+
+# CHECK:   thread #4294967295: tid = 0x0001, 0x0001a0a58418{{.*}}, queue = 'Application Specific Backtrace'
+# CHECK-NEXT: frame #0: 0x0001a0a58418{{.*}}
+# CHECK-NEXT: frame #1: 0x0001a05a2ea7{{.*}}
+# CHECK-NEXT: frame #2: 0x0001a0b3dcc3{{.*}}
+# CHECK-NEXT: frame #3: 0x0001a0b46af3{{.*}}
+# CHECK-NEXT: frame #4: 0x0001a09a12a3{{.*}}
+# CHECK-NEXT: frame #5: 0x0001047e3ecf asi`main{{.*}}
+# CHECK-NEXT: frame #6: 0x0001a05d3e4f dyld`start{{.*}}
+
+
+# CHECK: (lldb) thread list
+# CHECK-NEXT: Process 96535 stopped
+# CHECK-NEXT: * thread #1: tid = 0x1af8f3, 0x0001a08c7224{{.*}}, queue = 'com.apple.main-thread', stop reason = EXC_CRASH (code=0, subcode=0x0)
Index: 

[Lldb-commits] [PATCH] D137098: [lldb] Support simplified template names in the manual index

2022-11-02 Thread Arthur Eubanks via Phabricator via lldb-commits
aeubanks updated this revision to Diff 472770.
aeubanks added a comment.

move retry into SymbolFileDWARF
add tests for non-member functions


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137098

Files:
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/test/API/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py
  lldb/test/API/functionalities/breakpoint/cpp/main.cpp

Index: lldb/test/API/functionalities/breakpoint/cpp/main.cpp
===
--- lldb/test/API/functionalities/breakpoint/cpp/main.cpp
+++ lldb/test/API/functionalities/breakpoint/cpp/main.cpp
@@ -94,6 +94,8 @@
 
   template  void operator<<(T t) {}
 };
+
+template  void g() {}
 } // namespace ns
 
 int main (int argc, char const *argv[])
@@ -123,5 +125,8 @@
 f.operator<<(5);
 f.operator<< >({});
 
+ns::g();
+ns::g();
+
 return 0;
 }
Index: lldb/test/API/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py
===
--- lldb/test/API/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py
+++ lldb/test/API/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py
@@ -12,7 +12,16 @@
 
 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24764")
 def test(self):
-self.build()
+self.do_test(dict())
+
+@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24764")
+@skipIf(compiler=no_match("clang"))
+@skipIf(compiler_version=["<", "15.0"])
+def test_simple_template_names(self):
+self.do_test(dict(CFLAGS_EXTRAS="-gsimple-template-names"))
+
+def do_test(self, debug_flags):
+self.build(dictionary=debug_flags)
 self.breakpoint_id_tests()
 
 def verify_breakpoint_locations(self, target, bp_dict):
@@ -57,7 +66,11 @@
 
 # Template cases
 {'name': 'func', 'loc_names': []},
+{'name': 'Foo::func', 'loc_names': []},
+{'name': 'ns::Foo::func', 'loc_names': []},
 {'name': 'func', 'loc_names': ['auto ns::Foo::func()']},
+{'name': 'Foo::func', 'loc_names': ['auto ns::Foo::func()']},
+{'name': 'ns::Foo::func', 'loc_names': ['auto ns::Foo::func()']},
 {'name': 'func', 'loc_names': ['auto ns::Foo::func()',
'auto ns::Foo::func>()']},
 
@@ -71,6 +84,15 @@
 {'name': 'operator<<', 'loc_names': ['void ns::Foo::operator<<(int)']},
 {'name': 'ns::Foo::operator<<', 'loc_names': ['void ns::Foo::operator<<(int)',
   'void ns::Foo::operator<<>(ns::Foo)']},
+
+{'name': 'g', 'loc_names': []},
+{'name': 'g', 'loc_names': ['void ns::g()']},
+{'name': 'g', 'loc_names': ['void ns::g()']},
+{'name': 'g', 'loc_names': ['void ns::g()', 'void ns::g()']},
+{'name': 'ns::g', 'loc_names': []},
+{'name': 'ns::g', 'loc_names': ['void ns::g()']},
+{'name': 'ns::g', 'loc_names': ['void ns::g()']},
+{'name': 'ns::g', 'loc_names': ['void ns::g()', 'void ns::g()']},
 ]
 
 for bp_dict in bp_dicts:
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2389,6 +2389,24 @@
   ResolveFunction(die, include_inlines, sc_list);
 return true;
   });
+  // With -gsimple-template-names, a templated type's DW_AT_name will not
+  // contain the template parameters. Try again stripping '<' and anything
+  // after, filtering out entries with template parameters that don't match.
+  {
+const llvm::StringRef name_ref = name.GetStringRef();
+auto it = name_ref.find('<');
+if (it != llvm::StringRef::npos) {
+  const llvm::StringRef name_no_template_params = name_ref.slice(0, it);
+
+  Module::LookupInfo no_tp_lookup_info(lookup_info);
+  no_tp_lookup_info.SetLookupName(ConstString(name_no_template_params));
+  m_index->GetFunctions(no_tp_lookup_info, *this, parent_decl_ctx, [&](DWARFDIE die) {
+if (resolved_dies.insert(die.GetDIE()).second)
+  ResolveFunction(die, include_inlines, sc_list);
+return true;
+  });
+}
+  }
 
   // Return the number of variable that were appended to the list
   const uint32_t num_matches = sc_list.GetSize() - original_size;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D137098: [lldb] Support simplified template names in the manual index

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

In D137098#3902140 , @labath wrote:

> Why is it that the other indexes don't need an equivalent fix? Could it be 
> that you just haven't tried those code paths?
>
> If they do need it, then it'd be good if we could make the fix in a single 
> place. Possibly by putting the retry logic at a higher level?

Other indexes as in the other manual index indexes? Or as in other higher level 
indexes?




Comment at: lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp:450
   }
   if (name_type_mask & eFunctionNameTypeBase) {
 if (!m_set.function_basenames.Find(

labath wrote:
> Are you sure this doesn't need to be repeated for `eFunctionNameTypeBase`? 
> that's where non-member functions end up...
you're right, but I've moved this up into SymbolFileDWARF


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137098

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


[Lldb-commits] [PATCH] D136795: [LLDB] Add a `(not loaded) ` prefix to placeholder object filename to indicate they are not loaded.

2022-11-02 Thread Zequan Wu via Phabricator via lldb-commits
zequanwu added a comment.

Actually just changing the module's file spec make `image dump symtab 
/tmp/test/linux-x86_64` to fail because the extra string. I still prefer the 
previous version though `PlaceholderObjectFile` isn't first class plugin as we 
just checking the plugin name.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136795

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


[Lldb-commits] [PATCH] D137284: Override CalculateFrameVariableError in SymbolFileOnDemand

2022-11-02 Thread jeffrey tan via Phabricator via lldb-commits
yinghuitan requested changes to this revision.
yinghuitan added inline comments.
This revision now requires changes to proceed.



Comment at: lldb/include/lldb/Symbol/SymbolFileOnDemand.h:121
+  lldb_private::Status
+  CalculateFrameVariableError(lldb_private::StackFrame &frame) override;
+

Please add a unit test which should fail in symbol on-demand mode but succeeds 
after your patch. Checkout Greg's original test checking frame variable error 
as example.



Comment at: lldb/source/Symbol/SymbolFileOnDemand.cpp:277-279
+Status SymbolFileOnDemand::CalculateFrameVariableError(StackFrame &frame) {
+  return m_sym_file_impl->CalculateFrameVariableError(frame);
+}

You should only forward to underlying 
`m_sym_file_impl->CalculateFrameVariableError()` when `m_debug_info_enabled` is 
true otherwise it will trigger parsing of debug info. Follow the pattern in 
other methods of this file.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137284

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


[Lldb-commits] [PATCH] D84974: Enable Launching the Debugee in VSCode Terminal

2022-11-02 Thread Arthur Eubanks via Phabricator via lldb-commits
aeubanks added a comment.
Herald added a project: All.

the added test `TestVSCode_runInTerminal` consistently fails for me locally with

  Failed to attach to the target process. Timed out trying to get messages from 
the runInTerminal launcher

I've asked other people and they've also reported consistent (or flaky) 
failures of this test. Any idea of what could be going wrong?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84974

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


[Lldb-commits] [PATCH] D134066: [LLDB][NativePDB] Forcefully complete a record type it has incomplete type debug info.

2022-11-02 Thread Zequan Wu via Phabricator via lldb-commits
zequanwu abandoned this revision.
zequanwu added a comment.

It shouldn't reach the code path to complete a class with empty debug info.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134066

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


[Lldb-commits] [PATCH] D137301: PlatformDarwinKernel::GetSupportedArchitectures should report all supported architectures

2022-11-02 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda created this revision.
jasonmolenda added a reviewer: JDevlieghere.
jasonmolenda added a project: LLDB.
Herald added subscribers: pengfei, kristof.beyls.
Herald added a project: All.
jasonmolenda requested review of this revision.
Herald added a subscriber: lldb-commits.

PlatformDarwinKernel had an old idiom in its GetSupportedArchitectures method, 
which would turn the list of supported architectures based on the compile-time 
debug host.  This doesn't make any sense; you can debug an arm kernel from an 
x86 mac, but it usually didn't cause any obvious problems so it went unnoticed. 
 Fix that.

Also some NFC changes to Target::SetArchitecture log messages, to make it 
easier to track the Target's architecture as it is refined/updated.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D137301

Files:
  lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
  lldb/source/Target/Target.cpp


Index: lldb/source/Target/Target.cpp
===
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -1436,7 +1436,8 @@
 if (!m_arch.GetSpec().IsValid()) {
   m_arch = executable_sp->GetArchitecture();
   LLDB_LOG(log,
-   "setting architecture to {0} ({1}) based on executable file",
+   "Target::SetExecutableModule setting architecture to {0} ({1}) "
+   "based on executable file",
m_arch.GetSpec().GetArchitectureName(),
m_arch.GetSpec().GetTriple().getTriple());
 }
@@ -1536,7 +1537,9 @@
 // specified
 if (replace_local_arch)
   m_arch = other;
-LLDB_LOG(log, "set architecture to {0} ({1})",
+LLDB_LOG(log,
+ "Target::SetArchitecture merging compatible arch; arch "
+ "is now {0} ({1})",
  m_arch.GetSpec().GetArchitectureName(),
  m_arch.GetSpec().GetTriple().getTriple());
 return true;
@@ -1544,9 +1547,13 @@
 
   // If we have an executable file, try to reset the executable to the desired
   // architecture
-  LLDB_LOGF(log, "Target::SetArchitecture changing architecture to %s (%s)",
-arch_spec.GetArchitectureName(),
-arch_spec.GetTriple().getTriple().c_str());
+  LLDB_LOGF(
+  log,
+  "Target::SetArchitecture changing architecture to %s (%s) from %s (%s)",
+  arch_spec.GetArchitectureName(),
+  arch_spec.GetTriple().getTriple().c_str(),
+  m_arch.GetSpec().GetArchitectureName(),
+  m_arch.GetSpec().GetTriple().getTriple().c_str());
   m_arch = other;
   ModuleSP executable_sp = GetExecutableModule();
 
Index: lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
===
--- lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
+++ lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
@@ -986,11 +986,8 @@
 std::vector PlatformDarwinKernel::GetSupportedArchitectures(
 const ArchSpec &process_host_arch) {
   std::vector result;
-#if defined(__arm__) || defined(__arm64__) || defined(__aarch64__)
   ARMGetSupportedArchitectures(result);
-#else
   x86GetSupportedArchitectures(result);
-#endif
   return result;
 }
 


Index: lldb/source/Target/Target.cpp
===
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -1436,7 +1436,8 @@
 if (!m_arch.GetSpec().IsValid()) {
   m_arch = executable_sp->GetArchitecture();
   LLDB_LOG(log,
-   "setting architecture to {0} ({1}) based on executable file",
+   "Target::SetExecutableModule setting architecture to {0} ({1}) "
+   "based on executable file",
m_arch.GetSpec().GetArchitectureName(),
m_arch.GetSpec().GetTriple().getTriple());
 }
@@ -1536,7 +1537,9 @@
 // specified
 if (replace_local_arch)
   m_arch = other;
-LLDB_LOG(log, "set architecture to {0} ({1})",
+LLDB_LOG(log,
+ "Target::SetArchitecture merging compatible arch; arch "
+ "is now {0} ({1})",
  m_arch.GetSpec().GetArchitectureName(),
  m_arch.GetSpec().GetTriple().getTriple());
 return true;
@@ -1544,9 +1547,13 @@
 
   // If we have an executable file, try to reset the executable to the desired
   // architecture
-  LLDB_LOGF(log, "Target::SetArchitecture changing architecture to %s (%s)",
-arch_spec.GetArchitectureName(),
-arch_spec.GetTriple().getTriple().c_str());
+  LLDB_LOGF(
+  log,
+  "Target::SetArchitecture changing architecture to %s (%s) from %s (%s)",
+  arch_spec.GetArchitectureName(),
+  arch_spec.GetTriple().getTriple().c_str(),
+  m_arch.GetSpec().GetArchitectureName(),
+  m_arch.GetSpec().GetTriple().getTriple().c_str());
   m_arch = other;
   ModuleSP executable_sp = GetExecutableModule();
 
Index: lldb/source/Plugins/Platform/MacOSX/

[Lldb-commits] [PATCH] D137301: PlatformDarwinKernel::GetSupportedArchitectures should report all supported architectures

2022-11-02 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda added a comment.

I should note that `PlatformDarwin::ARMGetSupportedArchitectures` and 
`PlatformDarwin::x86GetSupportedArchitectures` append the entries to the vector 
passed in, so calling them in sequence is fine.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137301

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


[Lldb-commits] [PATCH] D137284: Override CalculateFrameVariableError in SymbolFileOnDemand

2022-11-02 Thread Yubo Hu via Phabricator via lldb-commits
GeorgeHuyubo updated this revision to Diff 472810.
GeorgeHuyubo marked 2 inline comments as done.
GeorgeHuyubo added a comment.

Address comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137284

Files:
  lldb/include/lldb/Symbol/SymbolFileOnDemand.h
  lldb/source/Symbol/SymbolFileOnDemand.cpp
  lldb/test/API/tools/lldb-vscode/variables/TestVSCode_variables.py


Index: lldb/test/API/tools/lldb-vscode/variables/TestVSCode_variables.py
===
--- lldb/test/API/tools/lldb-vscode/variables/TestVSCode_variables.py
+++ lldb/test/API/tools/lldb-vscode/variables/TestVSCode_variables.py
@@ -559,3 +559,46 @@
 }
 varref_dict = {}
 self.verify_variables(verify_locals, locals, varref_dict)
+
+
+@no_debug_info_test
+@skipUnlessDarwin
+def test_darwin_dwarf_missing_obj_with_symbol_ondemand_enabled(self):
+'''
+Test that if we build a binary with DWARF in .o files and we remove
+the .o file for main.cpp, that we get a variable named ""
+whose value matches the appriopriate error. Test with 
symbol_ondemand_enabled.
+'''
+self.build(debug_info="dwarf")
+program = self.getBuildArtifact("a.out")
+main_obj = self.getBuildArtifact("main.o")
+self.assertTrue(os.path.exists(main_obj))
+# Delete the main.o file that contains the debug info so we force an
+# error when we run to main and try to get variables
+os.unlink(main_obj)
+
+self.create_debug_adaptor()
+self.assertTrue(os.path.exists(program), 'executable must exist')
+
+initCommands = ['settings set symbols.load-on-demand true']
+self.launch(program=program,
+initCommands=initCommands)
+
+functions = ['main']
+breakpoint_ids = self.set_function_breakpoints(functions)
+self.assertEquals(len(breakpoint_ids), len(functions), "expect one 
breakpoint")
+self.continue_to_breakpoints(breakpoint_ids)
+
+locals = self.vscode.get_local_variables()
+
+verify_locals = {
+'': {
+'equals': {'type': 'const char *'},
+'contains': { 'value': [
+'debug map object file ',
+'main.o" containing debug info does not exist, debug info 
will not be loaded']
+}
+},
+}
+varref_dict = {}
+self.verify_variables(verify_locals, locals, varref_dict)
Index: lldb/source/Symbol/SymbolFileOnDemand.cpp
===
--- lldb/source/Symbol/SymbolFileOnDemand.cpp
+++ lldb/source/Symbol/SymbolFileOnDemand.cpp
@@ -274,6 +274,15 @@
   return m_sym_file_impl->ResolveSymbolContext(so_addr, resolve_scope, sc);
 }
 
+Status SymbolFileOnDemand::CalculateFrameVariableError(StackFrame &frame) {
+  if (!m_debug_info_enabled) {
+LLDB_LOG(GetLog(), "[{0}] {1} is skipped", GetSymbolFileName(),
+ __FUNCTION__);
+return this->CalculateFrameVariableError(frame);
+  }
+  return m_sym_file_impl->CalculateFrameVariableError(frame);
+}
+
 uint32_t SymbolFileOnDemand::ResolveSymbolContext(
 const SourceLocationSpec &src_location_spec,
 SymbolContextItem resolve_scope, SymbolContextList &sc_list) {
Index: lldb/include/lldb/Symbol/SymbolFileOnDemand.h
===
--- lldb/include/lldb/Symbol/SymbolFileOnDemand.h
+++ lldb/include/lldb/Symbol/SymbolFileOnDemand.h
@@ -117,6 +117,9 @@
 lldb::SymbolContextItem resolve_scope,
 lldb_private::SymbolContext &sc) override;
 
+  lldb_private::Status
+  CalculateFrameVariableError(lldb_private::StackFrame &frame) override;
+
   uint32_t ResolveSymbolContext(
   const lldb_private::SourceLocationSpec &src_location_spec,
   lldb::SymbolContextItem resolve_scope,


Index: lldb/test/API/tools/lldb-vscode/variables/TestVSCode_variables.py
===
--- lldb/test/API/tools/lldb-vscode/variables/TestVSCode_variables.py
+++ lldb/test/API/tools/lldb-vscode/variables/TestVSCode_variables.py
@@ -559,3 +559,46 @@
 }
 varref_dict = {}
 self.verify_variables(verify_locals, locals, varref_dict)
+
+
+@no_debug_info_test
+@skipUnlessDarwin
+def test_darwin_dwarf_missing_obj_with_symbol_ondemand_enabled(self):
+'''
+Test that if we build a binary with DWARF in .o files and we remove
+the .o file for main.cpp, that we get a variable named ""
+whose value matches the appriopriate error. Test with symbol_ondemand_enabled.
+'''
+self.build(debug_info="dwarf")
+program = self.getBuildArtifact("a.out")
+main_obj = self.getB

[Lldb-commits] [PATCH] D135631: [lldb] Copy log files into diagnostic directory (RFC)

2022-11-02 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 472812.
JDevlieghere marked an inline comment as done.
JDevlieghere added a comment.

Rebase


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

https://reviews.llvm.org/D135631

Files:
  lldb/source/Core/Debugger.cpp
  lldb/test/Shell/Diagnostics/Inputs/TestCopyLogs.in
  lldb/test/Shell/Diagnostics/TestCopyLogs.test


Index: lldb/test/Shell/Diagnostics/TestCopyLogs.test
===
--- /dev/null
+++ lldb/test/Shell/Diagnostics/TestCopyLogs.test
@@ -0,0 +1,10 @@
+# RUN: rm -rf %t
+# RUN: mkdir -p %t
+
+# Prevent lit from substituting 'lldb'
+# RUN: %python -c 'print("log enable " + "".join(["l", "l", "d", "b"]) + " 
commands -f %t/commands.log")' > %t.in
+
+# RUN: %lldb -s %t.in -o 'diagnostics dump -d %t/diags'
+
+# RUN: cat %t/diags/commands.log | FileCheck %s
+# CHECK: Processing command: diagnostics dump
Index: lldb/test/Shell/Diagnostics/Inputs/TestCopyLogs.in
===
--- /dev/null
+++ lldb/test/Shell/Diagnostics/Inputs/TestCopyLogs.in
@@ -0,0 +1 @@
+log enable lldb commands -f %t/commands.log
Index: lldb/source/Core/Debugger.cpp
===
--- lldb/source/Core/Debugger.cpp
+++ lldb/source/Core/Debugger.cpp
@@ -810,6 +810,22 @@
   if (!GetOutputFile().GetIsTerminalWithColors())
 SetUseColor(false);
 
+  if (Diagnostics::Enabled()) {
+Diagnostics::Instance().AddCallback(
+[&](const FileSpec &dir) -> llvm::Error {
+  for (auto &entry : m_stream_handlers) {
+llvm::StringRef log_path = entry.first();
+llvm::StringRef file_name = llvm::sys::path::filename(log_path);
+FileSpec destination = dir.CopyByAppendingPathComponent(file_name);
+std::error_code ec =
+llvm::sys::fs::copy_file(entry.first(), destination.GetPath());
+if (ec)
+  return llvm::errorCodeToError(ec);
+  }
+  return llvm::Error::success();
+});
+  }
+
 #if defined(_WIN32) && defined(ENABLE_VIRTUAL_TERMINAL_PROCESSING)
   // Enabling use of ANSI color codes because LLDB is using them to highlight
   // text.


Index: lldb/test/Shell/Diagnostics/TestCopyLogs.test
===
--- /dev/null
+++ lldb/test/Shell/Diagnostics/TestCopyLogs.test
@@ -0,0 +1,10 @@
+# RUN: rm -rf %t
+# RUN: mkdir -p %t
+
+# Prevent lit from substituting 'lldb'
+# RUN: %python -c 'print("log enable " + "".join(["l", "l", "d", "b"]) + " commands -f %t/commands.log")' > %t.in
+
+# RUN: %lldb -s %t.in -o 'diagnostics dump -d %t/diags'
+
+# RUN: cat %t/diags/commands.log | FileCheck %s
+# CHECK: Processing command: diagnostics dump
Index: lldb/test/Shell/Diagnostics/Inputs/TestCopyLogs.in
===
--- /dev/null
+++ lldb/test/Shell/Diagnostics/Inputs/TestCopyLogs.in
@@ -0,0 +1 @@
+log enable lldb commands -f %t/commands.log
Index: lldb/source/Core/Debugger.cpp
===
--- lldb/source/Core/Debugger.cpp
+++ lldb/source/Core/Debugger.cpp
@@ -810,6 +810,22 @@
   if (!GetOutputFile().GetIsTerminalWithColors())
 SetUseColor(false);
 
+  if (Diagnostics::Enabled()) {
+Diagnostics::Instance().AddCallback(
+[&](const FileSpec &dir) -> llvm::Error {
+  for (auto &entry : m_stream_handlers) {
+llvm::StringRef log_path = entry.first();
+llvm::StringRef file_name = llvm::sys::path::filename(log_path);
+FileSpec destination = dir.CopyByAppendingPathComponent(file_name);
+std::error_code ec =
+llvm::sys::fs::copy_file(entry.first(), destination.GetPath());
+if (ec)
+  return llvm::errorCodeToError(ec);
+  }
+  return llvm::Error::success();
+});
+  }
+
 #if defined(_WIN32) && defined(ENABLE_VIRTUAL_TERMINAL_PROCESSING)
   // Enabling use of ANSI color codes because LLDB is using them to highlight
   // text.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D137301: PlatformDarwinKernel::GetSupportedArchitectures should report all supported architectures

2022-11-02 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

LGTM




Comment at: lldb/source/Target/Target.cpp:1550-1556
+  LLDB_LOGF(
+  log,
+  "Target::SetArchitecture changing architecture to %s (%s) from %s (%s)",
+  arch_spec.GetArchitectureName(),
+  arch_spec.GetTriple().getTriple().c_str(),
+  m_arch.GetSpec().GetArchitectureName(),
+  m_arch.GetSpec().GetTriple().getTriple().c_str());

If you use `LLDB_LOG` you could drop the `.c_str()`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137301

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


[Lldb-commits] [PATCH] D137312: [LLDB] [LoongArch] Add loongarch64 case in ComputeHostArchitectureSupport()

2022-11-02 Thread Tiezhu Yang via Phabricator via lldb-commits
seehearfeel created this revision.
seehearfeel added reviewers: SixWeining, wangleiat, xen0n, xry111, MaskRay, 
DavidSpickett.
Herald added a subscriber: StephenFan.
Herald added a project: All.
seehearfeel requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

This is a simple change, loongarch64 host also supports 32-bit binaries,
so note it.

Without this patch:

  [loongson@linux build]$ ./tools/lldb/unittests/Host/HostTests | tail -6
  [==] 78 tests from 18 test suites ran. (16 ms total)
  [  PASSED  ] 77 tests.
  [  FAILED  ] 1 test, listed below:
  [  FAILED  ] HostTest.GetProcessInfo
  
   1 FAILED TEST

With this patch:

  [loongson@linux build]$ ./tools/lldb/unittests/Host/HostTests | tail -2
  [==] 78 tests from 18 test suites ran. (15 ms total)
  [  PASSED  ] 78 tests.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D137312

Files:
  lldb/source/Host/common/HostInfoBase.cpp


Index: lldb/source/Host/common/HostInfoBase.cpp
===
--- lldb/source/Host/common/HostInfoBase.cpp
+++ lldb/source/Host/common/HostInfoBase.cpp
@@ -340,6 +340,7 @@
   case llvm::Triple::ppc64le:
   case llvm::Triple::x86_64:
   case llvm::Triple::riscv64:
+  case llvm::Triple::loongarch64:
 arch_64.SetTriple(triple);
 arch_32.SetTriple(triple.get32BitArchVariant());
 break;


Index: lldb/source/Host/common/HostInfoBase.cpp
===
--- lldb/source/Host/common/HostInfoBase.cpp
+++ lldb/source/Host/common/HostInfoBase.cpp
@@ -340,6 +340,7 @@
   case llvm::Triple::ppc64le:
   case llvm::Triple::x86_64:
   case llvm::Triple::riscv64:
+  case llvm::Triple::loongarch64:
 arch_64.SetTriple(triple);
 arch_32.SetTriple(triple.get32BitArchVariant());
 break;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D137287: [Test] Fix CHECK typo.

2022-11-02 Thread Zequan Wu via Phabricator via lldb-commits
zequanwu updated this revision to Diff 472833.
zequanwu added a comment.
Herald added subscribers: lldb-commits, nemanjai.
Herald added projects: LLDB, clang-tools-extra, Flang.

Fix more typos.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137287

Files:
  
clang-tools-extra/test/clang-apply-replacements/Inputs/ignore-conflict/ignore-conflict.cpp
  clang/test/CodeGenCoroutines/pr56329.cpp
  clang/test/OpenMP/omp_with_loop_pragma_instr_profile.c
  clang/test/OpenMP/target_parallel_for_codegen.cpp
  flang/test/Lower/ext-proc-as-actual-argument-1.f90
  flang/test/Lower/ext-proc-as-actual-argument-2.f90
  flang/test/Lower/fail_image.f90
  lldb/test/Shell/SymbolFile/NativePDB/inline_sites.test
  llvm/test/CodeGen/PowerPC/livevars-crash2.mir
  llvm/test/CodeGen/PowerPC/phi-eliminate.mir
  llvm/test/CodeGen/PowerPC/vsx-args.ll
  llvm/test/DebugInfo/MIR/InstrRef/pick-vphi-in-shifting-loop.mir
  llvm/test/MC/WebAssembly/tag-section-decoding.ll
  llvm/test/MC/WebAssembly/type-checker-emit-after-unreachable.s
  llvm/test/Transforms/Coroutines/coro-debug.ll
  llvm/test/tools/llvm-profgen/recursion-compression-pseudoprobe.test
  mlir/test/Conversion/MathToSPIRV/math-to-gl-spirv.mlir
  mlir/test/Dialect/MemRef/canonicalize.mlir
  mlir/test/Dialect/Tensor/canonicalize.mlir
  mlir/test/python/ir/affine_expr.py

Index: mlir/test/python/ir/affine_expr.py
===
--- mlir/test/python/ir/affine_expr.py
+++ mlir/test/python/ir/affine_expr.py
@@ -116,7 +116,7 @@
 
 # CHECK: 2
 print(s2.position)
-# CHEKC: s2
+# CHECK: s2
 print(s2)
 
 assert s1 == s11
Index: mlir/test/Dialect/Tensor/canonicalize.mlir
===
--- mlir/test/Dialect/Tensor/canonicalize.mlir
+++ mlir/test/Dialect/Tensor/canonicalize.mlir
@@ -353,7 +353,7 @@
 //  CHECK-SAME:  [4, 1, %{{[a-zA-Z0-9_]+}}] [1, 1, 1]
 //  CHECK-SAME:  : tensor to tensor<4x1x?xf32>
 //   CHECK:   %[[RESULT:.+]] = tensor.cast %[[SLICE]]
-//   CHEKC:   return %[[RESULT]]
+//   CHECK:   return %[[RESULT]]
 
 // -
 
@@ -372,7 +372,7 @@
 //  CHECK-SAME:  [4, 1, %{{[a-zA-Z0-9_]+}}] [1, 1, 1]
 //  CHECK-SAME:  : tensor to tensor<4x?xf32>
 //   CHECK:   %[[RESULT:.+]] = tensor.cast %[[SLICE]]
-//   CHEKC:   return %[[RESULT]]
+//   CHECK:   return %[[RESULT]]
 
 // -
 
@@ -467,7 +467,7 @@
 //   CHECK:   %[[RESULT:.+]] = tensor.insert_slice %[[SLICE]]
 //  CHECK-SAME:  [0, %{{.+}}, 1] [4, 1, %{{.+}}] [1, 1, 1]
 //  CHECK-SAME:  : tensor<4x1x?xf32> into tensor
-//   CHEKC:   return %[[RESULT]]
+//   CHECK:   return %[[RESULT]]
 
 // -
 
@@ -486,7 +486,7 @@
 //   CHECK:   %[[RESULT:.+]] = tensor.insert_slice %[[CAST]]
 //  CHECK-SAME:  [0, %{{.+}}, 1] [4, 1, %{{.+}}] [1, 1, 1]
 //  CHECK-SAME:  : tensor<4x?xf32> into tensor
-//   CHEKC:   return %[[RESULT]]
+//   CHECK:   return %[[RESULT]]
 
 // -
 
@@ -509,7 +509,7 @@
 //   CHECK:   %[[RESULT:.+]] = tensor.insert_slice %[[SLICE]] into %[[ARG3]]
 //  CHECK-SAME:  [0, %{{.+}}, 1] [4, 1, %{{.+}}] [1, 1, 1]
 //  CHECK-SAME:  : tensor<4x?xf32> into tensor
-//   CHEKC:   return %[[RESULT]]
+//   CHECK:   return %[[RESULT]]
 
 // -
 
Index: mlir/test/Dialect/MemRef/canonicalize.mlir
===
--- mlir/test/Dialect/MemRef/canonicalize.mlir
+++ mlir/test/Dialect/MemRef/canonicalize.mlir
@@ -57,7 +57,7 @@
 //  CHECK-SAME:  [4, 1, %{{[a-zA-Z0-9_]+}}] [1, 1, 1]
 //  CHECK-SAME:  : memref to memref<4x1x?xf32
 //   CHECK:   %[[RESULT:.+]] = memref.cast %[[SUBVIEW]]
-//   CHEKC:   return %[[RESULT]]
+//   CHECK:   return %[[RESULT]]
 
 // -
 
Index: mlir/test/Conversion/MathToSPIRV/math-to-gl-spirv.mlir
===
--- mlir/test/Conversion/MathToSPIRV/math-to-gl-spirv.mlir
+++ mlir/test/Conversion/MathToSPIRV/math-to-gl-spirv.mlir
@@ -148,7 +148,7 @@
 // CHECK-LABEL: @powf_vector
 func.func @powf_vector(%lhs: vector<4xf32>, %rhs: vector<4xf32>) -> vector<4xf32> {
   // CHECK: spirv.FOrdLessThan
-  // CHEKC: spirv.GL.FAbs
+  // CHECK: spirv.GL.FAbs
   // CHECK: spirv.GL.Pow %{{.*}}: vector<4xf32>
   // CHECK: spirv.FNegate
   // CHECK: spirv.Select
Index: llvm/test/tools/llvm-profgen/recursion-compression-pseudoprobe.test
===
--- llvm/test/tools/llvm-profgen/recursion-compression-pseudoprobe.test
+++ llvm/test/tools/llvm-profgen/recursion-compression-pseudoprobe.test
@@ -91,7 +91,7 @@
 ; CHECK:  1: 4
 ; CHECK:  2: 3
 ; CHECK:  3: 1
-; CEHCK:  5: 4 fb:4
+; CHECK:  5: 4 fb:4
 ; CHECK:  6: 1 fa:1
 ; CHECK !CFGChecksum: 563022570642068
 ; CHECK: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:6 @ fa:8 @ fa:7 @ fb:6 @ fa]:6:2
Ind

[Lldb-commits] [PATCH] D137312: [LLDB] [LoongArch] Add loongarch64 case in ComputeHostArchitectureSupport()

2022-11-02 Thread WÁNG Xuěruì via Phabricator via lldb-commits
xen0n accepted this revision.
xen0n added a comment.
This revision is now accepted and ready to land.

Trivially correct. `CONFIG_COMPAT` isn't yet supported by upstream Linux 
though, but preemptively adding LoongArch here won't do any harm.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137312

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