[Lldb-commits] [lldb] r296593 - test: pass correct objcopy and ar paths to the test runner

2017-03-01 Thread Pavel Labath via lldb-commits
Author: labath
Date: Wed Mar  1 04:08:44 2017
New Revision: 296593

URL: http://llvm.org/viewvc/llvm-project?rev=296593&view=rev
Log:
test: pass correct objcopy and ar paths to the test runner

Summary:
The test runner has code to autodetect this, but it's not very smart --
in particular, it fails in the case where we build the test executables
with the just-built clang. Since cmake already has the knowledge about
the right toolchain, we can just have it pass the appropriate flags to
the test runner.

This also removes the "temporary" cache-scrubbing hack added a couple
months ago.

Reviewers: zturner, beanz

Subscribers: mgorny, lldb-commits

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

Modified:
lldb/trunk/test/CMakeLists.txt

Modified: lldb/trunk/test/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/CMakeLists.txt?rev=296593&r1=296592&r2=296593&view=diff
==
--- lldb/trunk/test/CMakeLists.txt (original)
+++ lldb/trunk/test/CMakeLists.txt Wed Mar  1 04:08:44 2017
@@ -43,11 +43,6 @@ set(LLDB_TEST_ARCH
${LLDB_DEFAULT_TEST_ARCH}
CACHE STRING "Specify the architecture to run LLDB tests as (x86|x64).  
Determines whether tests are compiled with -m32 or -m64")
 
-# Scrub LLDB_TEST_COMPILER out of the CMake caches
-# TODO: remove the replace lines and the FORCE parameter in a few days once the
-# change has made its way through bots to clean up their CMake caches.
-string(REPLACE "-C;${LLDB_TEST_COMPILER}" "" LLDB_TEST_USER_ARGS_New 
"${LLDB_TEST_USER_ARGS}")
-
 if(LLDB_TEST_CLANG)
   set(LLDB_TEST_COMPILER $)
 endif()
@@ -97,6 +92,11 @@ if(LLDB_BUILD_FRAMEWORK)
   list(APPEND LLDB_TEST_COMMON_ARGS --framework $)
 endif()
 
+if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows|Darwin")
+  list(APPEND LLDB_TEST_COMMON_ARGS
+--env ARCHIVER=${CMAKE_AR} --env OBJCOPY=${CMAKE_OBJCOPY})
+endif()
+
 add_python_test_target(check-lldb-single
   ${LLDB_SOURCE_DIR}/test/dotest.py
   "--no-multiprocess;${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS}"


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


[Lldb-commits] [lldb] r296595 - Fix gcc compilation of LogTest.cpp

2017-03-01 Thread Pavel Labath via lldb-commits
Author: labath
Date: Wed Mar  1 04:08:51 2017
New Revision: 296595

URL: http://llvm.org/viewvc/llvm-project?rev=296595&view=rev
Log:
Fix gcc compilation of LogTest.cpp

Modified:
lldb/trunk/unittests/Core/LogTest.cpp

Modified: lldb/trunk/unittests/Core/LogTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Core/LogTest.cpp?rev=296595&r1=296594&r2=296595&view=diff
==
--- lldb/trunk/unittests/Core/LogTest.cpp (original)
+++ lldb/trunk/unittests/Core/LogTest.cpp Wed Mar  1 04:08:51 2017
@@ -20,7 +20,7 @@ using namespace lldb_private;
 
 enum { FOO = 1, BAR = 2 };
 static constexpr Log::Category test_categories[] = {
-{"foo", "log foo", FOO}, {"bar", "log bar", BAR},
+{{"foo"}, {"log foo"}, FOO}, {{"bar"}, {"log bar"}, BAR},
 };
 static constexpr uint32_t default_flags = FOO;
 


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


[Lldb-commits] [lldb] r296592 - Modernize Enable/DisableLogChannel interface a bit

2017-03-01 Thread Pavel Labath via lldb-commits
Author: labath
Date: Wed Mar  1 04:08:40 2017
New Revision: 296592

URL: http://llvm.org/viewvc/llvm-project?rev=296592&view=rev
Log:
Modernize Enable/DisableLogChannel interface a bit

Summary:
Use StringRef and ArrayRef where possible. This adds an accessor to the
Args class to get a view of the arguments as ArrayRef.

Reviewers: zturner

Subscribers: lldb-commits

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

Modified:
lldb/trunk/include/lldb/Core/Debugger.h
lldb/trunk/include/lldb/Core/Log.h
lldb/trunk/include/lldb/Interpreter/Args.h
lldb/trunk/source/API/SBDebugger.cpp
lldb/trunk/source/Commands/CommandObjectLog.cpp
lldb/trunk/source/Core/Debugger.cpp
lldb/trunk/source/Core/Log.cpp
lldb/trunk/tools/lldb-server/LLDBServerUtilities.cpp
lldb/trunk/unittests/Core/LogTest.cpp
lldb/trunk/unittests/Interpreter/TestArgs.cpp

Modified: lldb/trunk/include/lldb/Core/Debugger.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Debugger.h?rev=296592&r1=296591&r2=296592&view=diff
==
--- lldb/trunk/include/lldb/Core/Debugger.h (original)
+++ lldb/trunk/include/lldb/Core/Debugger.h Wed Mar  1 04:08:40 2017
@@ -192,8 +192,9 @@ public:
 
   void SetCloseInputOnEOF(bool b);
 
-  bool EnableLog(const char *channel, const char **categories,
- const char *log_file, uint32_t log_options,
+  bool EnableLog(llvm::StringRef channel,
+ llvm::ArrayRef categories,
+ llvm::StringRef log_file, uint32_t log_options,
  Stream &error_stream);
 
   void SetLoggingCallback(lldb::LogOutputCallback log_callback, void *baton);

Modified: lldb/trunk/include/lldb/Core/Log.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Log.h?rev=296592&r1=296591&r2=296592&view=diff
==
--- lldb/trunk/include/lldb/Core/Log.h (original)
+++ lldb/trunk/include/lldb/Core/Log.h Wed Mar  1 04:08:40 2017
@@ -100,10 +100,12 @@ public:
   static bool
   EnableLogChannel(const std::shared_ptr &log_stream_sp,
uint32_t log_options, llvm::StringRef channel,
-   const char **categories, Stream &error_stream);
+   llvm::ArrayRef categories,
+   Stream &error_stream);
 
   static bool DisableLogChannel(llvm::StringRef channel,
-const char **categories, Stream &error_stream);
+llvm::ArrayRef categories,
+Stream &error_stream);
 
   static bool ListChannelCategories(llvm::StringRef channel, Stream &stream);
 

Modified: lldb/trunk/include/lldb/Interpreter/Args.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/Args.h?rev=296592&r1=296591&r2=296592&view=diff
==
--- lldb/trunk/include/lldb/Interpreter/Args.h (original)
+++ lldb/trunk/include/lldb/Interpreter/Args.h Wed Mar  1 04:08:40 2017
@@ -193,6 +193,15 @@ public:
   const char **GetConstArgumentVector() const;
 
   //--
+  /// Gets the argument as an ArrayRef. Note that the return value does *not*
+  /// have a nullptr const char * at the end, as the size of the list is
+  /// embedded in the ArrayRef object.
+  //--
+  llvm::ArrayRef GetArgumentArrayRef() const {
+return llvm::makeArrayRef(m_argv).drop_back();
+  }
+
+  //--
   /// Appends a new argument to the end of the list argument list.
   ///
   /// @param[in] arg_cstr

Modified: lldb/trunk/source/API/SBDebugger.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDebugger.cpp?rev=296592&r1=296591&r2=296592&view=diff
==
--- lldb/trunk/source/API/SBDebugger.cpp (original)
+++ lldb/trunk/source/API/SBDebugger.cpp Wed Mar  1 04:08:40 2017
@@ -1120,13 +1120,22 @@ SBTypeSynthetic SBDebugger::GetSynthetic
 }
 #endif // LLDB_DISABLE_PYTHON
 
