[Lldb-commits] [lldb] r306634 - Fix two places in RegisterContextLLDB::InitializeNonZerothFrame where

2017-06-28 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Wed Jun 28 20:02:24 2017
New Revision: 306634

URL: http://llvm.org/viewvc/llvm-project?rev=306634=rev
Log:
Fix two places in RegisterContextLLDB::InitializeNonZerothFrame where
I'm not running the saved pc through FixCodeAddress as soon as I should.

 

Modified:
lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp?rev=306634=306633=306634=diff
==
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp Wed Jun 
28 20:02:24 2017
@@ -297,6 +297,14 @@ void RegisterContextLLDB::InitializeNonZ
 return;
   }
 
+  ExecutionContext exe_ctx(m_thread.shared_from_this());
+  Process *process = exe_ctx.GetProcessPtr();
+  // Let ABIs fixup code addresses to make sure they are valid. In ARM ABIs
+  // this will strip bit zero in case we read a PC from memory or from the LR.
+  ABI *abi = process->GetABI().get();
+  if (abi)
+pc = abi->FixCodeAddress(pc);
+
   if (log) {
 UnwindLogMsg("pc = 0x%" PRIx64, pc);
 addr_t reg_val;
@@ -321,14 +329,6 @@ void RegisterContextLLDB::InitializeNonZ
 }
   }
 
-  ExecutionContext exe_ctx(m_thread.shared_from_this());
-  Process *process = exe_ctx.GetProcessPtr();
-  // Let ABIs fixup code addresses to make sure they are valid. In ARM ABIs
-  // this will strip bit zero in case we read a PC from memory or from the LR.
-  ABI *abi = process->GetABI().get();
-  if (abi)
-pc = abi->FixCodeAddress(pc);
-
   const bool allow_section_end = true;
   m_current_pc.SetLoadAddress(pc, >GetTarget(), allow_section_end);
 
