[Lldb-commits] [PATCH] D74187: [lldb] Add method Language::IsMangledName

2020-02-06 Thread Alex Langford via Phabricator via lldb-commits
xiaobai added inline comments.



Comment at: lldb/source/Plugins/Language/ObjC/ObjCLanguage.h:96-98
+  bool IsMangledName(llvm::StringRef name) const override {
+return false;
+  }

friss wrote:
> The original code was calling `IsPossibleObjCMethodName` and it looks like 
> you completely lose this codepath with this rewrite. Unclear to me if it's 
> the right thing to return here, but that's definitely a change in behavior.
If I understand correctly, Objective-C names aren't mangled in general, and are 
usually stored in the `m_demangled` name of `Mangled`, so that code path should 
have been bogus to begin with. Maybe I'm missing a detail though?

I can add a comment to this to clarify that Objective-C names aren't mangled 
(if I am correct in my understanding).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74187



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


[Lldb-commits] [lldb] f60de4c - Except, get the TARGET_OS_OSX check correct.

2020-02-06 Thread Jason Molenda via lldb-commits

Author: Jason Molenda
Date: 2020-02-06T20:28:40-08:00
New Revision: f60de4cdf7b8ca1b22700a6325a61a9b0da6a54b

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

LOG: Except, get the TARGET_OS_OSX check correct.

Added: 


Modified: 
lldb/tools/debugserver/source/RNBRemote.cpp

Removed: 