+static llvm::ArrayRef GetCategoryArray(const char **categories) {
+  if (categories == nullptr)
+return {};
+  size_t len = 0;
+  while (categories[len] != nullptr)
+++len;
+  return llvm::makeArrayRef(categories, len);
+}
+
 bool SBDebugger::EnableLog(const char *channel, const char **categories) {
   if (m_opaque_sp) {
 uint32_t log_options =
 LLDB_LOG_OPTION_PREPEND_TIMESTAMP | 
LLDB_LOG_OPTION_PREPEND_THREAD_NAME;
 StreamString errors;
-return m_opaque_sp->EnableLog(channel, categories, nullptr, log_options,
-  errors);
+return m_opaque_sp->EnableLog(channel, GetCategoryArray(categories), "",
+  

[Lldb-commits] [PATCH] D30402: Modernize Enable/DisableLogChannel interface a bit

2017-03-01 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL296592: Modernize Enable/DisableLogChannel interface a bit 
(authored by labath).

Changed prior to commit:
  https://reviews.llvm.org/D30402?vs=9&id=90132#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30402

Files:
  lldb/trunk/include/lldb/Core/Debugger.h
  lldb/trunk/include/lldb/Core/Log.h
  lldb/trunk/include/lldb/Interpreter/Args.h
  lldb/trunk/source/API/SBDebugger.cpp
  lldb/trunk/source/Commands/CommandObjectLog.cpp
  lldb/trunk/source/Core/Debugger.cpp
  lldb/trunk/source/Core/Log.cpp
  lldb/trunk/tools/lldb-server/LLDBServerUtilities.cpp
  lldb/trunk/unittests/Core/LogTest.cpp
  lldb/trunk/unittests/Interpreter/TestArgs.cpp

Index: lldb/trunk/include/lldb/Interpreter/Args.h
===
--- lldb/trunk/include/lldb/Interpreter/Args.h
+++ lldb/trunk/include/lldb/Interpreter/Args.h
@@ -193,6 +193,15 @@
   const char **GetConstArgumentVector() const;
 
   //--
+  /// Gets the argument as an ArrayRef. Note that the return value does *not*
+  /// have a nullptr const char * at the end, as the size of the list is
+  /// embedded in the ArrayRef object.
+  //--
+  llvm::ArrayRef GetArgumentArrayRef() const {
+return llvm::makeArrayRef(m_argv).drop_back();
+  }
+
+  //--
   /// Appends a new argument to the end of the list argument list.
   ///
   /// @param[in] arg_cstr
Index: lldb/trunk/include/lldb/Core/Debugger.h
===
--- lldb/trunk/include/lldb/Core/Debugger.h
+++ lldb/trunk/include/lldb/Core/Debugger.h
@@ -192,8 +192,9 @@
 
   void SetCloseInputOnEOF(bool b);
 
-  bool EnableLog(const char *channel, const char **categories,
- const char *log_file, uint32_t log_options,
+  bool EnableLog(llvm::StringRef channel,
+ llvm::ArrayRef categories,
+ llvm::StringRef log_file, uint32_t log_options,
  Stream &error_stream);
 
   void SetLoggingCallback(lldb::LogOutputCallback log_callback, void *baton);
Index: lldb/trunk/include/lldb/Core/Log.h
===
--- lldb/trunk/include/lldb/Core/Log.h
+++ lldb/trunk/include/lldb/Core/Log.h
@@ -100,10 +100,12 @@
   static bool
   EnableLogChannel(const std::shared_ptr &log_stream_sp,
uint32_t log_options, llvm::StringRef channel,
-   const char **categories, Stream &error_stream);
+   llvm::ArrayRef categories,
+   Stream &error_stream);
 
   static bool DisableLogChannel(llvm::StringRef channel,
-const char **categories, Stream &error_stream);
+llvm::ArrayRef categories,
+Stream &error_stream);
 
   static bool ListChannelCategories(llvm::StringRef channel, Stream &stream);
 
Index: lldb/trunk/unittests/Interpreter/TestArgs.cpp
===
--- lldb/trunk/unittests/Interpreter/TestArgs.cpp
+++ lldb/trunk/unittests/Interpreter/TestArgs.cpp
@@ -169,6 +169,14 @@
   EXPECT_STREQ("4", args.GetArgumentAtIndex(3));
 }
 
+TEST(ArgsTest, GetArgumentArrayRef) {
+  Args args("foo bar");
+  auto ref = args.GetArgumentArrayRef();
+  ASSERT_EQ(2u, ref.size());
+  EXPECT_STREQ("foo", ref[0]);
+  EXPECT_STREQ("bar", ref[1]);
+}
+
 TEST(ArgsTest, StringToBoolean) {
   bool success = false;
   EXPECT_TRUE(Args::StringToBoolean(llvm::StringRef("true"), false, nullptr));
Index: lldb/trunk/unittests/Core/LogTest.cpp
===
--- lldb/trunk/unittests/Core/LogTest.cpp
+++ lldb/trunk/unittests/Core/LogTest.cpp
@@ -93,7 +93,7 @@
   llvm::llvm_shutdown_obj obj;
   Log::Register("chan", test_channel);
   EXPECT_EQ(nullptr, test_channel.GetLogIfAny(FOO));
-  const char *cat1[] = {"foo", nullptr};
+  const char *cat1[] = {"foo"};
   std::string message;
   std::shared_ptr stream_sp(
   new llvm::raw_string_ostream(message));
@@ -110,20 +110,20 @@
   std::shared_ptr stream_sp(
   new llvm::raw_string_ostream(message));
   StreamString err;
-  EXPECT_FALSE(Log::EnableLogChannel(stream_sp, 0, "chanchan", nullptr, err));
+  EXPECT_FALSE(Log::EnableLogChannel(stream_sp, 0, "chanchan", {}, err));
   EXPECT_EQ("Invalid log channel 'chanchan'.\n", err.GetString());
   err.Clear();
 
-  EXPECT_TRUE(Log::EnableLogChannel(stream_sp, 0, "chan", nullptr, err));
-  EXPECT_EQ("", err.GetString());
+  EXPECT_TRUE(Log::EnableLogChannel(stream_sp, 0, "chan", {}, err));
+  EXPECT_EQ("", err.GetString()) << "err: " << err.GetString().str();
   EXPECT_NE(nullptr, test_channel.GetLogIfAll(FOO));
   EXPECT_E

[Lldb-commits] [lldb] r296594 - Switch SBBreakpointLocation to use a weak_ptr

2017-03-01 Thread Pavel Labath via lldb-commits
Author: labath
Date: Wed Mar  1 04:08:48 2017
New Revision: 296594

URL: http://llvm.org/viewvc/llvm-project?rev=296594&view=rev
Log:
Switch SBBreakpointLocation to use a weak_ptr

Modified:
lldb/trunk/include/lldb/API/SBBreakpointLocation.h

lldb/trunk/packages/Python/lldbsuite/test/python_api/breakpoint/TestBreakpointAPI.py
lldb/trunk/source/API/SBBreakpointLocation.cpp

Modified: lldb/trunk/include/lldb/API/SBBreakpointLocation.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBBreakpointLocation.h?rev=296594&r1=296593&r2=296594&view=diff
==
--- lldb/trunk/include/lldb/API/SBBreakpointLocation.h (original)
+++ lldb/trunk/include/lldb/API/SBBreakpointLocation.h Wed Mar  1 04:08:48 2017
@@ -78,8 +78,9 @@ private:
   friend class SBBreakpoint;
 
   void SetLocation(const lldb::BreakpointLocationSP &break_loc_sp);
+  BreakpointLocationSP GetSP() const;
 
-  lldb::BreakpointLocationSP m_opaque_sp;
+  lldb::BreakpointLocationWP m_opaque_wp;
 };
 
 } // namespace lldb

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/python_api/breakpoint/TestBreakpointAPI.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/breakpoint/TestBreakpointAPI.py?rev=296594&r1=296593&r2=296594&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/python_api/breakpoint/TestBreakpointAPI.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/python_api/breakpoint/TestBreakpointAPI.py
 Wed Mar  1 04:08:48 2017
