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

2021-06-10 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

Let me know if this goes into the right direction.


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

https://reviews.llvm.org/D103575

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


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

2021-06-10 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl updated this revision to Diff 351332.
aprantl added a comment.

Address review feedback from @JDevlieghere.


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

https://reviews.llvm.org/D103575

Files:
  lldb/include/lldb/Utility/Timer.h
  lldb/source/Utility/Timer.cpp
  llvm/include/llvm/Support/Signposts.h
  llvm/lib/Support/Signposts.cpp
  llvm/lib/Support/Timer.cpp

Index: llvm/lib/Support/Timer.cpp
===
--- llvm/lib/Support/Timer.cpp
+++ llvm/lib/Support/Timer.cpp
@@ -174,7 +174,7 @@
   Running = false;
   Time += TimeRecord::getCurrentTime(false);
   Time -= StartTime;
-  Signposts->endInterval(this, getName());
+  Signposts->endInterval(this);
 }
 
 void Timer::clear() {
Index: llvm/lib/Support/Signposts.cpp
===
--- llvm/lib/Support/Signposts.cpp
+++ llvm/lib/Support/Signposts.cpp
@@ -10,19 +10,14 @@
 #include "llvm/Support/Signposts.h"
 #include "llvm/Support/Timer.h"
 
-#include "llvm/Config/config.h"
 #if LLVM_SUPPORT_XCODE_SIGNPOSTS
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/Support/Mutex.h"
-#include 
-#include 
 #endif // if LLVM_SUPPORT_XCODE_SIGNPOSTS
 
 using namespace llvm;
 
 #if LLVM_SUPPORT_XCODE_SIGNPOSTS
-#define SIGNPOSTS_AVAILABLE()  \
-  __builtin_available(macos 10.14, iOS 12, tvOS 12, watchOS 5, *)
 namespace {
 os_log_t *LogCreator() {
   os_log_t *X = new os_log_t;
@@ -40,13 +35,13 @@
 namespace llvm {
 class SignpostEmitterImpl {
   using LogPtrTy = std::unique_ptr;
-  using LogTy = LogPtrTy::element_type;
 
   LogPtrTy SignpostLog;
   DenseMap Signposts;
   sys::SmartMutex Mutex;
 
-  LogTy () const { return *SignpostLog; }
+public:
+  os_log_t () const { return *SignpostLog; }
   os_signpost_id_t getSignpostForObject(const void *O) {
 sys::SmartScopedLock Lock(Mutex);
 const auto  = Signposts.find(O);
@@ -60,7 +55,6 @@
 return Inserted.first->second;
   }
 
-public:
   SignpostEmitterImpl() : SignpostLog(LogCreator()) {}
 
   bool isEnabled() const {
@@ -79,7 +73,7 @@
 }
   }
 
-  void endInterval(const void *O, llvm::StringRef Name) {
+  void endInterval(const void *O) {
 if (isEnabled()) {
   if (SIGNPOSTS_AVAILABLE()) {
 // Both strings used here are required to be constant literal strings.
@@ -125,10 +119,17 @@
 #endif // if !HAVE_ANY_SIGNPOST_IMPL
 }
 
-void SignpostEmitter::endInterval(const void *O, StringRef Name) {
+#if HAVE_ANY_SIGNPOST_IMPL
+os_log_t ::getLogger() const { return Impl->getLogger(); }
+os_signpost_id_t SignpostEmitter::getSignpostForObject(const void *O) {
+  return Impl->getSignpostForObject(O);
+}
+#endif
+
+void SignpostEmitter::endInterval(const void *O) {
 #if HAVE_ANY_SIGNPOST_IMPL
   if (Impl == nullptr)
 return;
-  Impl->endInterval(O, Name);
+  Impl->endInterval(O);
 #endif // if !HAVE_ANY_SIGNPOST_IMPL
 }
Index: llvm/include/llvm/Support/Signposts.h
===
--- llvm/include/llvm/Support/Signposts.h
+++ llvm/include/llvm/Support/Signposts.h
@@ -18,8 +18,17 @@
 #define LLVM_SUPPORT_SIGNPOSTS_H
 
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Config/config.h"
 #include 
 
+#if LLVM_SUPPORT_XCODE_SIGNPOSTS
+#include 
+#include 
+#endif
+
+#define SIGNPOSTS_AVAILABLE()  \
+  __builtin_available(macos 10.14, iOS 12, tvOS 12, watchOS 5, *)
+
 namespace llvm {
 class SignpostEmitterImpl;
 
@@ -36,8 +45,27 @@
 
   /// Begin a signposted interval for a given object.
   void startInterval(const void *O, StringRef Name);
+
+#if LLVM_SUPPORT_XCODE_SIGNPOSTS
+  os_log_t () const;
+  os_signpost_id_t getSignpostForObject(const void *O);
+#endif
+
+  /// A macro to take advantage of the special format string handling
+  /// in the os_signpost API. The format string substitution is
+  /// deferred to the log consumer and done outside of the
+  /// application.
+#define SIGNPOST_EMITTER_START_INTERVAL(SIGNPOST_EMITTER, O, ...)  \
+  do { \
+if ((SIGNPOST_EMITTER).isEnabled())\
+  if (SIGNPOSTS_AVAILABLE())   \
+os_signpost_interval_begin((SIGNPOST_EMITTER).getLogger(), \
+   (SIGNPOST_EMITTER).getSignpostForObject(O), \
+   "LLVM Timers", __VA_ARGS__);\
+  } while (0)
+
   /// End a signposted interval for a given object.
-  void endInterval(const void *O, StringRef Name);
+  void endInterval(const void *O);
 };
 
 } // end namespace llvm
Index: lldb/source/Utility/Timer.cpp
===
--- lldb/source/Utility/Timer.cpp
+++ lldb/source/Utility/Timer.cpp
@@ -33,6 +33,8 @@
 /// Allows 

[Lldb-commits] [PATCH] D104091: [NFC] Fix leak in test

2021-06-10 Thread Vitaly Buka via Phabricator via lldb-commits
vitalybuka created this revision.
vitalybuka requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Test leaks if we run
tools/lldb/unittests/Host/HostTests without --gtest_filter

Also if we call HostInfoLinux::Initialize twice
some llvm::call_once will prevent initialization of some fields.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104091

Files:
  lldb/source/Host/linux/HostInfoLinux.cpp
  lldb/unittests/Host/HostInfoTest.cpp


Index: lldb/unittests/Host/HostInfoTest.cpp
===
--- lldb/unittests/Host/HostInfoTest.cpp
+++ lldb/unittests/Host/HostInfoTest.cpp
@@ -60,3 +60,16 @@
   
EXPECT_TRUE(HostInfo::GetXcodeSDKPath(XcodeSDK("CeciNestPasUnOS.sdk")).empty());
 }
 #endif
+
+TEST(HostInfoTest2, InitTwice) {
+  llvm::VersionTuple Version;
+  {
+SubsystemRAII subsystems;
+Version = HostInfo::GetOSVersion();
+  }
+
+  {
+SubsystemRAII subsystems;
+EXPECT_EQ(Version, HostInfo::GetOSVersion());
+  }
+}
Index: lldb/source/Host/linux/HostInfoLinux.cpp
===
--- lldb/source/Host/linux/HostInfoLinux.cpp
+++ lldb/source/Host/linux/HostInfoLinux.cpp
@@ -35,8 +35,8 @@
 
 void HostInfoLinux::Initialize(SharedLibraryDirectoryHelper *helper) {
   HostInfoPosix::Initialize(helper);
-
-  g_fields = new HostInfoLinuxFields();
+  if (!g_fields)
+g_fields = new HostInfoLinuxFields();
 }
 
 llvm::VersionTuple HostInfoLinux::GetOSVersion() {


Index: lldb/unittests/Host/HostInfoTest.cpp
===
--- lldb/unittests/Host/HostInfoTest.cpp
+++ lldb/unittests/Host/HostInfoTest.cpp
@@ -60,3 +60,16 @@
   EXPECT_TRUE(HostInfo::GetXcodeSDKPath(XcodeSDK("CeciNestPasUnOS.sdk")).empty());
 }
 #endif
+
+TEST(HostInfoTest2, InitTwice) {
+  llvm::VersionTuple Version;
+  {
+SubsystemRAII subsystems;
+Version = HostInfo::GetOSVersion();
+  }
+
+  {
+SubsystemRAII subsystems;
+EXPECT_EQ(Version, HostInfo::GetOSVersion());
+  }
+}
Index: lldb/source/Host/linux/HostInfoLinux.cpp
===
--- lldb/source/Host/linux/HostInfoLinux.cpp
+++ lldb/source/Host/linux/HostInfoLinux.cpp
@@ -35,8 +35,8 @@
 
 void HostInfoLinux::Initialize(SharedLibraryDirectoryHelper *helper) {
   HostInfoPosix::Initialize(helper);
-
-  g_fields = new HostInfoLinuxFields();
+  if (!g_fields)
+g_fields = new HostInfoLinuxFields();
 }
 
 llvm::VersionTuple HostInfoLinux::GetOSVersion() {
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D103588: [trace] Create a top-level instruction class

2021-06-10 Thread walter erquinigo via Phabricator via lldb-commits
wallace updated this revision to Diff 351329.
wallace added a comment.
Herald added a subscriber: mgorny.

Following @vsk 's feedback, I made the following changes:

- Create a ThreadTrace class, that contains the trace for a specific thread and 
offers the TraverseInstructions method and other getters like 
GetInstructionType and GetInstructionSize. This effectively moves some code 
from the Trace.h class to this new class, which has a few advantanges:
  - It's easier to expose an SBAPI for instructions and its data storage with a 
corresponding SBThreadTrace class. Having only SBTrace is not enough for that.
  - A ThreadTrace can potentially outlive a stop id in the case of a live 
process, which could be useful if the user wants to compare traces or two 
different points in the execution of a process.
- I'm keeping the vector class for now as an internal 
representation, but now there's more freedom to change it because the top level 
API in ThreadTrace makes no assumptions on the data, except that it's indexed.
- I removed some deprecated code and improved some comments.

As a side note, I was chatting with some teammates and we'll explore storing 
decoded intel pt traces on disk, which later lldb will mmap and use as its 
storage. The accessors exposed in this diff are generic enough to handle that 
case as well.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103588

Files:
  lldb/include/lldb/Target/ThreadTrace.h
  lldb/include/lldb/Target/Trace.h
  lldb/include/lldb/lldb-enumerations.h
  lldb/include/lldb/lldb-forward.h
  lldb/source/Commands/CommandObjectThread.cpp
  lldb/source/Plugins/Trace/intel-pt/CMakeLists.txt
  lldb/source/Plugins/Trace/intel-pt/DecodedThread.cpp
  lldb/source/Plugins/Trace/intel-pt/DecodedThread.h
  lldb/source/Plugins/Trace/intel-pt/IntelPTDecoder.cpp
  lldb/source/Plugins/Trace/intel-pt/IntelPTDecoder.h
  lldb/source/Plugins/Trace/intel-pt/ThreadTraceIntelPT.cpp
  lldb/source/Plugins/Trace/intel-pt/ThreadTraceIntelPT.h
  lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
  lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
  lldb/source/Target/Trace.cpp
  lldb/test/API/commands/trace/TestTraceDumpInstructions.py

Index: lldb/test/API/commands/trace/TestTraceDumpInstructions.py
===
--- lldb/test/API/commands/trace/TestTraceDumpInstructions.py
+++ lldb/test/API/commands/trace/TestTraceDumpInstructions.py
@@ -160,8 +160,7 @@
 self.expect("trace load " +
 os.path.join(self.getSourceDir(), "intelpt-trace", "trace_wrong_cpu.json"))
 self.expect("thread trace dump instructions",
-substrs=['''thread #1: tid = 3842849, total instructions = 1
-[0] error: unknown cpu'''])
+substrs=['''thread #1: tid = 3842849, error: unknown cpu'''])
 
 def testMultiFileTraceWithMissingModule(self):
 self.expect("trace load " +
Index: lldb/source/Target/Trace.cpp
===
--- lldb/source/Target/Trace.cpp
+++ lldb/source/Target/Trace.cpp
@@ -141,8 +141,8 @@
 /// If \b true, then the \a InstructionSymbolInfo will have the
 /// \a disassembler and \a instruction objects calculated.
 static void TraverseInstructionsWithSymbolInfo(
-Trace , Thread , size_t position,
-Trace::TraceDirection direction, SymbolContextItem symbol_scope,
+ThreadTraceSP thread_trace_sp, Thread , size_t position,
+TraceDirection direction, SymbolContextItem symbol_scope,
 bool include_disassembler,
 std::function insn)>
 callback) {
@@ -197,8 +197,8 @@
 : InstructionSP());
   };
 
-  trace.TraverseInstructions(
-  thread, position, direction,
+  thread_trace_sp->TraverseInstructions(
+  position, direction,
   [&](size_t index, Expected load_address) -> bool {
 if (!load_address)
   return callback(index, load_address.takeError());
@@ -301,59 +301,59 @@
 
 void Trace::DumpTraceInstructions(Thread , Stream , size_t count,
   size_t end_position, bool raw) {
-  Optional instructions_count = GetInstructionCount(thread);
-  if (!instructions_count) {
-s.Printf("thread #%u: tid = %" PRIu64 ", not traced\n", thread.GetIndexID(),
- thread.GetID());
-return;
+  s.Printf("thread #%u: tid = %" PRIu64, thread.GetIndexID(), thread.GetID());
+
+  if (Expected thread_trace_sp = GetThreadTrace(thread)) {
+size_t instructions_count = thread_trace_sp.get()->GetInstructionCount();
+s.Printf(", total instructions = %zu\n", instructions_count);
+
+if (count == 0 || end_position >= instructions_count)
+  return;
+
+int digits_count = GetNumberOfDigits(end_position);
+size_t start_position =
+end_position + 1 < count ? 0 : end_position + 1 - count;
+auto printInstructionIndex = 

[Lldb-commits] [PATCH] D102993: [lldb] Disable minimal import mode for RecordDecls that back FieldDecls

2021-06-10 Thread Jordan Rupprecht via Phabricator via lldb-commits
rupprecht added a comment.

In D102993#2811337 , @teemperor wrote:

> Sure I can take a look, but I don't see the immediate problem when looking at 
> the backtrace.
>
> I assume it takes some time to reduce the bug in Chrome? If you could get me 
> the `dump()` output for the Decls `D`, `(Decl*)ToDC`, `FromRD`, `ToD`, 
> `(Decl*)ToD->getLexicalDeclContext()` and whether the left or the right side 
> of the `&&` is true/false then maybe it becomes more obvious what's going 
> wrong here.

This is probably not going to be useful:

- `D->dump()`: `FieldDecl 0x169993f9fbd0 <>  __r_ 
'std::__compressed_pair, 
std::allocator >::__rep, std::allocator >'`
- `((Decl*)ToDC)->dump()` - prints:

  a decl that inherits DeclContext isn't handled
  UNREACHABLE executed at llvm-project/clang/lib/AST/DeclBase.cpp:928!

- `FromRD->dump()` prints something wy to long to include here :)

  ClassTemplateSpecializationDecl 0x169983fc2b98 <>  class basic_string definition
  |-DefinitionData standard_layout has_user_declared_ctor can_const_default_init
  | |-DefaultConstructor exists non_trivial user_provided
  | |-CopyConstructor non_trivial user_declared has_const_param 
needs_overload_resolution implicit_has_const_param
  | |-MoveConstructor exists non_trivial user_declared 
  | |-CopyAssignment non_trivial has_const_param user_declared 
needs_overload_resolution implicit_has_const_param
  | |-MoveAssignment exists non_trivial user_declared
  | `-Destructor non_trivial user_declared
  |-private 'std::__basic_string_common'
  |-TemplateArgument type 'char'
  | `-BuiltinType 0x1695c0305860 'char'
  ...



- `((Decl*)ToD)->getLexicalDeclContext()` errors: `error: Execution was 
interrupted, reason: signal SIGSEGV: address access protected (fault address: 
0x55e26400).` (ToD is nonnull: 0x1699897a5e00)

I'm running out of time today & I'm off tomorrow, but I should be able to post 
something on Monday. I have a suspicion it's dependent on whatever flags chrome 
is building with, so I'll try to figure that out too.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102993

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


[Lldb-commits] [PATCH] D104067: [lldb] Decouple ObjCLanguage from Symtab

2021-06-10 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

This looks pretty good to me.

It's a little awkward in InitNameIndexes that we look up the various 
NameToSymbolIndex maps by eFunctionNameType, use the function name type again 
to sort the names & index pairs into the bucket we looked up before.  I wonder 
if that could be made cleaner by having an

AddToSymbolNameToIndexMap(symbol_name, index, func_name_type)

interface, which would just sort the symbol names into the right map.  Not sure 
that's worth the bother, however.




Comment at: lldb/source/Symbol/Symtab.cpp:332
 // name, add the version without categories to the index too.
-ObjCLanguage::MethodName objc_method(name.GetStringRef(), true);
-if (objc_method.IsValid(true)) {
-  selector_to_index.Append(objc_method.GetSelector(), value);
-
-  if (ConstString objc_method_no_category =
-  objc_method.GetFullNameWithoutCategory(true))
-name_to_index.Append(objc_method_no_category, value);
+if (auto *objc_lang = Language::FindPlugin(lldb::eLanguageTypeObjC)) {
+  for (auto variant_name_and_type :

Shouldn't this be in a loop over the supported languages?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104067

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


[Lldb-commits] [PATCH] D104067: [lldb] Decouple ObjCLanguage from Symtab

2021-06-10 Thread Alex Langford via Phabricator via lldb-commits
bulbazord added a comment.
Herald added a subscriber: JDevlieghere.

Note that this is working towards solving the same problem as D103210 
 but it does so in a different way. Instead 
of repurposing the old diff, I made a new one so it is a little easier to 
compare/contrast. Hopefully it's not too confusing.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104067

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


[Lldb-commits] [PATCH] D104067: [lldb] Decouple ObjCLanguage from Symtab

2021-06-10 Thread Alex Langford via Phabricator via lldb-commits
bulbazord created this revision.
bulbazord added a reviewer: teemperor.
Herald added a subscriber: mgorny.
bulbazord requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

We can extend/modify `GetMethodNameVariants` to suit our purposes here.
What symtab is looking for is alternate names we may want to use to
search for a specific symbol, and asking for variants of a name makes
the most sense here.

It might make more sense to wrap the ConstString and FunctionNameType
into a struct with a name, but for now I think a pair suffices.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104067

Files:
  lldb/include/lldb/Target/Language.h
  lldb/source/Breakpoint/BreakpointResolverName.cpp
  lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
  lldb/source/Plugins/Language/ObjC/ObjCLanguage.h
  lldb/source/Symbol/CMakeLists.txt
  lldb/source/Symbol/Symtab.cpp

Index: lldb/source/Symbol/Symtab.cpp
===
--- lldb/source/Symbol/Symtab.cpp
+++ lldb/source/Symbol/Symtab.cpp
@@ -9,8 +9,6 @@
 #include 
 #include 
 
-#include "Plugins/Language/ObjC/ObjCLanguage.h"
-
 #include "lldb/Core/Module.h"
 #include "lldb/Core/RichManglingContext.h"
 #include "lldb/Core/Section.h"
@@ -18,6 +16,7 @@
 #include "lldb/Symbol/Symbol.h"
 #include "lldb/Symbol/SymbolContext.h"
 #include "lldb/Symbol/Symtab.h"
+#include "lldb/Target/Language.h"
 #include "lldb/Utility/RegularExpression.h"
 #include "lldb/Utility/Stream.h"
 #include "lldb/Utility/Timer.h"
@@ -330,13 +329,14 @@
 
 // If the demangled name turns out to be an ObjC name, and is a category
 // name, add the version without categories to the index too.
-ObjCLanguage::MethodName objc_method(name.GetStringRef(), true);
-if (objc_method.IsValid(true)) {
-  selector_to_index.Append(objc_method.GetSelector(), value);
-
-  if (ConstString objc_method_no_category =
-  objc_method.GetFullNameWithoutCategory(true))
-name_to_index.Append(objc_method_no_category, value);
+if (auto *objc_lang = Language::FindPlugin(lldb::eLanguageTypeObjC)) {
+  for (auto variant_name_and_type :
+   objc_lang->GetMethodNameVariants(name)) {
+if (variant_name_and_type.second & lldb::eFunctionNameTypeSelector)
+  selector_to_index.Append(variant_name_and_type.first, value);
+else if (variant_name_and_type.second & lldb::eFunctionNameTypeFull)
+  name_to_index.Append(variant_name_and_type.first, value);
+  }
 }
   }
 }
Index: lldb/source/Symbol/CMakeLists.txt
===
--- lldb/source/Symbol/CMakeLists.txt
+++ lldb/source/Symbol/CMakeLists.txt
@@ -44,7 +44,6 @@
 lldbHost
 lldbTarget
 lldbUtility
-lldbPluginObjCLanguage
 
   LINK_COMPONENTS
 Support
Index: lldb/source/Plugins/Language/ObjC/ObjCLanguage.h
===
--- lldb/source/Plugins/Language/ObjC/ObjCLanguage.h
+++ lldb/source/Plugins/Language/ObjC/ObjCLanguage.h
@@ -100,7 +100,8 @@
   //  variant_names[1] => "-[NSString(my_additions) myStringWithCString:]"
   //  variant_names[2] => "+[NSString myStringWithCString:]"
   //  variant_names[3] => "-[NSString myStringWithCString:]"
-  std::vector
+  // We also return the FunctionNameType of each possible name.
+  std::vector>
   GetMethodNameVariants(ConstString method_name) const override;
 
   bool SymbolNameFitsToLanguage(Mangled mangled) const override;
Index: lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
===
--- lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
+++ lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
@@ -225,14 +225,17 @@
   return ConstString();
 }
 
-std::vector
+std::vector>
 ObjCLanguage::GetMethodNameVariants(ConstString method_name) const {
-  std::vector variant_names;
+  std::vector> variant_names;
   ObjCLanguage::MethodName objc_method(method_name.GetCString(), false);
   if (!objc_method.IsValid(false)) {
 return variant_names;
   }
 
+  variant_names.emplace_back(std::make_pair(objc_method.GetSelector(),
+lldb::eFunctionNameTypeSelector));
+
   const bool is_class_method =
   objc_method.GetType() == MethodName::eTypeClassMethod;
   const bool is_instance_method =
@@ -242,25 +245,30 @@
 
   if (is_class_method || is_instance_method) {
 if (name_sans_category)
-  variant_names.emplace_back(name_sans_category);
+  variant_names.emplace_back(
+  std::make_pair(name_sans_category, lldb::eFunctionNameTypeFull));
   } else {
 StreamString strm;
 
 strm.Printf("+%s", objc_method.GetFullName().GetCString());
-variant_names.emplace_back(strm.GetString());
+variant_names.emplace_back(
+

[Lldb-commits] [PATCH] D104054: [lldb] Enable Rust v0 symbol demangling

2021-06-10 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added inline comments.



Comment at: lldb/unittests/Core/MangledTest.cpp:72
+
+  EXPECT_STREQ("", TheDemangled.GetCString());
+}

asm wrote:
> teemperor wrote:
> > Could you do me a favour and change your test functions to LLDB's code 
> > style, so `mangled_name` as a variable name instead of `MangledName` and so 
> > on.
> > 
> > I'm aware the rest of the file is already using LLVM code style, but I 
> > think that's was just an oversight. I'll probably change the code style in 
> > this file to LLDB's and it would keep the git history a bit simpler.
> Sure no problem. This is my first contribution to LLVM. I just mimicked the 
> code around.
> 
> Just to check I understand. You're looking for something like this?
> 
> ```
>   ConstString manged_lname("_RRR");
>   Mangled the_mangled(mangled_name);
>   ConstString the_demangled = the_mangled.GetDemangledName();
> 
>   EXPECT_STREQ("", the_demangled.GetCString());
> ```
Jepp, that's the LLDB code style! Thank you!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104054

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


[Lldb-commits] [PATCH] D104054: [lldb] Enable Rust v0 symbol demangling

2021-06-10 Thread Alexander via Phabricator via lldb-commits
asm added inline comments.



Comment at: lldb/unittests/Core/MangledTest.cpp:72
+
+  EXPECT_STREQ("", TheDemangled.GetCString());
+}

teemperor wrote:
> Could you do me a favour and change your test functions to LLDB's code style, 
> so `mangled_name` as a variable name instead of `MangledName` and so on.
> 
> I'm aware the rest of the file is already using LLVM code style, but I think 
> that's was just an oversight. I'll probably change the code style in this 
> file to LLDB's and it would keep the git history a bit simpler.
Sure no problem. This is my first contribution to LLVM. I just mimicked the 
code around.

Just to check I understand. You're looking for something like this?

```
  ConstString manged_lname("_RRR");
  Mangled the_mangled(mangled_name);
  ConstString the_demangled = the_mangled.GetDemangledName();

  EXPECT_STREQ("", the_demangled.GetCString());
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104054

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


[Lldb-commits] [PATCH] D100243: [LLDB][GUI] Expand selected thread tree item by default

2021-06-10 Thread Omar Emara via Phabricator via lldb-commits
OmarEmaraDev added inline comments.



Comment at: 
lldb/test/API/commands/gui/expand-threads-tree/TestGuiExpandThreadsTree.py:38
+# Exit GUI.
+self.child.send(escape_key)
+self.expect_prompt()

wallace wrote:
> create a method self.exit_gui to dedup some code, as you'll end up doing a 
> lot of them as you write your tests
> 
>   def exit_gui(self):
> self.child.send(chr(27).encode())
> self.expect_prompt()
> 
> you can also create a method start_gui
> 
>   def start_gui(self):
> self.child.sendline("gui")
> self.child.send(chr(27).encode())
> 
> you could also later create a base class lldbgui_testcase similar to 
> lldbvscode_testcase, where you can put all needed common code
Okay. I will do for all tests in a separate patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100243

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


[Lldb-commits] [PATCH] D100243: [LLDB][GUI] Expand selected thread tree item by default

2021-06-10 Thread Omar Emara via Phabricator via lldb-commits
OmarEmaraDev updated this revision to Diff 351263.
OmarEmaraDev added a comment.

- Merge branch 'main' into lldb-gui-expand-threads-tree
- Implement default selection


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100243

Files:
  lldb/source/Core/IOHandlerCursesGUI.cpp
  lldb/test/API/commands/gui/expand-threads-tree/Makefile
  lldb/test/API/commands/gui/expand-threads-tree/TestGuiExpandThreadsTree.py
  lldb/test/API/commands/gui/expand-threads-tree/main.c

Index: lldb/test/API/commands/gui/expand-threads-tree/main.c
===
--- /dev/null
+++ lldb/test/API/commands/gui/expand-threads-tree/main.c
@@ -0,0 +1,10 @@
+#include 
+
+void *thread_start_routine(void *arg) { return NULL; }
+
+int main() {
+  pthread_t thread;
+  pthread_create(, NULL, thread_start_routine, NULL);
+  pthread_join(thread, NULL);
+  return 0;
+}
Index: lldb/test/API/commands/gui/expand-threads-tree/TestGuiExpandThreadsTree.py
===
--- /dev/null
+++ lldb/test/API/commands/gui/expand-threads-tree/TestGuiExpandThreadsTree.py
@@ -0,0 +1,55 @@
+"""
+Test the 'gui' default thread tree expansion.
+The root process tree item and the tree item corresponding to the selected
+thread should be expanded by default.
+"""
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.lldbpexpect import PExpectTest
+
+class TestGuiExpandThreadsTree(PExpectTest):
+
+mydir = TestBase.compute_mydir(__file__)
+
+# PExpect uses many timeouts internally and doesn't play well
+# under ASAN on a loaded machine..
+@skipIfAsan
+@skipIfCursesSupportMissing
+def test_gui(self):
+self.build()
+
+self.launch(executable=self.getBuildArtifact("a.out"), dimensions=(100,500))
+self.expect("breakpoint set -r thread_start_routine", substrs=["Breakpoint 1", "address ="])
+self.expect("run", substrs=["stop reason ="])
+
+escape_key = chr(27).encode()
+
+# Start the GUI and close the welcome window.
+self.child.sendline("gui")
+self.child.send(escape_key)
+self.child.expect_exact("Threads")
+
+# The thread running thread_start_routine should be expanded.
+self.child.expect_exact("frame #0: thread_start_routine")
+
+# Exit GUI.
+self.child.send(escape_key)
+self.expect_prompt()
+
+# Select the main thread.
+self.child.sendline("thread select 1")
+
+# Start the GUI.
+self.child.sendline("gui")
+self.child.expect_exact("Threads")
+
+# The main thread should be expanded.
+self.child.expect("frame #\d+: main")
+
+# Quit the GUI
+self.child.send(escape_key)
+
+self.expect_prompt()
+self.quit()
Index: lldb/test/API/commands/gui/expand-threads-tree/Makefile
===
--- /dev/null
+++ lldb/test/API/commands/gui/expand-threads-tree/Makefile
@@ -0,0 +1,3 @@
+C_SOURCES := main.c
+ENABLE_THREADS := YES
+include Makefile.rules
Index: lldb/source/Core/IOHandlerCursesGUI.cpp
===
--- lldb/source/Core/IOHandlerCursesGUI.cpp
+++ lldb/source/Core/IOHandlerCursesGUI.cpp
@@ -1608,6 +1608,8 @@
 
   virtual void TreeDelegateDrawTreeItem(TreeItem , Window ) = 0;
   virtual void TreeDelegateGenerateChildren(TreeItem ) = 0;
+  virtual void SetDefaultSelectionIfNeeded(TreeItem , int *selection_index,
+   TreeItem *selected_item) = 0;
   virtual bool TreeDelegateItemSelected(
   TreeItem ) = 0; // Return true if we need to update views
 };
@@ -1619,7 +1621,11 @@
   TreeItem(TreeItem *parent, TreeDelegate , bool might_have_children)
   : m_parent(parent), m_delegate(delegate), m_user_data(nullptr),
 m_identifier(0), m_row_idx(-1), m_children(),
-m_might_have_children(might_have_children), m_is_expanded(false) {}
+m_might_have_children(might_have_children), m_is_expanded(false) {
+// Expand root tree items by default.
+if (m_parent == nullptr)
+  m_is_expanded = true;
+  }
 
   TreeItem =(const TreeItem ) {
 if (this != ) {
@@ -1848,6 +1854,8 @@
   const int num_visible_rows = NumVisibleRows();
   m_num_rows = 0;
   m_root.CalculateRowIndexes(m_num_rows);
+  m_delegate_sp->SetDefaultSelectionIfNeeded(m_root, _selected_row_idx,
+ m_selected_item);
 
   // If we unexpanded while having something selected our total number of
   // rows is less than the num visible rows, then make sure we show all the
@@ -2031,6 +2039,11 @@
 // No children for frames yet...
   }
 
+  void SetDefaultSelectionIfNeeded(TreeItem , int *selection_index,
+  

[Lldb-commits] [PATCH] D104054: [lldb] Enable Rust v0 symbol demangling

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

This seems reasonable to me, but I'll leave this open for a while in case 
someone that knows more about Rust mangling shows up. Otherwise I'll accept 
this next week.




Comment at: lldb/source/Core/Mangled.cpp:213
+else
+  LLDB_LOGF(log, "demangled rustv0: %s -> error: failed to demangle", M);
+  }

Please use LLDB_LOG in new code: `LLDB_LOG(log, "demangled rustv0: {0} -> 
\"{1}\"", M, demangled_cstr);` (same in the line below).

(The code above just didn't get updated yet)



Comment at: lldb/unittests/Core/MangledTest.cpp:72
+
+  EXPECT_STREQ("", TheDemangled.GetCString());
+}

Could you do me a favour and change your test functions to LLDB's code style, 
so `mangled_name` as a variable name instead of `MangledName` and so on.

I'm aware the rest of the file is already using LLVM code style, but I think 
that's was just an oversight. I'll probably change the code style in this file 
to LLDB's and it would keep the git history a bit simpler.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104054

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


[Lldb-commits] [PATCH] D104054: [lldb] Enable Rust v0 symbol demangling

2021-06-10 Thread Alexander via Phabricator via lldb-commits
asm created this revision.
asm added reviewers: clayborg, wallace.
Herald added subscribers: pengfei, JDevlieghere.
asm requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Rust's v0 name mangling scheme [1] is easy to disambiguate from other
name mangling schemes because symbols always start with `_R`. The llvm
Demangle library supports demangling the Rust v0 scheme. Use it to
demangle Rust symbols.

Added unit tests that check simple symbols. Ran LLDB built with this
patch to debug some Rust programs compiled with the v0 name mangling
scheme. Confirmed symbol names were demangled as expected.

Note: enabling the new name mangling scheme requires a nightly
toolchain:

  $ cat main.rs
  fn main() {
  println!("Hello world!");
  }
  $ $(rustup which --toolchain nightly rustc) -Z symbol-mangling-version=v0 
main.rs -g
  $ /home/asm/hacking/llvm/build/bin/lldb ./main --one-line 'b main.rs:2'
  (lldb) target create "./main"
  Current executable set to '/home/asm/hacking/llvm/rust/main' (x86_64).
  (lldb) b main.rs:2
  Breakpoint 1: where = main`main::main + 4 at main.rs:2:5, address = 
0x76a4
  (lldb) r
  Process 948449 launched: '/home/asm/hacking/llvm/rust/main' (x86_64)
  warning: (x86_64) /lib64/libgcc_s.so.1 No LZMA support found for reading 
.gnu_debugdata section
  Process 948449 stopped
  * thread #1, name = 'main', stop reason = breakpoint 1.1
  frame #0: 0xb6a4 main`main::main at main.rs:2:5
 1fn main() {
  -> 2println!("Hello world!");
 3}
  (lldb) bt
  error: need to add support for DW_TAG_base_type '()' encoded with DW_ATE = 
0x7, bit_size = 0
  * thread #1, name = 'main', stop reason = breakpoint 1.1
* frame #0: 0xb6a4 main`main::main at main.rs:2:5
  frame #1: 0xb78b main`>::call_once((null)=(main`main::main at 
main.rs:1), (null)=) at function.rs:227:5
  frame #2: 0xb66e 
main`std::sys_common::backtrace::__rust_begin_short_backtrace::(f=(main`main::main at main.rs:1)) at backtrace.rs:125:18
  frame #3: 0xb851 main`std::rt::lang_start::<()>::{closure#0} 
at rt.rs:49:18
  frame #4: 0x5556c9f9 
main`std::rt::lang_start_internal::hc51399759a90501a [inlined] 
core::ops::function::impls::_$LT$impl$u20$core..ops..function..FnOnce$LT$A$GT$$u20$for$u20$$RF$F$GT$::call_once::h04259e4a34d07c2f
 at function.rs:259:13
  frame #5: 0x5556c9f2 
main`std::rt::lang_start_internal::hc51399759a90501a [inlined] 
std::panicking::try::do_call::hb8da45704d5cfbbf at panicking.rs:401:40
  frame #6: 0x5556c9f2 
main`std::rt::lang_start_internal::hc51399759a90501a [inlined] 
std::panicking::try::h4beadc19a78fec52 at panicking.rs:365:19
  frame #7: 0x5556c9f2 
main`std::rt::lang_start_internal::hc51399759a90501a [inlined] 
std::panic::catch_unwind::hc58016cd36ba81a4 at panic.rs:433:14
  frame #8: 0x5556c9f2 
main`std::rt::lang_start_internal::hc51399759a90501a at rt.rs:34:21
  frame #9: 0xb830 
main`std::rt::lang_start::<()>(main=(main`main::main at main.rs:1), argc=1, 
argv=0x7fffcb18) at rt.rs:48:5
  frame #10: 0xb6fc main`main + 28
  frame #11: 0x773f2493 libc.so.6`__libc_start_main + 243
  frame #12: 0xb59e main`_start + 46
  (lldb)

[1]: https://github.com/rust-lang/rust/issues/60705


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104054

Files:
  lldb/include/lldb/Core/Mangled.h
  lldb/source/Core/Mangled.cpp
  lldb/source/Symbol/Symtab.cpp
  lldb/unittests/Core/MangledTest.cpp

Index: lldb/unittests/Core/MangledTest.cpp
===
--- lldb/unittests/Core/MangledTest.cpp
+++ lldb/unittests/Core/MangledTest.cpp
@@ -55,6 +55,23 @@
   EXPECT_STREQ("", TheDemangled.GetCString());
 }
 
+TEST(MangledTest, ResultForValidRustV0Name) {
+  ConstString MangledName("_RNvC1a4main");
+  Mangled TheMangled(MangledName);
+  ConstString TheDemangled = TheMangled.GetDemangledName();
+
+  ConstString ExpectedResult("a::main");
+  EXPECT_STREQ(ExpectedResult.GetCString(), TheDemangled.GetCString());
+}
+
+TEST(MangledTest, EmptyForInvalidRustV0Name) {
+  ConstString MangledName("_RRR");
+  Mangled TheMangled(MangledName);
+  ConstString TheDemangled = TheMangled.GetDemangledName();
+
+  EXPECT_STREQ("", TheDemangled.GetCString());
+}
+
 TEST(MangledTest, NameIndexes_FindFunctionSymbols) {
   SubsystemRAII
   subsystems;
Index: lldb/source/Symbol/Symtab.cpp
===
--- lldb/source/Symbol/Symtab.cpp
+++ lldb/source/Symbol/Symtab.cpp
@@ -240,6 +240,10 @@
   case Mangled::eManglingSchemeMSVC:
 return false;
 
+  // No filters for this scheme yet. Include all names in indexing.
+  case Mangled::eManglingSchemeRustV0:
+return false;
+
   // Don't try and demangle things we can't categorize.
   case 

[Lldb-commits] [PATCH] D102993: [lldb] Disable minimal import mode for RecordDecls that back FieldDecls

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

Sure I can take a look, but I don't see the immediate problem when looking at 
the backtrace.

I assume it takes some time to reduce the bug in Chrome? If you could get me 
the `dump()` output for the Decls `D`, `(Decl*)ToDC`, `FromRD`, `ToD`, 
`(Decl*)ToD->getLexicalDeclContext()` and whether the left or the right side of 
the `&&` is true/false then maybe it becomes more obvious what's going wrong 
here.

In D102993#2811325 , @rupprecht wrote:

> This commit seems to be causing an LLDB crash. I'm still working on gathering 
> info and reducing it, but maybe the crash reason is obvious to you given this 
> stack trace:
>
>   $ lldb -b -o "b ChromeMain" -o "r" -o "v" -o "p chrome_main_delegate" 
> ~/src/chromium/src/out/Default/chrome
>   assert.h assertion failed at 
> llvm-project/clang/lib/AST/ASTImporter.cpp:1874 in llvm::Error 
> clang::ASTNodeImporter::ImportDeclContext(clang::DeclContext *, bool): ToDC 
> == ToD->getLexicalDeclContext() && ToDC->containsDecl(ToD)
>   ...
>   Stack dump:
>   0.  Program arguments: lldb -b -o "b ChromeMain" -o r -o v -o "p 
> chrome_main_delegate" /home/rupprecht/src/chromium/src/out/Default/chrome
>   1.  HandleCommand(command = "p chrome_main_delegate")^@
>   2.  :45:51: current parser token ';'
>   3.  :44:1: parsing function body '$__lldb_expr'
>   4.  :44:1: in compound statement ('{}')
>   ...
>#13 0x55646a128c66 
> clang::ASTNodeImporter::ImportDeclContext(clang::DeclContext*, bool) 
> llvm-project/clang/lib/AST/ASTImporter.cpp:1874:9
>#14 0x55646a15cc0d clang::ASTImporter::ImportDefinition(clang::Decl*) 
> llvm-project/clang/lib/AST/ASTImporter.cpp:9098:19
>#15 0x55646789e47d 
> lldb_private::ClangASTImporter::ASTImporterDelegate::ImportImpl(clang::Decl*) 
> llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp:916:25
>#16 0x55646a157235 clang::ASTImporter::Import(clang::Decl*) 
> llvm-project/clang/lib/AST/ASTImporter.cpp:8412:8
>#17 0x55646789ac8a 
> lldb_private::ClangASTImporter::CopyDecl(clang::ASTContext*, clang::Decl*) 
> llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp:79:8
>#18 0x5564679c4205 
> lldb_private::ClangASTSource::CopyDecl(clang::Decl*) 
> llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp:1720:3
>#19 0x5564679c415e 
> lldb_private::ClangASTSource::FindExternalLexicalDecls(clang::DeclContext 
> const*, llvm::function_ref, 
> llvm::SmallVectorImpl&) 
> llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp:492:5
>#20 0x5564679a6b6a 
> lldb_private::ClangASTSource::ClangASTSourceProxy::FindExternalLexicalDecls(clang::DeclContext
>  const*, llvm::function_ref, 
> llvm::SmallVectorImpl&) 
> llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h:223:7
>#21 0x55646a30d9b2 
> clang::ExternalASTSource::FindExternalLexicalDecls(clang::DeclContext const*, 
> llvm::SmallVectorImpl&) 
> llvm-project/clang/include/clang/AST/ExternalASTSource.h:186:3
>#22 0x55646a30ae60 
> clang::DeclContext::LoadLexicalDeclsFromExternalStorage() const 
> llvm-project/clang/lib/AST/DeclBase.cpp:1353:7
>#23 0x55646a30bec2 clang::DeclContext::buildLookup() 
> llvm-project/clang/lib/AST/DeclBase.cpp:1582:32
>#24 0x55646a30bc4f 
> clang::DeclContext::makeDeclVisibleInContextWithFlags(clang::NamedDecl*, 
> bool, bool) llvm-project/clang/lib/AST/DeclBase.cpp:1859:5
>#25 0x55646a30bd99 clang::DeclContext::addDeclInternal(clang::Decl*) 
> llvm-project/clang/lib/AST/DeclBase.cpp:1559:1
>#26 0x55646a12c1f0 
> clang::ASTNodeImporter::VisitTypedefNameDecl(clang::TypedefNameDecl*, bool) 
> llvm-project/clang/lib/AST/ASTImporter.cpp:0:16
>#27 0x55646a12c4cd 
> clang::ASTNodeImporter::VisitTypedefDecl(clang::TypedefDecl*) 
> llvm-project/clang/lib/AST/ASTImporter.cpp:2552:10
>#28 0x55646a171e3a clang::declvisitor::Base clang::ASTNodeImporter, llvm::Expected >::Visit(clang::Decl*) 
> llvm-project/clang/include/clang/AST/DeclNodes.inc:335:1
>#29 0x55646a15619d clang::ASTImporter::ImportImpl(clang::Decl*) 
> llvm-project/clang/lib/AST/ASTImporter.cpp:8240:19
>#30 0x55646789e55c 
> lldb_private::ClangASTImporter::ASTImporterDelegate::ImportImpl(clang::Decl*) 
> llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp:0:23
>#31 0x55646a157235 clang::ASTImporter::Import(clang::Decl*) 
> llvm-project/clang/lib/AST/ASTImporter.cpp:8412:8
>
> The class definition for the expression being evaluated can be found here: 
> https://source.chromium.org/chromium/chromium/src/+/master:chrome/app/chrome_main.cc;l=85;drc=83bf8a5bbe7f9af4f4531b65662cfeb0c232b583
>
> (It crashes in the same-ish w/o assertions too; this is just the more helpful 
> stack trace :) )




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  

[Lldb-commits] [PATCH] D102993: [lldb] Disable minimal import mode for RecordDecls that back FieldDecls

2021-06-10 Thread Jordan Rupprecht via Phabricator via lldb-commits
rupprecht added a comment.

This commit seems to be causing an LLDB crash. I'm still working on gathering 
info and reducing it, but maybe the crash reason is obvious to you given this 
stack trace:

  $ lldb -b -o "b ChromeMain" -o "r" -o "v" -o "p chrome_main_delegate" 
~/src/chromium/src/out/Default/chrome
  assert.h assertion failed at llvm-project/clang/lib/AST/ASTImporter.cpp:1874 
in llvm::Error clang::ASTNodeImporter::ImportDeclContext(clang::DeclContext *, 
bool): ToDC == ToD->getLexicalDeclContext() && ToDC->containsDecl(ToD)
  ...
  Stack dump:
  0.  Program arguments: lldb -b -o "b ChromeMain" -o r -o v -o "p 
chrome_main_delegate" /home/rupprecht/src/chromium/src/out/Default/chrome
  1.  HandleCommand(command = "p chrome_main_delegate")^@
  2.  :45:51: current parser token ';'
  3.  :44:1: parsing function body '$__lldb_expr'
  4.  :44:1: in compound statement ('{}')
  ...
   #13 0x55646a128c66 
clang::ASTNodeImporter::ImportDeclContext(clang::DeclContext*, bool) 
llvm-project/clang/lib/AST/ASTImporter.cpp:1874:9
   #14 0x55646a15cc0d clang::ASTImporter::ImportDefinition(clang::Decl*) 
llvm-project/clang/lib/AST/ASTImporter.cpp:9098:19
   #15 0x55646789e47d 
lldb_private::ClangASTImporter::ASTImporterDelegate::ImportImpl(clang::Decl*) 
llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp:916:25
   #16 0x55646a157235 clang::ASTImporter::Import(clang::Decl*) 
llvm-project/clang/lib/AST/ASTImporter.cpp:8412:8
   #17 0x55646789ac8a 
lldb_private::ClangASTImporter::CopyDecl(clang::ASTContext*, clang::Decl*) 
llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp:79:8
   #18 0x5564679c4205 lldb_private::ClangASTSource::CopyDecl(clang::Decl*) 
llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp:1720:3
   #19 0x5564679c415e 
lldb_private::ClangASTSource::FindExternalLexicalDecls(clang::DeclContext 
const*, llvm::function_ref, 
llvm::SmallVectorImpl&) 
llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp:492:5
   #20 0x5564679a6b6a 
lldb_private::ClangASTSource::ClangASTSourceProxy::FindExternalLexicalDecls(clang::DeclContext
 const*, llvm::function_ref, 
llvm::SmallVectorImpl&) 
llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h:223:7
   #21 0x55646a30d9b2 
clang::ExternalASTSource::FindExternalLexicalDecls(clang::DeclContext const*, 
llvm::SmallVectorImpl&) 
llvm-project/clang/include/clang/AST/ExternalASTSource.h:186:3
   #22 0x55646a30ae60 
clang::DeclContext::LoadLexicalDeclsFromExternalStorage() const 
llvm-project/clang/lib/AST/DeclBase.cpp:1353:7
   #23 0x55646a30bec2 clang::DeclContext::buildLookup() 
llvm-project/clang/lib/AST/DeclBase.cpp:1582:32
   #24 0x55646a30bc4f 
clang::DeclContext::makeDeclVisibleInContextWithFlags(clang::NamedDecl*, bool, 
bool) llvm-project/clang/lib/AST/DeclBase.cpp:1859:5
   #25 0x55646a30bd99 clang::DeclContext::addDeclInternal(clang::Decl*) 
llvm-project/clang/lib/AST/DeclBase.cpp:1559:1
   #26 0x55646a12c1f0 
clang::ASTNodeImporter::VisitTypedefNameDecl(clang::TypedefNameDecl*, bool) 
llvm-project/clang/lib/AST/ASTImporter.cpp:0:16
   #27 0x55646a12c4cd 
clang::ASTNodeImporter::VisitTypedefDecl(clang::TypedefDecl*) 
llvm-project/clang/lib/AST/ASTImporter.cpp:2552:10
   #28 0x55646a171e3a clang::declvisitor::Base >::Visit(clang::Decl*) 
llvm-project/clang/include/clang/AST/DeclNodes.inc:335:1
   #29 0x55646a15619d clang::ASTImporter::ImportImpl(clang::Decl*) 
llvm-project/clang/lib/AST/ASTImporter.cpp:8240:19
   #30 0x55646789e55c 
lldb_private::ClangASTImporter::ASTImporterDelegate::ImportImpl(clang::Decl*) 
llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp:0:23
   #31 0x55646a157235 clang::ASTImporter::Import(clang::Decl*) 
llvm-project/clang/lib/AST/ASTImporter.cpp:8412:8

The class definition for the expression being evaluated can be found here: 
https://source.chromium.org/chromium/chromium/src/+/master:chrome/app/chrome_main.cc;l=85;drc=83bf8a5bbe7f9af4f4531b65662cfeb0c232b583

(It crashes in the same-ish w/o assertions too; this is just the more helpful 
stack trace :) )


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102993

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


[Lldb-commits] [PATCH] D104047: [lldb, win] Remove obsolete workaround for MSVC and python libs

2021-06-10 Thread Stella Stamenova via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGca10add5dbe4: [lldb, win] Remove obsolete workaround for 
MSVC and python libs (authored by stella.stamenova).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104047

Files:
  lldb/source/API/CMakeLists.txt


Index: lldb/source/API/CMakeLists.txt
===
--- lldb/source/API/CMakeLists.txt
+++ lldb/source/API/CMakeLists.txt
@@ -182,13 +182,7 @@
   set_target_properties(liblldb_exports PROPERTIES FOLDER "lldb misc")
 endif()
 
-if (MSVC)
-  # Only MSVC has the ABI compatibility problem and avoids using 
FindPythonLibs,
-  # so only it needs to explicitly link against ${Python3_LIBRARIES}
-  if (LLDB_ENABLE_PYTHON)
-target_link_libraries(liblldb PRIVATE ${Python3_LIBRARIES})
-  endif()
-else()
+if (NOT MSVC)
   set_target_properties(liblldb
 PROPERTIES
 OUTPUT_NAME lldb


Index: lldb/source/API/CMakeLists.txt
===
--- lldb/source/API/CMakeLists.txt
+++ lldb/source/API/CMakeLists.txt
@@ -182,13 +182,7 @@
   set_target_properties(liblldb_exports PROPERTIES FOLDER "lldb misc")
 endif()
 
-if (MSVC)
-  # Only MSVC has the ABI compatibility problem and avoids using FindPythonLibs,
-  # so only it needs to explicitly link against ${Python3_LIBRARIES}
-  if (LLDB_ENABLE_PYTHON)
-target_link_libraries(liblldb PRIVATE ${Python3_LIBRARIES})
-  endif()
-else()
+if (NOT MSVC)
   set_target_properties(liblldb
 PROPERTIES
 OUTPUT_NAME lldb
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] ca10add - [lldb, win] Remove obsolete workaround for MSVC and python libs

2021-06-10 Thread Stella Stamenova via lldb-commits

Author: Stella Stamenova
Date: 2021-06-10T11:13:38-07:00
New Revision: ca10add5dbe4c3fb2ccaa032d9c7f3e13ca4b14b

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

LOG: [lldb, win] Remove obsolete workaround for MSVC and python libs

This workaround was necessary before the major changes of managing python 
versions, but it is not needed anymore.

Reviewed By: JDevlieghere

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

Added: 


Modified: 
lldb/source/API/CMakeLists.txt

Removed: 




diff  --git a/lldb/source/API/CMakeLists.txt b/lldb/source/API/CMakeLists.txt
index a7d6592b31dc0..b74bfd4a2ff8d 100644
--- a/lldb/source/API/CMakeLists.txt
+++ b/lldb/source/API/CMakeLists.txt
@@ -182,13 +182,7 @@ if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
   set_target_properties(liblldb_exports PROPERTIES FOLDER "lldb misc")
 endif()
 
-if (MSVC)
-  # Only MSVC has the ABI compatibility problem and avoids using 
FindPythonLibs,
-  # so only it needs to explicitly link against ${Python3_LIBRARIES}
-  if (LLDB_ENABLE_PYTHON)
-target_link_libraries(liblldb PRIVATE ${Python3_LIBRARIES})
-  endif()
-else()
+if (NOT MSVC)
   set_target_properties(liblldb
 PROPERTIES
 OUTPUT_NAME lldb



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


[Lldb-commits] [PATCH] D104047: [lldb, win] Remove obsolete workaround for MSVC and python libs

2021-06-10 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere 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/D104047/new/

https://reviews.llvm.org/D104047

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


[Lldb-commits] [PATCH] D104047: [lldb, win] Remove obsolete workaround for MSVC and python libs

2021-06-10 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova created this revision.
stella.stamenova added a reviewer: JDevlieghere.
Herald added a subscriber: mgorny.
stella.stamenova requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

This workaround was necessary before the major changes of managing python 
versions, but it is not needed anymore.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104047

Files:
  lldb/source/API/CMakeLists.txt


Index: lldb/source/API/CMakeLists.txt
===
--- lldb/source/API/CMakeLists.txt
+++ lldb/source/API/CMakeLists.txt
@@ -182,13 +182,7 @@
   set_target_properties(liblldb_exports PROPERTIES FOLDER "lldb misc")
 endif()
 
-if (MSVC)
-  # Only MSVC has the ABI compatibility problem and avoids using 
FindPythonLibs,
-  # so only it needs to explicitly link against ${Python3_LIBRARIES}
-  if (LLDB_ENABLE_PYTHON)
-target_link_libraries(liblldb PRIVATE ${Python3_LIBRARIES})
-  endif()
-else()
+if (NOT MSVC)
   set_target_properties(liblldb
 PROPERTIES
 OUTPUT_NAME lldb


Index: lldb/source/API/CMakeLists.txt
===
--- lldb/source/API/CMakeLists.txt
+++ lldb/source/API/CMakeLists.txt
@@ -182,13 +182,7 @@
   set_target_properties(liblldb_exports PROPERTIES FOLDER "lldb misc")
 endif()
 
-if (MSVC)
-  # Only MSVC has the ABI compatibility problem and avoids using FindPythonLibs,
-  # so only it needs to explicitly link against ${Python3_LIBRARIES}
-  if (LLDB_ENABLE_PYTHON)
-target_link_libraries(liblldb PRIVATE ${Python3_LIBRARIES})
-  endif()
-else()
+if (NOT MSVC)
   set_target_properties(liblldb
 PROPERTIES
 OUTPUT_NAME lldb
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


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

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

LGTM beside some minor formatting bugs that got exacerbated by the clang-tidy 
run. I got bored of writing 'format' everywhere so I translated every comment 
into a different language via Google translate. I'll already accept this as 
this is easy to fix.




Comment at: lldb/include/lldb/Expression/ExpressionParser.h:45
+  virtual ~ExpressionParser() = default;
+  ;
 

Please drop that when you land it.



Comment at: lldb/include/lldb/Target/Process.h:227
 
-  {}
+  = default;
 

format



Comment at: lldb/include/lldb/Target/StackFrameRecognizer.h:41
+  virtual ~RecognizedStackFrame() = default;
+  ;
 

please remove that pointy boy



Comment at: lldb/include/lldb/Target/StackFrameRecognizer.h:68
+  virtual ~StackFrameRecognizer() = default;
+  ;
 };

and that one too



Comment at: lldb/source/Interpreter/OptionValueFileColonLine.cpp:26
 
-{}
+= default;
 

formaat



Comment at: 
lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h:219
 
-{}
+= default;
 

formato



Comment at: 
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h:111
 
-{}
+= default;
 

formatione



Comment at: 
lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h:50
+  RSCoordinate() = default;
+  ;
 

goodbye



Comment at: 
lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.h:60
 
-{}
+= default;
   };

フォーマット



Comment at: lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.h:57
 
-{}
+= default;
   };

хэлбэр хэмжээ



Comment at: lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h:195
 
-{}
+= default;
 

formoup



Comment at: lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h:219
 
-{}
+= default;
 

isimo


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

https://reviews.llvm.org/D104041

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


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

2021-06-10 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: lldb/include/lldb/Interpreter/CommandInterpreter.h:103-105
   CommandInterpreterRunOptions()
 
+  = default;

Interesting, I would've expected clang-format to get this. 


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

https://reviews.llvm.org/D104041

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