[Lldb-commits] [lldb] r285885 - Test for YMMRegisters.

2016-11-03 Thread Ravitheja Addepally via lldb-commits
Author: ravitheja
Date: Thu Nov  3 03:35:55 2016
New Revision: 285885

URL: http://llvm.org/viewvc/llvm-project?rev=285885&view=rev
Log:
Test for YMMRegisters.

Summary:
This patch contains test for reading YMM Registers. The test basically
contains an inferior that loads the ymm registers with a bit pattern
and the python test executes register read to check if the bit pattern
is correctly written in the registers. This test is repeated twice for
each register with a different pattern for better sanity.

Reviewers: tberghammer, zturner, clayborg

Subscribers: tberghammer, danalbert, srhines

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

Added:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_avx/

lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_avx/Makefile

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

lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_avx/main.c

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_avx/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_avx/Makefile?rev=285885&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_avx/Makefile
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_avx/Makefile
 Thu Nov  3 03:35:55 2016
@@ -0,0 +1,7 @@
+LEVEL = ../../../make
+
+C_SOURCES := main.c
+
+CFLAGS_EXTRAS ?= -g -O1
+
+include $(LEVEL)/Makefile.rules

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestYMMRegister.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestYMMRegister.py?rev=285885&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestYMMRegister.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestYMMRegister.py
 Thu Nov  3 03:35:55 2016
@@ -0,0 +1,75 @@
+"""
+Test that we correctly read the YMM registers.
+"""
+
+from __future__ import print_function
+
+
+import os
+import time
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestYMMRegister(TestBase):
+mydir = TestBase.compute_mydir(__file__)
+
+@skipIfFreeBSD
+@skipIfiOSSimulator
+@skipIfTargetAndroid()
+@skipIf(archs=no_match(['i386', 'x86_64']))
+def test(self):
+self.build()
+self.setTearDownCleanup()
+
+exe = os.path.join(os.getcwd(), "a.out")
+target = self.dbg.CreateTarget(exe)
+
+self.assertTrue(target, VALID_TARGET)
+
+byte_pattern1 = 0x80
+byte_pattern2 = 0xFF
+
+# Launch the process and stop.
+self.expect("run", PROCESS_STOPPED, substrs=['stopped'])
+
+# Check stop reason; Should be either signal SIGTRAP or EXC_BREAKPOINT
+output = self.res.GetOutput()
+matched = False
+substrs = [
+'stop reason = EXC_BREAKPOINT',
+'stop reason = signal SIGTRAP']
+for str1 in substrs:
+matched = output.find(str1) != -1
+with recording(self, False) as sbuf:
+print("%s sub string: %s" % ('Expecting', str1), file=sbuf)
+print("Matched" if matched else "Not Matched", file=sbuf)
+if matched:
+break
+self.assertTrue(matched, STOPPED_DUE_TO_SIGNAL)
+
+if self.getArchitecture() == 'x86_64':
+register_range = 16
+else:
+register_range = 8
+for i in range(register_range):
+self.runCmd("thread step-inst")
+
+register_byte = (byte_pattern1 | i)
+pattern = "ymm" + str(i) + " = " + str('{') + (
+str(hex(register_byte)) + ' ') * 31 + str(hex(register_byte)) 
+ str('}')
+
+self.expect(
+"register read ymm" + str(i),
+substrs=[pattern])
+
+register_byte = (byte_pattern2 | i)
+pattern = "ymm" + str(i) + " = " + str('{') + (
+str(hex(register_byte)) + ' ') * 31 + str(hex(register_byte)) 
+ str('}')
+
+self.runCmd("thread step-inst")
+self.expect(
+"register read ymm" + str(i),
+substrs=[pattern])

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_avx/main.c
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_avx/main.c?rev=285885&view=auto
==
---

[Lldb-commits] [lldb] r285890 - Refactor Timer class

2016-11-03 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu Nov  3 04:14:09 2016
New Revision: 285890

URL: http://llvm.org/viewvc/llvm-project?rev=285890&view=rev
Log:
Refactor Timer class

Summary:
While removing TimeValue from this class I noticed a lot of room for small
simplifications here. Main are:
  - instead of complicated start-stop dances to compute own time, each Timer
just starts the timer once, and keeps track of the durations of child
timers. Then the own time can be computed at the end by subtracting the two
values.
  - remove double accounting in TimerStack - the stack object already knows the
number of timers.
The interface does not lend itself well to unit testing, but I have added a
couple of tests which can (and did) catch any obvious errors.

Reviewers: tberghammer, clayborg

Subscribers: mgorny, lldb-commits

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

Added:
lldb/trunk/unittests/Core/TimerTest.cpp
Modified:
lldb/trunk/include/lldb/Core/Timer.h
lldb/trunk/source/Core/Timer.cpp
lldb/trunk/unittests/Core/CMakeLists.txt

Modified: lldb/trunk/include/lldb/Core/Timer.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Timer.h?rev=285890&r1=285889&r2=285890&view=diff
==
--- lldb/trunk/include/lldb/Core/Timer.h (original)
+++ lldb/trunk/include/lldb/Core/Timer.h Thu Nov  3 04:14:09 2016
@@ -20,8 +20,8 @@
 
 // Other libraries and framework includes
 // Project includes
-#include "lldb/Host/TimeValue.h"
 #include "lldb/lldb-private.h"
+#include "llvm/Support/Chrono.h"
 
 namespace lldb_private {
 
@@ -61,27 +61,17 @@ public:
   static void ResetCategoryTimes();
 
 protected:
-  void ChildStarted(const TimeValue &time);
-
-  void ChildStopped(const TimeValue &time);
-
-  uint64_t GetTotalElapsedNanoSeconds();
-
-  uint64_t GetTimerElapsedNanoSeconds();
+  using TimePoint = std::chrono::steady_clock::time_point;
+  void ChildDuration(TimePoint::duration dur) { m_child_duration += dur; }
 
   const char *m_category;
-  TimeValue m_total_start;
-  TimeValue m_timer_start;
-  uint64_t m_total_ticks; // Total running time for this timer including when
-  // other timers below this are running
-  uint64_t m_timer_ticks; // Ticks for this timer that do not include when 
other
-  // timers below this one are running
+  TimePoint m_total_start;
+  TimePoint::duration m_child_duration{0};
 
   static std::atomic g_quiet;
   static std::atomic g_display_depth;
 
 private:
-  Timer();
   DISALLOW_COPY_AND_ASSIGN(Timer);
 };
 

Modified: lldb/trunk/source/Core/Timer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Timer.cpp?rev=285890&r1=285889&r2=285890&view=diff
==
--- lldb/trunk/source/Core/Timer.cpp (original)
+++ lldb/trunk/source/Core/Timer.cpp Thu Nov  3 04:14:09 2016
@@ -23,26 +23,14 @@ using namespace lldb_private;
 #define TIMER_INDENT_AMOUNT 2
 
 namespace {
-typedef std::map TimerCategoryMap;
-
-struct TimerStack {
-  TimerStack() : m_depth(0) {}
-
-  uint32_t m_depth;
-  std::vector m_stack;
-};
+typedef std::map TimerCategoryMap;
+typedef std::vector TimerStack;
 } // end of anonymous namespace
 
 std::atomic Timer::g_quiet(true);
 std::atomic Timer::g_display_depth(0);
 static std::mutex &GetFileMutex() {
-  static std::mutex *g_file_mutex_ptr = nullptr;
-  static std::once_flag g_once_flag;
-  std::call_once(g_once_flag, []() {
-// leaked on purpose to ensure this mutex works after main thread has run
-// global C++ destructor chain
-g_file_mutex_ptr = new std::mutex();
-  });
+  static std::mutex *g_file_mutex_ptr = new std::mutex();
   return *g_file_mutex_ptr;
 }
 