@@ -69,6 +69,9 @@ class BreakpointAPITestCase(TestBase):
 self.assertTrue(breakpoint and
 breakpoint.GetNumLocations() == 1,
 VALID_BREAKPOINT)
+location = breakpoint.GetLocationAtIndex(0)
+self.assertTrue(location.IsValid())
 
 self.assertTrue(self.dbg.DeleteTarget(target))
 self.assertFalse(breakpoint.IsValid())
+self.assertFalse(location.IsValid())

Modified: lldb/trunk/source/API/SBBreakpointLocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpointLocation.cpp?rev=296594&r1=296593&r2=296594&view=diff
==
--- lldb/trunk/source/API/SBBreakpointLocation.cpp (original)
+++ lldb/trunk/source/API/SBBreakpointLocation.cpp Wed Mar  1 04:08:48 2017
@@ -30,104 +30,111 @@
 using namespace lldb;
 using namespace lldb_private;
 
-SBBreakpointLocation::SBBreakpointLocation() : m_opaque_sp() {}
+SBBreakpointLocation::SBBreakpointLocation() {}
 
 SBBreakpointLocation::SBBreakpointLocation(
 const lldb::BreakpointLocationSP &break_loc_sp)
-: m_opaque_sp(break_loc_sp) {
+: m_opaque_wp(break_loc_sp) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
 
   if (log) {
 SBStream sstr;
 GetDescription(sstr, lldb::eDescriptionLevelBrief);
-log->Printf("SBBreakpointLocation::SBBreakpointLocaiton (const "
-"lldb::BreakpointLocationsSP &break_loc_sp"
-"=%p)  => this.sp = %p (%s)",
-static_cast(break_loc_sp.get()),
-static_cast(m_opaque_sp.get()), sstr.GetData());
+LLDB_LOG(log, "location = {0} ({1})", break_loc_sp.get(), sstr.GetData());
   }
 }
 
 SBBreakpointLocation::SBBreakpointLocation(const SBBreakpointLocation &rhs)
-: m_opaque_sp(rhs.m_opaque_sp) {}
+: m_opaque_wp(rhs.m_opaque_wp) {}
 
 const SBBreakpointLocation &SBBreakpointLocation::
 operator=(const SBBreakpointLocation &rhs) {
-  if (this != &rhs)
-m_opaque_sp = rhs.m_opaque_sp;
+  m_opaque_wp = rhs.m_opaque_wp;
   return *this;
 }
 
 SBBreakpointLocation::~SBBreakpointLocation() {}
 