diff  --git a/lldb/tools/debugserver/source/RNBRemote.cpp 
b/lldb/tools/debugserver/source/RNBRemote.cpp
index 0eba6d5358d5..b4dd9031eb67 100644
--- a/lldb/tools/debugserver/source/RNBRemote.cpp
+++ b/lldb/tools/debugserver/source/RNBRemote.cpp
@@ -3766,7 +3766,7 @@ static bool login_session_has_gui_access () {
 // $ security authorizationdb read system.privilege.taskport.debug
 
 static bool developer_mode_enabled () {
-#if TARGET_OS_OSX == 1
+#if TARGET_OS_OSX == 0
   return true;
 #else
  CFDictionaryRef currentRightDict = NULL;



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


[Lldb-commits] [lldb] e2fa760 - Fix my use of the TARGET_OS_OSX TargetConditional.

2020-02-06 Thread Jason Molenda via lldb-commits

Author: Jason Molenda
Date: 2020-02-06T20:28:28-08:00
New Revision: e2fa760cdde2ebaa93cf1e959189dece3e949a68

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

LOG: Fix my use of the TARGET_OS_OSX TargetConditional.

Added: 


Modified: 
lldb/tools/debugserver/source/RNBRemote.cpp

Removed: 




diff  --git a/lldb/tools/debugserver/source/RNBRemote.cpp 
b/lldb/tools/debugserver/source/RNBRemote.cpp
index dfea6780f206..0eba6d5358d5 100644
--- a/lldb/tools/debugserver/source/RNBRemote.cpp
+++ b/lldb/tools/debugserver/source/RNBRemote.cpp
@@ -3766,7 +3766,7 @@ static bool login_session_has_gui_access () {
 // $ security authorizationdb read system.privilege.taskport.debug
 
 static bool developer_mode_enabled () {
-#if !defined (TARGET_OS_OSX)
+#if TARGET_OS_OSX == 1
   return true;
 #else
  CFDictionaryRef currentRightDict = NULL;



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


[Lldb-commits] [PATCH] D74157: [lldb/API] NFC: Reformat SBThread::GetStopDescription()

2020-02-06 Thread Frederic Riss via Phabricator via lldb-commits
friss added a comment.

In D74157#1863069 , @jingham wrote:

> In D74157#1862537 , @labath wrote:
>
> > Looks better. TBH, I'm not sure why/if we really need the case handling the 
> > situation where the thread does not have a stop description. Ideally I'd 
> > just move this code there (or delete it).
>
>
> A thread that stops for no reason will have an empty StopInfoSP.  So somebody 
> has to check for that.  I also don't want a thread that hasn't stopped for a 
> reason to have a placeholder description like "no reason" because if you are 
> using the API's you'd like to just print whatever the description is, and if 
> you stop one thread at a breakpoint, having all the others say "no reason" is 
> noisy and unhelpful.


I don't understand this comment. The fallback code we are talking about only 
ever triggers if there's a StopInfo. If the StopInfoSP was empty we wouldn't 
return a description.

> But I agree that the SB layer is the wrong place to do this.  
> SBThread::GetStopDescription should just call Thread->GetStopDescription and 
> return whatever that returned.  It really shouldn't even care whether the 
> thread had a StopInfo or not, Thread::GetStopDescription should handle that 
> case too.
> 
> I also really wish we didn't need the code to augment the Thread's stop 
> description by using the stop reason.  You only get to this code if there IS 
> a StopInfo, so the StopInfo should have provided a description if there's a 
> reason for stopping.  Right now you can subclass StopInfo and return anything 
> you want in GetStopDescription.  So somebody could make a StopInfo subclass 
> that represents a stop because we hit a signal - returning eStopReasonSignal 
> from GetStopReason - and then just decide not to print anything for the 
> description.  But that's very unhelpful.  And these reduced descriptions are 
> a bit bogus (like any plan completed calls itself "step"...)

I removed this code and asserted that the description returned by StopInfos is 
not empty. The test suite passed fine. Do you have any example where this code 
would be needed? I think we should require that StopInfos return a non-empty 
description and get rid of it the fallback code.

> It would be really nice to just ban that.  Maybe we could make the StopInfo 
> virtual method be a DoGetStopDescription, and then have 
> StopInfo::GetStopReason() not be virtual, and call DoGetStopDescription and 
> assert if the StopReason in anything other than eStopReasonNone, but the 
> description was empty.  That way we could force people who handle the stops 
> to provide useful stop reasons.

Do you have any example how to get into a problematic case?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74157



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


[Lldb-commits] [PATCH] D74157: [lldb/API] NFC: Reformat SBThread::GetStopDescription()

2020-02-06 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

In D74157#1862537 , @labath wrote:

> Looks better. TBH, I'm not sure why/if we really need the case handling the 
> situation where the thread does not have a stop description. Ideally I'd just 
> move this code there (or delete it).


A thread that stops for no reason will have an empty StopInfoSP.  So somebody 
has to check for that.  I also don't want a thread that hasn't stopped for a 
reason to have a placeholder description like "no reason" because if you are 
using the API's you'd like to just print whatever the description is, and if 
you stop one thread at a breakpoint, having all the others say "no reason" is 
noisy and unhelpful.

But I agree that the SB layer is the wrong place to do this.  
SBThread::GetStopDescription should just call Thread->GetStopDescription and 
return whatever that returned.  It really shouldn't even care whether the 
thread had a StopInfo or not, Thread::GetStopDescription should handle that 
case too.

I also really wish we didn't need the code to augment the Thread's stop 
description by using the stop reason.  You only get to this code if there IS a 
StopInfo, so the StopInfo should have provided a description if there's a 
reason for stopping.  Right now you can subclass StopInfo and return anything 
you want in GetStopDescription.  So somebody could make a StopInfo subclass 
that represents a stop because we hit a signal - returning eStopReasonSignal 
from GetStopReason - and then just decide not to print anything for the 
description.  But that's very unhelpful.  And these reduced descriptions are a 
bit bogus (like any plan completed calls itself "step"...)

It would be really nice to just ban that.  Maybe we could make the StopInfo 
virtual method be a DoGetStopDescription, and then have 
StopInfo::GetStopReason() not be virtual, and call DoGetStopDescription and 
assert if the StopReason in anything other than eStopReasonNone, but the 
description was empty.  That way we could force people who handle the stops to 
provide useful stop reasons.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74157



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


[Lldb-commits] [PATCH] D74187: [lldb] Add method Language::IsMangledName

2020-02-06 Thread Frederic Riss via Phabricator via lldb-commits
friss added inline comments.



Comment at: lldb/source/Plugins/Language/ObjC/ObjCLanguage.h:96-98
+  bool IsMangledName(llvm::StringRef name) const override {
+return false;
+  }

The original code was calling `IsPossibleObjCMethodName` and it looks like you 
completely lose this codepath with this rewrite. Unclear to me if it's the 
right thing to return here, but that's definitely a change in behavior.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74187



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


[Lldb-commits] [lldb] 8eb9b67 - Add final description of why attach failed with poss error string.

2020-02-06 Thread Jason Molenda via lldb-commits

Author: Jason Molenda
Date: 2020-02-06T17:28:49-08:00
New Revision: 8eb9b67bdacdaefc82a61921e52d2908f6f06931

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

LOG: Add final description of why attach failed with poss error string.

Added: 


Modified: 
lldb/tools/debugserver/source/RNBRemote.cpp

Removed: 




diff  --git a/lldb/tools/debugserver/source/RNBRemote.cpp 
b/lldb/tools/debugserver/source/RNBRemote.cpp
index b2fe8a156fa1..dfea6780f206 100644
--- a/lldb/tools/debugserver/source/RNBRemote.cpp
+++ b/lldb/tools/debugserver/source/RNBRemote.cpp
@@ -3690,6 +3690,12 @@ static bool attach_failed_due_to_sip (nub_process_t pid) 
{
 // my_uid and process_uid are only initialized if this function
 // returns true -- that there was a uid mismatch -- and those
 // id's may want to be used in the error message.
+// 
+// NOTE: this should only be called after process_does_not_exist().
+// This sysctl will return uninitialized data if we ask for a pid
+// that doesn't exist.  The alternative would be to fetch all
+// processes and step through to find the one we're looking for
+// (as process_does_not_exist() does).
 static bool attach_failed_due_to_uid_mismatch (nub_process_t pid,
uid_t _uid,
uid_t _uid) {
@@ -3712,6 +3718,11 @@ static bool attach_failed_due_to_uid_mismatch 
(nub_process_t pid,
 return false;
 }
 
+// NOTE: this should only be called after process_does_not_exist().
+// This sysctl will return uninitialized data if we ask for a pid
+// that doesn't exist.  The alternative would be to fetch all
+// processes and step through to find the one we're looking for
+// (as process_does_not_exist() does).
 static bool process_is_already_being_debugged (nub_process_t pid) {
   struct kinfo_proc kinfo;
   int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_PID, pid};
@@ -3994,6 +4005,7 @@ rnb_err_t RNBRemote::HandlePacket_v(const char *p) {
   // string to lldb.
 
   if (pid_attaching_to != INVALID_NUB_PROCESS) {
+// The order of these checks is important.  
 if (process_does_not_exist (pid_attaching_to)) {
   DNBLogError("Tried to attach to pid that doesn't exist");
   std::string return_message = "E96;";
@@ -4056,7 +4068,16 @@ rnb_err_t RNBRemote::HandlePacket_v(const char *p) {
 }
   }
 
-  SendPacket("E01"); // E01 is our magic error value for attach failed.
+  std::string error_explainer = "attach failed";
+  if (err_str[0] != '\0') {
+error_explainer += " (";
+error_explainer += err_str;
+error_explainer += ")";
+  }
+  std::string default_return_msg = "E96;";
+  default_return_msg += cstring_to_asciihex_string 
+  (error_explainer.c_str());
+  SendPacket (default_return_msg.c_str());
   DNBLogError("Attach failed: \"%s\".", err_str);
   return rnb_err;
 }



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


[Lldb-commits] [PATCH] D74187: [lldb] Add method Language::IsMangledName

2020-02-06 Thread Alex Langford via Phabricator via lldb-commits
xiaobai marked an inline comment as done.
xiaobai added a comment.

I uploaded this patch primarily to get some feedback on possible alternatives 
because I'm not happy creating a dependency from `Core` to `Target` here. 
Suggestions welcome!




Comment at: lldb/source/Core/Mangled.cpp:12
 #include "lldb/Core/RichManglingContext.h"
+#include "lldb/Target/Language.h"
 #include "lldb/Utility/ConstString.h"

Not happy about introducing this dependency. Maybe I can remove the 
`GuessLanguage` method from Mangled and add one to `Language`... something like 
`Language::GuessMangledSymbolLanguage(Mangled mangled)`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74187



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


[Lldb-commits] [PATCH] D74187: [lldb] Add method Language::IsMangledName

2020-02-06 Thread Alex Langford via Phabricator via lldb-commits
xiaobai created this revision.
xiaobai added a reviewer: LLDB.
Herald added a project: LLDB.

Instead of asking each of the language plugins directly if a symbol is a
possible manghled name for that language, we can generalize this
pattern. By adding a method `IsMangledName` and iterating over each
loaded language plugin, we can avoid referencing any language plugin
directly.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74187

Files:
  lldb/include/lldb/Target/Language.h
  lldb/source/Core/Mangled.cpp
  lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
  lldb/source/Plugins/Language/ObjC/ObjCLanguage.h
  lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h

Index: lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h
===
--- lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h
+++ lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h
@@ -31,6 +31,11 @@
 
   const Highlighter *GetHighlighter() const override { return _highlighter; }
 
+  bool IsMangledName(llvm::StringRef name) const override {
+// Let the CPlusPlusLanguage plugin answer this
+return false;
+  }
+
   // Static Functions
   static void Initialize();
 
Index: lldb/source/Plugins/Language/ObjC/ObjCLanguage.h
===
--- lldb/source/Plugins/Language/ObjC/ObjCLanguage.h
+++ lldb/source/Plugins/Language/ObjC/ObjCLanguage.h
@@ -93,6 +93,10 @@
 return lldb::eLanguageTypeObjC;
   }
 
+  bool IsMangledName(llvm::StringRef name) const override {
+return false;
+  }
+
   // Get all possible names for a method. Examples:
   // If method_name is "+[NSString(my_additions) myStringWithCString:]"
   //   variant_names[0] => "+[NSString myStringWithCString:]"
Index: lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
===
--- lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
+++ lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
@@ -101,6 +101,8 @@
 
   static lldb_private::ConstString GetPluginNameStatic();
 
+  bool IsMangledName(llvm::StringRef name) const override;
+
   static bool IsCPPMangledName(llvm::StringRef name);
 
   // Extract C++ context and identifier from a string using heuristic matching
Index: lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
===
--- lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -239,6 +239,10 @@
   return res;
 }
 
+bool CPlusPlusLanguage::IsMangledName(llvm::StringRef name) const {
+  return IsCPPMangledName(name);
+}
+
 bool CPlusPlusLanguage::IsCPPMangledName(llvm::StringRef name) {
   // FIXME!! we should really run through all the known C++ Language plugins
   // and ask each one if this is a C++ mangled name
Index: lldb/source/Core/Mangled.cpp
===
--- lldb/source/Core/Mangled.cpp
+++ lldb/source/Core/Mangled.cpp
@@ -9,6 +9,7 @@
 #include "lldb/Core/Mangled.h"
 
 #include "lldb/Core/RichManglingContext.h"
+#include "lldb/Target/Language.h"
 #include "lldb/Utility/ConstString.h"
 #include "lldb/Utility/Log.h"
 #include "lldb/Utility/Logging.h"
@@ -410,11 +411,15 @@
   ConstString mangled = GetMangledName();
 
   if (mangled) {
-const char *mangled_name = mangled.GetCString();
-if (CPlusPlusLanguage::IsCPPMangledName(mangled_name))
-  return lldb::eLanguageTypeC_plus_plus;
-else if (ObjCLanguage::IsPossibleObjCMethodName(mangled_name))
-  return lldb::eLanguageTypeObjC;
+lldb::LanguageType lang_type = lldb::eLanguageTypeUnknown;
+Language::ForEach([_type, ](Language *lang) {
+  if (lang->IsMangledName(mangled.GetCString())) {
+lang_type = lang->GetLanguageType();
+return false; // Break out of ForEach early
+  }
+  return true;
+});
+return lang_type;
   } else {
 // ObjC names aren't really mangled, so they won't necessarily be in the
 // mangled name slot.
Index: lldb/include/lldb/Target/Language.h
===
--- lldb/include/lldb/Target/Language.h
+++ lldb/include/lldb/Target/Language.h
@@ -188,6 +188,8 @@
 
   virtual const char *GetLanguageSpecificTypeLookupHelp();
 
+  virtual bool IsMangledName(llvm::StringRef name) const = 0;
+
   // If a language can have more than one possible name for a method, this
   // function can be used to enumerate them. This is useful when doing name
   // lookups.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D74153: [lldb] Delete the SharingPtr class

2020-02-06 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

In D74153#1862554 , @labath wrote:

> Actually, it looks like we were getting away with that because the whole 
> ValueObjectRegisterContext (*not* RegisterSet) class is unused. In fact the 
> whole concept of having the entire register context as a "value" seems fairly 
> odd to me. Can we just delete it?


Oh, interesting.  I have no idea what that is for.  Looks like it was part of 
the initial checkin of lldb -> llvm.org, and except for formal changes hasn't 
actually been touched since then.  Seems like if we haven't used it by now, 
it's fine to get rid of it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74153



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


[Lldb-commits] [PATCH] D72751: [LLDB] Add DynamicLoaderWasmDYLD plugin for WebAssembly debugging

2020-02-06 Thread Paolo Severini via Phabricator via lldb-commits
paolosev reopened this revision.
paolosev added a comment.
This revision is now accepted and ready to land.

In D72751#1862140 , @labath wrote:

> As promised, here are the comments on the new tests. I think that most of the 
> py3 incompatibilities will go away once we get rid of the yaml preprocessing 
> step, but it would be good to verify this with python 3 nonetheless...


Thank you! Removing the yaml preprocessing indeed simplify everything, now 
tests should work both with Python 2 and 3.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72751



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


[Lldb-commits] [PATCH] D72751: [LLDB] Add DynamicLoaderWasmDYLD plugin for WebAssembly debugging

2020-02-06 Thread Paolo Severini via Phabricator via lldb-commits
paolosev updated this revision to Diff 243045.
paolosev added a comment.

Modified tests to be compatible with Python3.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72751

Files:
  
lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestWasm.py
  
lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/test_sym.yaml
  
lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/test_wasm_embedded_debug_sections.yaml
  
lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/test_wasm_external_debug_sections.yaml
  lldb/source/API/SystemInitializerFull.cpp
  lldb/source/Plugins/DynamicLoader/CMakeLists.txt
  lldb/source/Plugins/DynamicLoader/wasm-DYLD/CMakeLists.txt
  lldb/source/Plugins/DynamicLoader/wasm-DYLD/DynamicLoaderWasmDYLD.cpp
  lldb/source/Plugins/DynamicLoader/wasm-DYLD/DynamicLoaderWasmDYLD.h
  lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
  lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h
  lldb/test/Shell/ObjectFile/wasm/basic.yaml
  lldb/test/Shell/ObjectFile/wasm/embedded-debug-sections.yaml
  lldb/test/Shell/ObjectFile/wasm/stripped-debug-sections.yaml
  lldb/test/Shell/ObjectFile/wasm/unified-debug-sections.yaml
  lldb/tools/lldb-test/SystemInitializerTest.cpp

Index: lldb/tools/lldb-test/SystemInitializerTest.cpp
===
--- lldb/tools/lldb-test/SystemInitializerTest.cpp
+++ lldb/tools/lldb-test/SystemInitializerTest.cpp
@@ -38,6 +38,7 @@
 #include "Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h"
 #include "Plugins/DynamicLoader/Static/DynamicLoaderStatic.h"
 #include "Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h"
+#include "Plugins/DynamicLoader/wasm-DYLD/DynamicLoaderWasmDYLD.h"
 #include "Plugins/Instruction/ARM/EmulateInstructionARM.h"
 #include "Plugins/Instruction/ARM64/EmulateInstructionARM64.h"
 #include "Plugins/Instruction/MIPS/EmulateInstructionMIPS.h"
@@ -244,6 +245,7 @@
   DynamicLoaderMacOSXDYLD::Initialize();
   DynamicLoaderMacOS::Initialize();
   DynamicLoaderPOSIXDYLD::Initialize();
+  wasm::DynamicLoaderWasmDYLD::Initialize(); // before DynamicLoaderStatic.
   DynamicLoaderStatic::Initialize();
   DynamicLoaderWindowsDYLD::Initialize();
 
@@ -332,6 +334,7 @@
   DynamicLoaderMacOSXDYLD::Terminate();
   DynamicLoaderMacOS::Terminate();
   DynamicLoaderPOSIXDYLD::Terminate();
+  wasm::DynamicLoaderWasmDYLD::Terminate();
   DynamicLoaderStatic::Terminate();
   DynamicLoaderWindowsDYLD::Terminate();
 
Index: lldb/test/Shell/ObjectFile/wasm/unified-debug-sections.yaml
===
--- lldb/test/Shell/ObjectFile/wasm/unified-debug-sections.yaml
+++ lldb/test/Shell/ObjectFile/wasm/unified-debug-sections.yaml
@@ -13,11 +13,11 @@
 # CHECK: Plugin name: wasm
 # CHECK: Architecture: wasm32-unknown-unknown-wasm
 # CHECK: UUID: 
-# CHECK: Executable: true
+# CHECK: Executable: false
 # CHECK: Stripped: true
-# CHECK: Type: executable
+# CHECK: Type: shared library
 # CHECK: Strata: user
-# CHECK: Base VM address: 0xa
+# CHECK: Base VM address: 0x0
 
 # CHECK: Name: code
 # CHECK: Type: code
Index: lldb/test/Shell/ObjectFile/wasm/stripped-debug-sections.yaml
===
--- lldb/test/Shell/ObjectFile/wasm/stripped-debug-sections.yaml
+++ lldb/test/Shell/ObjectFile/wasm/stripped-debug-sections.yaml
@@ -4,9 +4,9 @@
 # CHECK: Plugin name: wasm
 # CHECK: Architecture: wasm32-unknown-unknown-wasm
 # CHECK: UUID: 
-# CHECK: Executable: true
-# CHECK: Stripped: true
-# CHECK: Type: executable
+# CHECK: Executable: false
+# CHECK: Stripped: false
+# CHECK: Type: shared library
 # CHECK: Strata: user
 # CHECK: Base VM address: 0x0
 
Index: lldb/test/Shell/ObjectFile/wasm/embedded-debug-sections.yaml
===
--- lldb/test/Shell/ObjectFile/wasm/embedded-debug-sections.yaml
+++ lldb/test/Shell/ObjectFile/wasm/embedded-debug-sections.yaml
@@ -4,11 +4,11 @@
 # CHECK: Plugin name: wasm
 # CHECK: Architecture: wasm32-unknown-unknown-wasm
 # CHECK: UUID: 
-# CHECK: Executable: true
-# CHECK: Stripped: true
-# CHECK: Type: executable
+# CHECK: Executable: false
+# CHECK: Stripped: false
+# CHECK: Type: shared library
 # CHECK: Strata: user
-# CHECK: Base VM address: 0xa
+# CHECK: Base VM address: 0x0
 
 # CHECK: Name: code
 # CHECK: Type: code
Index: lldb/test/Shell/ObjectFile/wasm/basic.yaml
===
--- lldb/test/Shell/ObjectFile/wasm/basic.yaml
+++ lldb/test/Shell/ObjectFile/wasm/basic.yaml
@@ -4,11 +4,11 @@
 # CHECK: Plugin name: wasm
 # CHECK: Architecture: wasm32-unknown-unknown-wasm
 # CHECK: UUID: 
-# CHECK: Executable: true
-# CHECK: Stripped: true
-# CHECK: Type: executable
+# CHECK: Executable: false
+# CHECK: Stripped: 

[Lldb-commits] [lldb] f5cdfb3 - Detect attach fail in debugserver due to non-interactive

2020-02-06 Thread Jason Molenda via lldb-commits

Author: Jason Molenda
Date: 2020-02-06T16:16:01-08:00
New Revision: f5cdfb34cd4b92bc6475f6c61f2996ada3a2ad1f

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

LOG: Detect attach fail in debugserver due to non-interactive
debug session.

Added: 


Modified: 
lldb/tools/debugserver/source/RNBRemote.cpp

Removed: 




diff  --git a/lldb/tools/debugserver/source/RNBRemote.cpp 
b/lldb/tools/debugserver/source/RNBRemote.cpp
index 1f11b2fe8c23..b2fe8a156fa1 100644
--- a/lldb/tools/debugserver/source/RNBRemote.cpp
+++ b/lldb/tools/debugserver/source/RNBRemote.cpp
@@ -12,6 +12,8 @@
 
 #include "RNBRemote.h"
 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -3723,6 +3725,19 @@ static bool process_is_already_being_debugged 
(nub_process_t pid) {
 return false;
 }
 
+// Test if this current login session has a connection to the
+// window server (if it does not have that access, it cannot ask
+// for debug permission by popping up a dialog box and attach
+// may fail outright).
+static bool login_session_has_gui_access () {
+  auditinfo_addr_t info;
+  getaudit_addr(, sizeof(info));
+  if (info.ai_flags & AU_SESSION_FLAG_HAS_GRAPHIC_ACCESS)
+return true;
+  else
+return false;
+}
+
 // Checking for 
 //
 //  {
@@ -4013,12 +4028,23 @@ rnb_err_t RNBRemote::HandlePacket_v(const char *p) {
   return_message += cstring_to_asciihex_string(msg.c_str());
   return SendPacket(return_message.c_str());
 }
-if (!developer_mode_enabled()) {
-  DNBLogError("Developer mode is not enabled");
+if (!login_session_has_gui_access() && !developer_mode_enabled()) {
+  DNBLogError("Developer mode is not enabled and this is a "
+  "non-interactive session");
+  std::string return_message = "E96;";
+  return_message += cstring_to_asciihex_string("developer mode is "
+   "not enabled on this machine "
+   "and this is a non-interactive "
+   "debug session.");
+  return SendPacket(return_message.c_str());
+}
+if (!login_session_has_gui_access()) {
+  DNBLogError("This is a non-interactive session");
   std::string return_message = "E96;";
-  return_message += cstring_to_asciihex_string("developer mode is not "
-   "enabled on this machine.  "
-   "sudo DevToolsSecurity --enable");
+  return_message += cstring_to_asciihex_string("this is a "
+   "non-interactive debug session, "
+   "cannot get permission to debug "
+   "processes.");
   return SendPacket(return_message.c_str());
 }
 if (attach_failed_due_to_sip (pid_attaching_to)) {



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


[Lldb-commits] [PATCH] D74168: [CMake] Make EXCLUDE_FROM_ALL an argument to add_lit_testsuite

2020-02-06 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova accepted this revision.
stella.stamenova added a comment.
This revision is now accepted and ready to land.

Thanks for doing this!


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

https://reviews.llvm.org/D74168



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


[Lldb-commits] [PATCH] D74168: [CMake] Make EXCLUDE_FROM_ALL an argument to add_lit_testsuite

2020-02-06 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 243030.
JDevlieghere added a comment.

Rename the argument from `EXCLUDE_FROM_ALL` to `EXCLUDE_FROM_CHECK_ALL` as per 
Stella's suggestion.


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

https://reviews.llvm.org/D74168

Files:
  clang/utils/perf-training/CMakeLists.txt
  compiler-rt/test/asan/CMakeLists.txt
  compiler-rt/test/fuzzer/CMakeLists.txt
  compiler-rt/test/tsan/CMakeLists.txt
  compiler-rt/test/ubsan/CMakeLists.txt
  lldb/test/Shell/CMakeLists.txt
  llvm/cmake/modules/AddLLVM.cmake
  llvm/test/CMakeLists.txt
  openmp/cmake/OpenMPTesting.cmake
  openmp/libomptarget/deviceRTLs/nvptx/test/CMakeLists.txt
  openmp/runtime/test/CMakeLists.txt

Index: openmp/runtime/test/CMakeLists.txt
===
--- openmp/runtime/test/CMakeLists.txt
+++ openmp/runtime/test/CMakeLists.txt
@@ -32,8 +32,7 @@
 
 add_openmp_testsuite(check-libomp "Running libomp tests" ${CMAKE_CURRENT_BINARY_DIR} DEPENDS omp)
 # Add target check-ompt, but make sure to not add the tests twice to check-openmp.
-set(EXCLUDE_FROM_ALL True)
-add_openmp_testsuite(check-ompt "Running OMPT tests" ${CMAKE_CURRENT_BINARY_DIR}/ompt DEPENDS omp)
+add_openmp_testsuite(check-ompt "Running OMPT tests" ${CMAKE_CURRENT_BINARY_DIR}/ompt EXCLUDE_FROM_CHECK_ALL DEPENDS omp)
 
 # Configure the lit.site.cfg.in file
 set(AUTO_GEN_COMMENT "## Autogenerated by libomp configuration.\n# Do not edit!")
Index: openmp/libomptarget/deviceRTLs/nvptx/test/CMakeLists.txt
===
--- openmp/libomptarget/deviceRTLs/nvptx/test/CMakeLists.txt
+++ openmp/libomptarget/deviceRTLs/nvptx/test/CMakeLists.txt
@@ -8,11 +8,10 @@
   set(deps ${deps} omptarget-nvptx-bc)
 endif()
 
-# Don't run by default.
-set(EXCLUDE_FROM_ALL True)
 # Run with only one thread to only launch one application to the GPU at a time.
 add_openmp_testsuite(check-libomptarget-nvptx
 "Running libomptarget-nvptx tests" ${CMAKE_CURRENT_BINARY_DIR}
+EXCLUDE_FROM_CHECK_ALL
 DEPENDS ${deps} ARGS -j1)
 
 set(LIBOMPTARGET_NVPTX_TEST_FLAGS "" CACHE STRING
Index: openmp/cmake/OpenMPTesting.cmake
===
--- openmp/cmake/OpenMPTesting.cmake
+++ openmp/cmake/OpenMPTesting.cmake
@@ -163,9 +163,9 @@
 return()
   endif()
 
-  cmake_parse_arguments(ARG "" "" "DEPENDS;ARGS" ${ARGN})
-  # EXCLUDE_FROM_ALL excludes the test ${target} out of check-openmp.
-  if (NOT EXCLUDE_FROM_ALL)
+  cmake_parse_arguments(ARG "EXCLUDE_FROM_CHECK_ALL" "" "DEPENDS;ARGS" ${ARGN})
+  # EXCLUDE_FROM_CHECK_ALL excludes the test ${target} out of check-openmp.
+  if (NOT ARG_EXCLUDE_FROM_ALL)
 # Register the testsuites and depends for the check-openmp rule.
 set_property(GLOBAL APPEND PROPERTY OPENMP_LIT_TESTSUITES ${ARG_UNPARSED_ARGUMENTS})
 set_property(GLOBAL APPEND PROPERTY OPENMP_LIT_DEPENDS ${ARG_DEPENDS})
@@ -183,6 +183,7 @@
 add_lit_testsuite(${target}
   ${comment}
   ${ARG_UNPARSED_ARGUMENTS}
+  ${ARG_EXCLUDE_FROM_ALL}
   DEPENDS clang clang-resource-headers FileCheck ${ARG_DEPENDS}
   ARGS ${ARG_ARGS}
 )
@@ -194,6 +195,5 @@
   get_property(OPENMP_LIT_DEPENDS GLOBAL PROPERTY OPENMP_LIT_DEPENDS)
 
   # We already added the testsuites themselves, no need to do that again.
-  set(EXCLUDE_FROM_ALL True)
-  add_openmp_testsuite(check-openmp "Running OpenMP tests" ${OPENMP_LIT_TESTSUITES} DEPENDS ${OPENMP_LIT_DEPENDS})
+  add_openmp_testsuite(check-openmp "Running OpenMP tests" ${OPENMP_LIT_TESTSUITES} EXCLUDE_FROM_CHECK_ALL DEPENDS ${OPENMP_LIT_DEPENDS})
 endfunction()
Index: llvm/test/CMakeLists.txt
===
--- llvm/test/CMakeLists.txt
+++ llvm/test/CMakeLists.txt
@@ -30,11 +30,6 @@
   ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py
   )
 
-# Don't include check-llvm into check-all without LLVM_BUILD_TOOLS.
-if(NOT LLVM_BUILD_TOOLS)
-  set(EXCLUDE_FROM_ALL ON)
-endif()
-
 # Set the depends list as a variable so that it can grow conditionally.
 # NOTE: Sync the substitutions in test/lit.cfg when adding to this list.
 set(LLVM_TEST_DEPENDS
@@ -173,13 +168,21 @@
 add_custom_target(llvm-test-depends DEPENDS ${LLVM_TEST_DEPENDS})
 set_target_properties(llvm-test-depends PROPERTIES FOLDER "Tests")
 
+if(LLVM_BUILD_TOOLS)
+  set(exclude_from_check_all "EXCLUDE_FROM_CHECK_ALL")
+else()
+  set(exclude_from_check_all "")
+endif()
+
 add_lit_testsuite(check-llvm "Running the LLVM regression tests"
   ${CMAKE_CURRENT_BINARY_DIR}
+  ${exclude_from_check_all}
   DEPENDS ${LLVM_TEST_DEPENDS}
   )
 set_target_properties(check-llvm PROPERTIES FOLDER "Tests")
 
 add_lit_testsuites(LLVM ${CMAKE_CURRENT_SOURCE_DIR}
+  ${exclude_from_check_all}
   DEPENDS ${LLVM_TEST_DEPENDS}
   )
 
Index: llvm/cmake/modules/AddLLVM.cmake
===
--- 

[Lldb-commits] [PATCH] D74168: [CMake] Make EXCLUDE_FROM_ALL an argument to add_lit_testsuite

2020-02-06 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 243031.

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

https://reviews.llvm.org/D74168

Files:
  clang/utils/perf-training/CMakeLists.txt
  compiler-rt/test/asan/CMakeLists.txt
  compiler-rt/test/fuzzer/CMakeLists.txt
  compiler-rt/test/tsan/CMakeLists.txt
  compiler-rt/test/ubsan/CMakeLists.txt
  lldb/test/Shell/CMakeLists.txt
  llvm/cmake/modules/AddLLVM.cmake
  llvm/test/CMakeLists.txt
  openmp/cmake/OpenMPTesting.cmake
  openmp/libomptarget/deviceRTLs/nvptx/test/CMakeLists.txt
  openmp/runtime/test/CMakeLists.txt

Index: openmp/runtime/test/CMakeLists.txt
===
--- openmp/runtime/test/CMakeLists.txt
+++ openmp/runtime/test/CMakeLists.txt
@@ -32,8 +32,7 @@
 
 add_openmp_testsuite(check-libomp "Running libomp tests" ${CMAKE_CURRENT_BINARY_DIR} DEPENDS omp)
 # Add target check-ompt, but make sure to not add the tests twice to check-openmp.
-set(EXCLUDE_FROM_ALL True)
-add_openmp_testsuite(check-ompt "Running OMPT tests" ${CMAKE_CURRENT_BINARY_DIR}/ompt DEPENDS omp)
+add_openmp_testsuite(check-ompt "Running OMPT tests" ${CMAKE_CURRENT_BINARY_DIR}/ompt EXCLUDE_FROM_CHECK_ALL DEPENDS omp)
 
 # Configure the lit.site.cfg.in file
 set(AUTO_GEN_COMMENT "## Autogenerated by libomp configuration.\n# Do not edit!")
Index: openmp/libomptarget/deviceRTLs/nvptx/test/CMakeLists.txt
===
--- openmp/libomptarget/deviceRTLs/nvptx/test/CMakeLists.txt
+++ openmp/libomptarget/deviceRTLs/nvptx/test/CMakeLists.txt
@@ -8,11 +8,10 @@
   set(deps ${deps} omptarget-nvptx-bc)
 endif()
 
-# Don't run by default.
-set(EXCLUDE_FROM_ALL True)
 # Run with only one thread to only launch one application to the GPU at a time.
 add_openmp_testsuite(check-libomptarget-nvptx
 "Running libomptarget-nvptx tests" ${CMAKE_CURRENT_BINARY_DIR}
+EXCLUDE_FROM_CHECK_ALL
 DEPENDS ${deps} ARGS -j1)
 
 set(LIBOMPTARGET_NVPTX_TEST_FLAGS "" CACHE STRING
Index: openmp/cmake/OpenMPTesting.cmake
===
--- openmp/cmake/OpenMPTesting.cmake
+++ openmp/cmake/OpenMPTesting.cmake
@@ -163,9 +163,9 @@
 return()
   endif()
 
-  cmake_parse_arguments(ARG "" "" "DEPENDS;ARGS" ${ARGN})
-  # EXCLUDE_FROM_ALL excludes the test ${target} out of check-openmp.
-  if (NOT EXCLUDE_FROM_ALL)
+  cmake_parse_arguments(ARG "EXCLUDE_FROM_CHECK_ALL" "" "DEPENDS;ARGS" ${ARGN})
+  # EXCLUDE_FROM_CHECK_ALL excludes the test ${target} out of check-openmp.
+  if (NOT ARG_EXCLUDE_FROM_CHECK_ALL)
 # Register the testsuites and depends for the check-openmp rule.
 set_property(GLOBAL APPEND PROPERTY OPENMP_LIT_TESTSUITES ${ARG_UNPARSED_ARGUMENTS})
 set_property(GLOBAL APPEND PROPERTY OPENMP_LIT_DEPENDS ${ARG_DEPENDS})
@@ -183,6 +183,7 @@
 add_lit_testsuite(${target}
   ${comment}
   ${ARG_UNPARSED_ARGUMENTS}
+  ${ARG_EXCLUDE_FROM_CHECK_ALL}
   DEPENDS clang clang-resource-headers FileCheck ${ARG_DEPENDS}
   ARGS ${ARG_ARGS}
 )
@@ -194,6 +195,5 @@
   get_property(OPENMP_LIT_DEPENDS GLOBAL PROPERTY OPENMP_LIT_DEPENDS)
 
   # We already added the testsuites themselves, no need to do that again.
-  set(EXCLUDE_FROM_ALL True)
-  add_openmp_testsuite(check-openmp "Running OpenMP tests" ${OPENMP_LIT_TESTSUITES} DEPENDS ${OPENMP_LIT_DEPENDS})
+  add_openmp_testsuite(check-openmp "Running OpenMP tests" ${OPENMP_LIT_TESTSUITES} EXCLUDE_FROM_CHECK_ALL DEPENDS ${OPENMP_LIT_DEPENDS})
 endfunction()
Index: llvm/test/CMakeLists.txt
===
--- llvm/test/CMakeLists.txt
+++ llvm/test/CMakeLists.txt
@@ -30,11 +30,6 @@
   ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py
   )
 
-# Don't include check-llvm into check-all without LLVM_BUILD_TOOLS.
-if(NOT LLVM_BUILD_TOOLS)
-  set(EXCLUDE_FROM_ALL ON)
-endif()
-
 # Set the depends list as a variable so that it can grow conditionally.
 # NOTE: Sync the substitutions in test/lit.cfg when adding to this list.
 set(LLVM_TEST_DEPENDS
@@ -173,13 +168,21 @@
 add_custom_target(llvm-test-depends DEPENDS ${LLVM_TEST_DEPENDS})
 set_target_properties(llvm-test-depends PROPERTIES FOLDER "Tests")
 
+if(LLVM_BUILD_TOOLS)
+  set(exclude_from_check_all "EXCLUDE_FROM_CHECK_ALL")
+else()
+  set(exclude_from_check_all "")
+endif()
+
 add_lit_testsuite(check-llvm "Running the LLVM regression tests"
   ${CMAKE_CURRENT_BINARY_DIR}
+  ${exclude_from_check_all}
   DEPENDS ${LLVM_TEST_DEPENDS}
   )
 set_target_properties(check-llvm PROPERTIES FOLDER "Tests")
 
 add_lit_testsuites(LLVM ${CMAKE_CURRENT_SOURCE_DIR}
+  ${exclude_from_check_all}
   DEPENDS ${LLVM_TEST_DEPENDS}
   )
 
Index: llvm/cmake/modules/AddLLVM.cmake
===
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -1560,10 +1560,10 @@
 
 # A function to add a set of lit test suites to be 

[Lldb-commits] [PATCH] D74168: [CMake] Make EXCLUDE_FROM_ALL an argument to add_lit_testsuite

2020-02-06 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 243018.
JDevlieghere added a comment.
Herald added a reviewer: jdoerfert.

Update all uses of `add_lit_testsuite` to pass `EXCLUDE_FROM_ALL` as an 
argument rather than a scoped variable.


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

https://reviews.llvm.org/D74168

Files:
  clang/utils/perf-training/CMakeLists.txt
  compiler-rt/test/asan/CMakeLists.txt
  compiler-rt/test/fuzzer/CMakeLists.txt
  compiler-rt/test/tsan/CMakeLists.txt
  compiler-rt/test/ubsan/CMakeLists.txt
  lldb/test/Shell/CMakeLists.txt
  llvm/cmake/modules/AddLLVM.cmake
  llvm/test/CMakeLists.txt
  openmp/cmake/OpenMPTesting.cmake
  openmp/libomptarget/deviceRTLs/nvptx/test/CMakeLists.txt
  openmp/runtime/test/CMakeLists.txt

Index: openmp/runtime/test/CMakeLists.txt
===
--- openmp/runtime/test/CMakeLists.txt
+++ openmp/runtime/test/CMakeLists.txt
@@ -32,8 +32,7 @@
 
 add_openmp_testsuite(check-libomp "Running libomp tests" ${CMAKE_CURRENT_BINARY_DIR} DEPENDS omp)
 # Add target check-ompt, but make sure to not add the tests twice to check-openmp.
-set(EXCLUDE_FROM_ALL True)
-add_openmp_testsuite(check-ompt "Running OMPT tests" ${CMAKE_CURRENT_BINARY_DIR}/ompt DEPENDS omp)
+add_openmp_testsuite(check-ompt "Running OMPT tests" ${CMAKE_CURRENT_BINARY_DIR}/ompt EXCLUDE_FROM_ALL DEPENDS omp)
 
 # Configure the lit.site.cfg.in file
 set(AUTO_GEN_COMMENT "## Autogenerated by libomp configuration.\n# Do not edit!")
Index: openmp/libomptarget/deviceRTLs/nvptx/test/CMakeLists.txt
===
--- openmp/libomptarget/deviceRTLs/nvptx/test/CMakeLists.txt
+++ openmp/libomptarget/deviceRTLs/nvptx/test/CMakeLists.txt
@@ -8,11 +8,10 @@
   set(deps ${deps} omptarget-nvptx-bc)
 endif()
 
-# Don't run by default.
-set(EXCLUDE_FROM_ALL True)
 # Run with only one thread to only launch one application to the GPU at a time.
 add_openmp_testsuite(check-libomptarget-nvptx
 "Running libomptarget-nvptx tests" ${CMAKE_CURRENT_BINARY_DIR}
+EXCLUDE_FROM_ALL
 DEPENDS ${deps} ARGS -j1)
 
 set(LIBOMPTARGET_NVPTX_TEST_FLAGS "" CACHE STRING
Index: openmp/cmake/OpenMPTesting.cmake
===
--- openmp/cmake/OpenMPTesting.cmake
+++ openmp/cmake/OpenMPTesting.cmake
@@ -163,9 +163,9 @@
 return()
   endif()
 
-  cmake_parse_arguments(ARG "" "" "DEPENDS;ARGS" ${ARGN})
+  cmake_parse_arguments(ARG "EXCLUDE_FROM_ALL" "" "DEPENDS;ARGS" ${ARGN})
   # EXCLUDE_FROM_ALL excludes the test ${target} out of check-openmp.
-  if (NOT EXCLUDE_FROM_ALL)
+  if (NOT ARG_EXCLUDE_FROM_ALL)
 # Register the testsuites and depends for the check-openmp rule.
 set_property(GLOBAL APPEND PROPERTY OPENMP_LIT_TESTSUITES ${ARG_UNPARSED_ARGUMENTS})
 set_property(GLOBAL APPEND PROPERTY OPENMP_LIT_DEPENDS ${ARG_DEPENDS})
@@ -183,6 +183,7 @@
 add_lit_testsuite(${target}
   ${comment}
   ${ARG_UNPARSED_ARGUMENTS}
+  ${ARG_EXCLUDE_FROM_ALL}
   DEPENDS clang clang-resource-headers FileCheck ${ARG_DEPENDS}
   ARGS ${ARG_ARGS}
 )
Index: llvm/test/CMakeLists.txt
===
--- llvm/test/CMakeLists.txt
+++ llvm/test/CMakeLists.txt
@@ -30,11 +30,6 @@
   ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py
   )
 
-# Don't include check-llvm into check-all without LLVM_BUILD_TOOLS.
-if(NOT LLVM_BUILD_TOOLS)
-  set(EXCLUDE_FROM_ALL ON)
-endif()
-
 # Set the depends list as a variable so that it can grow conditionally.
 # NOTE: Sync the substitutions in test/lit.cfg when adding to this list.
 set(LLVM_TEST_DEPENDS
@@ -173,13 +168,21 @@
 add_custom_target(llvm-test-depends DEPENDS ${LLVM_TEST_DEPENDS})
 set_target_properties(llvm-test-depends PROPERTIES FOLDER "Tests")
 
+if(LLVM_BUILD_TOOLS)
+  set(exclude_from_all "EXCLUDE_FROM_ALL")
+else()
+  set(exclude_from_all "")
+endif()
+
 add_lit_testsuite(check-llvm "Running the LLVM regression tests"
   ${CMAKE_CURRENT_BINARY_DIR}
+  ${exclude_from_all}
   DEPENDS ${LLVM_TEST_DEPENDS}
   )
 set_target_properties(check-llvm PROPERTIES FOLDER "Tests")
 
 add_lit_testsuites(LLVM ${CMAKE_CURRENT_SOURCE_DIR}
+  ${exclude_from_all}
   DEPENDS ${LLVM_TEST_DEPENDS}
   )
 
Index: llvm/cmake/modules/AddLLVM.cmake
===
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -1560,10 +1560,10 @@
 
 # A function to add a set of lit test suites to be driven through 'check-*' targets.
 function(add_lit_testsuite target comment)
-  cmake_parse_arguments(ARG "" "" "PARAMS;DEPENDS;ARGS" ${ARGN})
+  cmake_parse_arguments(ARG "EXCLUDE_FROM_ALL" "" "PARAMS;DEPENDS;ARGS" ${ARGN})
 
   # EXCLUDE_FROM_ALL excludes the test ${target} out of check-all.
-  if(NOT EXCLUDE_FROM_ALL)
+  if(NOT ARG_EXCLUDE_FROM_ALL)
 # Register the testsuites, params and depends for the global 

[Lldb-commits] [PATCH] D74168: [CMake] Make EXCLUDE_FROM_ALL an argument to add_lit_testsuite

2020-02-06 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 243021.
JDevlieghere added a comment.

Simplify logic in `asan/CMakeLists.txt`


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

https://reviews.llvm.org/D74168

Files:
  clang/utils/perf-training/CMakeLists.txt
  compiler-rt/test/asan/CMakeLists.txt
  compiler-rt/test/fuzzer/CMakeLists.txt
  compiler-rt/test/tsan/CMakeLists.txt
  compiler-rt/test/ubsan/CMakeLists.txt
  lldb/test/Shell/CMakeLists.txt
  llvm/cmake/modules/AddLLVM.cmake
  llvm/test/CMakeLists.txt
  openmp/cmake/OpenMPTesting.cmake
  openmp/libomptarget/deviceRTLs/nvptx/test/CMakeLists.txt
  openmp/runtime/test/CMakeLists.txt

Index: openmp/runtime/test/CMakeLists.txt
===
--- openmp/runtime/test/CMakeLists.txt
+++ openmp/runtime/test/CMakeLists.txt
@@ -32,8 +32,7 @@
 
 add_openmp_testsuite(check-libomp "Running libomp tests" ${CMAKE_CURRENT_BINARY_DIR} DEPENDS omp)
 # Add target check-ompt, but make sure to not add the tests twice to check-openmp.
-set(EXCLUDE_FROM_ALL True)
-add_openmp_testsuite(check-ompt "Running OMPT tests" ${CMAKE_CURRENT_BINARY_DIR}/ompt DEPENDS omp)
+add_openmp_testsuite(check-ompt "Running OMPT tests" ${CMAKE_CURRENT_BINARY_DIR}/ompt EXCLUDE_FROM_ALL DEPENDS omp)
 
 # Configure the lit.site.cfg.in file
 set(AUTO_GEN_COMMENT "## Autogenerated by libomp configuration.\n# Do not edit!")
Index: openmp/libomptarget/deviceRTLs/nvptx/test/CMakeLists.txt
===
--- openmp/libomptarget/deviceRTLs/nvptx/test/CMakeLists.txt
+++ openmp/libomptarget/deviceRTLs/nvptx/test/CMakeLists.txt
@@ -8,11 +8,10 @@
   set(deps ${deps} omptarget-nvptx-bc)
 endif()
 
-# Don't run by default.
-set(EXCLUDE_FROM_ALL True)
 # Run with only one thread to only launch one application to the GPU at a time.
 add_openmp_testsuite(check-libomptarget-nvptx
 "Running libomptarget-nvptx tests" ${CMAKE_CURRENT_BINARY_DIR}
+EXCLUDE_FROM_ALL
 DEPENDS ${deps} ARGS -j1)
 
 set(LIBOMPTARGET_NVPTX_TEST_FLAGS "" CACHE STRING
Index: openmp/cmake/OpenMPTesting.cmake
===
--- openmp/cmake/OpenMPTesting.cmake
+++ openmp/cmake/OpenMPTesting.cmake
@@ -163,9 +163,9 @@
 return()
   endif()
 
-  cmake_parse_arguments(ARG "" "" "DEPENDS;ARGS" ${ARGN})
+  cmake_parse_arguments(ARG "EXCLUDE_FROM_ALL" "" "DEPENDS;ARGS" ${ARGN})
   # EXCLUDE_FROM_ALL excludes the test ${target} out of check-openmp.
-  if (NOT EXCLUDE_FROM_ALL)
+  if (NOT ARG_EXCLUDE_FROM_ALL)
 # Register the testsuites and depends for the check-openmp rule.
 set_property(GLOBAL APPEND PROPERTY OPENMP_LIT_TESTSUITES ${ARG_UNPARSED_ARGUMENTS})
 set_property(GLOBAL APPEND PROPERTY OPENMP_LIT_DEPENDS ${ARG_DEPENDS})
@@ -183,6 +183,7 @@
 add_lit_testsuite(${target}
   ${comment}
   ${ARG_UNPARSED_ARGUMENTS}
+  ${ARG_EXCLUDE_FROM_ALL}
   DEPENDS clang clang-resource-headers FileCheck ${ARG_DEPENDS}
   ARGS ${ARG_ARGS}
 )
Index: llvm/test/CMakeLists.txt
===
--- llvm/test/CMakeLists.txt
+++ llvm/test/CMakeLists.txt
@@ -30,11 +30,6 @@
   ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py
   )
 
-# Don't include check-llvm into check-all without LLVM_BUILD_TOOLS.
-if(NOT LLVM_BUILD_TOOLS)
-  set(EXCLUDE_FROM_ALL ON)
-endif()
-
 # Set the depends list as a variable so that it can grow conditionally.
 # NOTE: Sync the substitutions in test/lit.cfg when adding to this list.
 set(LLVM_TEST_DEPENDS
@@ -173,13 +168,21 @@
 add_custom_target(llvm-test-depends DEPENDS ${LLVM_TEST_DEPENDS})
 set_target_properties(llvm-test-depends PROPERTIES FOLDER "Tests")
 
+if(LLVM_BUILD_TOOLS)
+  set(exclude_from_all "EXCLUDE_FROM_ALL")
+else()
+  set(exclude_from_all "")
+endif()
+
 add_lit_testsuite(check-llvm "Running the LLVM regression tests"
   ${CMAKE_CURRENT_BINARY_DIR}
+  ${exclude_from_all}
   DEPENDS ${LLVM_TEST_DEPENDS}
   )
 set_target_properties(check-llvm PROPERTIES FOLDER "Tests")
 
 add_lit_testsuites(LLVM ${CMAKE_CURRENT_SOURCE_DIR}
+  ${exclude_from_all}
   DEPENDS ${LLVM_TEST_DEPENDS}
   )
 
Index: llvm/cmake/modules/AddLLVM.cmake
===
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -1560,10 +1560,10 @@
 
 # A function to add a set of lit test suites to be driven through 'check-*' targets.
 function(add_lit_testsuite target comment)
-  cmake_parse_arguments(ARG "" "" "PARAMS;DEPENDS;ARGS" ${ARGN})
+  cmake_parse_arguments(ARG "EXCLUDE_FROM_ALL" "" "PARAMS;DEPENDS;ARGS" ${ARGN})
 
   # EXCLUDE_FROM_ALL excludes the test ${target} out of check-all.
-  if(NOT EXCLUDE_FROM_ALL)
+  if(NOT ARG_EXCLUDE_FROM_ALL)
 # Register the testsuites, params and depends for the global check rule.
 set_property(GLOBAL APPEND PROPERTY LLVM_LIT_TESTSUITES ${ARG_UNPARSED_ARGUMENTS})
 

[Lldb-commits] [PATCH] D74157: [lldb/API] NFC: Reformat SBThread::GetStopDescription()

2020-02-06 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.

In D74157#1862537 , @labath wrote:

> Looks better. TBH, I'm not sure why/if we really need the case handling the 
> situation where the thread does not have a stop description. Ideally I'd just 
> move this code there (or delete it).


+1, this doesn't seem like something that should be done at the API level. 
Otherwise LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74157



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


[Lldb-commits] [PATCH] D74168: [lldb\CMake] Exclude the reproducer test suites from check-all

2020-02-06 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova added inline comments.



Comment at: lldb/test/Shell/CMakeLists.txt:24
   PARAMS "lldb-run-with-repro=capture"
+  EXCLUDE_FROM_ALL
   DEPENDS lldb-test-deps)

After the change you made to add_lit_testsuite, this can be anywhere in the 
function call - including the end, if you so desire.


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

https://reviews.llvm.org/D74168



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


[Lldb-commits] [PATCH] D74168: [lldb\CMake] Exclude the reproducer test suites from check-all

2020-02-06 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 243010.
JDevlieghere added a comment.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Make EXCLUDE_FROM_ALL an argument to `add_lit_testsuite`


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

https://reviews.llvm.org/D74168

Files:
  lldb/test/Shell/CMakeLists.txt
  llvm/cmake/modules/AddLLVM.cmake


Index: llvm/cmake/modules/AddLLVM.cmake
===
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -1560,10 +1560,10 @@
 
 # A function to add a set of lit test suites to be driven through 'check-*' 
targets.
 function(add_lit_testsuite target comment)
-  cmake_parse_arguments(ARG "" "" "PARAMS;DEPENDS;ARGS" ${ARGN})
+  cmake_parse_arguments(ARG "EXCLUDE_FROM_ALL" "" "PARAMS;DEPENDS;ARGS" 
${ARGN})
 
   # EXCLUDE_FROM_ALL excludes the test ${target} out of check-all.
-  if(NOT EXCLUDE_FROM_ALL)
+  if(NOT EXCLUDE_FROM_ALL AND NOT ARG_EXCLUDE_FROM_ALL)
 # Register the testsuites, params and depends for the global check rule.
 set_property(GLOBAL APPEND PROPERTY LLVM_LIT_TESTSUITES 
${ARG_UNPARSED_ARGUMENTS})
 set_property(GLOBAL APPEND PROPERTY LLVM_LIT_PARAMS ${ARG_PARAMS})
Index: lldb/test/Shell/CMakeLists.txt
===
--- lldb/test/Shell/CMakeLists.txt
+++ lldb/test/Shell/CMakeLists.txt
@@ -21,6 +21,7 @@
   "Running lldb shell test suite with reproducer capture"
   ${CMAKE_CURRENT_BINARY_DIR}
   PARAMS "lldb-run-with-repro=capture"
+  EXCLUDE_FROM_ALL
   DEPENDS lldb-test-deps)
 
 # Add a lit test suite that runs the shell test by replaying a reproducer.
@@ -28,5 +29,6 @@
   "Running lldb shell test suite with reproducer replay"
   ${CMAKE_CURRENT_BINARY_DIR}
   PARAMS "lldb-run-with-repro=replay"
+  EXCLUDE_FROM_ALL
   DEPENDS lldb-test-deps)
 add_dependencies(check-lldb-repro check-lldb-repro-capture)


Index: llvm/cmake/modules/AddLLVM.cmake
===
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -1560,10 +1560,10 @@
 
 # A function to add a set of lit test suites to be driven through 'check-*' targets.
 function(add_lit_testsuite target comment)
-  cmake_parse_arguments(ARG "" "" "PARAMS;DEPENDS;ARGS" ${ARGN})
+  cmake_parse_arguments(ARG "EXCLUDE_FROM_ALL" "" "PARAMS;DEPENDS;ARGS" ${ARGN})
 
   # EXCLUDE_FROM_ALL excludes the test ${target} out of check-all.
-  if(NOT EXCLUDE_FROM_ALL)
+  if(NOT EXCLUDE_FROM_ALL AND NOT ARG_EXCLUDE_FROM_ALL)
 # Register the testsuites, params and depends for the global check rule.
 set_property(GLOBAL APPEND PROPERTY LLVM_LIT_TESTSUITES ${ARG_UNPARSED_ARGUMENTS})
 set_property(GLOBAL APPEND PROPERTY LLVM_LIT_PARAMS ${ARG_PARAMS})
Index: lldb/test/Shell/CMakeLists.txt
===
--- lldb/test/Shell/CMakeLists.txt
+++ lldb/test/Shell/CMakeLists.txt
@@ -21,6 +21,7 @@
   "Running lldb shell test suite with reproducer capture"
   ${CMAKE_CURRENT_BINARY_DIR}
   PARAMS "lldb-run-with-repro=capture"
+  EXCLUDE_FROM_ALL
   DEPENDS lldb-test-deps)
 
 # Add a lit test suite that runs the shell test by replaying a reproducer.
@@ -28,5 +29,6 @@
   "Running lldb shell test suite with reproducer replay"
   ${CMAKE_CURRENT_BINARY_DIR}
   PARAMS "lldb-run-with-repro=replay"
+  EXCLUDE_FROM_ALL
   DEPENDS lldb-test-deps)
 add_dependencies(check-lldb-repro check-lldb-repro-capture)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D74168: [lldb\CMake] Exclude the reproducer test suites from check-all

2020-02-06 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added a reviewer: stella.stamenova.
Herald added a subscriber: mgorny.
Herald added a project: LLDB.
JDevlieghere updated this revision to Diff 243003.

The capture & replay test suites should be optional and not part of `check-all`.


https://reviews.llvm.org/D74168

Files:
  lldb/test/Shell/CMakeLists.txt


Index: lldb/test/Shell/CMakeLists.txt
===
--- lldb/test/Shell/CMakeLists.txt
+++ lldb/test/Shell/CMakeLists.txt
@@ -21,6 +21,7 @@
   "Running lldb shell test suite with reproducer capture"
   ${CMAKE_CURRENT_BINARY_DIR}
   PARAMS "lldb-run-with-repro=capture"
+  EXCLUDE_FROM_ALL
   DEPENDS lldb-test-deps)
 
 # Add a lit test suite that runs the shell test by replaying a reproducer.
@@ -28,5 +29,6 @@
   "Running lldb shell test suite with reproducer replay"
   ${CMAKE_CURRENT_BINARY_DIR}
   PARAMS "lldb-run-with-repro=replay"
+  EXCLUDE_FROM_ALL
   DEPENDS lldb-test-deps)
 add_dependencies(check-lldb-repro check-lldb-repro-capture)


Index: lldb/test/Shell/CMakeLists.txt
===
--- lldb/test/Shell/CMakeLists.txt
+++ lldb/test/Shell/CMakeLists.txt
@@ -21,6 +21,7 @@
   "Running lldb shell test suite with reproducer capture"
   ${CMAKE_CURRENT_BINARY_DIR}
   PARAMS "lldb-run-with-repro=capture"
+  EXCLUDE_FROM_ALL
   DEPENDS lldb-test-deps)
 
 # Add a lit test suite that runs the shell test by replaying a reproducer.
@@ -28,5 +29,6 @@
   "Running lldb shell test suite with reproducer replay"
   ${CMAKE_CURRENT_BINARY_DIR}
   PARAMS "lldb-run-with-repro=replay"
+  EXCLUDE_FROM_ALL
   DEPENDS lldb-test-deps)
 add_dependencies(check-lldb-repro check-lldb-repro-capture)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D74168: [lldb\CMake] Exclude the reproducer test suites from check-all

2020-02-06 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 243003.

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

https://reviews.llvm.org/D74168

Files:
  lldb/test/Shell/CMakeLists.txt


Index: lldb/test/Shell/CMakeLists.txt
===
--- lldb/test/Shell/CMakeLists.txt
+++ lldb/test/Shell/CMakeLists.txt
@@ -21,6 +21,7 @@
   "Running lldb shell test suite with reproducer capture"
   ${CMAKE_CURRENT_BINARY_DIR}
   PARAMS "lldb-run-with-repro=capture"
+  EXCLUDE_FROM_ALL
   DEPENDS lldb-test-deps)
 
 # Add a lit test suite that runs the shell test by replaying a reproducer.
@@ -28,5 +29,6 @@
   "Running lldb shell test suite with reproducer replay"
   ${CMAKE_CURRENT_BINARY_DIR}
   PARAMS "lldb-run-with-repro=replay"
+  EXCLUDE_FROM_ALL
   DEPENDS lldb-test-deps)
 add_dependencies(check-lldb-repro check-lldb-repro-capture)


Index: lldb/test/Shell/CMakeLists.txt
===
--- lldb/test/Shell/CMakeLists.txt
+++ lldb/test/Shell/CMakeLists.txt
@@ -21,6 +21,7 @@
   "Running lldb shell test suite with reproducer capture"
   ${CMAKE_CURRENT_BINARY_DIR}
   PARAMS "lldb-run-with-repro=capture"
+  EXCLUDE_FROM_ALL
   DEPENDS lldb-test-deps)
 
 # Add a lit test suite that runs the shell test by replaying a reproducer.
@@ -28,5 +29,6 @@
   "Running lldb shell test suite with reproducer replay"
   ${CMAKE_CURRENT_BINARY_DIR}
   PARAMS "lldb-run-with-repro=replay"
+  EXCLUDE_FROM_ALL
   DEPENDS lldb-test-deps)
 add_dependencies(check-lldb-repro check-lldb-repro-capture)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 5e3fe22 - [lldb/Reproducers] Refactor GetStopReasonExtendedBacktraces (NFC)