@@ -2054,11 +2054,6 @@ bool RegisterContextLLDB::ReadPC(addr_t
 // unwind past that frame to help
 // find the bug.
 
-if (m_all_registers_available == false && above_trap_handler == false &&
-(pc == 0 || pc == 1)) {
-  return false;
-}
-
 ProcessSP process_sp (m_thread.GetProcess());
 if (process_sp)
 {
@@ -2066,6 +2061,12 @@ bool RegisterContextLLDB::ReadPC(addr_t
 if (abi)
 pc = abi->FixCodeAddress(pc);
 }
+
+if (m_all_registers_available == false && above_trap_handler == false &&
+(pc == 0 || pc == 1)) {
+  return false;
+}
+
 return true;
   } else {
 return false;


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


[Lldb-commits] [lldb] r306633 - Change the ABI class to have a weak pointer to its Process;

2017-06-28 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Wed Jun 28 19:57:03 2017
New Revision: 306633

URL: http://llvm.org/viewvc/llvm-project?rev=306633=rev
Log:
Change the ABI class to have a weak pointer to its Process;
some methods in the ABI need a Process to do their work.
Instead of passing it in as a one-off argument to those
methods, this patch puts it in the base class and the methods
can retrieve if it needed.

Note that ABI's are sometimes built without a Process 
(e.g. SBTarget::GetStackRedZoneSize) so it's entirely
possible that the process weak pointer will not be
able to reconsistitue into a strong pointer.

 

Modified:
lldb/trunk/include/lldb/Target/ABI.h
lldb/trunk/include/lldb/lldb-private-interfaces.h
lldb/trunk/source/API/SBTarget.cpp
lldb/trunk/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp
lldb/trunk/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h
lldb/trunk/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp
lldb/trunk/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h
lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h
lldb/trunk/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp
lldb/trunk/source/Plugins/ABI/SysV-arm/ABISysV_arm.h
lldb/trunk/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp
lldb/trunk/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.h
lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h
lldb/trunk/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp
lldb/trunk/source/Plugins/ABI/SysV-i386/ABISysV_i386.h
lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.h
lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h
lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp
lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.h
lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp
lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h
lldb/trunk/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp
lldb/trunk/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.h
lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/trunk/source/Symbol/Variable.cpp
lldb/trunk/source/Target/ABI.cpp
lldb/trunk/source/Target/Process.cpp

Modified: lldb/trunk/include/lldb/Target/ABI.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ABI.h?rev=306633=306632=306633=diff
==
--- lldb/trunk/include/lldb/Target/ABI.h (original)
+++ lldb/trunk/include/lldb/Target/ABI.h Wed Jun 28 19:57:03 2017
@@ -92,6 +92,16 @@ protected:
   virtual lldb::ValueObjectSP
   GetReturnValueObjectImpl(Thread , llvm::Type _type) const;
 
+  //--
+  /// Request to get a Process shared pointer.
+  ///
+  /// This ABI object may not have been created with a Process object,
+  /// or the Process object may no longer be alive.  Be sure to handle
+  /// the case where the shared pointer returned does not have an
+  /// object inside it.
+  //--
+  lldb::ProcessSP GetProcessSP() const { return m_process_wp.lock(); }
+
 public:
   virtual bool CreateFunctionEntryUnwindPlan(UnwindPlan _plan) = 0;
 
@@ -131,13 +141,18 @@ public:
 
   virtual bool GetPointerReturnRegister(const char *) { return false; }
 
-  static lldb::ABISP FindPlugin(const ArchSpec );
+  static lldb::ABISP FindPlugin(lldb::ProcessSP process_sp, const ArchSpec 
);
 
 protected:
   //--
   // Classes that inherit from ABI can see and modify these
   //--
-  ABI();
+  ABI(lldb::ProcessSP process_sp) {
+if (process_sp.get())
+m_process_wp = process_sp;
+  }
+
+  lldb::ProcessWP m_process_wp;
 
 private:
   DISALLOW_COPY_AND_ASSIGN(ABI);

Modified: lldb/trunk/include/lldb/lldb-private-interfaces.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private-interfaces.h?rev=306633=306632=306633=diff
==
--- lldb/trunk/include/lldb/lldb-private-interfaces.h (original)
+++ lldb/trunk/include/lldb/lldb-private-interfaces.h Wed Jun 28 19:57:03 2017
@@ -21,7 +21,7 @@
 #include 
 
 namespace lldb_private {
-typedef lldb::ABISP (*ABICreateInstance)(const ArchSpec );
+typedef lldb::ABISP (*ABICreateInstance)(lldb::ProcessSP process_sp, const 
ArchSpec );
 typedef Disassembler *(*DisassemblerCreateInstance)(const ArchSpec ,
   

[Lldb-commits] Buildbot numbers for the week of 06/11/2017 - 06/17/2017

2017-06-28 Thread Galina Kistanova via lldb-commits
Hello everyone,

Below are some buildbot numbers for the week of 06/11/2017 - 06/17/2017.

Please see the same data in attached csv files:

The longest time each builder was red during the last week;
"Status change ratio" by active builder (percent of builds that changed the
builder status from greed to red or from red to green);
Count of commits by project;
Number of completed builds, failed builds and average build time for
successful builds per active builder;
Average waiting time for a revision to get build result per active builder
(response time).

Thanks

Galina


The longest time each builder was red during the last week:

buildername | was_red
+-
 clang-x86_64-linux-selfhost-modules| 95:51:35
 clang-s390x-linux-multistage   | 61:03:09
 clang-s390x-linux-lnt  | 58:35:21
 clang-s390x-linux  | 58:25:03
 clang-ppc64be-linux-multistage | 56:02:39
 clang-ppc64be-linux| 55:35:48
 clang-ppc64be-linux-lnt| 55:24:17
 sanitizer-x86_64-linux-fast| 48:37:55
 sanitizer-x86_64-linux-bootstrap   | 34:44:35
 aosp-O3-polly-before-vectorizer-unprofitable   | 24:00:42
 clang-lld-x86_64-2stage| 23:00:13
 clang-with-thin-lto-ubuntu | 22:47:28
 clang-with-lto-ubuntu  | 22:12:10
 llvm-clang-x86_64-expensive-checks-win | 20:33:28
 clang-cmake-armv7-a15-selfhost-neon| 18:26:45
 clang-ppc64le-linux-multistage | 14:59:54
 clang-cmake-armv7-a15-selfhost | 14:59:04
 clang-hexagon-elf  | 14:43:57
 clang-x86-windows-msvc2015 | 14:32:31
 clang-x64-ninja-win7   | 14:31:08
 clang-x86_64-linux-selfhost-modules-2  | 14:20:41
 clang-bpf-build| 14:20:40
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast | 14:20:18
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast   | 14:19:17
 clang-cmake-thumbv7-a15-full-sh| 12:44:54
 clang-cmake-armv7-a15  | 12:34:57
 clang-cmake-thumbv7-a15| 12:24:45
 clang-cmake-armv7-a15-full | 12:11:09
 perf-x86_64-penryn-O3-polly-fast   | 10:03:46
 perf-x86_64-penryn-O3  | 09:41:08
 perf-x86_64-penryn-O3-polly| 09:00:55
 clang-cmake-aarch64-full   | 06:04:31
 perf-x86_64-penryn-O3-polly-before-vectorizer-unprofitable | 05:16:51
 lldb-x86_64-ubuntu-14.04-android   | 05:00:38
 clang-cmake-aarch64-lld| 04:57:36
 sanitizer-ppc64be-linux| 04:47:18
 sanitizer-ppc64le-linux| 04:38:26
 libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11   | 04:24:20
 lldb-x86_64-darwin-13.4| 04:12:10
 lldb-windows7-android  | 03:59:01
 lld-x86_64-win7| 03:08:16
 lld-x86_64-darwin13| 03:02:05
 clang-cuda-build   | 02:56:39
 lld-x86_64-freebsd | 02:33:21
 libcxx-libcxxabi-x86_64-linux-ubuntu-gcc-tot-cxx1z | 02:27:06
 perf-x86_64-penryn-O3-polly-unprofitable   | 02:14:54
 clang-cmake-aarch64-quick  | 01:59:11
 clang-x86_64-linux-abi-test| 01:57:32
 lldb-x86-windows-msvc2015  | 01:52:18
 clang-cmake-aarch64-42vma  | 01:50:24
 lldb-amd64-ninja-netbsd8   | 01:46:06
 clang-ppc64le-linux| 01:45:41
 sanitizer-windows  | 01:44:37
 sanitizer-x86_64-linux | 01:35:01
 clang-x86_64-debian-fast   | 01:29:52
 clang-atom-d525-fedora-rel | 01:20:25
 lldb-x86_64-ubuntu-14.04-buildserver   | 01:14:08
 sanitizer-x86_64-linux-autoconf| 00:56:04
 libcxx-libcxxabi-libunwind-aarch64-linux-noexceptions  | 00:53:27
 

[Lldb-commits] [lldb] r306611 - Added a project for the unified IR interpreter.

2017-06-28 Thread Sean Callanan via lldb-commits
Author: spyffe
Date: Wed Jun 28 15:51:16 2017
New Revision: 306611

URL: http://llvm.org/viewvc/llvm-project?rev=306611=rev
Log:
Added a project for the unified IR interpreter.

Modified:
lldb/trunk/www/projects.html

Modified: lldb/trunk/www/projects.html
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/www/projects.html?rev=306611=306610=306611=diff
==
--- lldb/trunk/www/projects.html (original)
+++ lldb/trunk/www/projects.html Wed Jun 28 15:51:16 2017
@@ -441,6 +441,18 @@
 And then you have to explain 
these conditions the user in some helpful way.
   
 
+
+  Unified IR interpreter.
+  
+Currently IRInterpreter 
implements a portion of the LLVM IR, but it doesn't handle
+vector data types and there 
are plenty of instructions it also doesn't support.
+Conversely, lli supports most 
of LLVM's IR but it doesn't handle remote memory and
+its function calling support 
is very rudimentary.  It would be useful to unify these
+and make the IR interpreter -- 
both for LLVM and LLDB -- better.  An alternate strategy
+would be simply to JIT into 
the current process but have callbacks for non-stack memory
+access.
+  
+
   
 



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


[Lldb-commits] [PATCH] D34774: [lldb] Add a testcase for MainThreadCheckerRuntime plugin

2017-06-28 Thread Kuba (Brecka) Mracek via Phabricator via lldb-commits
kubamracek updated this revision to Diff 104514.

https://reviews.llvm.org/D34774

Files:
  packages/Python/lldbsuite/test/functionalities/mtc/simple/Makefile
  packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py
  packages/Python/lldbsuite/test/functionalities/mtc/simple/main.m
  packages/Python/lldbsuite/test/lldbplatformutil.py

Index: packages/Python/lldbsuite/test/lldbplatformutil.py
===
--- packages/Python/lldbsuite/test/lldbplatformutil.py
+++ packages/Python/lldbsuite/test/lldbplatformutil.py
@@ -8,6 +8,7 @@
 import re
 import subprocess
 import sys
+import os
 
 # Third-party modules
 import six
@@ -140,6 +141,19 @@
 return getPlatform() in getDarwinOSTriples()
 
 
+def findMainThreadCheckerDylib():
+if not platformIsDarwin():
+return ""
+
+with os.popen('xcode-select -p') as output:
+xcode_developer_path = output.read().strip()
+mtc_dylib_path = '%s/usr/lib/libMainThreadChecker.dylib' % xcode_developer_path
+if os.path.isfile(mtc_dylib_path):
+return mtc_dylib_path
+
+return ""
+
+
 class _PlatformContext(object):
 """Value object class which contains platform-specific options."""
 
Index: packages/Python/lldbsuite/test/functionalities/mtc/simple/main.m
===
--- packages/Python/lldbsuite/test/functionalities/mtc/simple/main.m
+++ packages/Python/lldbsuite/test/functionalities/mtc/simple/main.m
@@ -0,0 +1,15 @@
+#import 
+#import 
+
+int main() {
+  NSView *view = [[NSView alloc] init];
+  dispatch_group_t g = dispatch_group_create();
+  dispatch_group_enter(g);
+  [NSThread detachNewThreadWithBlock:^{
+@autoreleasepool {
+  [view superview];
+}
+dispatch_group_leave(g);
+  }];
+  dispatch_group_wait(g, DISPATCH_TIME_FOREVER);
+}
Index: packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py
===
--- packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py
+++ packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py
@@ -0,0 +1,57 @@
+"""
+Tests basic Main Thread Checker support (detecting a main-thread-only violation).
+"""
+
+import os
+import time
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test.lldbplatformutil import *
+import json
+
+
+class MTCSimpleTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@skipUnlessDarwin
+def test(self):
+self.mtc_dylib_path = findMainThreadCheckerDylib()
+if self.mtc_dylib_path == "":
+self.skipTest("This test requires libMainThreadChecker.dylib.")
+
+self.build()
+self.mtc_tests()
+
+def setUp(self):
+# Call super's setUp().
+TestBase.setUp(self)
+
+def mtc_tests(self):
+# Load the test
+exe = os.path.join(os.getcwd(), "a.out")
+self.expect("file " + exe, patterns=["Current executable set to .*a.out"])
+
+self.runCmd("env DYLD_INSERT_LIBRARIES=%s" % self.mtc_dylib_path)
+self.runCmd("run")
+
+process = self.dbg.GetSelectedTarget().process
+thread = process.GetSelectedThread()
+frame = thread.GetSelectedFrame()
+
+self.expect("thread info", substrs=['stop reason = -[NSView superview] must be called from main thread only'])
+
+self.expect(
+"thread info -s",
+substrs=["instrumentation_class", "api_name", "class_name", "selector", "description"])
+self.assertEqual(thread.GetStopReason(), lldb.eStopReasonInstrumentation)
+output_lines = self.res.GetOutput().split('\n')
+json_line = '\n'.join(output_lines[2:])
+data = json.loads(json_line)
+self.assertEqual(data["instrumentation_class"], "MainThreadChecker")
+self.assertEqual(data["api_name"], "-[NSView superview]")
+self.assertEqual(data["class_name"], "NSView")
+self.assertEqual(data["selector"], "superview")
+self.assertEqual(data["description"], "-[NSView superview] must be called from main thread only")
Index: packages/Python/lldbsuite/test/functionalities/mtc/simple/Makefile
===
--- packages/Python/lldbsuite/test/functionalities/mtc/simple/Makefile
+++ packages/Python/lldbsuite/test/functionalities/mtc/simple/Makefile
@@ -0,0 +1,6 @@
+LEVEL = ../../../make
+
+OBJC_SOURCES := main.m
+LDFLAGS = $(CFLAGS) -lobjc -framework Foundation -framework AppKit
+
+include $(LEVEL)/Makefile.rules
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D34774: [lldb] Add a testcase for MainThreadCheckerRuntime plugin

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

Actually, I think I need to extract the detection of libMainThreadChecker.dylib 
into a helper function, because I want to add more tests that will use it.


https://reviews.llvm.org/D34774



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


[Lldb-commits] [PATCH] D34774: [lldb] Add a testcase for MainThreadCheckerRuntime plugin

2017-06-28 Thread Kuba (Brecka) Mracek via Phabricator via lldb-commits
kubamracek created this revision.

This adds a simple testcase for MainThreadCheckerRuntime.  The tool (Main 
Thread Checker) is only available on Darwin and in very new Xcode versions, so 
the test also detects the presence of `libMainThreadChecker.dylib` and is 
skipped if the tool is not available.


https://reviews.llvm.org/D34774

Files:
  packages/Python/lldbsuite/test/functionalities/mtc/simple/Makefile
  packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py
  packages/Python/lldbsuite/test/functionalities/mtc/simple/main.m

Index: packages/Python/lldbsuite/test/functionalities/mtc/simple/main.m
===
--- packages/Python/lldbsuite/test/functionalities/mtc/simple/main.m
+++ packages/Python/lldbsuite/test/functionalities/mtc/simple/main.m
@@ -0,0 +1,15 @@
+#import 
+#import 
+
+int main() {
+  NSView *view = [[NSView alloc] init];
+  dispatch_group_t g = dispatch_group_create();
+  dispatch_group_enter(g);
+  [NSThread detachNewThreadWithBlock:^{
+@autoreleasepool {
+  [view superview];
+}
+dispatch_group_leave(g);
+  }];
+  dispatch_group_wait(g, DISPATCH_TIME_FOREVER);
+}
Index: packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py
===
--- packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py
+++ packages/Python/lldbsuite/test/functionalities/mtc/simple/TestMTCSimple.py
@@ -0,0 +1,65 @@
+"""
+Tests basic Main Thread Checker support (detecting a main-thread-only violation).
+"""
+
+import os
+import time
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+import lldbsuite.test.lldbutil as lldbutil
+import json
+
+
+class MTCSimpleTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@skipUnlessDarwin
+def test(self):
+mtc_dylib_path = ""
+with os.popen('xcode-select -p') as output:
+xcode_developer_path = output.read().strip()
+mtc_dylib_path = '%s/usr/lib/libMainThreadChecker.dylib' % xcode_developer_path
+if not os.path.isfile(mtc_dylib_path):
+mtc_dylib_path = ""
+
+if mtc_dylib_path == "":
+self.skipTest("This test requires libMainThreadChecker.dylib.")
+return
+
+self.mtc_dylib_path = mtc_dylib_path
+
+self.build()
+self.mtc_tests()
+
+def setUp(self):
+# Call super's setUp().
+TestBase.setUp(self)
+
+def mtc_tests(self):
+# Load the test
+exe = os.path.join(os.getcwd(), "a.out")
+self.expect("file " + exe, patterns=["Current executable set to .*a.out"])
+
+self.runCmd("env DYLD_INSERT_LIBRARIES=%s" % self.mtc_dylib_path)
+self.runCmd("run")
+
+process = self.dbg.GetSelectedTarget().process
+thread = process.GetSelectedThread()
+frame = thread.GetSelectedFrame()
+
+self.expect("thread info", substrs=['stop reason = -[NSView superview] must be called from main thread only'])
+
+self.expect(
+"thread info -s",
+substrs=["instrumentation_class", "api_name", "class_name", "selector", "description"])
+self.assertEqual(thread.GetStopReason(), lldb.eStopReasonInstrumentation)
+output_lines = self.res.GetOutput().split('\n')
+json_line = '\n'.join(output_lines[2:])
+data = json.loads(json_line)
+self.assertEqual(data["instrumentation_class"], "MainThreadChecker")
+self.assertEqual(data["api_name"], "-[NSView superview]")
+self.assertEqual(data["class_name"], "NSView")
+self.assertEqual(data["selector"], "superview")
+self.assertEqual(data["description"], "-[NSView superview] must be called from main thread only")
Index: packages/Python/lldbsuite/test/functionalities/mtc/simple/Makefile
===
--- packages/Python/lldbsuite/test/functionalities/mtc/simple/Makefile
+++ packages/Python/lldbsuite/test/functionalities/mtc/simple/Makefile
@@ -0,0 +1,6 @@
+LEVEL = ../../../make
+
+OBJC_SOURCES := main.m
+LDFLAGS = $(CFLAGS) -lobjc -framework Foundation -framework AppKit
+
+include $(LEVEL)/Makefile.rules
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D34750: [UnwindAssembly/x86] Add support for "lea imm(%ebp), %esp" pattern

2017-06-28 Thread Tamas Berghammer via Phabricator via lldb-commits
tberghammer added inline comments.



Comment at: 
source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp:875-876
+ row->GetCFAValue().GetRegisterNumber() == m_lldb_fp_regnum) {
+  current_sp_bytes_offset_from_cfa =
+  row->GetCFAValue().GetOffset() - stack_offset;
+}

labath wrote:
> tberghammer wrote:
> > Shouldn't you change the unwind information for the CFA here? For me saying 
> > CFA=rbp seems like an incorrect thing to do, but not sure what would be the 
> > correct value (Undefined? IsSame?). The impact is if an other register (or 
> > a local variable) have a location specified as CFA+off then after this 
> > instruction it will point to bogus location.
> I think there has been some misunderstanding, as the your comment makes no 
> sense to me. :)
> 
> This code only fires if CFA=rbp+offset, and that remains valid even after 
> this instruction -- `lea` does not change the value of the rbp register, so 
> any register rule that was valid before this instruction will remain valid 
> after it. This only begins to make a difference after we process the `pop 
> %rbp` instruction -- then we will update the CFA rule to read 
> `CFA=rsp+current_sp_bytes_offset_from_cfa`.
You are right, please ignore my comment. I somehow assumed the `lea` 
instruction will change the value of `rbp` as well not just `rsp`.


https://reviews.llvm.org/D34750



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


[Lldb-commits] [PATCH] D34750: [UnwindAssembly/x86] Add support for "lea imm(%ebp), %esp" pattern

2017-06-28 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: 
source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp:875-876
+ row->GetCFAValue().GetRegisterNumber() == m_lldb_fp_regnum) {
+  current_sp_bytes_offset_from_cfa =
+  row->GetCFAValue().GetOffset() - stack_offset;
+}

tberghammer wrote:
> Shouldn't you change the unwind information for the CFA here? For me saying 
> CFA=rbp seems like an incorrect thing to do, but not sure what would be the 
> correct value (Undefined? IsSame?). The impact is if an other register (or a 
> local variable) have a location specified as CFA+off then after this 
> instruction it will point to bogus location.
I think there has been some misunderstanding, as the your comment makes no 
sense to me. :)