@@ -75,111 +63,58 @@ static TimerStack *GetTimerStackForCurre
 void Timer::SetQuiet(bool value) { g_quiet = value; }
 
 Timer::Timer(const char *category, const char *format, ...)
-: m_category(category), m_total_start(), m_timer_start(), m_total_ticks(0),
-  m_timer_ticks(0) {
+: m_category(category), m_total_start(std::chrono::steady_clock::now()) {
   TimerStack *stack = GetTimerStackForCurrentThread();
   if (!stack)
 return;
 
-  if (stack->m_depth++ < g_display_depth) {
-if (g_quiet == false) {
-  std::lock_guard lock(GetFileMutex());
-
-  // Indent
-  ::fprintf(stdout, "%*s", stack->m_depth * TIMER_INDENT_AMOUNT, "");
-  // Print formatted string
-  va_list args;
-  va_start(args, format);
-  ::vfprintf(stdout, format, args);
-  va_end(args);
-
-  // Newline
-  ::fprintf(stdout, "\n");
-}
-TimeValue start_time(TimeValue::Now());
-m_total_start = start_time;
-m_timer_start = start_time;
-
-if (!stack->m_stack.empty())
-  stack->m_stack.back()->ChildStarted(start_time);
-stack->m_stack.push_back(this);
+  stack->push_back(this);
+  if (g_quiet && stack->size() <= g_display_dept

[Lldb-commits] [PATCH] D26243: Refactor Timer class

2016-11-03 Thread Pavel Labath via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL285890: Refactor Timer class (authored by labath).

Changed prior to commit:
  https://reviews.llvm.org/D26243?vs=76701&id=76822#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D26243

Files:
  lldb/trunk/include/lldb/Core/Timer.h
  lldb/trunk/source/Core/Timer.cpp
  lldb/trunk/unittests/Core/CMakeLists.txt
  lldb/trunk/unittests/Core/TimerTest.cpp

Index: lldb/trunk/unittests/Core/TimerTest.cpp
===
--- lldb/trunk/unittests/Core/TimerTest.cpp
+++ lldb/trunk/unittests/Core/TimerTest.cpp
@@ -0,0 +1,75 @@
+//===-- TimerTest.cpp ---*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#if defined(_MSC_VER) && (_HAS_EXCEPTIONS == 0)
+// Workaround for MSVC standard library bug, which fails to include 
+// when exceptions are disabled.
+#include 
+#endif
+
+#include "lldb/Core/Timer.h"
+#include "gtest/gtest.h"
+
+#include "lldb/Core/StreamString.h"
+#include 
+
+using namespace lldb_private;
+
+TEST(TimerTest, CategoryTimes) {
+  Timer::ResetCategoryTimes();
+  {
+Timer t("CAT1", "");
+std::this_thread::sleep_for(std::chrono::milliseconds(10));
+  }
+  StreamString ss;
+  Timer::DumpCategoryTimes(&ss);
+  double seconds;
+  ASSERT_EQ(1, sscanf(ss.GetData(), "%lf sec for CAT1", &seconds));
+  EXPECT_LT(0.001, seconds);
+  EXPECT_GT(0.1, seconds);
+}
+
+TEST(TimerTest, CategoryTimesNested) {
+  Timer::ResetCategoryTimes();
+  {
+Timer t1("CAT1", "");
+std::this_thread::sleep_for(std::chrono::milliseconds(10));
+{
+  Timer t2("CAT1", "");
+  std::this_thread::sleep_for(std::chrono::milliseconds(10));
+}
+  }
+  StreamString ss;
+  Timer::DumpCategoryTimes(&ss);
+  double seconds;
+  ASSERT_EQ(1, sscanf(ss.GetData(), "%lf sec for CAT1", &seconds));
+  EXPECT_LT(0.002, seconds);
+  EXPECT_GT(0.2, seconds);
+}
+
+TEST(TimerTest, CategoryTimes2) {
+  Timer::ResetCategoryTimes();
+  {
+Timer t1("CAT1", "");
+std::this_thread::sleep_for(std::chrono::milliseconds(10));
+{
+  Timer t2("CAT2", "");
+  std::this_thread::sleep_for(std::chrono::milliseconds(10));
+}
+  }
+  StreamString ss;
+  Timer::DumpCategoryTimes(&ss);
+  double seconds1, seconds2;
+  ASSERT_EQ(2, sscanf(ss.GetData(), "%lf sec for CAT1%*[\n ]%lf sec for CAT2",
+  &seconds1, &seconds2));
+  EXPECT_LT(0.001, seconds1);
+  EXPECT_GT(0.1, seconds1);
+  EXPECT_LT(0.001, seconds2);
+  EXPECT_GT(0.1, seconds2);
+}
Index: lldb/trunk/unittests/Core/CMakeLists.txt
===
--- lldb/trunk/unittests/Core/CMakeLists.txt
+++ lldb/trunk/unittests/Core/CMakeLists.txt
@@ -4,4 +4,5 @@
   DataExtractorTest.cpp
   ScalarTest.cpp
   StructuredDataTest.cpp
+  TimerTest.cpp
   )
Index: lldb/trunk/source/Core/Timer.cpp
===
--- lldb/trunk/source/Core/Timer.cpp
+++ lldb/trunk/source/Core/Timer.cpp
@@ -23,26 +23,14 @@
 #define TIMER_INDENT_AMOUNT 2
 
 namespace {
-typedef std::map TimerCategoryMap;
-
-struct TimerStack {
-  TimerStack() : m_depth(0) {}
-
-  uint32_t m_depth;
-  std::vector m_stack;
-};
+typedef std::map TimerCategoryMap;
+typedef std::vector TimerStack;
 } // end of anonymous namespace
 
 std::atomic Timer::g_quiet(true);
 std::atomic Timer::g_display_depth(0);
 static std::mutex &GetFileMutex() {
-  static std::mutex *g_file_mutex_ptr = nullptr;
-  static std::once_flag g_once_flag;
-  std::call_once(g_once_flag, []() {
-// leaked on purpose to ensure this mutex works after main thread has run
-// global C++ destructor chain
-g_file_mutex_ptr = new std::mutex();
-  });
+  static std::mutex *g_file_mutex_ptr = new std::mutex();
   return *g_file_mutex_ptr;
 }
 
@@ -75,111 +63,58 @@
 void Timer::SetQuiet(bool value) { g_quiet = value; }
 
 Timer::Timer(const char *category, const char *format, ...)
-: m_category(category), m_total_start(), m_timer_start(), m_total_ticks(0),
-  m_timer_ticks(0) {
+: m_category(category), m_total_start(std::chrono::steady_clock::now()) {
   TimerStack *stack = GetTimerStackForCurrentThread();
   if (!stack)
 return;
 
-  if (stack->m_depth++ < g_display_depth) {
-if (g_quiet == false) {
-  std::lock_guard lock(GetFileMutex());
-
-  // Indent
-  ::fprintf(stdout, "%*s", stack->m_depth * TIMER_INDENT_AMOUNT, "");
-  // Print formatted string
-  va_list args;
-  va_start(args, format);
-  ::vfprintf(stdout, format, args);
-  va_end(args);
-
-  // Newline
-  ::fprintf(stdout, "\n");
-}
-TimeValue start_time(TimeValue::Now());
-m_total

[Lldb-commits] [lldb] r285891 - Remove TimeSpecTimeout class

2016-11-03 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu Nov  3 04:29:56 2016
New Revision: 285891

URL: http://llvm.org/viewvc/llvm-project?rev=285891&view=rev
Log:
Remove TimeSpecTimeout class

the class is unused.

Removed:
lldb/trunk/source/Utility/TimeSpecTimeout.cpp
lldb/trunk/source/Utility/TimeSpecTimeout.h
Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/source/Utility/CMakeLists.txt

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=285891&r1=285890&r2=285891&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Nov  3 04:29:56 2016
@@ -633,7 +633,6 @@
26CEB5F218762056008F575A /* CommandObjectGUI.cpp in Sources */ 
= {isa = PBXBuildFile; fileRef = 26CEB5F018762056008F575A /* 
CommandObjectGUI.cpp */; };
26CFDCA3186163A4000E63E5 /* Editline.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 26CFDCA2186163A4000E63E5 /* Editline.cpp */; };
26CFDCA818616473000E63E5 /* libedit.dylib in Frameworks */ = 
{isa = PBXBuildFile; fileRef = 26F5C32A10F3DFDD009D5894 /* libedit.dylib */; };
-   26D1804216CEDF0700EDFB5B /* TimeSpecTimeout.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 26D1804016CEDF0700EDFB5B /* TimeSpecTimeout.cpp 
*/; };
26D265BC136B4269002EEE45 /* lldb-public.h in Headers */ = {isa 
= PBXBuildFile; fileRef = 26651A14133BEC76005B64B7 /* lldb-public.h */; 
settings = {ATTRIBUTES = (Public, ); }; };
26D52C1F1A980FE300E5D2FB /* MICmdCmdSymbol.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 26D52C1D1A980FE300E5D2FB /* MICmdCmdSymbol.cpp 
*/; };
26D55235159A7DB100708D8D /* libxml2.dylib in Frameworks */ = 
{isa = PBXBuildFile; fileRef = 26D55234159A7DB100708D8D /* libxml2.dylib */; };
@@ -2252,8 +2251,6 @@
26D0DD5310FE555900271C65 /* BreakpointResolverAddress.cpp */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.cpp.cpp; name = BreakpointResolverAddress.cpp; path = 
source/Breakpoint/BreakpointResolverAddress.cpp; sourceTree = ""; };
26D0DD5410FE555900271C65 /* BreakpointResolverFileLine.cpp */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.cpp.cpp; name = BreakpointResolverFileLine.cpp; path = 
source/Breakpoint/BreakpointResolverFileLine.cpp; sourceTree = ""; };
26D0DD5510FE555900271C65 /* BreakpointResolverName.cpp */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.cpp.cpp; name = BreakpointResolverName.cpp; path = 
source/Breakpoint/BreakpointResolverName.cpp; sourceTree = ""; };
-   26D1804016CEDF0700EDFB5B /* TimeSpecTimeout.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = TimeSpecTimeout.cpp; path = source/Utility/TimeSpecTimeout.cpp; 
sourceTree = ""; };
-   26D1804616CEE12C00EDFB5B /* TimeSpecTimeout.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
TimeSpecTimeout.h; path = source/Utility/TimeSpecTimeout.h; sourceTree = 
""; };
26D27C9D11ED3A4E0024D721 /* ELFHeader.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = ELFHeader.cpp; sourceTree = ""; };
26D27C9E11ED3A4E0024D721 /* ELFHeader.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
ELFHeader.h; sourceTree = ""; };
26D52C1D1A980FE300E5D2FB /* MICmdCmdSymbol.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = MICmdCmdSymbol.cpp; path = "tools/lldb-mi/MICmdCmdSymbol.cpp"; 
sourceTree = SOURCE_ROOT; };
@@ -4242,8 +4239,6 @@
2676A093119C93C8008A98EF /* 
StringExtractorGDBRemote.cpp */,
94380B8019940B0300BFE4A8 /* StringLexer.h */,
94380B8119940B0A00BFE4A8 /* StringLexer.cpp */,
-   26D1804616CEE12C00EDFB5B /* TimeSpecTimeout.h 
*/,
-   26D1804016CEDF0700EDFB5B /* TimeSpecTimeout.cpp 
*/,
94BA8B6E176F8CA0005A91B5 /* Range.h */,
94BA8B6C176F8C9B005A91B5 /* Range.cpp */,
AF1FA8891A60A69500272AFC /* RegisterNumber.cpp 
*/,
@@ -7048,7 +7043,6 @@
buildActionMask = 2147483647;
files = (
33E5E8471A674FB60024ED68 /* StringConvert.cpp 
in Sources */,
-   26D1804216CEDF0700EDFB5B /* TimeSpecTimeout.cpp 
in Sources */,
2689FFDA13353D9D00698AC0 /* lldb.cpp in Sources 
*/,
  

[Lldb-commits] [lldb] r285892 - Fix Timer unit test

2016-11-03 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu Nov  3 05:07:47 2016
New Revision: 285892

URL: http://llvm.org/viewvc/llvm-project?rev=285892&view=rev
Log:
Fix Timer unit test

I did not take into account that the output of the Dump function will be
non-deterministic. Fix that by increasing of the times, this also makes the test
check that the dump function sorts the output.

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

Modified: lldb/trunk/unittests/Core/TimerTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Core/TimerTest.cpp?rev=285892&r1=285891&r2=285892&view=diff
==
--- lldb/trunk/unittests/Core/TimerTest.cpp (original)
+++ lldb/trunk/unittests/Core/TimerTest.cpp Thu Nov  3 05:07:47 2016
@@ -40,10 +40,8 @@ TEST(TimerTest, CategoryTimesNested) {
   {
 Timer t1("CAT1", "");
 std::this_thread::sleep_for(std::chrono::milliseconds(10));
-{
-  Timer t2("CAT1", "");
-  std::this_thread::sleep_for(std::chrono::milliseconds(10));
-}
+Timer t2("CAT1", "");
+std::this_thread::sleep_for(std::chrono::milliseconds(10));
   }
   StreamString ss;
   Timer::DumpCategoryTimes(&ss);
@@ -57,19 +55,18 @@ TEST(TimerTest, CategoryTimes2) {
   Timer::ResetCategoryTimes();
   {
 Timer t1("CAT1", "");
+std::this_thread::sleep_for(std::chrono::milliseconds(100));
+Timer t2("CAT2", "");
 std::this_thread::sleep_for(std::chrono::milliseconds(10));
-{
-  Timer t2("CAT2", "");
-  std::this_thread::sleep_for(std::chrono::milliseconds(10));
-}
   }
   StreamString ss;
   Timer::DumpCategoryTimes(&ss);
   double seconds1, seconds2;
   ASSERT_EQ(2, sscanf(ss.GetData(), "%lf sec for CAT1%*[\n ]%lf sec for CAT2",
-  &seconds1, &seconds2));
-  EXPECT_LT(0.001, seconds1);
-  EXPECT_GT(0.1, seconds1);
+  &seconds1, &seconds2))
+  << "String: " << ss.GetString();
+  EXPECT_LT(0.01, seconds1);
+  EXPECT_GT(1, seconds1);
   EXPECT_LT(0.001, seconds2);
   EXPECT_GT(0.1, seconds2);
 }


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