2020-02-06 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-02-06T14:00:09-08:00
New Revision: 5e3fe22c636274d4308400b0c2c9bc533ed0c49b

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

LOG: [lldb/Reproducers] Refactor GetStopReasonExtendedBacktraces (NFC)

Refactore GetStopReasonExtendedBacktraces so that the reproducer macro
is passed an instrumented copy constructor rather than the constructor
taking a ThreadCollectionSP, which is not instrumented.

Added: 


Modified: 
lldb/source/API/SBThread.cpp

Removed: 




diff  --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp
index a88e8442986d..0d3dd6d30e52 100644
--- a/lldb/source/API/SBThread.cpp
+++ b/lldb/source/API/SBThread.cpp
@@ -292,14 +292,13 @@ 
SBThread::GetStopReasonExtendedBacktraces(InstrumentationRuntimeType type) {
  GetStopReasonExtendedBacktraces,
  (lldb::InstrumentationRuntimeType), type);
 
-  ThreadCollectionSP threads;
-  threads = std::make_shared();
+  SBThreadCollection threads;
 
   std::unique_lock lock;
   ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
   if (!exe_ctx.HasThreadScope())
-return LLDB_RECORD_RESULT(threads);
+return LLDB_RECORD_RESULT(SBThreadCollection());
 
   ProcessSP process_sp = exe_ctx.GetProcessSP();
 
@@ -308,8 +307,9 @@ 
SBThread::GetStopReasonExtendedBacktraces(InstrumentationRuntimeType type) {
   if (!info)
 return LLDB_RECORD_RESULT(threads);
 
-  return LLDB_RECORD_RESULT(process_sp->GetInstrumentationRuntime(type)
-->GetBacktracesFromExtendedStopInfo(info));
+  threads = process_sp->GetInstrumentationRuntime(type)
+->GetBacktracesFromExtendedStopInfo(info);
+  return LLDB_RECORD_RESULT(threads);
 }
 
 size_t SBThread::GetStopDescription(char *dst, size_t dst_len) {



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


[Lldb-commits] [lldb] 2d59178 - [lldb/Reproducers] Add missing strings for redirect macro

2020-02-06 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-02-06T14:01:03-08:00
New Revision: 2d591786343288828d00b9601693bb9d1663c2a9

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

LOG: [lldb/Reproducers] Add missing strings for redirect macro

Added: 


Modified: 
lldb/include/lldb/Utility/ReproducerInstrumentation.h

Removed: 




diff  --git a/lldb/include/lldb/Utility/ReproducerInstrumentation.h 
b/lldb/include/lldb/Utility/ReproducerInstrumentation.h
index a562511d6012..944d46340622 100644
--- a/lldb/include/lldb/Utility/ReproducerInstrumentation.h
+++ b/lldb/include/lldb/Utility/ReproducerInstrumentation.h
@@ -96,7 +96,8 @@ template  inline std::string 
stringify_args(const Ts &... ts) {
   return char_ptr_redirect_static(Class::Method, s, l);
\
 }; 
\
 R.Register(
\
-static_cast(::Method), _redirect);   
\
+static_cast(::Method), _redirect,
\
+#Result, #Class, #Method, "(char*, size_t");   
\
   }
 #define LLDB_REGISTER_CHAR_PTR_REDIRECT(Result, Class, Method) 
