[Lldb-commits] [lldb] r336235 - Ammend "Fix MSVC2015 compilation failure after r336206 patch".

2018-07-03 Thread Alexander Polyakov via lldb-commits
Author: apolyakov
Date: Tue Jul  3 15:51:01 2018
New Revision: 336235

URL: http://llvm.org/viewvc/llvm-project?rev=336235=rev
Log:
Ammend "Fix MSVC2015 compilation failure after r336206 patch".

Modified:
lldb/trunk/tools/lldb-mi/MICmdCmdSymbol.cpp

Modified: lldb/trunk/tools/lldb-mi/MICmdCmdSymbol.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdSymbol.cpp?rev=336235=336234=336235=diff
==
--- lldb/trunk/tools/lldb-mi/MICmdCmdSymbol.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmdCmdSymbol.cpp Tue Jul  3 15:51:01 2018
@@ -39,6 +39,8 @@ CreateMITuplePCLine(const uint32_t addr,
 }
 } // namespace
 
+using namespace lldb; // For operator==(const SBAddress &, const SBAddress &).
+
 //++
 
//
 // Details: CMICmdCmdSymbolListLines constructor.


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


[Lldb-commits] [PATCH] D48782: LLDB Test Suite: Provide an Option to run all tests with Dwarf Package Format (DWP).

2018-07-03 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil added inline comments.



Comment at: packages/Python/lldbsuite/test/make/Makefile.rules:520
 $(EXE) : $(OBJECTS) $(ARCHIVE_NAME) $(DYLIB_FILENAME)
$(LD) $(OBJECTS) $(ARCHIVE_NAME) -L. -l$(DYLIB_NAME) $(LDFLAGS) -o 
"$(EXE)"
 else

Shouldn't be $(LLVM_DWP) even here? DWZ mode has its command even here.



Comment at: packages/Python/lldbsuite/test/make/Makefile.rules:546
$(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DSYM)" "$(EXE)" "$(EXE)"
 endif
 endif

Shouldn't be $(LLVM_DWP) even here? DWZ mode has its command even here.


https://reviews.llvm.org/D48782



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


[Lldb-commits] [PATCH] D48782: LLDB Test Suite: Provide an Option to run all tests with Dwarf Package Format (DWP).

2018-07-03 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil added a comment.

The DWZ-testmode Makefile.rules part. 

The DWZ-mode is written as another test matrix dimension.  Compared to this 
DWP-mode it autodetects if all the tools are available on the host for that 
testsuite mode.
I agree that some `EXPENSIVE_CHECKS` would be appropriate for both DWZ and DWP 
as general LLVM/LLDB development should not break only specifically these modes.
I do not think it matters whether there is an external wrapper script or 
whether the commands are specified as a Makefile rule/macro, sure I will adapt 
it if anyone requests an external command.


https://reviews.llvm.org/D48782



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


[Lldb-commits] [PATCH] D40475: DWZ 06/07: DWZ test mode

2018-07-03 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil updated this revision to Diff 153942.

https://reviews.llvm.org/D40475

Files:
  packages/Python/lldbsuite/test/dotest.py
  packages/Python/lldbsuite/test/lldbinline.py
  packages/Python/lldbsuite/test/lldbtest.py
  packages/Python/lldbsuite/test/make/Makefile.rules
  packages/Python/lldbsuite/test/plugins/builder_base.py
  packages/Python/lldbsuite/test/test_categories.py
  unittests/SymbolFile/CMakeLists.txt
  unittests/SymbolFile/DWZ/CMakeLists.txt
  unittests/SymbolFile/DWZ/Inputs/dwztest.c
  unittests/SymbolFile/DWZ/Inputs/dwztest.debug
  unittests/SymbolFile/DWZ/Inputs/dwztest.debug.dwz
  unittests/SymbolFile/DWZ/Inputs/dwztest.out
  unittests/SymbolFile/DWZ/SymbolFileDWZTests.cpp