This code only fires if CFA=rbp+offset, and that remains valid even after this 
instruction -- `lea` does not change the value of the rbp register, so any 
register rule that was valid before this instruction will remain valid after 
it. This only begins to make a difference after we process the `pop %rbp` 
instruction -- then we will update the CFA rule to read 
`CFA=rsp+current_sp_bytes_offset_from_cfa`.


https://reviews.llvm.org/D34750



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


[Lldb-commits] [PATCH] D33035: Tool for using Intel(R) Processor Trace hardware feature

2017-06-28 Thread Abhishek via Phabricator via lldb-commits
abhishek.aggarwal updated this revision to Diff 104430.
abhishek.aggarwal added a comment.

Fixed one minor thing in CMakeFile


https://reviews.llvm.org/D33035

Files:
  tools/CMakeLists.txt
  tools/intel-features/CMakeLists.txt
  tools/intel-features/README.txt
  tools/intel-features/cli-wrapper.cpp
  tools/intel-features/intel-mpx/CMakeLists.txt
  tools/intel-features/intel-mpx/cli-wrapper-mpxtable.cpp
  tools/intel-features/intel-mpx/cli-wrapper-mpxtable.h
  tools/intel-features/intel-mpx/test/Makefile
  tools/intel-features/intel-mpx/test/README.txt
  tools/intel-features/intel-mpx/test/TestMPXTable.py
  tools/intel-features/intel-mpx/test/main.cpp
  tools/intel-features/intel-pt/CMakeLists.txt
  tools/intel-features/intel-pt/Decoder.cpp
  tools/intel-features/intel-pt/Decoder.h
  tools/intel-features/intel-pt/PTDecoder.cpp
  tools/intel-features/intel-pt/PTDecoder.h
  tools/intel-features/intel-pt/README_CLI.txt
  tools/intel-features/intel-pt/README_TOOL.txt
  tools/intel-features/intel-pt/interface/PTDecoder.i
  tools/intel-features/scripts/CMakeLists.txt
  tools/intel-features/scripts/lldb-intel-features.swig
  tools/intel-features/scripts/python-typemaps.txt
  tools/intel-mpx/CMakeLists.txt
  tools/intel-mpx/IntelMPXTablePlugin.cpp
  tools/intel-mpx/test/Makefile
  tools/intel-mpx/test/README.txt
  tools/intel-mpx/test/TestMPXTable.py
  tools/intel-mpx/test/main.cpp