[Lldb-commits] [PATCH] D26275: Remove TimeValue usage from Core/Module

2016-11-03 Thread Pavel Labath via lldb-commits
labath created this revision.
labath added a reviewer: clayborg.
labath added a subscriber: lldb-commits.

The only interesting part here is that TimePoint and TimeValue have different
natural string representations, which affects "target modules list" output. It
is now "2016-07-09 04:02:21.0", whereas previously in was
"Sat Jul  9 04:02:21 2016". I wanted to check if we're OK with that.


https://reviews.llvm.org/D26275

Files:
  include/lldb/Core/Module.h
  include/lldb/Host/TimeValue.h
  source/Commands/CommandObjectTarget.cpp
  source/Core/Module.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h

Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
@@ -14,8 +14,8 @@
 #include 
 
 #include "lldb/Core/RangeMap.h"
-#include "lldb/Host/TimeValue.h"
 #include "lldb/Symbol/SymbolFile.h"
+#include "llvm/Support/Chrono.h"
 
 #include "UniqueDWARFASTType.h"
 
@@ -155,7 +155,7 @@
   struct CompileUnitInfo {
 lldb_private::FileSpec so_file;
 lldb_private::ConstString oso_path;
-lldb_private::TimeValue oso_mod_time;
+llvm::sys::TimePoint<> oso_mod_time;
 OSOInfoSP oso_sp;
 lldb::CompUnitSP compile_unit_sp;
 uint32_t first_symbol_index;
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -35,6 +35,7 @@
 #include "lldb/Symbol/SymbolVendor.h"
 #include "lldb/Symbol/TypeMap.h"
 #include "lldb/Symbol/VariableList.h"
+#include "llvm/Support/ScopedPrinter.h"
 
 #include "LogChannelDWARF.h"
 #include "SymbolFileDWARF.h"
@@ -175,9 +176,8 @@
   DebugMapModule(const ModuleSP &exe_module_sp, uint32_t cu_idx,
  const FileSpec &file_spec, const ArchSpec &arch,
  const ConstString *object_name, off_t object_offset,
- const TimeValue *object_mod_time_ptr)
-  : Module(file_spec, arch, object_name, object_offset,
-   object_mod_time_ptr),
+ const llvm::sys::TimePoint<> object_mod_time)
+  : Module(file_spec, arch, object_name, object_offset, object_mod_time),
 m_exe_module_wp(exe_module_sp), m_cu_idx(cu_idx) {}
 
   ~DebugMapModule() override = default;