\
   {
\



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


[Lldb-commits] [PATCH] D74153: [lldb] Delete the SharingPtr class

2020-02-06 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Actually, it looks like we were getting away with that because the whole 
ValueObjectRegisterContext (*not* RegisterSet) class is unused. In fact the 
whole concept of having the entire register context as a "value" seems fairly 
odd to me. Can we just delete it?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74153



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


[Lldb-commits] [PATCH] D74157: [lldb/API] NFC: Reformat SBThread::GetStopDescription()

2020-02-06 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

Looks better. TBH, I'm not sure why/if we really need the case handling the 
situation where the thread does not have a stop description. Ideally I'd just 
move this code there (or delete it).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74157



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


[Lldb-commits] [PATCH] D74160: [lldb] removed no longer needed CMakeDependentOption

2020-02-06 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

ship it


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74160



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


[Lldb-commits] [PATCH] D74160: [lldb] removed no longer needed CMakeDependentOption

2020-02-06 Thread Konrad Wilhelm Kleine via Phabricator via lldb-commits
kwk created this revision.
kwk added a reviewer: JDevlieghere.
Herald added subscribers: lldb-commits, mgorny.
Herald added a project: LLDB.
kwk updated this revision to Diff 242991.
kwk added a comment.
kwk edited the summary of this revision.
kwk edited the summary of this revision.

Removed typo in commit message


In D66791  I've introduced this 
`CMakeDependentOption` 
 but in
D71306  @JDevlieghere has changed the way 
optional dependencies
are handled in LLDB. Today there's no occurence of
`cmake_dependent_option` inside the lldb source tree.

That's why this include can be removed.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74160

Files:
  lldb/cmake/modules/LLDBConfig.cmake


Index: lldb/cmake/modules/LLDBConfig.cmake
===
--- lldb/cmake/modules/LLDBConfig.cmake
+++ lldb/cmake/modules/LLDBConfig.cmake
@@ -1,6 +1,5 @@
 include(CheckCXXSymbolExists)
 include(CheckTypeSize)
-include(CMakeDependentOption)
 
 set(LLDB_PROJECT_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
 set(LLDB_SOURCE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/source")


Index: lldb/cmake/modules/LLDBConfig.cmake
===
--- lldb/cmake/modules/LLDBConfig.cmake
+++ lldb/cmake/modules/LLDBConfig.cmake
@@ -1,6 +1,5 @@
 include(CheckCXXSymbolExists)
 include(CheckTypeSize)
-include(CMakeDependentOption)
 
 set(LLDB_PROJECT_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
 set(LLDB_SOURCE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/source")
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D74160: [lldb] removed no longer needed CMakeDependentOption

2020-02-06 Thread Konrad Wilhelm Kleine via Phabricator via lldb-commits
kwk updated this revision to Diff 242991.
kwk added a comment.

Removed typo in commit message


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74160

Files:
  lldb/cmake/modules/LLDBConfig.cmake


Index: lldb/cmake/modules/LLDBConfig.cmake
===
--- lldb/cmake/modules/LLDBConfig.cmake
+++ lldb/cmake/modules/LLDBConfig.cmake
@@ -1,6 +1,5 @@
 include(CheckCXXSymbolExists)
 include(CheckTypeSize)
-include(CMakeDependentOption)
 
 set(LLDB_PROJECT_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
 set(LLDB_SOURCE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/source")


Index: lldb/cmake/modules/LLDBConfig.cmake
===
--- lldb/cmake/modules/LLDBConfig.cmake
+++ lldb/cmake/modules/LLDBConfig.cmake
@@ -1,6 +1,5 @@
 include(CheckCXXSymbolExists)
 include(CheckTypeSize)
-include(CMakeDependentOption)
 
 set(LLDB_PROJECT_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
 set(LLDB_SOURCE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/source")
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D73303: [lldb/Target] Add Assert StackFrame Recognizer

2020-02-06 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil added a comment.

Even with the latest variant (commit 
`7ebe9cc4fc2d97ec0ed2a6038be25b2a7ed1aac2`) I am getting on Fedora 30 x86_64:

  
/home/jkratoch/redhat/llvm-monorepo/lldb/test/Shell/Recognizer/assert.test:5:10:
 error: CHECK: expected string not found in input
  # CHECK: thread #{{.*}}stop reason = hit program assert
   ^
  :1:1: note: scanning from here
  (lldb) command source -s 0 
'/home/jkratoch/redhat/llvm-monorepo-clangassert/tools/lldb/test/Shell/lit-lldb-init'
  ^
  :15:34: note: possible intended match here
  * thread #1, name = 'assert.test.tmp', stop reason = signal SIGABRT
   ^

The output is:

  (lldb) command source -s 0 
'/home/jkratoch/redhat/llvm-monorepo/lldb/test/Shell/Recognizer/assert.test'
  Executing commands in 
'/home/jkratoch/redhat/llvm-monorepo/lldb/test/Shell/Recognizer/assert.test'.
  (lldb) run
  assert.test.tmp.out: 
/home/jkratoch/redhat/llvm-monorepo/lldb/test/Shell/Recognizer/Inputs/assert.c:7:
 int main(): Assertion `a == 42' failed.
  Process 29077 stopped
  * thread #1, name = 'assert.test.tmp', stop reason = signal SIGABRT
  frame #0: 0x77ddee35 libc.so.6`raise + 325
  libc.so.6`raise:
  ->  0x77ddee35 <+325>: movq   0x108(%rsp), %rax
  0x77ddee3d <+333>: xorq   %fs:0x28, %rax
  0x77ddee46 <+342>: jne0x77ddee6c; <+380>
  0x77ddee48 <+344>: movl   %r8d, %eax
  
  Process 29077 launched: 
'/home/jkratoch/redhat/llvm-monorepo-clangassert/tools/lldb/test/Recognizer/Output/assert.test.tmp.out'
 (x86_64)
  (lldb) frame info
  frame #0: 0x77ddee35 libc.so.6`raise + 325
  (lldb) frame recognizer info 0
  frame 0 is recognized by Assert StackFrame Recognizer
  (lldb) set set thread-format "{${thread.stop-reason-raw}}\n"
  (lldb) thread info
  signal SIGABRT
  
  (lldb) q

Visible also on (silent) Fedora buildbot 
.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73303



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


[Lldb-commits] [PATCH] D74157: [lldb/API] NFC: Reformat SBThread::GetStopDescription()

2020-02-06 Thread Frederic Riss via Phabricator via lldb-commits
friss created this revision.
friss added reviewers: JDevlieghere, labath, mib.
Herald added a project: LLDB.

This gets rid of some nesting and of the raw char* variable that caused
the memory management bug Ismail hit yesterday.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74157

Files:
  lldb/source/API/SBThread.cpp

Index: lldb/source/API/SBThread.cpp
===
--- lldb/source/API/SBThread.cpp
+++ lldb/source/API/SBThread.cpp
@@ -319,97 +319,72 @@
   std::unique_lock lock;
   ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
-  if (exe_ctx.HasThreadScope()) {
-Process::StopLocker stop_locker;
-if (stop_locker.TryLock(_ctx.GetProcessPtr()->GetRunLock())) {
+  if (dst)
+*dst = 0;
 
-  StopInfoSP stop_info_sp = exe_ctx.GetThreadPtr()->GetStopInfo();
-  if (stop_info_sp) {
-std::string thread_stop_desc =
-exe_ctx.GetThreadPtr()->GetStopDescription();
-const char *stop_desc = thread_stop_desc.c_str();
-
-if (stop_desc[0] != '\0') {
-  if (dst)
-return ::snprintf(dst, dst_len, "%s", stop_desc);
-  else {
-// NULL dst passed in, return the length needed to contain the
-// description
-return ::strlen(stop_desc) + 1; // Include the NULL byte for size
-  }
-} else {
-  size_t stop_desc_len = 0;
-  switch (stop_info_sp->GetStopReason()) {
-  case eStopReasonTrace:
-  case eStopReasonPlanComplete: {
-static char trace_desc[] = "step";
-stop_desc = trace_desc;
-stop_desc_len =
-sizeof(trace_desc); // Include the NULL byte for size
-  } break;
-
-  case eStopReasonBreakpoint: {
-static char bp_desc[] = "breakpoint hit";
-stop_desc = bp_desc;
-stop_desc_len = sizeof(bp_desc); // Include the NULL byte for size
-  } break;
-
-  case eStopReasonWatchpoint: {
-static char wp_desc[] = "watchpoint hit";
-stop_desc = wp_desc;
-stop_desc_len = sizeof(wp_desc); // Include the NULL byte for size
-  } break;
-
-  case eStopReasonSignal: {
-stop_desc =
-exe_ctx.GetProcessPtr()->GetUnixSignals()->GetSignalAsCString(
-stop_info_sp->GetValue());
-if (stop_desc == nullptr || stop_desc[0] == '\0') {
-  static char signal_desc[] = "signal";
-  stop_desc = signal_desc;
-  stop_desc_len =
-  sizeof(signal_desc); // Include the NULL byte for size
-}
-  } break;
-
-  case eStopReasonException: {
-char exc_desc[] = "exception";
-stop_desc = exc_desc;
-stop_desc_len = sizeof(exc_desc); // Include the NULL byte for size
-  } break;
-
-  case eStopReasonExec: {
-char exc_desc[] = "exec";
-stop_desc = exc_desc;
-stop_desc_len = sizeof(exc_desc); // Include the NULL byte for size
-  } break;
-
-  case eStopReasonThreadExiting: {
-char limbo_desc[] = "thread exiting";
-stop_desc = limbo_desc;
-stop_desc_len = sizeof(limbo_desc);
-  } break;
-  default:
-break;
-  }
+  if (!exe_ctx.HasThreadScope())
+return 0;
 
-  if (stop_desc && stop_desc[0]) {
-if (dst)
-  return ::snprintf(dst, dst_len, "%s", stop_desc) +
- 1; // Include the NULL byte
+  Process::StopLocker stop_locker;
+  if (!stop_locker.TryLock(_ctx.GetProcessPtr()->GetRunLock()))
+return 0;
 
-if (stop_desc_len == 0)
-  stop_desc_len = ::strlen(stop_desc) + 1; // Include the NULL byte
+  StopInfoSP stop_info_sp = exe_ctx.GetThreadPtr()->GetStopInfo();
+  if (!stop_info_sp)
+return 0;
 
-return stop_desc_len;
-  }
-}
-  }
-}
+  std::string thread_stop_desc = exe_ctx.GetThreadPtr()->GetStopDescription();
+  if (!thread_stop_desc.empty()) {
+if (dst)
+  return ::snprintf(dst, dst_len, "%s", thread_stop_desc.c_str());
+
+// NULL dst passed in, return the length needed to contain the
+// description
+return thread_stop_desc.size() + 1; // Include the NULL byte for size
   }
+
+  // No stop description was provided by the thread's StopInfo, try to
+  // derive a meaningful description from the StopReason.
+
+  auto reason_string = [](StopReason reason) -> llvm::StringRef {
+switch (reason) {
+case eStopReasonTrace:
+case eStopReasonPlanComplete:
+  return "step";
+case eStopReasonBreakpoint:
+  return "breakpoint hit";
+case eStopReasonWatchpoint:
+  return "watchpoint hit";
+case eStopReasonSignal:
+  return "signal";
+case eStopReasonException:
+  return "exception";
+case 

[Lldb-commits] [PATCH] D74153: [lldb] Delete the SharingPtr class

2020-02-06 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

We were probably getting away with this because ValueObjectRegisterSet's 
children don't really need their parent to construct their values?  But still, 
this is not how ValueObject children should work...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74153



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


[Lldb-commits] [PATCH] D74153: [lldb] Delete the SharingPtr class

2020-02-06 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

I think the ValueObjectRegisterSet::CreateChildAtIndex was wrong originally.  
It doesn't make it's children by passing itself in as the parent of the child, 
but just makes an independent ValueObject.  You can fix that in your version by 
passing the ValueObjectRegisterSet's manager.




Comment at: lldb/source/Core/ValueObjectRegister.cpp:96
 ExecutionContext exe_ctx(GetExecutionContextRef());
+auto manager_sp = ValueObjectManager::Create();
 new_valobj = new ValueObjectRegisterSet(

Is this right?  You are making a child of the ValueObjectRegisterContext, so it 
should  use the manager of its parent, shouldn't it?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74153



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


[Lldb-commits] [PATCH] D74148: [lldb\utils] Place lldb-repro in a per-configuration directory to support multi-configuration generators

2020-02-06 Thread Stella Stamenova via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG733923a97dff: [lldb\utils] Place lldb-repro in a 
per-configuration directory to support multi… (authored by stella.stamenova).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74148

Files:
  lldb/utils/lldb-dotest/CMakeLists.txt
  lldb/utils/lldb-repro/CMakeLists.txt


Index: lldb/utils/lldb-repro/CMakeLists.txt
===
--- lldb/utils/lldb-repro/CMakeLists.txt
+++ lldb/utils/lldb-repro/CMakeLists.txt
@@ -1,4 +1,23 @@
 add_custom_target(lldb-repro)
 add_dependencies(lldb-repro lldb-test-deps)
 set_target_properties(lldb-repro PROPERTIES FOLDER "lldb utils")
-configure_file(lldb-repro.py ${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb-repro COPYONLY)
+
+# Generate lldb-repro Python script for each build mode.
+if(LLDB_BUILT_STANDALONE)
+  set(config_types ".")
+  if(CMAKE_CONFIGURATION_TYPES)
+set(config_types ${CMAKE_CONFIGURATION_TYPES})
+  endif()
+
+  foreach(config_type ${config_types})
+string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} 
config_runtime_output_dir ${LLVM_RUNTIME_OUTPUT_INTDIR})
+configure_file(lldb-repro.py ${config_runtime_output_dir}/lldb-repro 
COPYONLY)
+  endforeach()
+elseif(NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".")
+  foreach(LLVM_BUILD_MODE ${CMAKE_CONFIGURATION_TYPES})
+string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_REPRO_DIR 
${LLVM_RUNTIME_OUTPUT_INTDIR})
+configure_file(lldb-repro.py ${LLDB_REPRO_DIR}/lldb-repro COPYONLY)
+  endforeach()
+else()
+  configure_file(lldb-repro.py ${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb-repro 
COPYONLY)
+endif()
Index: lldb/utils/lldb-dotest/CMakeLists.txt
===
--- lldb/utils/lldb-dotest/CMakeLists.txt
+++ lldb/utils/lldb-dotest/CMakeLists.txt
@@ -53,7 +53,7 @@
   endforeach()
 elseif(NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".")
   foreach(LLVM_BUILD_MODE ${CMAKE_CONFIGURATION_TYPES})
-string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} 
LLDB_DOTEST_DIR_CONFIGURED ${LLVM_RUNTIME_OUTPUT_INTDIR})
+string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_DOTEST_DIR 
${LLVM_RUNTIME_OUTPUT_INTDIR})
 string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} 
LLDB_DOTEST_ARGS_CONFIGURED "${LLDB_DOTEST_ARGS}")
 string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} 
LLDB_SOURCE_DIR_CONFIGURED "${LLDB_SOURCE_DIR}")
 string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} 
LLDB_TEST_BUILD_DIRECTORY_CONFIGURED "${LLDB_TEST_BUILD_DIRECTORY}")
@@ -65,7 +65,7 @@
 
 configure_file(
   lldb-dotest.in
-  ${LLDB_DOTEST_DIR_CONFIGURED}/lldb-dotest
+  ${LLDB_DOTEST_DIR}/lldb-dotest
   )
   endforeach()
 else()


Index: lldb/utils/lldb-repro/CMakeLists.txt
===
--- lldb/utils/lldb-repro/CMakeLists.txt
+++ lldb/utils/lldb-repro/CMakeLists.txt
@@ -1,4 +1,23 @@
 add_custom_target(lldb-repro)
 add_dependencies(lldb-repro lldb-test-deps)
 set_target_properties(lldb-repro PROPERTIES FOLDER "lldb utils")
-configure_file(lldb-repro.py ${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb-repro COPYONLY)
+
+# Generate lldb-repro Python script for each build mode.
+if(LLDB_BUILT_STANDALONE)
+  set(config_types ".")
+  if(CMAKE_CONFIGURATION_TYPES)
+set(config_types ${CMAKE_CONFIGURATION_TYPES})
+  endif()
+
+  foreach(config_type ${config_types})
+string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} config_runtime_output_dir ${LLVM_RUNTIME_OUTPUT_INTDIR})
+configure_file(lldb-repro.py ${config_runtime_output_dir}/lldb-repro COPYONLY)
+  endforeach()
+elseif(NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".")
+  foreach(LLVM_BUILD_MODE ${CMAKE_CONFIGURATION_TYPES})
+string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_REPRO_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
+configure_file(lldb-repro.py ${LLDB_REPRO_DIR}/lldb-repro COPYONLY)
+  endforeach()
+else()
+  configure_file(lldb-repro.py ${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb-repro COPYONLY)
+endif()
Index: lldb/utils/lldb-dotest/CMakeLists.txt
===
--- lldb/utils/lldb-dotest/CMakeLists.txt
+++ lldb/utils/lldb-dotest/CMakeLists.txt
@@ -53,7 +53,7 @@
   endforeach()
 elseif(NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".")
   foreach(LLVM_BUILD_MODE ${CMAKE_CONFIGURATION_TYPES})
-string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_DOTEST_DIR_CONFIGURED ${LLVM_RUNTIME_OUTPUT_INTDIR})
+string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_DOTEST_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
 string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_DOTEST_ARGS_CONFIGURED "${LLDB_DOTEST_ARGS}")
 string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_SOURCE_DIR_CONFIGURED "${LLDB_SOURCE_DIR}")
 string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} 

[Lldb-commits] [PATCH] D74153: [lldb] Delete the SharingPtr class

2020-02-06 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.

Very nice!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74153



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


[Lldb-commits] [lldb] 733923a - [lldb\utils] Place lldb-repro in a per-configuration directory to support multi-configuration generators

2020-02-06 Thread Stella Stamenova via lldb-commits

Author: Stella Stamenova
Date: 2020-02-06T12:31:57-08:00
New Revision: 733923a97dff2d2c6096d6b17c3987421be69ab6

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

LOG: [lldb\utils] Place lldb-repro in a per-configuration directory to support 
multi-configuration generators

Summary: Currently, lldb-repro is placed in the wrong location for 
multi-configuration generators. For example, in the case of VS, it is placed in 
a directory $(Configuration) instead of in each of Debug, Release, etc.

Reviewers: JDevlieghere

Reviewed By: JDevlieghere

Subscribers: mgorny, lldb-commits, asmith

Tags: #lldb

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

Added: 


Modified: 
lldb/utils/lldb-dotest/CMakeLists.txt
lldb/utils/lldb-repro/CMakeLists.txt

Removed: 




diff  --git a/lldb/utils/lldb-dotest/CMakeLists.txt 
b/lldb/utils/lldb-dotest/CMakeLists.txt
index 21fedc6f650c..7359613d7fb9 100644
--- a/lldb/utils/lldb-dotest/CMakeLists.txt
+++ b/lldb/utils/lldb-dotest/CMakeLists.txt
@@ -53,7 +53,7 @@ if(LLDB_BUILT_STANDALONE)
   endforeach()
 elseif(NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".")
   foreach(LLVM_BUILD_MODE ${CMAKE_CONFIGURATION_TYPES})
-string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} 
LLDB_DOTEST_DIR_CONFIGURED ${LLVM_RUNTIME_OUTPUT_INTDIR})
+string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_DOTEST_DIR 
${LLVM_RUNTIME_OUTPUT_INTDIR})
 string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} 
LLDB_DOTEST_ARGS_CONFIGURED "${LLDB_DOTEST_ARGS}")
 string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} 
LLDB_SOURCE_DIR_CONFIGURED "${LLDB_SOURCE_DIR}")
 string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} 
LLDB_TEST_BUILD_DIRECTORY_CONFIGURED "${LLDB_TEST_BUILD_DIRECTORY}")
@@ -65,7 +65,7 @@ elseif(NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".")
 
 configure_file(
   lldb-dotest.in
-  ${LLDB_DOTEST_DIR_CONFIGURED}/lldb-dotest
+  ${LLDB_DOTEST_DIR}/lldb-dotest
   )
   endforeach()
 else()

diff  --git a/lldb/utils/lldb-repro/CMakeLists.txt 
b/lldb/utils/lldb-repro/CMakeLists.txt
index 0bfcaaa0062e..a496e9986199 100644
--- a/lldb/utils/lldb-repro/CMakeLists.txt
+++ b/lldb/utils/lldb-repro/CMakeLists.txt
@@ -1,4 +1,23 @@
 add_custom_target(lldb-repro)
 add_dependencies(lldb-repro lldb-test-deps)
 set_target_properties(lldb-repro PROPERTIES FOLDER "lldb utils")
