[Lldb-commits] [PATCH] D30234: Reformat inferior's main.cpp in lldb-server test

2017-02-22 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added inline comments.



Comment at: packages/Python/lldbsuite/test/tools/lldb-server/main.cpp:74
+  printf("%" PRIx64, static_cast(syscall(__NR_gettid)));
 #else
+  printf("{no-tid-support}");

Note to self -

```
#elif defined(__NetBSD__)
printf("%" PRIx64, static_cast(_lwp_self()));
```

and include

```
#if defined(__NetBSD__)
#include 
#endif
```


https://reviews.llvm.org/D30234



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


[Lldb-commits] [PATCH] D30234: Reformat inferior's main.cpp in lldb-server test

2017-02-22 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

clang-format did not pick up the correct formatting because we have a 
`.clang-format` file in `packages/Python/lldbsuite`. This was necessary because 
a lot of the tests would get broken, as the formatting would break our `// 
place breakpoint here` annotations (also, stepping behavior is affected by the 
line breaks). It would be an interesting project to format all existing tests, 
but this would probably need to be done on a test-by-test basis (and may 
involve adding additional clang-format directives like CommentPragmas, ...).

That said, none of these problems should apply to lldb-server tests as they 
operate differently, so reformatting them is probably a good idea. I guess you 
should also then put a `.clang-format` file in the lldb-server test folder to 
make sure it stays formatted in the future.


https://reviews.llvm.org/D30234



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


[Lldb-commits] [PATCH] D30172: Replace WINLOG_*** macros with LLDB_LOG

2017-02-22 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In https://reviews.llvm.org/D30172#682789, @amccarth wrote:

> Maybe we have too many categories.


Thanks. I was thinking about that as well.  Currently there is about 110 log 
statements in the windows log and 8 log categories. Things wouldn't get too 
noisy even if we showed everything into the same category.


https://reviews.llvm.org/D30172



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


[Lldb-commits] [lldb] r295822 - Replace WINLOG_*** macros with LLDB_LOG

2017-02-22 Thread Pavel Labath via lldb-commits
Author: labath
Date: Wed Feb 22 04:38:02 2017
New Revision: 295822

URL: http://llvm.org/viewvc/llvm-project?rev=295822&view=rev
Log:
Replace WINLOG_*** macros with LLDB_LOG

Summary:
The main difference here is that in the WINLOG macros you can specify
log categories per call, whereas here you have to go the usual lldb
route of getting a Log* variable first. While this means you have to
write at least two statements, it usually means that each statement will
fit on a single line, whereas fitting the WINLOG invocation on a single
line was almost impossible. So the total size of code does not increase
even in functions with a single log statement, and functions with more
logging get shorter.

The downside here is reduced flexibility in specifying the log
categories, which a couple of functions used quite heavily (e.g.
RefreshStateAfterStop). For these I chose a single category used most
prominently and put everything into that, although a solution with
multiple log variables is definitely possible.

Reviewers: zturner, amccarth

Subscribers: lldb-commits

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

Modified:
lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp
lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindowsLog.cpp
lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindowsLog.h
lldb/trunk/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp

lldb/trunk/source/Plugins/Process/Windows/Common/x86/RegisterContextWindows_x86.cpp

Modified: lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp?rev=295822&r1=295821&r2=295822&view=diff
==
--- lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp Wed Feb 
22 04:38:02 2017
@@ -61,9 +61,8 @@ DebuggerThread::DebuggerThread(DebugDele
 DebuggerThread::~DebuggerThread() { ::CloseHandle(m_debugging_ended_event); }
 
 Error DebuggerThread::DebugLaunch(const ProcessLaunchInfo &launch_info) {
-  WINLOG_IFALL(WINDOWS_LOG_PROCESS,
-   "DebuggerThread::DebugLaunch launching '%s'",
-   launch_info.GetExecutableFile().GetPath().c_str());
+  Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_PROCESS);
+  LLDB_LOG(log, "launching '{0}'", launch_info.GetExecutableFile().GetPath());
 
   Error error;
   DebugLaunchContext *context = new DebugLaunchContext(this, launch_info);
@@ -71,19 +70,16 @@ Error DebuggerThread::DebugLaunch(const
   "lldb.plugin.process-windows.slave[?]", DebuggerThreadLaunchRoutine,
   context, &error));
 
-  if (!error.Success()) {
-WINERR_IFALL(WINDOWS_LOG_PROCESS,
- "DebugLaunch couldn't launch debugger thread.  %s",
- error.AsCString());
-  }
+  if (!error.Success())
+LLDB_LOG(log, "couldn't launch debugger thread. {0}", error);
 
   return error;
 }
 
 Error DebuggerThread::DebugAttach(lldb::pid_t pid,
   const ProcessAttachInfo &attach_info) {
-  WINLOG_IFALL(WINDOWS_LOG_PROCESS,
-   "DebuggerThread::DebugAttach attaching to '%llu'", pid);
+  Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_PROCESS);
+  LLDB_LOG(log, "attaching to '{0}'", pid);
 
   Error error;
   DebugAttachContext *context = new DebugAttachContext(this, pid, attach_info);
@@ -91,11 +87,8 @@ Error DebuggerThread::DebugAttach(lldb::
   "lldb.plugin.process-windows.slave[?]", DebuggerThreadAttachRoutine,
   context, &error));
 
-  if (!error.Success()) {
-WINERR_IFALL(WINDOWS_LOG_PROCESS,
- "DebugAttach couldn't attach to process '%llu'.  %s", pid,
- error.AsCString());
-  }
+  if (!error.Success())
+LLDB_LOG(log, "couldn't attach to process '{0}'. {1}", pid, error);
 
   return error;
 }
@@ -123,9 +116,9 @@ lldb::thread_result_t DebuggerThread::De
   // thread routine has exited.
   std::shared_ptr this_ref(shared_from_this());
 
-  WINLOG_IFALL(WINDOWS_LOG_PROCESS,
-   "DebuggerThread preparing to launch '%s' on background thread.",
-   launch_info.GetExecutableFile().GetPath().c_str());
+  Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_PROCESS);
+  LLDB_LOG(log, "preparing to launch '{0}' on background thread.",
+   launch_info.GetExecutableFile().GetPath());
 
   Error error;
   ProcessLauncherWindows launcher;
@@ -154,9 +147,9 @@ lldb::thread_result_t DebuggerThread::De
   // thread routine has exited.
   std::shared_ptr this_ref(shared_from_this());
 
-  WINLOG_IFALL(WINDOWS_LOG_PROCESS, "DebuggerThread preparing to attach to "
-"process '%llu' on background thread.",
-   pid);
+  Log *log 

[Lldb-commits] [lldb] r295821 - Add format_provider for the MemoryRegionInfo::OptionalBool enum

2017-02-22 Thread Pavel Labath via lldb-commits
Author: labath
Date: Wed Feb 22 04:37:57 2017
New Revision: 295821

URL: http://llvm.org/viewvc/llvm-project?rev=295821&view=rev
Log:
Add format_provider for the MemoryRegionInfo::OptionalBool enum

Added:
lldb/trunk/unittests/Target/MemoryRegionInfoTest.cpp
Modified:
lldb/trunk/include/lldb/Target/MemoryRegionInfo.h
lldb/trunk/unittests/Target/CMakeLists.txt

Modified: lldb/trunk/include/lldb/Target/MemoryRegionInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/MemoryRegionInfo.h?rev=295821&r1=295820&r2=295821&view=diff
==
--- lldb/trunk/include/lldb/Target/MemoryRegionInfo.h (original)
+++ lldb/trunk/include/lldb/Target/MemoryRegionInfo.h Wed Feb 22 04:37:57 2017
@@ -12,6 +12,7 @@
 #define lldb_MemoryRegionInfo_h
 
 #include "lldb/Core/RangeMap.h"
+#include "llvm/Support/FormatProviders.h"
 #include "lldb/Utility/ConstString.h"
 #include "lldb/Utility/Range.h"
 
@@ -100,4 +101,24 @@ protected:
 };
 }
 
+namespace llvm {
+template <>
+struct format_provider {
+  static void format(const lldb_private::MemoryRegionInfo::OptionalBool &B,
+ raw_ostream &OS, StringRef Options) {
+switch(B) {
+case lldb_private::MemoryRegionInfo::eNo:
+  OS << "no";
+  return;
+case lldb_private::MemoryRegionInfo::eYes:
+  OS << "yes";
+  return;
+case lldb_private::MemoryRegionInfo::eDontKnow:
+  OS << "don't know";
+  return;
+}
+  }
+};
+}
+
 #endif // #ifndef lldb_MemoryRegionInfo_h

Modified: lldb/trunk/unittests/Target/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Target/CMakeLists.txt?rev=295821&r1=295820&r2=295821&view=diff
==
--- lldb/trunk/unittests/Target/CMakeLists.txt (original)
+++ lldb/trunk/unittests/Target/CMakeLists.txt Wed Feb 22 04:37:57 2017
@@ -1,4 +1,5 @@
 add_lldb_unittest(TargetTests
+  MemoryRegionInfoTest.cpp
   ModuleCacheTest.cpp
 
   LINK_LIBS

Added: lldb/trunk/unittests/Target/MemoryRegionInfoTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Target/MemoryRegionInfoTest.cpp?rev=295821&view=auto
==
--- lldb/trunk/unittests/Target/MemoryRegionInfoTest.cpp (added)
+++ lldb/trunk/unittests/Target/MemoryRegionInfoTest.cpp Wed Feb 22 04:37:57 
2017
@@ -0,0 +1,20 @@
+//===-- MemoryRegionInfoTest.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/Target/MemoryRegionInfo.h"
+#include "llvm/Support/FormatVariadic.h"
+#include "gtest/gtest.h"
+
+using namespace lldb_private;
+
+TEST(MemoryRegionInfoTest, Formatv) {
+  EXPECT_EQ("yes", llvm::formatv("{0}", MemoryRegionInfo::eYes).str());
+  EXPECT_EQ("no", llvm::formatv("{0}", MemoryRegionInfo::eNo).str());
+  EXPECT_EQ("don't know", llvm::formatv("{0}", 
MemoryRegionInfo::eDontKnow).str());
+}


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


[Lldb-commits] [PATCH] D30172: Replace WINLOG_*** macros with LLDB_LOG

2017-02-22 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL295822: Replace WINLOG_*** macros with LLDB_LOG (authored by 
labath).

Changed prior to commit:
  https://reviews.llvm.org/D30172?vs=89130&id=89342#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30172

Files:
  lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp
  lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
  lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindowsLog.cpp
  lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindowsLog.h
  lldb/trunk/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp
  
lldb/trunk/source/Plugins/Process/Windows/Common/x86/RegisterContextWindows_x86.cpp

Index: lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp
===
--- lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp
+++ lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp
@@ -61,41 +61,34 @@
 DebuggerThread::~DebuggerThread() { ::CloseHandle(m_debugging_ended_event); }
 
 Error DebuggerThread::DebugLaunch(const ProcessLaunchInfo &launch_info) {
-  WINLOG_IFALL(WINDOWS_LOG_PROCESS,
-   "DebuggerThread::DebugLaunch launching '%s'",
-   launch_info.GetExecutableFile().GetPath().c_str());
+  Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_PROCESS);
+  LLDB_LOG(log, "launching '{0}'", launch_info.GetExecutableFile().GetPath());
 
   Error error;
   DebugLaunchContext *context = new DebugLaunchContext(this, launch_info);
   HostThread slave_thread(ThreadLauncher::LaunchThread(
   "lldb.plugin.process-windows.slave[?]", DebuggerThreadLaunchRoutine,
   context, &error));
 
-  if (!error.Success()) {
-WINERR_IFALL(WINDOWS_LOG_PROCESS,
- "DebugLaunch couldn't launch debugger thread.  %s",
- error.AsCString());
-  }
+  if (!error.Success())
+LLDB_LOG(log, "couldn't launch debugger thread. {0}", error);
 
   return error;
 }
 
 Error DebuggerThread::DebugAttach(lldb::pid_t pid,
   const ProcessAttachInfo &attach_info) {
-  WINLOG_IFALL(WINDOWS_LOG_PROCESS,
-   "DebuggerThread::DebugAttach attaching to '%llu'", pid);
+  Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_PROCESS);
+  LLDB_LOG(log, "attaching to '{0}'", pid);
 
   Error error;
   DebugAttachContext *context = new DebugAttachContext(this, pid, attach_info);
   HostThread slave_thread(ThreadLauncher::LaunchThread(
   "lldb.plugin.process-windows.slave[?]", DebuggerThreadAttachRoutine,
   context, &error));
 