@@ -355,9 +355,8 @@
   m_compile_unit_infos[i].so_file.SetFile(
   so_symbol->GetName().AsCString(), false);
   m_compile_unit_infos[i].oso_path = oso_symbol->GetName();
-  TimeValue oso_mod_time;
-  oso_mod_time.OffsetWithSeconds(oso_symbol->GetIntegerValue(0));
-  m_compile_unit_infos[i].oso_mod_time = oso_mod_time;
+  m_compile_unit_infos[i].oso_mod_time =
+  llvm::sys::toTimePoint(oso_symbol->GetIntegerValue(0));
   uint32_t sibling_idx = so_symbol->GetSiblingIndex();
   // The sibling index can't be less that or equal to the current index
   // "i"
@@ -425,15 +424,14 @@
   FileSpec oso_file(oso_path, false);
   ConstString oso_object;
   if (oso_file.Exists()) {
-TimeValue oso_mod_time(FileSystem::GetModificationTime(oso_file));
+auto oso_mod_time = FileSystem::GetModificationTime(oso_file);
 if (oso_mod_time != comp_unit_info->oso_mod_time) {
   obj_file->GetModule()->ReportError(
   "debug map object file '%s' has changed (actual time is "
-  "0x%" PRIx64 ", debug map time is 0x%" PRIx64
+  "%s, debug map time is %s"
   ") since this executable was linked, file will be ignored",
-  oso_file.GetPath().c_str(),
-  oso_mod_time.GetAsSecondsSinceJan1_1970(),
-  comp_unit_info->oso_mod_time.GetAsSecondsSinceJan1_1970());
+  oso_file.GetPath().c_str(), llvm::to_string(oso_mod_time).c_str(),
+  llvm::to_string(comp_unit_info->oso_mod_time).c_str());
   return NULL;
 }
 
@@ -464,7 +462,8 @@
   comp_unit_info->oso_sp->module_sp.reset(new DebugMapModule(
   obj_file->GetModule(), GetCompUnitInfoIndex(comp_unit_info), oso_file,
   oso_arch, oso_object ? &oso_object : NULL, 0,
-  oso_object ? &comp_unit_info->oso_mod_time : NULL));
+  oso_object ? comp_unit_info->oso_mod_time
+ : llvm::sys::TimePoint<>()));
 }
   }
   if (comp_unit_info->oso_sp)