-configure_file(lldb-repro.py ${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb-repro COPYONLY)
+
+# Generate lldb-repro Python script for each build mode.
+if(LLDB_BUILT_STANDALONE)
+  set(config_types ".")
+  if(CMAKE_CONFIGURATION_TYPES)
+set(config_types ${CMAKE_CONFIGURATION_TYPES})
+  endif()
+
+  foreach(config_type ${config_types})
+string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} 
config_runtime_output_dir ${LLVM_RUNTIME_OUTPUT_INTDIR})
+configure_file(lldb-repro.py ${config_runtime_output_dir}/lldb-repro 
COPYONLY)
+  endforeach()
+elseif(NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".")
+  foreach(LLVM_BUILD_MODE ${CMAKE_CONFIGURATION_TYPES})
+string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_REPRO_DIR 
${LLVM_RUNTIME_OUTPUT_INTDIR})
+configure_file(lldb-repro.py ${LLDB_REPRO_DIR}/lldb-repro COPYONLY)
+  endforeach()
+else()
+  configure_file(lldb-repro.py ${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb-repro 
COPYONLY)
+endif()



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


[Lldb-commits] [PATCH] D74153: [lldb] Delete the SharingPtr class

2020-02-06 Thread Pavel Labath via Phabricator via lldb-commits
labath updated this revision to Diff 242974.
labath added a comment.

Remove the leftover mutex unlock in the ClusterManager destructor. Doing any
operation on the object while it is being destroyed is not safe, and the mutex
will not help there.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74153

Files:
  lldb/cmake/modules/LLDBFramework.cmake
  lldb/include/lldb/Core/ValueObject.h
  lldb/include/lldb/Core/ValueObjectConstResult.h
  lldb/include/lldb/Core/ValueObjectDynamicValue.h
  lldb/include/lldb/Core/ValueObjectMemory.h
  lldb/include/lldb/Core/ValueObjectRegister.h
  lldb/include/lldb/Core/ValueObjectVariable.h
  lldb/include/lldb/Utility/SharedCluster.h
  lldb/include/lldb/Utility/SharingPtr.h
  lldb/include/lldb/lldb-forward.h
  lldb/source/Core/FormatEntity.cpp
  lldb/source/Core/ValueObject.cpp
  lldb/source/Core/ValueObjectConstResult.cpp
  lldb/source/Core/ValueObjectConstResultImpl.cpp
  lldb/source/Core/ValueObjectList.cpp
  lldb/source/Core/ValueObjectMemory.cpp
  lldb/source/Core/ValueObjectRegister.cpp
  lldb/source/Core/ValueObjectSyntheticFilter.cpp
  lldb/source/Core/ValueObjectVariable.cpp
  lldb/source/Expression/IRInterpreter.cpp
  lldb/source/Utility/CMakeLists.txt
  lldb/source/Utility/SharingPtr.cpp
  lldb/unittests/Utility/SharedClusterTest.cpp

Index: lldb/unittests/Utility/SharedClusterTest.cpp
===
--- lldb/unittests/Utility/SharedClusterTest.cpp
+++ lldb/unittests/Utility/SharedClusterTest.cpp
@@ -25,30 +25,33 @@
 
 TEST(SharedCluster, ClusterManager) {
   std::vector Queue;
-  auto *CM = new ClusterManager();
-  auto *One = new DestructNotifier(Queue, 1);
-  auto *Two = new DestructNotifier(Queue, 2);
-  CM->ManageObject(One);
-  CM->ManageObject(Two);
-
-  ASSERT_THAT(Queue, testing::IsEmpty());
   {
-SharingPtr OnePtr = CM->GetSharedPointer(One);
-ASSERT_EQ(OnePtr->Key, 1);
-ASSERT_THAT(Queue, testing::IsEmpty());
+auto CM = ClusterManager::Create();
+auto *One = new DestructNotifier(Queue, 1);
+auto *Two = new DestructNotifier(Queue, 2);
+CM->ManageObject(One);
+CM->ManageObject(Two);
 
+ASSERT_THAT(Queue, testing::IsEmpty());
 {
-  SharingPtr OnePtrCopy = OnePtr;
-  ASSERT_EQ(OnePtrCopy->Key, 1);
+  std::shared_ptr OnePtr = CM->GetSharedPointer(One);
+  ASSERT_EQ(OnePtr->Key, 1);
   ASSERT_THAT(Queue, testing::IsEmpty());
-}
 
-{
-  SharingPtr TwoPtr = CM->GetSharedPointer(Two);
-  ASSERT_EQ(TwoPtr->Key, 2);
+  {
+std::shared_ptr OnePtrCopy = OnePtr;
+ASSERT_EQ(OnePtrCopy->Key, 1);
+ASSERT_THAT(Queue, testing::IsEmpty());
+  }
+
+  {
+std::shared_ptr TwoPtr = CM->GetSharedPointer(Two);
+ASSERT_EQ(TwoPtr->Key, 2);
+ASSERT_THAT(Queue, testing::IsEmpty());
+  }
+
   ASSERT_THAT(Queue, testing::IsEmpty());
 }
-
 ASSERT_THAT(Queue, testing::IsEmpty());
   }
   ASSERT_THAT(Queue, testing::ElementsAre(1, 2));
Index: lldb/source/Utility/SharingPtr.cpp
===
--- lldb/source/Utility/SharingPtr.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-//===-- SharingPtr.cpp ===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-
-#include "lldb/Utility/SharingPtr.h"
-
-#if defined(ENABLE_SP_LOGGING)
-
-// If ENABLE_SP_LOGGING is defined, then log all shared pointer assignments and
-// allow them to be queried using a pointer by a call to:
-#include 
-#include 
-
-#include "llvm/ADT/STLExtras.h"
-
-#include 
-#include 
-#include 
-
-class Backtrace {
-public:
-  Backtrace();
-
-  ~Backtrace();
-
-  void GetFrames();
-
-  void Dump() const;
-
-private:
-  void *m_sp_this;
-  std::vector m_frames;
-};
-
-Backtrace::Backtrace() : m_frames() {}
-
-Backtrace::~Backtrace() {}
-
-void Backtrace::GetFrames() {
-  void *frames[1024];
-  const int count = ::backtrace(frames, llvm::array_lengthof(frames));
-  if (count > 2)
-m_frames.assign(frames + 2, frames + (count - 2));
-}
-
-void Backtrace::Dump() const {
-  if (!m_frames.empty())
-::backtrace_symbols_fd(m_frames.data(), m_frames.size(), STDOUT_FILENO);
-  write(STDOUT_FILENO, "\n\n", 2);
-}
-
-extern "C" void track_sp(void *sp_this, void *ptr, long use_count) {
-  typedef std::pair PtrBacktracePair;
-  typedef std::map PtrToBacktraceMap;
-  static std::mutex g_mutex;
-  std::lock_guard guard(g_mutex);
-  static PtrToBacktraceMap g_map;
-
-  if (sp_this) {
-printf("sp(%p) -> %p %lu\n", sp_this, ptr, use_count);
-
-if (ptr) {
-  Backtrace bt;
-  bt.GetFrames();
-  g_map[sp_this] 

[Lldb-commits] [PATCH] D74153: [lldb] Delete the SharingPtr class

2020-02-06 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: teemperor, JDevlieghere, jingham.
Herald added subscribers: jfb, mgorny.
Herald added a project: LLDB.

The only use of this class was to implement the SharedCluster of ValueObjects.
However, the same functionality can be implemented using a regular
std::shared_ptr, and its little-known "sub-object pointer" feature, where the
pointer can point to one thing, but actually delete something else when it goes
out of scope.

This patch reimplements SharedCluster using this feature --
SharedClusterPointer::GetObject now returns a std::shared_pointer which points
to the ValueObject, but actually owns the whole cluster. The only change I
needed to make here is that now the SharedCluster object needs to be created
before the root ValueObject. This means that all private ValueObject
constructors get a ClusterManager argument, and their static Create functions do
the create-a-manager-and-pass-it-to-value-object dance.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74153

Files:
  lldb/cmake/modules/LLDBFramework.cmake
  lldb/include/lldb/Core/ValueObject.h
  lldb/include/lldb/Core/ValueObjectConstResult.h
  lldb/include/lldb/Core/ValueObjectDynamicValue.h
  lldb/include/lldb/Core/ValueObjectMemory.h
  lldb/include/lldb/Core/ValueObjectRegister.h
  lldb/include/lldb/Core/ValueObjectVariable.h
  lldb/include/lldb/Utility/SharedCluster.h
  lldb/include/lldb/Utility/SharingPtr.h
  lldb/include/lldb/lldb-forward.h
  lldb/source/Core/FormatEntity.cpp
  lldb/source/Core/ValueObject.cpp
  lldb/source/Core/ValueObjectConstResult.cpp
  lldb/source/Core/ValueObjectConstResultImpl.cpp
  lldb/source/Core/ValueObjectList.cpp
  lldb/source/Core/ValueObjectMemory.cpp
  lldb/source/Core/ValueObjectRegister.cpp
  lldb/source/Core/ValueObjectSyntheticFilter.cpp
  lldb/source/Core/ValueObjectVariable.cpp
  lldb/source/Expression/IRInterpreter.cpp
  lldb/source/Utility/CMakeLists.txt
  lldb/source/Utility/SharingPtr.cpp
  lldb/unittests/Utility/SharedClusterTest.cpp

Index: lldb/unittests/Utility/SharedClusterTest.cpp
===
--- lldb/unittests/Utility/SharedClusterTest.cpp
+++ lldb/unittests/Utility/SharedClusterTest.cpp
@@ -25,30 +25,33 @@
 
 TEST(SharedCluster, ClusterManager) {
   std::vector Queue;
-  auto *CM = new ClusterManager();
-  auto *One = new DestructNotifier(Queue, 1);
-  auto *Two = new DestructNotifier(Queue, 2);
-  CM->ManageObject(One);
-  CM->ManageObject(Two);
-
-  ASSERT_THAT(Queue, testing::IsEmpty());
   {
-SharingPtr OnePtr = CM->GetSharedPointer(One);
-ASSERT_EQ(OnePtr->Key, 1);
-ASSERT_THAT(Queue, testing::IsEmpty());
+auto CM = ClusterManager::Create();
+auto *One = new DestructNotifier(Queue, 1);
+auto *Two = new DestructNotifier(Queue, 2);
+CM->ManageObject(One);
+CM->ManageObject(Two);
 
+ASSERT_THAT(Queue, testing::IsEmpty());
 {
-  SharingPtr OnePtrCopy = OnePtr;
-  ASSERT_EQ(OnePtrCopy->Key, 1);
+  std::shared_ptr OnePtr = CM->GetSharedPointer(One);
+  ASSERT_EQ(OnePtr->Key, 1);
   ASSERT_THAT(Queue, testing::IsEmpty());
-}
 
-{
-  SharingPtr TwoPtr = CM->GetSharedPointer(Two);
-  ASSERT_EQ(TwoPtr->Key, 2);
+  {
+std::shared_ptr OnePtrCopy = OnePtr;
+ASSERT_EQ(OnePtrCopy->Key, 1);
+ASSERT_THAT(Queue, testing::IsEmpty());
+  }
+
+  {
+std::shared_ptr TwoPtr = CM->GetSharedPointer(Two);
+ASSERT_EQ(TwoPtr->Key, 2);
+ASSERT_THAT(Queue, testing::IsEmpty());
+  }
+
   ASSERT_THAT(Queue, testing::IsEmpty());
 }
-
 ASSERT_THAT(Queue, testing::IsEmpty());
   }
   ASSERT_THAT(Queue, testing::ElementsAre(1, 2));
Index: lldb/source/Utility/SharingPtr.cpp
===
--- lldb/source/Utility/SharingPtr.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-//===-- SharingPtr.cpp ===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-
-#include "lldb/Utility/SharingPtr.h"
-
-#if defined(ENABLE_SP_LOGGING)
-
-// If ENABLE_SP_LOGGING is defined, then log all shared pointer assignments and
-// allow them to be queried using a pointer by a call to:
-#include 
-#include 
-
-#include "llvm/ADT/STLExtras.h"
-
-#include 
-#include 
-#include 
-
-class Backtrace {
-public:
-  Backtrace();
-
-  ~Backtrace();
-
-  void GetFrames();
-
-  void Dump() const;
-
-private:
-  void *m_sp_this;
-  std::vector m_frames;
-};
-
-Backtrace::Backtrace() : m_frames() {}
-
-Backtrace::~Backtrace() {}
-
-void Backtrace::GetFrames() {
-  void *frames[1024];
-  const int count = ::backtrace(frames, llvm::array_lengthof(frames));
-  if 

[Lldb-commits] [PATCH] D74148: [lldb\utils] Place lldb-repro in a per-configuration directory to support multi-configuration generators

2020-02-06 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added inline comments.
This revision is now accepted and ready to land.



Comment at: lldb/utils/lldb-repro/CMakeLists.txt:6
+# Generate lldb-repro Python script for each build mode.
+if(LLDB_BUILT_STANDALONE)
+  set(config_types ".")

stella.stamenova wrote:
> JDevlieghere wrote:
> > Do you think it's possible/worthwhile to factor out this code in a CMake 
> > macro/function? We have a few places where we have to do something similar, 
> > but it's never exactly the same. 
> I think it's possible, but because it is not exactly the same, I am not sure 
> if it's worth doing. For example, we would have to make it possible to 
> specify a list of properties that all have to be "configured" together along 
> with a file to configure sometimes and the action on the file. It is 
> definitely doable, but it will still be complicated code that one has to 
> remember to call.
> 
> If anything, it may be worth placing any tools that fall under this category 
> in the same tree structure with a top-level CMake file that correctly handles 
> all of them, but that would require some more work and still wouldn't be 
> ideal because we'd need to handle any exceptions separately.
Fair enough, unfortunately that's what I expected. Thanks for entertaining the 
idea. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74148



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


[Lldb-commits] [PATCH] D74136: [LLDB] WIP: Optionally follow DW_AT_decl_file when setting breakpoint

2020-02-06 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

In D74136#1862246 , @labath wrote:

> In D74136#1862200 , @jingham wrote:
>
> > Is there ever a reason other than performance why you would want NOT to 
> > consult both the Compile Unit name and also look for DW_AT_decl_file?  That 
> > doesn't seem clear to me.
> >
> > If the only worry is performance, and except for that you would really 
> > always want the full search, then I don't see what we gain by adding 
> > --compile-unit as distinct from --file.  We should use 
> > target.inline-breakpoint-strategy to allow people to turn on or off the 
> > searching for DW_AT_decl_file for folks whose projects are complicated 
> > enough AND who aren't doing a lot of inlining.  "break set" is already 
> > over-stuffed, I don't want to add to it unless we get a positive benefit.
>
>
> Well, conceptually these are two different things. --compile-unit would 
> restrict the search to the given compile unit no matter what is the file 
> where the function was defined in. And --file would consider the defining 
> file, and not care which compile unit hosts that. In theory, both can be 
> useful, but I'm not sure if people would really use that flexibility.
>
> My proposal was based on the fact that we want to preserve the ability to 
> filter according to the defining cu. If we don't need to do that, then simply 
> just redefining the meaning of the file+function combo is fine by me..


Yeah, I'm not convinced the flexibility is worth adding another slot, 
especially since now --file needs to explain how it is different from 
--compile-unit, but ONLY when --name is specified.  When --file is the primary 
(for source breakpoints) that won't be true.  And why is there a --compile-unit 
that DOESN'T set file & line breakpoints, etc...  The fact that --file has 
different meanings depending on what the primary specification is is one of the 
reasons why it's a shame that they all share one common pool of documentable 
options.

> 
> 
>> On a side note, I really wish I had made "break set" be a multi-word 
>> command, so you could specify the main search criteria, and then the 
>> qualifiers could be used more flexibly and be better documented and and you 
>> wouldn't see options that weren't relevant.  Like:
>> 
>> break set name
>>  break set source
>>  break set address
>> 
>> That wouldn't make the command any harder to type, it would even be easier 
>> since:
>> 
>> break set name foo
>> 
>> would shorten to:
>> 
>> br s n foo
>> 
>> instead of
>> 
>> br s -n foo
>> 
>> I wonder if it is too late to make this change?
> 
> That would be a bigger change than what I proposed because it would affect 
> every breakpoint command, instead of just the (rarely used, I think) 
> file+function combo, though I'm not necessarily against that. However, if we 
> redefine the meaning of the file+function combo, then I think the need for 
> this will be diminished because the option will become less context sensitive 
> and thus more predictable and more combinable.

Yes, I wasn't suggesting as blocking this change.  I just feel like at some 
point we're going to tip over into too much complexity as things are currently 
constituted, so someday we'll probably go crazy if we don't rework this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74136



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


[Lldb-commits] [PATCH] D74148: [lldb\utils] Place lldb-repro in a per-configuration directory to support multi-configuration generators

2020-02-06 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova marked an inline comment as done.
stella.stamenova added inline comments.



Comment at: lldb/utils/lldb-repro/CMakeLists.txt:6
+# Generate lldb-repro Python script for each build mode.
+if(LLDB_BUILT_STANDALONE)
+  set(config_types ".")

JDevlieghere wrote:
> Do you think it's possible/worthwhile to factor out this code in a CMake 
> macro/function? We have a few places where we have to do something similar, 
> but it's never exactly the same. 
I think it's possible, but because it is not exactly the same, I am not sure if 
it's worth doing. For example, we would have to make it possible to specify a 
list of properties that all have to be "configured" together along with a file 
to configure sometimes and the action on the file. It is definitely doable, but 
it will still be complicated code that one has to remember to call.

If anything, it may be worth placing any tools that fall under this category in 
the same tree structure with a top-level CMake file that correctly handles all 
of them, but that would require some more work and still wouldn't be ideal 
because we'd need to handle any exceptions separately.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74148



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


[Lldb-commits] [PATCH] D74136: [LLDB] WIP: Optionally follow DW_AT_decl_file when setting breakpoint

2020-02-06 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D74136#1862200 , @jingham wrote:

> Is there ever a reason other than performance why you would want NOT to 
> consult both the Compile Unit name and also look for DW_AT_decl_file?  That 
> doesn't seem clear to me.
>
> If the only worry is performance, and except for that you would really always 
> want the full search, then I don't see what we gain by adding --compile-unit 
> as distinct from --file.  We should use target.inline-breakpoint-strategy to 
> allow people to turn on or off the searching for DW_AT_decl_file for folks 
> whose projects are complicated enough AND who aren't doing a lot of inlining. 
>  "break set" is already over-stuffed, I don't want to add to it unless we get 
> a positive benefit.


Well, conceptually these are two different things. --compile-unit would 
restrict the search to the given compile unit no matter what is the file where 
the function was defined in. And --file would consider the defining file, and 
not care which compile unit hosts that. In theory, both can be useful, but I'm 
not sure if people would really use that flexibility.

My proposal was based on the fact that we want to preserve the ability to 
filter according to the defining cu. If we don't need to do that, then simply 
just redefining the meaning of the file+function combo is fine by me..

> On a side note, I really wish I had made "break set" be a multi-word command, 
> so you could specify the main search criteria, and then the qualifiers could 
> be used more flexibly and be better documented and and you wouldn't see 
> options that weren't relevant.  Like:
> 
> break set name
>  break set source
>  break set address
> 
> That wouldn't make the command any harder to type, it would even be easier 
> since:
> 
> break set name foo
> 
> would shorten to:
> 
> br s n foo
> 
> instead of
> 
> br s -n foo
> 
> I wonder if it is too late to make this change?

That would be a bigger change than what I proposed because it would affect 
every breakpoint command, instead of just the (rarely used, I think) 
file+function combo, though I'm not necessarily against that. However, if we 
redefine the meaning of the file+function combo, then I think the need for this 
will be diminished because the option will become less context sensitive and 
thus more predictable and more combinable.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74136



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


[Lldb-commits] [PATCH] D74126: [lldb] Remove all 'clean' targets from test Makefiles

2020-02-06 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

The one use I had for these clean targets was when you are making a new test 
and getting the test source to compile it is really tempting to run make in the 
test directory.  It's a lot slower to go run the test, see the compile fail, 
fix something, etc... than just run make.  But if you do that and don't clean, 
then when you actually go to run the test, it will fail because make sees the 
product in the source directory and won't build it in the out-of-line 
directory, but the test will look for it there.

Not a super compelling reason, but...


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

https://reviews.llvm.org/D74126



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


[Lldb-commits] [PATCH] D74148: [lldb\utils] Place lldb-repro in a per-configuration directory to support multi-configuration generators

2020-02-06 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: lldb/utils/lldb-repro/CMakeLists.txt:6
+# Generate lldb-repro Python script for each build mode.
+if(LLDB_BUILT_STANDALONE)
+  set(config_types ".")

Do you think it's possible/worthwhile to factor out this code in a CMake 
macro/function? We have a few places where we have to do something similar, but 
it's never exactly the same. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74148



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


[Lldb-commits] [PATCH] D74136: [LLDB] WIP: Optionally follow DW_AT_decl_file when setting breakpoint

2020-02-06 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

Is there ever a reason other than performance why you would want NOT to consult 
both the Compile Unit name and also look for DW_AT_decl_file is performance?  
That doesn't seem clear to me.

If the only worry is performance, and except for that you would really always 
want the full search, then I don't see what we gain by adding --compile-unit as 
distinct from --file.  We should use target.inline-breakpoint-strategy to allow 
people to turn on or off the searching for DW_AT_decl_file for folks whose 
projects are complicated enough AND who aren't doing a lot of inlining.  "break 
set" is already over-stuffed, I don't want to add to it unless we get a 
positive benefit.

On a side note, I really wish I had made "break set" be a multi-word command, 
so you could specify the main search criteria, and then the qualifiers could be 
used more flexibly and be better documented and and you wouldn't see options 
that weren't relevant.  Like:

break set name
break set source
break set address

That wouldn't make the command any harder to type, it would even be easier 
since:

break set name foo

would shorten to:

br s n foo

instead of

br s -n foo

I wonder if it is too late to make this change?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74136



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


[Lldb-commits] [PATCH] D73787: [NFC] Refactor `GetDWARFDeclContext` to return `DWARFDeclContext`

2020-02-06 Thread Jan Kratochvil via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1d11d5f62422: [lldb] [NFC] Refactor GetDWARFDeclContext to 
return DWARFDeclContext (authored by jankratochvil).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73787

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h

Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -308,8 +308,7 @@
   static lldb_private::CompilerDeclContext
   GetContainingDeclContext(const DWARFDIE );
 
-  static void GetDWARFDeclContext(const DWARFDIE ,
-  DWARFDeclContext _decl_ctx);
+  static DWARFDeclContext GetDWARFDeclContext(const DWARFDIE );
 
   static lldb::LanguageType LanguageTypeFromDWARF(uint64_t val);
 
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2959,8 +2959,8 @@
 }
 
 if (try_resolving_type) {
-  DWARFDeclContext type_dwarf_decl_ctx;
-  GetDWARFDeclContext(type_die, type_dwarf_decl_ctx);
+  DWARFDeclContext type_dwarf_decl_ctx =
+  GetDWARFDeclContext(type_die);
 
   if (log) {
 GetObjectFile()->GetModule()->LogMessage(
@@ -3377,12 +3377,10 @@
 // declaration context.
 if ((parent_tag == DW_TAG_compile_unit ||
  parent_tag == DW_TAG_partial_unit) &&
-Language::LanguageIsCPlusPlus(GetLanguage(*die.GetCU( {
-  DWARFDeclContext decl_ctx;
-
-  GetDWARFDeclContext(die, decl_ctx);
-  mangled = decl_ctx.GetQualifiedNameAsConstString().GetCString();
-}
+Language::LanguageIsCPlusPlus(GetLanguage(*die.GetCU(
+  mangled = GetDWARFDeclContext(die)
+.GetQualifiedNameAsConstString()
+.GetCString();
   }
 
   if (tag == DW_TAG_formal_parameter)
@@ -3984,14 +3982,13 @@
   return CompilerDeclContext();
 }
 
-void SymbolFileDWARF::GetDWARFDeclContext(const DWARFDIE ,
-  DWARFDeclContext _decl_ctx) {
-  if (!die.IsValid()) {
-dwarf_decl_ctx.Clear();
-return;
-  }
+DWARFDeclContext SymbolFileDWARF::GetDWARFDeclContext(const DWARFDIE ) {
+  if (!die.IsValid())
+return {};
+  DWARFDeclContext dwarf_decl_ctx =
+  die.GetDIE()->GetDWARFDeclContext(die.GetCU());
   dwarf_decl_ctx.SetLanguage(GetLanguage(*die.GetCU()));
-  die.GetDIE()->GetDWARFDeclContext(die.GetCU(), dwarf_decl_ctx);
+  return dwarf_decl_ctx;
 }
 
 LanguageType SymbolFileDWARF::LanguageTypeFromDWARF(uint64_t val) {
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
@@ -158,8 +158,7 @@
 return HasChildren() ? this + 1 : nullptr;
   }
 
-  void GetDWARFDeclContext(DWARFUnit *cu,
-   DWARFDeclContext _decl_ctx) const;
+  DWARFDeclContext GetDWARFDeclContext(DWARFUnit *cu) const;
 
   DWARFDIE GetParentDeclContextDIE(DWARFUnit *cu) const;
   DWARFDIE GetParentDeclContextDIE(DWARFUnit *cu,
@@ -169,6 +168,9 @@
   void SetParentIndex(uint32_t idx) { m_parent_idx = idx; }
 
 protected:
+  static DWARFDeclContext
+  GetDWARFDeclContextStatic(const DWARFDebugInfoEntry *die, DWARFUnit *cu);
+
   dw_offset_t m_offset; // Offset within the .debug_info/.debug_types
   uint32_t m_parent_idx; // How many to subtract from "this" to get the parent.
  // If zero this die has no parent
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
@@ -868,21 +868,30 @@
   }
 }
 
-void DWARFDebugInfoEntry::GetDWARFDeclContext(
-DWARFUnit *cu, DWARFDeclContext _decl_ctx) const {
-  const dw_tag_t tag = Tag();
-  if (tag == DW_TAG_compile_unit || tag == DW_TAG_partial_unit)
-return;
-  dwarf_decl_ctx.AppendDeclContext(tag, GetName(cu));
-  DWARFDIE parent_decl_ctx_die = GetParentDeclContextDIE(cu);
-  if (parent_decl_ctx_die && parent_decl_ctx_die.GetDIE() 

[Lldb-commits] [PATCH] D74148: [lldb\utils] Place lldb-repro in a per-configuration directory to support multi-configuration generators

2020-02-06 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova created this revision.
stella.stamenova added a reviewer: JDevlieghere.
Herald added subscribers: lldb-commits, mgorny.
Herald added a project: LLDB.

Currently, lldb-repro is placed in the wrong location for multi-configuration 
generators. For example, in the case of VS, it is placed in a directory 
$(Configuration) instead of in each of Debug, Release, etc.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74148

Files:
  lldb/utils/lldb-dotest/CMakeLists.txt
  lldb/utils/lldb-repro/CMakeLists.txt


Index: lldb/utils/lldb-repro/CMakeLists.txt
===
--- lldb/utils/lldb-repro/CMakeLists.txt
+++ lldb/utils/lldb-repro/CMakeLists.txt
@@ -1,4 +1,23 @@
 add_custom_target(lldb-repro)
 add_dependencies(lldb-repro lldb-test-deps)
 set_target_properties(lldb-repro PROPERTIES FOLDER "lldb utils")
-configure_file(lldb-repro.py ${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb-repro COPYONLY)
+
+# Generate lldb-repro Python script for each build mode.
+if(LLDB_BUILT_STANDALONE)
+  set(config_types ".")
+  if(CMAKE_CONFIGURATION_TYPES)
+set(config_types ${CMAKE_CONFIGURATION_TYPES})
+  endif()
+
+  foreach(config_type ${config_types})
+string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} 
config_runtime_output_dir ${LLVM_RUNTIME_OUTPUT_INTDIR})
+configure_file(lldb-repro.py ${config_runtime_output_dir}/lldb-repro 
COPYONLY)
+  endforeach()
+elseif(NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".")
+  foreach(LLVM_BUILD_MODE ${CMAKE_CONFIGURATION_TYPES})
+string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_REPRO_DIR 
${LLVM_RUNTIME_OUTPUT_INTDIR})
+configure_file(lldb-repro.py ${LLDB_REPRO_DIR}/lldb-repro COPYONLY)
+  endforeach()
+else()
+  configure_file(lldb-repro.py ${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb-repro 
COPYONLY)
+endif()
Index: lldb/utils/lldb-dotest/CMakeLists.txt
===
--- lldb/utils/lldb-dotest/CMakeLists.txt
+++ lldb/utils/lldb-dotest/CMakeLists.txt
@@ -53,7 +53,7 @@
   endforeach()
 elseif(NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".")
   foreach(LLVM_BUILD_MODE ${CMAKE_CONFIGURATION_TYPES})
-string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} 
LLDB_DOTEST_DIR_CONFIGURED ${LLVM_RUNTIME_OUTPUT_INTDIR})
+string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_DOTEST_DIR 
${LLVM_RUNTIME_OUTPUT_INTDIR})
 string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} 
LLDB_DOTEST_ARGS_CONFIGURED "${LLDB_DOTEST_ARGS}")
 string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} 
LLDB_SOURCE_DIR_CONFIGURED "${LLDB_SOURCE_DIR}")
 string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} 
LLDB_TEST_BUILD_DIRECTORY_CONFIGURED "${LLDB_TEST_BUILD_DIRECTORY}")
@@ -65,7 +65,7 @@
 
 configure_file(
   lldb-dotest.in
-  ${LLDB_DOTEST_DIR_CONFIGURED}/lldb-dotest
+  ${LLDB_DOTEST_DIR}/lldb-dotest
   )
   endforeach()
 else()


Index: lldb/utils/lldb-repro/CMakeLists.txt
===
--- lldb/utils/lldb-repro/CMakeLists.txt
+++ lldb/utils/lldb-repro/CMakeLists.txt
@@ -1,4 +1,23 @@
 add_custom_target(lldb-repro)
 add_dependencies(lldb-repro lldb-test-deps)
 set_target_properties(lldb-repro PROPERTIES FOLDER "lldb utils")
-configure_file(lldb-repro.py ${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb-repro COPYONLY)
+
+# Generate lldb-repro Python script for each build mode.
+if(LLDB_BUILT_STANDALONE)
+  set(config_types ".")
+  if(CMAKE_CONFIGURATION_TYPES)
+set(config_types ${CMAKE_CONFIGURATION_TYPES})
+  endif()
+
+  foreach(config_type ${config_types})
+string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} config_runtime_output_dir ${LLVM_RUNTIME_OUTPUT_INTDIR})
+configure_file(lldb-repro.py ${config_runtime_output_dir}/lldb-repro COPYONLY)
+  endforeach()
+elseif(NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".")
+  foreach(LLVM_BUILD_MODE ${CMAKE_CONFIGURATION_TYPES})
+string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_REPRO_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
+configure_file(lldb-repro.py ${LLDB_REPRO_DIR}/lldb-repro COPYONLY)
+  endforeach()
+else()
+  configure_file(lldb-repro.py ${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb-repro COPYONLY)
+endif()
Index: lldb/utils/lldb-dotest/CMakeLists.txt
===
--- lldb/utils/lldb-dotest/CMakeLists.txt
+++ lldb/utils/lldb-dotest/CMakeLists.txt
@@ -53,7 +53,7 @@
   endforeach()
 elseif(NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".")
   foreach(LLVM_BUILD_MODE ${CMAKE_CONFIGURATION_TYPES})
-string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_DOTEST_DIR_CONFIGURED ${LLVM_RUNTIME_OUTPUT_INTDIR})
+string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_DOTEST_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
 string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_DOTEST_ARGS_CONFIGURED "${LLDB_DOTEST_ARGS}")
 string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_SOURCE_DIR_CONFIGURED 

[Lldb-commits] [lldb] 1d11d5f - [lldb] [NFC] Refactor GetDWARFDeclContext to return DWARFDeclContext

2020-02-06 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2020-02-06T20:06:28+01:00
New Revision: 1d11d5f6242206f4d0dbc11623f73cdf2173a087

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

LOG: [lldb] [NFC] Refactor GetDWARFDeclContext to return DWARFDeclContext

Suggested by Pavel Labath.

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

Added: 


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

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 0d640819ff28..5b3ea8838786 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -726,8 +726,7 @@ TypeSP DWARFASTParserClang::ParseEnum(const SymbolContext 
,
 if (type_sp)
   return type_sp;
 
-DWARFDeclContext die_decl_ctx;
-SymbolFileDWARF::GetDWARFDeclContext(die, die_decl_ctx);
+DWARFDeclContext die_decl_ctx = SymbolFileDWARF::GetDWARFDeclContext(die);
 
 type_sp = dwarf->FindDefinitionTypeForDWARFDeclContext(die_decl_ctx);
 
@@ -1515,8 +1514,7 @@ DWARFASTParserClang::ParseStructureLikeDIE(const 
SymbolContext ,
 if (type_sp)
   return type_sp;
 
-DWARFDeclContext die_decl_ctx;
-SymbolFileDWARF::GetDWARFDeclContext(die, die_decl_ctx);
+DWARFDeclContext die_decl_ctx = SymbolFileDWARF::GetDWARFDeclContext(die);
 
 // type_sp = FindDefinitionTypeForDIE (dwarf_cu, die,
 // type_name_const_str);
@@ -2323,10 +2321,9 @@ Function 
*DWARFASTParserClang::ParseFunctionFromDWARF(CompileUnit _unit,
 unsigned type_quals = 0;
 std::vector param_types;
 std::vector param_decls;
-DWARFDeclContext decl_ctx;
 StreamString sstr;
 
-SymbolFileDWARF::GetDWARFDeclContext(die, decl_ctx);
+DWARFDeclContext decl_ctx = SymbolFileDWARF::GetDWARFDeclContext(die);
 sstr << decl_ctx.GetQualifiedName();
 
 clang::DeclContext *containing_decl_ctx =

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
index 5d22e3d607ac..746be69a3e12 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
@@ -868,21 +868,30 @@ void DWARFDebugInfoEntry::BuildFunctionAddressRangeTable(
   }
 }
 
-void DWARFDebugInfoEntry::GetDWARFDeclContext(
-DWARFUnit *cu, DWARFDeclContext _decl_ctx) const {
-  const dw_tag_t tag = Tag();
-  if (tag == DW_TAG_compile_unit || tag == DW_TAG_partial_unit)
-return;
-  dwarf_decl_ctx.AppendDeclContext(tag, GetName(cu));
-  DWARFDIE parent_decl_ctx_die = GetParentDeclContextDIE(cu);
-  if (parent_decl_ctx_die && parent_decl_ctx_die.GetDIE() != this) {
-if (parent_decl_ctx_die.Tag() != DW_TAG_compile_unit &&
-parent_decl_ctx_die.Tag() != DW_TAG_partial_unit)
-  parent_decl_ctx_die.GetDIE()->GetDWARFDeclContext(
-  parent_decl_ctx_die.GetCU(), dwarf_decl_ctx);
+DWARFDeclContext
+DWARFDebugInfoEntry::GetDWARFDeclContextStatic(const DWARFDebugInfoEntry *die,
+   DWARFUnit *cu) {
+  DWARFDeclContext dwarf_decl_ctx;
+  for (;;) {
+const dw_tag_t tag = die->Tag();
+if (tag == DW_TAG_compile_unit || tag == DW_TAG_partial_unit)
+  return dwarf_decl_ctx;
+dwarf_decl_ctx.AppendDeclContext(tag, die->GetName(cu));
+DWARFDIE parent_decl_ctx_die = die->GetParentDeclContextDIE(cu);
+if (!parent_decl_ctx_die || parent_decl_ctx_die.GetDIE() == die)
+  return dwarf_decl_ctx;
+if (parent_decl_ctx_die.Tag() == DW_TAG_compile_unit ||
+parent_decl_ctx_die.Tag() == DW_TAG_partial_unit)
+  return dwarf_decl_ctx;
+die = parent_decl_ctx_die.GetDIE();
+cu = parent_decl_ctx_die.GetCU();
   }
 }
 
+DWARFDeclContext DWARFDebugInfoEntry::GetDWARFDeclContext(DWARFUnit *cu) const 
{
+  return GetDWARFDeclContextStatic(this, cu);
+}
+
 DWARFDIE
 DWARFDebugInfoEntry::GetParentDeclContextDIE(DWARFUnit *cu) const {
   DWARFAttributes attributes;

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
index 2bb69e738a2f..ef00d09cf71e 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
@@ -158,8 +158,7 @@ class DWARFDebugInfoEntry {
 return HasChildren() ? this + 1 : 

[Lldb-commits] [lldb] 31cf581 - [lldb] Explicitly qualify calls to std::static_pointer_cast

2020-02-06 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2020-02-06T10:55:16-08:00
New Revision: 31cf5819987a0b052338d7a6f41cbad5ba224b36

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

LOG: [lldb] Explicitly qualify calls to std::static_pointer_cast

Due to a c++ quirk, these are found through ADL only when a function with that
name is found through regular lookup. We have one such function in SharingPtr.h,
but I am trying to remove it.

Added: 


Modified: 
lldb/include/lldb/Interpreter/CommandReturnObject.h
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp

Removed: 




diff  --git a/lldb/include/lldb/Interpreter/CommandReturnObject.h 
b/lldb/include/lldb/Interpreter/CommandReturnObject.h
index 8af76e07e5ae..304e44af0073 100644
--- a/lldb/include/lldb/Interpreter/CommandReturnObject.h
+++ b/lldb/include/lldb/Interpreter/CommandReturnObject.h
@@ -30,14 +30,14 @@ class CommandReturnObject {
   llvm::StringRef GetOutputData() {
 lldb::StreamSP 
stream_sp(m_out_stream.GetStreamAtIndex(eStreamStringIndex));
 if (stream_sp)
-  return static_pointer_cast(stream_sp)->GetString();
+  return std::static_pointer_cast(stream_sp)->GetString();
 return llvm::StringRef();
   }
 
   llvm::StringRef GetErrorData() {
 lldb::StreamSP 
stream_sp(m_err_stream.GetStreamAtIndex(eStreamStringIndex));
 if (stream_sp)
-  return static_pointer_cast(stream_sp)->GetString();
+  return std::static_pointer_cast(stream_sp)->GetString();
 return llvm::StringRef();
   }
 

diff  --git 
a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index 12b05e7c9e4a..83aca6a380d0 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -3479,7 +3479,7 @@ 
GDBRemoteCommunicationClient::SendGetTraceConfigPacket(lldb::user_id_t uid,
   return error;
 } else
   options.setTraceParams(
-  static_pointer_cast(
+  std::static_pointer_cast(
   custom_params_sp));
   }
 } else {

diff  --git 
a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
index 6a6e0d56c69f..0bdad8b7b482 100644
--- 
a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -1072,7 +1072,7 @@ GDBRemoteCommunicationServerLLGS::Handle_jTraceStart(
 return SendIllFormedResponse(packet, "jTraceStart: Ill formed packet ");
 
   options.setTraceParams(
-  static_pointer_cast(custom_params_sp));
+  std::static_pointer_cast(custom_params_sp));
 
   if (buffersize == std::numeric_limits::max() ||
   type != lldb::TraceType::eTraceTypeProcessorTrace) {



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


[Lldb-commits] [PATCH] D72751: [LLDB] Add DynamicLoaderWasmDYLD plugin for WebAssembly debugging

2020-02-06 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

As promised, here are the comments on the new tests. I think that most of the 
py3 incompatibilities will go away once we get rid of the yaml preprocessing 
step, but it would be good to verify this with python 3 nonetheless...




Comment at: 
lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestWasm.py:8
+
+LLDB_INVALID_ADDRESS = 0x
+load_address = 0x4

this should be available as `lldb.LLDB_INVALID_ADDRESS`



Comment at: 
lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestWasm.py:173-179
+with open(yaml_template_path, mode='r') as file:
+yaml = file.read()
+file.close()
+yaml = yaml.replace("###_EXTERNAL_DEBUG_INFO_###", 
format_bytearray_as_hexstring(encode_wasm_string(sym_obj_path)))
+with open(yaml_path, mode='w') as file:
+file.write(yaml)
+file.close()

a simpler way to handle this would be to put just the bare file name (no path) 
into the yaml, and then add the build directory to the 
`target.debug-file-search-paths` setting.



Comment at: 
lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestWasm.py:233
+def readMemory(self, addr, length):
+assert False # Should not be called
+

As I said in the previous comment, this needs to be relaxed a bit. Maybe you 
could just always return an error. This way we can be sure that the file is not 
accidentally read from memory but spurious memory reads be lldb will not cause 
the test to fail.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72751



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


[Lldb-commits] [lldb] 17d0091 - [lldb/Target] Remove extra semicolon in AssertFrameRecognizer (NFC)

2020-02-06 Thread Med Ismail Bennani via lldb-commits

Author: Med Ismail Bennani
Date: 2020-02-06T19:46:32+01:00
New Revision: 17d0091d662b414600f0a31dcb3fe6cc353879a7

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

LOG: [lldb/Target] Remove extra semicolon in AssertFrameRecognizer (NFC)

Signed-off-by: Med Ismail Bennani 

Added: 


Modified: 
lldb/source/Target/AssertFrameRecognizer.cpp

Removed: 




diff  --git a/lldb/source/Target/AssertFrameRecognizer.cpp 
b/lldb/source/Target/AssertFrameRecognizer.cpp
index 58829be93816..89ed3ce022d9 100644
--- a/lldb/source/Target/AssertFrameRecognizer.cpp
+++ b/lldb/source/Target/AssertFrameRecognizer.cpp
@@ -182,7 +182,7 @@ AssertFrameRecognizer::RecognizeFrame(lldb::StackFrameSP 
frame_sp) {
   }
 
   return RecognizedStackFrameSP();
-};
+}
 
 AssertRecognizedStackFrame::AssertRecognizedStackFrame(
 StackFrameSP most_relevant_frame_sp)



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


[Lldb-commits] [PATCH] D73787: [NFC] Refactor `GetDWARFDeclContext` to return `DWARFDeclContext`

2020-02-06 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

This looks good too.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73787



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


[Lldb-commits] [PATCH] D74093: [lldb/tests] Correctly configure the lldb dotest arguments

2020-02-06 Thread Stella Stamenova via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd53c8c6af522: [lldb/tests] Correctly configure the lldb 
dotest arguments (authored by stella.stamenova).

Changed prior to commit:
  https://reviews.llvm.org/D74093?vs=242753=242941#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74093

Files:
  lldb/test/API/lit.site.cfg.py.in
  lldb/utils/lldb-dotest/CMakeLists.txt
  lldb/utils/lldb-dotest/lldb-dotest.in

Index: lldb/utils/lldb-dotest/lldb-dotest.in
===
--- lldb/utils/lldb-dotest/lldb-dotest.in
+++ lldb/utils/lldb-dotest/lldb-dotest.in
@@ -2,16 +2,15 @@
 import subprocess
 import sys
 
-dotest_path = '@LLDB_SOURCE_DIR@/test/API/dotest.py'
-build_dir = '@LLDB_TEST_BUILD_DIRECTORY@'
-dotest_args_str = '@LLDB_DOTEST_ARGS@'
+dotest_path = '@LLDB_SOURCE_DIR_CONFIGURED@/test/API/dotest.py'
+build_dir = '@LLDB_TEST_BUILD_DIRECTORY_CONFIGURED@'
+dotest_args_str = '@LLDB_DOTEST_ARGS_CONFIGURED@'
 arch = '@LLDB_TEST_ARCH@'
-executable = '@LLDB_TEST_EXECUTABLE@'
-compiler = '@LLDB_TEST_COMPILER@'
-dsymutil = '@LLDB_TEST_DSYMUTIL@'
-filecheck = '@LLDB_TEST_FILECHECK@'
-lldb_libs_dir = "@LLDB_LIBS_DIR@"
-
+executable = '@LLDB_TEST_EXECUTABLE_CONFIGURED@'
+compiler = '@LLDB_TEST_COMPILER_CONFIGURED@'
+dsymutil = '@LLDB_TEST_DSYMUTIL_CONFIGURED@'
+filecheck = '@LLDB_TEST_FILECHECK_CONFIGURED@'
+lldb_libs_dir = "@LLDB_LIBS_DIR_CONFIGURED@"
 
 if __name__ == '__main__':
 wrapper_args = sys.argv[1:]
Index: lldb/utils/lldb-dotest/CMakeLists.txt
===
--- lldb/utils/lldb-dotest/CMakeLists.txt
+++ lldb/utils/lldb-dotest/CMakeLists.txt
@@ -15,33 +15,35 @@
   foreach(config_type ${config_types})
 # In paths to our build-tree, replace CMAKE_CFG_INTDIR with our actual configuration names.
 string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} config_runtime_output_dir ${LLVM_RUNTIME_OUTPUT_INTDIR})
-string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} LLDB_DOTEST_ARGS "${LLDB_DOTEST_ARGS}")
-string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} LLDB_SOURCE_DIR "${LLDB_SOURCE_DIR}")
-string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} LLDB_TEST_BUILD_DIRECTORY "${LLDB_TEST_BUILD_DIRECTORY}")
-string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} LLDB_TEST_EXECUTABLE "${LLDB_TEST_EXECUTABLE}")
-string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} LLDB_TEST_COMPILER "${LLDB_TEST_COMPILER}")
-string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} LLDB_TEST_DSYMUTIL "${LLDB_TEST_DSYMUTIL}")
-string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} LLDB_TEST_FILECHECK "${LLDB_TEST_FILECHECK}")
+string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} LLDB_DOTEST_ARGS_CONFIGURED "${LLDB_DOTEST_ARGS}")
+string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} LLDB_SOURCE_DIR_CONFIGURED "${LLDB_SOURCE_DIR}")
+string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} LLDB_TEST_BUILD_DIRECTORY_CONFIGURED "${LLDB_TEST_BUILD_DIRECTORY}")
+string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} LLDB_TEST_EXECUTABLE_CONFIGURED "${LLDB_TEST_EXECUTABLE}")
+string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} LLDB_TEST_COMPILER_CONFIGURED "${LLDB_TEST_COMPILER}")
+string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} LLDB_TEST_DSYMUTIL_CONFIGURED "${LLDB_TEST_DSYMUTIL}")
+string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} LLDB_TEST_FILECHECK_CONFIGURED "${LLDB_TEST_FILECHECK}")
 
 # Remaining ones must be paths to the provided LLVM build-tree.
 if(${config_type} IN_LIST LLVM_CONFIGURATION_TYPES)
   # Multi-configuration generator like Xcode (with a matching config).