-  if (!error.Success()) {
-WINERR_IFALL(WINDOWS_LOG_PROCESS,
- "DebugAttach couldn't attach to process '%llu'.  %s", pid,
- error.AsCString());
-  }
+  if (!error.Success())
+LLDB_LOG(log, "couldn't attach to process '{0}'. {1}", pid, error);
 
   return error;
 }
@@ -123,9 +116,9 @@
   // thread routine has exited.
   std::shared_ptr this_ref(shared_from_this());
 
-  WINLOG_IFALL(WINDOWS_LOG_PROCESS,
-   "DebuggerThread preparing to launch '%s' on background thread.",
-   launch_info.GetExecutableFile().GetPath().c_str());
+  Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_PROCESS);
+  LLDB_LOG(log, "preparing to launch '{0}' on background thread.",
+   launch_info.GetExecutableFile().GetPath());
 
   Error error;
   ProcessLauncherWindows launcher;
@@ -154,9 +147,9 @@
   // thread routine has exited.
   std::shared_ptr this_ref(shared_from_this());
 
-  WINLOG_IFALL(WINDOWS_LOG_PROCESS, "DebuggerThread preparing to attach to "
-"process '%llu' on background thread.",
-   pid);
+  Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_PROCESS);
+  LLDB_LOG(log, "preparing to attach to process '{0}' on background thread.",
+   pid);
 
   if (!DebugActiveProcess((DWORD)pid)) {
 Error error(::GetLastError(), eErrorTypeWin32);
@@ -179,9 +172,8 @@
 
   lldb::pid_t pid = m_process.GetProcessId();
 
-  WINLOG_IFALL(WINDOWS_LOG_PROCESS,
-   "StopDebugging('%s') called (inferior=%I64u).",
-   (terminate ? "true" : "false"), pid);
+  Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_PROCESS);
+  LLDB_LOG(log, "terminate = {0}, inferior={1}.", terminate, pid);
 
   // Set m_is_shutting_down to true if it was false.  Return if it was already
   // true.
@@ -200,10 +192,9 @@
 // next debug
 // event we get is the exit process event, and not some other event.
 BOOL terminate_suceeded = TerminateProcess(handle, 0);
-WINLOG_IFALL(WINDOWS_LOG_PROCESS, "StopDebugging called "
-  "TerminateProcess(0x%p, 0) "
-  "(inferior=%I64u), success='%s'",
- handle, pid, (terminate_suceeded ? "true" : "false"));
+LLDB_LOG(

[Lldb-commits] [PATCH] D30249: Clear expression when breakpoint location becomes unresolved

2017-02-22 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.

The compiled expression is not needed once the location goes away. Also,
it holds a reference to the module, which prevents cleanup of the module
if somebody holds a reference to the breakpoint object.

This fixes the StepOverBreakpoint test on windows, but I am unsure how
to make a more generic test for this.


https://reviews.llvm.org/D30249

Files:
  
packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py
  source/Breakpoint/BreakpointLocation.cpp


Index: source/Breakpoint/BreakpointLocation.cpp
===
--- source/Breakpoint/BreakpointLocation.cpp
+++ source/Breakpoint/BreakpointLocation.cpp
@@ -458,6 +458,7 @@
   m_bp_site_sp->RemoveOwner(GetBreakpoint().GetID(), GetID());
 
 m_bp_site_sp.reset();
+m_user_expression_sp.reset();
 return true;
   }
   return false;
Index: 
packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py
===
--- 
packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py
+++ 
packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py
@@ -52,7 +52,6 @@
 self.thread = 
lldbutil.get_one_thread_stopped_at_breakpoint(self.process, self.breakpoint1)
 self.assertIsNotNone(self.thread, "Didn't stop at breakpoint 1.")
 
-@skipIf(bugnumber="llvm.org/pr31972", hostoslist=["windows"])
 def test_step_instruction(self): 
 # Count instructions between breakpoint_1 and breakpoint_4
 contextList = self.target.FindFunctions('main', 
lldb.eFunctionNameTypeAuto)


Index: source/Breakpoint/BreakpointLocation.cpp
===
--- source/Breakpoint/BreakpointLocation.cpp
+++ source/Breakpoint/BreakpointLocation.cpp
@@ -458,6 +458,7 @@
   m_bp_site_sp->RemoveOwner(GetBreakpoint().GetID(), GetID());
 
 m_bp_site_sp.reset();
+m_user_expression_sp.reset();
 return true;
   }
   return false;
Index: packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py
===
--- packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py
+++ packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py
@@ -52,7 +52,6 @@
 self.thread = lldbutil.get_one_thread_stopped_at_breakpoint(self.process, self.breakpoint1)
 self.assertIsNotNone(self.thread, "Didn't stop at breakpoint 1.")
 
-@skipIf(bugnumber="llvm.org/pr31972", hostoslist=["windows"])
 def test_step_instruction(self): 
 # Count instructions between breakpoint_1 and breakpoint_4
 contextList = self.target.FindFunctions('main', lldb.eFunctionNameTypeAuto)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r295823 - Switch "lldb" log channel to the new registration mechanism

2017-02-22 Thread Pavel Labath via lldb-commits
Author: labath
Date: Wed Feb 22 05:51:12 2017
New Revision: 295823

URL: http://llvm.org/viewvc/llvm-project?rev=295823&view=rev
Log:
Switch "lldb" log channel to the new registration mechanism

Modified:
lldb/trunk/include/lldb/Core/Log.h
lldb/trunk/include/lldb/Core/Logging.h
lldb/trunk/source/Core/Log.cpp
lldb/trunk/source/Core/Logging.cpp
lldb/trunk/source/Initialization/SystemInitializerCommon.cpp

Modified: lldb/trunk/include/lldb/Core/Log.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Log.h?rev=295823&r1=295822&r2=295823&view=diff
==
--- lldb/trunk/include/lldb/Core/Log.h (original)
+++ lldb/trunk/include/lldb/Core/Log.h Wed Feb 22 05:51:12 2017
@@ -136,10 +136,6 @@ public:
 
   static void ListAllLogChannels(Stream *strm);
 
-  static void Initialize();
-
-  static void Terminate();
-
   //--
   // Member functions
   //--

Modified: lldb/trunk/include/lldb/Core/Logging.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Logging.h?rev=295823&r1=295822&r2=295823&view=diff
==
--- lldb/trunk/include/lldb/Core/Logging.h (original)
+++ lldb/trunk/include/lldb/Core/Logging.h Wed Feb 22 05:51:12 2017
@@ -26,7 +26,6 @@
 #define LIBLLDB_LOG_WATCHPOINTS (1u << 6)
 #define LIBLLDB_LOG_STEP (1u << 7)
 #define LIBLLDB_LOG_EXPRESSIONS (1u << 8)
-#define LIBLLDB_LOG_TEMPORARY (1u << 9)
 #define LIBLLDB_LOG_STATE (1u << 10)
 #define LIBLLDB_LOG_OBJECT (1u << 11)
 #define LIBLLDB_LOG_COMMUNICATION (1u << 12)
@@ -57,23 +56,13 @@
 
 namespace lldb_private {
 
-void LogIfAllCategoriesSet(uint32_t mask, const char *format, ...);
-
 void LogIfAnyCategoriesSet(uint32_t mask, const char *format, ...);
 
 Log *GetLogIfAllCategoriesSet(uint32_t mask);
 
 Log *GetLogIfAnyCategoriesSet(uint32_t mask);
 
-uint32_t GetLogMask();
-
-void DisableLog(const char **categories, Stream *feedback_strm);
-
-Log *EnableLog(const std::shared_ptr &log_stream_sp,
-   uint32_t log_options, const char **categories,
-   Stream *feedback_strm);
-
-void ListLogCategories(Stream *strm);
+void InitializeLog();
 
 } // namespace lldb_private
 

Modified: lldb/trunk/source/Core/Log.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Log.cpp?rev=295823&r1=295822&r2=295823&view=diff
==
--- lldb/trunk/source/Core/Log.cpp (original)
+++ lldb/trunk/source/Core/Log.cpp Wed Feb 22 05:51:12 2017
@@ -335,13 +335,6 @@ void Log::DisableAllLogChannels(Stream *
 entry.second.channel.Disable(UINT32_MAX);
 }
 