Index: source/Core/Module.cpp
===
--- source/Core/Module.cpp
+++ source/Core/Module.cpp
@@ -229,10 +229,11 @@
 
 Module::Module(const FileSpec &file_spec, const ArchSpec &arch,
const ConstString *object_name, lldb::offset_t object_offset,
-

[Lldb-commits] [lldb] r285894 - Link lldb-mi only to the llvm components it uses

2016-11-03 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu Nov  3 05:52:17 2016
New Revision: 285894

URL: http://llvm.org/viewvc/llvm-project?rev=285894&view=rev
Log:
Link lldb-mi only to the llvm components it uses

Summary:
liblldb does not re-export the llvm library contained within, so lldb-mi needs 
to
manage its own dependencies. Right now it only uses the llvm support library.

Reviewers: beanz, zturner, tfiala, clayborg, abidh

Subscribers: ki.stfu, mgorny, lldb-commits

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

Modified:
lldb/trunk/tools/lldb-mi/CMakeLists.txt

Modified: lldb/trunk/tools/lldb-mi/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/CMakeLists.txt?rev=285894&r1=285893&r2=285894&view=diff
==
--- lldb/trunk/tools/lldb-mi/CMakeLists.txt (original)
+++ lldb/trunk/tools/lldb-mi/CMakeLists.txt Thu Nov  3 05:52:17 2016
@@ -1,5 +1,3 @@
-include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake)
-
 set(LLDB_MI_SOURCES
   MICmdArgContext.cpp
   MICmdArgSet.cpp
@@ -83,6 +81,9 @@ if ( CMAKE_SYSTEM_NAME MATCHES "Windows"
 )
 endif ()
 
+# We need to include the llvm components we depend on manually, as liblldb does
+# not re-export those.
+set(LLVM_LINK_COMPONENTS Support)
 add_lldb_executable(lldb-mi ${LLDB_MI_SOURCES})
 
 target_link_libraries(lldb-mi liblldb)
@@ -90,8 +91,6 @@ if ( NOT CMAKE_SYSTEM_NAME MATCHES "Wind
   target_link_libraries(lldb-mi pthread)
 endif ()
 
-llvm_config(lldb-mi ${LLVM_LINK_COMPONENTS})
-
 set_target_properties(lldb-mi PROPERTIES VERSION ${LLDB_VERSION})
 
 install(TARGETS lldb-mi


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


[Lldb-commits] [PATCH] D26190: [RFC] Solve linking inconsistency, proposal two

2016-11-03 Thread Pavel Labath via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL285894: Link lldb-mi only to the llvm components it uses 
(authored by labath).

Changed prior to commit:
  https://reviews.llvm.org/D26190?vs=76554&id=76833#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D26190

Files:
  lldb/trunk/tools/lldb-mi/CMakeLists.txt


Index: lldb/trunk/tools/lldb-mi/CMakeLists.txt
===
--- lldb/trunk/tools/lldb-mi/CMakeLists.txt
+++ lldb/trunk/tools/lldb-mi/CMakeLists.txt
@@ -1,5 +1,3 @@
-include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake)
-
 set(LLDB_MI_SOURCES
   MICmdArgContext.cpp
   MICmdArgSet.cpp
@@ -83,15 +81,16 @@
 )
 endif ()
 
+# We need to include the llvm components we depend on manually, as liblldb does
+# not re-export those.
+set(LLVM_LINK_COMPONENTS Support)
 add_lldb_executable(lldb-mi ${LLDB_MI_SOURCES})
 
 target_link_libraries(lldb-mi liblldb)
 if ( NOT CMAKE_SYSTEM_NAME MATCHES "Windows" )
   target_link_libraries(lldb-mi pthread)
 endif ()
 
-llvm_config(lldb-mi ${LLVM_LINK_COMPONENTS})
-
 set_target_properties(lldb-mi PROPERTIES VERSION ${LLDB_VERSION})
 
 install(TARGETS lldb-mi


Index: lldb/trunk/tools/lldb-mi/CMakeLists.txt
===
--- lldb/trunk/tools/lldb-mi/CMakeLists.txt
+++ lldb/trunk/tools/lldb-mi/CMakeLists.txt
@@ -1,5 +1,3 @@
-include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake)
-
 set(LLDB_MI_SOURCES
   MICmdArgContext.cpp
   MICmdArgSet.cpp
@@ -83,15 +81,16 @@
 )
 endif ()
 
+# We need to include the llvm components we depend on manually, as liblldb does
+# not re-export those.
+set(LLVM_LINK_COMPONENTS Support)
 add_lldb_executable(lldb-mi ${LLDB_MI_SOURCES})
 
 target_link_libraries(lldb-mi liblldb)
 if ( NOT CMAKE_SYSTEM_NAME MATCHES "Windows" )
   target_link_libraries(lldb-mi pthread)
 endif ()
 
-llvm_config(lldb-mi ${LLVM_LINK_COMPONENTS})
-
 set_target_properties(lldb-mi PROPERTIES VERSION ${LLDB_VERSION})
 
 install(TARGETS lldb-mi
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r285902 - [Renderscript] Add commands for scriptgroup interaction.

2016-11-03 Thread Aidan Dodds via lldb-commits
Author: aidandodds
Date: Thu Nov  3 08:20:37 2016
New Revision: 285902

URL: http://llvm.org/viewvc/llvm-project?rev=285902&view=rev
Log:
[Renderscript] Add commands for scriptgroup interaction.

This commit hooks the nofity function that signals script group
compilation.  By tracking scriptgroups compiled at runtine, users
are able to place breakpoints by script group name.  Breakpoints
will be placed on the kernels forming the group.


Added:

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

lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptScriptGroup.h
Modified:

lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/CMakeLists.txt

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

lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h

Modified: 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/CMakeLists.txt?rev=285902&r1=285901&r2=285902&view=diff
==
--- 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/CMakeLists.txt
 (original)
+++ 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/CMakeLists.txt
 Thu Nov  3 08:20:37 2016
@@ -2,6 +2,7 @@ add_lldb_library(lldbPluginRenderScriptR
   RenderScriptRuntime.cpp
   RenderScriptExpressionOpts.cpp
   RenderScriptx86ABIFixups.cpp
+  RenderScriptScriptGroup.cpp
   )
 
 if(NOT LLDB_BUILT_STANDALONE)

Modified: 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp?rev=285902&r1=285901&r2=285902&view=diff
==
--- 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
 Thu Nov  3 08:20:37 2016
@@ -14,6 +14,7 @@
 
 // Project includes
 #include "RenderScriptRuntime.h"
+#include "RenderScriptScriptGroup.h"
 
 #include "lldb/Breakpoint/StoppointCallbackContext.h"
 #include "lldb/Core/ConstString.h"
@@ -31,11 +32,13 @@
 #include "lldb/Interpreter/CommandObjectMultiword.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
 #include "lldb/Interpreter/Options.h"
+#include "lldb/Symbol/Function.h"
 #include "lldb/Symbol/Symbol.h"
 #include "lldb/Symbol/Type.h"
 #include "lldb/Symbol/VariableList.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/RegisterContext.h"
+#include "lldb/Target/SectionLoadList.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Target/Thread.h"
 
@@ -475,6 +478,26 @@ bool ParseCoordinate(llvm::StringRef coo
   return get_index(0, coord.x) && get_index(1, coord.y) &&
  get_index(2, coord.z);
 }
+
+bool SkipPrologue(lldb::ModuleSP &module, Address &addr) {
+  Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE));
+  SymbolContext sc;
+  uint32_t resolved_flags =
+  module->ResolveSymbolContextForAddress(addr, eSymbolContextFunction, sc);
+  if (resolved_flags & eSymbolContextFunction) {
+if (sc.function) {
+  const uint32_t offset = sc.function->GetPrologueByteSize();
+  ConstString name = sc.GetFunctionName();
+  if (offset)
+addr.Slide(offset);
+  if (log)
+log->Printf("%s: Prologue offset for %s is %" PRIu32, __FUNCTION__,
+name.AsCString(), offset);
+}
+return true;
+  } else
+return false;
+}
 } // anonymous namespace
 
 // The ScriptDetails class collects data associated with a single script
@@ -872,6 +895,80 @@ RSReduceBreakpointResolver::SearchCallba
   return eCallbackReturnContinue;
 }
 
+Searcher::CallbackReturn RSScriptGroupBreakpointResolver::SearchCallback(
+SearchFilter &filter, SymbolContext &context, Address *addr,
+bool containing) {
+
+  if (!m_breakpoint)
+return eCallbackReturnContinue;
+
+  Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
+  ModuleSP &module = context.module_sp;
+
+  if (!module || !IsRenderScriptScriptModule(module))
+return Searcher::eCallbackReturnContinue;
+
+  std::vector names;
+  m_breakpoint->GetNames(names);
+  if (names.empty())
+return eCallbackReturnContinue;
+
+  for (auto &name : names) {
+const RSScriptGroupDescriptorSP sg = FindScriptGroup(ConstString(name));
+if (!sg) {
+  if (log)
+log->Printf("%s: could not find script group for %s", __FUNCTION__,
+name.c_str());
+  continue;
+}
+
+if (log)
+  log->

[Lldb-commits] [lldb] r285941 - Add support to the ObjC type scavenger for finding types via debug info

2016-11-03 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Thu Nov  3 12:25:27 2016
New Revision: 285941

URL: http://llvm.org/viewvc/llvm-project?rev=285941&view=rev
Log:
Add support to the ObjC type scavenger for finding types via debug info


Modified:
lldb/trunk/include/lldb/Target/Language.h

lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/TestTypeLookup.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/main.mm
lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp

Modified: lldb/trunk/include/lldb/Target/Language.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Language.h?rev=285941&r1=285940&r2=285941&view=diff
==
--- lldb/trunk/include/lldb/Target/Language.h (original)
+++ lldb/trunk/include/lldb/Target/Language.h Thu Nov  3 12:25:27 2016
@@ -95,32 +95,51 @@ public:
ResultSet &results) override;
   };
 
-  template 
+  template 
   class EitherTypeScavenger : public TypeScavenger {
+  public:
+EitherTypeScavenger() : TypeScavenger(), m_scavengers() {
+  for (std::shared_ptr scavenger : { 
std::shared_ptr(new ScavengerTypes())... }) {
+if (scavenger)
+  m_scavengers.push_back(scavenger);
+  }
+}
+  protected:
 bool Find_Impl(ExecutionContextScope *exe_scope, const char *key,
ResultSet &results) override {
   const bool append = false;
-  auto ts1 = TypeScavenger1();
-  if (ts1.Find(exe_scope, key, results, append))
-return true;
-  auto ts2 = TypeScavenger2();
-  if (ts2.Find(exe_scope, key, results, append))
-return true;
+  for (auto& scavenger : m_scavengers) {
+if (scavenger && scavenger->Find(exe_scope, key, results, append))
+  return true;
+  }
   return false;
 }
+  private:
+std::vector> m_scavengers;
   };
 