-  string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} LLDB_DOTEST_ARGS "${LLDB_DOTEST_ARGS}")
-  string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} LLDB_SOURCE_DIR "${LLDB_SOURCE_DIR}")
-  string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} LLDB_TEST_BUILD_DIRECTORY "${LLDB_TEST_BUILD_DIRECTORY}")
-  string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} LLDB_TEST_EXECUTABLE "${LLDB_TEST_EXECUTABLE}")
-  string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} LLDB_TEST_COMPILER "${LLDB_TEST_COMPILER}")
-  string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} LLDB_TEST_DSYMUTIL "${LLDB_TEST_DSYMUTIL}")
-  string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} LLDB_TEST_FILECHECK "${LLDB_TEST_FILECHECK}")
+  string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} LLDB_DOTEST_ARGS_CONFIGURED "${LLDB_DOTEST_ARGS}")
+  string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} 

[Lldb-commits] [lldb] d53c8c6 - [lldb/tests] Correctly configure the lldb dotest arguments

2020-02-06 Thread Stella Stamenova via lldb-commits

Author: Stella Stamenova
Date: 2020-02-06T10:27:10-08:00
New Revision: d53c8c6af5223e4098b395175f0bfaf75721fb79

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

LOG: [lldb/tests] Correctly configure the lldb dotest arguments

Summary:
When the generator used for CMake is a multi-configuration generator (such as 
VS), the arguments passed to dotest are not currently configured correctly. 
There are a couple of issues:
1) The per-configuration files are all generated for the same configuration 
since the for loop overwrites the properties
2) Not all of the parameters are configured in the lit cfg, so they end up with 
%(build_mode)s as configuration and they point to non-existent paths

Reviewers: JDevlieghere

Reviewed By: JDevlieghere

Subscribers: mgorny, lldb-commits, asmith

Tags: #lldb

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

Added: 


Modified: 
lldb/test/API/lit.site.cfg.py.in
lldb/utils/lldb-dotest/CMakeLists.txt
lldb/utils/lldb-dotest/lldb-dotest.in

Removed: 




diff  --git a/lldb/test/API/lit.site.cfg.py.in 
b/lldb/test/API/lit.site.cfg.py.in
index e68d481f7f56..4e9413aac6f8 100644
--- a/lldb/test/API/lit.site.cfg.py.in
+++ b/lldb/test/API/lit.site.cfg.py.in
@@ -46,6 +46,10 @@ try:
 config.llvm_shlib_dir = config.llvm_shlib_dir % lit_config.params
 config.llvm_build_mode = config.llvm_build_mode % lit_config.params
 config.lldb_executable = config.lldb_executable % lit_config.params
+config.lldb_libs_dir = config.lldb_libs_dir % lit_config.params
+config.test_compiler = config.test_compiler % lit_config.params
+config.dsymutil = config.dsymutil % lit_config.params
+config.filecheck = config.filecheck % lit_config.params
 config.dotest_args_str = config.dotest_args_str % lit_config.params
 except KeyError as e:
 key, = e.args

diff  --git a/lldb/utils/lldb-dotest/CMakeLists.txt 
b/lldb/utils/lldb-dotest/CMakeLists.txt
index 55ba0ba3c824..21fedc6f650c 100644
--- a/lldb/utils/lldb-dotest/CMakeLists.txt
+++ b/lldb/utils/lldb-dotest/CMakeLists.txt
@@ -15,33 +15,35 @@ if(LLDB_BUILT_STANDALONE)
   foreach(config_type ${config_types})
 # In paths to our build-tree, replace CMAKE_CFG_INTDIR with our actual 
configuration names.
 string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} 
config_runtime_output_dir ${LLVM_RUNTIME_OUTPUT_INTDIR})
-string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} 
LLDB_DOTEST_ARGS "${LLDB_DOTEST_ARGS}")
-string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} 
LLDB_SOURCE_DIR "${LLDB_SOURCE_DIR}")
-string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} 
LLDB_TEST_BUILD_DIRECTORY "${LLDB_TEST_BUILD_DIRECTORY}")
-string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} 
LLDB_TEST_EXECUTABLE "${LLDB_TEST_EXECUTABLE}")
-string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} 
LLDB_TEST_COMPILER "${LLDB_TEST_COMPILER}")
-string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} 
LLDB_TEST_DSYMUTIL "${LLDB_TEST_DSYMUTIL}")
-string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} 
LLDB_TEST_FILECHECK "${LLDB_TEST_FILECHECK}")
+string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} 
LLDB_DOTEST_ARGS_CONFIGURED "${LLDB_DOTEST_ARGS}")
+string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} 
LLDB_SOURCE_DIR_CONFIGURED "${LLDB_SOURCE_DIR}")
+string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} 
LLDB_TEST_BUILD_DIRECTORY_CONFIGURED "${LLDB_TEST_BUILD_DIRECTORY}")
+string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} 
LLDB_TEST_EXECUTABLE_CONFIGURED "${LLDB_TEST_EXECUTABLE}")
+string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} 
LLDB_TEST_COMPILER_CONFIGURED "${LLDB_TEST_COMPILER}")
+string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} 
LLDB_TEST_DSYMUTIL_CONFIGURED "${LLDB_TEST_DSYMUTIL}")
+string(REPLACE ${LLVM_RUNTIME_OUTPUT_INTDIR} ${config_runtime_output_dir} 
LLDB_TEST_FILECHECK_CONFIGURED "${LLDB_TEST_FILECHECK}")
 
 # Remaining ones must be paths to the provided LLVM build-tree.
 if(${config_type} IN_LIST LLVM_CONFIGURATION_TYPES)
   # Multi-configuration generator like Xcode (with a matching config).