Index: tools/intel-mpx/CMakeLists.txt
===
--- tools/intel-mpx/CMakeLists.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-if (NOT CMAKE_SYSTEM_NAME MATCHES "Linux")
-  return ()
-endif ()
-
-include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake)
-
-add_library(lldb-intel-mpxtable SHARED
-  IntelMPXTablePlugin.cpp
-  )
-
-target_link_libraries(lldb-intel-mpxtable
-  PUBLIC liblldb LLVMSupport)
-
-install(TARGETS lldb-intel-mpxtable
-  LIBRARY DESTINATION bin)
Index: tools/intel-features/scripts/python-typemaps.txt
===
--- /dev/null
+++ tools/intel-features/scripts/python-typemaps.txt
@@ -0,0 +1,15 @@
+/* Typemap definitions to allow SWIG to properly handle some data types */
+
+// typemap for a char buffer
+%typemap(in) (char *dst, size_t dst_len) {
+   if (!PyInt_Check($input)) {
+   PyErr_SetString(PyExc_ValueError, "Expecting an integer");
+   return NULL;
+   }
+   $2 = PyInt_AsLong($input);
+   if ($2 <= 0) {
+   PyErr_SetString(PyExc_ValueError, "Positive integer expected");
+   return NULL;
+   }
+   $1 = (char *) malloc($2);
+}
Index: tools/intel-features/scripts/lldb-intel-features.swig
===
--- /dev/null
+++ tools/intel-features/scripts/lldb-intel-features.swig
@@ -0,0 +1,16 @@
+%module lldbIntelFeatures
+
+%{
+#include "lldb/lldb-public.h"
+#include "intel-pt/PTDecoder.h"
+using namespace ptdecoder;
+%}
+
+/* Undefine GCC keyword to make Swig happy when processing glibc's stdint.h */
+#define __extension__
+
+/* Combined python typemap for all features */
+%include "python-typemaps.txt"
+
+/* Feature specific python interface files*/
+%include "../intel-pt/interface/PTDecoder.i"
Index: tools/intel-features/scripts/CMakeLists.txt
===
--- /dev/null
+++ tools/intel-features/scripts/CMakeLists.txt
@@ -0,0 +1,37 @@
+file(GLOB_RECURSE SWIG_SOURCES *.swig)
+
+set(FLAGS
+  -c++
+  -shadow
+  -python
+  -D__STDC_LIMIT_MACROS
+  -D__STDC_CONSTANT_MACROS
+  )
+
+set(INCLUDES
+  -I${LLDB_SOURCE_DIR}/include
+  -I${LLDB_SOURCE_DIR}/tools/intel-features/intel-pt
+  )
+
+set(OUTPUT_PYTHON_WRAPPER
+  ${CMAKE_CURRENT_BINARY_DIR}/IntelFeaturesPythonWrap.cpp
+  )
+
+set(OUTPUT_PYTHON_SCRIPT_DIR
+  ${CMAKE_CURRENT_BINARY_DIR}
+  )
+
+find_package(SWIG REQUIRED)
+add_custom_command(
+  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/IntelFeaturesPythonWrap.cpp
+  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lldbIntelFeatures.py
+  DEPENDS ${SWIG_SOURCES}
+  COMMAND ${SWIG_EXECUTABLE} ${FLAGS} ${INCLUDES} -o ${OUTPUT_PYTHON_WRAPPER} -outdir ${OUTPUT_PYTHON_SCRIPT_DIR} ${SWIG_SOURCES}
+  COMMENT "Generating python wrapper for features library")
+
+set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/IntelFeaturesPythonWrap.cpp PROPERTIES GENERATED 1)
+set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/lldbIntelFeatures.py PROPERTIES GENERATED 1)
+
+add_custom_target(intel-features-swig_wrapper ALL
+  DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/IntelFeaturesPythonWrap.cpp
+  )
Index: tools/intel-features/intel-pt/interface/PTDecoder.i
===
--- /dev/null
+++ tools/intel-features/intel-pt/interface/PTDecoder.i
@@ -0,0 +1,13 @@
+%include "stdint.i"
+%include "std_string.i"
+%include "std_vector.i"
+
+%include "lldb/lldb-defines.h"
+%include "lldb/lldb-enumerations.h"
+%include "lldb/lldb-forward.h"
+%include "lldb/lldb-types.h"
+

[Lldb-commits] [PATCH] D34750: [UnwindAssembly/x86] Add support for "lea imm(%ebp), %esp" pattern

2017-06-28 Thread Tamas Berghammer via Phabricator via lldb-commits
tberghammer accepted this revision.
tberghammer added a comment.
This revision is now accepted and ready to land.

Looks good with one possible question




Comment at: 
source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp:875-876
+ row->GetCFAValue().GetRegisterNumber() == m_lldb_fp_regnum) {
+  current_sp_bytes_offset_from_cfa =
+  row->GetCFAValue().GetOffset() - stack_offset;
+}

Shouldn't you change the unwind information for the CFA here? For me saying 
CFA=rbp seems like an incorrect thing to do, but not sure what would be the 
correct value (Undefined? IsSame?). The impact is if an other register (or a 
local variable) have a location specified as CFA+off then after this 
instruction it will point to bogus location.


https://reviews.llvm.org/D34750



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


[Lldb-commits] [PATCH] D34750: [UnwindAssembly/x86] Add support for "lea imm(%ebp), %esp" pattern

2017-06-28 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.

The instruction pattern:
and $-16, %esp
sub $imm, %esp
...
lea imm(%ebp), %esp

appears when the compiler is realigning the stack (for example in
main(), or almost everywhere with -mstackrealign switch). The "and"
instruction is very difficult to model, but that's not necessary, as
these frames are always %ebp-based (the compiler also needs a way to
restore the original %esp). Therefore the plans we were generating for
these function were almost correct already. The only place we were doing
it wrong were the last instructions of the epilogue (usually just
"ret"), where we had to revert to %esp-based unwinding, as the %ebp had
been popped already.

This was wrong because our "distance of esp from cfa" counter had picked
up the "sub" instruction (and incremented the counter) but it had not
seen that the register was reset by the "lea" instruction.

This patch fixes that shortcoming, and adds a test for handling
functions like this.

I have not been able to tickle the compiler into producing a 64-bit
function with this pattern, but I don't see a reason why it couldn't
produce it, if it chose to, so I add a x86_64 test as well.


https://reviews.llvm.org/D34750

Files:
  source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp
  source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.h
  unittests/UnwindAssembly/x86/Testx86AssemblyInspectionEngine.cpp

Index: unittests/UnwindAssembly/x86/Testx86AssemblyInspectionEngine.cpp
===
--- unittests/UnwindAssembly/x86/Testx86AssemblyInspectionEngine.cpp
+++ unittests/UnwindAssembly/x86/Testx86AssemblyInspectionEngine.cpp
@@ -18,6 +18,7 @@
 #include "lldb/Core/AddressRange.h"
 #include "lldb/Core/ArchSpec.h"
 #include "lldb/Symbol/UnwindPlan.h"
+#include "lldb/Utility/StreamString.h"
 
 #include "llvm/Support/TargetSelect.h"
 
@@ -130,6 +131,15 @@
   return engine;
 }
 
+namespace lldb_private {
+static std::ostream <<(std::ostream ,
+const UnwindPlan::Row::CFAValue ) {
+  StreamString S;
+  CFA.Dump(S, nullptr, nullptr);
+  return OS << S.GetData();
+}
+} // namespace lldb_private
+
 TEST_F(Testx86AssemblyInspectionEngine, TestSimple64bitFrameFunction) {
   std::unique_ptr engine = Getx86_64Inspector();
 
@@ -2337,3 +2347,71 @@
 
   EXPECT_FALSE(row_sp->GetRegisterInfo(k_rbp, regloc));
 }