-  template 
-  class BothTypeScavenger : public TypeScavenger {
+  template 
+  class UnionTypeScavenger : public TypeScavenger {
+  public:
+UnionTypeScavenger() : TypeScavenger(), m_scavengers() {
+  for (std::shared_ptr scavenger : { 
std::shared_ptr(new ScavengerTypes())... }) {
+if (scavenger)
+  m_scavengers.push_back(scavenger);
+  }
+}
+  protected:
 bool Find_Impl(ExecutionContextScope *exe_scope, const char *key,
ResultSet &results) override {
   const bool append = true;
-  auto ts1 = TypeScavenger1();
-  bool success = ts1.Find(exe_scope, key, results, append);
-  auto ts2 = TypeScavenger2();
-  success = ts2.Find(exe_scope, key, results, append) || success;
+  bool success = false;
+  for (auto& scavenger : m_scavengers) {
+if (scavenger)
+  success = scavenger->Find(exe_scope, key, results, append) || 
success;
+  }
   return success;
 }
+  private:
+std::vector> m_scavengers;
   };
 
   enum class FunctionNameRepresentation {

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/TestTypeLookup.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/TestTypeLookup.py?rev=285941&r1=285940&r2=285941&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/TestTypeLookup.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/TestTypeLookup.py
 Thu Nov  3 12:25:27 2016
@@ -52,3 +52,4 @@ class TypeLookupTestCase(TestBase):
 "no type was found matching 
'PleaseDontBeARealTypeThatExists'"])
 self.expect('type lookup MyCPPClass', substrs=['setF', 'float getF'])
 self.expect('type lookup MyClass', substrs=['setF', 'float getF'])
+self.expect('type lookup MyObjCClass', substrs=['@interface 
MyObjCClass', 'int x', 'int y'])

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/main.mm
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/main.mm?rev=285941&r1=285940&r2=285941&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/main.mm 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/main.mm 
Thu Nov  3 12:25:27 2016
@@ -28,6 +28,28 @@ private:
 
 typedef MyCPPClass MyClass;
 
+@interface MyObjCClass : NSObject {
+  int x;
+}
+- (id)init;
+- (int)read;
+@end
+
+@implementation MyObjCClass {
+  int y;
+}
+- (id)init {
+  if (self = [super init]) {
+self->x = 12;
+self->y = 24;
+  }
+  return self;
+}
+- (int)read {
+  return self->x + self->y;
+}
+@end
+
 int main (int argc, const char * argv[])
 {
   MyClass my_cpp(3.1415);

Modified: lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp

[Lldb-commits] [lldb] r285943 - Add RenderScriptScriptGroup to the Xcode project

2016-11-03 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Thu Nov  3 12:33:11 2016
New Revision: 285943

URL: http://llvm.org/viewvc/llvm-project?rev=285943&view=rev
Log:
Add RenderScriptScriptGroup to the Xcode project


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

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=285943&r1=285942&r2=285943&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Nov  3 12:33:11 2016
@@ -836,6 +836,7 @@
947CF7711DC7B1EE00EF980B /* ProcessMinidump.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 947CF7701DC7B1EE00EF980B /* ProcessMinidump.cpp 
*/; };
947CF7761DC7B20D00EF980B /* RegisterContextMinidump_x86_32.cpp 
in Sources */ = {isa = PBXBuildFile; fileRef = 947CF7741DC7B20D00EF980B /* 
RegisterContextMinidump_x86_32.cpp */; };
947CF7771DC7B20D00EF980B /* ThreadMinidump.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 947CF7751DC7B20D00EF980B /* ThreadMinidump.cpp 
*/; };
+   9485545A1DCBAE3B00345FF5 /* RenderScriptScriptGroup.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 948554591DCBAE3B00345FF5 /* 
RenderScriptScriptGroup.cpp */; };
949ADF031406F648004833E1 /* ValueObjectConstResultImpl.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 949ADF021406F648004833E1 /* 
ValueObjectConstResultImpl.cpp */; };
949EEDA01BA74B6D008C63CF /* CoreMedia.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = 949EED9E1BA74B64008C63CF /* CoreMedia.cpp */; };
949EEDA31BA76577008C63CF /* Cocoa.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 949EEDA11BA76571008C63CF /* Cocoa.cpp */; };
@@ -2740,6 +2741,8 @@
947CF7741DC7B20D00EF980B /* RegisterContextMinidump_x86_32.cpp 
*/ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.cpp.cpp; path = RegisterContextMinidump_x86_32.cpp; sourceTree = 
""; };
947CF7751DC7B20D00EF980B /* ThreadMinidump.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = ThreadMinidump.cpp; sourceTree = ""; };
9481FE6B1B5F2D9200DED357 /* Either.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Either.h; path = 
include/lldb/Utility/Either.h; sourceTree = ""; };
+   948554581DCBAE3200345FF5 /* RenderScriptScriptGroup.h */ = {isa 
= PBXFileReference; lastKnownFileType = sourcecode.c.h; path = 
RenderScriptScriptGroup.h; sourceTree = ""; };
+   948554591DCBAE3B00345FF5 /* RenderScriptScriptGroup.cpp */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.cpp.cpp; path = RenderScriptScriptGroup.cpp; sourceTree = ""; 
};
949ADF001406F62E004833E1 /* ValueObjectConstResultImpl.h */ = 
{isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = 
ValueObjectConstResultImpl.h; path = 
include/lldb/Core/ValueObjectConstResultImpl.h; sourceTree = ""; };
949ADF021406F648004833E1 /* ValueObjectConstResultImpl.cpp */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.cpp.cpp; name = ValueObjectConstResultImpl.cpp; path = 
source/Core/ValueObjectConstResultImpl.cpp; sourceTree = ""; };
949EED9E1BA74B64008C63CF /* CoreMedia.cpp */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = CoreMedia.cpp; 
path = Language/ObjC/CoreMedia.cpp; sourceTree = ""; };
@@ -5722,6 +5725,8 @@
isa = PBXGroup;
children = (
23D065811D4A7BDA0008EDE6 /* CMakeLists.txt */,
+   948554591DCBAE3B00345FF5 /* 
RenderScriptScriptGroup.cpp */,
+   948554581DCBAE3200345FF5 /* 
RenderScriptScriptGroup.h */,
23D065831D4A7BDA0008EDE6 /* 
RenderScriptExpressionOpts.h */,
23D065821D4A7BDA0008EDE6 /* 
RenderScriptExpressionOpts.cpp */,
23D065851D4A7BDA0008EDE6 /* 
RenderScriptRuntime.h */,
@@ -7391,6 +7396,7 @@
4C56543119D1EFAA002E9C44 /* 
ThreadPlanPython.cpp in Sources */,
26AB92121819D74600E63F3E /* 
DWARFDataExtractor.cpp in Sources */,
268900E913353E6F00698AC0 /* 
CPPLanguageRuntime.cpp in Sources */,
+   9485545A1DCBAE3B00345FF5 /* 
RenderScriptScriptGroup.cpp in Sources */,
268900EA13353E6F00698AC0 /* DynamicLoader.cpp 
in Sources */,
945261BF1B9A11FC00BF138D /* CxxStringTypes.cpp 
in Sources */,
268900EB13353E6F00698AC0 /* 
ExecutionContext.cpp in Sources */,

[Lldb-commits] [lldb] r285974 - Don't access the process in expressions w/o checking that

2016-11-03 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Thu Nov  3 18:42:09 2016
New Revision: 285974

URL: http://llvm.org/viewvc/llvm-project?rev=285974&view=rev
Log:
Don't access the process in expressions w/o checking that
the process exists.

I also added some tests that crash before this fix, and work correctly after.



Added:

lldb/trunk/packages/Python/lldbsuite/test/expression_command/calculator_mode/

lldb/trunk/packages/Python/lldbsuite/test/expression_command/calculator_mode/TestCalculatorMode.py
Modified:
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/calculator_mode/TestCalculatorMode.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/calculator_mode/TestCalculatorMode.py?rev=285974&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/calculator_mode/TestCalculatorMode.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/calculator_mode/TestCalculatorMode.py
 Thu Nov  3 18:42:09 2016
@@ -0,0 +1,27 @@
+"""
+Test calling an expression without a target.
+"""
+
+from __future__ import print_function
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestCalculatorMode(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def setUp(self):
+# Call super's setUp().
+TestBase.setUp(self)
+
+def test__calculator_mode(self):
+"""Test calling expressions in the dummy target."""
+self.expect("expression 11 + 22", "11 + 22 didn't get the expected 
result", substrs=["33"])
+# Now try it with a specific language:
+self.expect("expression -l c -- 11 + 22", "11 + 22 didn't get the 
expected result", substrs=["33"])
+

Modified: 
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp?rev=285974&r1=285973&r2=285974&view=diff
==
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp 
(original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp 
Thu Nov  3 18:42:09 2016
@@ -808,9 +808,9 @@ lldb_private::Error ClangExpressionParse
 if (log)
   log->Printf("%s - Currrent expression language is %s\n", __FUNCTION__,
   Language::GetNameForLanguageType(lang));
-
-if (lang != lldb::eLanguageTypeUnknown) {
-  auto runtime = exe_ctx.GetProcessSP()->GetLanguageRuntime(lang);
+lldb::ProcessSP process_sp = exe_ctx.GetProcessSP();
+if (process_sp && lang != lldb::eLanguageTypeUnknown) {
+  auto runtime = process_sp->GetLanguageRuntime(lang);
   if (runtime)
 runtime->GetIRPasses(custom_passes);
 }


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


[Lldb-commits] [lldb] r285977 - Added a couple more odd dot patterns that we got out

2016-11-03 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Thu Nov  3 20:47:59 2016
New Revision: 285977

URL: http://llvm.org/viewvc/llvm-project?rev=285977&view=rev
Log:
Added a couple more odd dot patterns that we got out
of clang.

Modified:
lldb/trunk/unittests/Host/FileSpecTest.cpp

Modified: lldb/trunk/unittests/Host/FileSpecTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/FileSpecTest.cpp?rev=285977&r1=285976&r2=285977&view=diff
==
--- lldb/trunk/unittests/Host/FileSpecTest.cpp (original)
+++ lldb/trunk/unittests/Host/FileSpecTest.cpp Thu Nov  3 20:47:59 2016
@@ -200,6 +200,8 @@ TEST(FileSpecTest, EqualDotsPosixRoot) {
 
 TEST(FileSpecTest, GetNormalizedPath) {
   std::pair posix_tests[] = {
+  {"/foo/.././bar", "/bar"},
+  {"/foo/./../bar", "/bar"},
   {"/foo/../bar", "/bar"},
   {"/foo/./bar", "/foo/bar"},
   {"/foo/..", "/"},


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


[Lldb-commits] GDBRemoteCommunicationClientTest.TestPacketSpeedJSON unit test hanging for anyone else?

2016-11-03 Thread Jason Molenda via lldb-commits
Is anyone else seeing a hang in 
GDBRemoteCommunicationClientTest.TestPacketSpeedJSON when running the unit 
tests?  It was a new test added in r285602, it always hangs for me on my 
system, a macOS 10.12.something machine.  Attaching to it with lldb, it's 
waiting to get a packet down in

thread #1: tid = 0x62358  com.apple.main-thread
0  0x7fffbf8a3f4a libsystem_kernel`__select + 10  
1  0x000105feb733   lldb-gtest`SelectHelper::Select + 4323  
SelectHelper.cpp:221
2  0x000105d8c6c5   
lldb-gtest`lldb_private::ConnectionFileDescriptor::BytesAvailable + 565  
ConnectionFileDescriptorPosix.cpp:594
3  0x000105d8be48   lldb-gtest`lldb_private::ConnectionFileDescriptor::Read 
+ 552  ConnectionFileDescriptorPosix.cpp:394
4  0x000105378038   lldb-gtest`lldb_private::Communication::Read + 1416  
Communication.cpp:164
5  0x0001057e82bd   
lldb-gtest`lldb_private::process_gdb_remote::GDBRemoteCommunication::WaitForPacketWithTimeoutMicroSecondsNoLock
 + 381  GDBRemoteCommunication.cpp:355
6  0x0001057e7b5c   
lldb-gtest`lldb_private::process_gdb_remote::GDBRemoteCommunication::ReadPacket 
+ 204  GDBRemoteCommunication.cpp:286
7  0x000105de0636   
lldb-gtest`lldb_private::process_gdb_remote::GDBRemoteClientBase::SendPacketAndWaitForResponseNoLock
 + 502  GDBRemoteClientBase.cpp:191
8  0x000105de03fe   
lldb-gtest`lldb_private::process_gdb_remote::GDBRemoteClientBase::SendPacketAndWaitForResponse
 + 430  GDBRemoteClientBase.cpp:179
9  0x000105d1e2b3   
lldb-gtest`lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::TestPacketSpeed
 + 1667  GDBRemoteCommunicationClient.cpp:2183
10 0x000102a4d29d   
lldb-gtest`GDBRemoteCommunicationClientTest_TestPacketSpeedJSON_Test::TestBody 
+ 269  GDBRemoteCommunicationClientTest.cpp:287



with frame 10 being,

frame #10: 0x000102a4d29d 
lldb-gtest`GDBRemoteCommunicationClientTest_TestPacketSpeedJSON_Test::TestBody(this=0x7fb687d0d530)
 + 269 at GDBRemoteCommunicationClientTest.cpp:287
   284});
   285  
   286StreamString ss;
-> 287client.TestPacketSpeed(10, 32, 32, true, ss);
   288client.Disconnect();
   289server_thread.join();
   290  


The most unusual thing I saw in a quick stack crawl is in 
GDBRemoteCommunication::WaitForPacketWithTimeoutMicroSecondsNoLock where it's 
being told to wait for 10 microseconds, I think that's 1000 seconds or 
16 minutes.  So maybe it would complete if I waited 15 minutes longer than I 
have been. ;)

I'll try to build this up & test it on my more common external-mac setup at 
home, but I don't think this one would be impacted by our internal OS installs.


> On Oct 31, 2016, at 10:19 AM, Pavel Labath via lldb-commits 
>  wrote:
> 
> Author: labath
> Date: Mon Oct 31 12:19:42 2016
> New Revision: 285602
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=285602&view=rev
> Log:
> Remove usages of TimeValue from gdb-remote process plugin
> 
> Summary:
> Most of the changes are very straight-forward, the only tricky part was the
> "packet speed-test" function, which is very time-heavy. As the function was
> completely untested, I added a quick unit smoke test for it.
> 
> Reviewers: clayborg, zturner
> 
> Subscribers: lldb-commits
> 
> Differential Revision: https://reviews.llvm.org/D25391
> 
> Modified:
>lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
>lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp
>lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
>lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
>
> lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
>lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
>
> lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
>lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
>
> lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
> 
> Modified: 
> lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp?rev=285602&r1=285601&r2=285602&view=diff
> ==
> --- lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp 
> (original)
> +++ lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp 
> Mon Oct 31 12:19:42 2016
> @@ -445,7 +445,7 @@ Error PlatformRemoteGDBServer::LaunchPro
>   {
> // Scope for the scoped timeout object
> process_gdb_remote::GDBRemoteCommunication::ScopedTimeout timeout(
> -m_gdb_client, 5);
> +m_gdb_client, std::chrono::seconds(5));
> arg_packet_err = m_gdb_client.SendArgumentsPacket(launch_info);
>   }
> 
> 
> Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp
> URL:

[Lldb-commits] [PATCH] D26295: Change UnwindAssemblyInstEmulation to remove a register location instead of marking it as IsSame()

2016-11-03 Thread Jason Molenda via lldb-commits
jasonmolenda created this revision.
jasonmolenda added reviewers: labath, tberghammer.
jasonmolenda added a subscriber: lldb-commits.
jasonmolenda set the repository for this revision to rL LLVM.

This is a minor change and maybe more of a personal preference, but 
UnwindAssemblyInstEmulation marks registers that have been restored to their 
original values as "IsSame" - which is equivalent to the UnwindPlan not 
mentioning a location for the register at all.  When I look at an unwind plan 
while a function is executing it's epilogue, the output looks like

row[14]:  520: CFA=sp+320 => x8=[CFA-240] x19=  x20=  x21=  
x22=  x23=[CFA-56] x24=[CFA-64] x25=[CFA-72] x26=[CFA-80] x27=[CFA-88] 
x28=[CFA-96] fp=  lr=  
row[15]:  524: CFA=sp+320 => x8=[CFA-240] x19=  x20=  x21=  
x22=  x23=  x24=  x25=[CFA-72] x26=[CFA-80] x27=[CFA-88] 
x28=[CFA-96] fp=  lr=  
row[16]:  528: CFA=sp+320 => x8=[CFA-240] x19=  x20=  x21=  
x22=  x23=  x24=  x25=  x26=  x27=[CFA-88] 
x28=[CFA-96] fp=  lr=  
row[17]:  532: CFA=sp +0 => x8=[CFA-240] x19=  x20=  x21=  
x22=  x23=  x24=  x25=  x26=  x27=  x28= 
 fp=  lr= 

etc.  If we remove the registers from the row, the unwind dump will read like

row[14]:  516: CFA=sp+96 => x8=[CFA-240] x21=[CFA-40] x22=[CFA-48] x23=[CFA-56] 
x24=[CFA-64] x25=[CFA-72] x26=[CFA-80] x27=[CFA-88] x28=[CFA-96] 
row[15]:  520: CFA=sp+96 => x8=[CFA-240] x23=[CFA-56] x24=[CFA-64] x25=[CFA-72] 
x26=[CFA-80] x27=[CFA-88] x28=[CFA-96] 
row[16]:  524: CFA=sp+96 => x8=[CFA-240] x25=[CFA-72] x26=[CFA-80] x27=[CFA-88] 
x28=[CFA-96] 
row[17]:  528: CFA=sp+96 => x8=[CFA-240] x27=[CFA-88] x28=[CFA-96]

There's no functional difference between the two (there SHOULD be no functional 
difference) - but I think it's a bit easier to read without the IsSame's.  Does 
anyone care one way or the other?


Repository:
  rL LLVM

https://reviews.llvm.org/D26295

Files:
  source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
  unittests/UnwindAssembly/InstEmulation/TestArm64InstEmulation.cpp

Index: unittests/UnwindAssembly/InstEmulation/TestArm64InstEmulation.cpp
===
--- unittests/UnwindAssembly/InstEmulation/TestArm64InstEmulation.cpp
+++ unittests/UnwindAssembly/InstEmulation/TestArm64InstEmulation.cpp
@@ -278,24 +278,16 @@
   row_sp = unwind_plan.GetRowForFunctionOffset(32);
   EXPECT_EQ(32ull, row_sp->GetOffset());
 
-  // I'd prefer if these restored registers were cleared entirely instead of set
-  // to IsSame...
-  EXPECT_TRUE(row_sp->GetRegisterInfo(gpr_fp_arm64, regloc));
-  EXPECT_TRUE(regloc.IsSame());
-
-  EXPECT_TRUE(row_sp->GetRegisterInfo(gpr_lr_arm64, regloc));
-  EXPECT_TRUE(regloc.IsSame());
+  EXPECT_FALSE(row_sp->GetRegisterInfo(gpr_fp_arm64, regloc));
+  EXPECT_FALSE(row_sp->GetRegisterInfo(gpr_lr_arm64, regloc));
 
   // 36: CFA=sp+48 => x19=  x20=  x21=[CFA-40] x22=[CFA-48] fp=
   //  lr= 
   row_sp = unwind_plan.GetRowForFunctionOffset(36);
   EXPECT_EQ(36ull, row_sp->GetOffset());
 
-  EXPECT_TRUE(row_sp->GetRegisterInfo(gpr_x19_arm64, regloc));
-  EXPECT_TRUE(regloc.IsSame());
-
-  EXPECT_TRUE(row_sp->GetRegisterInfo(gpr_x20_arm64, regloc));
-  EXPECT_TRUE(regloc.IsSame());
+  EXPECT_FALSE(row_sp->GetRegisterInfo(gpr_x19_arm64, regloc));
+  EXPECT_FALSE(row_sp->GetRegisterInfo(gpr_x20_arm64, regloc));
 
   // 40: CFA=sp +0 => x19=  x20=  x21=  x22=  fp= 
   // lr= 
@@ -305,11 +297,8 @@
   EXPECT_TRUE(row_sp->GetCFAValue().IsRegisterPlusOffset() == true);
   EXPECT_EQ(0, row_sp->GetCFAValue().GetOffset());
 
-  EXPECT_TRUE(row_sp->GetRegisterInfo(gpr_x21_arm64, regloc));
-  EXPECT_TRUE(regloc.IsSame());
-
-  EXPECT_TRUE(row_sp->GetRegisterInfo(gpr_x22_arm64, regloc));
-  EXPECT_TRUE(regloc.IsSame());
+  EXPECT_FALSE(row_sp->GetRegisterInfo(gpr_x21_arm64, regloc));
+  EXPECT_FALSE(row_sp->GetRegisterInfo(gpr_x22_arm64, regloc));
 }
 
 TEST_F(TestArm64InstEmulation, TestFramelessThreeEpilogueFunction) {
@@ -649,24 +638,14 @@
   EXPECT_TRUE(row_sp->GetCFAValue().IsRegisterPlusOffset() == true);
   EXPECT_EQ(0, row_sp->GetCFAValue().GetOffset());
 
-  if (row_sp->GetRegisterInfo(fpu_d8_arm64, regloc))
-EXPECT_TRUE(regloc.IsSame());
-  if (row_sp->GetRegisterInfo(fpu_d9_arm64, regloc))
-EXPECT_TRUE(regloc.IsSame());
-  if (row_sp->GetRegisterInfo(fpu_d10_arm64, regloc))
-EXPECT_TRUE(regloc.IsSame());
-  if (row_sp->GetRegisterInfo(fpu_d11_arm64, regloc))
-EXPECT_TRUE(regloc.IsSame());
-  if (row_sp->GetRegisterInfo(fpu_d12_arm64, regloc))
-EXPECT_TRUE(regloc.IsSame());
-  if (row_sp->GetRegisterInfo(fpu_d13_arm64, regloc))
-EXPECT_TRUE(regloc.IsSame());
-  if (row_sp->GetRegisterInfo(fpu_d14_arm64, regloc))
-EXPECT_TRUE(regloc.IsSame());
-  if (row_sp->GetRegisterInfo(fpu_d15_arm64, regloc))
-EXPECT_TRUE(regloc.IsSame());
-  if (row_sp->GetRegisterInfo(gpr_x27_arm64, regloc))
-EXPECT_TRUE(regloc.IsSame());
-  if (row_sp->GetRegisterInfo(gpr_x28_arm64, regloc))
-EXPECT_TRUE(regloc.IsSam