[Lldb-commits] [lldb] 642bc15 - [lldb][NFC] Remove several inefficient ConstString -> const char * -> StringRef conversions

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

Author: Raphael Isemann
Date: 2020-02-11T09:14:41+01:00
New Revision: 642bc15dd7186a6317510cf961a8dc3d35e5b713

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

LOG: [lldb][NFC] Remove several inefficient ConstString -> const char * -> 
StringRef conversions

StringRef will call strlen on the C string which is inefficient (as ConstString 
already
knows the string lenght and so does StringRef). This patch replaces all those 
calls
with GetStringRef() which doesn't recompute the length.

Added: 


Modified: 
lldb/include/lldb/DataFormatters/FormattersContainer.h
lldb/include/lldb/Expression/IRExecutionUnit.h
lldb/source/Breakpoint/BreakpointResolverName.cpp
lldb/source/Core/Debugger.cpp
lldb/source/Core/DynamicLoader.cpp
lldb/source/Core/FormatEntity.cpp
lldb/source/Core/Mangled.cpp
lldb/source/Core/ModuleList.cpp
lldb/source/Core/ValueObject.cpp
lldb/source/Core/ValueObjectRegister.cpp
lldb/source/Expression/IRExecutionUnit.cpp
lldb/source/Expression/REPL.cpp
lldb/source/Expression/UserExpression.cpp
lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
lldb/source/Target/UnixSignals.cpp
lldb/source/Utility/Broadcaster.cpp
lldb/source/Utility/ConstString.cpp
lldb/source/Utility/StructuredData.cpp
lldb/tools/lldb-server/lldb-platform.cpp

Removed: 




diff  --git a/lldb/include/lldb/DataFormatters/FormattersContainer.h 
b/lldb/include/lldb/DataFormatters/FormattersContainer.h
index 86023dd9bf0b..88d4afe7d72c 100644
--- a/lldb/include/lldb/DataFormatters/FormattersContainer.h
+++ b/lldb/include/lldb/DataFormatters/FormattersContainer.h
@@ -266,7 +266,7 @@ template  class 
FormattersContainer {
 ConstString key = m_format_map.GetKeyAtIndex(index);
 if (key)
   return lldb::TypeNameSpecifierImplSP(
-  new TypeNameSpecifierImpl(key.AsCString(), false));
+  new TypeNameSpecifierImpl(key.GetStringRef(), false));
 else
   return lldb::TypeNameSpecifierImplSP();
   }