+
+TEST_F(Testx86AssemblyInspectionEngine, TestStackRealign8BitDisp_i386) {
+  std::unique_ptr engine = Geti386Inspector();
+
+  uint8_t data[] = {
+  0x55, // pushl %ebp
+  0x89, 0xe5,   // movl %esp, %ebp
+  0x53, // pushl %ebx
+  0x83, 0xe4, 0xf0, // andl $-16, %esp
+  0x83, 0xec, 0x10, // subl $16, %esp
+  0x8d, 0x65, 0xfc, // leal -4(%ebp), %esp
+  0x5b, // popl %ebx
+  0x5d, // popl %ebp
+  0xc3, // retl
+  };
+
+  AddressRange sample_range(0x1000, sizeof(data));
+  UnwindPlan plan(eRegisterKindLLDB);
+  ASSERT_TRUE(engine->GetNonCallSiteUnwindPlanFromAssembly(data, sizeof(data),
+   sample_range, plan));
+
+  UnwindPlan::Row::CFAValue esp_plus_4, esp_plus_8, ebp_plus_8;
+  esp_plus_4.SetIsRegisterPlusOffset(k_esp, 4);
+  esp_plus_8.SetIsRegisterPlusOffset(k_esp, 8);
+  ebp_plus_8.SetIsRegisterPlusOffset(k_ebp, 8);
+
+  EXPECT_EQ(esp_plus_4, plan.GetRowForFunctionOffset(0)->GetCFAValue());
+  EXPECT_EQ(esp_plus_8, plan.GetRowForFunctionOffset(1)->GetCFAValue());
+  for (size_t i = 3; i < sizeof(data) - 2; ++i)
+EXPECT_EQ(ebp_plus_8, plan.GetRowForFunctionOffset(i)->GetCFAValue())
+<< "i: " << i;
+  EXPECT_EQ(esp_plus_4,
+plan.GetRowForFunctionOffset(sizeof(data) - 1)->GetCFAValue());
+}
+
+TEST_F(Testx86AssemblyInspectionEngine, TestStackRealign32BitDisp_x86_64) {
+  std::unique_ptr engine = Getx86_64Inspector();
+
+  uint8_t data[] = {
+  0x55, // pushq %rbp
+  0x48, 0x89, 0xe5, // movq %rsp, %rbp
+  0x53, // pushl %rbx
+  0x48, 0x83, 0xe4, 0xf0,   // andq $-16, %rsp
+  0x48, 0x81, 0xec, 0x00, 0x01, 0x00, 0x00, // subq $256, %rsp
+  0x48, 0x8d, 0x65, 0xf8,   // leaq -8(%rbp), %rsp
+  0x5b, // popq %rbx
+  0x5d, // popq %rbp
+  0xc3, // retq
+  };
+
+  AddressRange sample_range(0x1000, sizeof(data));
+  UnwindPlan plan(eRegisterKindLLDB);
+  ASSERT_TRUE(engine->GetNonCallSiteUnwindPlanFromAssembly(data, sizeof(data),
+   sample_range, plan));
+
+  UnwindPlan::Row::CFAValue rsp_plus_8, rsp_plus_16, rbp_plus_16;
+  rsp_plus_8.SetIsRegisterPlusOffset(k_rsp, 8);
+  rsp_plus_16.SetIsRegisterPlusOffset(k_rsp, 16);
+  

[Lldb-commits] [PATCH] D33035: Tool for using Intel(R) Processor Trace hardware feature

2017-06-28 Thread Abhishek via Phabricator via lldb-commits
abhishek.aggarwal updated this revision to Diff 104376.
abhishek.aggarwal added a comment.

Cmake files related changes

- Using lldb's cmake functions insted of vanilla ones for cmake files


https://reviews.llvm.org/D33035

Files:
  tools/CMakeLists.txt
  tools/intel-features/CMakeLists.txt
  tools/intel-features/README.txt
  tools/intel-features/cli-wrapper.cpp
  tools/intel-features/intel-mpx/CMakeLists.txt
  tools/intel-features/intel-mpx/cli-wrapper-mpxtable.cpp
  tools/intel-features/intel-mpx/cli-wrapper-mpxtable.h
  tools/intel-features/intel-mpx/test/Makefile
  tools/intel-features/intel-mpx/test/README.txt
  tools/intel-features/intel-mpx/test/TestMPXTable.py
  tools/intel-features/intel-mpx/test/main.cpp
  tools/intel-features/intel-pt/CMakeLists.txt
  tools/intel-features/intel-pt/Decoder.cpp
  tools/intel-features/intel-pt/Decoder.h
  tools/intel-features/intel-pt/PTDecoder.cpp
  tools/intel-features/intel-pt/PTDecoder.h
  tools/intel-features/intel-pt/README_CLI.txt
  tools/intel-features/intel-pt/README_TOOL.txt
  tools/intel-features/intel-pt/interface/PTDecoder.i
  tools/intel-features/scripts/CMakeLists.txt
  tools/intel-features/scripts/lldb-intel-features.swig
  tools/intel-features/scripts/python-typemaps.txt
  tools/intel-mpx/CMakeLists.txt
  tools/intel-mpx/IntelMPXTablePlugin.cpp
  tools/intel-mpx/test/Makefile
  tools/intel-mpx/test/README.txt
  tools/intel-mpx/test/TestMPXTable.py
  tools/intel-mpx/test/main.cpp

Index: tools/intel-mpx/CMakeLists.txt
===
--- tools/intel-mpx/CMakeLists.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-if (NOT CMAKE_SYSTEM_NAME MATCHES "Linux")
-  return ()
-endif ()
-
-include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake)
-
-add_library(lldb-intel-mpxtable SHARED
-  IntelMPXTablePlugin.cpp
-  )
-
-target_link_libraries(lldb-intel-mpxtable
-  PUBLIC liblldb LLVMSupport)
-
-install(TARGETS lldb-intel-mpxtable
-  LIBRARY DESTINATION bin)
Index: tools/intel-features/scripts/python-typemaps.txt
===
--- /dev/null
+++ tools/intel-features/scripts/python-typemaps.txt
@@ -0,0 +1,15 @@
+/* Typemap definitions to allow SWIG to properly handle some data types */
+
+// typemap for a char buffer
+%typemap(in) (char *dst, size_t dst_len) {
+   if (!PyInt_Check($input)) {
+   PyErr_SetString(PyExc_ValueError, "Expecting an integer");
+   return NULL;
+   }
+   $2 = PyInt_AsLong($input);
+   if ($2 <= 0) {
+   PyErr_SetString(PyExc_ValueError, "Positive integer expected");
+   return NULL;
+   }
+   $1 = (char *) malloc($2);
+}
Index: tools/intel-features/scripts/lldb-intel-features.swig
===
--- /dev/null
+++ tools/intel-features/scripts/lldb-intel-features.swig
@@ -0,0 +1,16 @@
+%module lldbIntelFeatures
+
+%{
+#include "lldb/lldb-public.h"
+#include "intel-pt/PTDecoder.h"
+using namespace ptdecoder;
+%}
+
+/* Undefine GCC keyword to make Swig happy when processing glibc's stdint.h */
+#define __extension__
+
+/* Combined python typemap for all features */
+%include "python-typemaps.txt"
+
+/* Feature specific python interface files*/
+%include "../intel-pt/interface/PTDecoder.i"
Index: tools/intel-features/scripts/CMakeLists.txt
===
--- /dev/null
+++ tools/intel-features/scripts/CMakeLists.txt
@@ -0,0 +1,37 @@
+file(GLOB_RECURSE SWIG_SOURCES *.swig)
+
+set(FLAGS
+  -c++
+  -shadow
+  -python
+  -D__STDC_LIMIT_MACROS
+  -D__STDC_CONSTANT_MACROS
+  )
+
+set(INCLUDES
+  -I${LLDB_SOURCE_DIR}/include
+  -I${LLDB_SOURCE_DIR}/tools/intel-features/intel-pt
+  )
+
+set(OUTPUT_PYTHON_WRAPPER
+  ${CMAKE_CURRENT_BINARY_DIR}/IntelFeaturesPythonWrap.cpp
+  )
+
+set(OUTPUT_PYTHON_SCRIPT_DIR
+  ${CMAKE_CURRENT_BINARY_DIR}
+  )
+
+find_package(SWIG REQUIRED)
+add_custom_command(
+  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/IntelFeaturesPythonWrap.cpp
+  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lldbIntelFeatures.py
+  DEPENDS ${SWIG_SOURCES}
+  COMMAND ${SWIG_EXECUTABLE} ${FLAGS} ${INCLUDES} -o ${OUTPUT_PYTHON_WRAPPER} -outdir ${OUTPUT_PYTHON_SCRIPT_DIR} ${SWIG_SOURCES}
+  COMMENT "Generating python wrapper for features library")
+
+set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/IntelFeaturesPythonWrap.cpp PROPERTIES GENERATED 1)
+set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/lldbIntelFeatures.py PROPERTIES GENERATED 1)
+
+add_custom_target(intel-features-swig_wrapper ALL
+  DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/IntelFeaturesPythonWrap.cpp
+  )
Index: tools/intel-features/intel-pt/interface/PTDecoder.i
===
--- /dev/null
+++ tools/intel-features/intel-pt/interface/PTDecoder.i
@@ -0,0 +1,13 @@
+%include "stdint.i"
+%include "std_string.i"
+%include "std_vector.i"
+
+%include "lldb/lldb-defines.h"
+%include "lldb/lldb-enumerations.h"