-bool SBBreakpointLocation::IsValid() const { return m_opaque_sp.get() != NULL; 
}
+BreakpointLocationSP SBBreakpointLocation::GetSP() const {
+  return m_opaque_wp.lock();
+}
+
+bool SBBreakpointLocation::IsValid() const { return bool(GetSP()); }
 
 SBAddress SBBreakpointLocation::GetAddress() {
-  if (m_opaque_sp)
-return SBAddress(&m_opaque_sp->GetAddress());
+  BreakpointLocationSP loc_sp = GetSP();
+  if (loc_sp)
+return SBAddress(&loc_sp->GetAddress());
   else
 return SBAddress();
 }
 
 addr_t SBBreakpointLocation::GetLoadAddress() {
   addr_t ret_addr = LLDB_INVALID_ADDRESS;
+  BreakpointLocationSP loc_sp = GetSP();
 
-  if (m_opaque_sp) {
+  if (loc_sp) {
 std::lock_guard guard(
-m_opaque_sp->GetTarget().GetAPIMutex());
-ret_addr = m_opaque_sp->GetLoadAddress();
+loc_sp->GetTarget().GetAPIMutex());
+ret_addr = loc_sp->GetLoadAddress();
   }
 
   return ret_addr;
 }
 
 void SBBreakpointLocation::SetEnabled(bool enabled) {
-  if (m_opaque_sp) {
+  BreakpointLocationSP loc_sp = GetSP();
+  if (loc_sp) {
 std::lock_guard guard(
-m_opaque_sp->GetTarget().GetAPIMutex());
-m_opaque_sp->Se

[Lldb-commits] [PATCH] D30453: test: pass correct objcopy and ar paths to the test runner

2017-03-01 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL296593: test: pass correct objcopy and ar paths to the test 
runner (authored by labath).

Changed prior to commit:
  https://reviews.llvm.org/D30453?vs=90008&id=90134#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30453

Files:
  lldb/trunk/test/CMakeLists.txt


Index: lldb/trunk/test/CMakeLists.txt
===
--- lldb/trunk/test/CMakeLists.txt
+++ lldb/trunk/test/CMakeLists.txt
@@ -43,11 +43,6 @@
${LLDB_DEFAULT_TEST_ARCH}
CACHE STRING "Specify the architecture to run LLDB tests as (x86|x64).  
Determines whether tests are compiled with -m32 or -m64")
 
-# Scrub LLDB_TEST_COMPILER out of the CMake caches
-# TODO: remove the replace lines and the FORCE parameter in a few days once the
-# change has made its way through bots to clean up their CMake caches.
-string(REPLACE "-C;${LLDB_TEST_COMPILER}" "" LLDB_TEST_USER_ARGS_New 
"${LLDB_TEST_USER_ARGS}")
-
 if(LLDB_TEST_CLANG)
   set(LLDB_TEST_COMPILER $)
 endif()
@@ -97,6 +92,11 @@
   list(APPEND LLDB_TEST_COMMON_ARGS --framework $)
 endif()
 
+if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows|Darwin")
+  list(APPEND LLDB_TEST_COMMON_ARGS
+--env ARCHIVER=${CMAKE_AR} --env OBJCOPY=${CMAKE_OBJCOPY})
+endif()
+
 add_python_test_target(check-lldb-single
   ${LLDB_SOURCE_DIR}/test/dotest.py
   "--no-multiprocess;${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS}"


Index: lldb/trunk/test/CMakeLists.txt
===
--- lldb/trunk/test/CMakeLists.txt
+++ lldb/trunk/test/CMakeLists.txt
@@ -43,11 +43,6 @@
 	${LLDB_DEFAULT_TEST_ARCH}
 	CACHE STRING "Specify the architecture to run LLDB tests as (x86|x64).  Determines whether tests are compiled with -m32 or -m64")
 
-# Scrub LLDB_TEST_COMPILER out of the CMake caches
-# TODO: remove the replace lines and the FORCE parameter in a few days once the
-# change has made its way through bots to clean up their CMake caches.
-string(REPLACE "-C;${LLDB_TEST_COMPILER}" "" LLDB_TEST_USER_ARGS_New "${LLDB_TEST_USER_ARGS}")
-
 if(LLDB_TEST_CLANG)
   set(LLDB_TEST_COMPILER $)
 endif()
@@ -97,6 +92,11 @@
   list(APPEND LLDB_TEST_COMMON_ARGS --framework $)
 endif()
 
+if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows|Darwin")
+  list(APPEND LLDB_TEST_COMMON_ARGS
+--env ARCHIVER=${CMAKE_AR} --env OBJCOPY=${CMAKE_OBJCOPY})
+endif()
+
 add_python_test_target(check-lldb-single
   ${LLDB_SOURCE_DIR}/test/dotest.py
   "--no-multiprocess;${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS}"
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r296611 - Mark TestYMMRegister as no_debug_info_test

2017-03-01 Thread Pavel Labath via lldb-commits
Author: labath
Date: Wed Mar  1 05:18:59 2017
New Revision: 296611

URL: http://llvm.org/viewvc/llvm-project?rev=296611&view=rev
Log:
Mark TestYMMRegister as no_debug_info_test

We don't need to run this test multiple times to check whether we can
read a register.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestYMMRegister.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestYMMRegister.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestYMMRegister.py?rev=296611&r1=296610&r2=296611&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestYMMRegister.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestYMMRegister.py
 Wed Mar  1 05:18:59 2017
@@ -15,6 +15,7 @@ from lldbsuite.test import lldbutil
 
 class TestYMMRegister(TestBase):
 mydir = TestBase.compute_mydir(__file__)
+NO_DEBUG_INFO_TESTCASE = True
 
 @skipIfFreeBSD
 @skipIfiOSSimulator


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


[Lldb-commits] [lldb] r296669 - Add a sample_test directory with simple starter

2017-03-01 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Wed Mar  1 14:25:48 2017
New Revision: 296669

URL: http://llvm.org/viewvc/llvm-project?rev=296669&view=rev
Log:
Add a sample_test directory with simple starter
test cases for standard and "inline" tests.

Added:
lldb/trunk/packages/Python/lldbsuite/test/sample_test/
lldb/trunk/packages/Python/lldbsuite/test/sample_test/Makefile

lldb/trunk/packages/Python/lldbsuite/test/sample_test/TestSampleInlineTest.py
lldb/trunk/packages/Python/lldbsuite/test/sample_test/TestSampleTest.py
lldb/trunk/packages/Python/lldbsuite/test/sample_test/main.c
Modified:
lldb/trunk/packages/Python/lldbsuite/test/README-TestSuite

Modified: lldb/trunk/packages/Python/lldbsuite/test/README-TestSuite
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/README-TestSuite?rev=296669&r1=296668&r2=296669&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/README-TestSuite (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/README-TestSuite Wed Mar  1 
14:25:48 2017
@@ -54,6 +54,10 @@ o subdirectories of 'test'
   C/C++/ObjC source files; they were created to house the Python test case 
which
   does not involve lldb reading in an executable file at all.
 
+  The sample_test directory contains examples of both a full and an "inline" 
+  testcase that run a process to a breakpoint and check a local variable.  
These
+  are convenient starting points for adding new tests.
+
 o make directory
 
   Contains Makefile.rules, which can be utilized by test cases to write 
Makefile
@@ -158,6 +162,9 @@ o Writing test cases:
  from the command in the command return object, and all the part where you are 
driving the 
  debugger to the point you want to test will be more robust.
 
+ The sample_test directory contains a standard and an "inline" test that are 
good starting
+ points for writing a new test.
+
 o Attaching in test cases:
 
  If you need to attach to inferiors in your tests, you must make sure the 
inferior calls

Added: lldb/trunk/packages/Python/lldbsuite/test/sample_test/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/sample_test/Makefile?rev=296669&view=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/sample_test/Makefile (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/sample_test/Makefile Wed Mar  1 
14:25:48 2017
@@ -0,0 +1,6 @@
+LEVEL = ../make
+
+C_SOURCES := main.c
+CFLAGS_EXTRAS += -std=c99
+
+include $(LEVEL)/Makefile.rules

Added: 
lldb/trunk/packages/Python/lldbsuite/test/sample_test/TestSampleInlineTest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/sample_test/TestSampleInlineTest.py?rev=296669&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/sample_test/TestSampleInlineTest.py 
(added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/sample_test/TestSampleInlineTest.py 
Wed Mar  1 14:25:48 2017
@@ -0,0 +1,6 @@
+from __future__ import absolute_import
+
+from lldbsuite.test import lldbinline
+
+lldbinline.MakeInlineTest(
+__file__, globals(), None)

Added: lldb/trunk/packages/Python/lldbsuite/test/sample_test/TestSampleTest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/sample_test/TestSampleTest.py?rev=296669&view=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/sample_test/TestSampleTest.py 
(added)
+++ lldb/trunk/packages/Python/lldbsuite/test/sample_test/TestSampleTest.py Wed 
Mar  1 14:25:48 2017
@@ -0,0 +1,71 @@
+"""
+Sample test that runs a process to a source regexp breakpoint.
+"""
+
+from __future__ import print_function
+
+
+import os
+import time
+import re
+import lldb
+import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test.lldbtest import *
+
+
+class SampleTestTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+NO_DEBUG_INFO_TESTCASE = True
+
+def test_sample(self):
+"""A sample test example that drives a debug session to a 
breakpoint."""
+self.build()
+self.sample_test()
+
+def setUp(self):
+# Call super's setUp().
+TestBase.setUp(self)
+
+def sample_test(self):
+"""A sample test example that drives a debug session to a 
breakpoint."""
+exe = os.path.join(os.getcwd(), "a.out")
+
+# Create a target by the debugger.
+target = self.dbg.CreateTarget(exe)
+self.assertTrue(target, VALID_TARGET)
+
+# Now create a breakpoint in main.c at the source matching
+# "Set a breakpoint here"
+breakpoint = target.BreakpointCreateBySourceRegex(
+"Set a breakpoint here", lldb.SBFileSpec("main.c"))
+self.assertTrue(breakpoint a

[Lldb-commits] [lldb] r296692 - Add a test to ensure that SBFrame::Disassemble produces some output.

2017-03-01 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Wed Mar  1 16:18:37 2017
New Revision: 296692

URL: http://llvm.org/viewvc/llvm-project?rev=296692&view=rev
Log:
Add a test to ensure that SBFrame::Disassemble produces some output.

Added:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/disassembly/TestFrameDisassemble.py
Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/disassembly/main.cpp

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/disassembly/TestFrameDisassemble.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/disassembly/TestFrameDisassemble.py?rev=296692&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/disassembly/TestFrameDisassemble.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/disassembly/TestFrameDisassemble.py
 Wed Mar  1 16:18:37 2017
@@ -0,0 +1,68 @@
+"""
+Test to ensure SBFrame::Disassemble produces SOME output
+"""
+
+from __future__ import print_function
+
+
+import os
+import time
+import re
+import lldb
+import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test.lldbtest import *
+
+
+class FrameDisassembleTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+NO_DEBUG_INFO_TESTCASE = True
+
+def test_frame_disassemble(self):
+"""Sample test to ensure SBFrame::Disassemble produces SOME output."""
+self.build()
+self.frame_disassemble_test()
+
+def setUp(self):
+# Call super's setUp().
+TestBase.setUp(self)
+
+def frame_disassemble_test(self):
+"""Sample test to ensure SBFrame::Disassemble produces SOME output"""
+exe = os.path.join(os.getcwd(), "a.out")
+
+# Create a target by the debugger.
+target = self.dbg.CreateTarget(exe)
+self.assertTrue(target, VALID_TARGET)
+
+# Now create a breakpoint in main.c at the source matching
+# "Set a breakpoint here"
+breakpoint = target.BreakpointCreateBySourceRegex(
+"Set a breakpoint here", lldb.SBFileSpec("main.cpp"))
+self.assertTrue(breakpoint and
+breakpoint.GetNumLocations() >= 1,
+VALID_BREAKPOINT)
+
+error = lldb.SBError()
+# This is the launch info.  If you want to launch with arguments or
+# environment variables, add them using SetArguments or
+# SetEnvironmentEntries
+
+launch_info = lldb.SBLaunchInfo(None)
+process = target.Launch(launch_info, error)
+self.assertTrue(process, PROCESS_IS_VALID)
+
+# Did we hit our breakpoint?
+from lldbsuite.test.lldbutil import get_threads_stopped_at_breakpoint
+threads = get_threads_stopped_at_breakpoint(process, breakpoint)
+self.assertTrue(
+len(threads) == 1,
+"There should be a thread stopped at our breakpoint")
+
+# The hit count for the breakpoint should be 1.
+self.assertTrue(breakpoint.GetHitCount() == 1)
+
+frame = threads[0].GetFrameAtIndex(0)
+disassembly = frame.Disassemble()
+self.assertTrue(len(disassembly) != 0, "Disassembly was empty.")

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/disassembly/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/disassembly/main.cpp?rev=296692&r1=296691&r2=296692&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/disassembly/main.cpp 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/disassembly/main.cpp 
Wed Mar  1 16:18:37 2017
@@ -20,7 +20,7 @@ main(int argc, char const *argv[])
 
 int array[3];
 
-array[0] = sum (1238, 78392);
+array[0] = sum (1238, 78392); // Set a breakpoint here
 array[1] = sum (379265, 23674);
 array[2] = sum (872934, 234);
 


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


[Lldb-commits] [lldb] r296693 - Make it clear what you should modify when you copy any of these sample

2017-03-01 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Wed Mar  1 16:23:30 2017
New Revision: 296693

URL: http://llvm.org/viewvc/llvm-project?rev=296693&view=rev
Log:
Make it clear what you should modify when you copy any of these sample
test cases.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/sample_test/TestSampleInlineTest.py
lldb/trunk/packages/Python/lldbsuite/test/sample_test/TestSampleTest.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/sample_test/TestSampleInlineTest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/sample_test/TestSampleInlineTest.py?rev=296693&r1=296692&r2=296693&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/sample_test/TestSampleInlineTest.py 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/sample_test/TestSampleInlineTest.py 
Wed Mar  1 16:23:30 2017
@@ -1,3 +1,7 @@
+"""
+Describe the purpose of the test here.
+"""
+
 from __future__ import absolute_import
 
 from lldbsuite.test import lldbinline

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/sample_test/TestSampleTest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/sample_test/TestSampleTest.py?rev=296693&r1=296692&r2=296693&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/sample_test/TestSampleTest.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/sample_test/TestSampleTest.py Wed 
Mar  1 16:23:30 2017
@@ -1,5 +1,5 @@
 """
-Sample test that runs a process to a source regexp breakpoint.
+Describe the purpose of the test class here.
 """
 
 from __future__ import print_function
@@ -13,14 +13,17 @@ import lldbsuite.test.lldbutil as lldbut
 from lldbsuite.test.lldbtest import *
 
 
-class SampleTestTestCase(TestBase):
+class RenameThisSampleTestTestCase(TestBase):
 
 mydir = TestBase.compute_mydir(__file__)
 
+# If your test case doesn't stress debug info, the 
+# set this to true.  That way it won't be run once for
+# each debug info format.
 NO_DEBUG_INFO_TESTCASE = True
 
-def test_sample(self):
-"""A sample test example that drives a debug session to a 
breakpoint."""
+def test_sample_rename_this(self):
+"""There can be many tests in a test case - describe this test here."""
 self.build()
 self.sample_test()
 
@@ -29,7 +32,7 @@ class SampleTestTestCase(TestBase):
 TestBase.setUp(self)
 
 def sample_test(self):
-"""A sample test example that drives a debug session to a 
breakpoint."""
+"""You might use the test implementation in several ways, say so 
here."""
 exe = os.path.join(os.getcwd(), "a.out")
 
 # Create a target by the debugger.


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


[Lldb-commits] [lldb] r296717 - Fix various warnings. NFC

2017-03-01 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Wed Mar  1 18:05:25 2017
New Revision: 296717

URL: http://llvm.org/viewvc/llvm-project?rev=296717&view=rev
Log:
Fix various warnings.  NFC

Modified:
lldb/trunk/source/Commands/CommandObjectFrame.cpp
lldb/trunk/source/Commands/CommandObjectType.cpp
lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Target/Process.cpp
lldb/trunk/source/Target/StackFrame.cpp
lldb/trunk/source/Target/Target.cpp
lldb/trunk/source/Utility/VASprintf.cpp

Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=296717&r1=296716&r2=296717&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Wed Mar  1 18:05:25 2017
@@ -194,10 +194,9 @@ protected:
 
 const bool qualify_cxx_base_classes = false;
 
-DumpValueObjectOptions::DeclPrintingHelper helper =
-[&valobj_sp, qualify_cxx_base_classes](
-ConstString type, ConstString var,
-const DumpValueObjectOptions &opts, Stream &stream) -> bool {
+DumpValueObjectOptions::DeclPrintingHelper helper = [&valobj_sp](
+ConstString type, ConstString var, const DumpValueObjectOptions &opts,
+Stream &stream) -> bool {
   const ValueObject::GetExpressionPathFormat format = ValueObject::
   GetExpressionPathFormat::eGetExpressionPathFormatHonorPointers;
   valobj_sp->GetExpressionPath(stream, qualify_cxx_base_classes, format);

Modified: lldb/trunk/source/Commands/CommandObjectType.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectType.cpp?rev=296717&r1=296716&r2=296717&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectType.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectType.cpp Wed Mar  1 18:05:25 2017
@@ -1188,8 +1188,7 @@ protected:
 category_closure(category_sp);
 } else {
   DataVisualization::Categories::ForEach(
-  [this, &command, &result, &category_regex, &formatter_regex,
-   &category_closure](
+  [&category_regex, &category_closure](
   const lldb::TypeCategoryImplSP &category) -> bool {
 if (category_regex) {
   bool escape = true;

Modified: lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp?rev=296717&r1=296716&r2=296717&view=diff
==
--- lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp 
(original)
+++ lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp Wed Mar 
 1 18:05:25 2017
@@ -44,358 +44,6 @@ using namespace lldb_private;
 //
 //--
 
-static const char *GetARMDWARFRegisterName(unsigned reg_num) {
-  switch (reg_num) {
-  case dwarf_r0:
-return "r0";
-  case dwarf_r1:
-return "r1";
-  case dwarf_r2:
-return "r2";
-  case dwarf_r3:
-return "r3";
-  case dwarf_r4:
-return "r4";
-  case dwarf_r5:
-return "r5";
-  case dwarf_r6:
-return "r6";
-  case dwarf_r7:
-return "r7";
-  case dwarf_r8:
-return "r8";
-  case dwarf_r9:
-return "r9";
-  case dwarf_r10:
-return "r10";
-  case dwarf_r11:
-return "r11";
-  case dwarf_r12:
-return "r12";
-  case dwarf_sp:
-return "sp";
-  case dwarf_lr:
-return "lr";
-  case dwarf_pc:
-return "pc";
-  case dwarf_cpsr:
-return "cpsr";
-
-  case dwarf_s0:
-return "s0";
-  case dwarf_s1:
-return "s1";
-  case dwarf_s2:
-return "s2";
-  case dwarf_s3:
-return "s3";
-  case dwarf_s4:
-return "s4";
-  case dwarf_s5:
-return "s5";
-  case dwarf_s6:
-return "s6";
-  case dwarf_s7:
-return "s7";
-  case dwarf_s8:
-return "s8";
-  case dwarf_s9:
-return "s9";
-  case dwarf_s10:
-return "s10";
-  case dwarf_s11:
-return "s11";
-  case dwarf_s12:
-return "s12";
-  case dwarf_s13:
-return "s13";
-  case dwarf_s14:
-return "s14";
-  case dwarf_s15:
-return "s15";
-  case dwarf_s16:
-return "s16";
-  case dwarf_s17:
-return "s17";
-  case dwarf_s18:
-return "s18";
-  case dwarf_s19:
-return "s19";
-  case dwarf_s20:
-return "s20";

[Lldb-commits] [PATCH] D30515: Made GetClangTargetCPU() const.

2017-03-01 Thread Jason Majors via Phabricator via lldb-commits
jmajors created this revision.

It does not change members or call non-const members.
HostInfo::GetArchitecture() returns a const object ref (maybe others?),
which can't access the non-const function.


https://reviews.llvm.org/D30515

Files:
  include/lldb/Core/ArchSpec.h
  source/Core/ArchSpec.cpp


Index: source/Core/ArchSpec.cpp
===
--- source/Core/ArchSpec.cpp
+++ source/Core/ArchSpec.cpp
@@ -657,7 +657,7 @@
   SetFlags(flag);
 }
 
-std::string ArchSpec::GetClangTargetCPU() {
+std::string ArchSpec::GetClangTargetCPU() const {
   std::string cpu;
   const llvm::Triple::ArchType machine = GetMachine();
 
Index: include/lldb/Core/ArchSpec.h
===
--- include/lldb/Core/ArchSpec.h
+++ include/lldb/Core/ArchSpec.h
@@ -307,7 +307,7 @@
   /// @return A string representing target CPU for the current
   /// architecture.
   //--
-  std::string GetClangTargetCPU();
+  std::string GetClangTargetCPU() const;
 
   //--
   /// Return a string representing target application ABI.


Index: source/Core/ArchSpec.cpp
===
--- source/Core/ArchSpec.cpp
+++ source/Core/ArchSpec.cpp
@@ -657,7 +657,7 @@
   SetFlags(flag);
 }
 
-std::string ArchSpec::GetClangTargetCPU() {
+std::string ArchSpec::GetClangTargetCPU() const {
   std::string cpu;
   const llvm::Triple::ArchType machine = GetMachine();
 
Index: include/lldb/Core/ArchSpec.h
===
--- include/lldb/Core/ArchSpec.h
+++ include/lldb/Core/ArchSpec.h
@@ -307,7 +307,7 @@
   /// @return A string representing target CPU for the current
   /// architecture.
   //--
-  std::string GetClangTargetCPU();
+  std::string GetClangTargetCPU() const;
 
   //--
   /// Return a string representing target application ABI.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D30515: Made GetClangTargetCPU() const.

2017-03-01 Thread Zachary Turner via lldb-commits
lgtm

On Wed, Mar 1, 2017 at 4:26 PM Jason Majors via Phabricator via
lldb-commits  wrote:

> jmajors created this revision.
>
> It does not change members or call non-const members.
> HostInfo::GetArchitecture() returns a const object ref (maybe others?),
> which can't access the non-const function.
>
>
> https://reviews.llvm.org/D30515
>
> Files:
>   include/lldb/Core/ArchSpec.h
>   source/Core/ArchSpec.cpp
>
>
> Index: source/Core/ArchSpec.cpp
> ===
> --- source/Core/ArchSpec.cpp
> +++ source/Core/ArchSpec.cpp
> @@ -657,7 +657,7 @@
>SetFlags(flag);
>  }
>
> -std::string ArchSpec::GetClangTargetCPU() {
> +std::string ArchSpec::GetClangTargetCPU() const {
>std::string cpu;
>const llvm::Triple::ArchType machine = GetMachine();
>
> Index: include/lldb/Core/ArchSpec.h
> ===
> --- include/lldb/Core/ArchSpec.h
> +++ include/lldb/Core/ArchSpec.h
> @@ -307,7 +307,7 @@
>/// @return A string representing target CPU for the current
>/// architecture.
>//--
> -  std::string GetClangTargetCPU();
> +  std::string GetClangTargetCPU() const;
>
>//--
>/// Return a string representing target application ABI.
>
>
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D30520: Make LLDB skip server-client roundtrip for signals that don't require any actions

2017-03-01 Thread Eugene Zemtsov via Phabricator via lldb-commits
eugene created this revision.

If QPassSignals packaet is supported by lldb-server, lldb-client will utilize 
it and ask the server to ignore signals that don't require stops or 
notifications.
Such signals will be immediately re-injected into inferior to continue normal 
execution.


https://reviews.llvm.org/D30520

Files:
  include/lldb/Target/UnixSignals.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
  source/Target/UnixSignals.cpp
  unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp

Index: unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
===
--- unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
+++ unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
@@ -211,10 +211,11 @@
   std::async(std::launch::async,
  [&] { return client.GetModulesInfo(file_specs, triple); });
   HandlePacket(
-  server, "jModulesInfo:["
-  R"({"file":"/foo/bar.so","triple":"i386-pc-linux"},)"
-  R"({"file":"/foo/baz.so","triple":"i386-pc-linux"},)"
-  R"({"file":"/foo/baw.so","triple":"i386-pc-linux"}])",
+  server,
+  "jModulesInfo:["
+  R"({"file":"/foo/bar.so","triple":"i386-pc-linux"},)"
+  R"({"file":"/foo/baz.so","triple":"i386-pc-linux"},)"
+  R"({"file":"/foo/baw.so","triple":"i386-pc-linux"}])",
   R"([{"uuid":"404142434445464748494a4b4c4d4e4f","triple":"i386-pc-linux",)"
   R"("file_path":"/foo/bar.so","file_offset":0,"file_size":1234}]])");
 
@@ -314,3 +315,27 @@
   << ss.GetString();
   ASSERT_EQ(10, num_packets);
 }
+
+TEST_F(GDBRemoteCommunicationClientTest, SendSignalsToIgnore) {
+  TestClient client;
+  MockServer server;
+  Connect(client, server);
+  if (HasFailure())
+return;
+
+  const lldb::tid_t tid = 0x47;
+  const uint32_t reg_num = 4;
+  std::future result = std::async(std::launch::async, [&] {
+return client.SendSignalsToIgnore({2, 3, 5, 7, 0xB, 0xD, 0x11});
+  });
+
+  HandlePacket(server, "QPassSignals:2;3;5;7;B;D;11", "OK");
+  EXPECT_TRUE(result.get().Success());
+
+  result = std::async(std::launch::async, [&] {
+return client.SendSignalsToIgnore(std::vector());
+  });
+
+  HandlePacket(server, "QPassSignals:", "OK");
+  EXPECT_TRUE(result.get().Success());
+}
Index: source/Target/UnixSignals.cpp
===
--- source/Target/UnixSignals.cpp
+++ source/Target/UnixSignals.cpp
@@ -123,12 +123,14 @@
   Signal new_signal(name, default_suppress, default_stop, default_notify,
 description, alias);
   m_signals.insert(std::make_pair(signo, new_signal));
+  ++m_version;
 }
 
 void UnixSignals::RemoveSignal(int signo) {
   collection::iterator pos = m_signals.find(signo);
   if (pos != m_signals.end())
 m_signals.erase(pos);
+  ++m_version;
 }
 
 const char *UnixSignals::GetSignalAsCString(int signo) const {
@@ -217,6 +219,7 @@
   collection::iterator pos = m_signals.find(signo);
   if (pos != m_signals.end()) {
 pos->second.m_suppress = value;
+++m_version;
 return true;
   }
   return false;
@@ -240,6 +243,7 @@
   collection::iterator pos = m_signals.find(signo);
   if (pos != m_signals.end()) {
 pos->second.m_stop = value;
+++m_version;
 return true;
   }
   return false;
@@ -263,6 +267,7 @@
   collection::iterator pos = m_signals.find(signo);
   if (pos != m_signals.end()) {
 pos->second.m_notify = value;
+++m_version;
 return true;
   }
   return false;
@@ -284,3 +289,7 @@
   std::advance(it, index);
   return it->first;
 }
+
+uint64_t UnixSignals::GetVersion() const {
+  return m_version;
+}
Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
@@ -403,12 +403,15 @@
   //--
   std::string m_partial_profile_data;
   std::map m_thread_id_to_used_usec_map;
+  uint64_t m_last_signals_version = 0;
 
   static bool NewThreadNotifyBreakpointHit(void *baton,
StoppointCallbackContext *context,
lldb::user_id_t break_id,
lldb::user_id_t break_loc_id);
 
+  Error SendSignalsToIgnoreIfNeeded();
+
   //--
   // ContinueDelegate interface
   //--
Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
-

[Lldb-commits] [PATCH] D30520: Make LLDB skip server-client roundtrip for signals that don't require any actions

2017-03-01 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

The ability to send a set of signals for the remote stub to ignore isn't 
inherently specific to the GDB Remote protocol.  Some other remote protocol 
could very well implement the same functionality.  SendSignalsToIgnoreIfNeeded 
seems like it should be in Process, and called in the Resume before DoResume 
gets called and in DidLaunch.


https://reviews.llvm.org/D30520



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


[Lldb-commits] [PATCH] D30520: Make LLDB skip server-client roundtrip for signals that don't require any actions

2017-03-01 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

Of course, the default implementation would do nothing, and you would override 
it with your GDB remote protocol specific version.


https://reviews.llvm.org/D30520



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


[Lldb-commits] [PATCH] D30520: Make LLDB skip server-client roundtrip for signals that don't require any actions

2017-03-01 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

Also, it would be good to add a test that ensures that calling "process handle" 
actually passes the right thing to your SendSignalsToIgnore.


https://reviews.llvm.org/D30520



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


[Lldb-commits] [lldb] r296733 - x86AssemblyInspectionEngine::AugmentUnwindPlanFromCallSite could access

2017-03-01 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Wed Mar  1 23:08:10 2017
New Revision: 296733

URL: http://llvm.org/viewvc/llvm-project?rev=296733&view=rev
Log:
x86AssemblyInspectionEngine::AugmentUnwindPlanFromCallSite could access
the byte past the end of the buffer it had been given.  ASAN catch.
 

Modified:
lldb/trunk/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp

Modified: 
lldb/trunk/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp?rev=296733&r1=296732&r2=296733&view=diff
==
--- 
lldb/trunk/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp 
Wed Mar  1 23:08:10 2017
@@ -979,11 +979,12 @@ bool x86AssemblyInspectionEngine::Augmen
 offset += insn_len;
 m_cur_insn = data + offset;
 
-if (reinstate_unwind_state) {
-  // that was the last instruction of this function
-  if (offset >= size)
-continue;
+// offset is pointing beyond the bounds of the
+// function; stop looping.
+if (offset >= size) 
+  continue;
 
+if (reinstate_unwind_state) {
   UnwindPlan::RowSP new_row(new UnwindPlan::Row());
   *new_row = *original_last_row;
   new_row->SetOffset(offset);


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