-void Log::Initialize() {
-  Log::Callbacks log_callbacks = {DisableLog, EnableLog, ListLogCategories};
-  Log::RegisterLogChannel(ConstString("lldb"), log_callbacks);
-}
-
-void Log::Terminate() { DisableAllLogChannels(nullptr); }
-
 void Log::ListAllLogChannels(Stream *strm) {
   CallbackMap &callback_map = GetCallbackMap();
 

Modified: lldb/trunk/source/Core/Logging.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Logging.cpp?rev=295823&r1=295822&r2=295823&view=diff
==
--- lldb/trunk/source/Core/Logging.cpp (original)
+++ lldb/trunk/source/Core/Logging.cpp Wed Feb 22 05:51:12 2017
@@ -23,292 +23,58 @@
 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_lob_sp the first time this function is
-// called.
+static constexpr Log::Category g_categories[] = {
+  {{"api"}, {"log API calls and return values"}, LIBLLDB_LOG_API},
+  {{"break"}, {"log breakpoints"}, LIBLLDB_LOG_BREAKPOINTS},
+  {{"commands"}, {"log command argument parsing"}, LIBLLDB_LOG_COMMANDS},
+  {{"comm"}, {"log communication activities"}, LIBLLDB_LOG_COMMUNICATION},
+  {{"conn"}, {"log connection details"}, LIBLLDB_LOG_CONNECTION},
+  {{"demangle"}, {"log mangled names to catch demangler crashes"}, 
LIBLLDB_LOG_DEMANGLE},
+  {{"dyld"}, {"log shared library related activities"}, 
LIBLLDB_LOG_DYNAMIC_LOADER},
+  {{"event"}, {"log broadcaster, listener and event queue activities"}, 
LIBLLDB_LOG_EVENTS},
+  {{"expr"}, {"log expressions"}, LIBLLDB_LOG_EXPRESSIONS},
+  {{"formatters"}, {"log data formatters related activities"}, 
LIBLLDB_LOG_DATAFORMATTERS},
+  {{"host"}, {"log host activities"}, LIBLLDB_LOG_HOST},
+  {{"jit"}, {"log JIT events in the target"}, LIBLLDB_LOG_JIT_LOADER},
+  {{"language"}, {"log language runtime events"}, LIBLLDB_LOG_LANGUAGE},
+  {{"mmap"}, {"log mmap related activities"}, LIBLLDB_LOG_MMAP},
+  {{"module"}, {"log modul

[Lldb-commits] [PATCH] D30250: Switch "posix" to the new log channel registration mechanism

2017-02-22 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.

This also removes magic rename code, which caused the channel to be
called "linux" when built on a linux machine, and "freebsd" when built
on a freebsd one, which seems unnecessary - registering a new channel is
sufficiently simple now that if we wish to log something extremely
os-specific, we can just create a new channel. None of the current
categories seem very specific to one OS or another.


https://reviews.llvm.org/D30250

Files:
  
packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py
  source/Initialization/SystemInitializerCommon.cpp
  source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
  source/Plugins/Process/POSIX/ProcessPOSIXLog.cpp
  source/Plugins/Process/POSIX/ProcessPOSIXLog.h

Index: source/Plugins/Process/POSIX/ProcessPOSIXLog.h
===
--- source/Plugins/Process/POSIX/ProcessPOSIXLog.h
+++ source/Plugins/Process/POSIX/ProcessPOSIXLog.h
@@ -20,53 +20,25 @@
 
 #define POSIX_LOG_PROCESS (1u << 1)
 #define POSIX_LOG_THREAD (1u << 2)
-#define POSIX_LOG_PACKETS (1u << 3)
 #define POSIX_LOG_MEMORY (1u << 4) // Log memory reads/writes calls
-#define POSIX_LOG_MEMORY_DATA_SHORT\
-  (1u << 5) // Log short memory reads/writes bytes
-#define POSIX_LOG_MEMORY_DATA_LONG \
-  (1u << 6) // Log all memory reads/writes bytes
+#define POSIX_LOG_PTRACE (1u << 5)
+#define POSIX_LOG_REGISTERS (1u << 6)
 #define POSIX_LOG_BREAKPOINTS (1u << 7)
 #define POSIX_LOG_WATCHPOINTS (1u << 8)
-#define POSIX_LOG_STEP (1u << 9)
-#define POSIX_LOG_COMM (1u << 10)
-#define POSIX_LOG_ASYNC (1u << 11)
-#define POSIX_LOG_PTRACE (1u << 12)
-#define POSIX_LOG_REGISTERS (1u << 13)
 #define POSIX_LOG_ALL (UINT32_MAX)
-#define POSIX_LOG_DEFAULT POSIX_LOG_PACKETS
-
-// The size which determines "short memory reads/writes".
-#define POSIX_LOG_MEMORY_SHORT_BYTES (4 * sizeof(ptrdiff_t))
+#define POSIX_LOG_DEFAULT POSIX_LOG_PROCESS
 
+namespace lldb_private {
 class ProcessPOSIXLog {
-  static const char *m_pluginname;
+  static Log::Channel g_channel;
 
 public:
-  // -
-  // Public Static Methods
-  // -
-  static void Initialize(lldb_private::ConstString name);
-
-  static void RegisterPluginName(const char *pluginName) {
-m_pluginname = pluginName;
-  }
+  static void Initialize();
 
-  static void RegisterPluginName(lldb_private::ConstString pluginName) {
-m_pluginname = pluginName.GetCString();
+  static Log *GetLogIfAllCategoriesSet(uint32_t mask) {
+return g_channel.GetLogIfAll(mask);
   }
-
-  static lldb_private::Log *GetLogIfAllCategoriesSet(uint32_t mask = 0);
-
-  static void DisableLog(const char **args,
- lldb_private::Stream *feedback_strm);
-
-  static lldb_private::Log *
-  EnableLog(const std::shared_ptr &log_stream_sp,
-uint32_t log_options, const char **args,
-lldb_private::Stream *feedback_strm);
-
-  static void ListLogCategories(lldb_private::Stream *strm);
 };
+}
 
 #endif // liblldb_ProcessPOSIXLog_h_
Index: source/Plugins/Process/POSIX/ProcessPOSIXLog.cpp
===
--- source/Plugins/Process/POSIX/ProcessPOSIXLog.cpp
+++ source/Plugins/Process/POSIX/ProcessPOSIXLog.cpp
@@ -10,178 +10,24 @@
 
 #include "ProcessPOSIXLog.h"
 
-#include 
-
-#include "lldb/Core/StreamFile.h"
-#include "lldb/Interpreter/Args.h"
-
 #include "llvm/Support/Threading.h"
 
-#include "ProcessPOSIXLog.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;
-}
-
-void ProcessPOSIXLog::Initialize(ConstString name) {
-  static llvm::once_flag g_once_flag;
-
-  llvm::call_once(g_once_flag, [name]() {
-Log::Callbacks log_callbacks = {DisableLog, EnableLog, ListLogCategories};
-
-Log::RegisterLogChannel(name, log_callbacks);
-RegisterPluginName(name);
-  });
-}
-
-Log *ProcessPOSIXLog::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;
-}
-
-static uint32_t GetFlagBits(const char *arg) {
-  if (::strcasecmp(arg, "all") == 0)
-return POSIX_LOG_ALL;
-  else if (::strcasecmp(arg, "async") == 0)
-return POSIX_LOG_ASYNC;
-  else if (::strncasecmp(arg, "break", 5) == 0)
-return POSIX_LOG_BREAKPOINTS;
-  else if (::strncasec

[Lldb-commits] [PATCH] D30251: Map ELF files as writable so we can update the relocations in them

2017-02-22 Thread Tamas Berghammer via Phabricator via lldb-commits
tberghammer created this revision.

Map ELF files as writable so we can update the relocations in them

After this change ELF files will be mapped as private writable pages so
we can cheaply update the relocations inside them without have to read
them into memory and any modification we do in the memory will not be
reflected in the on disk files.


https://reviews.llvm.org/D30251

Files:
  include/lldb/Host/FileSpec.h
  source/Host/common/FileSpec.cpp
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -386,7 +386,7 @@
   lldb::offset_t file_offset,
   lldb::offset_t length) {
   if (!data_sp) {
-data_sp = file->MemoryMapFileContentsIfLocal(file_offset, length);
+data_sp = file->MemoryMapFileContentsIfLocal(file_offset, length, true);
 data_offset = 0;
   }
 
@@ -396,7 +396,7 @@
 if (ELFHeader::MagicBytesMatch(magic)) {
   // Update the data to contain the entire file if it doesn't already
   if (data_sp->GetByteSize() < length) {
-data_sp = file->MemoryMapFileContentsIfLocal(file_offset, length);
+data_sp = file->MemoryMapFileContentsIfLocal(file_offset, length, true);
 data_offset = 0;
 magic = data_sp->GetBytes();
   }
@@ -654,7 +654,8 @@
   if (header.HasHeaderExtension() &&
 section_header_end > data_sp->GetByteSize()) {
 data_sp = file.MemoryMapFileContentsIfLocal (file_offset,
- section_header_end);
+ section_header_end,
+ true);
 data.SetData(data_sp);
 lldb::offset_t header_offset = data_offset;
 header.Parse(data, &header_offset);
@@ -667,7 +668,8 @@
   header.e_shoff + header.e_shnum * header.e_shentsize;
   if (section_header_end > data_sp->GetByteSize()) {
 data_sp = file.MemoryMapFileContentsIfLocal(file_offset,
-section_header_end);
+section_header_end,
+true);
 data.SetData(data_sp);
   }
 
@@ -712,7 +714,7 @@
 header.e_phoff + header.e_phnum * header.e_phentsize;
 if (program_headers_end > data_sp->GetByteSize()) {
   data_sp = file.MemoryMapFileContentsIfLocal(
-  file_offset, program_headers_end);
+  file_offset, program_headers_end, true);
   data.SetData(data_sp);
 }
 ProgramHeaderColl program_headers;
@@ -727,16 +729,19 @@
 
 if (segment_data_end > data_sp->GetByteSize()) {
   data_sp = file.MemoryMapFileContentsIfLocal(file_offset,
-  segment_data_end);
+  segment_data_end,
+  true);
   data.SetData(data_sp);
 }
 
 core_notes_crc =
 CalculateELFNotesSegmentsCRC32(program_headers, data);
   } else {
 // Need to map entire file into memory to calculate the crc.
 data_sp =
-file.MemoryMapFileContentsIfLocal(file_offset, SIZE_MAX);
+file.MemoryMapFileContentsIfLocal(file_offset,
+  SIZE_MAX,
+  true);
 data.SetData(data_sp);
 gnu_debuglink_crc = calc_gnu_debuglink_crc32(
 data.GetDataStart(), data.GetByteSize());
Index: source/Host/common/FileSpec.cpp
===
--- source/Host/common/FileSpec.cpp
+++ source/Host/common/FileSpec.cpp
@@ -837,23 +837,28 @@
 // verified using the DataBuffer::GetByteSize() function.
 //--
 DataBufferSP FileSpec::MemoryMapFileContents(off_t file_offset,
- size_t file_size) const {
+ size_t file_size,
+ bool writeable) const {
   DataBufferSP data_sp;
   std::unique_ptr mmap_data(new DataBufferMemoryMap());
   if (mmap_data.get()) {
 const size_t mapped_length =
-mmap_data->MemoryMapFromFileSpec(this, file_offset, file_size);
+mmap_data

[Lldb-commits] [PATCH] D30251: Map ELF files as writable so we can update the relocations in them

2017-02-22 Thread Pavel Labath via Phabricator via lldb-commits
labath added a reviewer: zturner.
labath added a comment.

Adding Zachary as he was about to remove this code.

The timing of this patch is a bit unfortunate, as it would complicate the 
removal of the code in question. If I am not mistaken, llvm's version currently 
does not support copy-on-write mappings, which is what we are trying to do 
here. The c-o-w could certainly be added there, and we will probably need to do 
it in the future, but I am not sure whether this is the right time for it. I 
don't want to impede Zachary's cleanup effort due to a "feature" that noone has 
serious commitment of supporting.


https://reviews.llvm.org/D30251



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


[Lldb-commits] [PATCH] D30054: Delete DataBufferMemoryMap

2017-02-22 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I think you are still waiting to get the llvm changes sorted out, but this side 
of it looks fine to me (modulo a couple of nits).




Comment at: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:414
+
+data_sp = std::make_shared(std::move(*Buffer));
+data_offset = 0;

It looks like this make-a-MemoryBuffer-and-shove-it-in-a-DataBufferLLVM 
functionality could be handled by a utility function, as it is used in a number 
of places.



Comment at: lldb/unittests/Process/minidump/MinidumpParserTest.cpp:54
 llvm::sys::path::append(filename, minidump_filename);
 FileSpec minidump_file(filename.c_str(), false);
+

It looks like this variable is not necessary anymore.


https://reviews.llvm.org/D30054



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


Re: [Lldb-commits] [PATCH] D30251: Map ELF files as writable so we can update the relocations in them

2017-02-22 Thread Zachary Turner via lldb-commits
Yea if this isn't urgent, can we wait for my other changes to go in?

Llvm does support mapping writable, but not through the same interface. So
it should still work
On Wed, Feb 22, 2017 at 6:43 AM Pavel Labath via Phabricator <
revi...@reviews.llvm.org> wrote:

> labath added a reviewer: zturner.
> labath added a comment.
>
> Adding Zachary as he was about to remove this code.
>
> The timing of this patch is a bit unfortunate, as it would complicate the
> removal of the code in question. If I am not mistaken, llvm's version
> currently does not support copy-on-write mappings, which is what we are
> trying to do here. The c-o-w could certainly be added there, and we will
> probably need to do it in the future, but I am not sure whether this is the
> right time for it. I don't want to impede Zachary's cleanup effort due to a
> "feature" that noone has serious commitment of supporting.
>
>
> https://reviews.llvm.org/D30251
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D30251: Map ELF files as writable so we can update the relocations in them

2017-02-22 Thread Tamas Berghammer via lldb-commits
Sure, it isn't urgent at all. I created this as a resolution for the crash
reported by Ramana (
http://lists.llvm.org/pipermail/lldb-dev/2017-February/012001.html) but I
don't fully understand the use case he/she is working on when wanting to
open a ".o" file yet (but I still wanted to get rid of an LLDB crash).

Tamas

On Wed, Feb 22, 2017 at 3:03 PM Zachary Turner  wrote:

Yea if this isn't urgent, can we wait for my other changes to go in?

Llvm does support mapping writable, but not through the same interface. So
it should still work
On Wed, Feb 22, 2017 at 6:43 AM Pavel Labath via Phabricator <
revi...@reviews.llvm.org> wrote:

labath added a reviewer: zturner.
labath added a comment.

Adding Zachary as he was about to remove this code.

The timing of this patch is a bit unfortunate, as it would complicate the
removal of the code in question. If I am not mistaken, llvm's version
currently does not support copy-on-write mappings, which is what we are
trying to do here. The c-o-w could certainly be added there, and we will
probably need to do it in the future, but I am not sure whether this is the
right time for it. I don't want to impede Zachary's cleanup effort due to a
"feature" that noone has serious commitment of supporting.


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


Re: [Lldb-commits] [PATCH] D30249: Clear expression when breakpoint location becomes unresolved

2017-02-22 Thread Jim Ingham via lldb-commits
Note that the breakpoint location's site gets cleared when you disable the 
breakpoint or its location, as well as when you delete it.  So if you have a 
workflow that does: "hit a breakpoint, disable it, hit another, reenable the 
first, hit the second" you'll end up re-evaluating the condition expression 
unnecessarily.  This isn't a terribly common workflow, and compiling the 
expression is not hugely expensive.  But in this instance, it was probably 
better to break the link at the SBBreakpoint level, and not here.

Jim




> On Feb 22, 2017, at 3:56 AM, Pavel Labath via Phabricator 
>  wrote:
> 
> labath created this revision.
> 
> The compiled expression is not needed once the location goes away. Also,
> it holds a reference to the module, which prevents cleanup of the module
> if somebody holds a reference to the breakpoint object.
> 
> This fixes the StepOverBreakpoint test on windows, but I am unsure how
> to make a more generic test for this.
> 
> 
> https://reviews.llvm.org/D30249
> 
> Files:
>  
> packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py
>  source/Breakpoint/BreakpointLocation.cpp
> 
> 
> Index: source/Breakpoint/BreakpointLocation.cpp
> ===
> --- source/Breakpoint/BreakpointLocation.cpp
> +++ source/Breakpoint/BreakpointLocation.cpp
> @@ -458,6 +458,7 @@
>   m_bp_site_sp->RemoveOwner(GetBreakpoint().GetID(), GetID());
> 
> m_bp_site_sp.reset();
> +m_user_expression_sp.reset();
> return true;
>   }
>   return false;
> Index: 
> packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py
> ===
> --- 
> packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py
> +++ 
> packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py
> @@ -52,7 +52,6 @@
> self.thread = 
> lldbutil.get_one_thread_stopped_at_breakpoint(self.process, self.breakpoint1)
> self.assertIsNotNone(self.thread, "Didn't stop at breakpoint 1.")
> 
> -@skipIf(bugnumber="llvm.org/pr31972", hostoslist=["windows"])
> def test_step_instruction(self): 
> # Count instructions between breakpoint_1 and breakpoint_4
> contextList = self.target.FindFunctions('main', 
> lldb.eFunctionNameTypeAuto)
> 
> 
> 

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


[Lldb-commits] [PATCH] D30255: Ensure lldb-server waits for child debug servers to start up when passing them a port number to listen on.

2017-02-22 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good.


https://reviews.llvm.org/D30255



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


[Lldb-commits] [PATCH] D30250: Switch "posix" to the new log channel registration mechanism

2017-02-22 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski accepted this revision.
krytarowski added a comment.
This revision is now accepted and ready to land.

I had locally code registering NetBSD specific log channel and this patch is 
removing this needless code. Thank you for this work!


https://reviews.llvm.org/D30250



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


[Lldb-commits] [PATCH] D30234: Reformat inferior's main.cpp in lldb-server test

2017-02-22 Thread Eugene Zemtsov via Phabricator via lldb-commits
eugene updated this revision to Diff 89404.
eugene added a comment.

I have added local .clang-format file. But it didn't change the way main.cpp 
was formated.


https://reviews.llvm.org/D30234

Files:
  packages/Python/lldbsuite/test/tools/lldb-server/.clang-format
  packages/Python/lldbsuite/test/tools/lldb-server/main.cpp

Index: packages/Python/lldbsuite/test/tools/lldb-server/main.cpp
===
--- packages/Python/lldbsuite/test/tools/lldb-server/main.cpp
+++ packages/Python/lldbsuite/test/tools/lldb-server/main.cpp
@@ -1,3 +1,12 @@
+//===-- main.cpp *- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
 #include 
 #include 
 #include 
@@ -15,22 +24,22 @@
 
 #if defined(__APPLE__)
 __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2)
-int pthread_threadid_np(pthread_t,__uint64_t*);
+int pthread_threadid_np(pthread_t, __uint64_t *);
 #elif defined(__linux__)
 #include 
 #endif
 
-static const char *const RETVAL_PREFIX   = "retval:";
-static const char *const SLEEP_PREFIX= "sleep:";
-static const char *const STDERR_PREFIX   = "stderr:";
-static const char *const SET_MESSAGE_PREFIX  = "set-message:";
-static const char *const PRINT_MESSAGE_COMMAND   = "print-message:";
-static const char *const GET_DATA_ADDRESS_PREFIX = "get-data-address-hex:";
-static const char *const GET_STACK_ADDRESS_COMMAND   = "get-stack-address-hex:";
-static const char *const GET_HEAP_ADDRESS_COMMAND= "get-heap-address-hex:";
+static const char *const RETVAL_PREFIX = "retval:";
+static const char *const SLEEP_PREFIX = "sleep:";
+static const char *const STDERR_PREFIX = "stderr:";
+static const char *const SET_MESSAGE_PREFIX = "set-message:";
+static const char *const PRINT_MESSAGE_COMMAND = "print-message:";
+static const char *const GET_DATA_ADDRESS_PREFIX = "get-data-address-hex:";
+static const char *const GET_STACK_ADDRESS_COMMAND = "get-stack-address-hex:";
+static const char *const GET_HEAP_ADDRESS_COMMAND = "get-heap-address-hex:";
 
-static const char *const GET_CODE_ADDRESS_PREFIX = "get-code-address-hex:";
-static const char *const CALL_FUNCTION_PREFIX= "call-function:";
+static const char *const GET_CODE_ADDRESS_PREFIX = "get-code-address-hex:";
+static const char *const CALL_FUNCTION_PREFIX = "call-function:";
 
 static const char *const THREAD_PREFIX = "thread:";
 static const char *const THREAD_COMMAND_NEW = "new";
@@ -50,342 +59,301 @@
 static volatile char g_c1 = '0';
 static volatile char g_c2 = '1';
 
-static void
-print_thread_id ()
-{
-	// Put in the right magic here for your platform to spit out the thread id (tid) that debugserver/lldb-gdbserver would see as a TID.
-	// Otherwise, let the else clause print out the unsupported text so that the unit test knows to skip verifying thread ids.
+static void print_thread_id() {
+// Put in the right magic here for your platform to spit out the thread id (tid)
+// that debugserver/lldb-gdbserver would see as a TID. Otherwise, let the else
+// clause print out the unsupported text so that the unit test knows to skip
+// verifying thread ids.
 #if defined(__APPLE__)
-	__uint64_t tid = 0;
-	pthread_threadid_np(pthread_self(), &tid);
-	printf ("%" PRIx64, tid);
-#elif defined (__linux__)
-	// This is a call to gettid() via syscall.
-	printf ("%" PRIx64, static_cast (syscall (__NR_gettid)));
+  __uint64_t tid = 0;
+  pthread_threadid_np(pthread_self(), &tid);
+  printf("%" PRIx64, tid);
+#elif defined(__linux__)
+  // This is a call to gettid() via syscall.
+  printf("%" PRIx64, static_cast(syscall(__NR_gettid)));
 #else
-	printf("{no-tid-support}");
+  printf("{no-tid-support}");
 #endif
 }
 
-static void
-signal_handler (int signo)
-{
-	const char *signal_name = nullptr;
-	switch (signo)
-	{
-		case SIGUSR1: signal_name = "SIGUSR1"; break;
-		case SIGSEGV: signal_name = "SIGSEGV"; break;
-		default:  signal_name = nullptr;
-	}
-
-	// Print notice that we received the signal on a given thread.
-	pthread_mutex_lock (&g_print_mutex);
-	if (signal_name)
-		printf ("received %s on thread id: ", signal_name);
-	else
-		printf ("received signo %d (%s) on thread id: ", signo, strsignal (signo));
-	print_thread_id ();
-	printf ("\n");
-	pthread_mutex_unlock (&g_print_mutex);
-
-	// Reset the signal handler if we're one of the expected signal handlers.
-	switch (signo)
-	{
-case SIGSEGV:
-	if (g_is_segfaulting)
-	{
-	// Fix up the pointer we're writing to.  This needs to happen if nothing intercepts the SIGSEGV
-	// (i.e. if somebody runs this from the command line).
-	longjmp(g_jump_buffer, 1);
-			}
-bre

[Lldb-commits] [PATCH] D30249: Clear expression when breakpoint location becomes unresolved

2017-02-22 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

> Note that the breakpoint location's site gets cleared when you disable the 
> breakpoint or its location, as well as when you delete it.  So if you have a 
> workflow that does: "hit a breakpoint, disable it, hit another, reenable the 
> first, hit the second" you'll end up re-evaluating the condition expression 
> unnecessarily.  This isn't a terribly common workflow, and compiling the 
> expression is not hugely expensive.  But in this instance, it was probably 
> better to break the link at the SBBreakpoint level, and not here.

Sorry, I thought I understood Greg wanted me to do this. I can certainly do the 
SBBreakpoint thing instead.


https://reviews.llvm.org/D30249



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


[Lldb-commits] [lldb] r295881 - Fix header documentation.

2017-02-22 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Wed Feb 22 15:32:16 2017
New Revision: 295881

URL: http://llvm.org/viewvc/llvm-project?rev=295881&view=rev
Log:
Fix header documentation.

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

Modified: lldb/trunk/include/lldb/API/SBTarget.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTarget.h?rev=295881&r1=295880&r2=295881&view=diff
==
--- lldb/trunk/include/lldb/API/SBTarget.h (original)
+++ lldb/trunk/include/lldb/API/SBTarget.h Wed Feb 22 15:32:16 2017
@@ -124,9 +124,6 @@ public:
   /// @param[in] envp
   /// The environment array.
   ///
-  /// @param[in] launch_flags
-  /// Flags to modify the launch (@see lldb::LaunchFlags)
-  ///
   /// @param[in] stdin_path
   /// The path to use when re-directing the STDIN of the new
   /// process. If all stdXX_path arguments are nullptr, a pseudo
@@ -480,6 +477,7 @@ public:
   /// Resolve a current file address into a section offset address.
   ///
   /// @param[in] file_addr
+  /// The file address to resolve.
   ///
   /// @return
   /// An SBAddress which will be valid if...
@@ -653,7 +651,7 @@ public:
   /// @param[in] source_file
   ///The file from which to read the breakpoints.
   ///
-  /// @param[out] bkpt_list
+  /// @param[out] new_bps
   ///A list of the newly created breakpoints.
   ///
   /// @return
@@ -673,7 +671,7 @@ public:
   ///Only read in breakpoints whose names match one of the names in this
   ///list.
   ///
-  /// @param[out] bkpt_list
+  /// @param[out] new_bps
   ///A list of the newly created breakpoints.
   ///
   /// @return


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


[Lldb-commits] [lldb] r295882 - Fix header documentation.

2017-02-22 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Wed Feb 22 15:32:48 2017
New Revision: 295882

URL: http://llvm.org/viewvc/llvm-project?rev=295882&view=rev
Log:
Fix header documentation.

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

Modified: lldb/trunk/include/lldb/API/SBAttachInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBAttachInfo.h?rev=295882&r1=295881&r2=295882&view=diff
==
--- lldb/trunk/include/lldb/API/SBAttachInfo.h (original)
+++ lldb/trunk/include/lldb/API/SBAttachInfo.h Wed Feb 22 15:32:48 2017
@@ -86,7 +86,7 @@ public:
   /// This function implies that a call to SBTarget::Attach(...) will
   /// be synchronous.
   ///
-  /// @param[in] wait_for
+  /// @param[in] b
   /// If \b false, attach to an existing process whose name matches.
   /// If \b true, then wait for the next process whose name matches.
   //--
@@ -99,7 +99,7 @@ public:
   /// Future calls to SBTarget::Attach(...) will be synchronous or
   /// asynchronous depending on the \a async argument.
   ///
-  /// @param[in] wait_for
+  /// @param[in] b
   /// If \b false, attach to an existing process whose name matches.
   /// If \b true, then wait for the next process whose name matches.
   ///


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


[Lldb-commits] [PATCH] D30272: Improve data formatter for libstdcpp unique_ptr

2017-02-22 Thread Tamas Berghammer via Phabricator via lldb-commits
tberghammer created this revision.

Improve data formatter for libstdcpp unique_ptr

- Fix infinite loop when there is a reference loop created from smart pointers
- Respect pointer depth argument in frame variable command
- Support dereferencing unique_ptr in the frame variable command
- Support operator-> for unique_ptr in the frame variable command

Note: After submitting this change I plan to add the same functionality for the 
other smart pointers as well (shared_ptr/weak_ptr, libcpp/libstdcpp)


https://reviews.llvm.org/D30272

Files:
  include/lldb/Core/ValueObject.h
  include/lldb/DataFormatters/ValueObjectPrinter.h
  include/lldb/Target/Language.h
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/main.cpp
  source/Core/ValueObject.cpp
  source/DataFormatters/ValueObjectPrinter.cpp
  source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
  source/Target/Language.cpp
  source/Target/StackFrame.cpp

Index: source/Target/StackFrame.cpp
===
--- source/Target/StackFrame.cpp
+++ source/Target/StackFrame.cpp
@@ -604,8 +604,10 @@
 // Calculate the next separator index ahead of time
 ValueObjectSP child_valobj_sp;
 const char separator_type = var_expr[0];
+bool expr_is_ptr = false;
 switch (separator_type) {
 case '-':
+  expr_is_ptr = true;
   if (var_expr.size() >= 2 && var_expr[1] != '>')
 return ValueObjectSP();
 
@@ -622,11 +624,26 @@
   return ValueObjectSP();
 }
   }
+
+  // If we have operator-> and it is a pointer like value object then we
+  // dereference it and then handle it as operator.
+  if (valobj_sp->IsPointerLikeObject()) {
+Error deref_error;
+ValueObjectSP deref_sp = valobj_sp->Dereference(deref_error);
+if (deref_sp && error.Success()) {
+  valobj_sp = deref_sp;
+  expr_is_ptr = false;
+} else {
+  error.SetErrorStringWithFormat(
+  "Failed to dereference a pointer like object: %s",
+  deref_error.AsCString());
+  return ValueObjectSP();
+}
+  }
+
   var_expr = var_expr.drop_front(); // Remove the '-'
   LLVM_FALLTHROUGH;
 case '.': {
-  const bool expr_is_ptr = var_expr[0] == '>';
-
   var_expr = var_expr.drop_front(); // Remove the '.' or '>'
   separator_idx = var_expr.find_first_of(".-[");
   ConstString child_name(var_expr.substr(0, var_expr.find_first_of(".-[")));
Index: source/Target/Language.cpp
===
--- source/Target/Language.cpp
+++ source/Target/Language.cpp
@@ -413,6 +413,9 @@
   s.Printf("Exception breakpoint (catch: %s throw: %s)",
catch_on ? "on" : "off", throw_on ? "on" : "off");
 }
+
+bool Language::IsPointerLikeObject(ValueObject &valobj) { return false; }
+
 //--
 // Constructor
 //--
Index: source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
===
--- source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
+++ source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
@@ -101,6 +101,8 @@
   HardcodedFormatters::HardcodedSyntheticFinder
   GetHardcodedSynthetics() override;
 
+  bool IsPointerLikeObject(ValueObject &valobj) override;
+
   //--
   // Static Functions
   //--
Index: source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
===
--- source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -1164,3 +1164,12 @@
 
   return g_formatters;
 }
+
+bool CPlusPlusLanguage::IsPointerLikeObject(ValueObject &valobj) {
+  static RegularExpression unique_ptr_regex("^std::unique_ptr<.+>(( )?&)?$");
+
+  llvm::StringRef name(valobj.GetCompilerType().GetTypeName().GetStringRef());
+  if (unique_ptr_regex.Execute(name))
+return true;
+  return false;
+}
Index: source/DataFormatters/ValueObjectPrinter.cpp
===
--- source/DataFormatters/ValueObjectPrinter.cpp
+++ source/DataFormatters/ValueObjectPrinter.cpp
@@ -63,6 +63,7 @@
   m_is_ptr = eLazyBoolCalculate;
   m_is_ref = eLazyBoolCalculate;
   m_is_aggregate = eLazyBoolCalculate;
+  m_is_pointer_like = eLazyBoolCalculate;
   m_is_instance_ptr = eLazyBoolCalculate;
   m_summary_formatter = {nullptr, false};
   m_value.assign("");
@@ -208,6 +209,

Re: [Lldb-commits] [PATCH] D30249: Clear expression when breakpoint location becomes unresolved

2017-02-22 Thread Jim Ingham via lldb-commits
In some classes we have a Clear method that we use to release resources from an 
object when we are done with it but it might not get destroyed right away.  I 
pretty sure Greg thought that you would be adding your change to such a method; 
and in fact it would be fine to add a Clear method to BreakpointLocation and 
put the deallocation of the user expression there, but there isn't one at 
present.  Greg's not as familiar with the breakpoints as with other parts of 
lldb, since I wrote that subsystem and have been mostly maintaining it over the 
years, so he probably didn't know this.

Sorry for the crossed wires.

Jim



> On Feb 22, 2017, at 12:39 PM, Pavel Labath via Phabricator 
>  wrote:
> 
> labath added a comment.
> 
>> Note that the breakpoint location's site gets cleared when you disable the 
>> breakpoint or its location, as well as when you delete it.  So if you have a 
>> workflow that does: "hit a breakpoint, disable it, hit another, reenable the 
>> first, hit the second" you'll end up re-evaluating the condition expression 
>> unnecessarily.  This isn't a terribly common workflow, and compiling the 
>> expression is not hugely expensive.  But in this instance, it was probably 
>> better to break the link at the SBBreakpoint level, and not here.
> 
> Sorry, I thought I understood Greg wanted me to do this. I can certainly do 
> the SBBreakpoint thing instead.
> 
> 
> https://reviews.llvm.org/D30249
> 
> 
> 

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


[Lldb-commits] [lldb] r295897 - Changed builld-llvm.py to use .json files

2017-02-22 Thread Sean Callanan via lldb-commits
Author: spyffe
Date: Wed Feb 22 16:57:59 2017
New Revision: 295897

URL: http://llvm.org/viewvc/llvm-project?rev=295897&view=rev
Log:
Changed builld-llvm.py to use .json files

LLDB has many branches in a variety of repositories.
The build-script.py file is subtly different for each set.
This is unnecessary and causes merge headaches.

This patch makes build-llvm.py consult a directory full 
of .json files, each one of which matches a particular
branch using a regular expression.

Differential revision: https://reviews.llvm.org/D30275

Added:
lldb/trunk/scripts/Xcode/repo.py
lldb/trunk/scripts/Xcode/repos/
lldb/trunk/scripts/Xcode/repos/svn-trunk.json
Modified:
lldb/trunk/scripts/Xcode/build-llvm.py

Modified: lldb/trunk/scripts/Xcode/build-llvm.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Xcode/build-llvm.py?rev=295897&r1=295896&r2=295897&view=diff
==
--- lldb/trunk/scripts/Xcode/build-llvm.py (original)
+++ lldb/trunk/scripts/Xcode/build-llvm.py Wed Feb 22 16:57:59 2017
@@ -6,6 +6,7 @@ import fnmatch
 import os
 import platform
 import re
+import repo
 import subprocess
 import sys
 
@@ -17,42 +18,38 @@ from lldbbuild import *
 def LLVM_HASH_INCLUDES_DIFFS():
 return False
 
-# The use of "x = "..."; return x" here is important because tooling looks for
-# it with regexps.  Only change how this works if you know what you are doing.
-
-
-def LLVM_REF():
-llvm_ref = "master"
-return llvm_ref
-
-
-def CLANG_REF():
-clang_ref = "master"
-return clang_ref
-
 # For use with Xcode-style builds
 
+def process_vcs(vcs):
+return {
+"svn": VCS.svn,
+"git": VCS.git
+}[vcs]
+
+def process_root(name):
+return {
+"llvm": llvm_source_path(),
+"clang": clang_source_path(),
+"ninja": ninja_source_path()
+}[name]
+
+def process_repo(r):
+return {
+'name': r["name"],
+'vcs': process_vcs(r["vcs"]),
+'root': process_root(r["name"]),
+'url': r["url"],
+'ref': r["ref"]
+}
 
 def XCODE_REPOSITORIES():
-return [
-{'name': "llvm",
- 'vcs': VCS.git,
- 'root': llvm_source_path(),
- 'url': "http://llvm.org/git/llvm.git";,
- 'ref': LLVM_REF()},
-
-{'name': "clang",
- 'vcs': VCS.git,
- 'root': clang_source_path(),
- 'url': "http://llvm.org/git/clang.git";,
- 'ref': CLANG_REF()},
-
-{'name': "ninja",
- 'vcs': VCS.git,
- 'root': ninja_source_path(),
- 'url': "https://github.com/ninja-build/ninja.git";,
- 'ref': "master"}
-]
+identifier = repo.identifier()
+if identifier == None:
+sys.exit("Couldn't identify the current branch")
+set = repo.find(identifier)
+if set == None:
+sys.exit("Couldn't find a repository set for the current branch")
+return [process_repo(r) for r in set]
 
 
 def get_c_compiler():

Added: lldb/trunk/scripts/Xcode/repo.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Xcode/repo.py?rev=295897&view=auto
==
--- lldb/trunk/scripts/Xcode/repo.py (added)
+++ lldb/trunk/scripts/Xcode/repo.py Wed Feb 22 16:57:59 2017
@@ -0,0 +1,33 @@
+import json
+import os
+import re
+import subprocess
+
+def identifier():
+   try:
+   svn_output = subprocess.check_output(["svn", "info", 
"--show-item", "url"], stderr=subprocess.STDOUT).rstrip()
+   return svn_output
+   except:
+   pass
+   try:
+   git_remote_and_branch = subprocess.check_output(["git", 
"rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"]).rstrip()
+   git_remote = git_remote_and_branch.split("/")[0]
+   git_branch = "/".join(git_remote_and_branch.split("/")[1:])
+   git_url = subprocess.check_output(["git", "remote", "get-url", 
git_remote]).rstrip()
+   return git_url + ":" + git_branch
+   except:
+   pass
+   return None
+
+def find(identifier):
+   dir = os.path.dirname(os.path.realpath(__file__))
+   repos_dir = os.path.join(dir, "repos")
+   json_regex = re.compile(r"^.*.json$")
+   override_path = os.path.join(repos_dir, "OVERRIDE.json")
+   if os.path.isfile(override_path):
+   override_set = json.load(open(override_path))
+   return override_set["repos"]
+   for set in [json.load(open(os.path.join(repos_dir, f))) for f in 
filter(json_regex.match, os.listdir(repos_dir))]:
+   if re.match(set["regexp"], identifier):
+   return set["repos"]
+   return None

Added: lldb/trunk/scripts/Xcode/repos/svn-trunk.json
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Xcode/repos/svn-trunk.json?rev=295897&view=auto
==

[Lldb-commits] [lldb] r295907 - Fixed errors in AllocatedBlock:

2017-02-22 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Wed Feb 22 17:42:55 2017
New Revision: 295907

URL: http://llvm.org/viewvc/llvm-project?rev=295907&view=rev
Log:
Fixed errors in AllocatedBlock:
- Allow zero byte size request for memory and ensure it gets a unique address
- Exit the free block loop when we find an appropriate free block




Modified:
lldb/trunk/source/Target/Memory.cpp

Modified: lldb/trunk/source/Target/Memory.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Memory.cpp?rev=295907&r1=295906&r2=295907&view=diff
==
--- lldb/trunk/source/Target/Memory.cpp (original)
+++ lldb/trunk/source/Target/Memory.cpp Wed Feb 22 17:42:55 2017
@@ -263,7 +263,9 @@ AllocatedBlock::AllocatedBlock(lldb::add
 AllocatedBlock::~AllocatedBlock() {}
 
 lldb::addr_t AllocatedBlock::ReserveBlock(uint32_t size) {
-  addr_t addr = LLDB_INVALID_ADDRESS;
+  // We must return something valid for zero bytes.
+  if (size == 0)
+size = 1;
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
   
   const size_t free_count = m_free_blocks.GetSize();
@@ -276,7 +278,7 @@ lldb::addr_t AllocatedBlock::ReserveBloc
   // We found a free block that is big enough for our data. Figure out how
   // many chunks we will need and calculate the resulting block size we 
will
   // reserve.
-  addr = free_block.GetRangeBase();
+  addr_t addr = free_block.GetRangeBase();
   size_t num_chunks = CalculateChunksNeededForSize(size);
   lldb::addr_t block_size = num_chunks * m_chunk_size;
   lldb::addr_t bytes_left = range_size - block_size;
@@ -301,11 +303,14 @@ lldb::addr_t AllocatedBlock::ReserveBloc
 free_block.SetRangeBase(reserved_block.GetRangeEnd());
 free_block.SetByteSize(bytes_left);
   }
+  LLDB_LOGV(log, "({0}) (size = {1} ({1:x})) => {2:x}", this, size, addr);
+  return addr;
 }
   }
 
-  LLDB_LOGV(log, "({0}) (size = {1} ({1:x})) => {2:x}", this, size, addr);
-  return addr;
+  LLDB_LOGV(log, "({0}) (size = {1} ({1:x})) => {2:x}", this, size,
+LLDB_INVALID_ADDRESS);
+  return LLDB_INVALID_ADDRESS;
 }
 
 bool AllocatedBlock::FreeBlock(addr_t addr) {


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


[Lldb-commits] [PATCH] D30272: Improve data formatter for libstdcpp unique_ptr

2017-02-22 Thread Jim Ingham via Phabricator via lldb-commits
jingham requested changes to this revision.
jingham added a comment.
This revision now requires changes to proceed.

It seems a little wrong to me to hook "IsPointerLikeObject" up to the 
ValueObject, and not to the Synthetic Child Provider for the type.  After all, 
you are using the Synthetic Child Provider to provide the pointee object, so it 
should be the synthetic child provider that says it is presenting the bare type 
as a pointer-like thing.  That's also more in line with the way the formatters 
work.  They add structure to an underlying object independent of it's own 
structure.  And the "can be treated like a pointer" bit is just another 
instance of this.

Also, if you did it that way, you could then add an "is_pointer_like" method to 
the Scripted Synthetic Child Provider, and this could be adopted by formatters 
for types lldb knows nothing about.


https://reviews.llvm.org/D30272



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


[Lldb-commits] [PATCH] D30007: [lldb] Provide API to know which sanitizer generated an eStopReasonInstrumentation

2017-02-22 Thread Kuba (Brecka) Mracek via Phabricator via lldb-commits
kubamracek added a comment.

@jingham ping


https://reviews.llvm.org/D30007



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


[Lldb-commits] [PATCH] D30007: [lldb] Provide API to know which sanitizer generated an eStopReasonInstrumentation

2017-02-22 Thread Jim Ingham via Phabricator via lldb-commits
jingham requested changes to this revision.
jingham added a comment.
This revision now requires changes to proceed.

Aargh, sorry.  My queue is overflowing...  I had one tiny comment about the 
tests.  If you do that, then it will be fine to go in.




Comment at: 
packages/Python/lldbsuite/test/functionalities/asan/TestMemoryHistory.py:126-132
+self.assertEqual(
+process.GetSelectedThread().GetStopReason(),
+lldb.eStopReasonInstrumentation)
+self.assertEqual(
+process.GetSelectedThread().GetStopReasonDataAtIndex(0),
+lldb.eInstrumentationRuntimeTypeAddressSanitizer)
+

Can you add a check that GetStopReasonDataCount and only do the check for 
GetStopReasonDataAtIndex if this is 1?  We have the ability to run the 
testsuite against older lldb's and it's good not to add failures if it can be 
avoided.  Plus it's good to check that that call is returning a reasonable 
value.



Comment at: 
packages/Python/lldbsuite/test/functionalities/asan/TestReportData.py:65-67
+self.assertEqual(process.
+GetSelectedThread().GetStopReasonDataAtIndex(0),
+lldb.eInstrumentationRuntimeTypeAddressSanitizer)

Same comment as above.



Comment at: 
packages/Python/lldbsuite/test/functionalities/tsan/basic/TestTsanBasic.py:57-59
+self.assertEqual(
+process.GetSelectedThread().GetStopReasonDataAtIndex(0),
+lldb.eInstrumentationRuntimeTypeThreadSanitizer)

Same comment as above.


https://reviews.llvm.org/D30007



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


Re: [Lldb-commits] [lldb] r295897 - Changed builld-llvm.py to use .json files

2017-02-22 Thread Tim Hammerquist via lldb-commits
Hi Sean,

Looks like this is breaking builds in Green Dragon (and locally for me from
master branch). Can you take a look at the failures here?

http://lab.llvm.org:8080/green/view/LLDB/job/lldb_build_test/26076/console

Thanks!
-Tim


On Wed, Feb 22, 2017 at 2:57 PM, Sean Callanan via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> Author: spyffe
> Date: Wed Feb 22 16:57:59 2017
> New Revision: 295897
>
> URL: http://llvm.org/viewvc/llvm-project?rev=295897&view=rev
> Log:
> Changed builld-llvm.py to use .json files
>
> LLDB has many branches in a variety of repositories.
> The build-script.py file is subtly different for each set.
> This is unnecessary and causes merge headaches.
>
> This patch makes build-llvm.py consult a directory full
> of .json files, each one of which matches a particular
> branch using a regular expression.
>
> Differential revision: https://reviews.llvm.org/D30275
>
> Added:
> lldb/trunk/scripts/Xcode/repo.py
> lldb/trunk/scripts/Xcode/repos/
> lldb/trunk/scripts/Xcode/repos/svn-trunk.json
> Modified:
> lldb/trunk/scripts/Xcode/build-llvm.py
>
> Modified: lldb/trunk/scripts/Xcode/build-llvm.py
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/
> Xcode/build-llvm.py?rev=295897&r1=295896&r2=295897&view=diff
> 
> ==
> --- lldb/trunk/scripts/Xcode/build-llvm.py (original)
> +++ lldb/trunk/scripts/Xcode/build-llvm.py Wed Feb 22 16:57:59 2017
> @@ -6,6 +6,7 @@ import fnmatch
>  import os
>  import platform
>  import re
> +import repo
>  import subprocess
>  import sys
>
> @@ -17,42 +18,38 @@ from lldbbuild import *
>  def LLVM_HASH_INCLUDES_DIFFS():
>  return False
>
> -# The use of "x = "..."; return x" here is important because tooling
> looks for
> -# it with regexps.  Only change how this works if you know what you are
> doing.
> -
> -
> -def LLVM_REF():
> -llvm_ref = "master"
> -return llvm_ref
> -
> -
> -def CLANG_REF():
> -clang_ref = "master"
> -return clang_ref
> -
>  # For use with Xcode-style builds
>
> +def process_vcs(vcs):
> +return {
> +"svn": VCS.svn,
> +"git": VCS.git
> +}[vcs]
> +
> +def process_root(name):
> +return {
> +"llvm": llvm_source_path(),
> +"clang": clang_source_path(),
> +"ninja": ninja_source_path()
> +}[name]
> +
> +def process_repo(r):
> +return {
> +'name': r["name"],
> +'vcs': process_vcs(r["vcs"]),
> +'root': process_root(r["name"]),
> +'url': r["url"],
> +'ref': r["ref"]
> +}
>
>  def XCODE_REPOSITORIES():
> -return [
> -{'name': "llvm",
> - 'vcs': VCS.git,
> - 'root': llvm_source_path(),
> - 'url': "http://llvm.org/git/llvm.git";,
> - 'ref': LLVM_REF()},
> -
> -{'name': "clang",
> - 'vcs': VCS.git,
> - 'root': clang_source_path(),
> - 'url': "http://llvm.org/git/clang.git";,
> - 'ref': CLANG_REF()},
> -
> -{'name': "ninja",
> - 'vcs': VCS.git,
> - 'root': ninja_source_path(),
> - 'url': "https://github.com/ninja-build/ninja.git";,
> - 'ref': "master"}
> -]
> +identifier = repo.identifier()
> +if identifier == None:
> +sys.exit("Couldn't identify the current branch")
> +set = repo.find(identifier)
> +if set == None:
> +sys.exit("Couldn't find a repository set for the current branch")
> +return [process_repo(r) for r in set]
>
>
>  def get_c_compiler():
>
> Added: lldb/trunk/scripts/Xcode/repo.py
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/
> Xcode/repo.py?rev=295897&view=auto
> 
> ==
> --- lldb/trunk/scripts/Xcode/repo.py (added)
> +++ lldb/trunk/scripts/Xcode/repo.py Wed Feb 22 16:57:59 2017
> @@ -0,0 +1,33 @@
> +import json
> +import os
> +import re
> +import subprocess
> +
> +def identifier():
> +   try:
> +   svn_output = subprocess.check_output(["svn", "info",
> "--show-item", "url"], stderr=subprocess.STDOUT).rstrip()
> +   return svn_output
> +   except:
> +   pass
> +   try:
> +   git_remote_and_branch = subprocess.check_output(["git",
> "rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"]).rstrip()
> +   git_remote = git_remote_and_branch.split("/")[0]
> +   git_branch = "/".join(git_remote_and_
> branch.split("/")[1:])
> +   git_url = subprocess.check_output(["git", "remote",
> "get-url", git_remote]).rstrip()
> +   return git_url + ":" + git_branch
> +   except:
> +   pass
> +   return None
> +
> +def find(identifier):
> +   dir = os.path.dirname(os.path.realpath(__file__))
> +   repos_dir = os.path.join(dir, "repos")
> +   json_regex = re.compile(r"^.*.json$")
> +   override_path = os.path.join(repos_dir, 

Re: [Lldb-commits] [lldb] r295897 - Changed builld-llvm.py to use .json files

2017-02-22 Thread Sean Callanan via lldb-commits
I'll roll it back pending some fixes on my end.
Sorry for the break.

Sean

> On Feb 22, 2017, at 4:40 PM, Tim Hammerquist  wrote:
> 
> Hi Sean,
> 
> Looks like this is breaking builds in Green Dragon (and locally for me from 
> master branch). Can you take a look at the failures here?
> 
> http://lab.llvm.org:8080/green/view/LLDB/job/lldb_build_test/26076/console 
> 
> 
> Thanks!
> -Tim
> 
> 
> On Wed, Feb 22, 2017 at 2:57 PM, Sean Callanan via lldb-commits 
> mailto:lldb-commits@lists.llvm.org>> wrote:
> Author: spyffe
> Date: Wed Feb 22 16:57:59 2017
> New Revision: 295897
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=295897&view=rev 
> 
> Log:
> Changed builld-llvm.py to use .json files
> 
> LLDB has many branches in a variety of repositories.
> The build-script.py file is subtly different for each set.
> This is unnecessary and causes merge headaches.
> 
> This patch makes build-llvm.py consult a directory full
> of .json files, each one of which matches a particular
> branch using a regular expression.
> 
> Differential revision: https://reviews.llvm.org/D30275 
> 
> 
> Added:
> lldb/trunk/scripts/Xcode/repo.py
> lldb/trunk/scripts/Xcode/repos/
> lldb/trunk/scripts/Xcode/repos/svn-trunk.json
> Modified:
> lldb/trunk/scripts/Xcode/build-llvm.py
> 
> Modified: lldb/trunk/scripts/Xcode/build-llvm.py
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Xcode/build-llvm.py?rev=295897&r1=295896&r2=295897&view=diff
>  
> 
> ==
> --- lldb/trunk/scripts/Xcode/build-llvm.py (original)
> +++ lldb/trunk/scripts/Xcode/build-llvm.py Wed Feb 22 16:57:59 2017
> @@ -6,6 +6,7 @@ import fnmatch
>  import os
>  import platform
>  import re
> +import repo
>  import subprocess
>  import sys
> 
> @@ -17,42 +18,38 @@ from lldbbuild import *
>  def LLVM_HASH_INCLUDES_DIFFS():
>  return False
> 
> -# The use of "x = "..."; return x" here is important because tooling looks 
> for
> -# it with regexps.  Only change how this works if you know what you are 
> doing.
> -
> -
> -def LLVM_REF():
> -llvm_ref = "master"
> -return llvm_ref
> -
> -
> -def CLANG_REF():
> -clang_ref = "master"
> -return clang_ref
> -
>  # For use with Xcode-style builds
> 
> +def process_vcs(vcs):
> +return {
> +"svn": VCS.svn,
> +"git": VCS.git
> +}[vcs]
> +
> +def process_root(name):
> +return {
> +"llvm": llvm_source_path(),
> +"clang": clang_source_path(),
> +"ninja": ninja_source_path()
> +}[name]
> +
> +def process_repo(r):
> +return {
> +'name': r["name"],
> +'vcs': process_vcs(r["vcs"]),
> +'root': process_root(r["name"]),
> +'url': r["url"],
> +'ref': r["ref"]
> +}
> 
>  def XCODE_REPOSITORIES():
> -return [
> -{'name': "llvm",
> - 'vcs': VCS.git,
> - 'root': llvm_source_path(),
> - 'url': "http://llvm.org/git/llvm.git 
> ",
> - 'ref': LLVM_REF()},
> -
> -{'name': "clang",
> - 'vcs': VCS.git,
> - 'root': clang_source_path(),
> - 'url': "http://llvm.org/git/clang.git 
> ",
> - 'ref': CLANG_REF()},
> -
> -{'name': "ninja",
> - 'vcs': VCS.git,
> - 'root': ninja_source_path(),
> - 'url': "https://github.com/ninja-build/ninja.git 
> ",
> - 'ref': "master"}
> -]
> +identifier = repo.identifier()
> +if identifier == None:
> +sys.exit("Couldn't identify the current branch")
> +set = repo.find(identifier)
> +if set == None:
> +sys.exit("Couldn't find a repository set for the current branch")
> +return [process_repo(r) for r in set]
> 
> 
>  def get_c_compiler():
> 
> Added: lldb/trunk/scripts/Xcode/repo.py
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Xcode/repo.py?rev=295897&view=auto
>  
> 
> ==
> --- lldb/trunk/scripts/Xcode/repo.py (added)
> +++ lldb/trunk/scripts/Xcode/repo.py Wed Feb 22 16:57:59 2017
> @@ -0,0 +1,33 @@
> +import json
> +import os
> +import re
> +import subprocess
> +
> +def identifier():
> +   try:
> +   svn_output = subprocess.check_output(["svn", "info", 
> "--show-item", "url"], stderr=subprocess.STDOUT).rstrip()
> +   return svn_output
> +   except:
> +   pass
> +   try:
> +   git_remote_and_branch = subprocess.check_out

[Lldb-commits] [lldb] r295915 - Reverted 295897 pending refinements and fixes for green-dragon.

2017-02-22 Thread Sean Callanan via lldb-commits
Author: spyffe
Date: Wed Feb 22 18:46:30 2017
New Revision: 295915

URL: http://llvm.org/viewvc/llvm-project?rev=295915&view=rev
Log:
Reverted 295897 pending refinements and fixes for green-dragon.

Removed:
lldb/trunk/scripts/Xcode/repo.py
lldb/trunk/scripts/Xcode/repos/
Modified:
lldb/trunk/scripts/Xcode/build-llvm.py

Modified: lldb/trunk/scripts/Xcode/build-llvm.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Xcode/build-llvm.py?rev=295915&r1=295914&r2=295915&view=diff
==
--- lldb/trunk/scripts/Xcode/build-llvm.py (original)
+++ lldb/trunk/scripts/Xcode/build-llvm.py Wed Feb 22 18:46:30 2017
@@ -6,7 +6,6 @@ import fnmatch
 import os
 import platform
 import re
-import repo
 import subprocess
 import sys
 
@@ -18,38 +17,42 @@ from lldbbuild import *
 def LLVM_HASH_INCLUDES_DIFFS():
 return False
 
+# The use of "x = "..."; return x" here is important because tooling looks for
+# it with regexps.  Only change how this works if you know what you are doing.
+
+
+def LLVM_REF():
+llvm_ref = "master"
+return llvm_ref
+
+
+def CLANG_REF():
+clang_ref = "master"
+return clang_ref
+
 # For use with Xcode-style builds
 
-def process_vcs(vcs):
-return {
-"svn": VCS.svn,
-"git": VCS.git
-}[vcs]
-
-def process_root(name):
-return {
-"llvm": llvm_source_path(),
-"clang": clang_source_path(),
-"ninja": ninja_source_path()
-}[name]
-
-def process_repo(r):
-return {
-'name': r["name"],
-'vcs': process_vcs(r["vcs"]),
-'root': process_root(r["name"]),
-'url': r["url"],
-'ref': r["ref"]
-}
 
 def XCODE_REPOSITORIES():
-identifier = repo.identifier()
-if identifier == None:
-sys.exit("Couldn't identify the current branch")
-set = repo.find(identifier)
-if set == None:
-sys.exit("Couldn't find a repository set for the current branch")
-return [process_repo(r) for r in set]
+return [
+{'name': "llvm",
+ 'vcs': VCS.git,
+ 'root': llvm_source_path(),
+ 'url': "http://llvm.org/git/llvm.git";,
+ 'ref': LLVM_REF()},
+
+{'name': "clang",
+ 'vcs': VCS.git,
+ 'root': clang_source_path(),
+ 'url': "http://llvm.org/git/clang.git";,
+ 'ref': CLANG_REF()},
+
+{'name': "ninja",
+ 'vcs': VCS.git,
+ 'root': ninja_source_path(),
+ 'url': "https://github.com/ninja-build/ninja.git";,
+ 'ref': "master"}
+]
 
 
 def get_c_compiler():

Removed: lldb/trunk/scripts/Xcode/repo.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Xcode/repo.py?rev=295914&view=auto
==
--- lldb/trunk/scripts/Xcode/repo.py (original)
+++ lldb/trunk/scripts/Xcode/repo.py (removed)
@@ -1,33 +0,0 @@
-import json
-import os
-import re
-import subprocess
-
-def identifier():
-   try:
-   svn_output = subprocess.check_output(["svn", "info", 
"--show-item", "url"], stderr=subprocess.STDOUT).rstrip()
-   return svn_output
-   except:
-   pass
-   try:
-   git_remote_and_branch = subprocess.check_output(["git", 
"rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"]).rstrip()
-   git_remote = git_remote_and_branch.split("/")[0]
-   git_branch = "/".join(git_remote_and_branch.split("/")[1:])
-   git_url = subprocess.check_output(["git", "remote", "get-url", 
git_remote]).rstrip()
-   return git_url + ":" + git_branch
-   except:
-   pass
-   return None
-
-def find(identifier):
-   dir = os.path.dirname(os.path.realpath(__file__))
-   repos_dir = os.path.join(dir, "repos")
-   json_regex = re.compile(r"^.*.json$")
-   override_path = os.path.join(repos_dir, "OVERRIDE.json")
-   if os.path.isfile(override_path):
-   override_set = json.load(open(override_path))
-   return override_set["repos"]
-   for set in [json.load(open(os.path.join(repos_dir, f))) for f in 
filter(json_regex.match, os.listdir(repos_dir))]:
-   if re.match(set["regexp"], identifier):
-   return set["repos"]
-   return None


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


[Lldb-commits] [PATCH] D30054: Delete DataBufferMemoryMap

2017-02-22 Thread Zachary Turner via Phabricator via lldb-commits
zturner updated this revision to Diff 89453.
zturner added a comment.

Updated with suggestions from labath@


https://reviews.llvm.org/D30054

Files:
  lldb/include/lldb/Core/DataBufferHeap.h
  lldb/include/lldb/Core/DataBufferLLVM.h
  lldb/include/lldb/Core/DataBufferMemoryMap.h
  lldb/include/lldb/Host/FileSpec.h
  lldb/source/Core/CMakeLists.txt
  lldb/source/Core/DataBufferMemoryMap.cpp
  lldb/source/Host/common/FileSpec.cpp
  lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
  lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
  lldb/unittests/Process/minidump/MinidumpParserTest.cpp

Index: lldb/unittests/Process/minidump/MinidumpParserTest.cpp
===
--- lldb/unittests/Process/minidump/MinidumpParserTest.cpp
+++ lldb/unittests/Process/minidump/MinidumpParserTest.cpp
@@ -19,13 +19,15 @@
 #include "gtest/gtest.h"
 
 #include "lldb/Core/ArchSpec.h"
+#include "lldb/Core/DataBufferLLVM.h"
 #include "lldb/Core/DataExtractor.h"
 #include "lldb/Host/FileSpec.h"
 #include "lldb/Target/MemoryRegionInfo.h"
 
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/Support/FileSystem.h"
+#include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/Path.h"
 
 // C includes
@@ -49,11 +51,11 @@
   void SetUpData(const char *minidump_filename, size_t load_size = SIZE_MAX) {
 llvm::SmallString<128> filename = inputs_folder;
 llvm::sys::path::append(filename, minidump_filename);
-FileSpec minidump_file(filename.c_str(), false);
-lldb::DataBufferSP data_sp(
-minidump_file.MemoryMapFileContents(0, load_size));
+
+auto BufferPtr = DataBufferLLVM::CreateFromPath(filename, load_size, 0);
+
 llvm::Optional optional_parser =
-MinidumpParser::Create(data_sp);
+MinidumpParser::Create(BufferPtr);
 ASSERT_TRUE(optional_parser.hasValue());
 parser.reset(new MinidumpParser(optional_parser.getValue()));
 ASSERT_GT(parser->GetData().size(), 0UL);
Index: lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
===
--- lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
+++ lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
@@ -12,7 +12,7 @@
 #include "ThreadMinidump.h"
 
 // Other libraries and framework includes
-#include "lldb/Core/DataBufferHeap.h"
+#include "lldb/Core/DataBufferLLVM.h"
 #include "lldb/Core/Log.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/ModuleSpec.h"
@@ -25,6 +25,7 @@
 #include "lldb/Target/UnixSignals.h"
 #include "lldb/Utility/LLDBAssert.h"
 
+#include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/Threading.h"
 
 // C includes
@@ -50,20 +51,26 @@
 
   lldb::ProcessSP process_sp;
   // Read enough data for the Minidump header
-  const size_t header_size = sizeof(MinidumpHeader);
-  lldb::DataBufferSP data_sp(crash_file->MemoryMapFileContents(0, header_size));
-  if (!data_sp)
+  constexpr size_t header_size = sizeof(MinidumpHeader);
+  auto DataPtr =
+  DataBufferLLVM::CreateFromFileSpec(*crash_file, header_size, 0);
+  if (!DataPtr)
 return nullptr;
 
+  assert(DataPtr->GetByteSize() == header_size);
+
   // first, only try to parse the header, beacuse we need to be fast
-  llvm::ArrayRef header_data(data_sp->GetBytes(), header_size);
-  const MinidumpHeader *header = MinidumpHeader::Parse(header_data);
+  llvm::ArrayRef HeaderBytes = DataPtr->GetData();
+  const MinidumpHeader *header = MinidumpHeader::Parse(HeaderBytes);
+  if (header == nullptr)
+return nullptr;
 
-  if (data_sp->GetByteSize() != header_size || header == nullptr)
+  auto AllData = llvm::MemoryBuffer::getFile(crash_file->GetPath(), -1, false);
+  if (!AllData)
 return nullptr;
+  auto AllDataPtr = std::make_shared(std::move(*AllData));
 
-  lldb::DataBufferSP all_data_sp(crash_file->MemoryMapFileContents());
-  auto minidump_parser = MinidumpParser::Create(all_data_sp);
+  auto minidump_parser = MinidumpParser::Create(AllDataPtr);
   // check if the parser object is valid
   if (!minidump_parser)
 return nullptr;
Index: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
===
--- lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -13,8 +13,8 @@
 #include "llvm/Support/COFF.h"
 
 #include "lldb/Core/ArchSpec.h"
-#include "lldb/Core/DataBuffer.h"
 #include "lldb/Core/DataBufferHeap.h"
+#include "lldb/Core/DataBufferLLVM.h"
 #include "lldb/Core/FileSpecList.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/ModuleSpec.h"
@@ -30,6 +30,8 @@
 #include "lldb/Target/Target.h"
 #include "lldb/Utility/StreamString.h"
 
+#include "llvm/Support/Me

[Lldb-commits] [lldb] r295922 - Changed builld-llvm.py to use .json files

2017-02-22 Thread Sean Callanan via lldb-commits
Author: spyffe
Date: Wed Feb 22 20:21:34 2017
New Revision: 295922

URL: http://llvm.org/viewvc/llvm-project?rev=295922&view=rev
Log:
Changed builld-llvm.py to use .json files

LLDB has many branches in a variety of repositories.
The build-script.py file is subtly different for each set.
This is unnecessary and causes merge headaches.

This patch makes build-llvm.py consult a directory full 
of .json files, each one of which matches a particular
branch using a regular expression.

This update to the patch introduces a FALLBACK file
whose contents take precedence if the current branch
could not be identified.  If the current branch could be
identified, FALLBACK is updated, allowing the user to
e.g. cut branches off of known branches and still have
the automatic checkout mechanism work.

It also documents all of this.

Differential revision: https://reviews.llvm.org/D30275

Added:
lldb/trunk/scripts/Xcode/repo.py
lldb/trunk/scripts/Xcode/repos/
lldb/trunk/scripts/Xcode/repos/FALLBACK
lldb/trunk/scripts/Xcode/repos/svn-trunk.json
Modified:
lldb/trunk/INSTALL.txt
lldb/trunk/scripts/Xcode/build-llvm.py

Modified: lldb/trunk/INSTALL.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/INSTALL.txt?rev=295922&r1=295921&r2=295922&view=diff
==
--- lldb/trunk/INSTALL.txt (original)
+++ lldb/trunk/INSTALL.txt Wed Feb 22 20:21:34 2017
@@ -7,6 +7,11 @@ On Mac OS X, in addition to using Xcode
 on your system to either build lldb or debug using lldb.  Please see the code
 signing documentation in docs/code-signing.txt for more detailed directions.
 
+If you are building on Mac OS X and LLVM is not present in llvm/, then LLDB
+will check it out automatically.  The files in scripts/Xcode/repos determine
+which branches of LLVM/Clang are checked out, depending on the current
+LLDB branch, according to the algorithm in scripts/Xcode/repo.py.
+
 For instructions to build LLDB on Linux, or more details about supported
 compiler versions, other dependencies, and build flags, see:
 

Modified: lldb/trunk/scripts/Xcode/build-llvm.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Xcode/build-llvm.py?rev=295922&r1=295921&r2=295922&view=diff
==
--- lldb/trunk/scripts/Xcode/build-llvm.py (original)
+++ lldb/trunk/scripts/Xcode/build-llvm.py Wed Feb 22 20:21:34 2017
@@ -6,6 +6,7 @@ import fnmatch
 import os
 import platform
 import re
+import repo
 import subprocess
 import sys
 
@@ -17,42 +18,36 @@ from lldbbuild import *
 def LLVM_HASH_INCLUDES_DIFFS():
 return False
 
-# The use of "x = "..."; return x" here is important because tooling looks for
-# it with regexps.  Only change how this works if you know what you are doing.
-
-
-def LLVM_REF():
-llvm_ref = "master"
-return llvm_ref
-
-
-def CLANG_REF():
-clang_ref = "master"
-return clang_ref
-
 # For use with Xcode-style builds
 
+def process_vcs(vcs):
+return {
+"svn": VCS.svn,
+"git": VCS.git
+}[vcs]
+
+def process_root(name):
+return {
+"llvm": llvm_source_path(),
+"clang": clang_source_path(),
+"ninja": ninja_source_path()
+}[name]
+
+def process_repo(r):
+return {
+'name': r["name"],
+'vcs': process_vcs(r["vcs"]),
+'root': process_root(r["name"]),
+'url': r["url"],
+'ref': r["ref"]
+}
 
 def XCODE_REPOSITORIES():
-return [
-{'name': "llvm",
- 'vcs': VCS.git,
- 'root': llvm_source_path(),
- 'url': "http://llvm.org/git/llvm.git";,
- 'ref': LLVM_REF()},
-
-{'name': "clang",
- 'vcs': VCS.git,
- 'root': clang_source_path(),
- 'url': "http://llvm.org/git/clang.git";,
- 'ref': CLANG_REF()},
-
-{'name': "ninja",
- 'vcs': VCS.git,
- 'root': ninja_source_path(),
- 'url': "https://github.com/ninja-build/ninja.git";,
- 'ref': "master"}
-]
+identifier = repo.identifier()
+if identifier == None:
+identifier = "" # repo.find will just use the fallback file
+set = repo.find(identifier)
+return [process_repo(r) for r in set]
 
 
 def get_c_compiler():

Added: lldb/trunk/scripts/Xcode/repo.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Xcode/repo.py?rev=295922&view=auto
==
--- lldb/trunk/scripts/Xcode/repo.py (added)
+++ lldb/trunk/scripts/Xcode/repo.py Wed Feb 22 20:21:34 2017
@@ -0,0 +1,42 @@
+import json
+import os
+import re
+import shutil
+import subprocess
+
+def identifier():
+   try:
+   svn_output = subprocess.check_output(["svn", "info", 
"--show-item", "url"], stderr=subprocess.STDOUT).rstrip()
+   return svn_output
+   except:
+   pass
+   try:
+   git_remote_and_branch 

Re: [Lldb-commits] [lldb] r295897 - Changed builld-llvm.py to use .json files

2017-02-22 Thread Sean Callanan via lldb-commits
I've recommitted with a bunch of fixes:

SendingINSTALL.txt
Sendingscripts/Xcode/build-llvm.py
Adding scripts/Xcode/repo.py
Adding scripts/Xcode/repos
Adding scripts/Xcode/repos/FALLBACK
Adding scripts/Xcode/repos/svn-trunk.json
Transmitting file data .done
Committing transaction...
Committed revision 295922.

Please let me know if you see any problems.

Sean

> On Feb 22, 2017, at 4:56 PM, Sean Callanan via lldb-commits 
>  wrote:
> 
> I'll roll it back pending some fixes on my end.
> Sorry for the break.
> 
> Sean
> 
>> On Feb 22, 2017, at 4:40 PM, Tim Hammerquist > > wrote:
>> 
>> Hi Sean,
>> 
>> Looks like this is breaking builds in Green Dragon (and locally for me from 
>> master branch). Can you take a look at the failures here?
>> 
>> http://lab.llvm.org:8080/green/view/LLDB/job/lldb_build_test/26076/console 
>> 
>> 
>> Thanks!
>> -Tim
>> 
>> 
>> On Wed, Feb 22, 2017 at 2:57 PM, Sean Callanan via lldb-commits 
>> mailto:lldb-commits@lists.llvm.org>> wrote:
>> Author: spyffe
>> Date: Wed Feb 22 16:57:59 2017
>> New Revision: 295897
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=295897&view=rev 
>> 
>> Log:
>> Changed builld-llvm.py to use .json files
>> 
>> LLDB has many branches in a variety of repositories.
>> The build-script.py file is subtly different for each set.
>> This is unnecessary and causes merge headaches.
>> 
>> This patch makes build-llvm.py consult a directory full
>> of .json files, each one of which matches a particular
>> branch using a regular expression.
>> 
>> Differential revision: https://reviews.llvm.org/D30275 
>> 
>> 
>> Added:
>> lldb/trunk/scripts/Xcode/repo.py
>> lldb/trunk/scripts/Xcode/repos/
>> lldb/trunk/scripts/Xcode/repos/svn-trunk.json
>> Modified:
>> lldb/trunk/scripts/Xcode/build-llvm.py
>> 
>> Modified: lldb/trunk/scripts/Xcode/build-llvm.py
>> URL: 
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Xcode/build-llvm.py?rev=295897&r1=295896&r2=295897&view=diff
>>  
>> 
>> ==
>> --- lldb/trunk/scripts/Xcode/build-llvm.py (original)
>> +++ lldb/trunk/scripts/Xcode/build-llvm.py Wed Feb 22 16:57:59 2017
>> @@ -6,6 +6,7 @@ import fnmatch
>>  import os
>>  import platform
>>  import re
>> +import repo
>>  import subprocess
>>  import sys
>> 
>> @@ -17,42 +18,38 @@ from lldbbuild import *
>>  def LLVM_HASH_INCLUDES_DIFFS():
>>  return False
>> 
>> -# The use of "x = "..."; return x" here is important because tooling looks 
>> for
>> -# it with regexps.  Only change how this works if you know what you are 
>> doing.
>> -
>> -
>> -def LLVM_REF():
>> -llvm_ref = "master"
>> -return llvm_ref
>> -
>> -
>> -def CLANG_REF():
>> -clang_ref = "master"
>> -return clang_ref
>> -
>>  # For use with Xcode-style builds
>> 
>> +def process_vcs(vcs):
>> +return {
>> +"svn": VCS.svn,
>> +"git": VCS.git
>> +}[vcs]
>> +
>> +def process_root(name):
>> +return {
>> +"llvm": llvm_source_path(),
>> +"clang": clang_source_path(),
>> +"ninja": ninja_source_path()
>> +}[name]
>> +
>> +def process_repo(r):
>> +return {
>> +'name': r["name"],
>> +'vcs': process_vcs(r["vcs"]),
>> +'root': process_root(r["name"]),
>> +'url': r["url"],
>> +'ref': r["ref"]
>> +}
>> 
>>  def XCODE_REPOSITORIES():
>> -return [
>> -{'name': "llvm",
>> - 'vcs': VCS.git,
>> - 'root': llvm_source_path(),
>> - 'url': "http://llvm.org/git/llvm.git 
>> ",
>> - 'ref': LLVM_REF()},
>> -
>> -{'name': "clang",
>> - 'vcs': VCS.git,
>> - 'root': clang_source_path(),
>> - 'url': "http://llvm.org/git/clang.git 
>> ",
>> - 'ref': CLANG_REF()},
>> -
>> -{'name': "ninja",
>> - 'vcs': VCS.git,
>> - 'root': ninja_source_path(),
>> - 'url': "https://github.com/ninja-build/ninja.git 
>> ",
>> - 'ref': "master"}
>> -]
>> +identifier = repo.identifier()
>> +if identifier == None:
>> +sys.exit("Couldn't identify the current branch")
>> +set = repo.find(identifier)
>> +if set == None:
>> +sys.exit("Couldn't find a repository set for the current branch")
>> +return [process_repo(r) for r in set]
>> 
>> 
>>  def get_c_compiler():
>> 
>> Added: lldb/trunk/scripts/Xcode/repo.py
>> URL: 
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Xcode/repo.py?rev=295897&view=auto
>>  
>> 

[Lldb-commits] [PATCH] D29669: Hardware breakpoints implementation for Arm/AArch64 targets

2017-02-22 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid added inline comments.



Comment at: 
packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py:78
+
+while count < 4 :
+ 

labath wrote:
> This is quite racy.
> 
> There is nothing that guarantees that we will stop on the breakpoint at least 
> four times. In particular, it can happen that all 8 threads hit the 
> breakpoint simultaneously, and then you have only one stop of the whole 
> process. If you want to have more than one stop you need to either:
> - make sure that no two threads can hit the breakpoint simultaneously (e.g., 
> add some kind of a mutex in the inferior),
> - or count the stops more diligently (after each stop, count the number of 
> threads stopped at the location, as in e.g. TestConcurrentEvents)
> 
> However, if the purpose of this test is to make sure the breakpoint applies 
> to newly-created threads, then I think you don't need than many threads, and 
> one thread would suffice. Then the test could be:
> - set a breakpoint
> - inferior spins up a thread and hits it
> - remove/disable the breakpoint
> - inferior joins the first thread
> - inferior spins up another thread which does *not* hit the breakpoint
> This should make debugging any failures easier as the test is more 
> deterministic.
Agreed!! I ll post an alternative then.

Thanks!


https://reviews.llvm.org/D29669



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


[Lldb-commits] [PATCH] D30286: Implement QPassSignals GDB package in lldb-server

2017-02-22 Thread Eugene Zemtsov via Phabricator via lldb-commits
eugene created this revision.
eugene added a project: LLDB.
Herald added a subscriber: emaste.

https://reviews.llvm.org/D30286

Files:
  include/lldb/Host/common/NativeProcessProtocol.h
  packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
  packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/Makefile
  
packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py
  packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/main.cpp
  source/Host/common/NativeProcessProtocol.cpp
  source/Plugins/Process/Linux/NativeProcessLinux.cpp
  source/Plugins/Process/POSIX/CrashReason.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
  source/Utility/StringExtractorGDBRemote.cpp
  source/Utility/StringExtractorGDBRemote.h

Index: source/Utility/StringExtractorGDBRemote.h
===
--- source/Utility/StringExtractorGDBRemote.h
+++ source/Utility/StringExtractorGDBRemote.h
@@ -96,6 +96,7 @@
 // debug server packages
 eServerPacketType_QEnvironmentHexEncoded,
 eServerPacketType_QListThreadsInStopReply,
+eServerPacketType_QPassSignals,
 eServerPacketType_QRestoreRegisterState,
 eServerPacketType_QSaveRegisterState,
 eServerPacketType_QSetLogging,
Index: source/Utility/StringExtractorGDBRemote.cpp
===
--- source/Utility/StringExtractorGDBRemote.cpp
+++ source/Utility/StringExtractorGDBRemote.cpp
@@ -91,6 +91,10 @@
 return eServerPacketType_QEnvironmentHexEncoded;
   break;
 
+case 'P':
+  if (PACKET_STARTS_WITH("QPassSignals:"))
+return eServerPacketType_QPassSignals;
+
 case 'S':
   if (PACKET_MATCHES("QStartNoAckMode"))
 return eServerPacketType_QStartNoAckMode;
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
@@ -203,6 +203,8 @@
 
   PacketResult Handle_qFileLoadAddress(StringExtractorGDBRemote &packet);
 
+  PacketResult Handle_QPassSignals(StringExtractorGDBRemote &packet);
+
   void SetCurrentThreadID(lldb::tid_t tid);
 
   lldb::tid_t GetCurrentThreadID() const;
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -181,6 +181,9 @@
 &GDBRemoteCommunicationServerLLGS::Handle_Z);
   RegisterMemberFunctionHandler(StringExtractorGDBRemote::eServerPacketType_z,
 &GDBRemoteCommunicationServerLLGS::Handle_z);
+  RegisterMemberFunctionHandler(
+  StringExtractorGDBRemote::eServerPacketType_QPassSignals,
+  &GDBRemoteCommunicationServerLLGS::Handle_QPassSignals);
 
   RegisterPacketHandler(StringExtractorGDBRemote::eServerPacketType_k,
 [this](StringExtractorGDBRemote packet, Error &error,
@@ -3072,6 +3075,43 @@
   return SendPacketNoLock(response.GetString());
 }
 
+GDBRemoteCommunication::PacketResult
+GDBRemoteCommunicationServerLLGS::Handle_QPassSignals(
+StringExtractorGDBRemote &packet) {
+  std::vector signals;
+  packet.SetFilePos(strlen("QPassSignals:"));
+
+  // Read sequence of hex signal numbers divided by a semicolon and
+  // optionally spaces.
+  while (packet.GetBytesLeft() > 0) {
+int signal = packet.GetS32(-1, 16);
+if (signal < 0) {
+  return SendIllFormedResponse(packet, "Failed to parse signal number.");
+}
+signals.push_back(signal);
+
+packet.SkipSpaces();
+char separator = packet.GetChar();
+if (separator == '\0') {
+  break; // End of string
+}
+if (separator != ';') {
+  return SendIllFormedResponse(packet, "Invalid separator,"
+" expected semicolon.");
+}
+  }
+
+  // Fail if we don't have a current process.
+  if (!m_debugged_process_sp)
+return SendErrorResponse(68);
+
+  Error error = m_debugged_process_sp->IgnoreSignals(signals);
+  if (error.Fail())
+return SendErrorResponse(69);
+
+  return SendOKResponse();
+}
+
 void GDBRemoteCommunicationServerLLGS::MaybeCloseInferiorTerminalConnection() {
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS));
 
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
+++ so