[Lldb-commits] [PATCH] D33035: Tool for using Intel(R) Processor Trace hardware feature

2017-06-28 Thread Abhishek via Phabricator via lldb-commits
abhishek.aggarwal added a comment.

Hi Pavel .. I have made the changes you suggested. My apologies for 
misinterpreting your previous comments but during written communications, it is 
sometimes difficult to interpret everything correctly. I have tried following 
LLDB's coding conventions and guidelines. Please let me know if I still missed 
things that you would have liked to see in this patch. Thanks for your patience 
:)




Comment at: tools/intel-features/CMakeLists.txt:16
+endif()
+
+if (NOT LLDB_DISABLE_PYTHON AND LLDB_BUILD_INTEL_PT)

labath wrote:
> Could we avoid building the shared library altogether if both features are 
> OFF?
yes. Adding the check.



Comment at: tools/intel-features/cli-wrapper.cpp:27
+bool lldb::PluginInitialize(lldb::SBDebugger debugger) {
+  PTPluginInitialize(debugger);
+  MPXPluginInitialize(debugger);

labath wrote:
> You will need some ifdef magic to make sure these still compile when the 
> feature is off.
Fixed it.



Comment at: tools/intel-features/intel-mpx/CMakeLists.txt:9
+
+set(MPX_DEPS ${MPX_DEPS} LLVMSupport PARENT_SCOPE)

labath wrote:
> What you want here is to define an INTERFACE dependency on the MPX library 
> instead.
> vanilla cmake way would be `target_link_libraries(lldbIntelMPX INTERFACE 
> LLVMSupport)`. **However**, we should use the llvm function instead, as that 
> also handles other llvm-specific magic (for example, this code will break if 
> someone does a LLVM_LINK_LLVM_DYLIB build).
> 
> So, I am asking for the third time:
> Have you tried using add_lldb_library instead?
> 
> The correct invocation should be `add_lldb_library(foo.cpp LINK_LIBS 
> Support)` and the rest of this file can just go away.
I am extremely sorry Pavel but I understood it now what you were trying to say 
in previous comments. Sorry about misinterpreting your comments before. I have 
used add_lldb_library function now. Please see them in the next patch set.



Comment at: tools/intel-features/scripts/lldb-intel-features.swig:9
+
+/* Various liblldb typedefs that SWIG needs to know about.*/
+#define __extension__ /* Undefine GCC keyword to make Swig happy when

labath wrote:
> There appear to be no typedefs here.
Forgot to remove this. Doing it.



Comment at: tools/intel-features/scripts/lldb-intel-features.swig:14
+   as INT32_MAX should only be defined if __STDC_LIMIT_MACROS is. */
+#define __STDC_LIMIT_MACROS
+%include "python-typemaps.txt"

labath wrote:
> You are already defining this as a part of the swig invocation in cmake.
removing it.


https://reviews.llvm.org/D33035



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


[Lldb-commits] [PATCH] D34746: Move Timer and TraceOptions from Core to Utility

2017-06-28 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
Herald added subscribers: mgorny, emaste.

The classes have no dependencies, and they are used both by lldb and
lldb-server, so it makes sense for them to live in the lowest layers.


https://reviews.llvm.org/D34746

Files:
  include/lldb/Core/Timer.h
  include/lldb/Core/TraceOptions.h
  include/lldb/Host/common/NativeProcessProtocol.h
  include/lldb/Target/Process.h
  include/lldb/Utility/Timer.h
  include/lldb/Utility/TraceOptions.h
  source/API/SBTraceOptions.cpp
  source/API/SystemInitializerFull.cpp
  source/Commands/CommandObjectFrame.cpp
  source/Commands/CommandObjectLog.cpp
  source/Commands/CommandObjectTarget.cpp
  source/Core/CMakeLists.txt
  source/Core/Disassembler.cpp
  source/Core/Mangled.cpp
  source/Core/Module.cpp
  source/Core/Timer.cpp
  source/Host/common/Symbols.cpp
  source/Host/posix/ConnectionFileDescriptorPosix.cpp
  source/Initialization/SystemInitializerCommon.cpp
  source/Interpreter/CommandInterpreter.cpp
  source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
  source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
  source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
  source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
  source/Plugins/Process/Linux/ProcessorTrace.h
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
  source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
  source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
  source/Symbol/DWARFCallFrameInfo.cpp
  source/Symbol/ObjectFile.cpp
  source/Symbol/Symtab.cpp
  source/Target/ObjCLanguageRuntime.cpp
  source/Target/Target.cpp
  source/Target/TargetList.cpp
  source/Utility/CMakeLists.txt
  source/Utility/Timer.cpp
  unittests/Core/CMakeLists.txt
  unittests/Core/TimerTest.cpp
  unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
  unittests/Utility/CMakeLists.txt
  unittests/Utility/TimerTest.cpp

Index: unittests/Utility/TimerTest.cpp
===
--- unittests/Utility/TimerTest.cpp
+++ unittests/Utility/TimerTest.cpp
@@ -7,10 +7,9 @@
 //
 //===--===//
 
-#include "lldb/Core/Timer.h"
-#include "gtest/gtest.h"
-
 #include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/Timer.h"
+#include "gtest/gtest.h"
 #include 
 
 using namespace lldb_private;
Index: unittests/Utility/CMakeLists.txt
===
--- unittests/Utility/CMakeLists.txt
+++ unittests/Utility/CMakeLists.txt
@@ -10,6 +10,7 @@
   TaskPoolTest.cpp
   TildeExpressionResolverTest.cpp
   TimeoutTest.cpp
+  TimerTest.cpp
   UriParserTest.cpp
   VASprintfTest.cpp
 
Index: unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
===
--- unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
+++ unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
@@ -12,10 +12,10 @@
 
 #include "Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h"
 #include "lldb/Core/ModuleSpec.h"
-#include "lldb/Core/TraceOptions.h"
 #include "lldb/Target/MemoryRegionInfo.h"
 #include "lldb/Utility/DataBuffer.h"
 #include "lldb/Utility/StructuredData.h"
+#include "lldb/Utility/TraceOptions.h"
 #include "lldb/lldb-enumerations.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/Testing/Support/Error.h"
Index: unittests/Core/CMakeLists.txt
===
--- unittests/Core/CMakeLists.txt
+++ unittests/Core/CMakeLists.txt
@@ -6,7 +6,6 @@
   ScalarTest.cpp
   StateTest.cpp
   StreamCallbackTest.cpp
-  TimerTest.cpp
 
   LINK_LIBS
 lldbCore
Index: source/Utility/Timer.cpp
===
--- source/Utility/Timer.cpp
+++ source/Utility/Timer.cpp
@@ -6,11 +6,9 @@
 // License. See LICENSE.TXT for details.
 //
 //===--===//
-#include "lldb/Core/Timer.h"
-
+#include "lldb/Utility/Timer.h"
 #include "lldb/Host/Host.h"
 #include "lldb/Utility/Stream.h"
-#include "lldb/lldb-types.h" // for thread_key_t
 
 #include 
 #include 
Index: source/Utility/CMakeLists.txt
===
--- source/Utility/CMakeLists.txt
+++ source/Utility/CMakeLists.txt
@@ -31,6 

[Lldb-commits] [PATCH] D34683: [unittests] Add a helper function for getting an input file

2017-06-28 Thread Pavel Labath via Phabricator via lldb-commits
labath marked an inline comment as done.
labath added a comment.

In https://reviews.llvm.org/D34683#792736, @eugene wrote:

> The only comment I have is about location of TestUtilities.cpp.
>  Utility\Helpers kinda implies that these are helpers for Utility tests which 
> is not true.
>
> I would move it up one level up lldb/unittests/TestUtilities.cpp


Hm.. that makes sort of sense for this function.

However, right now I can't think of any other utility function that would go 
here. OTOH, I have a couple of ideas about the use of the `XXX/Helpers/YYY.h` 
pattern. For example, in `Host/Helpers` we could have a utility function which 
creates two connected sockets (already needed for a couple tests), and 
`Core/Helpers` could contain mocked versions of various Process/Target/... 
classes (as no higher level functionality can be tested without one of those 
around).

That's why I'd like to avoid creating a module if it's going to contain just 
this function. And with that in mind putting in in Utility/Helpers makes sense 
as that's the place everyone can pull it from without grabbing additional 
dependencies.


https://reviews.llvm.org/D34683



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


[Lldb-commits] [PATCH] D34681: [DWARFCallFrameInfo] Add Type enum to differentiate eh/debug_frame sections

2017-06-28 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL306521: [DWARFCallFrameInfo] Add Type enum to differentiate 
eh/debug_frame sections (authored by labath).

Repository:
  rL LLVM

https://reviews.llvm.org/D34681

Files:
  lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h
  lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp
  lldb/trunk/source/Symbol/UnwindTable.cpp
  lldb/trunk/unittests/Symbol/TestDWARFCallFrameInfo.cpp

Index: lldb/trunk/unittests/Symbol/TestDWARFCallFrameInfo.cpp
===
--- lldb/trunk/unittests/Symbol/TestDWARFCallFrameInfo.cpp
+++ lldb/trunk/unittests/Symbol/TestDWARFCallFrameInfo.cpp
@@ -46,7 +46,7 @@
 protected:
   llvm::SmallString<128> m_inputs_folder;
 
-  void TestBasic(bool eh_frame, llvm::StringRef symbol);
+  void TestBasic(DWARFCallFrameInfo::Type type, llvm::StringRef symbol);
 };
 
 #define ASSERT_NO_ERROR(x) \