Index: unittests/SymbolFile/DWZ/SymbolFileDWZTests.cpp
===
--- /dev/null
+++ unittests/SymbolFile/DWZ/SymbolFileDWZTests.cpp
@@ -0,0 +1,89 @@
+//===-- SymbolFileDWZTests.cpp --*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "gtest/gtest.h"
+
+#include "TestingSupport/TestUtilities.h"
+
+#include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h"
+#include "Plugins/ObjectFile/ELF/ObjectFileELF.h"
+#include "Plugins/SymbolVendor/ELF/SymbolVendorELF.h"
+#include "lldb/Core/Module.h"
+#include "lldb/Host/HostInfo.h"
+#include "lldb/Symbol/ClangASTContext.h"
+#include "lldb/Symbol/SymbolVendor.h"
+#include "lldb/Utility/ArchSpec.h"
+#include "lldb/Utility/FileSpec.h"
+
+#if defined(_MSC_VER)
+#include "lldb/Host/windows/windows.h"
+#include 
+#endif
+
+#include 
+
+using namespace lldb_private;
+
+class SymbolFileDWZTests : public testing::Test {
+public:
+  void SetUp() override {
+// Initialize and TearDown the plugin every time, so we get a brand new
+// AST every time so that modifications to the AST from each test don't
+// leak into the next test.
+#if defined(_MSC_VER)
+::CoInitializeEx(nullptr, COINIT_MULTITHREADED);
+#endif
+
+HostInfo::Initialize();
+SymbolFileDWARF::Initialize();
+ClangASTContext::Initialize();
+ObjectFileELF::Initialize();
+SymbolVendorELF::Initialize();
+
+m_dwztest_out = GetInputFilePath("dwztest.out");
+  }
+
+  void TearDown() override {
+SymbolVendorELF::Terminate();
+ObjectFileELF::Terminate();
+ClangASTContext::Terminate();
+SymbolFileDWARF::Terminate();
+HostInfo::Terminate();
+
+#if defined(_MSC_VER)
+::CoUninitialize();
+#endif
+  }
+
+protected:
+  std::string m_dwztest_out;
+};
+
+TEST_F(SymbolFileDWZTests, TestSimpleClassTypes) {
+  FileSpec fspec(m_dwztest_out.c_str(), false);
+  ArchSpec aspec("x86_64-pc-linux");
+  lldb::ModuleSP module = std::make_shared(fspec, aspec);
+
+  SymbolVendor *plugin = module->GetSymbolVendor();
+  EXPECT_NE(nullptr, plugin);
+  SymbolFile *symfile = plugin->GetSymbolFile();
+  EXPECT_NE(nullptr, symfile);
+  EXPECT_EQ(symfile->GetPluginName(), SymbolFileDWARF::GetPluginNameStatic());
+  SymbolContext sc;
+  llvm::DenseSet searched_files;
+  TypeMap results;
+  EXPECT_EQ(1u,
+  symfile->FindTypes(sc, ConstString("StructMovedToDWZCommonFile"), nullptr,
+  false, 0, searched_files, results));
+  EXPECT_EQ(1u, results.GetSize());
+  lldb::TypeSP udt_type = results.GetTypeAtIndex(0);
+  EXPECT_EQ(ConstString("StructMovedToDWZCommonFile"), udt_type->GetName());
+  CompilerType compiler_type = udt_type->GetForwardCompilerType();
+  EXPECT_TRUE(ClangASTContext::IsClassType(compiler_type.GetOpaqueQualType()));
+}
Index: unittests/SymbolFile/DWZ/Inputs/dwztest.c
===
--- /dev/null
+++ unittests/SymbolFile/DWZ/Inputs/dwztest.c
@@ -0,0 +1,9 @@
+// gcc -Wall -g -o dwztest.out dwztest.c; eu-strip --remove-comment -f dwztest.debug dwztest.out; cp -p dwztest.debug dwztest.debug.dup; dwz -m dwztest.debug.dwz dwztest.debug dwztest.debug.dup;rm dwztest.debug.dup; /usr/lib/rpm/sepdebugcrcfix . dwztest.out 
+
+struct StructMovedToDWZCommonFile {
+  int i1, i2, i3, i4, i5, i6, i7, i8, i9;
+} VarWithStructMovedToDWZCommonFile;
+static const int sizeof_StructMovedToDWZCommonFile = sizeof(struct StructMovedToDWZCommonFile);
+int main() {
+  return sizeof_StructMovedToDWZCommonFile;
+}
Index: unittests/SymbolFile/DWZ/CMakeLists.txt
===
--- /dev/null
+++ unittests/SymbolFile/DWZ/CMakeLists.txt
@@ -0,0 +1,21 @@
+add_lldb_unittest(SymbolFileDWZTests
+  SymbolFileDWZTests.cpp
+
+  LINK_LIBS
+lldbCore
+lldbHost
+lldbSymbol
+lldbPluginSymbolFileDWARF
+lldbUtilityHelpers
+lldbPluginObjectFileELF
+lldbPluginSymbolVendorELF
+  LINK_COMPONENTS
+Support
+  )
+
+set(test_inputs
+   dwztest.out
+   dwztest.debug
+   

[Lldb-commits] [PATCH] D40475: DWZ 06/07: DWZ test mode

2018-07-03 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil updated this revision to Diff 153941.

https://reviews.llvm.org/D40475

Files:
  packages/Python/lldbsuite/test/dotest.py
  packages/Python/lldbsuite/test/lldbinline.py
  packages/Python/lldbsuite/test/lldbtest.py
  packages/Python/lldbsuite/test/make/Makefile.rules
  packages/Python/lldbsuite/test/plugins/builder_base.py
  packages/Python/lldbsuite/test/test_categories.py
  unittests/SymbolFile/CMakeLists.txt
  unittests/SymbolFile/DWZ/CMakeLists.txt
  unittests/SymbolFile/DWZ/Inputs/dwztest.c
  unittests/SymbolFile/DWZ/Inputs/dwztest.debug
  unittests/SymbolFile/DWZ/Inputs/dwztest.debug.dwz
  unittests/SymbolFile/DWZ/Inputs/dwztest.out
  unittests/SymbolFile/DWZ/SymbolFileDWZTests.cpp

Index: unittests/SymbolFile/DWZ/SymbolFileDWZTests.cpp
===
--- /dev/null
+++ unittests/SymbolFile/DWZ/SymbolFileDWZTests.cpp
@@ -0,0 +1,89 @@
+//===-- SymbolFileDWZTests.cpp --*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "gtest/gtest.h"
+
+#include "TestingSupport/TestUtilities.h"
+
+#include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h"
+#include "Plugins/ObjectFile/ELF/ObjectFileELF.h"
+#include "Plugins/SymbolVendor/ELF/SymbolVendorELF.h"
+#include "lldb/Core/Module.h"
+#include "lldb/Host/HostInfo.h"
+#include "lldb/Symbol/ClangASTContext.h"
+#include "lldb/Symbol/SymbolVendor.h"
+#include "lldb/Utility/ArchSpec.h"
+#include "lldb/Utility/FileSpec.h"
+
+#if defined(_MSC_VER)
+#include "lldb/Host/windows/windows.h"
+#include 
+#endif
+
+#include 
+
+using namespace lldb_private;
+
+class SymbolFileDWZTests : public testing::Test {
+public:
+  void SetUp() override {
+// Initialize and TearDown the plugin every time, so we get a brand new
+// AST every time so that modifications to the AST from each test don't
+// leak into the next test.
+#if defined(_MSC_VER)
+::CoInitializeEx(nullptr, COINIT_MULTITHREADED);
+#endif
+
+HostInfo::Initialize();
+SymbolFileDWARF::Initialize();
+ClangASTContext::Initialize();
+ObjectFileELF::Initialize();
+SymbolVendorELF::Initialize();
+
+m_dwztest_out = GetInputFilePath("dwztest.out");
+  }
+
+  void TearDown() override {
+SymbolVendorELF::Terminate();
+ObjectFileELF::Terminate();
+ClangASTContext::Terminate();
+SymbolFileDWARF::Terminate();
+HostInfo::Terminate();
+
+#if defined(_MSC_VER)
+::CoUninitialize();
+#endif
+  }
+
+protected:
+  std::string m_dwztest_out;
+};
+
+TEST_F(SymbolFileDWZTests, TestSimpleClassTypes) {
+  FileSpec fspec(m_dwztest_out.c_str(), false);
+  ArchSpec aspec("x86_64-pc-linux");
+  lldb::ModuleSP module = std::make_shared(fspec, aspec);
+
+  SymbolVendor *plugin = module->GetSymbolVendor();
+  EXPECT_NE(nullptr, plugin);
+  SymbolFile *symfile = plugin->GetSymbolFile();
+  EXPECT_NE(nullptr, symfile);
+  EXPECT_EQ(symfile->GetPluginName(), SymbolFileDWARF::GetPluginNameStatic());
+  SymbolContext sc;
+  llvm::DenseSet searched_files;
+  TypeMap results;
+  EXPECT_EQ(1u,
+  symfile->FindTypes(sc, ConstString("StructMovedToDWZCommonFile"), nullptr,
+  false, 0, searched_files, results));
+  EXPECT_EQ(1u, results.GetSize());
+  lldb::TypeSP udt_type = results.GetTypeAtIndex(0);
+  EXPECT_EQ(ConstString("StructMovedToDWZCommonFile"), udt_type->GetName());
+  CompilerType compiler_type = udt_type->GetForwardCompilerType();
+  EXPECT_TRUE(ClangASTContext::IsClassType(compiler_type.GetOpaqueQualType()));
+}
Index: unittests/SymbolFile/DWZ/Inputs/dwztest.c
===
--- /dev/null
+++ unittests/SymbolFile/DWZ/Inputs/dwztest.c
@@ -0,0 +1,9 @@
+// gcc -Wall -g -o dwztest.out dwztest.c; eu-strip --remove-comment -f dwztest.debug dwztest.out; cp -p dwztest.debug dwztest.debug.dup; dwz -m dwztest.debug.dwz dwztest.debug dwztest.debug.dup;rm dwztest.debug.dup; /usr/lib/rpm/sepdebugcrcfix . dwztest.out 
+
+struct StructMovedToDWZCommonFile {
+  int i1, i2, i3, i4, i5, i6, i7, i8, i9;
+} VarWithStructMovedToDWZCommonFile;
+static const int sizeof_StructMovedToDWZCommonFile = sizeof(struct StructMovedToDWZCommonFile);
+int main() {
+  return sizeof_StructMovedToDWZCommonFile;
+}
Index: unittests/SymbolFile/DWZ/CMakeLists.txt
===
--- /dev/null
+++ unittests/SymbolFile/DWZ/CMakeLists.txt
@@ -0,0 +1,21 @@
+add_lldb_unittest(SymbolFileDWZTests
+  SymbolFileDWZTests.cpp
+
+  LINK_LIBS
+lldbCore
+lldbHost
+lldbSymbol
+lldbPluginSymbolFileDWARF
+lldbUtilityHelpers
+lldbPluginObjectFileELF
+lldbPluginSymbolVendorELF
+  LINK_COMPONENTS
+Support
+  )
+
+set(test_inputs
+   dwztest.out
+   dwztest.debug
+   

[Lldb-commits] [PATCH] D48865: [LLDB] CommandObjectThreadUntil::DoExecute() sets the wrong selected thread ID

2018-07-03 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

This is correct, thanks for catching it!

There are a few other places that use m_thread_idx above this change.  
Everything after the:

  if (thread == nullptr) {

check should also use thread->GetID not m_options.m_thread_idx.  This is all 
error reporting, so it's not a big deal.  But having the error be "failed to 
resolve line table for frame 5 of thread 4294967295" would be confusing.  Could 
you change those uses as well?


https://reviews.llvm.org/D48865



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


[Lldb-commits] [lldb] r336212 - Fix MSVC2015 compilation failure after r336206 patch.

2018-07-03 Thread Alexander Polyakov via lldb-commits
Author: apolyakov
Date: Tue Jul  3 09:07:30 2018
New Revision: 336212

URL: http://llvm.org/viewvc/llvm-project?rev=336212=rev
Log:
Fix MSVC2015 compilation failure after r336206 patch.

Added missing headers.

Modified:
lldb/trunk/tools/lldb-mi/MICmdCmdSymbol.cpp

Modified: lldb/trunk/tools/lldb-mi/MICmdCmdSymbol.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdSymbol.cpp?rev=336212=336211=336212=diff
==
--- lldb/trunk/tools/lldb-mi/MICmdCmdSymbol.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmdCmdSymbol.cpp Tue Jul  3 09:07:30 2018
@@ -11,6 +11,12 @@
 
 // Third Party Headers:
 #include "llvm/ADT/Twine.h"
+#include "lldb/API/SBAddress.h"
+#include "lldb/API/SBLineEntry.h"
+#include "lldb/API/SBFileSpec.h"
+#include "lldb/API/SBCompileUnit.h"
+#include "lldb/API/SBSymbolContext.h"
+#include "lldb/API/SBSymbolContextList.h"
 
 // In-house headers:
 #include "MICmdArgValFile.h"


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


[Lldb-commits] [PATCH] D48802: [lldb-mi] Re-implement symbol-list-lines command.

2018-07-03 Thread Alexander Polyakov via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL336206: [lldb-mi] Re-implement symbol-list-lines command. 
(authored by apolyakov, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D48802?vs=153847=153922#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D48802

Files:
  lldb/trunk/lit/tools/lldb-mi/symbol/inputs/list-lines-helper.c
  lldb/trunk/lit/tools/lldb-mi/symbol/inputs/list-lines-helper.h
  lldb/trunk/lit/tools/lldb-mi/symbol/inputs/main.c
  lldb/trunk/lit/tools/lldb-mi/symbol/inputs/symbol-list-lines.c
  lldb/trunk/lit/tools/lldb-mi/symbol/inputs/symbol-list-lines.h
  lldb/trunk/lit/tools/lldb-mi/symbol/lit.local.cfg
  lldb/trunk/lit/tools/lldb-mi/symbol/symbol-list-lines.test
  lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/Makefile
  lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/main.cpp
  
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test.cpp
  
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test.h
  
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test2.cpp
  lldb/trunk/tools/lldb-mi/MICmdCmdSymbol.cpp
  lldb/trunk/tools/lldb-mi/MICmdCmdSymbol.h

Index: lldb/trunk/tools/lldb-mi/MICmdCmdSymbol.h
===
--- lldb/trunk/tools/lldb-mi/MICmdCmdSymbol.h
+++ lldb/trunk/tools/lldb-mi/MICmdCmdSymbol.h
@@ -24,10 +24,10 @@
 #pragma once
 
 // Third party headers:
-#include "lldb/API/SBCommandReturnObject.h"
 
 // In-house headers:
 #include "MICmdBase.h"
+#include "MICmnMIValueList.h"
 
 //++
 //
@@ -55,6 +55,6 @@
 
   // Attributes:
 private:
-  lldb::SBCommandReturnObject m_lldbResult;
+  CMICmnMIValueList m_resultList;
   const CMIUtilString m_constStrArgNameFile;
 };
Index: lldb/trunk/tools/lldb-mi/MICmdCmdSymbol.cpp
===
--- lldb/trunk/tools/lldb-mi/MICmdCmdSymbol.cpp
+++ lldb/trunk/tools/lldb-mi/MICmdCmdSymbol.cpp
@@ -10,18 +10,28 @@
 // Overview:CMICmdCmdSymbolListLines implementation.
 
 // Third Party Headers:
-#include "lldb/API/SBCommandInterpreter.h"
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/ADT/StringRef.h"
-#include "llvm/Support/Regex.h"
+#include "llvm/ADT/Twine.h"
 
 // In-house headers:
 #include "MICmdArgValFile.h"
 #include "MICmdCmdSymbol.h"
 #include "MICmnLLDBDebugSessionInfo.h"
 #include "MICmnMIResultRecord.h"
-#include "MICmnMIValueList.h"
 #include "MICmnMIValueTuple.h"
+#include "MICmnMIValueResult.h"
+
+namespace {
+const CMICmnMIValueTuple
+CreateMITuplePCLine(const uint32_t addr, const uint32_t line_number) {
+  const CMICmnMIValueConst miValueConstAddr("0x" + llvm::Twine::utohexstr(addr).str());
+  const CMICmnMIValueConst miValueConstLine(llvm::Twine(line_number).str());
+  const CMICmnMIValueResult miValueResultAddr("pc", miValueConstAddr);
+  const CMICmnMIValueResult miValueResultLine("line", miValueConstLine);
+  CMICmnMIValueTuple miValueTuple(miValueResultAddr);
+  miValueTuple.Add(miValueResultLine);
+  return miValueTuple;
+}
+} // namespace
 
 //++
 //
@@ -32,7 +42,7 @@
 // Throws:  None.
 //--
 CMICmdCmdSymbolListLines::CMICmdCmdSymbolListLines()
-: m_constStrArgNameFile("file") {
+: m_resultList(false), m_constStrArgNameFile("file") {
   // Command factory matches this name with that received from the stdin stream
   m_strMiCmd = "symbol-list-lines";
 
@@ -84,93 +94,51 @@
 bool CMICmdCmdSymbolListLines::Execute() {
   CMICMDBASE_GETOPTION(pArgFile, File, m_constStrArgNameFile);
 
-  const CMIUtilString (pArgFile->GetValue());
-  const CMIUtilString strCmd(CMIUtilString::Format(
-  "source info --file \"%s\"", strFilePath.AddSlashes().c_str()));
-
-  CMICmnLLDBDebugSessionInfo (
-  CMICmnLLDBDebugSessionInfo::Instance());
-  const lldb::ReturnStatus rtn =
-  rSessionInfo.GetDebugger().GetCommandInterpreter().HandleCommand(
-  strCmd.c_str(), m_lldbResult);
-  MIunused(rtn);
-
-  return MIstatus::success;
-}
-
-//++
-//
-// Details: Helper function for parsing the header returned from lldb for the
-// command:
-//  target modules dump line-table 
-//  where the header is of the format:
-//  Line table for /path/to/file in `/path/to/module
-// Args:input - (R) Input string to parse.
-//  file  - (W) String representing the file.
-// Return:  bool - True = input was parsed successfully, false = input could not
-// be parsed.
-// Throws:  None.
-//--
-static bool ParseLLDBLineAddressHeader(const char *input, CMIUtilString ) {
-  // Match LineEntry using 

[Lldb-commits] [lldb] r336206 - [lldb-mi] Re-implement symbol-list-lines command.

2018-07-03 Thread Alexander Polyakov via lldb-commits
Author: apolyakov
Date: Tue Jul  3 08:40:20 2018
New Revision: 336206

URL: http://llvm.org/viewvc/llvm-project?rev=336206=rev
Log:
[lldb-mi] Re-implement symbol-list-lines command.

Summary: Now this command uses SB API instead of HandleCommand.

Reviewers: aprantl, clayborg

Reviewed By: aprantl, clayborg

Subscribers: ki.stfu, eraman, lldb-commits

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

Added:
lldb/trunk/lit/tools/lldb-mi/symbol/
lldb/trunk/lit/tools/lldb-mi/symbol/inputs/
lldb/trunk/lit/tools/lldb-mi/symbol/inputs/list-lines-helper.c
lldb/trunk/lit/tools/lldb-mi/symbol/inputs/list-lines-helper.h
lldb/trunk/lit/tools/lldb-mi/symbol/inputs/main.c
lldb/trunk/lit/tools/lldb-mi/symbol/inputs/symbol-list-lines.c
lldb/trunk/lit/tools/lldb-mi/symbol/inputs/symbol-list-lines.h
lldb/trunk/lit/tools/lldb-mi/symbol/lit.local.cfg
lldb/trunk/lit/tools/lldb-mi/symbol/symbol-list-lines.test
Removed:
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/Makefile
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/main.cpp

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test.cpp

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test.h

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test2.cpp
Modified:
lldb/trunk/tools/lldb-mi/MICmdCmdSymbol.cpp
lldb/trunk/tools/lldb-mi/MICmdCmdSymbol.h

Added: lldb/trunk/lit/tools/lldb-mi/symbol/inputs/list-lines-helper.c
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/symbol/inputs/list-lines-helper.c?rev=336206=auto
==
--- lldb/trunk/lit/tools/lldb-mi/symbol/inputs/list-lines-helper.c (added)
+++ lldb/trunk/lit/tools/lldb-mi/symbol/inputs/list-lines-helper.c Tue Jul  3 
08:40:20 2018
@@ -0,0 +1,3 @@
+void HelpFunction(void) {
+  int x = 12345;
+}

Added: lldb/trunk/lit/tools/lldb-mi/symbol/inputs/list-lines-helper.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/symbol/inputs/list-lines-helper.h?rev=336206=auto
==
--- lldb/trunk/lit/tools/lldb-mi/symbol/inputs/list-lines-helper.h (added)
+++ lldb/trunk/lit/tools/lldb-mi/symbol/inputs/list-lines-helper.h Tue Jul  3 
08:40:20 2018
@@ -0,0 +1 @@
+void HelpFunction(void);

Added: lldb/trunk/lit/tools/lldb-mi/symbol/inputs/main.c
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/symbol/inputs/main.c?rev=336206=auto
==
--- lldb/trunk/lit/tools/lldb-mi/symbol/inputs/main.c (added)
+++ lldb/trunk/lit/tools/lldb-mi/symbol/inputs/main.c Tue Jul  3 08:40:20 2018
@@ -0,0 +1,6 @@
+#include "symbol-list-lines.h"
+
+int main(void) {
+  int x = GetZero();
+  return 0;
+}

Added: lldb/trunk/lit/tools/lldb-mi/symbol/inputs/symbol-list-lines.c
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/symbol/inputs/symbol-list-lines.c?rev=336206=auto
==
--- lldb/trunk/lit/tools/lldb-mi/symbol/inputs/symbol-list-lines.c (added)
+++ lldb/trunk/lit/tools/lldb-mi/symbol/inputs/symbol-list-lines.c Tue Jul  3 
08:40:20 2018
@@ -0,0 +1,6 @@
+#include "list-lines-helper.h"
+
+int GetZero() {
+  HelpFunction();
+  return 0;
+}

Added: lldb/trunk/lit/tools/lldb-mi/symbol/inputs/symbol-list-lines.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/symbol/inputs/symbol-list-lines.h?rev=336206=auto
==
--- lldb/trunk/lit/tools/lldb-mi/symbol/inputs/symbol-list-lines.h (added)
+++ lldb/trunk/lit/tools/lldb-mi/symbol/inputs/symbol-list-lines.h Tue Jul  3 
08:40:20 2018
@@ -0,0 +1 @@
+int GetZero();

Added: lldb/trunk/lit/tools/lldb-mi/symbol/lit.local.cfg
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/symbol/lit.local.cfg?rev=336206=auto
==
--- lldb/trunk/lit/tools/lldb-mi/symbol/lit.local.cfg (added)
+++ lldb/trunk/lit/tools/lldb-mi/symbol/lit.local.cfg Tue Jul  3 08:40:20 2018
@@ -0,0 +1 @@
+config.suffixes = ['.test']

Added: lldb/trunk/lit/tools/lldb-mi/symbol/symbol-list-lines.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/symbol/symbol-list-lines.test?rev=336206=auto
==
--- lldb/trunk/lit/tools/lldb-mi/symbol/symbol-list-lines.test (added)
+++ lldb/trunk/lit/tools/lldb-mi/symbol/symbol-list-lines.test Tue Jul  3 
08:40:20 2018
@@ -0,0 +1,17 @@
+# RUN: %cc -o %t %p/inputs/main.c %p/inputs/symbol-list-lines.c 
%p/inputs/list-lines-helper.c -g
+# RUN: %lldbmi %t < %s | 

[Lldb-commits] [PATCH] D48801: Add new API to SBTarget and SBModule classes.

2018-07-03 Thread Alexander Polyakov via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL336200: Add new API to SBTarget and SBModule classes. 
(authored by apolyakov, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D48801?vs=153846=153912#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D48801

Files:
  lldb/trunk/include/lldb/API/SBModule.h
  lldb/trunk/include/lldb/API/SBTarget.h
  
lldb/trunk/packages/Python/lldbsuite/test/python_api/module_section/TestModuleAndSection.py
  lldb/trunk/packages/Python/lldbsuite/test/python_api/target/TestTargetAPI.py
  lldb/trunk/scripts/interface/SBModule.i
  lldb/trunk/scripts/interface/SBTarget.i
  lldb/trunk/source/API/SBModule.cpp
  lldb/trunk/source/API/SBTarget.cpp

Index: lldb/trunk/scripts/interface/SBTarget.i
===
--- lldb/trunk/scripts/interface/SBTarget.i
+++ lldb/trunk/scripts/interface/SBTarget.i
@@ -405,6 +405,23 @@
 lldb::SBModule
 FindModule (const lldb::SBFileSpec _spec);
 
+%feature("docstring", "
+//--
+/// Find compile units related to *this target and passed source
+/// file.
+///
+/// @param[in] sb_file_spec
+/// A lldb::SBFileSpec object that contains source file
+/// specification.
+///
+/// @return
+/// A lldb::SBSymbolContextList that gets filled in with all of
+/// the symbol contexts for all the matches.
+//--
+") FindCompileUnits;
+lldb::SBSymbolContextList
+FindCompileUnits (const lldb::SBFileSpec _file_spec);
+
 lldb::ByteOrder
 GetByteOrder ();
 
Index: lldb/trunk/scripts/interface/SBModule.i
===
--- lldb/trunk/scripts/interface/SBModule.i
+++ lldb/trunk/scripts/interface/SBModule.i
@@ -179,6 +179,23 @@
 lldb::SBCompileUnit
 GetCompileUnitAtIndex (uint32_t);
 
+%feature("docstring", "
+//--
+/// Find compile units related to *this module and passed source
+/// file.
+///
+/// @param[in] sb_file_spec
+/// A lldb::SBFileSpec object that contains source file
+/// specification.
+///
+/// @return
+/// A lldb::SBSymbolContextList that gets filled in with all of
+/// the symbol contexts for all the matches.
+//--
+") FindCompileUnits;
+lldb::SBSymbolContextList
+FindCompileUnits (const lldb::SBFileSpec _file_spec);
+
 size_t
 GetNumSymbols ();
 
Index: lldb/trunk/include/lldb/API/SBTarget.h
===
--- lldb/trunk/include/lldb/API/SBTarget.h
+++ lldb/trunk/include/lldb/API/SBTarget.h
@@ -292,6 +292,21 @@
 
   lldb::SBModule FindModule(const lldb::SBFileSpec _spec);
 
+  //--
+  /// Find compile units related to *this target and passed source
+  /// file.
+  ///
+  /// @param[in] sb_file_spec
+  /// A lldb::SBFileSpec object that contains source file
+  /// specification.
+  ///
+  /// @return
+  /// A lldb::SBSymbolContextList that gets filled in with all of
+  /// the symbol contexts for all the matches.
+  //--
+  lldb::SBSymbolContextList
+  FindCompileUnits(const lldb::SBFileSpec _file_spec);
+
   lldb::ByteOrder GetByteOrder();
 
   uint32_t GetAddressByteSize();
Index: lldb/trunk/include/lldb/API/SBModule.h
===
--- lldb/trunk/include/lldb/API/SBModule.h
+++ lldb/trunk/include/lldb/API/SBModule.h
@@ -129,6 +129,21 @@
 
   lldb::SBCompileUnit GetCompileUnitAtIndex(uint32_t);
 
+  //--
+  /// Find compile units related to *this module and passed source
+  /// file.
+  ///
+  /// @param[in] sb_file_spec
+  /// A lldb::SBFileSpec object that contains source file
+  /// specification.
+  ///
+  /// @return
+  /// A lldb::SBSymbolContextList that gets filled in with all of
+  /// the symbol contexts for all the matches.
+  //--
+  lldb::SBSymbolContextList
+  FindCompileUnits(const lldb::SBFileSpec _file_spec);
+
   size_t GetNumSymbols();
 
   lldb::SBSymbol GetSymbolAtIndex(size_t idx);
Index: lldb/trunk/packages/Python/lldbsuite/test/python_api/target/TestTargetAPI.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/target/TestTargetAPI.py
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/target/TestTargetAPI.py
@@ 

[Lldb-commits] [lldb] r336200 - Add new API to SBTarget and SBModule classes.

2018-07-03 Thread Alexander Polyakov via lldb-commits
Author: apolyakov
Date: Tue Jul  3 07:22:44 2018
New Revision: 336200

URL: http://llvm.org/viewvc/llvm-project?rev=336200=rev
Log:
Add new API to SBTarget and SBModule classes.

Summary: The new API allows to find a list of compile units related to 
target/module.

Reviewers: aprantl, clayborg

Reviewed By: aprantl

Subscribers: jingham, lldb-commits

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

Modified:
lldb/trunk/include/lldb/API/SBModule.h
lldb/trunk/include/lldb/API/SBTarget.h

lldb/trunk/packages/Python/lldbsuite/test/python_api/module_section/TestModuleAndSection.py
lldb/trunk/packages/Python/lldbsuite/test/python_api/target/TestTargetAPI.py
lldb/trunk/scripts/interface/SBModule.i
lldb/trunk/scripts/interface/SBTarget.i
lldb/trunk/source/API/SBModule.cpp
lldb/trunk/source/API/SBTarget.cpp

Modified: lldb/trunk/include/lldb/API/SBModule.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBModule.h?rev=336200=336199=336200=diff
==
--- lldb/trunk/include/lldb/API/SBModule.h (original)
+++ lldb/trunk/include/lldb/API/SBModule.h Tue Jul  3 07:22:44 2018
@@ -129,6 +129,21 @@ public:
 
   lldb::SBCompileUnit GetCompileUnitAtIndex(uint32_t);
 
+  //--
+  /// Find compile units related to *this module and passed source
+  /// file.
+  ///
+  /// @param[in] sb_file_spec
+  /// A lldb::SBFileSpec object that contains source file
+  /// specification.
+  ///
+  /// @return
+  /// A lldb::SBSymbolContextList that gets filled in with all of
+  /// the symbol contexts for all the matches.
+  //--
+  lldb::SBSymbolContextList
+  FindCompileUnits(const lldb::SBFileSpec _file_spec);
+
   size_t GetNumSymbols();
 
   lldb::SBSymbol GetSymbolAtIndex(size_t idx);

Modified: lldb/trunk/include/lldb/API/SBTarget.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTarget.h?rev=336200=336199=336200=diff
==
--- lldb/trunk/include/lldb/API/SBTarget.h (original)
+++ lldb/trunk/include/lldb/API/SBTarget.h Tue Jul  3 07:22:44 2018
@@ -292,6 +292,21 @@ public:
 
   lldb::SBModule FindModule(const lldb::SBFileSpec _spec);
 
+  //--
+  /// Find compile units related to *this target and passed source
+  /// file.
+  ///
+  /// @param[in] sb_file_spec
+  /// A lldb::SBFileSpec object that contains source file
+  /// specification.
+  ///
+  /// @return
+  /// A lldb::SBSymbolContextList that gets filled in with all of
+  /// the symbol contexts for all the matches.
+  //--
+  lldb::SBSymbolContextList
+  FindCompileUnits(const lldb::SBFileSpec _file_spec);
+
   lldb::ByteOrder GetByteOrder();
 
   uint32_t GetAddressByteSize();

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/python_api/module_section/TestModuleAndSection.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/module_section/TestModuleAndSection.py?rev=336200=336199=336200=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/python_api/module_section/TestModuleAndSection.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/python_api/module_section/TestModuleAndSection.py
 Tue Jul  3 07:22:44 2018
@@ -141,3 +141,29 @@ class ModuleAndSectionAPIsTestCase(TestB
 INDENT2 = INDENT * 2
 for cu in exe_module.compile_unit_iter():
 print(cu)
+
+@add_test_categories(['pyapi'])
+def test_find_compile_units(self):
+"""Exercise SBModule.FindCompileUnits() API."""
+d = {'EXE': 'b.out'}
+self.build(dictionary=d)
+self.setTearDownCleanup(dictionary=d)
+self.find_compile_units(self.getBuildArtifact('b.out'))
+
+def find_compile_units(self, exe):
+"""Exercise SBModule.FindCompileUnits() API."""
+source_name_list = ["main.cpp", "b.cpp", "c.cpp"]
+
+# Create a target by the debugger.
+target = self.dbg.CreateTarget(exe)
+self.assertTrue(target, VALID_TARGET)
+
+num_modules = target.GetNumModules()
+for i in range(num_modules):
+module = target.GetModuleAtIndex(i)
+for source_name in source_name_list:
+list = module.FindCompileUnits(lldb.SBFileSpec(source_name, 
False))
+for sc in list:
+self.assertTrue(
+sc.GetCompileUnit().GetFileSpec().GetFilename() ==
+source_name)

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/python_api/target/TestTargetAPI.py
URL: 

[Lldb-commits] [PATCH] D48868: [LLDB] In ProcessGDBRemote::UpdateThreadIDList(), the thread PCs should not be cleared after they are updated from the stop reply packet

2018-07-03 Thread Venkata Ramanaiah via Phabricator via lldb-commits
ramana-nvr created this revision.
ramana-nvr added a reviewer: labath.

The function ProcessGDBRemote::UpdateThreadIDsFromStopReplyThreadsValue(), 
which is being called after the thread PCs are updated, is clearing the thread 
PC list and that is wrong.


https://reviews.llvm.org/D48868

Files:
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp


Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -1523,7 +1523,6 @@
 size_t
 ProcessGDBRemote::UpdateThreadIDsFromStopReplyThreadsValue(std::string ) 
{
   m_thread_ids.clear();
-  m_thread_pcs.clear();
   size_t comma_pos;
   lldb::tid_t tid;
   while ((comma_pos = value.find(',')) != std::string::npos) {
@@ -1598,7 +1597,6 @@
 StringExtractorGDBRemote _info = m_stop_packet_stack[i];
 const std::string _info_str = stop_info.GetStringRef();
 
-m_thread_pcs.clear();
 const size_t thread_pcs_pos = stop_info_str.find(";thread-pcs:");
 if (thread_pcs_pos != std::string::npos) {
   const size_t start = thread_pcs_pos + strlen(";thread-pcs:");


Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -1523,7 +1523,6 @@
 size_t
 ProcessGDBRemote::UpdateThreadIDsFromStopReplyThreadsValue(std::string ) {
   m_thread_ids.clear();
-  m_thread_pcs.clear();
   size_t comma_pos;
   lldb::tid_t tid;
   while ((comma_pos = value.find(',')) != std::string::npos) {
@@ -1598,7 +1597,6 @@
 StringExtractorGDBRemote _info = m_stop_packet_stack[i];
 const std::string _info_str = stop_info.GetStringRef();
 
-m_thread_pcs.clear();
 const size_t thread_pcs_pos = stop_info_str.find(";thread-pcs:");
 if (thread_pcs_pos != std::string::npos) {
   const size_t start = thread_pcs_pos + strlen(";thread-pcs:");
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D48865: [LLDB] CommandObjectThreadUntil::DoExecute() sets the wrong selected thread ID

2018-07-03 Thread Venkata Ramanaiah via Phabricator via lldb-commits
ramana-nvr created this revision.
ramana-nvr added a reviewer: labath.

For the 'thread until' command, the selected thread ID, to perform the 
operation on, could be of the current thread or the specified thread.


https://reviews.llvm.org/D48865

Files:
  source/Commands/CommandObjectThread.cpp


Index: source/Commands/CommandObjectThread.cpp
===
--- source/Commands/CommandObjectThread.cpp
+++ source/Commands/CommandObjectThread.cpp
@@ -1285,7 +1285,7 @@
 return false;
   }
 
-  process->GetThreadList().SetSelectedThreadByID(m_options.m_thread_idx);
+  process->GetThreadList().SetSelectedThreadByID(thread->GetID());
 
   StreamString stream;
   Status error;


Index: source/Commands/CommandObjectThread.cpp
===
--- source/Commands/CommandObjectThread.cpp
+++ source/Commands/CommandObjectThread.cpp
@@ -1285,7 +1285,7 @@
 return false;
   }
 
-  process->GetThreadList().SetSelectedThreadByID(m_options.m_thread_idx);
+  process->GetThreadList().SetSelectedThreadByID(thread->GetID());
 
   StreamString stream;
   Status error;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits