[Lldb-commits] [lldb] r295436 - Fix breakage caused by r295368

2017-02-17 Thread Pavel Labath via lldb-commits
Author: labath
Date: Fri Feb 17 04:19:46 2017
New Revision: 295436

URL: http://llvm.org/viewvc/llvm-project?rev=295436&view=rev
Log:
Fix breakage caused by r295368

Also move the ErrorTest into the Utility package, to follow the class it
is testing.

Added:
lldb/trunk/unittests/Utility/ErrorTest.cpp
  - copied, changed from r295400, lldb/trunk/unittests/Core/ErrorTest.cpp
Removed:
lldb/trunk/unittests/Core/ErrorTest.cpp
Modified:
lldb/trunk/source/Utility/Error.cpp
lldb/trunk/unittests/Core/CMakeLists.txt
lldb/trunk/unittests/Utility/CMakeLists.txt

Modified: lldb/trunk/source/Utility/Error.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/Error.cpp?rev=295436&r1=295435&r2=295436&view=diff
==
--- lldb/trunk/source/Utility/Error.cpp (original)
+++ lldb/trunk/source/Utility/Error.cpp Fri Feb 17 04:19:46 2017
@@ -235,6 +235,7 @@ int Error::SetErrorStringWithVarArg(cons
 
 llvm::SmallString<1024> buf;
 VASprintf(buf, format, args);
+m_string = buf.str();
 return buf.size();
   } else {
 m_string.clear();

Modified: lldb/trunk/unittests/Core/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Core/CMakeLists.txt?rev=295436&r1=295435&r2=295436&view=diff
==
--- lldb/trunk/unittests/Core/CMakeLists.txt (original)
+++ lldb/trunk/unittests/Core/CMakeLists.txt Fri Feb 17 04:19:46 2017
@@ -2,7 +2,6 @@ add_lldb_unittest(LLDBCoreTests
   ArchSpecTest.cpp
   BroadcasterTest.cpp
   DataExtractorTest.cpp
-  ErrorTest.cpp
   ListenerTest.cpp
   LogTest.cpp
   ScalarTest.cpp

Removed: lldb/trunk/unittests/Core/ErrorTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Core/ErrorTest.cpp?rev=295435&view=auto
==
--- lldb/trunk/unittests/Core/ErrorTest.cpp (original)
+++ lldb/trunk/unittests/Core/ErrorTest.cpp (removed)
@@ -1,19 +0,0 @@
-//===-- ErrorTest.cpp ---*- C++ 
-*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===--===//
-
-#include "lldb/Utility/Error.h"
-#include "gtest/gtest.h"
-
-using namespace lldb_private;
-
-TEST(ErrorTest, Formatv) {
-  EXPECT_EQ("", llvm::formatv("{0}", Error()).str());
-  EXPECT_EQ("Hello Error", llvm::formatv("{0}", Error("Hello Error")).str());
-  EXPECT_EQ("Hello", llvm::formatv("{0:5}", Error("Hello Error")).str());
-}

Modified: lldb/trunk/unittests/Utility/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/CMakeLists.txt?rev=295436&r1=295435&r2=295436&view=diff
==
--- lldb/trunk/unittests/Utility/CMakeLists.txt (original)
+++ lldb/trunk/unittests/Utility/CMakeLists.txt Fri Feb 17 04:19:46 2017
@@ -1,5 +1,6 @@
 add_lldb_unittest(UtilityTests
   ConstStringTest.cpp
+  ErrorTest.cpp
   StringExtractorTest.cpp
   TaskPoolTest.cpp
   TimeoutTest.cpp
@@ -8,6 +9,6 @@ add_lldb_unittest(UtilityTests
 
   LINK_LIBS
   lldbUtility
-LINK_COMPONENTS
-  Support
+  LINK_COMPONENTS
+Support
   )

Copied: lldb/trunk/unittests/Utility/ErrorTest.cpp (from r295400, 
lldb/trunk/unittests/Core/ErrorTest.cpp)
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/ErrorTest.cpp?p2=lldb/trunk/unittests/Utility/ErrorTest.cpp&p1=lldb/trunk/unittests/Core/ErrorTest.cpp&r1=295400&r2=295436&rev=295436&view=diff
==
(empty)


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


Re: [Lldb-commits] [lldb] r295369 - Fix build

2017-02-17 Thread Pavel Labath via lldb-commits
Hey Zach,

after you think you've fixed the build, could you check back on the
buildbot to make sure that it actually fixes things? In this case you
would've seen that after the build is fixed, the next thing it runs
into is about a dozen test failures.

In fact, this breakage was something that would have been already
caught by running the unit tests on windows, which leads me to believe
you didn't run them before submission.

Thanks,
pl


2017-02-16 20:15 GMT+00:00 Zachary Turner via lldb-commits
:
> Author: zturner
> Date: Thu Feb 16 14:15:26 2017
> New Revision: 295369
>
> URL: http://llvm.org/viewvc/llvm-project?rev=295369&view=rev
> Log:
> Fix build
>
> Modified:
> lldb/trunk/source/Utility/VASprintf.cpp
> lldb/trunk/unittests/Utility/VASprintfTest.cpp
>
> Modified: lldb/trunk/source/Utility/VASprintf.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/VASprintf.cpp?rev=295369&r1=295368&r2=295369&view=diff
> ==
> --- lldb/trunk/source/Utility/VASprintf.cpp (original)
> +++ lldb/trunk/source/Utility/VASprintf.cpp Thu Feb 16 14:15:26 2017
> @@ -7,7 +7,7 @@
>  //
>  
> //===--===//
>
> -#include "lldb/Utility/VASprintf.h"
> +#include "lldb/Utility/VASPrintf.h"
>
>  #include "llvm/ADT/SmallString.h"
>
>
> Modified: lldb/trunk/unittests/Utility/VASprintfTest.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/VASprintfTest.cpp?rev=295369&r1=295368&r2=295369&view=diff
> ==
> --- lldb/trunk/unittests/Utility/VASprintfTest.cpp (original)
> +++ lldb/trunk/unittests/Utility/VASprintfTest.cpp Thu Feb 16 14:15:26 2017
> @@ -7,7 +7,7 @@
>  //
>  
> //===--===//
>
> -#include "lldb/Utility/VASprintf.h"
> +#include "lldb/Utility/VASPrintf.h"
>  #include "llvm/ADT/SmallString.h"
>
>  #include "gtest/gtest.h"
>
>
> ___
> 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] [lldb] r295440 - NPL: Fix one more bug in the single step workaround

2017-02-17 Thread Pavel Labath via lldb-commits
Author: labath
Date: Fri Feb 17 05:48:34 2017
New Revision: 295440

URL: http://llvm.org/viewvc/llvm-project?rev=295440&view=rev
Log:
NPL: Fix one more bug in the single step workaround

In the case we are stepping over the thread creation instruction, we
will end up calling Thread::SingleStep back-to-back twice (because of
the intermediate PTRACE_EVENT_CLONE stop). This will cause the cpu mask
to be set inappropriately (because the old SingleStepCheck object will
be destroyed after we create the new one), and the single-step will
fail.

Before the refactor the code was still incorrect in this case, but in a
different way (the thread was left with the incorrect mask after the
stepping was complete), so this was not easy to spot.

This fixes TestCreateDuringInstructionStep on the affected devices.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/linux/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py
lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp
lldb/trunk/source/Plugins/Process/Linux/SingleStepCheck.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/linux/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/linux/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py?rev=295440&r1=295439&r2=295440&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/linux/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/linux/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py
 Fri Feb 17 05:48:34 2017
@@ -16,10 +16,7 @@ from lldbsuite.test import lldbutil
 class CreateDuringInstructionStepTestCase(TestBase):
 
 mydir = TestBase.compute_mydir(__file__)
-
-def setUp(self):
-# Call super's setUp().
-TestBase.setUp(self)
+NO_DEBUG_INFO_TESTCASE = True
 
 @skipUnlessPlatform(['linux'])
 @expectedFailureAndroid('llvm.org/pr24737', archs=['arm'])

Modified: lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp?rev=295440&r1=295439&r2=295440&view=diff
==
--- lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp Fri Feb 17 
05:48:34 2017
@@ -225,7 +225,13 @@ Error NativeThreadLinux::SingleStep(uint
   MaybeLogStateChange(new_state);
   m_state = new_state;
   m_stop_info.reason = StopReason::eStopReasonNone;
-  m_step_workaround = SingleStepWorkaround::Get(m_tid);
+
+  if(!m_step_workaround) {
+// If we already hava a workaround inplace, don't reset it. Otherwise, the
+// destructor of the existing instance will run after the new instance has
+// fetched the cpu mask, and the thread will end up with the wrong mask.
+m_step_workaround = SingleStepWorkaround::Get(m_tid);
+  }
 
   intptr_t data = 0;
   if (signo != LLDB_INVALID_SIGNAL_NUMBER)

Modified: lldb/trunk/source/Plugins/Process/Linux/SingleStepCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/SingleStepCheck.cpp?rev=295440&r1=295439&r2=295440&view=diff
==
--- lldb/trunk/source/Plugins/Process/Linux/SingleStepCheck.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/SingleStepCheck.cpp Fri Feb 17 
05:48:34 2017
@@ -172,8 +172,9 @@ std::unique_ptr Si
 }
 
 SingleStepWorkaround::~SingleStepWorkaround() {
+  Log *log = ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD);
+  LLDB_LOG(log, "Removing workaround");
   if (sched_setaffinity(m_tid, sizeof m_original_set, &m_original_set) != 0) {
-Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
 LLDB_LOG(log, "Unable to reset cpu affinity for thread {0}: {1}", m_tid,
  Error(errno, eErrorTypePOSIX));
   }


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


[Lldb-commits] [lldb] r295443 - Fix VASprintfTest on darwin

2017-02-17 Thread Pavel Labath via lldb-commits
Author: labath
Date: Fri Feb 17 07:27:50 2017
New Revision: 295443

URL: http://llvm.org/viewvc/llvm-project?rev=295443&view=rev
Log:
Fix VASprintfTest on darwin

The way of injecting an error into the printf call was not working on
darwin - the C library still happily format the character. It only
returns an error after we use a wide character that does not fit into a
single byte, so switch the test to use that.

Modified:
lldb/trunk/unittests/Utility/VASprintfTest.cpp

Modified: lldb/trunk/unittests/Utility/VASprintfTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/VASprintfTest.cpp?rev=295443&r1=295442&r2=295443&view=diff
==
--- lldb/trunk/unittests/Utility/VASprintfTest.cpp (original)
+++ lldb/trunk/unittests/Utility/VASprintfTest.cpp Fri Feb 17 07:27:50 2017
@@ -49,11 +49,11 @@ TEST(VASprintfTest, EncodingError) {
   setlocale(LC_ALL, ".932");
 
   wchar_t Invalid[2];
-  Invalid[0] = 129;
+  Invalid[0] = 0x100;
   Invalid[1] = 0;
   llvm::SmallString<32> Buffer;
   EXPECT_FALSE(Sprintf(Buffer, "%ls", Invalid));
   EXPECT_EQ("", Buffer);
 
-  setlocale(LC_CTYPE, Current.c_str());
+  setlocale(LC_ALL, Current.c_str());
 }


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


[Lldb-commits] [lldb] r295442 - Reapply "Refactor log channel registration mechanism"

2017-02-17 Thread Pavel Labath via lldb-commits
Author: labath
Date: Fri Feb 17 07:27:42 2017
New Revision: 295442

URL: http://llvm.org/viewvc/llvm-project?rev=295442&view=rev
Log:
Reapply "Refactor log channel registration mechanism"

Changes wrt. previous version:
- add #include : fix build on windows
- add extra {} around the string literals used to initialize
  llvm::StringLiteral: fix gcc build

Modified:
lldb/trunk/include/lldb/Core/Log.h
lldb/trunk/include/lldb/Core/PluginManager.h
lldb/trunk/include/lldb/lldb-forward.h
lldb/trunk/include/lldb/lldb-private-interfaces.h
lldb/trunk/source/Commands/CommandObjectLog.cpp
lldb/trunk/source/Core/Log.cpp
lldb/trunk/source/Core/PluginManager.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/unittests/Core/LogTest.cpp

Modified: lldb/trunk/include/lldb/Core/Log.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Log.h?rev=295442&r1=295441&r2=295442&view=diff
==
--- lldb/trunk/include/lldb/Core/Log.h (original)
+++ lldb/trunk/include/lldb/Core/Log.h Fri Feb 17 07:27:42 2017
@@ -12,7 +12,6 @@
 
 // Project includes
 #include "lldb/Core/Logging.h"
-#include "lldb/Core/PluginInterface.h"
 #include "lldb/Utility/ConstString.h"
 #include "lldb/Utility/Flags.h"
 #include "lldb/lldb-private.h"
@@ -20,6 +19,7 @@
 // Other libraries and framework includes
 #include "llvm/Support/FormatVariadic.h"
 // C++ Includes
+#include 
 #include 
 #include 
 // C Includes
@@ -44,6 +44,53 @@ namespace lldb_private {
 
 class Log final {
 public:
+  // Description of a log channel category.
+  struct Category {
+llvm::StringLiteral name;
+llvm::StringLiteral description;
+uint32_t flag;
+  };
+
+  // This class describes a log channel. It also encapsulates the behavior
+  // necessary to enable a log channel in an atomic manner.
+  class Channel {
+std::atomic log_ptr;
+
+  public:
+const llvm::ArrayRef categories;
+const uint32_t default_flags;
+
+constexpr Channel(llvm::ArrayRef categories,
+  uint32_t default_flags)
+: log_ptr(nullptr), categories(categories),
+  default_flags(default_flags) {}
+
+// This function is safe to call at any time
+// FIXME: Not true yet, mask access is not atomic
+Log *GetLogIfAll(uint32_t mask) {
+  Log *log = log_ptr.load(std::memory_order_acquire);
+  if (log && log->GetMask().AllSet(mask))
+return log;
+  return nullptr;
+}
+
+// This function is safe to call at any time
+// FIXME: Not true yet, mask access is not atomic
+Log *GetLogIfAny(uint32_t mask) {
+  Log *log = log_ptr.load(std::memory_order_acquire);
+  if (log && log->GetMask().AnySet(mask))
+return log;
+  return nullptr;
+}
+
+// Calls to Enable and disable need to be serialized externally.
+void Enable(Log &log, const std::shared_ptr &stream_sp,
+uint32_t flags);
+
+// Calls to Enable and disable need to be serialized externally.
+void Disable(uint32_t flags);
+  };
+
   //--
   // Callback definitions for abstracted plug-in log access.
   //--
@@ -63,6 +110,9 @@ public:
   //--
   // Static accessors for logging channels
   //--
+  static void Register(llvm::StringRef name, Channel &channel);
+  static void Unregister(llvm::StringRef name);
+
   static void RegisterLogChannel(const ConstString &channel,
  const Log::Callbacks &log_callbacks);
 
@@ -73,13 +123,13 @@ public:
 
   static bool
   EnableLogChannel(const std::shared_ptr &log_stream_sp,
-   uint32_t log_options, const char *channel,
+   uint32_t log_options, llvm::StringRef channel,
const char **categories, Stream &error_stream);
 
-  static void
-  EnableAllLogChannels(const std::shared_ptr &log_stream_sp,
-   uint32_t log_options, const char **categories,
-   Stream *feedback_strm);
+  static bool DisableLogChannel(llvm::StringRef channel,
+const char **categories, Stream &error_stream);
+
+  static bool ListChannelCategories(llvm::StringRef channel, Stream &stream);
 
   static void DisableAllLogChannels(Stream *feedback_strm);
 
@@ -90,12 +140,6 @@ public:
   static void Terminate();
 
   //--
-  // Auto completion
-  //--
-  static void AutoCompleteChannelName(const char *channel_nam

[Lldb-commits] [PATCH] D30005: Fix compiler warnings for missing switch cases in lldb.

2017-02-17 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL295445: Fix compiler warnings for missing switch cases in 
lldb. (authored by labath).

Changed prior to commit:
  https://reviews.llvm.org/D30005?vs=88604&id=88876#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30005

Files:
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
  lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  lldb/trunk/source/Symbol/ClangASTContext.cpp
  lldb/trunk/source/Symbol/ClangExternalASTSourceCallbacks.cpp

Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -1907,6 +1907,7 @@
 llvm::Triple triple(llvm::Twine("-") + vendor_name + "-" + os_name);
 
 assert(triple.getObjectFormat() != llvm::Triple::UnknownObjectFormat);
+assert(triple.getObjectFormat() != llvm::Triple::Wasm);
 switch (triple.getObjectFormat()) {
 case llvm::Triple::MachO:
   m_process_arch.SetArchitecture(eArchTypeMachO, cpu, sub);
@@ -1917,6 +1918,10 @@
 case llvm::Triple::COFF:
   m_process_arch.SetArchitecture(eArchTypeCOFF, cpu, sub);
   break;
+case llvm::Triple::Wasm:
+  if (log)
+log->Printf("error: not supported target architecture");
+  return false;
 case llvm::Triple::UnknownObjectFormat:
   if (log)
 log->Printf("error: failed to determine target architecture");
Index: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
===
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
@@ -139,6 +139,7 @@
   case DeclarationName::CXXConstructorName:
   case DeclarationName::CXXDestructorName:
   case DeclarationName::CXXConversionFunctionName:
+  case DeclarationName::CXXDeductionGuideName:
 SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
 return false;
   }
Index: lldb/trunk/source/Symbol/ClangExternalASTSourceCallbacks.cpp
===
--- lldb/trunk/source/Symbol/ClangExternalASTSourceCallbacks.cpp
+++ lldb/trunk/source/Symbol/ClangExternalASTSourceCallbacks.cpp
@@ -61,93 +61,6 @@
   }
 
   std::string decl_name(clang_decl_name.getAsString());
-
-  switch (clang_decl_name.getNameKind()) {
-  // Normal identifiers.
-  case clang::DeclarationName::Identifier:
-// printf
-// ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx
-// = %p, decl_name = { kind = \"Identifier\", name = \"%s\")\n", decl_ctx,
-// decl_name.c_str());
-if (clang_decl_name.getAsIdentifierInfo()->getBuiltinID() != 0) {
-  SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
-  return false;
-}
-break;
-
-  case clang::DeclarationName::ObjCZeroArgSelector:
-// printf
-// ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx
-// = %p, decl_name = { kind = \"ObjCZeroArgSelector\", name = \"%s\")\n",
-// decl_ctx, decl_name.c_str());
-SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
-return false;
-
-  case clang::DeclarationName::ObjCOneArgSelector:
-// printf
-// ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx
-// = %p, decl_name = { kind = \"ObjCOneArgSelector\", name = \"%s\")\n",
-// decl_ctx, decl_name.c_str());
-SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
-return false;
-
-  case clang::DeclarationName::ObjCMultiArgSelector:
-// printf
-// ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx
-// = %p, decl_name = { kind = \"ObjCMultiArgSelector\", name = \"%s\")\n",
-// decl_ctx, decl_name.c_str());
-SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
-return false;
-
-  case clang::DeclarationName::CXXConstructorName:
-// printf
-// ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx
-// = %p, decl_name = { kind = \"CXXConstructorName\", name = \"%s\")\n",
-// decl_ctx, decl_name.c_str());
-SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
-return false;
-
-  case clang::DeclarationName::CXXDestructorName:
-// printf
-// ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx
-// = %p, decl_name = { kind = \"CXXDestructorName\", name = \"%s\")\n",
-// decl_ctx, decl_name.c_str());
-SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
-return false;
-
-  case clang::DeclarationName::CXXConversionFunctionNa

[Lldb-commits] [lldb] r295445 - Fix compiler warnings for missing switch cases in lldb.

2017-02-17 Thread Pavel Labath via lldb-commits
Author: labath
Date: Fri Feb 17 07:39:50 2017
New Revision: 295445

URL: http://llvm.org/viewvc/llvm-project?rev=295445&view=rev
Log:
Fix compiler warnings for missing switch cases in lldb.

Summary:
There have been a few new values added to a few LLVM enums
this change makes sure that LLDB code handles them correctly.

Reviewers: labath

Reviewed By: labath

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D30005
Author: Eugene Zemtsov 

Modified:
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/trunk/source/Symbol/ClangASTContext.cpp
lldb/trunk/source/Symbol/ClangExternalASTSourceCallbacks.cpp

Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp?rev=295445&r1=295444&r2=295445&view=diff
==
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp 
(original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp Fri Feb 
17 07:39:50 2017
@@ -139,6 +139,7 @@ bool ClangASTSource::FindExternalVisible
   case DeclarationName::CXXConstructorName:
   case DeclarationName::CXXDestructorName:
   case DeclarationName::CXXConversionFunctionName:
+  case DeclarationName::CXXDeductionGuideName:
 SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
 return false;
   }

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=295445&r1=295444&r2=295445&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
Fri Feb 17 07:39:50 2017
@@ -1907,6 +1907,7 @@ bool GDBRemoteCommunicationClient::GetCu
 llvm::Triple triple(llvm::Twine("-") + vendor_name + "-" + os_name);
 
 assert(triple.getObjectFormat() != llvm::Triple::UnknownObjectFormat);
+assert(triple.getObjectFormat() != llvm::Triple::Wasm);
 switch (triple.getObjectFormat()) {
 case llvm::Triple::MachO:
   m_process_arch.SetArchitecture(eArchTypeMachO, cpu, sub);
@@ -1917,6 +1918,10 @@ bool GDBRemoteCommunicationClient::GetCu
 case llvm::Triple::COFF:
   m_process_arch.SetArchitecture(eArchTypeCOFF, cpu, sub);
   break;
+case llvm::Triple::Wasm:
+  if (log)
+log->Printf("error: not supported target architecture");
+  return false;
 case llvm::Triple::UnknownObjectFormat:
   if (log)
 log->Printf("error: failed to determine target architecture");

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=295445&r1=295444&r2=295445&view=diff
==
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Fri Feb 17 07:39:50 2017
@@ -4316,6 +4316,8 @@ ClangASTContext::GetTypeClass(lldb::opaq
 break;
   case clang::Type::TemplateSpecialization:
 break;
+  case clang::Type::DeducedTemplateSpecialization:
+break;
   case clang::Type::Atomic:
 break;
   case clang::Type::Pipe:
@@ -5124,6 +5126,7 @@ lldb::Encoding ClangASTContext::GetEncod
   case clang::Type::TypeOf:
   case clang::Type::Decltype:
   case clang::Type::TemplateSpecialization:
+  case clang::Type::DeducedTemplateSpecialization:
   case clang::Type::Atomic:
   case clang::Type::Adjusted:
   case clang::Type::Pipe:
@@ -5273,6 +5276,7 @@ lldb::Format ClangASTContext::GetFormat(
   case clang::Type::TypeOf:
   case clang::Type::Decltype:
   case clang::Type::TemplateSpecialization:
+  case clang::Type::DeducedTemplateSpecialization:
   case clang::Type::Atomic:
   case clang::Type::Adjusted:
   case clang::Type::Pipe:

Modified: lldb/trunk/source/Symbol/ClangExternalASTSourceCallbacks.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangExternalASTSourceCallbacks.cpp?rev=295445&r1=295444&r2=295445&view=diff
==
--- lldb/trunk/source/Symbol/ClangExternalASTSourceCallbacks.cpp (original)
+++ lldb/trunk/source/Symbol/ClangExternalASTSourceCallbacks.cpp Fri Feb 17 
07:39:50 2017
@@ -61,93 +61,6 @@ bool ClangExternalASTSourceCallbacks::Fi
   }
 
   std::string decl_name(clang_decl_name.getAsString());
-
-  switch (clang_decl_name.getNameKind()) {
-  // Normal identifiers.
-  case clang::Declaratio

[Lldb-commits] [PATCH] D29985: [lldb] [test] Fix finding LLDB tools when building stand-alone

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

Thanks, I feel more comfortable with this one.

Let's give the others a but more time to chime in. If they don't I guess you 
can submit this. :)


https://reviews.llvm.org/D29985



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


[Lldb-commits] [lldb] r295450 - Switch ProcessKDPLog to the new channel registration mechanism

2017-02-17 Thread Pavel Labath via lldb-commits
Author: labath
Date: Fri Feb 17 09:08:08 2017
New Revision: 295450

URL: http://llvm.org/viewvc/llvm-project?rev=295450&view=rev
Log:
Switch ProcessKDPLog to the new channel registration mechanism

Modified:
lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.cpp
lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.h
lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp

Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp?rev=295450&r1=295449&r2=295450&view=diff
==
--- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp Fri Feb 17 
09:08:08 2017
@@ -726,11 +726,7 @@ void ProcessKDP::Initialize() {
   GetPluginDescriptionStatic(), CreateInstance,
   DebuggerInitialize);
 
-Log::Callbacks log_callbacks = {ProcessKDPLog::DisableLog,
-ProcessKDPLog::EnableLog,
-ProcessKDPLog::ListLogCategories};
-
-Log::RegisterLogChannel(ProcessKDP::GetPluginNameStatic(), log_callbacks);
+ProcessKDPLog::Initialize();
   });
 }
 

Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.cpp?rev=295450&r1=295449&r2=295450&view=diff
==
--- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.cpp Fri Feb 
17 09:08:08 2017
@@ -9,181 +9,28 @@
 
 #include "ProcessKDPLog.h"
 
-#include "lldb/Core/StreamFile.h"
-#include "lldb/Interpreter/Args.h"
-
-#include "ProcessKDP.h"
-
 using namespace lldb;
 using namespace lldb_private;
 
-// We want to avoid global constructors where code needs to be run so here we
-// control access to our static g_log_sp by hiding it in a singleton function
-// that will construct the static g_log_sp the first time this function is
-// called.
-static bool g_log_enabled = false;
-static Log *g_log = NULL;
-static Log *GetLog() {
-  if (!g_log_enabled)
-return NULL;
-  return g_log;
-}
-
-Log *ProcessKDPLog::GetLogIfAllCategoriesSet(uint32_t mask) {
-  Log *log(GetLog());
-  if (log && mask) {
-uint32_t log_mask = log->GetMask().Get();
-if ((log_mask & mask) != mask)
-  return NULL;
-  }
-  return log;
-}
-
-void ProcessKDPLog::DisableLog(const char **categories, Stream *feedback_strm) 
{
-  Log *log(GetLog());
-  if (log) {
-uint32_t flag_bits = 0;
-
-if (categories[0] != NULL) {
-  flag_bits = log->GetMask().Get();
-  for (size_t i = 0; categories[i] != NULL; ++i) {
-const char *arg = categories[i];
-
-if (::strcasecmp(arg, "all") == 0)
-  flag_bits &= ~KDP_LOG_ALL;
-else if (::strcasecmp(arg, "async") == 0)
-  flag_bits &= ~KDP_LOG_ASYNC;
-else if (::strncasecmp(arg, "break", 5) == 0)
-  flag_bits &= ~KDP_LOG_BREAKPOINTS;
-else if (::strncasecmp(arg, "comm", 4) == 0)
-  flag_bits &= ~KDP_LOG_COMM;
-else if (::strcasecmp(arg, "default") == 0)
-  flag_bits &= ~KDP_LOG_DEFAULT;
-else if (::strcasecmp(arg, "packets") == 0)
-  flag_bits &= ~KDP_LOG_PACKETS;
-else if (::strcasecmp(arg, "memory") == 0)
-  flag_bits &= ~KDP_LOG_MEMORY;
-else if (::strcasecmp(arg, "data-short") == 0)
-  flag_bits &= ~KDP_LOG_MEMORY_DATA_SHORT;
-else if (::strcasecmp(arg, "data-long") == 0)
-  flag_bits &= ~KDP_LOG_MEMORY_DATA_LONG;
-else if (::strcasecmp(arg, "process") == 0)
-  flag_bits &= ~KDP_LOG_PROCESS;
-else if (::strcasecmp(arg, "step") == 0)
-  flag_bits &= ~KDP_LOG_STEP;
-else if (::strcasecmp(arg, "thread") == 0)
-  flag_bits &= ~KDP_LOG_THREAD;
-else if (::strncasecmp(arg, "watch", 5) == 0)
-  flag_bits &= ~KDP_LOG_WATCHPOINTS;
-else {
-  feedback_strm->Printf("error: unrecognized log category '%s'\n", 
arg);
-  ListLogCategories(feedback_strm);
-}
-  }
-}
-
-log->GetMask().Reset(flag_bits);
-if (flag_bits == 0)
-  g_log_enabled = false;
-  }
-
-  return;
-}
-
-Log *ProcessKDPLog::EnableLog(
-const std::shared_ptr &log_stream_sp,
-uint32_t log_options, const char **categories, Stream *feedback_strm) {
-  // Try see if there already is a log - that way we can reuse its settings.
-  // We could reuse the log in toto, but we don't know that the stream is the
-  // same.
-  uint32_t flag_bits = 0;
-  if

[Lldb-commits] [PATCH] D30094: Fix a couple of corner cases in NameMatches

2017-02-17 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
Herald added a subscriber: mgorny.

I originally set out to move the NameMatches closer to the relevant
function and add some unit tests. However, in the process I've found a
couple of bugs in the implementation:

- the early exits where not always correct:
  - (test==pattern) does not mean the match will always suceed because of 
regular expressions
  - pattern.empty() does not mean the match will fail because the "" is a valid 
prefix of any string

So I cleaned up those and added some tests. The only tricky part here
was that regcomp() implementation on darwin did not recognise the empty
string as a regular expression and returned an REG_EMPTY error instead.
The simples fix here seemed to be to replace the empty expression with
an equivalent non-empty one.


https://reviews.llvm.org/D30094

Files:
  include/lldb/Target/Process.h
  include/lldb/Utility/NameMatches.h
  include/lldb/lldb-private-enumerations.h
  source/Commands/CommandObjectPlatform.cpp
  source/Commands/CommandObjectProcess.cpp
  source/Core/ArchSpec.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
  source/Target/Process.cpp
  source/Utility/NameMatches.cpp
  source/Utility/RegularExpression.cpp
  unittests/Utility/CMakeLists.txt
  unittests/Utility/NameMatchesTest.cpp

Index: unittests/Utility/NameMatchesTest.cpp
===
--- /dev/null
+++ unittests/Utility/NameMatchesTest.cpp
@@ -0,0 +1,58 @@
+//===-- NameMatchesTest.cpp -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "lldb/Utility/NameMatches.h"
+#include "gtest/gtest.h"
+
+using namespace lldb_private;
+
+TEST(NameMatchesTest, Ignore) {
+  EXPECT_TRUE(NameMatches("foo", NameMatch::Ignore, "bar"));
+}
+
+TEST(NameMatchesTest, Equals) {
+  EXPECT_TRUE(NameMatches("foo", NameMatch::Equals, "foo"));
+  EXPECT_FALSE(NameMatches("foo", NameMatch::Equals, "bar"));
+}
+
+TEST(NameMatchesTest, Contains) {
+  EXPECT_TRUE(NameMatches("foobar", NameMatch::Contains, "foo"));
+  EXPECT_TRUE(NameMatches("foobar", NameMatch::Contains, "oob"));
+  EXPECT_TRUE(NameMatches("foobar", NameMatch::Contains, "bar"));
+  EXPECT_TRUE(NameMatches("foobar", NameMatch::Contains, "foobar"));
+  EXPECT_TRUE(NameMatches("", NameMatch::Contains, ""));
+  EXPECT_FALSE(NameMatches("", NameMatch::Contains, "foo"));
+  EXPECT_FALSE(NameMatches("foobar", NameMatch::Contains, "baz"));
+}
+
+TEST(NameMatchesTest, StartsWith) {
+  EXPECT_TRUE(NameMatches("foo", NameMatch::StartsWith, "f"));
+  EXPECT_TRUE(NameMatches("foo", NameMatch::StartsWith, ""));
+  EXPECT_TRUE(NameMatches("", NameMatch::StartsWith, ""));
+  EXPECT_FALSE(NameMatches("foo", NameMatch::StartsWith, "b"));
+  EXPECT_FALSE(NameMatches("", NameMatch::StartsWith, "b"));
+}
+
+TEST(NameMatchesTest, EndsWith) {
+  EXPECT_TRUE(NameMatches("foo", NameMatch::EndsWith, "o"));
+  EXPECT_TRUE(NameMatches("foo", NameMatch::EndsWith, ""));
+  EXPECT_TRUE(NameMatches("", NameMatch::EndsWith, ""));
+  EXPECT_FALSE(NameMatches("foo", NameMatch::EndsWith, "b"));
+  EXPECT_FALSE(NameMatches("", NameMatch::EndsWith, "b"));
+}
+
+TEST(NameMatchesTest, RegularExpression) {
+  EXPECT_TRUE(NameMatches("foobar", NameMatch::RegularExpression, "foo"));
+  EXPECT_TRUE(NameMatches("foobar", NameMatch::RegularExpression, "f[oa]o"));
+  EXPECT_TRUE(NameMatches("foo", NameMatch::RegularExpression, ""));
+  EXPECT_TRUE(NameMatches("", NameMatch::RegularExpression, ""));
+  EXPECT_FALSE(NameMatches("foo", NameMatch::RegularExpression, "b"));
+  EXPECT_FALSE(NameMatches("", NameMatch::RegularExpression, "b"));
+  EXPECT_FALSE(NameMatches("^a", NameMatch::RegularExpression, "^a"));
+}
Index: unittests/Utility/CMakeLists.txt
===
--- unittests/Utility/CMakeLists.txt
+++ unittests/Utility/CMakeLists.txt
@@ -1,6 +1,7 @@
 add_lldb_unittest(UtilityTests
   ConstStringTest.cpp
   ErrorTest.cpp
+  NameMatchesTest.cpp
   StringExtractorTest.cpp
   TaskPoolTest.cpp
   TimeoutTest.cpp
Index: source/Utility/RegularExpression.cpp
===
--- source/Utility/RegularExpression.cpp
+++ source/Utility/RegularExpression.cpp
@@ -81,14 +81,10 @@
 bool RegularExpression::Compile(llvm::StringRef str) {
   Free();
 
-  if (!str.empty()) {
-m_re = str;
-m_comp_err = ::regcomp(&m_preg, m_re.c_str(), DEFAULT_COMPILE_FLAGS);
-  } else {
-// No valid regular expression
-m_comp_err = 1;
-  }
-
+  // regcomp() on darwin does not recognize "" as a valid regular expression, so
+  // we substitute it with an equivalent non

Re: [Lldb-commits] [lldb] r295369 - Fix build

2017-02-17 Thread Zachary Turner via lldb-commits
Sorry about that, it's often frustrating to check every single buildbot
that was failing because 99% of the time they fail for exactly the same
reason, and when one is fixed all of them get fixed. In this case i used
http://lab.llvm.org:8011/builders/lldb-amd64-ninja-freebsd11/builds/5417 as
evidence that the change was good, but in hindsight this one doesn't run
tests, so that was my mistake.

Regarding the tests, i ran all of UtilityTests but not the whole test
suite.  Again my mistake, was trying to cut corners and it backfired :(



On Fri, Feb 17, 2017 at 2:35 AM Pavel Labath  wrote:

Hey Zach,

after you think you've fixed the build, could you check back on the
buildbot to make sure that it actually fixes things? In this case you
would've seen that after the build is fixed, the next thing it runs
into is about a dozen test failures.

In fact, this breakage was something that would have been already
caught by running the unit tests on windows, which leads me to believe
you didn't run them before submission.

Thanks,
pl


2017-02-16 20:15 GMT+00:00 Zachary Turner via lldb-commits
:
> Author: zturner
> Date: Thu Feb 16 14:15:26 2017
> New Revision: 295369
>
> URL: http://llvm.org/viewvc/llvm-project?rev=295369&view=rev
> Log:
> Fix build
>
> Modified:
> lldb/trunk/source/Utility/VASprintf.cpp
> lldb/trunk/unittests/Utility/VASprintfTest.cpp
>
> Modified: lldb/trunk/source/Utility/VASprintf.cpp
> URL:
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/VASprintf.cpp?rev=295369&r1=295368&r2=295369&view=diff
>
==
> --- lldb/trunk/source/Utility/VASprintf.cpp (original)
> +++ lldb/trunk/source/Utility/VASprintf.cpp Thu Feb 16 14:15:26 2017
> @@ -7,7 +7,7 @@
>  //
>
//===--===//
>
> -#include "lldb/Utility/VASprintf.h"
> +#include "lldb/Utility/VASPrintf.h"
>
>  #include "llvm/ADT/SmallString.h"
>
>
> Modified: lldb/trunk/unittests/Utility/VASprintfTest.cpp
> URL:
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/VASprintfTest.cpp?rev=295369&r1=295368&r2=295369&view=diff
>
==
> --- lldb/trunk/unittests/Utility/VASprintfTest.cpp (original)
> +++ lldb/trunk/unittests/Utility/VASprintfTest.cpp Thu Feb 16 14:15:26
2017
> @@ -7,7 +7,7 @@
>  //
>
//===--===//
>
> -#include "lldb/Utility/VASprintf.h"
> +#include "lldb/Utility/VASPrintf.h"
>  #include "llvm/ADT/SmallString.h"
>
>  #include "gtest/gtest.h"
>
>
> ___
> 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] [lldb] r295455 - Switch GDBRemoteLog to the new registration mechanism

2017-02-17 Thread Pavel Labath via lldb-commits
Author: labath
Date: Fri Feb 17 10:09:06 2017
New Revision: 295455

URL: http://llvm.org/viewvc/llvm-project?rev=295455&view=rev
Log:
Switch GDBRemoteLog to the new registration mechanism

Modified:
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h
lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp?rev=295455&r1=295454&r2=295455&view=diff
==
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp Fri 
Feb 17 10:09:06 2017
@@ -8,207 +8,37 @@
 
//===--===//
 
 #include "ProcessGDBRemoteLog.h"
-
-#include 
-
-#include "lldb/Core/StreamFile.h"
-#include "lldb/Interpreter/Args.h"
-
-#include "llvm/Support/Threading.h"
-
 #include "ProcessGDBRemote.h"
+#include "llvm/Support/Threading.h"
 
 using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::process_gdb_remote;
 
-// We want to avoid global constructors where code needs to be run so here we
-// control access to our static g_log_sp by hiding it in a singleton function
-// that will construct the static g_lob_sp the first time this function is
-// called.
-static bool g_log_enabled = false;
-static Log *g_log = NULL;
-static Log *GetLog() {
-  if (!g_log_enabled)
-return NULL;
-  return g_log;
-}
+static constexpr Log::Category g_categories[] = {
+{{"async"}, {"log asynchronous activity"}, GDBR_LOG_ASYNC},
+{{"break"}, {"log breakpoints"}, GDBR_LOG_BREAKPOINTS},
+{{"comm"}, {"log communication activity"}, GDBR_LOG_COMM},
+{{"packets"}, {"log gdb remote packets"}, GDBR_LOG_PACKETS},
+{{"memory"}, {"log memory reads and writes"}, GDBR_LOG_MEMORY},
+{{"data-short"},
+ {"log memory bytes for memory reads and writes for short transactions "
+  "only"},
+ GDBR_LOG_MEMORY_DATA_SHORT},
+{{"data-long"},
+ {"log memory bytes for memory reads and writes for all transactions"},
+ GDBR_LOG_MEMORY_DATA_LONG},
+{{"process"}, {"log process events and activities"}, GDBR_LOG_PROCESS},
+{{"step"}, {"log step related activities"}, GDBR_LOG_STEP},
+{{"thread"}, {"log thread events and activities"}, GDBR_LOG_THREAD},
+{{"watch"}, {"log watchpoint related activities"}, GDBR_LOG_WATCHPOINTS},
+};
+
+Log::Channel ProcessGDBRemoteLog::g_channel(g_categories, GDBR_LOG_DEFAULT);
 
 void ProcessGDBRemoteLog::Initialize() {
-  static ConstString g_name("gdb-remote");
   static llvm::once_flag g_once_flag;
-
   llvm::call_once(g_once_flag, []() {
-Log::Callbacks log_callbacks = {DisableLog, EnableLog, ListLogCategories};
-
-Log::RegisterLogChannel(g_name, log_callbacks);
+Log::Register("gdb-remote", g_channel);
   });
 }
-
-Log *ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(uint32_t mask) {
-  Log *log(GetLog());
-  if (log && mask) {
-uint32_t log_mask = log->GetMask().Get();
-if ((log_mask & mask) != mask)
-  return NULL;
-  }
-  return log;
-}
-
-Log *ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet(uint32_t mask) {
-  Log *log(GetLog());
-  if (log && log->GetMask().Get() & mask)
-return log;
-  return NULL;
-}
-
-void ProcessGDBRemoteLog::DisableLog(const char **categories,
- Stream *feedback_strm) {
-  Log *log(GetLog());
-  if (log) {
-uint32_t flag_bits = 0;
-
-if (categories && categories[0]) {
-  flag_bits = log->GetMask().Get();
-  for (size_t i = 0; categories[i] != NULL; ++i) {
-const char *arg = categories[i];
-
-if (::strcasecmp(arg, "all") == 0)
-  flag_bits &= ~GDBR_LOG_ALL;
-else if (::strcasecmp(arg, "async") == 0)
-  flag_bits &= ~GDBR_LOG_ASYNC;
-else if (::strncasecmp(arg, "break", 5) == 0)
-  flag_bits &= ~GDBR_LOG_BREAKPOINTS;
-else if (::strncasecmp(arg, "comm", 4) == 0)
-  flag_bits &= ~GDBR_LOG_COMM;
-else if (::strcasecmp(arg, "default") == 0)
-  flag_bits &= ~GDBR_LOG_DEFAULT;
-else if (::strcasecmp(arg, "packets") == 0)
-  flag_bits &= ~GDBR_LOG_PACKETS;
-else if (::strcasecmp(arg, "memory") == 0)
-  flag_bits &= ~GDBR_LOG_MEMORY;
-else if (::strcasecmp(arg, "data-short") == 0)
-  flag_bits &= ~GDBR_LOG_MEMORY_DATA_SHORT;
-else if (::strcasecmp(arg, "data-long") == 0)
-  flag_bits &= ~GDBR_LOG_MEMORY_DATA_LONG;
-else if (::strcasecmp(arg, "process") == 0)
-  flag_bits &= ~GDBR_LOG_PROCESS;
-else if (::strcasecmp(arg, "step") == 0)
-  flag_bits &= ~GDBR_LOG_STEP;
-

[Lldb-commits] [lldb] r295457 - NPL: Fix an incorrect logging formatv call

2017-02-17 Thread Pavel Labath via lldb-commits
Author: labath
Date: Fri Feb 17 10:09:10 2017
New Revision: 295457

URL: http://llvm.org/viewvc/llvm-project?rev=295457&view=rev
Log:
NPL: Fix an incorrect logging formatv call

Modified:
lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp

Modified: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp?rev=295457&r1=295456&r2=295457&view=diff
==
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp Fri Feb 17 
10:09:10 2017
@@ -2412,8 +2412,8 @@ Error NativeProcessLinux::PtraceWrapper(
   if (result)
 *result = ret;
 
-  LLDB_LOG(log, "ptrace({0}, {1}, {2}, {3}, {4}, {5})={6:x}", req, pid, addr,
-   data, data_size, ret);
+  LLDB_LOG(log, "ptrace({0}, {1}, {2}, {3}, {4})={5:x}", req, pid, addr, data,
+   data_size, ret);
 
   PtraceDisplayBytes(req, data, data_size);
 


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


[Lldb-commits] [lldb] r295522 - Updated the results formatter to eliminate redundant data.

2017-02-17 Thread Sean Callanan via lldb-commits
Author: spyffe
Date: Fri Feb 17 19:07:51 2017
New Revision: 295522

URL: http://llvm.org/viewvc/llvm-project?rev=295522&view=rev
Log:
Updated the results formatter to eliminate redundant data.

The testsuite's results formatter maintains a result_status_counts
structure solely for the purpose of setting the return status code
after the testsuite has run.  This data is redundant with the
result_events structure that contains the results of individual
tests.

There are subtle bugs arising from this redundancy that make some
builds report no errors but a nonzero status.  Rather than try to
make sure these two are always in agreement, I've just rewritten
the code that used to use the counts to now use the per-test
results.



Modified:

lldb/trunk/packages/Python/lldbsuite/test_event/formatter/results_formatter.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test_event/formatter/results_formatter.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test_event/formatter/results_formatter.py?rev=295522&r1=295521&r2=295522&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test_event/formatter/results_formatter.py 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test_event/formatter/results_formatter.py 
Fri Feb 17 19:07:51 2017
@@ -126,19 +126,6 @@ class ResultsFormatter(object):
 self.terminate_called = False
 self.file_is_stream = file_is_stream
 
-# Store counts of test_result events by status.
-self.result_status_counts = {
-EventBuilder.STATUS_SUCCESS: 0,
-EventBuilder.STATUS_EXPECTED_FAILURE: 0,
-EventBuilder.STATUS_EXPECTED_TIMEOUT: 0,
-EventBuilder.STATUS_SKIP: 0,
-EventBuilder.STATUS_UNEXPECTED_SUCCESS: 0,
-EventBuilder.STATUS_FAILURE: 0,
-EventBuilder.STATUS_ERROR: 0,
-EventBuilder.STATUS_TIMEOUT: 0,
-EventBuilder.STATUS_EXCEPTIONAL_EXIT: 0
-}
-
 # Track the most recent test start event by worker index.
 # We'll use this to assign TIMEOUT and exceptional
 # exits to the most recent test started on a given
@@ -359,18 +346,12 @@ class ResultsFormatter(object):
 if event_type == "terminate":
 self.terminate_called = True
 elif event_type in EventBuilder.RESULT_TYPES:
-# Keep track of event counts per test/job result status
-# type. The only job (i.e. inferior process) results that
-# make it here are ones that cannot be remapped to the most
-# recently started test for the given worker index.
-status = test_event["status"]
-self.result_status_counts[status] += 1
 # Clear the most recently started test for the related
 # worker.
 worker_index = test_event.get("worker_index", None)
 if worker_index is not None:
 self.started_tests_by_worker.pop(worker_index, None)
-
+status = test_event["status"]
 if status in EventBuilder.TESTRUN_ERROR_STATUS_VALUES:
 # A test/job status value in any of those status values
 # causes a testrun failure. If such a test fails, check
@@ -393,12 +374,6 @@ class ResultsFormatter(object):
 # the need to run a low-load, single-worker test run can
 # have the final run's results to always be used.
 if test_key in self.result_events:
-# We are replacing the result of something that was
-# already counted by the base class.  Remove the double
-# counting by reducing by one the count for the test
-# result status.
-old_status = self.result_events[test_key]["status"]
-self.result_status_counts[old_status] -= 1
 self.test_method_rerun_count += 1
 self.result_events[test_key] = test_event
 elif event_type == EventBuilder.TYPE_TEST_START:
@@ -494,7 +469,9 @@ class ResultsFormatter(object):
 @return an integer returning the number of test methods matching
 the given test result status.
 """
-return self.result_status_counts[status]
+return len([
+[key, event] for (key, event) in self.result_events.items()
+if event.get("status", "") == status])
 
 @classmethod
 def _event_sort_key(cls, event):


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


[Lldb-commits] [lldb] r295530 - Update the location of ModuleCacheTest.cpp from

2017-02-17 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Fri Feb 17 19:51:11 2017
New Revision: 295530

URL: http://llvm.org/viewvc/llvm-project?rev=295530&view=rev
Log:
Update the location of ModuleCacheTest.cpp from
unittest/Utility to unittest/Target so the unit
tests can be run from xcode again.

The diff is enormous - I think zachary might have
put windows line endings or something with his last
commit?  didn't look too closely but his commit & this
commit have every line being different.


Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj

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