@@ -94,7 +94,8 @@
   return row;
 }
 
-void DWARFCallFrameInfoTest::TestBasic(bool eh_frame, llvm::StringRef symbol) {
+void DWARFCallFrameInfoTest::TestBasic(DWARFCallFrameInfo::Type type,
+   llvm::StringRef symbol) {
   llvm::SmallString<128> yaml = m_inputs_folder;
   llvm::sys::path::append(yaml, "basic-call-frame-info.yaml");
   llvm::SmallString<128> obj = m_inputs_folder;
@@ -116,13 +117,13 @@
   SectionList *list = module_sp->GetSectionList();
   ASSERT_NE(nullptr, list);
 
-  auto section_sp = list->FindSectionByType(
-  eh_frame ? eSectionTypeEHFrame : eSectionTypeDWARFDebugFrame, false);
+  auto section_sp = list->FindSectionByType(type == DWARFCallFrameInfo::EH
+? eSectionTypeEHFrame
+: eSectionTypeDWARFDebugFrame,
+false);
   ASSERT_NE(nullptr, section_sp);
 
-  DWARFCallFrameInfo cfi(*module_sp->GetObjectFile(), section_sp,
- eh_frame ? eRegisterKindEHFrame : eRegisterKindDWARF,
- eh_frame);
+  DWARFCallFrameInfo cfi(*module_sp->GetObjectFile(), section_sp, type);
 
   const Symbol *sym = module_sp->FindFirstSymbolWithNameAndType(
   ConstString(symbol), eSymbolTypeAny);
@@ -137,11 +138,13 @@
 }
 
 TEST_F(DWARFCallFrameInfoTest, Basic_dwarf3) {
-  TestBasic(false, "debug_frame3");
+  TestBasic(DWARFCallFrameInfo::DWARF, "debug_frame3");
 }
 
 TEST_F(DWARFCallFrameInfoTest, Basic_dwarf4) {
-  TestBasic(false, "debug_frame4");
+  TestBasic(DWARFCallFrameInfo::DWARF, "debug_frame4");
 }
 
-TEST_F(DWARFCallFrameInfoTest, Basic_eh) { TestBasic(true, "eh_frame"); }
+TEST_F(DWARFCallFrameInfoTest, Basic_eh) {
+  TestBasic(DWARFCallFrameInfo::EH, "eh_frame");
+}
Index: lldb/trunk/source/Symbol/UnwindTable.cpp
===
--- lldb/trunk/source/Symbol/UnwindTable.cpp
+++ lldb/trunk/source/Symbol/UnwindTable.cpp
@@ -52,14 +52,14 @@
 
   SectionSP sect = sl->FindSectionByType(eSectionTypeEHFrame, true);
   if (sect.get()) {
-m_eh_frame_up.reset(new DWARFCallFrameInfo(m_object_file, sect,
-   eRegisterKindEHFrame, true));
+m_eh_frame_up.reset(
+new DWARFCallFrameInfo(m_object_file, sect, DWARFCallFrameInfo::EH));
   }
 
   sect = sl->FindSectionByType(eSectionTypeDWARFDebugFrame, true);
   if (sect) {
 m_debug_frame_up.reset(
-new DWARFCallFrameInfo(m_object_file, sect, eRegisterKindDWARF, false));
+new DWARFCallFrameInfo(m_object_file, sect, DWARFCallFrameInfo::DWARF));
   }
 
   sect = sl->FindSectionByType(eSectionTypeCompactUnwind, true);