-  string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} LLDB_DOTEST_ARGS 
"${LLDB_DOTEST_ARGS}")
-  string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} LLDB_SOURCE_DIR 
"${LLDB_SOURCE_DIR}")
-  string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} 
LLDB_TEST_BUILD_DIRECTORY "${LLDB_TEST_BUILD_DIRECTORY}")
-  string(REPLACE ${CMAKE_CFG_INTDIR} ${config_type} 

[Lldb-commits] [PATCH] D73787: [NFC] Refactor `GetDWARFDeclContext` to return `DWARFDeclContext`

2020-02-06 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil updated this revision to Diff 242936.
This revision is now accepted and ready to land.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73787

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h

Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -308,8 +308,7 @@
   static lldb_private::CompilerDeclContext
   GetContainingDeclContext(const DWARFDIE );
 
-  static void GetDWARFDeclContext(const DWARFDIE ,
-  DWARFDeclContext _decl_ctx);
+  static DWARFDeclContext GetDWARFDeclContext(const DWARFDIE );
 
   static lldb::LanguageType LanguageTypeFromDWARF(uint64_t val);
 
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2959,8 +2959,8 @@
 }
 
 if (try_resolving_type) {
-  DWARFDeclContext type_dwarf_decl_ctx;
-  GetDWARFDeclContext(type_die, type_dwarf_decl_ctx);
+  DWARFDeclContext type_dwarf_decl_ctx =
+  GetDWARFDeclContext(type_die);
 
   if (log) {
 GetObjectFile()->GetModule()->LogMessage(
@@ -3377,12 +3377,10 @@
 // declaration context.
 if ((parent_tag == DW_TAG_compile_unit ||
  parent_tag == DW_TAG_partial_unit) &&
-Language::LanguageIsCPlusPlus(GetLanguage(*die.GetCU( {
-  DWARFDeclContext decl_ctx;
-
-  GetDWARFDeclContext(die, decl_ctx);
-  mangled = decl_ctx.GetQualifiedNameAsConstString().GetCString();
-}
+Language::LanguageIsCPlusPlus(GetLanguage(*die.GetCU(
+  mangled = GetDWARFDeclContext(die)
+.GetQualifiedNameAsConstString()
+.GetCString();
   }
 
   if (tag == DW_TAG_formal_parameter)
@@ -3984,14 +3982,13 @@
   return CompilerDeclContext();
 }
 
-void SymbolFileDWARF::GetDWARFDeclContext(const DWARFDIE ,
-  DWARFDeclContext _decl_ctx) {
-  if (!die.IsValid()) {
-dwarf_decl_ctx.Clear();
-return;
-  }
+DWARFDeclContext SymbolFileDWARF::GetDWARFDeclContext(const DWARFDIE ) {
+  if (!die.IsValid())
+return {};
+  DWARFDeclContext dwarf_decl_ctx =
+  die.GetDIE()->GetDWARFDeclContext(die.GetCU());
   dwarf_decl_ctx.SetLanguage(GetLanguage(*die.GetCU()));
-  die.GetDIE()->GetDWARFDeclContext(die.GetCU(), dwarf_decl_ctx);
+  return dwarf_decl_ctx;
 }
 
 LanguageType SymbolFileDWARF::LanguageTypeFromDWARF(uint64_t val) {
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
@@ -158,8 +158,7 @@
 return HasChildren() ? this + 1 : nullptr;
   }
 
-  void GetDWARFDeclContext(DWARFUnit *cu,
-   DWARFDeclContext _decl_ctx) const;
+  DWARFDeclContext GetDWARFDeclContext(DWARFUnit *cu) const;
 
   DWARFDIE GetParentDeclContextDIE(DWARFUnit *cu) const;
   DWARFDIE GetParentDeclContextDIE(DWARFUnit *cu,
@@ -169,6 +168,9 @@
   void SetParentIndex(uint32_t idx) { m_parent_idx = idx; }
 
 protected:
+  static DWARFDeclContext
+  GetDWARFDeclContextStatic(const DWARFDebugInfoEntry *die, DWARFUnit *cu);
+
   dw_offset_t m_offset; // Offset within the .debug_info/.debug_types
   uint32_t m_parent_idx; // How many to subtract from "this" to get the parent.
  // If zero this die has no parent
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
@@ -868,21 +868,30 @@
   }
 }
 
-void DWARFDebugInfoEntry::GetDWARFDeclContext(
-DWARFUnit *cu, DWARFDeclContext _decl_ctx) const {
-  const dw_tag_t tag = Tag();
-  if (tag == DW_TAG_compile_unit || tag == DW_TAG_partial_unit)
-return;
-  dwarf_decl_ctx.AppendDeclContext(tag, GetName(cu));
-  DWARFDIE parent_decl_ctx_die = GetParentDeclContextDIE(cu);
-  if (parent_decl_ctx_die && parent_decl_ctx_die.GetDIE() != this) {
-if (parent_decl_ctx_die.Tag() != DW_TAG_compile_unit &&
-

[Lldb-commits] [PATCH] D73787: [NFC] Refactor `GetDWARFDeclContext` to return `DWARFDeclContext`

2020-02-06 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil added a comment.

In D73787#1859754 , @labath wrote:

> One way to this could be improved further is to change the recursion in 
> `GetDWARFDeclContext` into a loop (then you wouldn't need the extra wrapper).


True, I am stupid. But then I find there a need for the static method (as 
having `this` and iterating `die` pointer is error-prone).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73787



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


[Lldb-commits] [lldb] b8f4e0a - [lldb] Remove reset(nullptr_t) overload from SharingPtr

2020-02-06 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2020-02-06T10:07:06-08:00
New Revision: b8f4e0a8234377cdac8740addfdabee339b12d2a

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

LOG: [lldb] Remove reset(nullptr_t) overload from SharingPtr

std::shared_ptr has no such method. This makes the two more similar.

Added: 


Modified: 
lldb/include/lldb/Breakpoint/Watchpoint.h
lldb/include/lldb/Utility/SharingPtr.h

Removed: 




diff  --git a/lldb/include/lldb/Breakpoint/Watchpoint.h 
b/lldb/include/lldb/Breakpoint/Watchpoint.h
index 2cc74bb4c632..27b0d36b4308 100644
--- a/lldb/include/lldb/Breakpoint/Watchpoint.h
+++ b/lldb/include/lldb/Breakpoint/Watchpoint.h
@@ -160,8 +160,8 @@ class Watchpoint : public 
std::enable_shared_from_this,
   void ResetHitCount() { m_hit_count = 0; }
 
   void ResetHistoricValues() {
-m_old_value_sp.reset(nullptr);
-m_new_value_sp.reset(nullptr);
+m_old_value_sp.reset();
+m_new_value_sp.reset();
   }
 
   Target _target;

diff  --git a/lldb/include/lldb/Utility/SharingPtr.h 
b/lldb/include/lldb/Utility/SharingPtr.h
index ddd55a00d384..76e340a3ae66 100644
--- a/lldb/include/lldb/Utility/SharingPtr.h
+++ b/lldb/include/lldb/Utility/SharingPtr.h
@@ -135,7 +135,6 @@ template  class SharingPtr {
   void swap(SharingPtr );
   void reset();
   template  void reset(Y *p);
-  void reset(std::nullptr_t);
 
   element_type *get() const { return ptr_; }
   element_type *() const { return *ptr_; }
@@ -235,10 +234,6 @@ template  inline void SharingPtr::reset() {
   SharingPtr().swap(*this);
 }
 
-template  inline void SharingPtr::reset(std::nullptr_t p) {
-  reset();
-}
-
 template  template  inline void SharingPtr::reset(Y *p) {
   SharingPtr(p).swap(*this);
 }



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


[Lldb-commits] [PATCH] D74136: [LLDB] WIP: Optionally follow DW_AT_decl_file when setting breakpoint

2020-02-06 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I think that having this behavior key off of a flag is really confusing. I 
think the most sensible behavior here would be to introduce a new option like 
`--compile-unit` and have that behave like the current --file+--function mode. 
This would free up the --file argument for the behavior that you want to 
implement here.

I.e.:

- --compile-unit+--function: search for the occurence of the given function in 
the given compile unit (ignoring DW_AT_decl_file)
- --file+--function: search for the given function defined in the given file 
(no matter which compile unit it comes from). This would be consistent with the 
--file+--line scenario. For maximal consistence this should also respect the 
`target.inline-breakpoint-strategy` setting and only do an exhaustive file 
search when the value of that setting is "always". If the value is "headers" 
then we should assume that the name of the .cpp file refers to a compile unit 
and only search the unit with that name.

The change in behavior is unfortunate, but I don't think this is something that 
a lot of people will depend on because the current behavior is quite confusing. 
And I think it's better to change it now instead of painting ourselves into an 
even smaller corner. To reduce surprises we can issue a warning about the 
behavior change when the user uses this flag combination. And making these 
things separate paves the way for introducing new combinations of flags 
(--compile-unit+--file+--name, or --compile-unit+--file+--line) with a 
reasonably predictable behavior...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74136



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


[Lldb-commits] [PATCH] D73303: [lldb/Target] Add Assert StackFrame Recognizer

2020-02-06 Thread Med Ismail Bennani via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7ebe9cc4fc2d: [lldb/Target] Add Assert StackFrame Recognizer 
(authored by mib).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73303

Files:
  lldb/docs/use/formatting.rst
  lldb/include/lldb/Core/FormatEntity.h
  lldb/include/lldb/Target/AssertFrameRecognizer.h
  lldb/include/lldb/Target/StackFrameRecognizer.h
  lldb/include/lldb/Target/Thread.h
  
lldb/packages/Python/lldbsuite/test/functionalities/inferior-assert/TestInferiorAssert.py
  lldb/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py
  lldb/source/API/SBThread.cpp
  lldb/source/Core/FormatEntity.cpp
  
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
  lldb/source/Target/AssertFrameRecognizer.cpp
  lldb/source/Target/CMakeLists.txt
  lldb/source/Target/Process.cpp
  lldb/source/Target/StackFrameRecognizer.cpp
  lldb/source/Target/Thread.cpp
  lldb/test/Shell/Recognizer/Inputs/assert.c
  lldb/test/Shell/Recognizer/assert.test

Index: lldb/test/Shell/Recognizer/assert.test
===
--- /dev/null
+++ lldb/test/Shell/Recognizer/assert.test
@@ -0,0 +1,13 @@
+# UNSUPPORTED: system-windows
+# RUN: %clang_host -g -O0 %S/Inputs/assert.c -o %t.out
+# RUN: %lldb -b -s %s %t.out | FileCheck %s
+run
+# CHECK: thread #{{.*}}stop reason = hit program assert
+frame info
+# CHECK: frame #{{.*}}`main at assert.c
+frame recognizer info 0
+# CHECK: frame 0 is recognized by Assert StackFrame Recognizer
+set set thread-format "{${thread.stop-reason-raw}}\n"
+thread info
+# CHECK: signal SIGABRT
+q
Index: lldb/test/Shell/Recognizer/Inputs/assert.c
===
--- /dev/null
+++ lldb/test/Shell/Recognizer/Inputs/assert.c
@@ -0,0 +1,9 @@
+#include 
+
+int main() {
+  int a = 42;
+  assert(a == 42);
+  a--;
+  assert(a == 42);
+  return 0;
+}
Index: lldb/source/Target/Thread.cpp
===
--- lldb/source/Target/Thread.cpp
+++ lldb/source/Target/Thread.cpp
@@ -573,9 +573,64 @@
   m_state = state;
 }
 
+std::string Thread::GetStopDescription() {
+  StackFrameSP frame_sp = GetStackFrameAtIndex(0);
+
+  if (!frame_sp)
+return GetStopDescriptionRaw();
+
+  auto recognized_frame_sp = frame_sp->GetRecognizedFrame();
+
+  if (!recognized_frame_sp)
+return GetStopDescriptionRaw();
+
+  std::string recognized_stop_description =
+  recognized_frame_sp->GetStopDescription();
+
+  if (!recognized_stop_description.empty())
+return recognized_stop_description;
+
+  return GetStopDescriptionRaw();
+}
+
+std::string Thread::GetStopDescriptionRaw() {
+  StopInfoSP stop_info_sp = GetStopInfo();
+  std::string raw_stop_description;
+  if (stop_info_sp && stop_info_sp->IsValid())
+raw_stop_description = stop_info_sp->GetDescription();
+  return raw_stop_description;
+}
+
+void Thread::SelectMostRelevantFrame() {
+  Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD);
+
+  auto frames_list_sp = GetStackFrameList();
+
+  // Only the top frame should be recognized.
+  auto frame_sp = frames_list_sp->GetFrameAtIndex(0);
+
+  auto recognized_frame_sp = frame_sp->GetRecognizedFrame();
+
+  if (!recognized_frame_sp) {
+LLDB_LOG(log, "Frame #0 not recognized");
+return;
+  }
+
+  if (StackFrameSP most_relevant_frame_sp =
+  recognized_frame_sp->GetMostRelevantFrame()) {
+LLDB_LOG(log, "Found most relevant frame at index {0}",
+ most_relevant_frame_sp->GetFrameIndex());
+SetSelectedFrame(most_relevant_frame_sp.get());
+  } else {
+LLDB_LOG(log, "No relevant frame!");
+  }
+}
+
 void Thread::WillStop() {
   ThreadPlan *current_plan = GetCurrentPlan();
 
+  SelectMostRelevantFrame();
+
   // FIXME: I may decide to disallow threads with no plans.  In which
   // case this should go to an assert.
 
Index: lldb/source/Target/StackFrameRecognizer.cpp
===
--- lldb/source/Target/StackFrameRecognizer.cpp
+++ lldb/source/Target/StackFrameRecognizer.cpp
@@ -92,8 +92,8 @@
   }
 
   StackFrameRecognizerSP GetRecognizerForFrame(StackFrameSP frame) {
-const SymbolContext  =
-frame->GetSymbolContext(eSymbolContextModule | eSymbolContextFunction);
+const SymbolContext  = frame->GetSymbolContext(
+eSymbolContextModule | eSymbolContextFunction | eSymbolContextSymbol);
 ConstString function_name = symctx.GetFunctionName();
 ModuleSP module_sp = symctx.module_sp;
 if (!module_sp) return StackFrameRecognizerSP();
Index: lldb/source/Target/Process.cpp
===
--- lldb/source/Target/Process.cpp
+++ lldb/source/Target/Process.cpp
@@ -38,6 +38,7 @@
 #include "lldb/Symbol/Function.h"
 #include 

[Lldb-commits] [lldb] 7ebe9cc - [lldb/Target] Add Assert StackFrame Recognizer

2020-02-06 Thread Med Ismail Bennani via lldb-commits

Author: Med Ismail Bennani
Date: 2020-02-06T18:27:48+01:00
New Revision: 7ebe9cc4fc2d97ec0ed2a6038be25b2a7ed1aac2

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

LOG: [lldb/Target] Add Assert StackFrame Recognizer

When a thread stops, this checks depending on the platform if the top frame is
an abort stack frame. If so, it looks for an assert stack frame in the upper
frames and set it as the most relavant frame when found.

To do so, the StackFrameRecognizer class holds a "Most Relevant Frame" and a
"cooked" stop reason description. When the thread is about to stop, it checks
if the current frame is recognized, and if so, it fetches the recognized frame's
attributes and applies them.

rdar://58528686

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

Signed-off-by: Med Ismail Bennani 

Added: 
lldb/include/lldb/Target/AssertFrameRecognizer.h
lldb/source/Target/AssertFrameRecognizer.cpp
lldb/test/Shell/Recognizer/Inputs/assert.c
lldb/test/Shell/Recognizer/assert.test

Modified: 
lldb/docs/use/formatting.rst
lldb/include/lldb/Core/FormatEntity.h
lldb/include/lldb/Target/StackFrameRecognizer.h
lldb/include/lldb/Target/Thread.h

lldb/packages/Python/lldbsuite/test/functionalities/inferior-assert/TestInferiorAssert.py

lldb/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py
lldb/source/API/SBThread.cpp
lldb/source/Core/FormatEntity.cpp

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
lldb/source/Target/CMakeLists.txt
lldb/source/Target/Process.cpp
lldb/source/Target/StackFrameRecognizer.cpp
lldb/source/Target/Thread.cpp

Removed: 




diff  --git a/lldb/docs/use/formatting.rst b/lldb/docs/use/formatting.rst
index 939c4e18f749..e2644d50217b 100644
--- a/lldb/docs/use/formatting.rst
+++ b/lldb/docs/use/formatting.rst
@@ -134,7 +134,9 @@ A complete list of currently supported format string 
variables is listed below:
 
+---+-+
 | ``thread.queue``  | The queue name of the 
thread if the target OS supports dispatch queues


  |
 
+---+-+
-| ``thread.stop-reason``| A textual reason each 
thread stopped  


  |
+| ``thread.stop-reason``| A textual reason why the 
thread stopped. If the thread have a recognized frame, this displays its 
recognized stop reason. Otherwise, gets the stop info description.  

  |
++---+-+
+| ``thread.stop-reason-raw``| A textual reason why the 
thread stopped. Always returns stop info description.   


   |
 
+---+-+
 | ``thread.return-value``   

[Lldb-commits] [PATCH] D73303: [lldb/Target] Add Assert StackFrame Recognizer

2020-02-06 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib updated this revision to Diff 242926.
mib added a comment.
This revision is now accepted and ready to land.

Fixing the memory management bug should hopefully solve the Linux and Windows 
Issues.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73303

Files:
  lldb/docs/use/formatting.rst
  lldb/include/lldb/Core/FormatEntity.h
  lldb/include/lldb/Target/AssertFrameRecognizer.h
  lldb/include/lldb/Target/StackFrameRecognizer.h
  lldb/include/lldb/Target/Thread.h
  
lldb/packages/Python/lldbsuite/test/functionalities/inferior-assert/TestInferiorAssert.py
  lldb/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py
  lldb/source/API/SBThread.cpp
  lldb/source/Core/FormatEntity.cpp
  
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
  lldb/source/Target/AssertFrameRecognizer.cpp
  lldb/source/Target/CMakeLists.txt
  lldb/source/Target/Process.cpp
  lldb/source/Target/StackFrameRecognizer.cpp
  lldb/source/Target/Thread.cpp
  lldb/test/Shell/Recognizer/Inputs/assert.c
  lldb/test/Shell/Recognizer/assert.test

Index: lldb/test/Shell/Recognizer/assert.test
===
--- /dev/null
+++ lldb/test/Shell/Recognizer/assert.test
@@ -0,0 +1,13 @@
+# UNSUPPORTED: system-windows
+# RUN: %clang_host -g -O0 %S/Inputs/assert.c -o %t.out
+# RUN: %lldb -b -s %s %t.out | FileCheck %s
+run
+# CHECK: thread #{{.*}}stop reason = hit program assert
+frame info
+# CHECK: frame #{{.*}}`main at assert.c
+frame recognizer info 0
+# CHECK: frame 0 is recognized by Assert StackFrame Recognizer
+set set thread-format "{${thread.stop-reason-raw}}\n"
+thread info
+# CHECK: signal SIGABRT
+q
Index: lldb/test/Shell/Recognizer/Inputs/assert.c
===
--- /dev/null
+++ lldb/test/Shell/Recognizer/Inputs/assert.c
@@ -0,0 +1,9 @@
+#include 
+
+int main() {
+  int a = 42;
+  assert(a == 42);
+  a--;
+  assert(a == 42);
+  return 0;
+}
Index: lldb/source/Target/Thread.cpp
===
--- lldb/source/Target/Thread.cpp
+++ lldb/source/Target/Thread.cpp
@@ -573,9 +573,64 @@
   m_state = state;
 }
 
+std::string Thread::GetStopDescription() {
+  StackFrameSP frame_sp = GetStackFrameAtIndex(0);
+
+  if (!frame_sp)
+return GetStopDescriptionRaw();
+
+  auto recognized_frame_sp = frame_sp->GetRecognizedFrame();
+
+  if (!recognized_frame_sp)
+return GetStopDescriptionRaw();
+
+  std::string recognized_stop_description =
+  recognized_frame_sp->GetStopDescription();
+
+  if (!recognized_stop_description.empty())
+return recognized_stop_description;
+
+  return GetStopDescriptionRaw();
+}
+
+std::string Thread::GetStopDescriptionRaw() {
+  StopInfoSP stop_info_sp = GetStopInfo();
+  std::string raw_stop_description;
+  if (stop_info_sp && stop_info_sp->IsValid())
+raw_stop_description = stop_info_sp->GetDescription();
+  return raw_stop_description;
+}
+
+void Thread::SelectMostRelevantFrame() {
+  Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD);
+
+  auto frames_list_sp = GetStackFrameList();
+
+  // Only the top frame should be recognized.
+  auto frame_sp = frames_list_sp->GetFrameAtIndex(0);
+
+  auto recognized_frame_sp = frame_sp->GetRecognizedFrame();
+
+  if (!recognized_frame_sp) {
+LLDB_LOG(log, "Frame #0 not recognized");
+return;
+  }
+
+  if (StackFrameSP most_relevant_frame_sp =
+  recognized_frame_sp->GetMostRelevantFrame()) {
+LLDB_LOG(log, "Found most relevant frame at index {0}",
+ most_relevant_frame_sp->GetFrameIndex());
+SetSelectedFrame(most_relevant_frame_sp.get());
+  } else {
+LLDB_LOG(log, "No relevant frame!");
+  }
+}
+
 void Thread::WillStop() {
   ThreadPlan *current_plan = GetCurrentPlan();
 
+  SelectMostRelevantFrame();
+
   // FIXME: I may decide to disallow threads with no plans.  In which
   // case this should go to an assert.
 
Index: lldb/source/Target/StackFrameRecognizer.cpp
===
--- lldb/source/Target/StackFrameRecognizer.cpp
+++ lldb/source/Target/StackFrameRecognizer.cpp
@@ -92,8 +92,8 @@
   }
 
   StackFrameRecognizerSP GetRecognizerForFrame(StackFrameSP frame) {
-const SymbolContext  =
-frame->GetSymbolContext(eSymbolContextModule | eSymbolContextFunction);
+const SymbolContext  = frame->GetSymbolContext(
+eSymbolContextModule | eSymbolContextFunction | eSymbolContextSymbol);
 ConstString function_name = symctx.GetFunctionName();
 ModuleSP module_sp = symctx.module_sp;
 if (!module_sp) return StackFrameRecognizerSP();
Index: lldb/source/Target/Process.cpp
===
--- lldb/source/Target/Process.cpp
+++ lldb/source/Target/Process.cpp
@@ -38,6 +38,7 @@
 #include 

[Lldb-commits] [PATCH] D74138: [lldb] Group ABI plugins

2020-02-06 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

If there's a need for single entry point for each of the new meta-plugins, this 
can go into a new file like ABIAArch64.cpp (and then the common code can go 
there too).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74138



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


[Lldb-commits] [PATCH] D74138: [lldb] Group ABI plugins

2020-02-06 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: JDevlieghere, jasonmolenda.
Herald added subscribers: jsji, atanasyan, jrtc27, kbarton, fedor.sergeev, 
kristof.beyls, mgorny, nemanjai, sdardis.
Herald added a reviewer: jfb.
Herald added a project: LLDB.

There's a fair amount of code duplication between the different ABI plugins for
the same architecture (e.g. ABIMacOSX_arm & ABISysV_arm). Deduplicating this
code is not very easy at the moment because there is no good place where to put
the common code.

Instead of creating more plugins, this patch reduces their number by grouping
similar plugins into a single folder/plugin. This makes it easy to extract
common code to a (e.g.) base class, which can then live in the same folder.

The grouping is done based on the underlying llvm target for that architecture,
because the plugins already require this for their operation.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74138

Files:
  lldb/source/API/SystemInitializerFull.cpp
  lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
  lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.h
  lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp
  lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.h
  lldb/source/Plugins/ABI/AArch64/CMakeLists.txt
  lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp
  lldb/source/Plugins/ABI/ARC/ABISysV_arc.h
  lldb/source/Plugins/ABI/ARC/CMakeLists.txt
  lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp
  lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.h
  lldb/source/Plugins/ABI/ARM/ABISysV_arm.cpp
  lldb/source/Plugins/ABI/ARM/ABISysV_arm.h
  lldb/source/Plugins/ABI/ARM/CMakeLists.txt
  lldb/source/Plugins/ABI/CMakeLists.txt
  lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.cpp
  lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.h
  lldb/source/Plugins/ABI/Hexagon/CMakeLists.txt
  lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp
  lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h
  lldb/source/Plugins/ABI/MacOSX-arm/CMakeLists.txt
  lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp
  lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h
  lldb/source/Plugins/ABI/MacOSX-arm64/CMakeLists.txt
  lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
  lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h
  lldb/source/Plugins/ABI/MacOSX-i386/CMakeLists.txt
  lldb/source/Plugins/ABI/Mips/ABISysV_mips.cpp
  lldb/source/Plugins/ABI/Mips/ABISysV_mips.h
  lldb/source/Plugins/ABI/Mips/ABISysV_mips64.cpp
  lldb/source/Plugins/ABI/Mips/ABISysV_mips64.h
  lldb/source/Plugins/ABI/Mips/CMakeLists.txt
  lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.cpp
  lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc.h
  lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp
  lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.h
  lldb/source/Plugins/ABI/PowerPC/CMakeLists.txt
  lldb/source/Plugins/ABI/SysV-arc/ABISysV_arc.cpp
  lldb/source/Plugins/ABI/SysV-arc/ABISysV_arc.h
  lldb/source/Plugins/ABI/SysV-arc/CMakeLists.txt
  lldb/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp
  lldb/source/Plugins/ABI/SysV-arm/ABISysV_arm.h
  lldb/source/Plugins/ABI/SysV-arm/CMakeLists.txt
  lldb/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp
  lldb/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.h
  lldb/source/Plugins/ABI/SysV-arm64/CMakeLists.txt
  lldb/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
  lldb/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h
  lldb/source/Plugins/ABI/SysV-hexagon/CMakeLists.txt
  lldb/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp
  lldb/source/Plugins/ABI/SysV-i386/ABISysV_i386.h
  lldb/source/Plugins/ABI/SysV-i386/CMakeLists.txt
  lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
  lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.h
  lldb/source/Plugins/ABI/SysV-mips/CMakeLists.txt
  lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
  lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h
  lldb/source/Plugins/ABI/SysV-mips64/CMakeLists.txt
  lldb/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp
  lldb/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.h
  lldb/source/Plugins/ABI/SysV-ppc/CMakeLists.txt
  lldb/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp
  lldb/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h
  lldb/source/Plugins/ABI/SysV-ppc64/CMakeLists.txt
  lldb/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp
  lldb/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.h
  lldb/source/Plugins/ABI/SysV-s390x/CMakeLists.txt
  lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
  lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h
  lldb/source/Plugins/ABI/SysV-x86_64/CMakeLists.txt
  lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp
  lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.h
  lldb/source/Plugins/ABI/SystemZ/CMakeLists.txt
  lldb/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.cpp
  lldb/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.h
  lldb/source/Plugins/ABI/Windows-x86_64/CMakeLists.txt
  lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.cpp
  lldb/source/Plugins/ABI/X86/ABIMacOSX_i386.h
  

[Lldb-commits] [PATCH] D74136: [LLDB] WIP: Optionally follow DW_AT_decl_file when setting breakpoint

2020-02-06 Thread Konrad Wilhelm Kleine via Phabricator via lldb-commits
kwk created this revision.
Herald added subscribers: lldb-commits, dexonsmith, aprantl, mehdi_amini, 
mgorny.
Herald added a reviewer: jdoerfert.
Herald added a project: LLDB.
kwk planned changes to this revision.
kwk added a comment.

I plan to refactor some of this patch.


To set a breakpoint on a function called `YOURFUNCTION` you do this:

  (lldb) breakpoint set -n YOURFUNCTION

The output then could look like this:

  Breakpoint 1: where = YOURTARGET`YOURFUNCTION() + 4 at YOURFILE:1:20, address 
= 0x01234

LLDB does a good job in finding `YOURFUNCTION` because, indeed,
`YOURFILE` contains the definition of `YOURFUNCTION`.

Let's say, you not only want to find `YOURFUNCTION` anywhere in
`YOURTARGET`. Say, you want to find `YOURFUNCTION` in the file that LLDB
found it in.

This is how you'd do that:

  (lldb) breakpoint set -n YOURFUNCTION -f YOURFILE

This is where things get a bit tricky. If `YOURFILE` points to a header
file in which `YOURFUNCTION` is not only declared but also defined, then
chances are that it might be inlined into `YOURTARGET` and LLDB cannot
find it. *Why?* You might ask and the answer is that LLDB uses only the
`DW_TAG_compile_unit`'s name that it finds under the `DW_AT_name`
attribute.

Suppose this is a snippet of `llvm-darfdump YOURTARGET`

  0x000b: DW_TAG_compile_unit
DW_AT_name ("main.c")
  
  0x002a: DW_TAG_subprogram
DW_AT_name ("YOURFUNCTION")
DW_AT_decl_file ("YOURFILE")

Then LLDB only looks at the file called `main.c` and ignores the
`DW_AT_decl_file`.

With this change I introduce a switch that teaches LLDB to optionally
also respect the `DW_AT_decl_file` all you have to do is pass an option
to the previously mentioned breakpoint command.

  (lldb) breakpoint set -n YOURFUNCTION -f YOURFILE
  --search-source-files

I'm happy to change the name of the flag from `--search-source-files` or
`-Q` to something else. Maybe `--respect-decl-file` or
`--follow-decl-file` are better names, but for now this is about the
working of this patch and not about names.

If you're not convinced that this change has any purpose, think about
LTO and how it might inline your functions with logic that is hard to
reason about when you just have the source code and a binary.

For reference, here's the definition for `DW_AT_decl_file` from the DWARF
spec in chapter 2.14:

> It is sometimes useful in a debugger to be able to associate a
>  declaration with its occurrence in the program source.
>  [...]
>  The value of the DW_AT_decl_file attribute corresponds to a file
>  number from the line number information table for the compilation unit
>  containing the debugging information entry and represents the source
>  file in which the declaration appeared (see Section 6.2 on page 148).
>  The value 0 indicates that no source file has been specified.



Reference to lldb-dev mailing list
==

I once brought this topic up on the lldb-dev mailing list
(http://lists.llvm.org/pipermail/lldb-dev/2019-November/015707.html) and
since then worked on it.

Performance considerations
--

That is where Jim Ingham wrote:

> You probably also want to take some care not to regress the
>  performance of the case where the function is defined in a CU, since
>  that's the more common usage.

Since I didn't change the default behavior in LLDB, I think the
performance is not in danger.

Documentation issue
---

Jim also brought up an idea of documenting and querying options of
commands:

> Another thing I've thought about doing is adding the ability to have
>  help include one of the non-optional, non-overlapping options to the
> command, so you could say:
> 
>   (lldb) help break set -n
> 
> and that would tell you that this is a "by function name" breakpoint,
>  and in that case -n means...  That might help reduce the information
>  overload, and give a better sense of what these complex commands do.

I haven't implemented this yet but I wanted to bubble this idea up here
so it receives more attention.

Thoughts on LTO
---

Jim's thoughts on LTO:

> Back to your original query...  If the function is defined in a .h
>  file, or gets inlined by LTO, this filtering is trickier, and I
>  didn't implement that behavior when I implemented this breakpoint
>  type.  So in that case, and in the case where LTO inlines a function,
>  the feature isn't implemented correctly.  The -n searche always looks
>  for out of line and inline instances when doing the search.  So we
>  already get the searcher to all the instances.
>  You would just have to widen the search beyond "Does the CU match" to
>  try to figure out where the inlined instance was defined.

That is essentially what I do in this change.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74136

Files:
  lldb/include/lldb/Core/SearchFilter.h
  lldb/include/lldb/Target/Target.h
  

[Lldb-commits] [PATCH] D74136: [LLDB] WIP: Optionally follow DW_AT_decl_file when setting breakpoint

2020-02-06 Thread Konrad Wilhelm Kleine via Phabricator via lldb-commits
kwk planned changes to this revision.
kwk added a comment.

I plan to refactor some of this patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74136



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


[Lldb-commits] [PATCH] D73782: [lldb/DWARF] Don't hold a unique SymbolFileDWARFDwo in a DWARFUnit

2020-02-06 Thread Pavel Labath via Phabricator via lldb-commits
labath updated this revision to Diff 242915.
labath marked 2 inline comments as done.
labath added a comment.

- clang-format
- add some doxygen


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73782

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h

Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
@@ -29,10 +29,7 @@
 
   ~SymbolFileDWARFDwo() override = default;
 
-  DWARFCompileUnit *GetCompileUnit();
-
-  DWARFUnit *
-  GetDWARFCompileUnit(lldb_private::CompileUnit *comp_unit) override;
+  DWARFCompileUnit *GetDWOCompileUnitForHash(uint64_t hash);
 
   size_t GetObjCMethodDIEOffsets(lldb_private::ConstString class_name,
  DIEArray _die_offsets) override;
@@ -68,10 +65,11 @@
 
   SymbolFileDWARF () { return m_base_symbol_file; }
 
-  DWARFCompileUnit *ComputeCompileUnit();
+  /// If this file contains exactly one compile unit, this function will return
+  /// it. Otherwise it returns nullptr.
+  DWARFCompileUnit *FindSingleCompileUnit();
 
   SymbolFileDWARF _base_symbol_file;
-  DWARFCompileUnit *m_cu = nullptr;
 };
 
 #endif // SymbolFileDWARFDwo_SymbolFileDWARFDwo_h_
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
@@ -49,13 +49,17 @@
   SymbolFileDWARF::LoadSectionData(sect_type, data);
 }
 
-DWARFCompileUnit *SymbolFileDWARFDwo::GetCompileUnit() {
-  if (!m_cu)
-m_cu = ComputeCompileUnit();
-  return m_cu;
+DWARFCompileUnit *SymbolFileDWARFDwo::GetDWOCompileUnitForHash(uint64_t hash) {
+  DWARFCompileUnit *cu = FindSingleCompileUnit();
+  if (!cu)
+return nullptr;
+  if (hash !=
+  cu->GetUnitDIEOnly().GetAttributeValueAsUnsigned(DW_AT_GNU_dwo_id, 0))
+return nullptr;
+  return cu;
 }
 
-DWARFCompileUnit *SymbolFileDWARFDwo::ComputeCompileUnit() {
+DWARFCompileUnit *SymbolFileDWARFDwo::FindSingleCompileUnit() {
   DWARFDebugInfo *debug_info = DebugInfo();
   if (!debug_info)
 return nullptr;
@@ -79,11 +83,6 @@
   return cu;
 }
 
-DWARFUnit *
-SymbolFileDWARFDwo::GetDWARFCompileUnit(lldb_private::CompileUnit *comp_unit) {
-  return GetCompileUnit();
-}
-
 SymbolFileDWARF::DIEToTypePtr ::GetDIEToType() {
   return GetBaseSymbolFile().GetDIEToType();
 }
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -270,7 +270,7 @@
 
   lldb::user_id_t GetUID(DIERef ref);
 
-  std::unique_ptr
+  std::shared_ptr
   GetDwoSymbolFileForCompileUnit(DWARFUnit _cu,
  const DWARFDebugInfoEntry _die);
 
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1552,7 +1552,7 @@
   return {};
 }
 
-std::unique_ptr
+std::shared_ptr
 SymbolFileDWARF::GetDwoSymbolFileForCompileUnit(
 DWARFUnit , const DWARFDebugInfoEntry _die) {
   // If this is a Darwin-style debug map (non-.dSYM) symbol file,
@@ -1607,7 +1607,7 @@
   if (dwo_obj_file == nullptr)
 return nullptr;
 
-  return std::make_unique(*this, dwo_obj_file,
+  return std::make_shared(*this, dwo_obj_file,
   dwarf_cu->GetID());
 }
 
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
@@ -277,7 +277,7 @@
   }
 
   SymbolFileDWARF _dwarf;
-  std::unique_ptr m_dwo_symbol_file;
+  std::shared_ptr m_dwo;
   DWARFUnitHeader m_header;
   const DWARFAbbreviationDeclarationSet *m_abbrevs = nullptr;
   void *m_user_data = nullptr;
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -188,7 +188,7 @@
   // simultaneously. We also don't need to do that as the dwo file will
   // contain a superset of 

[Lldb-commits] [PATCH] D74126: [lldb] Remove all 'clean' targets from test Makefiles

2020-02-06 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

Yes, I don't think we need to maintain this. Now that the tests our built out 
of tree, we can clean them by just nuking the build folder.


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

https://reviews.llvm.org/D74126



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


[Lldb-commits] [PATCH] D73782: [lldb/DWARF] Don't hold a unique SymbolFileDWARFDwo in a DWARFUnit

2020-02-06 Thread Pavel Labath via Phabricator via lldb-commits
labath marked 4 inline comments as done.
labath added inline comments.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp:56
+return nullptr;
+  if (hash != 
cu->GetUnitDIEOnly().GetAttributeValueAsUnsigned(DW_AT_GNU_dwo_id, 0))
+return nullptr;

clayborg wrote:
> How often does this function get called? Should we cache the DW_AT_GNU_dwo_id 
> in the DWARFCompileUnit to avoid extracting the DW_AT_GNU_dwo_id attribute 
> maybe multiple times? 
In a dwo file, this function will be called exactly once. With a DWP file (the 
next patch) it will get called once for each compile unit, but it will return a 
different compile unit each time, so for a single compile unit, the dwo_id 
attribute will still be accessed only once.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h:67
   SymbolFileDWARF () { return m_base_symbol_file; }
 
+  DWARFCompileUnit *FindSingleCompileUnit();

clayborg wrote:
> Curious: what is a single compile unit? A bit of a comment in header doc here 
> might be nice.
I've added a simple comment. The idea is that a dwo file will normally(*) 
contain exactly one compile unit. This function will find it and return it.

(*) This may not be 100% as I believe llvm can produce multiple CUs in a dwo 
file under some circumstances, but I'm not sure if this is fully conforming, 
and it is definitely not something that works in lldb right now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73782



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


[Lldb-commits] [PATCH] D74126: [lldb] Remove all 'clean' targets from test Makefiles

2020-02-06 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor updated this revision to Diff 242899.
teemperor added a comment.

- Reverted some removal for bundle tests that somehow use this.


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

https://reviews.llvm.org/D74126

Files:
  lldb/packages/Python/lldbsuite/test/api/multithreaded/Makefile
  lldb/packages/Python/lldbsuite/test/commands/expression/call-function/Makefile
  
lldb/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/synthupdate/Makefile
  lldb/packages/Python/lldbsuite/test/functionalities/memory-region/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/cross_dso/Makefile
  lldb/packages/Python/lldbsuite/test/functionalities/target_var/Makefile
  lldb/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Makefile
  lldb/packages/Python/lldbsuite/test/lang/cpp/char1632_t/Makefile
  lldb/packages/Python/lldbsuite/test/lang/cpp/enum_types/Makefile
  lldb/packages/Python/lldbsuite/test/lang/cpp/stl/Makefile
  lldb/packages/Python/lldbsuite/test/lang/cpp/unicode-literals/Makefile
  lldb/packages/Python/lldbsuite/test/lang/cpp/wchar_t/Makefile
  lldb/packages/Python/lldbsuite/test/lang/objc/objc-ivar-stripped/Makefile
  
lldb/packages/Python/lldbsuite/test/lang/objc/objc-static-method-stripped/Makefile
  lldb/packages/Python/lldbsuite/test/linux/add-symbols/Makefile
  lldb/packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/Makefile
  lldb/packages/Python/lldbsuite/test/linux/sepdebugsymlink/Makefile
  lldb/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/Makefile
  lldb/packages/Python/lldbsuite/test/macosx/universal/Makefile
  lldb/packages/Python/lldbsuite/test/python_api/findvalue_duplist/Makefile
  lldb/packages/Python/lldbsuite/test/python_api/formatters/Makefile
  lldb/packages/Python/lldbsuite/test/python_api/sbvalue_persist/Makefile
  lldb/packages/Python/lldbsuite/test/source-manager/Makefile

Index: lldb/packages/Python/lldbsuite/test/source-manager/Makefile
===
--- lldb/packages/Python/lldbsuite/test/source-manager/Makefile
+++ lldb/packages/Python/lldbsuite/test/source-manager/Makefile
@@ -5,7 +5,3 @@
 # Copy file into the build folder to enable the test to modify it.
 main-copy.c: main.c
 	cp -f $< $@
-
-
-clean::
-	$(RM) main-copy.c
Index: lldb/packages/Python/lldbsuite/test/python_api/sbvalue_persist/Makefile
===
--- lldb/packages/Python/lldbsuite/test/python_api/sbvalue_persist/Makefile
+++ lldb/packages/Python/lldbsuite/test/python_api/sbvalue_persist/Makefile
@@ -1,6 +1,3 @@
 CXX_SOURCES := main.cpp
 
-# Clean renamed executable on 'make clean'
-clean: OBJECTS+=no_synth
-
 include Makefile.rules
Index: lldb/packages/Python/lldbsuite/test/python_api/formatters/Makefile
===
--- lldb/packages/Python/lldbsuite/test/python_api/formatters/Makefile
+++ lldb/packages/Python/lldbsuite/test/python_api/formatters/Makefile
@@ -1,7 +1,3 @@
 CXX_SOURCES := main.cpp
 
 include Makefile.rules
-
-# Clean renamed executable on 'make clean'
-clean::
-	$(RM) -f no_synth
Index: lldb/packages/Python/lldbsuite/test/python_api/findvalue_duplist/Makefile
===
--- lldb/packages/Python/lldbsuite/test/python_api/findvalue_duplist/Makefile
+++ lldb/packages/Python/lldbsuite/test/python_api/findvalue_duplist/Makefile
@@ -2,7 +2,3 @@
 
 include Makefile.rules
 
-# Clean renamed executable on 'make clean'
-clean::
-	$(RM) -f no_synth
-
Index: lldb/packages/Python/lldbsuite/test/macosx/universal/Makefile
===
--- lldb/packages/Python/lldbsuite/test/macosx/universal/Makefile
+++ lldb/packages/Python/lldbsuite/test/macosx/universal/Makefile
@@ -18,6 +18,3 @@
 
 testit.x86_64.o: main.c
 	$(CC) -g -O0 -arch x86_64 -c -o testit.x86_64.o $<
-
-clean::
-	rm -rf $(wildcard testit* *~)
Index: lldb/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/Makefile
===
--- lldb/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/Makefile
+++ lldb/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/Makefile
@@ -15,6 +15,3 @@
 	cp -r $(SRCDIR)/TestApp.app .
 	mv TestApp TestApp.app/Contents/MacOS/TestApp
 	mv TestApp.dSYM TestApp.app.dSYM
-
-clean:
-	rm -rf TestApp.app/Contents/MacOS/TestApp TestApp.app.dSYM
Index: lldb/packages/Python/lldbsuite/test/linux/sepdebugsymlink/Makefile
===
--- lldb/packages/Python/lldbsuite/test/linux/sepdebugsymlink/Makefile
+++ 

[Lldb-commits] [PATCH] D74096: [lldb/API] Fix the dangling pointer issue in SBThread::GetStopDescription

2020-02-06 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib abandoned this revision.
mib added a comment.

I'll merge this with D73303 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74096



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


[Lldb-commits] [PATCH] D74126: [lldb] Remove all 'clean' targets from test Makefiles

2020-02-06 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor created this revision.
teemperor added reviewers: labath, JDevlieghere.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

To my knowledge we don't actually use or need these rules. And if we need them 
then
there is probably a better way to implement this than having all these random 
regexes.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D74126

Files:
  lldb/packages/Python/lldbsuite/test/api/multithreaded/Makefile
  lldb/packages/Python/lldbsuite/test/commands/expression/call-function/Makefile
  
lldb/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/synthupdate/Makefile
  lldb/packages/Python/lldbsuite/test/functionalities/fat_archives/Makefile
  lldb/packages/Python/lldbsuite/test/functionalities/memory-region/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/cross_dso/Makefile
  lldb/packages/Python/lldbsuite/test/functionalities/target_var/Makefile
  lldb/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Makefile
  lldb/packages/Python/lldbsuite/test/lang/cpp/char1632_t/Makefile
  lldb/packages/Python/lldbsuite/test/lang/cpp/enum_types/Makefile
  lldb/packages/Python/lldbsuite/test/lang/cpp/stl/Makefile
  lldb/packages/Python/lldbsuite/test/lang/cpp/unicode-literals/Makefile
  lldb/packages/Python/lldbsuite/test/lang/cpp/wchar_t/Makefile
  lldb/packages/Python/lldbsuite/test/lang/objc/objc-ivar-stripped/Makefile
  
lldb/packages/Python/lldbsuite/test/lang/objc/objc-static-method-stripped/Makefile
  lldb/packages/Python/lldbsuite/test/linux/add-symbols/Makefile
  lldb/packages/Python/lldbsuite/test/linux/mix-dwo-and-regular-objects/Makefile
  lldb/packages/Python/lldbsuite/test/linux/sepdebugsymlink/Makefile
  lldb/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/Makefile
  
lldb/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/Makefile
  lldb/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Makefile
  lldb/packages/Python/lldbsuite/test/macosx/universal/Makefile
  lldb/packages/Python/lldbsuite/test/python_api/findvalue_duplist/Makefile
  lldb/packages/Python/lldbsuite/test/python_api/formatters/Makefile
  lldb/packages/Python/lldbsuite/test/python_api/sbvalue_persist/Makefile
  lldb/packages/Python/lldbsuite/test/source-manager/Makefile

Index: lldb/packages/Python/lldbsuite/test/source-manager/Makefile
===
--- lldb/packages/Python/lldbsuite/test/source-manager/Makefile
+++ lldb/packages/Python/lldbsuite/test/source-manager/Makefile
@@ -5,7 +5,3 @@
 # Copy file into the build folder to enable the test to modify it.
 main-copy.c: main.c
 	cp -f $< $@
-
-
-clean::
-	$(RM) main-copy.c
Index: lldb/packages/Python/lldbsuite/test/python_api/sbvalue_persist/Makefile
===
--- lldb/packages/Python/lldbsuite/test/python_api/sbvalue_persist/Makefile
+++ lldb/packages/Python/lldbsuite/test/python_api/sbvalue_persist/Makefile
@@ -1,6 +1,3 @@
 CXX_SOURCES := main.cpp
 
-# Clean renamed executable on 'make clean'
-clean: OBJECTS+=no_synth
-
 include Makefile.rules
Index: lldb/packages/Python/lldbsuite/test/python_api/formatters/Makefile
===
--- lldb/packages/Python/lldbsuite/test/python_api/formatters/Makefile
+++ lldb/packages/Python/lldbsuite/test/python_api/formatters/Makefile
@@ -1,7 +1,3 @@
 CXX_SOURCES := main.cpp
 
 include Makefile.rules
-
-# Clean renamed executable on 'make clean'
-clean::
-	$(RM) -f no_synth
Index: lldb/packages/Python/lldbsuite/test/python_api/findvalue_duplist/Makefile
===
--- lldb/packages/Python/lldbsuite/test/python_api/findvalue_duplist/Makefile
+++ lldb/packages/Python/lldbsuite/test/python_api/findvalue_duplist/Makefile
@@ -2,7 +2,3 @@
 
 include Makefile.rules
 
-# Clean renamed executable on 'make clean'
-clean::
-	$(RM) -f no_synth
-
Index: lldb/packages/Python/lldbsuite/test/macosx/universal/Makefile
===
--- lldb/packages/Python/lldbsuite/test/macosx/universal/Makefile
+++ lldb/packages/Python/lldbsuite/test/macosx/universal/Makefile
@@ -18,6 +18,3 @@
 
 testit.x86_64.o: main.c
 	$(CC) -g -O0 -arch x86_64 -c -o testit.x86_64.o $<
-
-clean::
-	rm -rf $(wildcard testit* *~)
Index: lldb/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Makefile
===
--- lldb/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Makefile
+++ lldb/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Makefile
@@ -23,7 +23,3 @@
 	rm -f MyFramework
 	tar cf - MyFramework.framework 

[Lldb-commits] [lldb] 7603778 - [lldb][NFC] Move call-overidden-method test to lang/cpp/ folder

2020-02-06 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2020-02-06T14:36:09+01:00
New Revision: 7603778922ab1e93ec3d9da451fcd89c3bad9ec2

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

LOG: [lldb][NFC] Move call-overidden-method test to lang/cpp/ folder

Added: 
lldb/packages/Python/lldbsuite/test/lang/cpp/overriden-methods/Makefile

lldb/packages/Python/lldbsuite/test/lang/cpp/overriden-methods/TestCallOverriddenMethod.py
lldb/packages/Python/lldbsuite/test/lang/cpp/overriden-methods/main.cpp

Modified: 


Removed: 

lldb/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/Makefile

lldb/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/TestCallOverriddenMethod.py

lldb/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/main.cpp



diff  --git 
a/lldb/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/Makefile
 b/lldb/packages/Python/lldbsuite/test/lang/cpp/overriden-methods/Makefile
similarity index 100%
rename from 
lldb/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/Makefile
rename to 
lldb/packages/Python/lldbsuite/test/lang/cpp/overriden-methods/Makefile

diff  --git 
a/lldb/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/TestCallOverriddenMethod.py
 
b/lldb/packages/Python/lldbsuite/test/lang/cpp/overriden-methods/TestCallOverriddenMethod.py
similarity index 100%
rename from 
lldb/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/TestCallOverriddenMethod.py
rename to 
lldb/packages/Python/lldbsuite/test/lang/cpp/overriden-methods/TestCallOverriddenMethod.py

diff  --git 
a/lldb/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/main.cpp
 b/lldb/packages/Python/lldbsuite/test/lang/cpp/overriden-methods/main.cpp
similarity index 100%
rename from 
lldb/packages/Python/lldbsuite/test/commands/expression/call-overridden-method/main.cpp
rename to 
lldb/packages/Python/lldbsuite/test/lang/cpp/overriden-methods/main.cpp



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


[Lldb-commits] [lldb] 0ea20eb - [lldb] Add test for calling const functions

2020-02-06 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2020-02-06T14:28:06+01:00
New Revision: 0ea20ebf2d46072c36a0be49fdf4061480a42206

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

LOG: [lldb] Add test for calling const functions

Added: 
lldb/packages/Python/lldbsuite/test/lang/cpp/function-qualifiers/Makefile

lldb/packages/Python/lldbsuite/test/lang/cpp/function-qualifiers/TestCppFunctionQualifiers.py
lldb/packages/Python/lldbsuite/test/lang/cpp/function-qualifiers/main.cpp

Modified: 


Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/lang/cpp/function-qualifiers/Makefile 
b/lldb/packages/Python/lldbsuite/test/lang/cpp/function-qualifiers/Makefile
new file mode 100644
index ..8b20bcb0
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/function-qualifiers/Makefile
@@ -0,0 +1,3 @@
+CXX_SOURCES := main.cpp
+
+include Makefile.rules

diff  --git 
a/lldb/packages/Python/lldbsuite/test/lang/cpp/function-qualifiers/TestCppFunctionQualifiers.py
 
b/lldb/packages/Python/lldbsuite/test/lang/cpp/function-qualifiers/TestCppFunctionQualifiers.py
new file mode 100644
index ..f7653164d1c3
--- /dev/null
+++ 
b/lldb/packages/Python/lldbsuite/test/lang/cpp/function-qualifiers/TestCppFunctionQualifiers.py
@@ -0,0 +1,25 @@
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class TestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def test(self):
+self.build()
+lldbutil.run_to_source_breakpoint(self,"// break here", 
lldb.SBFileSpec("main.cpp"))
+
+# Test calling a function that has const/non-const overload.
+self.expect_expr("c.func()", result_type="int", result_value="111")
+self.expect_expr("const_c.func()", result_type="int", 
result_value="222")
+
+# Call a function that is only const on a const/non-const instance.
+self.expect_expr("c.const_func()", result_type="int", 
result_value="333")
+self.expect_expr("const_c.const_func()", result_type="int", 
result_value="333")
+
+# Call a function that is not const on a const/non-const instance.
+self.expect_expr("c.nonconst_func()", result_type="int", 
result_value="444")
+self.expect("expr const_c.nonconst_func()", error=True,
+substrs=["'this' argument to member function 'nonconst_func' has 
type 'const C', but function is not marked const"])

diff  --git 
a/lldb/packages/Python/lldbsuite/test/lang/cpp/function-qualifiers/main.cpp 
b/lldb/packages/Python/lldbsuite/test/lang/cpp/function-qualifiers/main.cpp
new file mode 100644
index ..4d3fbcfc3937
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/function-qualifiers/main.cpp
@@ -0,0 +1,17 @@
+struct C {
+  int func() { return 111; }
+  int func() const { return 222; }
+
+  int const_func() const { return 333; }
+  int nonconst_func() { return 444; }
+};
+
+int main() {
+  C c;
+  const C const_c;
+  c.func();
+  c.nonconst_func();
+  const_c.func();
+  c.const_func();
+  return 0; // break here
+}



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


[Lldb-commits] [PATCH] D73969: [LLDB] Let DataExtractor deal with two-byte addresses

2020-02-06 Thread Ayke via Phabricator via lldb-commits
aykevl added a comment.

>> Right now there are asserts both when constructing/copying(?) the object (5 
>> asserts) and at the place where `m_addr_size` is used (3 asserts). I would 
>> propose picking one place, such as where it is used. That would reduce the 
>> number of asserts to 3 and keep them close together. What do you think?
> 
> I agree only one of those two places should be enough. My idea was to make 
> the constructors delegate to one another (if necessary by creating a private 
> uber-constructor that everybody can delegate to). Then we could have only one 
> assert.

Should I do that in the same patch, or in a different one? Before or after this 
patch? It seems like doing the constructor merging in this patch would make it 
more complicated than necessary.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73969



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


[Lldb-commits] [PATCH] D74084: [LLDB] Fix compilation with GCC 5

2020-02-06 Thread Hans Wennborg via Phabricator via lldb-commits
hans added a comment.

In D74084#1861269 , @mstorsjo wrote:

> @hans - this could be applied on 10.x (it seems to apply cleanly), to fix 
> PR44791.


Thanks! Cherry-picked as 22633f85bb7d317ff97c86b6ae7817b678777d93 
.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74084



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


[Lldb-commits] [PATCH] D74084: [LLDB] Fix compilation with GCC 5

2020-02-06 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo added a subscriber: hans.
mstorsjo added a comment.

@hans - this could be applied on 10.x (it seems to apply cleanly), to fix 
PR44791.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74084



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


[Lldb-commits] [PATCH] D74084: [LLDB] Fix compilation with GCC 5

2020-02-06 Thread Martin Storsjö via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5bbaf543585c: [LLDB] Fix compilation with GCC 5 (authored by 
mstorsjo).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74084

Files:
  lldb/source/DataFormatters/FormatCache.cpp
  lldb/source/DataFormatters/LanguageCategory.cpp
  lldb/source/Interpreter/CommandAlias.cpp
  lldb/source/Interpreter/Options.cpp


Index: lldb/source/Interpreter/Options.cpp
===
--- lldb/source/Interpreter/Options.cpp
+++ lldb/source/Interpreter/Options.cpp
@@ -1061,8 +1061,8 @@
 }
 if (!option_arg)
   option_arg = "";
-option_arg_vector->emplace_back(option_str.GetString(), has_arg,
-option_arg);
+option_arg_vector->emplace_back(std::string(option_str.GetString()),
+has_arg, std::string(option_arg));
 
 // Find option in the argument list; also see if it was supposed to take an
 // argument and if one was supplied.  Remove option (and argument, if
Index: lldb/source/Interpreter/CommandAlias.cpp
===
--- lldb/source/Interpreter/CommandAlias.cpp
+++ lldb/source/Interpreter/CommandAlias.cpp
@@ -65,7 +65,8 @@
 else {
   for (auto  : args.entries()) {
 if (!entry.ref().empty())
-  option_arg_vector->emplace_back("", -1, entry.ref());
+  option_arg_vector->emplace_back(std::string(""), -1,
+  std::string(entry.ref()));
   }
 }
   }
Index: lldb/source/DataFormatters/LanguageCategory.cpp
===
--- lldb/source/DataFormatters/LanguageCategory.cpp
+++ lldb/source/DataFormatters/LanguageCategory.cpp
@@ -54,6 +54,8 @@
   return result;
 }
 
+namespace lldb_private {
+
 /// Explicit instantiations for the three types.
 /// \{
 template bool
@@ -82,6 +84,8 @@
   return m_hardcoded_synthetics;
 }
 
+} // namespace lldb_private
+
 template 
 bool LanguageCategory::GetHardcoded(FormatManager _mgr,
 FormattersMatchData _data,
Index: lldb/source/DataFormatters/FormatCache.cpp
===
--- lldb/source/DataFormatters/FormatCache.cpp
+++ lldb/source/DataFormatters/FormatCache.cpp
@@ -68,6 +68,8 @@
   return m_map[type];
 }
 
+namespace lldb_private {
+
 template<> bool FormatCache::Entry::IsCached() {
   return IsFormatCached();
 }
@@ -78,6 +80,8 @@
   return IsSyntheticCached();
 }
 
+} // namespace lldb_private
+
 template 
 bool FormatCache::Get(ConstString type, ImplSP _impl_sp) {
   std::lock_guard guard(m_mutex);


Index: lldb/source/Interpreter/Options.cpp
===
--- lldb/source/Interpreter/Options.cpp
+++ lldb/source/Interpreter/Options.cpp
@@ -1061,8 +1061,8 @@
 }
 if (!option_arg)
   option_arg = "";
-option_arg_vector->emplace_back(option_str.GetString(), has_arg,
-option_arg);
+option_arg_vector->emplace_back(std::string(option_str.GetString()),
+has_arg, std::string(option_arg));
 
 // Find option in the argument list; also see if it was supposed to take an
 // argument and if one was supplied.  Remove option (and argument, if
Index: lldb/source/Interpreter/CommandAlias.cpp
===
--- lldb/source/Interpreter/CommandAlias.cpp
+++ lldb/source/Interpreter/CommandAlias.cpp
@@ -65,7 +65,8 @@
 else {
   for (auto  : args.entries()) {
 if (!entry.ref().empty())
-  option_arg_vector->emplace_back("", -1, entry.ref());
+  option_arg_vector->emplace_back(std::string(""), -1,
+  std::string(entry.ref()));
   }
 }
   }
Index: lldb/source/DataFormatters/LanguageCategory.cpp
===
--- lldb/source/DataFormatters/LanguageCategory.cpp
+++ lldb/source/DataFormatters/LanguageCategory.cpp
@@ -54,6 +54,8 @@
   return result;
 }
 
+namespace lldb_private {
+
 /// Explicit instantiations for the three types.
 /// \{
 template bool
@@ -82,6 +84,8 @@
   return m_hardcoded_synthetics;
 }
 
+} // namespace lldb_private
+
 template 
 bool LanguageCategory::GetHardcoded(FormatManager _mgr,
 FormattersMatchData _data,
Index: lldb/source/DataFormatters/FormatCache.cpp
===
--- lldb/source/DataFormatters/FormatCache.cpp
+++ lldb/source/DataFormatters/FormatCache.cpp
@@ -68,6 +68,8 @@
   return m_map[type];
 }
 
+namespace lldb_private {
+
 template<> bool