diff  --git a/lldb/include/lldb/Expression/IRExecutionUnit.h 
b/lldb/include/lldb/Expression/IRExecutionUnit.h
index 05f2f8471ef8..9ce4adfda04a 100644
--- a/lldb/include/lldb/Expression/IRExecutionUnit.h
+++ b/lldb/include/lldb/Expression/IRExecutionUnit.h
@@ -71,7 +71,7 @@ class IRExecutionUnit : public 
std::enable_shared_from_this,
   llvm::Module *GetModule() { return m_module; }
 
   llvm::Function *GetFunction() {
-return ((m_module != nullptr) ? m_module->getFunction(m_name.AsCString())
+return ((m_module != nullptr) ? 
m_module->getFunction(m_name.GetStringRef())
   : nullptr);
   }
 

diff  --git a/lldb/source/Breakpoint/BreakpointResolverName.cpp 
b/lldb/source/Breakpoint/BreakpointResolverName.cpp
index 3e5a22ac1fc5..fdf70f1d74aa 100644
--- a/lldb/source/Breakpoint/BreakpointResolverName.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolverName.cpp
@@ -199,7 +199,7 @@ StructuredData::ObjectSP 
BreakpointResolverName::SerializeToStructuredData() {
 StructuredData::ArraySP name_masks_sp(new StructuredData::Array());
 for (auto lookup : m_lookups) {
   names_sp->AddItem(StructuredData::StringSP(
-  new StructuredData::String(lookup.GetName().AsCString(;
+  new StructuredData::String(lookup.GetName().GetStringRef(;
   name_masks_sp->AddItem(StructuredData::IntegerSP(
   new StructuredData::Integer(lookup.GetNameTypeMask(;
 }

diff  --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 6e883d150e12..4f988d3a2941 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -1529,9 +1529,9 @@ bool Debugger::StartEventHandlerThread() {
 listener_sp->StartListeningForEvents(&m_sync_broadcaster,
  eBroadcastBitEventThreadIsListening);
 
-auto thread_name =
+llvm::StringRef thread_name =
 full_name.GetLength() < llvm::get_max_thread_name_length()
-? full_name.AsCString()
+? full_name.GetStringRef()
 : "dbg.evt-handler";
 
 // Use larger 8MB stack for this thread

diff  --git a/lldb/source/Core/DynamicLoader.cpp 
b/lldb/source/Core/DynamicLoader.cpp
index 449ea5c7ddca..ceccbe437e1d 100644
--- a/lldb/source/Core/DynamicLoader.cpp
+++ b/lldb/source/Core/DynamicLoader.cpp
@@ -193,7 +193,7 @@ ModuleSP DynamicLoader::LoadModuleAtAddress(const FileSpec 
&file,
 if (error.Success() && memory_info.GetMapped() &&
 memory_info.GetRange().G

[Lldb-commits] [PATCH] D74252: Fix+re-enable Assert StackFrame Recognizer on Linux

2020-02-11 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added inline comments.



Comment at: lldb/source/Target/AssertFrameRecognizer.cpp:152
+ConstString func_name = sym_ctx.GetFunctionName();
+if (func_name == ConstString(function_name) ||
+alternate_function_name.empty() ||

JDevlieghere wrote:
> I believe someone added an overload for comparing ConstStrings with 
> StringRefs. We shouldn't have to pay the price of creating one here just for 
> comparison. Same below.
I really don't want a == overload for StringRef in `ConstString`. The *only* 
reason for using ConstString is using less memory for duplicate strings and 
being fast to compare against other ConstStrings. So if we add an overload for 
comparing against StringRef then code like this will look really innocent even 
though it essentially goes against the idea of ConstString. Either both string 
lists are using ConstString or neither does (which I would prefer). But having 
a list of normal strings and comparing it against ConstStrings usually means 
that the design is kinda flawed. Then we have both normal string comparisons 
but also the whole overhead of ConstString.

Looking at this patch we already construct at one point a ConstString from the 
function name at one point, so that might as well be a ConstString in the first 
place. If we had an implicit comparison than the conversion here would look 
really innocent and no one would notice.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74252



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


[Lldb-commits] [PATCH] D74388: [lldb/test] Add alternate symbol to StackFrame Recognizer

2020-02-11 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib created this revision.
mib added reviewers: jankratochvil, teemperor.
mib added a project: LLDB.
Herald added a subscriber: lldb-commits.
mib added a comment.

Hi @jankratochvil,

Could you let me know if this works on your end ?

Thanks!


This patch reverts commit 6b2979c12300b90a1e69791d43ee9cff14f4265e 
 and 
updates it  to reflect the addition of the alternate symbol attribute to 
StackFrame Recognizer.

This should fix the test failures it caused on macOS, and continue working on 
Linux.

It also addresses D74252  feedbacks.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74388

Files:
  lldb/include/lldb/Target/StackFrameRecognizer.h
  lldb/source/Commands/CommandObjectFrame.cpp
  
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
  lldb/source/Target/AssertFrameRecognizer.cpp
  lldb/source/Target/StackFrameRecognizer.cpp
  lldb/test/Shell/Recognizer/assert.test
  lldb/unittests/Target/StackFrameRecognizerTest.cpp

Index: lldb/unittests/Target/StackFrameRecognizerTest.cpp
===
--- lldb/unittests/Target/StackFrameRecognizerTest.cpp
+++ lldb/unittests/Target/StackFrameRecognizerTest.cpp
@@ -77,6 +77,7 @@
   StackFrameRecognizerManager::ForEach(
   [&any_printed](uint32_t recognizer_id, std::string name,
  std::string function, std::string symbol,
+ std::string alternate_symbol,
  bool regexp) { any_printed = true; });
 
   EXPECT_TRUE(any_printed);
Index: lldb/test/Shell/Recognizer/assert.test
===
--- lldb/test/Shell/Recognizer/assert.test
+++ lldb/test/Shell/Recognizer/assert.test
@@ -1,4 +1,4 @@
-# UNSUPPORTED: system-windows, system-linux
+# 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
Index: lldb/source/Target/StackFrameRecognizer.cpp
===
--- lldb/source/Target/StackFrameRecognizer.cpp
+++ lldb/source/Target/StackFrameRecognizer.cpp
@@ -50,24 +50,28 @@
 
 class StackFrameRecognizerManagerImpl {
 public:
-  void AddRecognizer(StackFrameRecognizerSP recognizer,
- ConstString module, ConstString symbol,
+  void AddRecognizer(StackFrameRecognizerSP recognizer, ConstString module,
+ ConstString symbol, ConstString alternate_symbol,
  bool first_instruction_only) {
-m_recognizers.push_front({(uint32_t)m_recognizers.size(), false, recognizer, false, module, RegularExpressionSP(),
-  symbol, RegularExpressionSP(),
+m_recognizers.push_front({(uint32_t)m_recognizers.size(), false, recognizer,
+  false, module, RegularExpressionSP(), symbol,
+  alternate_symbol, RegularExpressionSP(),
   first_instruction_only});
   }
 
   void AddRecognizer(StackFrameRecognizerSP recognizer,
  RegularExpressionSP module, RegularExpressionSP symbol,
  bool first_instruction_only) {
-m_recognizers.push_front({(uint32_t)m_recognizers.size(), false, recognizer, true, ConstString(), module,
+m_recognizers.push_front({(uint32_t)m_recognizers.size(), false, recognizer,
+  true, ConstString(), module, ConstString(),
   ConstString(), symbol, first_instruction_only});
   }
 
   void ForEach(
-  std::function const &callback) {
+  std::function const
+  &callback) {
 for (auto entry : m_recognizers) {
   if (entry.is_regexp) {
 std::string module_name;
@@ -79,11 +83,16 @@
   symbol_name = entry.symbol_regexp->GetText().str();
 
 callback(entry.recognizer_id, entry.recognizer->GetName(), module_name,
- symbol_name, true);
+ symbol_name, {}, true);
 
   } else {
-callback(entry.recognizer_id, entry.recognizer->GetName(), entry.module.GetCString(),
- entry.symbol.GetCString(), false);
+std::string alternate_symbol;
+if (!entry.alternate_symbol.IsEmpty())
+  alternate_symbol.append(entry.alternate_symbol.GetCString());
+
+callback(entry.recognizer_id, entry.recognizer->GetName(),
+ entry.module.GetCString(), entry.symbol.GetCString(),
+ alternate_symbol, false);
   }
 }
   }
@@ -120,7 +129,10 @@
 if (!entry.module_regexp->Execute(module_name.GetStringRef())) continue;
 
   if (entry.symbol)
-if (entry.symbol != function_name) continue;
+if (entry.symbol != function_name &&
+(!entry.alternate_symbol ||
+ entry.alternate_symbol != function_nam

[Lldb-commits] [PATCH] D74388: [lldb/test] Add alternate symbol to StackFrame Recognizer

2020-02-11 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib added a comment.

Hi @jankratochvil,

Could you let me know if this works on your end ?

Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74388



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


[Lldb-commits] [lldb] 70fb447 - [lldb] Add test for C++ constructor calls from the expression evaluator

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

Author: Raphael Isemann
Date: 2020-02-11T10:47:42+01:00
New Revision: 70fb447ca012728dbfa49a82136554630e188229

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

LOG: [lldb] Add test for C++ constructor calls from the expression evaluator

Added: 
lldb/packages/Python/lldbsuite/test/lang/cpp/constructors/Makefile

lldb/packages/Python/lldbsuite/test/lang/cpp/constructors/TestCppConstructors.py
lldb/packages/Python/lldbsuite/test/lang/cpp/constructors/main.cpp

Modified: 


Removed: 




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

diff  --git 
a/lldb/packages/Python/lldbsuite/test/lang/cpp/constructors/TestCppConstructors.py
 
b/lldb/packages/Python/lldbsuite/test/lang/cpp/constructors/TestCppConstructors.py
new file mode 100644
index ..422854e38de1
--- /dev/null
+++ 
b/lldb/packages/Python/lldbsuite/test/lang/cpp/constructors/TestCppConstructors.py
@@ -0,0 +1,26 @@
+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_constructors(self):
+self.build()
+lldbutil.run_to_source_breakpoint(self,"// break here", 
lldb.SBFileSpec("main.cpp"))
+self.expect_expr("ClassWithImplicitCtor().foo()", result_type="int", 
result_value="1")
+self.expect_expr("ClassWithMultipleCtor(3).value", result_type="int", 
result_value="3")
+self.expect_expr("ClassWithMultipleCtor(3, 1).value", 
result_type="int", result_value="4")
+
+self.expect_expr("ClassWithDeletedCtor().value", result_type="int", 
result_value="6")
+self.expect_expr("ClassWithDeletedDefaultCtor(7).value", 
result_type="int", result_value="7")
+
+# FIXME: It seems we try to call the non-existent default constructor 
here which is wrong.
+self.expect("expr ClassWithDefaultedCtor().foo()", error=True, 
substrs="Couldn't lookup symbols:")
+
+# FIXME: Calling deleted constructors should fail before linking.
+self.expect("expr ClassWithDeletedCtor(1).value", error=True, 
substrs=["Couldn't lookup symbols:"])
+self.expect("expr ClassWithDeletedDefaultCtor().value", error=True, 
substrs=["Couldn't lookup symbols:"])
+

diff  --git 
a/lldb/packages/Python/lldbsuite/test/lang/cpp/constructors/main.cpp 
b/lldb/packages/Python/lldbsuite/test/lang/cpp/constructors/main.cpp
new file mode 100644
index ..4e69b58abb00
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/constructors/main.cpp
@@ -0,0 +1,45 @@
+struct ClassWithImplicitCtor {
+  int foo() { return 1; }
+};
+
+struct ClassWithDefaultedCtor {
+  ClassWithDefaultedCtor() = default;
+  int foo() { return 2; }
+};
+
+struct ClassWithOneCtor {
+  int value;
+  ClassWithOneCtor(int i) { value = i; }
+};
+
+struct ClassWithMultipleCtor {
+  int value;
+  ClassWithMultipleCtor(int i) { value = i; }
+  ClassWithMultipleCtor(int i, int v) { value = v + i; }
+};
+
+struct ClassWithDeletedCtor {
+  int value;
+  ClassWithDeletedCtor() { value = 6; }
+  ClassWithDeletedCtor(int i) = delete;
+};
+
+struct ClassWithDeletedDefaultCtor {
+  int value;
+  ClassWithDeletedDefaultCtor() = delete;
+  ClassWithDeletedDefaultCtor(int i) { value = i; }
+};
+
+int main() {
+  ClassWithImplicitCtor C1;
+  C1.foo();
+  ClassWithDefaultedCtor C2;
+  C2.foo();
+  ClassWithOneCtor C3(22);
+  ClassWithMultipleCtor C4(23);
+  ClassWithMultipleCtor C5(24, 25);
+  ClassWithDeletedCtor C6;
+  ClassWithDeletedDefaultCtor C7(26);
+
+  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] [lldb] 5b61f78 - [lldb] Add test for lldb_private::Stream's indentation functionality

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

Author: Raphael Isemann
Date: 2020-02-11T11:12:54+01:00
New Revision: 5b61f78ad5e0f96b0c21ad9a634fc1b26601a00a

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

LOG: [lldb] Add test for lldb_private::Stream's indentation functionality

Added: 


Modified: 
lldb/unittests/Utility/StreamTest.cpp

Removed: 




diff  --git a/lldb/unittests/Utility/StreamTest.cpp 
b/lldb/unittests/Utility/StreamTest.cpp
index d963ecb5d2ff..e5cc2fd3ed49 100644
--- a/lldb/unittests/Utility/StreamTest.cpp
+++ b/lldb/unittests/Utility/StreamTest.cpp
@@ -129,6 +129,38 @@ TEST_F(StreamTest, ChangingByteOrder) {
   EXPECT_EQ(lldb::eByteOrderPDP, s.GetByteOrder());
 }
 
+TEST_F(StreamTest, SetIndentLevel) {
+  s.Indent("a");
+  EXPECT_EQ("a", TakeValue());
+
+  s.SetIndentLevel(3);
+  s.Indent("a");
+  EXPECT_EQ("   a", TakeValue());
+
+  s.SetIndentLevel(2);
+  s.Indent("a");
+  EXPECT_EQ("  a", TakeValue());
+
+  s.SetIndentLevel(0);
+  s.Indent("a");
+  EXPECT_EQ("a", TakeValue());
+}
+
+TEST_F(StreamTest, Indent) {
+  s.SetIndentLevel(2);
+  s.Indent(nullptr);
+  EXPECT_EQ("  ", TakeValue());
+
+  s.Indent("");
+  EXPECT_EQ("  ", TakeValue());
+
+  s.Indent(" ");
+  EXPECT_EQ("   ", TakeValue());
+
+  s.Indent(" aa");
+  EXPECT_EQ("   aa", TakeValue());
+}
+
 TEST_F(StreamTest, PutChar) {
   s.PutChar('a');
   EXPECT_EQ(1U, s.GetWrittenBytes());



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


[Lldb-commits] [PATCH] D74388: [lldb/test] Add alternate symbol to StackFrame Recognizer

2020-02-11 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil accepted this revision.
jankratochvil added a comment.
This revision is now accepted and ready to land.

> This patch reverts commit 6b2979c12300b90a1e69791d43ee9cff14f4265e 
> 

The patch is already reverted, this patch reimplements it.

In D74388#1868935 , @mib wrote:

> Could you let me know if this works on your end ?


Yes, it works on Fedora 31 x86_64.




Comment at: lldb/source/Target/AssertFrameRecognizer.cpp:144
+(!location.alternate_symbol_name.IsEmpty() &&
+ func_name == location.alternate_symbol_name)) {
 

I see I made a mistake here, thanks for fixing it. That was probably the OSX 
regression.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74388



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


[Lldb-commits] [PATCH] D74217: Add target.xml support for qXfer request.

2020-02-11 Thread Levon Ter-Grigoryan via Phabricator via lldb-commits
PatriosTheGreat updated this revision to Diff 243579.

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

https://reviews.llvm.org/D74217

Files:
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/Makefile
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/main.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp

Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -377,6 +377,87 @@
   }
 }
 
+static std::string GetEncodingNameOrEmpty(const RegisterInfo *reg_info) {
+  switch (reg_info->encoding) {
+  case eEncodingUint:
+return "uint";
+  case eEncodingSint:
+return "sint";
+  case eEncodingIEEE754:
+return "ieee754";
+  case eEncodingVector:
+return "vector";
+  default:
+return "";
+  }
+}
+
+static std::string GetFormatNameOrEmpty(const RegisterInfo *reg_info) {
+  switch (reg_info->format) {
+  case eFormatBinary:
+return "binary";
+  case eFormatDecimal:
+return "decimal";
+  case eFormatHex:
+return "hex";
+  case eFormatFloat:
+return "float";
+  case eFormatVectorOfSInt8:
+return "vector-sint8";
+  case eFormatVectorOfUInt8:
+return "vector-uint8";
+  case eFormatVectorOfSInt16:
+return "vector-sint16";
+  case eFormatVectorOfUInt16:
+return "vector-uint16";
+  case eFormatVectorOfSInt32:
+return "vector-sint32";
+  case eFormatVectorOfUInt32:
+return "vector-uint32";
+  case eFormatVectorOfFloat32:
+return "vector-float32";
+  case eFormatVectorOfUInt64:
+return "vector-uint64";
+  case eFormatVectorOfUInt128:
+return "vector-uint128";
+  default:
+return "";
+  };
+}
+
+static std::string GetKindGenericOrEmpty(const RegisterInfo *reg_info) {
+  switch (reg_info->kinds[RegisterKind::eRegisterKindGeneric]) {
+  case LLDB_REGNUM_GENERIC_PC:
+return "pc";
+  case LLDB_REGNUM_GENERIC_SP:
+return "sp";
+  case LLDB_REGNUM_GENERIC_FP:
+return "fp";
+  case LLDB_REGNUM_GENERIC_RA:
+return "ra";
+  case LLDB_REGNUM_GENERIC_FLAGS:
+return "flags";
+  case LLDB_REGNUM_GENERIC_ARG1:
+return "arg1";
+  case LLDB_REGNUM_GENERIC_ARG2:
+return "arg2";
+  case LLDB_REGNUM_GENERIC_ARG3:
+return "arg3";
+  case LLDB_REGNUM_GENERIC_ARG4:
+return "arg4";
+  case LLDB_REGNUM_GENERIC_ARG5:
+return "arg5";
+  case LLDB_REGNUM_GENERIC_ARG6:
+return "arg6";
+  case LLDB_REGNUM_GENERIC_ARG7:
+return "arg7";
+  case LLDB_REGNUM_GENERIC_ARG8:
+return "arg8";
+  default:
+return "";
+  }
+}
+
 static void WriteRegisterValueInHexFixedWidth(
 StreamString &response, NativeRegisterContext ®_ctx,
 const RegisterInfo ®_info, const RegisterValue *reg_value_p,
@@ -1699,66 +1780,19 @@
   response.Printf("bitsize:%" PRIu32 ";offset:%" PRIu32 ";",
   reg_info->byte_size * 8, reg_info->byte_offset);
 
-  switch (reg_info->encoding) {
-  case eEncodingUint:
-response.PutCString("encoding:uint;");
-break;
-  case eEncodingSint:
-response.PutCString("encoding:sint;");
-break;
-  case eEncodingIEEE754:
-response.PutCString("encoding:ieee754;");
-break;
-  case eEncodingVector:
-response.PutCString("encoding:vector;");
-break;
-  default:
-break;
+  std::string encoding = GetEncodingNameOrEmpty(reg_info);
+  if (!encoding.empty()) {
+response.PutCString("encoding:");
+response.PutCString(encoding.c_str());
+response.PutChar(';');
   }
 
-  switch (reg_info->format) {
-  case eFormatBinary:
-response.PutCString("format:binary;");
-break;
-  case eFormatDecimal:
-response.PutCString("format:decimal;");
-break;
-  case eFormatHex:
-response.PutCString("format:hex;");
-break;
-  case eFormatFloat:
-response.PutCString("format:float;");
-break;
-  case eFormatVectorOfSInt8:
-response.PutCString("format:vector-sint8;");
-break;
-  case eFormatVectorOfUInt8:
-response.PutCString("format:vector-uint8;");
-break;
-  case eFormatVectorOfSInt16:
-response.PutCString("format:vector-sint16;");
-break;
-  case eFormatVectorOfUInt16:
-response.PutCString("format:vector-uint16;");
-break;
-  case eFormatVectorOfSInt32:
-response.PutCString("format:vector-sint32;");
-break;
-  case eFormatVectorOfUInt32:
-response.PutCString("format:vector-uint32;");
-break;
-  case eFormatVectorOfFloat32:
-response.PutCString("format:vector-float32;");
-break;
-  case eFormatVectorOfUInt64:
-response.PutCString("format:

[Lldb-commits] [lldb] 6909c2e - [lldb] Add test for calling overloaded virtual functions

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

Author: Raphael Isemann
Date: 2020-02-11T11:36:26+01:00
New Revision: 6909c2e88d0b60e608237f55149bc09d74be47c5

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

LOG: [lldb] Add test for calling overloaded virtual functions

Added: 


Modified: 

lldb/packages/Python/lldbsuite/test/lang/cpp/virtual-functions/TestCppVirtualFunctions.py
lldb/packages/Python/lldbsuite/test/lang/cpp/virtual-functions/main.cpp

Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/lang/cpp/virtual-functions/TestCppVirtualFunctions.py
 
b/lldb/packages/Python/lldbsuite/test/lang/cpp/virtual-functions/TestCppVirtualFunctions.py
index d81435421f82..32c4d3513974 100644
--- 
a/lldb/packages/Python/lldbsuite/test/lang/cpp/virtual-functions/TestCppVirtualFunctions.py
+++ 
b/lldb/packages/Python/lldbsuite/test/lang/cpp/virtual-functions/TestCppVirtualFunctions.py
@@ -29,3 +29,11 @@ def test_call_on_derived_as_base(self):
 self.expect_expr("derived_without_as_base.foo()", result_type="int", 
result_value="4")
 self.expect_expr("derived_with_base_dtor_as_base.foo()", 
result_type="int", result_value="5")
 self.expect_expr("derived_with_dtor_but_no_base_dtor_as_base.foo()", 
result_type="int", result_value="6")
+
+def test_call_overloaded(self):
+self.common_setup()
+self.expect("expr derived_with_overload.foo()", error=True, 
substrs=["too few arguments to function call, expected 1, have 0"])
+self.expect_expr("derived_with_overload.foo(1)", result_type="int", 
result_value="7")
+self.expect_expr("derived_with_overload_and_using.foo(1)", 
result_type="int", result_value="8")
+# FIXME: It seems the using declaration doesn't import the overload 
from the base class.
+self.expect("expr derived_with_overload_and_using.foo()", error=True, 
substrs=["too few arguments to function call, expected 1, have 0"])

diff  --git 
a/lldb/packages/Python/lldbsuite/test/lang/cpp/virtual-functions/main.cpp 
b/lldb/packages/Python/lldbsuite/test/lang/cpp/virtual-functions/main.cpp
index 3689828b2bb9..6f6c9e6b41c4 100644
--- a/lldb/packages/Python/lldbsuite/test/lang/cpp/virtual-functions/main.cpp
+++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/virtual-functions/main.cpp
@@ -29,6 +29,17 @@ struct DerivedWithVirtDtorButNoBaseDtor : 
BaseWithoutVirtDtor {
   virtual int foo() { return 6; }
 };
 
+struct DerivedWithOverload : BaseWithVirtDtor {
+  virtual ~DerivedWithOverload() {}
+  virtual int foo(int i) { return 7; }
+};
+
+struct DerivedWithOverloadAndUsing : BaseWithVirtDtor {
+  virtual ~DerivedWithOverloadAndUsing() {}
+  using BaseWithVirtDtor::foo;
+  virtual int foo(int i) { return 8; }
+};
+
 int main() {
   // Declare base classes.
   BaseWithVirtDtor base_with_dtor;
@@ -39,6 +50,8 @@ int main() {
   DerivedWithoutVirtDtor derived_without_dtor;
   DerivedWithBaseVirtDtor derived_with_base_dtor;
   DerivedWithVirtDtorButNoBaseDtor derived_with_dtor_but_no_base_dtor;
+  DerivedWithOverload derived_with_overload;
+  DerivedWithOverloadAndUsing derived_with_overload_and_using;
 
   // The previous classes as their base class type.
   BaseWithVirtDtor &derived_with_dtor_as_base = derived_with_dtor;
@@ -49,7 +62,9 @@ int main() {
   // Call functions so that they are compiled.
   int i = base_with_dtor.foo() + base_without_dtor.foo() +
   derived_with_dtor.foo() + derived_without_dtor.foo() +
-  derived_with_base_dtor.foo();
+  derived_with_base_dtor.foo() + derived_with_overload.foo(1)
+  + derived_with_overload_and_using.foo(2)
+  + derived_with_overload_and_using.foo();
 
   return i; // break here
 }



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


[Lldb-commits] [lldb] cb0c4ee - [lldb/test] Add alternate symbol to StackFrame Recognizer

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

Author: Med Ismail Bennani
Date: 2020-02-11T11:44:37+01:00
New Revision: cb0c4ee3ebfe55809c9d0be72726b05668028fc4

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

LOG: [lldb/test] Add alternate symbol to StackFrame Recognizer

This reimplements commit 6b2979c12300b90a1e69791d43ee9cff14f4265e and updates
the tests to reflect the addition of the alternate symbol attribute.

Signed-off-by: Med Ismail Bennani 

Added: 


Modified: 
lldb/include/lldb/Target/StackFrameRecognizer.h
lldb/source/Commands/CommandObjectFrame.cpp

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
lldb/source/Target/AssertFrameRecognizer.cpp
lldb/source/Target/StackFrameRecognizer.cpp
lldb/test/Shell/Recognizer/assert.test
lldb/unittests/Target/StackFrameRecognizerTest.cpp

Removed: 




diff  --git a/lldb/include/lldb/Target/StackFrameRecognizer.h 
b/lldb/include/lldb/Target/StackFrameRecognizer.h
index b509e0760b31..92cfca4227cf 100644
--- a/lldb/include/lldb/Target/StackFrameRecognizer.h
+++ b/lldb/include/lldb/Target/StackFrameRecognizer.h
@@ -101,8 +101,8 @@ class ScriptedStackFrameRecognizer : public 
StackFrameRecognizer {
 class StackFrameRecognizerManager {
 public:
   static void AddRecognizer(lldb::StackFrameRecognizerSP recognizer,
-ConstString module,
-ConstString symbol,
+ConstString module, ConstString symbol,
+ConstString alternate_symbol,
 bool first_instruction_only = true);
 
   static void AddRecognizer(lldb::StackFrameRecognizerSP recognizer,
@@ -113,7 +113,8 @@ class StackFrameRecognizerManager {
   static void ForEach(
   std::function const &callback);
+ std::string alternate_symbol, bool regexp)> const
+  &callback);
 
   static bool RemoveRecognizerWithID(uint32_t recognizer_id);
 

diff  --git a/lldb/source/Commands/CommandObjectFrame.cpp 
b/lldb/source/Commands/CommandObjectFrame.cpp
index d86b50bd7aad..baf64e5c884d 100644
--- a/lldb/source/Commands/CommandObjectFrame.cpp
+++ b/lldb/source/Commands/CommandObjectFrame.cpp
@@ -881,7 +881,7 @@ bool CommandObjectFrameRecognizerAdd::DoExecute(Args 
&command,
   } else {
 auto module = ConstString(m_options.m_module);
 auto func = ConstString(m_options.m_function);
-StackFrameRecognizerManager::AddRecognizer(recognizer_sp, module, func);
+StackFrameRecognizerManager::AddRecognizer(recognizer_sp, module, func, 
{});
   }
 #endif
 
@@ -959,13 +959,26 @@ class CommandObjectFrameRecognizerList : public 
CommandObjectParsed {
 bool any_printed = false;
 StackFrameRecognizerManager::ForEach(
 [&result, &any_printed](uint32_t recognizer_id, std::string name,
-std::string function, std::string symbol,
-bool regexp) {
-  if (name == "")
+std::string module, std::string symbol,
+std::string alternate_symbol, bool regexp) {
+  Stream &stream = result.GetOutputStream();
+
+  if (name.empty())
 name = "(internal)";
-  result.GetOutputStream().Printf(
-  "%d: %s, module %s, function %s%s\n", recognizer_id, 
name.c_str(),
-  function.c_str(), symbol.c_str(), regexp ? " (regexp)" : "");
+
+  stream << std::to_string(recognizer_id) << ": " << name;
+  if (!module.empty())
+stream << ", module " << module;
+  if (!symbol.empty())
+stream << ", function " << symbol;
+  if (!alternate_symbol.empty())
+stream << ", symbol " << alternate_symbol;
+  if (regexp)
+stream << " (regexp)";
+
+  stream.EOL();
+  stream.Flush();
+
   any_printed = true;
 });
 

diff  --git 
a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
 
b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
index a2f90d7fbbd6..bae489128fd1 100644
--- 
a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ 
b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -2691,6 +2691,7 @@ static void RegisterObjCExceptionRecognizer() {
 std::tie(module, function) = AppleObjCRuntime::GetExceptionThrowLocation();
 StackFrameRecognizerManager::AddRecognizer(
 StackFrameRecognizerSP(new ObjCExceptionThrowFrameRecognizer()),
-module.GetFilename(), function, /*first_instruction_only*/ true);
+module.GetFilename(), function, /*alternate_symbol*/ {},
+/*first_instruction_only*/ tru

[Lldb-commits] [PATCH] D74388: [lldb/test] Add alternate symbol to StackFrame Recognizer

2020-02-11 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib added a comment.

This patch landed in commit cb0c4ee3ebfe55809c9d0be72726b05668028fc4 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74388



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


[Lldb-commits] [lldb] 363f05b - [lldb] Delete the SharingPtr class

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

Author: Pavel Labath
Date: 2020-02-11T13:23:18+01:00
New Revision: 363f05b83d9cf207e1b024ca105b8d55526178b8

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

LOG: [lldb] Delete the SharingPtr class

Summary:
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.

Reviewers: teemperor, JDevlieghere, jingham

Subscribers: mgorny, jfb, lldb-commits

Tags: #lldb

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

Added: 


Modified: 
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/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/unittests/Utility/SharedClusterTest.cpp

Removed: 
lldb/include/lldb/Utility/SharingPtr.h
lldb/source/Utility/SharingPtr.cpp



diff  --git a/lldb/cmake/modules/LLDBFramework.cmake 
b/lldb/cmake/modules/LLDBFramework.cmake
index fd4c2e41d768..c52daaa4fa8b 100644
--- a/lldb/cmake/modules/LLDBFramework.cmake
+++ b/lldb/cmake/modules/LLDBFramework.cmake
@@ -59,8 +59,7 @@ list(REMOVE_ITEM root_public_headers ${root_private_headers})
 set(lldb_header_staging ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders)
 foreach(header
 ${public_headers}
-${root_public_headers}
-${LLDB_SOURCE_DIR}/include/lldb/Utility/SharingPtr.h)
+${root_public_headers})
 
   get_filename_component(basename ${header} NAME)
   set(staged_header ${lldb_header_staging}/${basename})

diff  --git a/lldb/include/lldb/Core/ValueObject.h 
b/lldb/include/lldb/Core/ValueObject.h
index 4a410e9e19df..4f8ea9d23d78 100644
--- a/lldb/include/lldb/Core/ValueObject.h
+++ b/lldb/include/lldb/Core/ValueObject.h
@@ -902,7 +902,7 @@ class ValueObject : public UserID {
   // Use this constructor to create a "root variable object".  The ValueObject
   // will be locked to this context through-out its lifespan.
 
-  ValueObject(ExecutionContextScope *exe_scope,
+  ValueObject(ExecutionContextScope *exe_scope, ValueObjectManager &manager,
   AddressType child_ptr_or_ref_addr_type = eAddressTypeLoad);
 
   // Use this constructor to create a ValueObject owned by another ValueObject.

diff  --git a/lldb/include/lldb/Core/ValueObjectConstResult.h 
b/lldb/include/lldb/Core/ValueObjectConstResult.h
index 3bc957ef2b84..57d6b530df7b 100644
--- a/lldb/include/lldb/Core/ValueObjectConstResult.h
+++ b/lldb/include/lldb/Core/ValueObjectConstResult.h
@@ -121,30 +121,34 @@ class ValueObjectConstResult : public ValueObject {
   friend class ValueObjectConstResultImpl;
 
   ValueObjectConstResult(ExecutionContextScope *exe_scope,
+ ValueObjectManager &manager,
  lldb::ByteOrder byte_order, uint32_t addr_byte_size,
  lldb::addr_t address);
 
   ValueObjectConstResult(ExecutionContextScope *exe_scope,
- const CompilerType &compiler_type,
- ConstString name, const DataExtractor &data,
- lldb::addr_t address);
+ ValueObjectManager &manager,
+ const CompilerType &compiler_type, ConstString name,
+ const DataExtractor &data, lldb::addr_t address);
 
   ValueObjectConstResult(ExecutionContextScope *exe_scope,
- const CompilerTy

[Lldb-commits] [lldb] 651936e - [lldb][NFC] Remove Stream::Indent(const char *) overload in favor of the StringRef version

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

Author: Raphael Isemann
Date: 2020-02-11T13:29:32+01:00
New Revision: 651936e5b62a6a06b1aca1cd976503f5b2991051

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

LOG: [lldb][NFC] Remove Stream::Indent(const char *) overload in favor of the 
StringRef version

Added: 


Modified: 
lldb/include/lldb/Utility/Stream.h
lldb/source/Utility/Stream.cpp
lldb/unittests/Utility/StreamTest.cpp

Removed: 




diff  --git a/lldb/include/lldb/Utility/Stream.h 
b/lldb/include/lldb/Utility/Stream.h
index 18a16a3461c1..bf0e5f284b12 100644
--- a/lldb/include/lldb/Utility/Stream.h
+++ b/lldb/include/lldb/Utility/Stream.h
@@ -270,10 +270,8 @@ class Stream {
   /// optional string following the indentation spaces.
   ///
   /// \param[in] s
-  /// A C string to print following the indentation. If nullptr, just
-  /// output the indentation characters.
-  size_t Indent(const char *s = nullptr);
-  size_t Indent(llvm::StringRef s);
+  /// A string to print following the indentation.
+  size_t Indent(llvm::StringRef s = "");
 
   /// Decrement the current indentation level.
   void IndentLess(unsigned amount = 2);

diff  --git a/lldb/source/Utility/Stream.cpp b/lldb/source/Utility/Stream.cpp
index ca43c013a426..8d32b5674502 100644
--- a/lldb/source/Utility/Stream.cpp
+++ b/lldb/source/Utility/Stream.cpp
@@ -126,15 +126,9 @@ size_t Stream::PrintfVarArg(const char *format, va_list 
args) {
 // Print and End of Line character to the stream
 size_t Stream::EOL() { return PutChar('\n'); }
 
-// Indent the current line using the current indentation level and print an
-// optional string following the indentation spaces.
-size_t Stream::Indent(const char *s) {
-  return Printf("%*.*s%s", m_indent_level, m_indent_level, "", s ? s : "");
-}
-
 size_t Stream::Indent(llvm::StringRef str) {
-  return Printf("%*.*s%s", m_indent_level, m_indent_level, "",
-str.str().c_str());
+  std::string indentation(m_indent_level, ' ');
+  return PutCString(indentation) + PutCString(str);
 }
 
 // Stream a character "ch" out to this stream.

diff  --git a/lldb/unittests/Utility/StreamTest.cpp 
b/lldb/unittests/Utility/StreamTest.cpp
index e5cc2fd3ed49..940d49fdfdb7 100644
--- a/lldb/unittests/Utility/StreamTest.cpp
+++ b/lldb/unittests/Utility/StreamTest.cpp
@@ -148,7 +148,8 @@ TEST_F(StreamTest, SetIndentLevel) {
 
 TEST_F(StreamTest, Indent) {
   s.SetIndentLevel(2);
-  s.Indent(nullptr);
+  const char *nullptr_cstring = nullptr;
+  s.Indent(nullptr_cstring);
   EXPECT_EQ("  ", TakeValue());
 
   s.Indent("");



___
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-11 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.

yeah, go for it.


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] D74153: [lldb] Delete the SharingPtr class

2020-02-11 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG363f05b83d9c: [lldb] Delete the SharingPtr class (authored 
by labath).

Changed prior to commit:
  https://reviews.llvm.org/D74153?vs=242974&id=243808#toc

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] [lldb] 65ac68e - [lldb] Add test for multiple inheritance

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

Author: Raphael Isemann
Date: 2020-02-11T13:31:34+01:00
New Revision: 65ac68ec3419abd98731e0c434229239e1563045

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

LOG: [lldb] Add test for multiple inheritance

Added: 
lldb/packages/Python/lldbsuite/test/lang/cpp/multiple-inheritance/Makefile

lldb/packages/Python/lldbsuite/test/lang/cpp/multiple-inheritance/TestCppMultipleInheritance.py
lldb/packages/Python/lldbsuite/test/lang/cpp/multiple-inheritance/main.cpp

Modified: 


Removed: 




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

diff  --git 
a/lldb/packages/Python/lldbsuite/test/lang/cpp/multiple-inheritance/TestCppMultipleInheritance.py
 
b/lldb/packages/Python/lldbsuite/test/lang/cpp/multiple-inheritance/TestCppMultipleInheritance.py
new file mode 100644
index ..defd4bd5df5f
--- /dev/null
+++ 
b/lldb/packages/Python/lldbsuite/test/lang/cpp/multiple-inheritance/TestCppMultipleInheritance.py
@@ -0,0 +1,35 @@
+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"))
+
+# Member access
+self.expect_expr("C.Base1::m_base", result_type="int", 
result_value="11")
+self.expect_expr("C.Base2::m_base", result_type="int", 
result_value="12")
+self.expect_expr("C.m1", result_type="int", result_value="22")
+self.expect_expr("C.m2", result_type="int", result_value="33")
+self.expect_expr("C.m_final", result_type="int", result_value="44")
+
+# Virtual functions
+self.expect_expr("C.Base1::virt_base()", result_type="int", 
result_value="111")
+self.expect_expr("C.Base2::virt_base()", result_type="int", 
result_value="121")
+self.expect_expr("C.virt1()", result_type="int", result_value="3")
+self.expect_expr("C.virt2()", result_type="int", result_value="5")
+self.expect_expr("C.final_virt()", result_type="int", result_value="7")
+self.expect_expr("C.virt_common()", result_type="int", 
result_value="444")
+
+# Normal functions
+self.expect_expr("C.Base1::func_base()", result_type="int", 
result_value="112")
+self.expect_expr("C.Base2::func_base()", result_type="int", 
result_value="122")
+self.expect_expr("C.func1()", result_type="int", result_value="4")
+self.expect_expr("C.func2()", result_type="int", result_value="6")
+self.expect_expr("C.final_func()", result_type="int", result_value="8")
+self.expect_expr("C.func_common()", result_type="int", 
result_value="888")

diff  --git 
a/lldb/packages/Python/lldbsuite/test/lang/cpp/multiple-inheritance/main.cpp 
b/lldb/packages/Python/lldbsuite/test/lang/cpp/multiple-inheritance/main.cpp
new file mode 100644
index ..62c40a52a150
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/multiple-inheritance/main.cpp
@@ -0,0 +1,52 @@
+struct CommonBase {
+  int m_base;
+  int virt_base_val;
+  int func_base_val;
+  virtual int virt_base() { return virt_base_val; }
+  virtual int virt_common() { return 555; }
+  int func_base() { return func_base_val; }
+  int func_common() { return 777; }
+};
+
+struct Base1 : CommonBase {
+  int m1 = 22;
+  Base1() {
+// Give the base functions/members unique values.
+virt_base_val = 111;
+func_base_val = 112;
+m_base = 11;
+  }
+  virtual int virt1() { return 3; }
+  int func1() { return 4; }
+};
+
+struct Base2 : CommonBase {
+  int m2 = 33;
+  Base2() {
+// Give the base functions/members unique values.
+virt_base_val = 121;
+func_base_val = 122;
+m_base = 12;
+  }
+  virtual int virt2() { return 5; }
+  int func2() { return 6; }
+};
+
+struct FinalClass : Base1, Base2 {
+  int m_final = 44;
+  virtual int final_virt() { return 7; }
+  int final_func() { return 8; }
+  virtual int virt_common() { return 444; }
+  int func_common() { return 888; }
+};
+
+int main() {
+  FinalClass C;
+  // Call functions so they get emitted.
+  C.func1();
+  C.func2();
+  C.final_func();
+  C.func_common();
+  C.Base1::func_base();
+  return 0; // break here
+}



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists

[Lldb-commits] [lldb] 9dfd4e2 - [lldb][NFC] Remove ConstString -> const char * -> StringRef conversions when calling Stream::Indent

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

Author: Raphael Isemann
Date: 2020-02-11T13:51:41+01:00
New Revision: 9dfd4e260bd4f9f1d9d0fce343ed645fdd331261

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

LOG: [lldb][NFC] Remove ConstString -> const char * -> StringRef conversions 
when calling Stream::Indent

Let's just pass in a StringRef and save the strlen call when rebuilding the 
StringRef parameter.

Added: 


Modified: 
lldb/source/Interpreter/OptionValueDictionary.cpp
lldb/source/Interpreter/Options.cpp

lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp

Removed: 




diff  --git a/lldb/source/Interpreter/OptionValueDictionary.cpp 
b/lldb/source/Interpreter/OptionValueDictionary.cpp
index 8a534fe6d752..caadccd04232 100644
--- a/lldb/source/Interpreter/OptionValueDictionary.cpp
+++ b/lldb/source/Interpreter/OptionValueDictionary.cpp
@@ -45,7 +45,7 @@ void OptionValueDictionary::DumpValue(const ExecutionContext 
*exe_ctx,
   else
 strm.EOL();
 
-  strm.Indent(pos->first.GetCString());
+  strm.Indent(pos->first.GetStringRef());
 
   const uint32_t extra_dump_options = m_raw_value_dump ? eDumpOptionRaw : 
0;
   switch (dict_type) {

diff  --git a/lldb/source/Interpreter/Options.cpp 
b/lldb/source/Interpreter/Options.cpp
index f0d24cd27030..fb13bd48e478 100644
--- a/lldb/source/Interpreter/Options.cpp
+++ b/lldb/source/Interpreter/Options.cpp
@@ -282,7 +282,7 @@ void Options::OutputFormattedUsageText(Stream &strm,
   if (static_cast(actual_text.length() + strm.GetIndentLevel()) <
   output_max_columns) {
 // Output it as a single line.
-strm.Indent(actual_text.c_str());
+strm.Indent(actual_text);
 strm.EOL();
   } else {
 // We need to break it up into multiple lines.

diff  --git 
a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
 
b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
index 78fec8e5c20a..9b81ba03148c 100644
--- 
a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
+++ 
b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
@@ -3131,7 +3131,7 @@ void RenderScriptRuntime::DumpKernels(Stream &strm) const 
{
 strm.Printf("Resource '%s':", module->m_resname.c_str());
 strm.EOL();
 for (const auto &kernel : module->m_kernels) {
-  strm.Indent(kernel.m_name.AsCString());
+  strm.Indent(kernel.m_name.GetStringRef());
   strm.EOL();
 }
   }
@@ -3941,7 +3941,7 @@ void RSModuleDescriptor::Dump(Stream &strm) const {
 }
 
 void RSGlobalDescriptor::Dump(Stream &strm) const {
-  strm.Indent(m_name.AsCString());
+  strm.Indent(m_name.GetStringRef());
   VariableList var_list;
   m_module->m_module->FindGlobalVariables(m_name, nullptr, 1U, var_list);
   if (var_list.GetSize() == 1) {
@@ -3966,12 +3966,12 @@ void RSGlobalDescriptor::Dump(Stream &strm) const {
 }
 
 void RSKernelDescriptor::Dump(Stream &strm) const {
-  strm.Indent(m_name.AsCString());
+  strm.Indent(m_name.GetStringRef());
   strm.EOL();
 }
 
 void RSReductionDescriptor::Dump(lldb_private::Stream &stream) const {
-  stream.Indent(m_reduce_name.AsCString());
+  stream.Indent(m_reduce_name.GetStringRef());
   stream.IndentMore();
   stream.EOL();
   stream.Indent();



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


[Lldb-commits] [lldb] e8e7cf8 - [lldb][NFC] Remove the CppVirtualMadness test

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

Author: Raphael Isemann
Date: 2020-02-11T14:09:58+01:00
New Revision: e8e7cf810c11697c99c8ed75f925c600c7df014f

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

LOG: [lldb][NFC] Remove the CppVirtualMadness test

We now have a virtual-functions test and a multiple-inheritance test that
are testing the same functionality (and more) using the newer test functions 
which
we have in LLDB these days. These tests should also be less flaky and
less dependent on other unrelated LLDB functionality.

Added: 


Modified: 


Removed: 
lldb/packages/Python/lldbsuite/test/lang/cpp/virtual/Makefile
lldb/packages/Python/lldbsuite/test/lang/cpp/virtual/TestVirtual.py
lldb/packages/Python/lldbsuite/test/lang/cpp/virtual/main.cpp



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

diff  --git 
a/lldb/packages/Python/lldbsuite/test/lang/cpp/virtual/TestVirtual.py 
b/lldb/packages/Python/lldbsuite/test/lang/cpp/virtual/TestVirtual.py
deleted file mode 100644
index 22fe96b96d2c..
--- a/lldb/packages/Python/lldbsuite/test/lang/cpp/virtual/TestVirtual.py
+++ /dev/null
@@ -1,101 +0,0 @@
-"""
-Test C++ virtual function and virtual inheritance.
-"""
-
-import os
-import re
-import lldb
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-
-
-def Msg(expr, val):
-return "'expression %s' matches the output (from compiled code): %s" % (
-expr, val)
-
-
-class CppVirtualMadness(TestBase):
-
-mydir = TestBase.compute_mydir(__file__)
-
-# This is the pattern by design to match the "my_expr = 'value'" output 
from
-# printf() stmts (see main.cpp).
-pattern = re.compile("^([^=]*) = '([^=]*)'$")
-
-def setUp(self):
-# Call super's setUp().
-TestBase.setUp(self)
-# Find the line number to break for main.cpp.
-self.source = 'main.cpp'
-self.line = line_number(self.source, '// Set first breakpoint here.')
-
-@expectedFailureAll(
-compiler="icc",
-bugnumber="llvm.org/pr16808 lldb does not call the correct virtual 
function with icc.")
-@skipIfWindows # This test will hang on windows llvm.org/pr21753
-@expectedFlakeyNetBSD
-def test_virtual_madness(self):
-"""Test that expression works correctly with virtual inheritance as 
well as virtual function."""
-self.build()
-
-# Bring the program to the point where we can issue a series of
-# 'expression' command to compare against the golden output.
-self.dbg.SetAsync(False)
-
-# Create a target by the debugger.
-target = self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
-self.assertTrue(target, VALID_TARGET)
-
-# Create the breakpoint inside function 'main'.
-breakpoint = target.BreakpointCreateByLocation(self.source, self.line)
-self.assertTrue(breakpoint, VALID_BREAKPOINT)
-
-# Now launch the process, and do not stop at entry point.
-process = target.LaunchSimple(
-None, None, self.get_process_working_directory())
-self.assertTrue(process, PROCESS_IS_VALID)
-
-self.assertTrue(process.GetState() == lldb.eStateStopped)
-thread = lldbutil.get_stopped_thread(
-process, lldb.eStopReasonBreakpoint)
-self.assertTrue(
-thread.IsValid(),
-"There should be a thread stopped due to breakpoint condition")
-
-# First, capture the golden output from the program itself.
-golden = thread.GetFrameAtIndex(0).FindVariable("golden")
-self.assertTrue(
-golden.IsValid(),
-"Encountered an error reading the process's golden variable")
-error = lldb.SBError()
-golden_str = process.ReadCStringFromMemory(
-golden.AddressOf().GetValueAsUnsigned(), 4096, error)
-self.assertTrue(error.Success())
-self.assertTrue("c_as_C" in golden_str)
-
-# This golden list contains a list of "my_expr = 'value' pairs 
extracted
-# from the golden output.
-gl = []
-
-# Scan the golden output line by line, looking for the pattern:
-#
-# my_expr = 'value'
-#
-for line in golden_str.split(os.linesep):
-match = self.pattern.search(line)
-if match:
-my_expr, val = match.group(1), match.group(2)
-gl.append((my_expr, val))
-#print("golden list

[Lldb-commits] [PATCH] D70847: [lldb-vscode] Ensure that target matches the executable file

2020-02-11 Thread Anton Kolesov via Phabricator via lldb-commits
anton.kolesov updated this revision to Diff 243828.
anton.kolesov retitled this revision from "[lldb] Set executable module when 
adding modules to the Target" to "[lldb-vscode] Ensure that target matches the 
executable file".
anton.kolesov edited the summary of this revision.
anton.kolesov added a comment.

Reverted to the original idea of modifying lldb-vscode. Unlike first version, 
this commit also modifies request_attach to have the same behaviour. Two new 
properties are added to request arguments: "targetTriple" and "platformName" to 
specify values to respective arguments of SBDebugger::CreateTarget().


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70847

Files:
  lldb/tools/lldb-vscode/lldb-vscode.cpp
  lldb/tools/lldb-vscode/package.json

Index: lldb/tools/lldb-vscode/package.json
===
--- lldb/tools/lldb-vscode/package.json
+++ lldb/tools/lldb-vscode/package.json
@@ -122,6 +122,14 @@
 "type": "string",
 "description": "Specify a working directory to set the debug adaptor to so relative object files can be located."
 			},
+			"targetTriple": {
+"type": "string",
+"description": "Triplet of the target architecture to override value derived from the program file."
+			},
+			"platformName": {
+"type": "string",
+"description": "Name of the execution platform to override value derived from the program file."
+			},
 			"initCommands": {
 	"type": "array",
 	"description": "Initialization commands executed upon debugger startup.",
@@ -175,6 +183,14 @@
 "type": "string",
 "description": "Specify a working directory to set the debug adaptor to so relative object files can be located."
 			},
+			"targetTriple": {
+"type": "string",
+"description": "Triplet of the target architecture to override value derived from the program file."
+			},
+			"platformName": {
+"type": "string",
+"description": "Name of the execution platform to override value derived from the program file."
+			},
 			"attachCommands": {
 "type": "array",
 "description": "Custom commands that are executed instead of attaching to a process ID or to a process by name. These commands may optionally create a new target and must perform an attach. A valid process must exist after these commands complete or the \"attach\" will fail.",
Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -110,6 +110,16 @@
   return newsockfd;
 }
 
+void AddBreakpointListener(VSCode &vscode) {
+  // Configure breakpoint event listeners for the target.
+  lldb::SBListener listener = vscode.debugger.GetListener();
+  listener.StartListeningForEvents(
+  vscode.target.GetBroadcaster(),
+  lldb::SBTarget::eBroadcastBitBreakpointChanged);
+  listener.StartListeningForEvents(vscode.broadcaster,
+   eBroadcastBitStopEventThread);
+}
+
 std::vector MakeArgv(const llvm::ArrayRef &strs) {
   // Create and return an array of "const char *", one for each C string in
   // "strs" and terminate the list with a NULL. This can be used for argument
@@ -512,27 +522,45 @@
   // Run any initialize LLDB commands the user specified in the launch.json
   g_vsc.RunInitCommands();
 
-  // Grab the name of the program we need to debug and set it as the first
-  // argument that will be passed to the program we will debug.
-  const auto program = GetString(arguments, "program");
-  if (!program.empty()) {
-lldb::SBFileSpec program_fspec(program.data(), true /*resolve_path*/);
-
-g_vsc.launch_info.SetExecutableFile(program_fspec,
-false /*add_as_first_arg*/);
-const char *target_triple = nullptr;
-const char *uuid_cstr = nullptr;
-// Stand alone debug info file if different from executable
-const char *symfile = nullptr;
-g_vsc.target.AddModule(program.data(), target_triple, uuid_cstr, symfile);
-if (error.Fail()) {
-  response["success"] = llvm::json::Value(false);
-  EmplaceSafeString(response, "message", std::string(error.GetCString()));
-  g_vsc.SendJSON(llvm::json::Value(std::move(response)));
-  return;
-}
+  // Grab the name of the program we need to debug and create a target using
+  // the given program as an argument. Executable file can be a source of target
+  // architecture and platform, if they differ from the host. Setting exe path
+  // in launch info is useless because Target.Launch() will not change
+  // architecture and platform, therefore they should be known at the target
+  // creation. We also use target triple and platform from the launch
+  // configuration, if g

[Lldb-commits] [PATCH] D74398: [lldb-server] jThreadsInfo returns stack memory

2020-02-11 Thread Jaroslav Sevcik via Phabricator via lldb-commits
jarin created this revision.
jarin added a reviewer: labath.
jarin added a project: LLDB.
Herald added a subscriber: lldb-commits.

This patch adds parts of the stack that should be useful for unwinding to the 
jThreadsInfo reply from lldb-server. We return the top of the stack (12 words), 
and we also try to walk the frame pointer linked list and return the memory 
containing frame pointer and return address pairs. The idea is to cover the 
cases with and without frame pointer omission.

Here are some questions:

- Does this approach sound reasonable?
- How do we test this?
- Is it fine if we do not handle the big-endian and 32-bit word cases? (There 
we will be basically never generate the frame list.)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74398

Files:
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp

Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -469,6 +469,118 @@
   return register_object;
 }
 
+static llvm::Expected
+GetRegisterValue(NativeRegisterContext ®_ctx, uint32_t generic_regnum) {
+  Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_THREAD));
+  uint32_t reg_num = reg_ctx.ConvertRegisterKindToRegisterNumber(
+  eRegisterKindGeneric, generic_regnum);
+  const RegisterInfo *const reg_info_p =
+  reg_ctx.GetRegisterInfoAtIndex(reg_num);
+
+  if (reg_info_p == nullptr || reg_info_p->value_regs != nullptr) {
+LLDB_LOGF(log, "%s failed to get register info for register index %" PRIu32,
+  __FUNCTION__, reg_num);
+return llvm::make_error("failed to obtain register info",
+   llvm::inconvertibleErrorCode());
+  }
+
+  RegisterValue reg_value;
+  Status error = reg_ctx.ReadRegister(reg_info_p, reg_value);
+  if (error.Fail()) {
+LLDB_LOGF(log, "%s failed to read register '%s' index %" PRIu32 ": %s",
+  __FUNCTION__,
+  reg_info_p->name ? reg_info_p->name : "",
+  reg_num, error.AsCString());
+return llvm::make_error("failed to read register value",
+   llvm::inconvertibleErrorCode());
+  }
+  return reg_value;
+}
+
+static void AddMemoryChunk(json::Array &stack_memory_chunks, addr_t address,
+   std::vector &bytes) {
+  if (bytes.empty())
+return;
+  json::Object chunk;
+  chunk.try_emplace("address", static_cast(address));
+  StreamString stream;
+  for (int8_t b : bytes)
+stream.PutHex8(b);
+  chunk.try_emplace("bytes", stream.GetString().str());
+  stack_memory_chunks.push_back(std::move(chunk));
+}
+
+static json::Array GetStackMemoryAsJSON(NativeProcessProtocol &process,
+NativeThreadProtocol &thread) {
+  const size_t kStackTopMemoryInfoWordSize = 12;
+  const size_t kStackTopMemoryInfoByteSize =
+  kStackTopMemoryInfoWordSize * sizeof(addr_t);
+  const size_t kMaxStackSize = 128 * 1024;
+  const size_t kMaxFrameSize = 4 * 1024;
+  const size_t kFpAndRaSize = 2 * sizeof(addr_t);
+  const size_t kMaxFrameCount = 128;
+
+  NativeRegisterContext ®_ctx = thread.GetRegisterContext();
+
+  json::Array stack_memory_chunks;
+
+  lldb::addr_t sp_value;
+  if (llvm::Expected expected_sp_value =
+  GetRegisterValue(reg_ctx, LLDB_REGNUM_GENERIC_SP)) {
+sp_value = expected_sp_value->GetAsUInt64();
+  } else {
+return stack_memory_chunks;
+  }
+  lldb::addr_t fp_value;
+  if (llvm::Expected expected_fp_value =
+  GetRegisterValue(reg_ctx, LLDB_REGNUM_GENERIC_FP)) {
+fp_value = expected_fp_value->GetAsUInt64();
+  } else {
+return stack_memory_chunks;
+  }
+
+  // First, make sure we copy the top kStackTopMemoryInfoSize bytes from the
+  // stack.
+  size_t byte_count = std::min(kStackTopMemoryInfoByteSize,
+   static_cast(fp_value - sp_value));
+  std::vector buf(byte_count, 0);
+
+  size_t bytes_read = 0;
+  Status error = process.ReadMemoryWithoutTrap(sp_value, buf.data(), byte_count,
+   bytes_read);
+  if (error.Success() && bytes_read > 0) {
+buf.resize(bytes_read);
+AddMemoryChunk(stack_memory_chunks, sp_value, buf);
+  }
+
+  // Additionally, try to walk the frame pointer link chain. If the frame
+  // is too big or if the frame pointer points too far, stop the walk.
+  addr_t max_frame_pointer = sp_value + kMaxStackSize;
+  for (size_t i = 0; i < kMaxFrameCount; i++) {
+if (fp_value < sp_value || fp_value > sp_value + kMaxFrameSize ||
+fp_value > max_frame_pointer)
+  break;
+
+std::vector fp_ra_buf(kFpAndRaSize, 0);
+bytes_read = 0;
+error = process.ReadMemoryWithoutTrap(fp_value, fp_ra_buf.data(),
+

[Lldb-commits] [lldb] 98c940b - [NFC] [lldb] Remove unused declaration

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

Author: Jan Kratochvil
Date: 2020-02-11T14:59:52+01:00
New Revision: 98c940bf515831420b8b53489dd4f9a4fc8a40ad

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

LOG: [NFC] [lldb] Remove unused declaration

ObjectFileELF::GetSectionIndexByType declaration without definition was
added by commit 17220c188635721e948cf02d2b6ad36b267ea393.

Added: 


Modified: 
lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h

Removed: 




diff  --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h 
b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
index 3b273896cb59..d3f620385d97 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
@@ -328,9 +328,6 @@ class ObjectFileELF : public lldb_private::ObjectFile {
   /// section index 0 is never valid).
   lldb::user_id_t GetSectionIndexByName(const char *name);
 
-  // Returns the ID of the first section that has the given type.
-  lldb::user_id_t GetSectionIndexByType(unsigned type);
-
   /// Returns the section header with the given id or NULL.
   const ELFSectionHeaderInfo *GetSectionHeaderByIndex(lldb::user_id_t id);
 



___
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-11 Thread Konrad Wilhelm Kleine via Phabricator via lldb-commits
kwk added a comment.

@labath @jingham to summarize from what I read here and what I chatted about 
with @labath , the following  is a possible way to go for now, right?

1. We're not going to introduce my flag.
2. You're both not perfectly happy with the way things are documented at the 
moment and dislike some of the implementation as in in LLDB but chaning it 
should not be part of this patch.
3. @jingham wouldn't want to introduce `--compile-unit` as a flag that @labath 
proposed.
4. You want `breakpoint set --file` to search everything, that is to say 
compilation units and files referenced in `DW_AT_decl_file`.

If you can confirm that this is correct, then I can refactor this patch to 
remove the switch and change the default behavior for `breakpoint set --file`. 
Especially point 4. is important I guess.


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] D74217: Add target.xml support for qXfer request.

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

I think this is looking pretty good overall. I just have a bunch of stylistic 
remarks...




Comment at: 
lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/main.cpp:1
+#include 
+

I don't think the choice of inferior really matters here. This code could just 
be like `int main(){}`



Comment at: 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp:849
   response.PutCString(";qXfer:auxv:read+");
+  response.PutCString(";qXfer:features:read+");
   response.PutCString(";qXfer:libraries-svr4:read+");

You can put this outside the `#ifdef`



Comment at: 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:380-459
+static std::string GetEncodingNameOrEmpty(const RegisterInfo *reg_info) {
+  switch (reg_info->encoding) {
+  case eEncodingUint:
+return "uint";
+  case eEncodingSint:
+return "sint";
+  case eEncodingIEEE754:

These should return a `llvm::StringRef` to avoid copies, and take the argument 
as a reference to convey non-nullness.



Comment at: 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:2786-2910
+  if (object == "features" && annex == "target.xml") {
+// Make sure we have a valid process.
+if (!m_debugged_process_up ||
+(m_debugged_process_up->GetID() == LLDB_INVALID_PROCESS_ID)) {
+  return llvm::createStringError(llvm::inconvertibleErrorCode(),
+ "No process available");
+}

Please move this into a separate function



Comment at: 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:2788-2792
+if (!m_debugged_process_up ||
+(m_debugged_process_up->GetID() == LLDB_INVALID_PROCESS_ID)) {
+  return llvm::createStringError(llvm::inconvertibleErrorCode(),
+ "No process available");
+}

This check could be factored to the front of the function (the svr4 branch does 
currently not have it, but it most likely should).



Comment at: 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:2841-2843
+  if (!encoding.empty()) {
+response.Printf("encoding=\"%s\" ", encoding.c_str());
+  }

We generally don't put curly braces around statements which fit on a single 
line.



Comment at: 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:2871-2894
+  if (reg_info->value_regs &&
+  reg_info->value_regs[0] != LLDB_INVALID_REGNUM) {
+response.PutCString("value_regnums=\"");
+int i = 0;
+for (const uint32_t *reg_num = reg_info->value_regs;
+ *reg_num != LLDB_INVALID_REGNUM; ++reg_num, ++i) {
+  if (i > 0)

Make a utility function (lambda?) for this?


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

https://reviews.llvm.org/D74217



___
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-11 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

In D74136#1869622 , @kwk wrote:

> @labath @jingham to summarize from what I read here and what I chatted about 
> with @labath , the following  is a possible way to go for now, right?
>
> 1. We're not going to introduce my flag.
> 2. You're both not perfectly happy with the way things are documented at the 
> moment and dislike some of the implementation as in in LLDB but chaning it 
> should not be part of this patch.
> 3. @jingham wouldn't want to introduce `--compile-unit` as a flag that 
> @labath proposed.
> 4. You want `breakpoint set --file` to search everything, that is to say 
> compilation units and files referenced in `DW_AT_decl_file`.
>
>   If you can confirm that this is correct, then I can refactor this patch to 
> remove the switch and change the default behavior for `breakpoint set 
> --file`. Especially point 4. is important I guess.


There's a point (5) which is that the search in 4 should be conditioned on the 
setting of the "target.inline-breakpoint-strategy".  That way if people have 
big projects but don't ever #include source files, and don't build with LTO, 
they can turn off these extra searches, which might end up being costly and to 
no purpose for them.


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] [lldb] 6217468 - [lldb][NFC] Remove support file searching from SourceFileCompleter

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

Author: Raphael Isemann
Date: 2020-02-11T18:50:25+01:00
New Revision: 62174682a039efce2ce7606d5416d2450ff42dab

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

LOG: [lldb][NFC] Remove support file searching from SourceFileCompleter

This code seems wrong as the directory variable actually contains
the file name. It's also unreachable code as m_include_support_files
is hardcoded to false which is the condition for the surrounding 'if
statement'. Let's just remove all of this.

Added: 


Modified: 
lldb/include/lldb/Interpreter/CommandCompletions.h
lldb/source/Commands/CommandCompletions.cpp

Removed: 




diff  --git a/lldb/include/lldb/Interpreter/CommandCompletions.h 
b/lldb/include/lldb/Interpreter/CommandCompletions.h
index 275cc7e7c145..39061d9db8bc 100644
--- a/lldb/include/lldb/Interpreter/CommandCompletions.h
+++ b/lldb/include/lldb/Interpreter/CommandCompletions.h
@@ -121,7 +121,7 @@ class CommandCompletions {
   class SourceFileCompleter : public Completer {
   public:
 SourceFileCompleter(CommandInterpreter &interpreter,
-bool include_support_files, CompletionRequest 
&request);
+CompletionRequest &request);
 
 lldb::SearchDepth GetDepth() override;
 
@@ -132,7 +132,6 @@ class CommandCompletions {
 void DoCompletion(SearchFilter *filter) override;
 
   private:
-bool m_include_support_files;
 FileSpecList m_matching_files;
 const char *m_file_name;
 const char *m_dir_name;

diff  --git a/lldb/source/Commands/CommandCompletions.cpp 
b/lldb/source/Commands/CommandCompletions.cpp
index e5f29115a8a7..2ced56f90178 100644
--- a/lldb/source/Commands/CommandCompletions.cpp
+++ b/lldb/source/Commands/CommandCompletions.cpp
@@ -66,8 +66,7 @@ bool CommandCompletions::InvokeCommonCompletionCallbacks(
 void CommandCompletions::SourceFiles(CommandInterpreter &interpreter,
  CompletionRequest &request,
  SearchFilter *searcher) {
-  // Find some way to switch "include support files..."
-  SourceFileCompleter completer(interpreter, false, request);
+  SourceFileCompleter completer(interpreter, request);
 
   if (searcher == nullptr) {
 lldb::TargetSP target_sp = interpreter.GetDebugger().GetSelectedTarget();
@@ -332,10 +331,8 @@ CommandCompletions::Completer::~Completer() = default;
 // SourceFileCompleter
 
 CommandCompletions::SourceFileCompleter::SourceFileCompleter(
-CommandInterpreter &interpreter, bool include_support_files,
-CompletionRequest &request)
-: CommandCompletions::Completer(interpreter, request),
-  m_include_support_files(include_support_files), m_matching_files() {
+CommandInterpreter &interpreter, CompletionRequest &request)
+: CommandCompletions::Completer(interpreter, request), m_matching_files() {
   FileSpec partial_spec(m_request.GetCursorArgumentPrefix());
   m_file_name = partial_spec.GetFilename().GetCString();
   m_dir_name = partial_spec.GetDirectory().GetCString();
@@ -350,43 +347,22 @@ 
CommandCompletions::SourceFileCompleter::SearchCallback(SearchFilter &filter,
 SymbolContext &context,
 Address *addr) {
   if (context.comp_unit != nullptr) {
-if (m_include_support_files) {
-  FileSpecList supporting_files = context.comp_unit->GetSupportFiles();
-  for (size_t sfiles = 0; sfiles < supporting_files.GetSize(); sfiles++) {
-const FileSpec &sfile_spec =
-supporting_files.GetFileSpecAtIndex(sfiles);
-const char *sfile_file_name = sfile_spec.GetFilename().GetCString();
-const char *sfile_dir_name = sfile_spec.GetFilename().GetCString();
-bool match = false;
-if (m_file_name && sfile_file_name &&
-strstr(sfile_file_name, m_file_name) == sfile_file_name)
-  match = true;
-if (match && m_dir_name && sfile_dir_name &&
-strstr(sfile_dir_name, m_dir_name) != sfile_dir_name)
-  match = false;
-
-if (match) {
-  m_matching_files.AppendIfUnique(sfile_spec);
-}
-  }
-} else {
-  const char *cur_file_name =
-  context.comp_unit->GetPrimaryFile().GetFilename().GetCString();
-  const char *cur_dir_name =
-  context.comp_unit->GetPrimaryFile().GetDirectory().GetCString();
-
-  bool match = false;
-  if (m_file_name && cur_file_name &&
-  strstr(cur_file_name, m_file_name) == cur_file_name)
-match = true;
-
-  if (match && m_dir_name && cur_dir_name &&
-  strstr(cur_dir_name, m_dir_name) != cur_dir_name)
-match = false;
-
-  if (match) {
-m_matching_files.AppendIf

[Lldb-commits] [PATCH] D71151: [lldb][test] Remove symlink for API tests.

2020-02-11 Thread Jordan Rupprecht via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG99451b445368: [lldb][test] Remove symlink for API tests. 
(authored by rupprecht).

Changed prior to commit:
  https://reviews.llvm.org/D71151?vs=232658&id=243908#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71151

Files:
  lldb/packages/Python/lldbsuite/__init__.py
  lldb/packages/Python/lldbsuite/test/android/platform/Makefile
  
lldb/packages/Python/lldbsuite/test/android/platform/TestDefaultCacheLineSize.py
  lldb/packages/Python/lldbsuite/test/android/platform/main.cpp
  lldb/packages/Python/lldbsuite/test/api/check_public_api_headers/Makefile
  
lldb/packages/Python/lldbsuite/test/api/check_public_api_headers/TestPublicAPIHeaders.py
  
lldb/packages/Python/lldbsuite/test/api/check_public_api_headers/main.cpp.template
  lldb/packages/Python/lldbsuite/test/api/command-return-object/Makefile
  
lldb/packages/Python/lldbsuite/test/api/command-return-object/TestSBCommandReturnObject.py
  lldb/packages/Python/lldbsuite/test/api/command-return-object/main.cpp
  lldb/packages/Python/lldbsuite/test/api/listeners/Makefile
  lldb/packages/Python/lldbsuite/test/api/listeners/TestListener.py
  lldb/packages/Python/lldbsuite/test/api/listeners/main.c
  lldb/packages/Python/lldbsuite/test/api/log/TestAPILog.py
  lldb/packages/Python/lldbsuite/test/api/multiple-debuggers/.categories
  lldb/packages/Python/lldbsuite/test/api/multiple-debuggers/Makefile
  
lldb/packages/Python/lldbsuite/test/api/multiple-debuggers/TestMultipleDebuggers.py
  
lldb/packages/Python/lldbsuite/test/api/multiple-debuggers/multi-process-driver.cpp
  lldb/packages/Python/lldbsuite/test/api/multiple-debuggers/testprog.cpp
  lldb/packages/Python/lldbsuite/test/api/multiple-targets/Makefile
  
lldb/packages/Python/lldbsuite/test/api/multiple-targets/TestMultipleTargets.py
  lldb/packages/Python/lldbsuite/test/api/multiple-targets/main.cpp
  lldb/packages/Python/lldbsuite/test/api/multithreaded/Makefile
  lldb/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py
  lldb/packages/Python/lldbsuite/test/api/multithreaded/common.h
  lldb/packages/Python/lldbsuite/test/api/multithreaded/driver.cpp.template
  lldb/packages/Python/lldbsuite/test/api/multithreaded/inferior.cpp
  
lldb/packages/Python/lldbsuite/test/api/multithreaded/listener_test.cpp.template
  
lldb/packages/Python/lldbsuite/test/api/multithreaded/test_breakpoint_callback.cpp.template
  
lldb/packages/Python/lldbsuite/test/api/multithreaded/test_listener_event_description.cpp.template
  
lldb/packages/Python/lldbsuite/test/api/multithreaded/test_listener_event_process_state.cpp.template
  
lldb/packages/Python/lldbsuite/test/api/multithreaded/test_listener_resume.cpp.template
  lldb/packages/Python/lldbsuite/test/arm/breakpoint-it/Makefile
  lldb/packages/Python/lldbsuite/test/arm/breakpoint-it/TestBreakpointIt.py
  lldb/packages/Python/lldbsuite/test/arm/breakpoint-it/main.c
  lldb/packages/Python/lldbsuite/test/arm/breakpoint-thumb-codesection/Makefile
  
lldb/packages/Python/lldbsuite/test/arm/breakpoint-thumb-codesection/TestBreakpointThumbCodesection.py
  lldb/packages/Python/lldbsuite/test/arm/breakpoint-thumb-codesection/main.c
  lldb/packages/Python/lldbsuite/test/arm/emulation/TestEmulations.py
  
lldb/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-1-arm.dat
  
lldb/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-1-thumb.dat
  
lldb/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-10-thumb.dat
  
lldb/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-11-thumb.dat
  
lldb/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-12-thumb.dat
  
lldb/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-2-arm.dat
  
lldb/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-2-thumb.dat
  
lldb/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-3-arm.dat
  
lldb/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-3-thumb.dat
  
lldb/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-4-arm.dat
  
lldb/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-4-thumb.dat
  
lldb/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-5-arm.dat
  
lldb/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-5-thumb.dat
  
lldb/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-6-arm.dat
  
lldb/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-6-thumb.dat
  
lldb/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-7-arm.dat
  
lldb/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-7-thumb.dat
  
lldb/packages/Python/lldbsuite/test/arm/emulation/new-test-files/test-add-8-arm.dat
  
lldb/packages/Python/lldbs

[Lldb-commits] [PATCH] D74398: [lldb-server] jThreadsInfo returns stack memory

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



> Does this approach sound reasonable?

I think this is ok, in principle. It might be nice to include some numbers, 
like how much this increases the jThreadsInfo packet size vs. how much time or 
packets does this save us.

> How do we test this?

I am imagining a two-pronged test strategy. One test, where we do a high-level 
check on the syntax of the packet, and cross-check the consistency of the data 
against regular memory reads. And another test, which creates "interesting" 
stack(s) via inline asm, and where we can make stronger assertions about the 
data returned.

> Is it fine if we do not handle the big-endian and 32-bit word cases? (There 
> we will be basically never generate the frame list.)

We should definitely do 32-bit. It shouldn't be that hard -- just use 
`process->GetArchitecture().GetAddressByteSize()` instead of `sizeof(addr_t)`. 
I have a feeling this code might actually work on big-endian (if we assume the 
lldb-server and inferior have the same endianness), but it may be better to 
read the data via `DataExtractor::GetAddress`, as that will also handle the 
32-bit case for you.

Another case where this won't work is architectures with upward-growing stacks 
-- but I don't think we need to handle that, as lldb does not even have a way 
to describe this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74398



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


[Lldb-commits] [lldb] 8888992 - [lldb][NFC] Test SourceFileCompletion by completing the target line-table argument

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

Author: Raphael Isemann
Date: 2020-02-11T19:59:21+01:00
New Revision: 992dee3706d3e84d3533d506c7e971a66382

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

LOG: [lldb][NFC] Test SourceFileCompletion by completing the target line-table 
argument

Added: 


Modified: 
lldb/test/API/functionalities/completion/TestCompletion.py

Removed: 




diff  --git a/lldb/test/API/functionalities/completion/TestCompletion.py 
b/lldb/test/API/functionalities/completion/TestCompletion.py
index 26c70c1e7fc9..83c72b34d75f 100644
--- a/lldb/test/API/functionalities/completion/TestCompletion.py
+++ b/lldb/test/API/functionalities/completion/TestCompletion.py
@@ -348,6 +348,14 @@ def test_target_space(self):
'stop-hook',
'variable'])
 
+@skipIfFreeBSD  # timing out on the FreeBSD buildbot
+def test_target_modules_dump_line_table(self):
+"""Tests source file completion by completing the line-table 
argument."""
+self.build()
+self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
+self.complete_from_to('target modules dump line-table main.cp',
+  ['main.cpp'])
+
 @skipIfFreeBSD  # timing out on the FreeBSD buildbot
 def test_target_create_dash_co(self):
 """Test that 'target create --co' completes to 'target variable --core 
'."""



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


[Lldb-commits] [PATCH] D74217: Add target.xml support for qXfer request.

2020-02-11 Thread Levon Ter-Grigoryan via Phabricator via lldb-commits
PatriosTheGreat updated this revision to Diff 243932.

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

https://reviews.llvm.org/D74217

Files:
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/Makefile
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/main.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h

Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
@@ -199,6 +199,8 @@
   static std::string XMLEncodeAttributeValue(llvm::StringRef value);
 
 private:
+  llvm::Expected> BuildTargetXml();
+
   void HandleInferiorState_Exited(NativeProcessProtocol *process);
 
   void HandleInferiorState_Stopped(NativeProcessProtocol *process);
Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -377,6 +377,109 @@
   }
 }
 
+static llvm::StringRef GetEncodingNameOrEmpty(const RegisterInfo *reg_info) {
+  switch (reg_info->encoding) {
+  case eEncodingUint:
+return "uint";
+  case eEncodingSint:
+return "sint";
+  case eEncodingIEEE754:
+return "ieee754";
+  case eEncodingVector:
+return "vector";
+  default:
+return "";
+  }
+}
+
+static llvm::StringRef GetFormatNameOrEmpty(const RegisterInfo *reg_info) {
+  switch (reg_info->format) {
+  case eFormatBinary:
+return "binary";
+  case eFormatDecimal:
+return "decimal";
+  case eFormatHex:
+return "hex";
+  case eFormatFloat:
+return "float";
+  case eFormatVectorOfSInt8:
+return "vector-sint8";
+  case eFormatVectorOfUInt8:
+return "vector-uint8";
+  case eFormatVectorOfSInt16:
+return "vector-sint16";
+  case eFormatVectorOfUInt16:
+return "vector-uint16";
+  case eFormatVectorOfSInt32:
+return "vector-sint32";
+  case eFormatVectorOfUInt32:
+return "vector-uint32";
+  case eFormatVectorOfFloat32:
+return "vector-float32";
+  case eFormatVectorOfUInt64:
+return "vector-uint64";
+  case eFormatVectorOfUInt128:
+return "vector-uint128";
+  default:
+return "";
+  };
+}
+
+static llvm::StringRef GetKindGenericOrEmpty(const RegisterInfo *reg_info) {
+  switch (reg_info->kinds[RegisterKind::eRegisterKindGeneric]) {
+  case LLDB_REGNUM_GENERIC_PC:
+return "pc";
+  case LLDB_REGNUM_GENERIC_SP:
+return "sp";
+  case LLDB_REGNUM_GENERIC_FP:
+return "fp";
+  case LLDB_REGNUM_GENERIC_RA:
+return "ra";
+  case LLDB_REGNUM_GENERIC_FLAGS:
+return "flags";
+  case LLDB_REGNUM_GENERIC_ARG1:
+return "arg1";
+  case LLDB_REGNUM_GENERIC_ARG2:
+return "arg2";
+  case LLDB_REGNUM_GENERIC_ARG3:
+return "arg3";
+  case LLDB_REGNUM_GENERIC_ARG4:
+return "arg4";
+  case LLDB_REGNUM_GENERIC_ARG5:
+return "arg5";
+  case LLDB_REGNUM_GENERIC_ARG6:
+return "arg6";
+  case LLDB_REGNUM_GENERIC_ARG7:
+return "arg7";
+  case LLDB_REGNUM_GENERIC_ARG8:
+return "arg8";
+  default:
+return "";
+  }
+}
+
+static void CollectRegNums(const RegisterInfo *reg_info,
+   lldb_private::StreamString response) {
+  int i = 0;
+  for (const uint32_t *reg_num = reg_info->value_regs;
+   *reg_num != LLDB_INVALID_REGNUM; ++reg_num, ++i) {
+if (i > 0)
+  response.PutChar(',');
+response.Printf("%" PRIx32, *reg_num);
+  }
+}
+
+static void CollectInvalidateRegNums(const RegisterInfo *reg_info,
+ lldb_private::StreamString response) {
+  int i = 0;
+  for (const uint32_t *reg_num = reg_info->invalidate_regs;
+   *reg_num != LLDB_INVALID_REGNUM; ++reg_num, ++i) {
+if (i > 0)
+  response.PutChar(',');
+response.Printf("%" PRIx32, *reg_num);
+  }
+}
+
 static void WriteRegisterValueInHexFixedWidth(
 StreamString &response, NativeRegisterContext ®_ctx,
 const RegisterInfo ®_info, const RegisterValue *reg_value_p,
@@ -1699,66 +1802,19 @@
   response.Printf("bitsize:%" PRIu32 ";offset:%" PRIu32 ";",
   reg_info->byte_size * 8, reg_info->byte_offset);
 
-  switch (reg_info->encoding) {
-  case eEncodingUint:
-response.PutCString("encoding:uint;");
-break;
-  case eEncodingSint:
-response.PutCString("encoding:sint;");
-break;
-  case eEncodingIEEE754:
-response.PutCString("

[Lldb-commits] [lldb] f65f9d3 - [lldb][NFC] Test ModuleCompletion mode by completing the target modules load argument

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

Author: Raphael Isemann
Date: 2020-02-11T20:38:21+01:00
New Revision: f65f9d3bc5ab9444a9fcde17bca490bfc1f425b7

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

LOG: [lldb][NFC] Test ModuleCompletion mode by completing the target modules 
load argument

Added: 


Modified: 
lldb/test/API/functionalities/completion/TestCompletion.py

Removed: 




diff  --git a/lldb/test/API/functionalities/completion/TestCompletion.py 
b/lldb/test/API/functionalities/completion/TestCompletion.py
index 83c72b34d75f..538c626d60fd 100644
--- a/lldb/test/API/functionalities/completion/TestCompletion.py
+++ b/lldb/test/API/functionalities/completion/TestCompletion.py
@@ -356,6 +356,14 @@ def test_target_modules_dump_line_table(self):
 self.complete_from_to('target modules dump line-table main.cp',
   ['main.cpp'])
 
+@skipIfFreeBSD  # timing out on the FreeBSD buildbot
+def test_target_modules_load_aout(self):
+"""Tests modules completion by completing the target modules load 
argument."""
+self.build()
+self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
+self.complete_from_to('target modules load a.ou',
+  ['a.out'])
+
 @skipIfFreeBSD  # timing out on the FreeBSD buildbot
 def test_target_create_dash_co(self):
 """Test that 'target create --co' completes to 'target variable --core 
'."""



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


[Lldb-commits] [PATCH] D70847: [lldb-vscode] Ensure that target matches the executable file

2020-02-11 Thread Greg Clayton via Phabricator via lldb-commits
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Very nice, just need to add a VSCode::SetTarget(...) as detailed in inlined 
comments and this will be good to go.




Comment at: lldb/tools/lldb-vscode/lldb-vscode.cpp:113
 
+void AddBreakpointListener(VSCode &vscode) {
+  // Configure breakpoint event listeners for the target.

Better to add a:
```
void VSCode::SetTarget(lldb::SBTarget target)
```
and this to that function



Comment at: lldb/tools/lldb-vscode/lldb-vscode.cpp:539
+  lldb::SBError status;
+  g_vsc.target = g_vsc.debugger.CreateTarget(
+program.data(),

Add a SetTarget() to the g_vsc struct definition and do the breakpoint 
listening there if the target is valid?



Comment at: lldb/tools/lldb-vscode/lldb-vscode.cpp:562
 
+  AddBreakpointListener(g_vsc);
+

Move to VSCode::SetTarget(lldb::SBTarget) function to avoid having to do this 
in two functions.



Comment at: lldb/tools/lldb-vscode/lldb-vscode.cpp:1408
+  lldb::SBError status;
+  g_vsc.target = g_vsc.debugger.CreateTarget(
+program.data(),

call g_vsc.SetTarget(g_vsc.debugger.CreateTarget(...))



Comment at: lldb/tools/lldb-vscode/lldb-vscode.cpp:1431
+
+  AddBreakpointListener(g_vsc);
+

This will be in VSCode::SetTarget, remove.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70847



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


[Lldb-commits] [PATCH] D73665: Stop emitting a breakpoint for each location in a breakpoint when responding to breakpoint commands.

2020-02-11 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Friendly ping.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73665



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


[Lldb-commits] [lldb] 2d3ecad - [lldb/Plugins] Move PlatformRemoteiOS into PlatformMacOSX (NFCI)

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

Author: Jonas Devlieghere
Date: 2020-02-11T15:54:36-08:00
New Revision: 2d3ecade3892fb0d0713350e06522a94734733b7

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

LOG: [lldb/Plugins] Move PlatformRemoteiOS into PlatformMacOSX (NFCI)

Move the logic for initialization and termination for PlatformRemoteiOS
into PlatformMacOSX, like we did for the other Darwin platforms in
a731c6ba94d0464c6a122de1af70ab88ffb5c1a6.

Added: 


Modified: 
lldb/source/API/SystemInitializerFull.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
lldb/tools/lldb-test/SystemInitializerTest.cpp

Removed: 




diff  --git a/lldb/source/API/SystemInitializerFull.cpp 
b/lldb/source/API/SystemInitializerFull.cpp
index b14a9a2ccd28..cde820bbb76b 100644
--- a/lldb/source/API/SystemInitializerFull.cpp
+++ b/lldb/source/API/SystemInitializerFull.cpp
@@ -60,7 +60,6 @@ LLDB_PLUGIN_DECLARE(PlatformNetBSD);
 LLDB_PLUGIN_DECLARE(PlatformOpenBSD);
 LLDB_PLUGIN_DECLARE(PlatformWindows);
 LLDB_PLUGIN_DECLARE(PlatformAndroid);
-LLDB_PLUGIN_DECLARE(PlatformRemoteiOS);
 LLDB_PLUGIN_DECLARE(PlatformMacOSX);
 LLDB_PLUGIN_DECLARE(TypeSystemClang);
 LLDB_PLUGIN_DECLARE(ArchitectureArm);
@@ -187,7 +186,6 @@ llvm::Error SystemInitializerFull::Initialize() {
   LLDB_PLUGIN_INITIALIZE(PlatformOpenBSD);
   LLDB_PLUGIN_INITIALIZE(PlatformWindows);
   LLDB_PLUGIN_INITIALIZE(PlatformAndroid);
-  LLDB_PLUGIN_INITIALIZE(PlatformRemoteiOS);
   LLDB_PLUGIN_INITIALIZE(PlatformMacOSX);
 
   // Initialize LLVM and Clang
@@ -363,7 +361,6 @@ void SystemInitializerFull::Terminate() {
   LLDB_PLUGIN_TERMINATE(PlatformOpenBSD);
   LLDB_PLUGIN_TERMINATE(PlatformWindows);
   LLDB_PLUGIN_TERMINATE(PlatformAndroid);
-  LLDB_PLUGIN_TERMINATE(PlatformRemoteiOS);
   LLDB_PLUGIN_TERMINATE(PlatformMacOSX);
 
   LLDB_PLUGIN_TERMINATE(ObjectFileBreakpad);

diff  --git a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp 
b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
index 6cf96eded7aa..c62940f35e5c 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
@@ -7,6 +7,7 @@
 
//===--===//
 
 #include "PlatformMacOSX.h"
+#include "PlatformRemoteiOS.h"
 #if defined(__APPLE__)
 #include "PlatformAppleTVSimulator.h"
 #include "PlatformAppleWatchSimulator.h"
@@ -44,6 +45,7 @@ static uint32_t g_initialize_count = 0;
 
 void PlatformMacOSX::Initialize() {
   PlatformDarwin::Initialize();
+  PlatformRemoteiOS::Initialize();
 #if defined(__APPLE__)
   PlatformiOSSimulator::Initialize();
   PlatformDarwinKernel::Initialize();
@@ -82,6 +84,7 @@ void PlatformMacOSX::Terminate() {
   PlatformDarwinKernel::Terminate();
   PlatformiOSSimulator::Terminate();
 #endif
+  PlatformRemoteiOS::Terminate();
   PlatformDarwin::Terminate();
 }
 

diff  --git a/lldb/tools/lldb-test/SystemInitializerTest.cpp 
b/lldb/tools/lldb-test/SystemInitializerTest.cpp
index 3d8c80db5500..a9b4ba67c2ca 100644
--- a/lldb/tools/lldb-test/SystemInitializerTest.cpp
+++ b/lldb/tools/lldb-test/SystemInitializerTest.cpp
@@ -46,7 +46,6 @@ LLDB_PLUGIN_DECLARE(PlatformNetBSD);
 LLDB_PLUGIN_DECLARE(PlatformOpenBSD);
 LLDB_PLUGIN_DECLARE(PlatformWindows);
 LLDB_PLUGIN_DECLARE(PlatformAndroid);
-LLDB_PLUGIN_DECLARE(PlatformRemoteiOS);
 LLDB_PLUGIN_DECLARE(PlatformMacOSX);
 LLDB_PLUGIN_DECLARE(TypeSystemClang);
 LLDB_PLUGIN_DECLARE(ArchitectureArm);
@@ -162,7 +161,6 @@ llvm::Error SystemInitializerTest::Initialize() {
   LLDB_PLUGIN_INITIALIZE(PlatformOpenBSD);
   LLDB_PLUGIN_INITIALIZE(PlatformWindows);
   LLDB_PLUGIN_INITIALIZE(PlatformAndroid);
-  LLDB_PLUGIN_INITIALIZE(PlatformRemoteiOS);
   LLDB_PLUGIN_INITIALIZE(PlatformMacOSX);
 
   // Initialize LLVM and Clang
@@ -338,7 +336,6 @@ void SystemInitializerTest::Terminate() {
   LLDB_PLUGIN_TERMINATE(PlatformOpenBSD);
   LLDB_PLUGIN_TERMINATE(PlatformWindows);
   LLDB_PLUGIN_TERMINATE(PlatformAndroid);
-  LLDB_PLUGIN_TERMINATE(PlatformRemoteiOS);
   LLDB_PLUGIN_TERMINATE(PlatformMacOSX);
 
   LLDB_PLUGIN_TERMINATE(ObjectFileBreakpad);



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


[Lldb-commits] [lldb] f9fdd11 - Rewrite default "could not attach" msg to point to hints

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

Author: Jason Molenda
Date: 2020-02-11T16:18:49-08:00
New Revision: f9fdd1172c8b326126463f1efcfee721e5222334

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

LOG: Rewrite default "could not attach" msg to point to hints
about where more information can be found about why it
may have failed.


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 87aca91c00c4..8eed06381d3a 100644
--- a/lldb/tools/debugserver/source/RNBRemote.cpp
+++ b/lldb/tools/debugserver/source/RNBRemote.cpp
@@ -4076,6 +4076,16 @@ rnb_err_t RNBRemote::HandlePacket_v(const char *p) {
 
   std::string error_explainer = "attach failed";
   if (err_str[0] != '\0') {
+// This is not a super helpful message for end users
+if (strcmp (err_str, "unable to start the exception thread") == 0) {
+  snprintf (err_str, sizeof (err_str) - 1,
+"Not allowed to attach to process.  Look in the console "
+"messages (Console.app), near the debugserver entries "
+"when the attached failed.  The subsystem that denied "
+"the attach permission will likely have logged an "
+"informative message about why it was denied.");
+  err_str[sizeof (err_str) - 1] = '\0';
+}
 error_explainer += " (";
 error_explainer += err_str;
 error_explainer += ")";



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


[Lldb-commits] [lldb] 413307d - [lldb/Plugins] Rename OSPython plugin to OperatingSystemPython (NFC)

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

Author: Jonas Devlieghere
Date: 2020-02-11T16:32:08-08:00
New Revision: 413307d4560441b47261ced5db5f8e29c8811277

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

LOG: [lldb/Plugins] Rename OSPython plugin to OperatingSystemPython (NFC)

Rename the plugin to match both the directory structure and the class.

Added: 


Modified: 
lldb/source/Plugins/OperatingSystem/Python/CMakeLists.txt

Removed: 




diff  --git a/lldb/source/Plugins/OperatingSystem/Python/CMakeLists.txt 
b/lldb/source/Plugins/OperatingSystem/Python/CMakeLists.txt
index e8b0f31d3736..91d7901011bc 100644
--- a/lldb/source/Plugins/OperatingSystem/Python/CMakeLists.txt
+++ b/lldb/source/Plugins/OperatingSystem/Python/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_lldb_library(lldbPluginOSPython PLUGIN
+add_lldb_library(lldbPluginOperatingSystemPython PLUGIN
   OperatingSystemPython.cpp
 
   LINK_LIBS



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


[Lldb-commits] [PATCH] D74451: [lldb/Plugins] Have one initializer per ABI plugin

2020-02-11 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added a reviewer: labath.
Herald added subscribers: jsji, abidh, atanasyan, mgorny, nemanjai, sdardis.
Herald added a project: LLDB.

After the recent change that grouped some of the ABI plugins together, those 
plugins ended up with multiple initializers per plugin. This is incompatible 
with my proposed approach of generating the initializers dynamically, which is 
why I've grouped them together in a new entry point.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D74451

Files:
  lldb/source/API/SystemInitializerFull.cpp
  lldb/source/Plugins/ABI/AArch64/AArch64.cpp
  lldb/source/Plugins/ABI/AArch64/AArch64.h
  lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
  lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp
  lldb/source/Plugins/ABI/AArch64/CMakeLists.txt
  lldb/source/Plugins/ABI/ARM/ARM.cpp
  lldb/source/Plugins/ABI/ARM/ARM.h
  lldb/source/Plugins/ABI/ARM/CMakeLists.txt
  lldb/source/Plugins/ABI/Mips/CMakeLists.txt
  lldb/source/Plugins/ABI/Mips/Mips.cpp
  lldb/source/Plugins/ABI/Mips/Mips.h
  lldb/source/Plugins/ABI/PowerPC/CMakeLists.txt
  lldb/source/Plugins/ABI/PowerPC/PowerPC.cpp
  lldb/source/Plugins/ABI/PowerPC/PowerPC.h
  lldb/source/Plugins/ABI/X86/CMakeLists.txt
  lldb/source/Plugins/ABI/X86/X86.cpp
  lldb/source/Plugins/ABI/X86/X86.h

Index: lldb/source/Plugins/ABI/X86/X86.h
===
--- /dev/null
+++ lldb/source/Plugins/ABI/X86/X86.h
@@ -0,0 +1,17 @@
+//===-- X86.h ---*- C++ -*-===//
+//
+// 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
+//
+//===--===//
+
+#ifndef liblldb_ABIX86_h_
+#define liblldb_ABIX86_h_
+
+class ABIX86 {
+public:
+  static void Initialize();
+  static void Terminate();
+};
+#endif
Index: lldb/source/Plugins/ABI/X86/X86.cpp
===
--- /dev/null
+++ lldb/source/Plugins/ABI/X86/X86.cpp
@@ -0,0 +1,30 @@
+//===-- X86.h -===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "X86.h"
+#include "ABIMacOSX_i386.h"
+#include "ABISysV_i386.h"
+#include "ABISysV_x86_64.h"
+#include "ABIWindows_x86_64.h"
+#include "lldb/Core/PluginManager.h"
+
+LLDB_PLUGIN(ABIX86)
+
+void ABIX86::Initialize() {
+  ABIMacOSX_i386::Initialize();
+  ABISysV_i386::Initialize();
+  ABISysV_x86_64::Initialize();
+  ABIWindows_x86_64::Initialize();
+}
+
+void ABIX86::Terminate() {
+  ABIMacOSX_i386::Terminate();
+  ABISysV_i386::Terminate();
+  ABISysV_x86_64::Terminate();
+  ABIWindows_x86_64::Terminate();
+}
Index: lldb/source/Plugins/ABI/X86/CMakeLists.txt
===
--- lldb/source/Plugins/ABI/X86/CMakeLists.txt
+++ lldb/source/Plugins/ABI/X86/CMakeLists.txt
@@ -1,4 +1,5 @@
 add_lldb_library(lldbPluginABIX86 PLUGIN
+  X86.cpp
   ABIMacOSX_i386.cpp
   ABISysV_i386.cpp
   ABISysV_x86_64.cpp
Index: lldb/source/Plugins/ABI/PowerPC/PowerPC.h
===
--- /dev/null
+++ lldb/source/Plugins/ABI/PowerPC/PowerPC.h
@@ -0,0 +1,17 @@
+//===-- PowerPC.h ---*- C++ -*-===//
+//
+// 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
+//
+//===--===//
+
+#ifndef liblldb_ABIPowerPC_h_
+#define liblldb_ABIPowerPC_h_
+
+class ABIPowerPC {
+public:
+  static void Initialize();
+  static void Terminate();
+};
+#endif
Index: lldb/source/Plugins/ABI/PowerPC/PowerPC.cpp
===
--- /dev/null
+++ lldb/source/Plugins/ABI/PowerPC/PowerPC.cpp
@@ -0,0 +1,24 @@
+//===-- PowerPC.h -===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "PowerPC.h"
+#include "ABISysV_ppc.h"
+#include "ABISysV_ppc64.h"
+#include "lldb/Core/PluginManager.h"
+
+LLDB_PLUGIN(ABIPowerPC)
+
+void ABIPowerPC::Initialize() {
+  ABISysV_ppc::Initialize();
+  ABISysV_ppc64

[Lldb-commits] [lldb] d797e33 - [TestConstVariable] Clean-up XFAIL lists.

2020-02-11 Thread Davide Italiano via lldb-commits

Author: Davide Italiano
Date: 2020-02-11T20:31:09-08:00
New Revision: d797e33cc083c186103e0cb9aeb016913b96fd08

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

LOG: [TestConstVariable] Clean-up XFAIL lists.

These versions of `clang` are ancient history.

Added: 


Modified: 
lldb/test/API/lang/c/const_variables/TestConstVariables.py

Removed: 




diff  --git a/lldb/test/API/lang/c/const_variables/TestConstVariables.py 
b/lldb/test/API/lang/c/const_variables/TestConstVariables.py
index 59fa6bcb0a1b..2cc94369f38d 100644
--- a/lldb/test/API/lang/c/const_variables/TestConstVariables.py
+++ b/lldb/test/API/lang/c/const_variables/TestConstVariables.py
@@ -12,15 +12,6 @@ class ConstVariableTestCase(TestBase):
 
 mydir = TestBase.compute_mydir(__file__)
 
-@expectedFailureAll(
-oslist=["freebsd", "linux"],
-compiler="clang", compiler_version=["<", "3.5"])
-@expectedFailureAll(
-oslist=["freebsd", "linux"],
-compiler="clang", compiler_version=["=", "3.7"])
-@expectedFailureAll(
-oslist=["freebsd", "linux"],
-compiler="clang", compiler_version=["=", "3.8"])
 @expectedFailureAll(oslist=["freebsd", "linux"], compiler="icc")
 @expectedFailureAll(archs=['mips', 'mipsel', 'mips64', 'mips64el'])
 @expectedFailureAll(



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


[Lldb-commits] [lldb] 346cb7b - [lldb] Remove skipIfFreeBSD from TestCompletion

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

Author: Raphael Isemann
Date: 2020-02-12T07:14:46+01:00
New Revision: 346cb7b50f7f892b33b46313742eef86bfde7943

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

LOG: [lldb] Remove skipIfFreeBSD from TestCompletion

This was skipped because of an pexpect issue (http://llvm.org/pr22784),
but this test is no longer using pexpect and is running fine on FreeBSD.

Added: 


Modified: 
lldb/test/API/functionalities/completion/TestCompletion.py

Removed: 




diff  --git a/lldb/test/API/functionalities/completion/TestCompletion.py 
b/lldb/test/API/functionalities/completion/TestCompletion.py
index 538c626d60fd..9e15b5d3f557 100644
--- a/lldb/test/API/functionalities/completion/TestCompletion.py
+++ b/lldb/test/API/functionalities/completion/TestCompletion.py
@@ -27,17 +27,14 @@ def classCleanup(cls):
 except:
 pass
 
-@skipIfFreeBSD  # timing out on the FreeBSD buildbot
 def test_at(self):
 """Test that 'at' completes to 'attach '."""
 self.complete_from_to('at', 'attach ')
 
-@skipIfFreeBSD  # timing out on the FreeBSD buildbot
 def test_de(self):
 """Test that 'de' completes to 'detach '."""
 self.complete_from_to('de', 'detach ')
 
-@skipIfFreeBSD  # timing out on the FreeBSD buildbot
 def test_frame_variable(self):
 self.build()
 self.main_source = "main.cpp"
@@ -76,95 +73,79 @@ def test_frame_variable(self):
 self.complete_from_to('frame variable ptr_container->Mem',
   'frame variable ptr_container->MemberVar')
 
-@skipIfFreeBSD  # timing out on the FreeBSD buildbot
 def test_process_attach_dash_dash_con(self):
 """Test that 'process attach --con' completes to 'process attach 
--continue '."""
 self.complete_from_to(
 'process attach --con',
 'process attach --continue ')
 
-@skipIfFreeBSD  # timing out on the FreeBSD buildbot
 def test_process_launch_arch(self):
 self.complete_from_to('process launch --arch ',
   ['mips',
'arm64'])
 
-@skipIfFreeBSD  # timing out on the FreeBSD buildbot
 def test_ambiguous_long_opt(self):
 self.completions_match('breakpoint modify --th',
['--thread-id',
 '--thread-index',
 '--thread-name'])
 
-@skipIfFreeBSD  # timing out on the FreeBSD buildbot
 def test_plugin_load(self):
 self.complete_from_to('plugin load ', [])
 
-@skipIfFreeBSD  # timing out on the FreeBSD buildbot
 def test_log_enable(self):
 self.complete_from_to('log enable ll', ['lldb'])
 self.complete_from_to('log enable dw', ['dwarf'])
 self.complete_from_to('log enable lldb al', ['all'])
 self.complete_from_to('log enable lldb sym', ['symbol'])
 
-@skipIfFreeBSD  # timing out on the FreeBSD buildbot
 def test_log_enable(self):
 self.complete_from_to('log disable ll', ['lldb'])
 self.complete_from_to('log disable dw', ['dwarf'])
 self.complete_from_to('log disable lldb al', ['all'])
 self.complete_from_to('log disable lldb sym', ['symbol'])
 
-@skipIfFreeBSD  # timing out on the FreeBSD buildbot
 def test_log_list(self):
 self.complete_from_to('log list ll', ['lldb'])
 self.complete_from_to('log list dw', ['dwarf'])
 self.complete_from_to('log list ll', ['lldb'])
 self.complete_from_to('log list lldb dwa', ['dwarf'])
 
-@skipIfFreeBSD  # timing out on the FreeBSD buildbot
 def test_quoted_command(self):
 self.complete_from_to('"set',
   ['"settings" '])
 
-@skipIfFreeBSD  # timing out on the FreeBSD buildbot
 def test_quoted_arg_with_quoted_command(self):
 self.complete_from_to('"settings" "repl',
   ['"replace" '])
 
-@skipIfFreeBSD  # timing out on the FreeBSD buildbot
 def test_quoted_arg_without_quoted_command(self):
 self.complete_from_to('settings "repl',
   ['"replace" '])
 
-@skipIfFreeBSD  # timing out on the FreeBSD buildbot
 def test_single_quote_command(self):
 self.complete_from_to("'set",
   ["'settings' "])
 
-@skipIfFreeBSD  # timing out on the FreeBSD buildbot
 def test_terminated_quote_command(self):
 # This should not crash, but we don't get any
 # reasonable completions from this.
 self.complete_from_to("'settings'", [])
 
-@skipIfFreeBSD  # timing out on the FreeBSD buildbot
 def test_process_launch_arch_arm(self):
 self.complete_from_to('process launch

[Lldb-commits] [lldb] 477c090 - [lldb][NFC] Remove eCustomCompletion mode

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

Author: Raphael Isemann
Date: 2020-02-12T08:34:02+01:00
New Revision: 477c09043e654bc154fce6e6b013f8f91fb96f05

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

LOG: [lldb][NFC] Remove eCustomCompletion mode

It's not used by anyone. Also if something implements its own
completion it could just not call the method instead of having
a parameter that makes the function a no-op.

Added: 


Modified: 
lldb/source/Commands/CommandCompletions.cpp

Removed: 




diff  --git a/lldb/source/Commands/CommandCompletions.cpp 
b/lldb/source/Commands/CommandCompletions.cpp
index 2ced56f90178..0e35e0d1123f 100644
--- a/lldb/source/Commands/CommandCompletions.cpp
+++ b/lldb/source/Commands/CommandCompletions.cpp
@@ -29,7 +29,6 @@ using namespace lldb_private;
 
 CommandCompletions::CommonCompletionElement
 CommandCompletions::g_common_completions[] = {
-{eCustomCompletion, nullptr},
 {eSourceFileCompletion, CommandCompletions::SourceFiles},
 {eDiskFileCompletion, CommandCompletions::DiskFiles},
 {eDiskDirectoryCompletion, CommandCompletions::DiskDirectories},
@@ -47,9 +46,6 @@ bool CommandCompletions::InvokeCommonCompletionCallbacks(
 CompletionRequest &request, SearchFilter *searcher) {
   bool handled = false;
 
-  if (completion_mask & eCustomCompletion)
-return false;
-
   for (int i = 0;; i++) {
 if (g_common_completions[i].type == eNoCompletion)
   break;



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