Index: lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp
===
--- lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp
+++ lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp
@@ -151,15 +151,8 @@
 }
 
 DWARFCallFrameInfo::DWARFCallFrameInfo(ObjectFile ,
-   SectionSP _sp,
-   lldb::RegisterKind reg_kind,
-   bool is_eh_frame)
-: m_objfile(objfile), m_section_sp(section_sp),
-  m_reg_kind(reg_kind), // The flavor of registers that the CFI data uses
-// (enum RegisterKind)
-  m_flags(), m_cie_map(), m_cfi_data(), m_cfi_data_initialized(false),
-  m_fde_index(), m_fde_index_initialized(false),
-  m_is_eh_frame(is_eh_frame) {}
+   SectionSP _sp, Type type)
+: m_objfile(objfile), m_section_sp(section_sp), m_type(type) {}
 
 bool DWARFCallFrameInfo::GetUnwindPlan(Address addr, UnwindPlan _plan) {
   FDEEntryMap::Entry fde_entry;
@@ -266,8 +259,8 @@
 cie_id = m_cfi_data.GetU32();
 end_offset = 

[Lldb-commits] [lldb] r306521 - [DWARFCallFrameInfo] Add Type enum to differentiate eh/debug_frame sections

2017-06-28 Thread Pavel Labath via lldb-commits
Author: labath
Date: Wed Jun 28 02:09:19 2017
New Revision: 306521

URL: http://llvm.org/viewvc/llvm-project?rev=306521=rev
Log:
[DWARFCallFrameInfo] Add Type enum to differentiate eh/debug_frame sections

Summary:
instead of using a boolean to differentiate between the two section
types, use an enum to make the intent clearer.

I also remove the RegisterKind argument from the constructor, as this
can be deduced from the Type argument.

Reviewers: clayborg, jasonmolenda

Subscribers: lldb-commits

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

Modified:
lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h
lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp
lldb/trunk/source/Symbol/UnwindTable.cpp
lldb/trunk/unittests/Symbol/TestDWARFCallFrameInfo.cpp

Modified: lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h?rev=306521=306520=306521=diff
==
--- lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h (original)
+++ lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h Wed Jun 28 02:09:19 2017
@@ -34,8 +34,9 @@ namespace lldb_private {
 
 class DWARFCallFrameInfo {
 public:
-  DWARFCallFrameInfo(ObjectFile , lldb::SectionSP ,
- lldb::RegisterKind reg_kind, bool is_eh_frame);
+  enum Type { EH, DWARF };
+
+  DWARFCallFrameInfo(ObjectFile , lldb::SectionSP , Type type);
 
   ~DWARFCallFrameInfo() = default;
 
@@ -142,21 +143,24 @@ private:
 
   ObjectFile _objfile;
   lldb::SectionSP m_section_sp;
-  lldb::RegisterKind m_reg_kind;
-  Flags m_flags;
+  Flags m_flags = 0;
   cie_map_t m_cie_map;
 
   DataExtractor m_cfi_data;
-  bool m_cfi_data_initialized; // only copy the section into the DE once
+  bool m_cfi_data_initialized = false; // only copy the section into the DE 
once
 
   FDEEntryMap m_fde_index;
-  bool m_fde_index_initialized; // only scan the section for FDEs once
+  bool m_fde_index_initialized = false; // only scan the section for FDEs once
   std::mutex m_fde_index_mutex; // and isolate the thread that does it
 
-  bool m_is_eh_frame;
+  Type m_type;
 
   CIESP
   ParseCIE(const uint32_t cie_offset);
+
+  lldb::RegisterKind GetRegisterKind() const {
+return m_type == EH ? lldb::eRegisterKindEHFrame : 
lldb::eRegisterKindDWARF;
+  }
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=306521=306520=306521=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Wed Jun 28 
02:09:19 2017
@@ -2502,7 +2502,7 @@ size_t ObjectFileMachO::ParseSymtab() {
   if (text_section_sp.get() && eh_frame_section_sp.get() &&
   m_type != eTypeDebugInfo) {
 DWARFCallFrameInfo eh_frame(*this, eh_frame_section_sp,
-eRegisterKindEHFrame, true);
+DWARFCallFrameInfo::EH);
 DWARFCallFrameInfo::FunctionAddressAndSizeVector functions;
 eh_frame.GetFunctionAddressAndSizeVector(functions);
 addr_t text_base_addr = text_section_sp->GetFileAddress();

Modified: lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp?rev=306521=306520=306521=diff
==
--- lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp (original)
+++ lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp Wed Jun 28 02:09:19 2017
@@ -151,15 +151,8 @@ GetGNUEHPointer(const DataExtractor ,
 }
 
 DWARFCallFrameInfo::DWARFCallFrameInfo(ObjectFile ,
-   SectionSP _sp,
-   lldb::RegisterKind reg_kind,
-   bool is_eh_frame)
-: m_objfile(objfile), m_section_sp(section_sp),
-  m_reg_kind(reg_kind), // The flavor of registers that the CFI data uses
-// (enum RegisterKind)
-  m_flags(), m_cie_map(), m_cfi_data(), m_cfi_data_initialized(false),
-  m_fde_index(), m_fde_index_initialized(false),
-  m_is_eh_frame(is_eh_frame) {}
+   SectionSP _sp, Type type)
+: m_objfile(objfile), m_section_sp(section_sp), m_type(type) {}
 
 bool DWARFCallFrameInfo::GetUnwindPlan(Address addr, UnwindPlan _plan) {
   FDEEntryMap::Entry fde_entry;
@@ -266,8 +259,8 @@ DWARFCallFrameInfo::ParseCIE(const dw_of
 cie_id = m_cfi_data.GetU32();
 end_offset = cie_offset + length + 4;
   }
-  if (length > 0 && ((!m_is_eh_frame && 

[Lldb-commits] [PATCH] D34681: [DWARFCallFrameInfo] Add Type enum to differentiate eh/debug_frame sections

2017-06-28 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In https://reviews.llvm.org/D34681#792602, @tatyana-krasnukha wrote:

> Saying about clear intent, it would be even much more better if class name 
> doesn't start with DWARF ;)


That's probably true. :) However, I think I've done enough of renaming of files 
lately that I will pass on this one for now.


https://reviews.llvm.org/D34681



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


[Lldb-commits] [lldb] r306520 - Linux unit tests should only run on

2017-06-28 Thread Ravitheja Addepally via lldb-commits
Author: ravitheja
Date: Wed Jun 28 02:01:17 2017
New Revision: 306520

URL: http://llvm.org/viewvc/llvm-project?rev=306520=rev
Log:
Linux unit tests should only run on
Linux based systems.

Modified:
lldb/trunk/unittests/Process/CMakeLists.txt

Modified: lldb/trunk/unittests/Process/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Process/CMakeLists.txt?rev=306520=306519=306520=diff
==
--- lldb/trunk/unittests/Process/CMakeLists.txt (original)
+++ lldb/trunk/unittests/Process/CMakeLists.txt Wed Jun 28 02:01:17 2017
@@ -1,3 +1,5 @@
 add_subdirectory(gdb-remote)
-add_subdirectory(Linux)
+if (CMAKE_SYSTEM_NAME MATCHES "Linux|Android")
+  add_subdirectory(Linux)
+endif()
 add_subdirectory(minidump)


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


[Lldb-commits] [lldb] r306516 - Implementation of Intel(R) Processor Trace support for Linux

2017-06-28 Thread Ravitheja Addepally via lldb-commits
Author: ravitheja
Date: Wed Jun 28 00:58:31 2017
New Revision: 306516

URL: http://llvm.org/viewvc/llvm-project?rev=306516=rev
Log:
Implementation of Intel(R) Processor Trace support for Linux

Summary:
This patch implements support for Intel(R) Processor Trace
in lldb server. The changes have support for
starting/stopping and reading the trace data. The code
is only available on Linux versions where the perf
attributes for aux buffers are available.

The patch also consists of Unit tests for testing the
core buffer reading function.

Reviewers: lldb-commits, labath, clayborg, zturner, tberghammer

Reviewed By: labath, clayborg

Subscribers: mgorny

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

Added:
lldb/trunk/source/Plugins/Process/Linux/ProcessorTrace.cpp
lldb/trunk/source/Plugins/Process/Linux/ProcessorTrace.h
lldb/trunk/unittests/Process/Linux/
lldb/trunk/unittests/Process/Linux/CMakeLists.txt
lldb/trunk/unittests/Process/Linux/ProcessorTraceTest.cpp
Modified:
lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h
lldb/trunk/include/lldb/Host/linux/Support.h
lldb/trunk/source/Host/linux/Support.cpp
lldb/trunk/source/Plugins/Process/Linux/CMakeLists.txt
lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
lldb/trunk/unittests/Process/CMakeLists.txt

Modified: lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h?rev=306516=306515=306516=diff
==
--- lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h (original)
+++ lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h Wed Jun 28 
00:58:31 2017
@@ -333,7 +333,7 @@ public:
   //--
   /// StopTracing API as the name suggests stops a tracing instance.
   ///
-  /// @param[in] uid
+  /// @param[in] traceid
   /// The user id of the trace intended to be stopped. Now a
   /// user_id may map to multiple threads in which case this API
   /// could be used to stop the tracing for a specific thread by
@@ -346,7 +346,7 @@ public:
   /// @return
   /// Status indicating what went wrong.
   //--
-  virtual Status StopTrace(lldb::user_id_t uid,
+  virtual Status StopTrace(lldb::user_id_t traceid,
lldb::tid_t thread = LLDB_INVALID_THREAD_ID) {
 return Status("Not implemented");
   }
@@ -355,8 +355,8 @@ public:
   /// This API provides the trace data collected in the form of raw
   /// data.
   ///
-  /// @param[in] uid thread
-  /// The uid and thread provide the context for the trace
+  /// @param[in] traceid thread
+  /// The traceid and thread provide the context for the trace
   /// instance.
   ///
   /// @param[in] buffer
@@ -372,7 +372,7 @@ public:
   /// @return
   /// The size of the data actually read.
   //--
-  virtual Status GetData(lldb::user_id_t uid, lldb::tid_t thread,
+  virtual Status GetData(lldb::user_id_t traceid, lldb::tid_t thread,
  llvm::MutableArrayRef ,
  size_t offset = 0) {
 return Status("Not implemented");
@@ -382,7 +382,7 @@ public:
   /// Similar API as above except it aims to provide any extra data
   /// useful for decoding the actual trace data.
   //--
-  virtual Status GetMetaData(lldb::user_id_t uid, lldb::tid_t thread,
+  virtual Status GetMetaData(lldb::user_id_t traceid, lldb::tid_t thread,
  llvm::MutableArrayRef ,
  size_t offset = 0) {
 return Status("Not implemented");
@@ -391,7 +391,7 @@ public:
   //--
   /// API to query the TraceOptions for a given user id
   ///
-  /// @param[in] uid
+  /// @param[in] traceid
   /// The user id of the tracing instance.
   ///
   /// @param[in] config
@@ -405,7 +405,7 @@ public:
   /// @param[out] config
   /// The actual configuration being used for tracing.
   //--
-  virtual Status GetTraceConfig(lldb::user_id_t uid, TraceOptions ) {
+  virtual Status GetTraceConfig(lldb::user_id_t traceid, TraceOptions ) 
{
 return Status("Not implemented");
   }
 

Modified: lldb/trunk/include/lldb/Host/linux/Support.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/linux/Support.h?rev=306516=306515=306516=diff
==
---