[Lldb-commits] [PATCH] D31231: Reuse appropriate Launch and Attach on NetBSD

2017-03-21 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski created this revision.
krytarowski added a project: LLDB.
Herald added a subscriber: mgorny.

NetBSD ships with NativeProcessNetBSD  inherited from NativeProcessProtocol.

Link Plugins/Process/gdb-remote with lldbPluginProcessNetBSD in order to resolve
correctly the linking to Launch and Attach from the NetBSD plugin.

Sponsored by 


Repository:
  rL LLVM

https://reviews.llvm.org/D31231

Files:
  source/Host/common/NativeProcessProtocol.cpp
  source/Plugins/Process/gdb-remote/CMakeLists.txt


Index: source/Plugins/Process/gdb-remote/CMakeLists.txt
===
--- source/Plugins/Process/gdb-remote/CMakeLists.txt
+++ source/Plugins/Process/gdb-remote/CMakeLists.txt
@@ -11,6 +11,10 @@
   list(APPEND LLDB_PLUGINS lldbPluginProcessLinux)
 endif()
 
+if(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
+  list(APPEND LLDB_PLUGINS lldbPluginProcessNetBSD)
+endif()
+
 add_lldb_library(lldbPluginProcessGDBRemote PLUGIN
   GDBRemoteClientBase.cpp
   GDBRemoteCommunication.cpp
Index: source/Host/common/NativeProcessProtocol.cpp
===
--- source/Host/common/NativeProcessProtocol.cpp
+++ source/Host/common/NativeProcessProtocol.cpp
@@ -504,7 +504,7 @@
 return Error("failed to retrieve a valid architecture from the exe 
module");
 }
 
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__NetBSD__)
 // These need to be implemented to support lldb-gdb-server on a given platform.
 // Stubs are
 // provided to make the rest of the code link on non-supported platforms.


Index: source/Plugins/Process/gdb-remote/CMakeLists.txt
===
--- source/Plugins/Process/gdb-remote/CMakeLists.txt
+++ source/Plugins/Process/gdb-remote/CMakeLists.txt
@@ -11,6 +11,10 @@
   list(APPEND LLDB_PLUGINS lldbPluginProcessLinux)
 endif()
 
+if(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
+  list(APPEND LLDB_PLUGINS lldbPluginProcessNetBSD)
+endif()
+
 add_lldb_library(lldbPluginProcessGDBRemote PLUGIN
   GDBRemoteClientBase.cpp
   GDBRemoteCommunication.cpp
Index: source/Host/common/NativeProcessProtocol.cpp
===
--- source/Host/common/NativeProcessProtocol.cpp
+++ source/Host/common/NativeProcessProtocol.cpp
@@ -504,7 +504,7 @@
 return Error("failed to retrieve a valid architecture from the exe module");
 }
 
-#ifndef __linux__
+#if !defined(__linux__) && !defined(__NetBSD__)
 // These need to be implemented to support lldb-gdb-server on a given platform.
 // Stubs are
 // provided to make the rest of the code link on non-supported platforms.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] Buildbot numbers for the week of 03/12/2017 - 03/18/2017

2017-03-21 Thread Galina Kistanova via lldb-commits
Hello everyone,

Below are some buildbot numbers for the last week of 03/12/2017 -
03/18/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
+-
 sanitizer-x86_64-linux | 61:48:26
 sanitizer-windows  | 38:12:04
 clang-cmake-mipsel | 38:03:10
 clang-x86-windows-msvc2015 | 37:58:47
 perf-x86_64-penryn-O3-polly-before-vectorizer  | 25:00:41
 clang-cmake-aarch64-lld| 23:59:46
 clang-s390x-linux  | 23:07:48
 clang-lld-x86_64-2stage| 20:07:59
 perf-x86_64-penryn-O3  | 19:04:33
 clang-cmake-armv7-a15-selfhost-neon| 18:27:27
 llvm-clang-x86_64-expensive-checks-win | 18:14:44
 perf-x86_64-penryn-O3-polly-before-vectorizer-detect-only  | 18:14:14
 sanitizer-ppc64be-linux| 17:17:10
 clang-cmake-armv7-a15  | 16:40:31
 clang-with-thin-lto-ubuntu | 16:13:12
 sanitizer-ppc64le-linux| 15:51:09
 clang-cmake-mips   | 15:46:41
 clang-cmake-aarch64-full   | 15:39:30
 clang-with-lto-ubuntu  | 15:30:43
 clang-ppc64be-linux-lnt| 15:19:24
 perf-x86_64-penryn-O3-polly-parallel-fast  | 14:51:42
 clang-native-arm-lnt   | 14:45:39
 clang-ppc64be-linux-multistage | 14:41:51
 perf-x86_64-penryn-O3-polly-unprofitable   | 14:39:51
 clang-bpf-build| 14:33:46
 lldb-x86_64-ubuntu-14.04-buildserver   | 14:27:23
 lldb-amd64-ninja-netbsd7   | 14:26:45
 perf-x86_64-penryn-O3-polly| 14:25:25
 clang-ppc64le-linux-multistage | 14:24:48
 clang-cmake-armv7-a15-selfhost | 14:23:26
 clang-cmake-thumbv7-a15-full-sh| 14:11:28
 clang-cmake-aarch64-quick  | 14:09:20
 clang-ppc64be-linux| 14:09:05
 llvm-mips-linux| 14:07:30
 clang-cmake-armv7-a15-full | 14:07:08
 clang-x86_64-linux-selfhost-modules-2  | 14:03:30
 clang-cmake-aarch64-39vma  | 14:03:17
 clang-atom-d525-fedora-rel | 14:02:10
 sanitizer-x86_64-linux-bootstrap   | 14:01:46
 clang-cmake-aarch64-42vma  | 14:00:21
 clang-x86_64-linux-selfhost-modules| 13:59:52
 lldb-x86-windows-msvc2015  | 13:59:01
 clang-hexagon-elf  | 13:56:33
 clang-ppc64le-linux| 13:55:16
 polly-amd64-linux  | 13:52:16
 clang-ppc64le-linux-lnt| 13:49:21
 lld-x86_64-freebsd | 13:46:54
 lld-x86_64-darwin13| 13:46:18
 clang-cuda-build   | 13:44:58
 lld-x86_64-win7| 13:43:40
 clang-x86_64-linux-abi-test| 13:41:21
 llvm-hexagon-elf   | 13:41:13
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast | 13:41:06
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast   | 13:39:03
 sanitizer-x86_64-linux-fast| 13:36:57
 polly-arm-linux| 13:35:42
 clang-x86_64-debian-fast   | 13:26:42
 lldb-amd64-ninja-freebsd11 | 13:20:26
 perf-x86_64-penryn-O3-polly-before-vectorizer-unprofitable | 12:49:29
 clang-cmake-thumbv7-a15 

[Lldb-commits] Buildbot numbers for the week of 03/05/2017 - 03/11/2017

2017-03-21 Thread Galina Kistanova via lldb-commits
Hello everyone,

Below are some buildbot numbers for the week of 03/05/2017 - 03/11/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-bpf-build| 132:35:47
 clang-x86-windows-msvc2015 | 102:23:37
 clang-lld-x86_64-2stage| 80:38:29
 sanitizer-x86_64-linux-fast| 51:15:06
 clang-cmake-aarch64-lld| 50:56:29
 sanitizer-x86_64-linux-bootstrap   | 48:22:47
 clang-cmake-mipsel | 44:13:26
 clang-ppc64le-linux-multistage | 39:58:29
 lldb-x86-windows-msvc2015  | 39:52:30
 clang-ppc64le-linux| 39:11:59
 sanitizer-x86_64-linux | 36:25:13
 clang-ppc64le-linux-lnt| 36:07:38
 lldb-windows7-android  | 35:13:43
 sanitizer-ppc64le-linux| 35:08:56
 lldb-x86_64-ubuntu-14.04-android   | 32:03:01
 lldb-x86_64-darwin-13.4| 31:37:06
 lldb-x86_64-ubuntu-14.04-cmake | 31:33:08
 libcxx-libcxxabi-x86_64-linux-ubuntu-msan  | 17:53:02
 perf-x86_64-penryn-O3-polly-before-vectorizer  | 16:39:21
 llvm-clang-x86_64-expensive-checks-win | 13:51:22
 clang-cmake-armv7-a15-selfhost-neon| 10:41:11
 clang-cmake-armv7-a15-selfhost | 10:27:10
 clang-with-thin-lto-ubuntu | 10:01:08
 perf-x86_64-penryn-O3-polly-before-vectorizer-detect-only  | 09:16:35
 sanitizer-ppc64be-linux| 08:46:00
 clang-x86_64-debian-fast   | 08:41:18
 clang-with-lto-ubuntu  | 08:20:38
 clang-cmake-mips   | 08:03:57
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast | 07:09:51
 clang-cmake-aarch64-full   | 06:30:01
 clang-3stage-ubuntu| 06:22:09
 lld-x86_64-darwin13| 05:54:50
 polly-amd64-linux  | 04:46:29
 perf-x86_64-penryn-O3-polly-parallel-fast  | 04:24:41
 clang-s390x-linux  | 04:14:21
 libcxx-libcxxabi-libunwind-aarch64-linux   | 04:10:47
 clang-x86_64-linux-selfhost-modules-2  | 04:09:15
 sanitizer-windows  | 03:51:36
 clang-cmake-thumbv7-a15-full-sh| 03:50:56
 perf-x86_64-penryn-O3-polly-unprofitable   | 03:36:02
 clang-x86_64-linux-selfhost-modules| 03:11:39
 clang-cmake-thumbv7-a15| 02:54:48
 lld-x86_64-freebsd | 02:51:07
 perf-x86_64-penryn-O3-polly-before-vectorizer-unprofitable | 02:46:45
 clang-ppc64be-linux-lnt| 02:38:54
 clang-cmake-armv7-a15  | 02:38:54
 sanitizer-x86_64-linux-fuzzer  | 02:29:45
 clang-ppc64be-linux| 02:21:44
 clang-cmake-armv7-a15-full | 01:59:38
 clang-cmake-aarch64-39vma  | 01:49:13
 clang-ppc64be-linux-multistage | 01:48:31
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast   | 01:46:08
 clang-cuda-build   | 01:44:36
 clang-hexagon-elf  | 01:40:48
 clang-cmake-aarch64-quick  | 01:30:09
 lldb-amd64-ninja-netbsd7   | 01:21:06
 polly-arm-linux| 01:20:07
 clang-cmake-aarch64-42vma  | 00:59:38
 clang-atom-d525-fedora-rel | 00:57:23
 

[Lldb-commits] [PATCH] D31129: Remove remaining platform specific code from FileSpec

2017-03-21 Thread Zachary Turner via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL298465: Delete the remainder of platform specific code in 
FileSpec. (authored by zturner).

Changed prior to commit:
  https://reviews.llvm.org/D31129?vs=92373=92577#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31129

Files:
  lldb/trunk/include/lldb/Host/FileSpec.h
  lldb/trunk/include/lldb/Utility/TildeExpressionResolver.h
  lldb/trunk/source/API/SBDeclaration.cpp
  lldb/trunk/source/API/SBFileSpec.cpp
  lldb/trunk/source/API/SBFileSpecList.cpp
  lldb/trunk/source/API/SBLineEntry.cpp
  lldb/trunk/source/Host/common/FileSpec.cpp
  lldb/trunk/source/Host/windows/FileSystem.cpp
  lldb/trunk/source/Host/windows/HostInfoWindows.cpp
  lldb/trunk/source/Target/TargetList.cpp
  lldb/trunk/source/Utility/TildeExpressionResolver.cpp
  lldb/trunk/unittests/CMakeLists.txt
  lldb/trunk/unittests/Interpreter/CMakeLists.txt
  lldb/trunk/unittests/Interpreter/TestCompletion.cpp
  lldb/trunk/unittests/Utility/CMakeLists.txt
  lldb/trunk/unittests/Utility/Mocks/CMakeLists.txt
  lldb/trunk/unittests/Utility/Mocks/MockTildeExpressionResolver.cpp
  lldb/trunk/unittests/Utility/Mocks/MockTildeExpressionResolver.h
  lldb/trunk/unittests/Utility/TildeExpressionResolverTest.cpp

Index: lldb/trunk/include/lldb/Host/FileSpec.h
===
--- lldb/trunk/include/lldb/Host/FileSpec.h
+++ lldb/trunk/include/lldb/Host/FileSpec.h
@@ -17,7 +17,6 @@
 
 // Other libraries and framework includes
 // Project includes
-#include "lldb/Host/PosixApi.h"
 #include "lldb/Utility/ConstString.h"
 #include "lldb/lldb-private.h"
 
@@ -539,26 +538,6 @@
 
   ConstString GetLastPathComponent() const;
 
-  //--
-  /// Resolves the user name at the beginning of \a src_path, and writes the
-  /// output
-  /// to \a dst_path.  Note, \a src_path can contain other path components after
-  /// the
-  /// user name, they will be copied over, and if the path doesn't start with
-  /// "~" it
-  /// will also be copied over to \a dst_path.
-  ///
-  /// @param[in] src_path
-  /// Input path to be resolved.
-  ///
-  /// @param[in] dst_path
-  /// Buffer to store the resolved path.
-  //--
-  static void ResolveUsername(llvm::SmallVectorImpl );
-
-  static size_t ResolvePartialUsername(llvm::StringRef partial_name,
-   StringList );
-
   enum EnumerateDirectoryResult {
 eEnumerateDirectoryResultNext,  // Enumerate next entry in the current
 // directory
Index: lldb/trunk/include/lldb/Utility/TildeExpressionResolver.h
===
--- lldb/trunk/include/lldb/Utility/TildeExpressionResolver.h
+++ lldb/trunk/include/lldb/Utility/TildeExpressionResolver.h
@@ -44,6 +44,11 @@
   /// \returns true if there were any matches, false otherwise.
   virtual bool ResolvePartial(llvm::StringRef Expr,
   llvm::StringSet<> ) = 0;
+
+  /// \brief Resolve an entire path that begins with a tilde expression,
+  /// replacing the username portion with the matched result.
+  bool ResolveFullPath(llvm::StringRef Expr,
+   llvm::SmallVectorImpl );
 };
 
 class StandardTildeExpressionResolver : public TildeExpressionResolver {
Index: lldb/trunk/unittests/Interpreter/CMakeLists.txt
===
--- lldb/trunk/unittests/Interpreter/CMakeLists.txt
+++ lldb/trunk/unittests/Interpreter/CMakeLists.txt
@@ -4,6 +4,7 @@
 
   LINK_LIBS
 lldbInterpreter
+lldbUtilityMocks
   )
 
 target_link_libraries(InterpreterTests
Index: lldb/trunk/unittests/Interpreter/TestCompletion.cpp
===
--- lldb/trunk/unittests/Interpreter/TestCompletion.cpp
+++ lldb/trunk/unittests/Interpreter/TestCompletion.cpp
@@ -8,7 +8,6 @@
 //===--===//
 
 #include "gtest/gtest.h"
-
 #include "lldb/Interpreter/CommandCompletions.h"
 #include "lldb/Utility/StringList.h"
 #include "lldb/Utility/TildeExpressionResolver.h"
@@ -18,6 +17,8 @@
 #include "llvm/Support/Path.h"
 #include "llvm/Support/raw_ostream.h"
 
+#include "unittests/Utility/Mocks/MockTildeExpressionResolver.h"
+
 namespace fs = llvm::sys::fs;
 namespace path = llvm::sys::path;
 using namespace llvm;
@@ -36,74 +37,6 @@
 
 namespace {
 
-class MockTildeExpressionResolver : public TildeExpressionResolver {
-  StringRef CurrentUser;
-  StringMap UserDirectories;
-
-public:
-  explicit MockTildeExpressionResolver(StringRef CurrentUser, StringRef HomeDir)
-  : CurrentUser(CurrentUser) {
-UserDirectories.insert(std::make_pair(CurrentUser, HomeDir));
-  }
-
-  void AddKnownUser(StringRef User, StringRef HomeDir) {
- 

[Lldb-commits] [lldb] r298466 - Break the cycle between Host and PluginProcessUtility.

2017-03-21 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Tue Mar 21 19:27:54 2017
New Revision: 298466

URL: http://llvm.org/viewvc/llvm-project?rev=298466=rev
Log:
Break the cycle between Host and PluginProcessUtility.

There are only two users of NativeRegisterContextRegisterInfo,
and both are in process plugins.  Moving this code from Host
to Plugins/Process/Utility thus makes sense, and as it is the
only dependency from Host -> PluginProcessUtility, it also
breaks this cycle, reducing LLDB's overall cycle count from
45 to 44.

Added:

lldb/trunk/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.cpp

lldb/trunk/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h
Removed:
lldb/trunk/include/lldb/Host/common/NativeRegisterContextRegisterInfo.h
lldb/trunk/source/Host/common/NativeRegisterContextRegisterInfo.cpp
Modified:
lldb/trunk/source/Host/CMakeLists.txt
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux.h
lldb/trunk/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h
lldb/trunk/source/Plugins/Process/Utility/CMakeLists.txt

Removed: lldb/trunk/include/lldb/Host/common/NativeRegisterContextRegisterInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/common/NativeRegisterContextRegisterInfo.h?rev=298465=auto
==
--- lldb/trunk/include/lldb/Host/common/NativeRegisterContextRegisterInfo.h 
(original)
+++ lldb/trunk/include/lldb/Host/common/NativeRegisterContextRegisterInfo.h 
(removed)
@@ -1,42 +0,0 @@
-//===-- NativeRegisterContextRegisterInfo.h --*- C++
-//-*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===--===//
-
-#ifndef lldb_NativeRegisterContextRegisterInfo_h
-#define lldb_NativeRegisterContextRegisterInfo_h
-
-#include 
-
-#include "NativeRegisterContext.h"
-#include "Plugins/Process/Utility/RegisterInfoInterface.h"
-
-namespace lldb_private {
-class NativeRegisterContextRegisterInfo : public NativeRegisterContext {
-public:
-  ///
-  /// Construct a NativeRegisterContextRegisterInfo, taking ownership
-  /// of the register_info_interface pointer.
-  ///
-  NativeRegisterContextRegisterInfo(
-  NativeThreadProtocol , uint32_t concrete_frame_idx,
-  RegisterInfoInterface *register_info_interface);
-
-  uint32_t GetRegisterCount() const override;
-
-  uint32_t GetUserRegisterCount() const override;
-
-  const RegisterInfo *GetRegisterInfoAtIndex(uint32_t reg_index) const 
override;
-
-  const RegisterInfoInterface () const;
-
-private:
-  std::unique_ptr m_register_info_interface_up;
-};
-}
-#endif

Modified: lldb/trunk/source/Host/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/CMakeLists.txt?rev=298466=298465=298466=diff
==
--- lldb/trunk/source/Host/CMakeLists.txt (original)
+++ lldb/trunk/source/Host/CMakeLists.txt Tue Mar 21 19:27:54 2017
@@ -22,7 +22,6 @@ add_host_subdirectory(common
   common/NativeWatchpointList.cpp
   common/NativeProcessProtocol.cpp
   common/NativeRegisterContext.cpp
-  common/NativeRegisterContextRegisterInfo.cpp
   common/NativeThreadProtocol.cpp
   common/OptionParser.cpp
   common/PipeBase.cpp

Removed: lldb/trunk/source/Host/common/NativeRegisterContextRegisterInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/NativeRegisterContextRegisterInfo.cpp?rev=298465=auto
==
--- lldb/trunk/source/Host/common/NativeRegisterContextRegisterInfo.cpp 
(original)
+++ lldb/trunk/source/Host/common/NativeRegisterContextRegisterInfo.cpp 
(removed)
@@ -1,43 +0,0 @@
-//===-- NativeRegisterContextRegisterInfo.cpp ---*- C++ 
-*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===--===//
-
-#include "lldb/Host/common/NativeRegisterContextRegisterInfo.h"
-#include "lldb/lldb-private-forward.h"
-#include "lldb/lldb-types.h"
-
-using namespace lldb_private;
-
-NativeRegisterContextRegisterInfo::NativeRegisterContextRegisterInfo(
-NativeThreadProtocol , uint32_t concrete_frame_idx,
-RegisterInfoInterface *register_info_interface)
-: NativeRegisterContext(thread, concrete_frame_idx),
-  m_register_info_interface_up(register_info_interface) {
-  assert(register_info_interface && "null register_info_interface");
-}
-
-uint32_t NativeRegisterContextRegisterInfo::GetRegisterCount() const {
-  return m_register_info_interface_up->GetRegisterCount();
-}
-

[Lldb-commits] [lldb] r298455 - [deps script] Sort cycles by the difficulty of breaking.

2017-03-21 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Tue Mar 21 17:46:46 2017
New Revision: 298455

URL: http://llvm.org/viewvc/llvm-project?rev=298455=rev
Log:
[deps script] Sort cycles by the difficulty of breaking.

When passing --discover-cycles and --show-counts, it displays
the number of dependencies between each hop of the cycle,
and sorts by the sum.  Dependencies at the top of the list
should be the easiest to break.

Modified:
lldb/trunk/scripts/analyze-project-deps.py

Modified: lldb/trunk/scripts/analyze-project-deps.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/analyze-project-deps.py?rev=298455=298454=298455=diff
==
--- lldb/trunk/scripts/analyze-project-deps.py (original)
+++ lldb/trunk/scripts/analyze-project-deps.py Tue Mar 21 17:46:46 2017
@@ -1,6 +1,8 @@
 import argparse
+import itertools
 import os
 import re
+import sys
 
 from use_lldb_suite import lldb_root
 
@@ -22,7 +24,7 @@ src_map = {}
 include_regex = re.compile('#include \"((lldb|Plugins|clang)(.*/)+).*\"')
 
 def is_sublist(small, big):
-it = iter(big)
+it = iter(big)
 return all(c in it for c in small)
 
 def normalize_host(str):
@@ -102,9 +104,7 @@ def expand(path_queue, path_lengths, cyc
 continue
 
 next_len = path_lengths.pop(0) + 1
-
 last_component = cur_path[-1]
-
 for item in src_map[last_component]:
 if item.startswith("clang"):
 continue
@@ -143,6 +143,19 @@ for (path, deps) in items:
 for dep in sorted_deps:
 print "\t{}".format(dep[0])
 
+def iter_cycles(cycles):
+global src_map
+for cycle in cycles:
+cycle.append(cycle[0])
+zipper = list(zip(cycle[0:-1], cycle[1:]))
+result = [(x, src_map[x][y], y) for (x,y) in zipper]
+total = 0
+smallest = result[0][1]
+for (first, value, last) in result:
+total += value
+smallest = min(smallest, value)
+yield (total, smallest, result)
+
 if args.discover_cycles:
 print "Analyzing cycles..."
 
@@ -151,8 +164,18 @@ if args.discover_cycles:
 average = sum([len(x)+1 for x in cycles]) / len(cycles)
 
 print "Found {} cycles.  Average cycle length = {}.".format(len(cycles), 
average)
-for cycle in cycles:
-cycle.append(cycle[0])
-print " -> ".join(cycle)
-
+if args.show_counts:
+counted = list(iter_cycles(cycles))
+counted.sort(lambda A, B: cmp(A[0], B[0]))
+for (total, smallest, cycle) in counted:
+sys.stdout.write("{} deps to break: ".format(total))
+sys.stdout.write(cycle[0][0])
+for (first, count, last) in cycle:
+sys.stdout.write(" [{}->] {}".format(count, last))
+sys.stdout.write("\n")
+else:
+for cycle in cycles:
+cycle.append(cycle[0])
+print " -> ".join(cycle)
+sys.stdout.flush()
 pass
\ No newline at end of file


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


[Lldb-commits] [lldb] r298451 - Mirror CMake changes from r298412 to Xcode project

2017-03-21 Thread Tim Hammerquist via lldb-commits
Author: penryu
Date: Tue Mar 21 17:08:16 2017
New Revision: 298451

URL: http://llvm.org/viewvc/llvm-project?rev=298451=rev
Log:
Mirror CMake changes from r298412 to Xcode project


Mlldb.xcodeproj/project.pbxproj

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=298451=298450=298451=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Tue Mar 21 17:08:16 2017
@@ -2793,8 +2793,8 @@
9A22A160135E30370024DDC3 /* EmulationStateARM.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
EmulationStateARM.h; sourceTree = ""; };
9A357582116CFDEE00E8ED2F /* SBValueList.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
SBValueList.h; path = include/lldb/API/SBValueList.h; sourceTree = ""; };
9A35758D116CFE0F00E8ED2F /* SBValueList.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = SBValueList.cpp; path = source/API/SBValueList.cpp; sourceTree = 
""; };
-   9A35765E116E76A700E8ED2F /* StringList.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
StringList.h; path = include/lldb/Core/StringList.h; sourceTree = ""; };
-   9A35765F116E76B900E8ED2F /* StringList.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = StringList.cpp; path = source/Core/StringList.cpp; sourceTree = 
""; };
+   9A35765E116E76A700E8ED2F /* StringList.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
StringList.h; path = include/lldb/Utility/StringList.h; sourceTree = ""; 
};
+   9A35765F116E76B900E8ED2F /* StringList.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = StringList.cpp; path = source/Utility/StringList.cpp; sourceTree = 
""; };
9A357670116E7B5200E8ED2F /* SBStringList.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
SBStringList.h; path = include/lldb/API/SBStringList.h; sourceTree = ""; 
};
9A357672116E7B6400E8ED2F /* SBStringList.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = SBStringList.cpp; path = source/API/SBStringList.cpp; sourceTree = 
""; };
9A3576A7116E9AB700E8ED2F /* SBHostOS.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
SBHostOS.h; path = include/lldb/API/SBHostOS.h; sourceTree = ""; };
@@ -4235,6 +4235,8 @@
2676A093119C93C8008A98EF /* 
StringExtractorGDBRemote.cpp */,
94380B8019940B0300BFE4A8 /* StringLexer.h */,
94380B8119940B0A00BFE4A8 /* StringLexer.cpp */,
+   9A35765E116E76A700E8ED2F /* StringList.h */,
+   9A35765F116E76B900E8ED2F /* StringList.cpp */,
94BA8B6E176F8CA0005A91B5 /* Range.h */,
94BA8B6C176F8C9B005A91B5 /* Range.cpp */,
6DEC6F3A1BD66D950091ABA6 /* TaskPool.h */,
@@ -4729,8 +4731,6 @@
2623096E13D0EFFB006381D9 /* StreamBuffer.h */,
26BC7D7A10F1B77400F91463 /* StreamFile.h */,
26BC7E9210F1B85900F91463 /* StreamFile.cpp */,
-   9A35765E116E76A700E8ED2F /* StringList.h */,
-   9A35765F116E76B900E8ED2F /* StringList.cpp */,
26F2F8FD1B156678007857DE /* StructuredData.h */,
AFEC3361194A8ABA00FF05C6 /* StructuredData.cpp 
*/,
26B167A41123BF5500DC7B4F /* ThreadSafeValue.h 
*/,


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


[Lldb-commits] [lldb] r298419 - Fix build broken by StringList move.

2017-03-21 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Tue Mar 21 13:45:42 2017
New Revision: 298419

URL: http://llvm.org/viewvc/llvm-project?rev=298419=rev
Log:
Fix build broken by StringList move.

Modified:
lldb/trunk/include/lldb/Utility/StringList.h
lldb/trunk/source/Symbol/Symtab.cpp

Modified: lldb/trunk/include/lldb/Utility/StringList.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/StringList.h?rev=298419=298418=298419=diff
==
--- lldb/trunk/include/lldb/Utility/StringList.h (original)
+++ lldb/trunk/include/lldb/Utility/StringList.h Tue Mar 21 13:45:42 2017
@@ -15,6 +15,7 @@
 
 // C++ Includes
 #include 
+#include 
 
 // Other libraries and framework includes
 #include "llvm/ADT/StringRef.h"

Modified: lldb/trunk/source/Symbol/Symtab.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Symtab.cpp?rev=298419=298418=298419=diff
==
--- lldb/trunk/source/Symbol/Symtab.cpp (original)
+++ lldb/trunk/source/Symbol/Symtab.cpp Tue Mar 21 13:45:42 2017
@@ -14,6 +14,7 @@
 #include "Plugins/Language/ObjC/ObjCLanguage.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/Section.h"
+#include "lldb/Core/STLUtils.h"
 #include "lldb/Core/Timer.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Symbol/Symbol.h"


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


[Lldb-commits] [lldb] r298412 - Move StringList from Core -> Utility.

2017-03-21 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Tue Mar 21 13:25:04 2017
New Revision: 298412

URL: http://llvm.org/viewvc/llvm-project?rev=298412=rev
Log:
Move StringList from Core -> Utility.

Added:
lldb/trunk/include/lldb/Utility/StringList.h
lldb/trunk/source/Utility/StringList.cpp
Removed:
lldb/trunk/include/lldb/Core/StringList.h
lldb/trunk/source/Core/StringList.cpp
Modified:
lldb/trunk/include/lldb/Breakpoint/Breakpoint.h
lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h
lldb/trunk/include/lldb/Breakpoint/WatchpointOptions.h
lldb/trunk/include/lldb/Core/IOHandler.h
lldb/trunk/include/lldb/Core/UserSettingsController.h
lldb/trunk/include/lldb/Host/Host.h
lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
lldb/trunk/include/lldb/Interpreter/CommandObject.h
lldb/trunk/source/API/SBStringList.cpp
lldb/trunk/source/Breakpoint/BreakpointOptions.cpp
lldb/trunk/source/Breakpoint/WatchpointOptions.cpp
lldb/trunk/source/Commands/CommandObjectCommands.cpp
lldb/trunk/source/Commands/CommandObjectType.cpp
lldb/trunk/source/Core/ArchSpec.cpp
lldb/trunk/source/Core/CMakeLists.txt
lldb/trunk/source/Host/common/Editline.cpp
lldb/trunk/source/Host/common/FileSpec.cpp
lldb/trunk/source/Interpreter/OptionValue.cpp
lldb/trunk/source/Interpreter/OptionValueBoolean.cpp
lldb/trunk/source/Interpreter/OptionValueChar.cpp
lldb/trunk/source/Interpreter/OptionValueEnumeration.cpp
lldb/trunk/source/Interpreter/OptionValueFormatEntity.cpp
lldb/trunk/source/Interpreter/OptionValueProperties.cpp
lldb/trunk/source/Interpreter/OptionValueUUID.cpp
lldb/trunk/source/Interpreter/ScriptInterpreter.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
lldb/trunk/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp
lldb/trunk/source/Utility/CMakeLists.txt
lldb/trunk/unittests/Editline/EditlineTest.cpp
lldb/trunk/unittests/Interpreter/TestCompletion.cpp

Modified: lldb/trunk/include/lldb/Breakpoint/Breakpoint.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/Breakpoint.h?rev=298412=298411=298412=diff
==
--- lldb/trunk/include/lldb/Breakpoint/Breakpoint.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/Breakpoint.h Tue Mar 21 13:25:04 2017
@@ -26,8 +26,8 @@
 #include "lldb/Breakpoint/Stoppoint.h"
 #include "lldb/Core/Event.h"
 #include "lldb/Core/SearchFilter.h"
-#include "lldb/Core/StringList.h"
 #include "lldb/Core/StructuredData.h"
+#include "lldb/Utility/StringList.h"
 
 namespace lldb_private {
 

Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h?rev=298412=298411=298412=diff
==
--- lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h Tue Mar 21 13:25:04 
2017
@@ -17,9 +17,9 @@
 
 // Other libraries and framework includes
 // Project includes
-#include "lldb/Core/StringList.h"
 #include "lldb/Core/StructuredData.h"
 #include "lldb/Utility/Baton.h"
+#include "lldb/Utility/StringList.h"
 #include "lldb/lldb-private.h"
 
 namespace lldb_private {

Modified: lldb/trunk/include/lldb/Breakpoint/WatchpointOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/WatchpointOptions.h?rev=298412=298411=298412=diff
==
--- lldb/trunk/include/lldb/Breakpoint/WatchpointOptions.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/WatchpointOptions.h Tue Mar 21 13:25:04 
2017
@@ -17,8 +17,8 @@
 
 // Other libraries and framework includes
 // Project includes
-#include "lldb/Core/StringList.h"
 #include "lldb/Utility/Baton.h"
+#include "lldb/Utility/StringList.h"
 #include "lldb/lldb-private.h"
 
 namespace lldb_private {

Modified: lldb/trunk/include/lldb/Core/IOHandler.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/IOHandler.h?rev=298412=298411=298412=diff
==
--- lldb/trunk/include/lldb/Core/IOHandler.h (original)
+++ lldb/trunk/include/lldb/Core/IOHandler.h Tue Mar 21 13:25:04 2017
@@ -23,12 +23,12 @@
 // Project includes
 #include "lldb/Utility/Flags.h"
 
-#include "lldb/Core/StringList.h"
 #include "lldb/Core/ValueObjectList.h"
 #include "lldb/Host/Predicate.h"
 #include "lldb/Utility/ConstString.h"
 #include "lldb/Utility/Error.h"
 #include "lldb/Utility/Stream.h"
+#include "lldb/Utility/StringList.h"
 #include "lldb/lldb-enumerations.h"
 #include "lldb/lldb-public.h"
 

Removed: 

[Lldb-commits] [PATCH] D31129: Remove remaining platform specific code from FileSpec

2017-03-21 Thread Eugene Zemtsov via Phabricator via lldb-commits
eugene accepted this revision.
eugene added a comment.
This revision is now accepted and ready to land.

I like how much code you deleted.


https://reviews.llvm.org/D31129



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


Re: [Lldb-commits] [PATCH] D31172: Move stop info override callback code from ArchSpec into Process

2017-03-21 Thread Zachary Turner via lldb-commits
Thanks for the suggestions!  Not sure if I'll be able to make those changes
before tomorrow EOD, and after that I will be out for ~2 weeks, so if time
doesn't permit, I may not follow up with another patch until after I get
back.

On Tue, Mar 21, 2017 at 11:19 AM Jim Ingham via Phabricator <
revi...@reviews.llvm.org> wrote:

> jingham added a comment.
>
> None of this isn't modeling the situation particularly clearly, since we
> have "architecture specific modifications to general behaviors" that aren't
> coming in through plugins so that it would be easy to modify the behavior
> for new architectures. Instead, we're requiring new architectures to go in
> and edit supposedly generic code.  We put off that abstraction because it
> was unclear what we would need it to do, and because of that for the most
> part we just put these architecture specific behaviors inline in various
> places.  Then this one callback had nowhere to go but ArchSpec which is the
> only logical place for architecture specific code to accumulate.   It
> doesn't seem like we should gate cleaning up ArchSpec on that larger issue,
> however.
>
> Rather than introducing another file, it seems simpler to make this part
> of StopInfo, since it is logically modifying the StopInfo for a thread.  It
> isn't right there, but it's any worse, and StopInfo is closer to the
> machine (though so far mostly closer to the Platform) than Process should
> be.  And StopInfo's already have to know about pretty much all the details
> of Process/Thread/etc...  so you wouldn't be adding knowledge to them that
> isn't appropriate.
>
> I'd also suggest removing the "callback" name from it since it really
> isn't a general purpose callback, it is absolutely determined by the
> ArchSpec.  For instance if you were to use anything but the ARM one for ARM
> debugging you would break debugging.  It's not optional...  Instead I'd
> call it something like InvokeStopInfoArchOverride.  That will also make it
> clear that this is a target for gathering up into some "ArchSpec specific
> behaviors" if/when we get around to that.
>
>
> https://reviews.llvm.org/D31172
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r298409 - Create instance of DynamicLoaderPOSIXDYLD on NetBSD

2017-03-21 Thread Kamil Rytarowski via lldb-commits
Author: kamil
Date: Tue Mar 21 12:39:15 2017
New Revision: 298409

URL: http://llvm.org/viewvc/llvm-project?rev=298409=rev
Log:
Create instance of DynamicLoaderPOSIXDYLD on NetBSD

Summary:
NetBSD is a modern ELF UNIX-like system.

There is requires DynamicLoaderPOSIXDYLD e.g. for ELF AUXV reading from the 
client.

Sponsored by 

Reviewers: labath, joerg, kettenis

Reviewed By: labath

Subscribers: #lldb

Tags: #lldb

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

Modified:

lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp

Modified: 
lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp?rev=298409=298408=298409=diff
==
--- 
lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp 
Tue Mar 21 12:39:15 2017
@@ -63,8 +63,9 @@ DynamicLoader *DynamicLoaderPOSIXDYLD::C
   if (!create) {
 const llvm::Triple _ref =
 process->GetTarget().GetArchitecture().GetTriple();
-if (triple_ref.getOS() == llvm::Triple::Linux ||
-triple_ref.getOS() == llvm::Triple::FreeBSD)
+if (triple_ref.getOS() == llvm::Triple::FreeBSD ||
+triple_ref.getOS() == llvm::Triple::Linux ||
+triple_ref.getOS() == llvm::Triple::NetBSD)
   create = true;
   }
 


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


[Lldb-commits] [PATCH] D31192: Create instance of DynamicLoaderPOSIXDYLD on NetBSD

2017-03-21 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added a comment.

This approach is easier for my to understand each change and make sure that 
it's actually needed and correct (or looking like a proper solution).
There are 2 similar changes left I don't fully understand and code interfering 
with the OpenBSD platform addition that I will hold on a while.

I expect that FreeBSD/OpenBSD (and perhaps DragonflyBSD at some point) will 
have the job clearer.


Repository:
  rL LLVM

https://reviews.llvm.org/D31192



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


[Lldb-commits] [lldb] r298408 - Add stub for PluginProcessNetBSD

2017-03-21 Thread Kamil Rytarowski via lldb-commits
Author: kamil
Date: Tue Mar 21 12:30:47 2017
New Revision: 298408

URL: http://llvm.org/viewvc/llvm-project?rev=298408=rev
Log:
Add stub for PluginProcessNetBSD

Summary:
This is the base for introduction of further features to support Process 
Tracing on NetBSD, in local and remote setup.

This code is also a starting point to synchronize the development with other 
BSDs. Currently NetBSD is ahead and other systems can catch up.

Sponsored by 

Reviewers: emaste, joerg, kettenis, labath

Reviewed By: labath

Subscribers: mgorny, #lldb

Tags: #lldb

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

Added:
lldb/trunk/source/Plugins/Process/NetBSD/
lldb/trunk/source/Plugins/Process/NetBSD/CMakeLists.txt
lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
lldb/trunk/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp
lldb/trunk/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h
lldb/trunk/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
lldb/trunk/source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
Modified:
lldb/trunk/source/Plugins/Process/CMakeLists.txt
lldb/trunk/tools/lldb-server/CMakeLists.txt

Modified: lldb/trunk/source/Plugins/Process/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/CMakeLists.txt?rev=298408=298407=298408=diff
==
--- lldb/trunk/source/Plugins/Process/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/Process/CMakeLists.txt Tue Mar 21 12:30:47 2017
@@ -5,6 +5,7 @@ elseif (CMAKE_SYSTEM_NAME MATCHES "FreeB
   add_subdirectory(FreeBSD)
   add_subdirectory(POSIX)
 elseif (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
+  add_subdirectory(NetBSD)
   add_subdirectory(POSIX)
 elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")
   add_subdirectory(Windows/Common)

Added: lldb/trunk/source/Plugins/Process/NetBSD/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/NetBSD/CMakeLists.txt?rev=298408=auto
==
--- lldb/trunk/source/Plugins/Process/NetBSD/CMakeLists.txt (added)
+++ lldb/trunk/source/Plugins/Process/NetBSD/CMakeLists.txt Tue Mar 21 12:30:47 
2017
@@ -0,0 +1,20 @@
+include_directories(.)
+include_directories(../POSIX)
+include_directories(../Utility)
+
+add_lldb_library(lldbPluginProcessNetBSD PLUGIN
+  NativeProcessNetBSD.cpp
+  NativeRegisterContextNetBSD.cpp
+  NativeThreadNetBSD.cpp
+
+  LINK_LIBS
+lldbCore
+lldbHost
+lldbSymbol
+lldbTarget
+lldbUtility
+lldbPluginProcessPOSIX
+lldbPluginProcessUtility
+  LINK_COMPONENTS
+Support
+  )

Added: lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp?rev=298408=auto
==
--- lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp (added)
+++ lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp Tue Mar 21 
12:30:47 2017
@@ -0,0 +1,51 @@
+//===-- NativeProcessNetBSD.cpp --- -*- C++ 
-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "NativeProcessNetBSD.h"
+
+// C Includes
+
+// C++ Includes
+
+// Other libraries and framework includes
+
+#include "Plugins/Process/POSIX/ProcessPOSIXLog.h"
+
+// System includes - They have to be included after framework includes because
+// they define some
+// macros which collide with variable names in other modules
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace lldb_private::process_netbsd;
+using namespace llvm;
+
+// 
-
+// Public Static Methods
+// 
-
+
+Error NativeProcessProtocol::Launch(
+ProcessLaunchInfo _info,
+NativeProcessProtocol::NativeDelegate _delegate, MainLoop ,
+NativeProcessProtocolSP _process_sp) {
+  return Error();
+}
+
+Error NativeProcessProtocol::Attach(
+lldb::pid_t pid, NativeProcessProtocol::NativeDelegate _delegate,
+MainLoop , NativeProcessProtocolSP _process_sp) {
+  return Error();
+}
+
+// 
-
+// Public Instance Methods
+// 
-
+
+NativeProcessNetBSD::NativeProcessNetBSD()
+: NativeProcessProtocol(LLDB_INVALID_PROCESS_ID) {}

Added: 

[Lldb-commits] [lldb] r298407 - Enable AUXV and QPassSignals in gdb-remote for NetBSD

2017-03-21 Thread Kamil Rytarowski via lldb-commits
Author: kamil
Date: Tue Mar 21 12:27:59 2017
New Revision: 298407

URL: http://llvm.org/viewvc/llvm-project?rev=298407=rev
Log:
Enable AUXV and QPassSignals in gdb-remote for NetBSD

Summary:
NetBSD is an ELF platform and it uses Elf Auxiliary Vector like Linux and other 
modern BSDs.

While there enable QPassSignals for the NetBSD port as well.

Sponsored by 

Reviewers: labath, kettenis, joerg, emaste

Reviewed By: labath

Subscribers: #lldb

Tags: #lldb

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

Modified:

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp

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

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp?rev=298407=298406=298407=diff
==
--- 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
 Tue Mar 21 12:27:59 2017
@@ -840,7 +840,7 @@ GDBRemoteCommunicationServerCommon::Hand
   response.PutCString(";QThreadSuffixSupported+");
   response.PutCString(";QListThreadsInStopReply+");
   response.PutCString(";qEcho+");
-#if defined(__linux__)
+#if defined(__linux__) || defined(__NetBSD__)
   response.PutCString(";QPassSignals+");
   response.PutCString(";qXfer:auxv:read+");
 #endif

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp?rev=298407=298406=298407=diff
==
--- 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
 Tue Mar 21 12:27:59 2017
@@ -2665,7 +2665,7 @@ GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServerLLGS::Handle_qXfer_auxv_read(
 StringExtractorGDBRemote ) {
 // *BSD impls should be able to do this too.
-#if defined(__linux__)
+#if defined(__linux__) || defined(__NetBSD__)
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS));
 
   // Parse out the offset.


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


[Lldb-commits] [lldb] r298405 - Add NetBSD case in Entry::Type::ThreadID

2017-03-21 Thread Kamil Rytarowski via lldb-commits
Author: kamil
Date: Tue Mar 21 12:25:47 2017
New Revision: 298405

URL: http://llvm.org/viewvc/llvm-project?rev=298405=rev
Log:
Add NetBSD case in Entry::Type::ThreadID

Summary:
NetBSD native threads are printed as 64-bit unsigned integers.

The underlying system type of a thread identity is lwpid_t of type int32_t. For 
consistency with Linux and FreeBSD share the 64-bit unsigned integer type.

Sponsored by 

Reviewers: labath, kettenis, joerg, emaste

Reviewed By: labath, emaste

Subscribers: #lldb

Tags: #lldb

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

Modified:
lldb/trunk/source/Core/FormatEntity.cpp

Modified: lldb/trunk/source/Core/FormatEntity.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/FormatEntity.cpp?rev=298405=298404=298405=diff
==
--- lldb/trunk/source/Core/FormatEntity.cpp (original)
+++ lldb/trunk/source/Core/FormatEntity.cpp Tue Mar 21 12:25:47 2017
@@ -1187,7 +1187,8 @@ bool FormatEntity::Format(const Entry 
   ? arch.GetTriple().getOS()
   : llvm::Triple::UnknownOS;
 if ((ostype == llvm::Triple::FreeBSD) ||
-(ostype == llvm::Triple::Linux)) {
+(ostype == llvm::Triple::Linux) ||
+(ostype == llvm::Triple::NetBSD)) {
   format = "%" PRIu64;
 }
   } else {


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


[Lldb-commits] [lldb] r298402 - Remove stray paren that got in while attempting to fix the build for AttributeList

2017-03-21 Thread Reid Kleckner via lldb-commits
Author: rnk
Date: Tue Mar 21 12:15:50 2017
New Revision: 298402

URL: http://llvm.org/viewvc/llvm-project?rev=298402=rev
Log:
Remove stray paren that got in while attempting to fix the build for 
AttributeList

Modified:

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

Modified: 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp?rev=298402=298401=298402=diff
==
--- 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp
 Tue Mar 21 12:15:50 2017
@@ -266,7 +266,7 @@ bool fixupRSAllocationStructByValCalls(l
 // inspect all of the arguments in the call
 for (auto  : func->args()) {
   if (arg.hasByValAttr()) {
-arg.removeAttr(llvm::Attribute::ByVal));
+arg.removeAttr(llvm::Attribute::ByVal);
 changed = true;
   }
 }


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


[Lldb-commits] [PATCH] D31172: Move stop info override callback code from ArchSpec into Process

2017-03-21 Thread Zachary Turner via Phabricator via lldb-commits
zturner added a comment.

The architecture help change snuck in, I already removed it locally but didn't 
re-upload.

As for why I'm trying to get this out of `ArchSpec`, it turns out `ArchSpec` is 
one of the biggest causes of dependency cycles.  It's used all over the place, 
which triggers a dependency from Everywhere -> Core, and then it depends on 
Target, a couple of Plugins, and Host.  There's only a very small amount of 
code in `ArchSpec` that accounts for all of these dependencies though.  The 
first is this code that I'm attempting to move, the second is the code to set 
the triple given a Platform.  So I wanted to tackle these one at a time.

One option would be to make `lldb/Process/StopInfoOverride.h` and cpp, and put 
the code there.  Thoughts?


https://reviews.llvm.org/D31172



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


[Lldb-commits] [lldb] r298399 - Update for LLVM API rename of AttributeSet -> AttributeList

2017-03-21 Thread Reid Kleckner via lldb-commits
Author: rnk
Date: Tue Mar 21 12:09:20 2017
New Revision: 298399

URL: http://llvm.org/viewvc/llvm-project?rev=298399=rev
Log:
Update for LLVM API rename of AttributeSet -> AttributeList

Modified:

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

Modified: 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp?rev=298399=298398=298399=diff
==
--- 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp
 Tue Mar 21 12:09:20 2017
@@ -248,7 +248,7 @@ bool fixupRSAllocationStructByValCalls(l
 rs_functions.insert(call_inst->getCalledFunction());
 
 // get the function attributes
-llvm::AttributeSet call_attribs = call_inst->getAttributes();
+llvm::AttributeList call_attribs = call_inst->getAttributes();
 
 // iterate over the argument attributes
 for (size_t i = 1; i <= call_attribs.getNumSlots(); ++i) {
@@ -261,15 +261,12 @@ bool fixupRSAllocationStructByValCalls(l
 }
   }
 
-  llvm::AttributeSet attr_byval =
-  llvm::AttributeSet::get(module.getContext(), 1u, llvm::Attribute::ByVal);
-
   // for all called function decls
   for (auto func : rs_functions) {
 // inspect all of the arguments in the call
 for (auto  : func->args()) {
   if (arg.hasByValAttr()) {
-arg.removeAttr(attr_byval);
+arg.removeAttr(llvm::Attribute::ByVal));
 changed = true;
   }
 }


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


[Lldb-commits] [PATCH] D31138: Add stub for PluginProcessNetBSD

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

Heh... I did not expect it would get this small, but ok. :)


Repository:
  rL LLVM

https://reviews.llvm.org/D31138



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


[Lldb-commits] [PATCH] D31191: Enable ProcessPOSIXLog on NetBSD

2017-03-21 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski created this revision.
krytarowski added a project: LLDB.

NetBSD can share the same logging functionality with Linux and FreeBSD.

Sponsored by 


Repository:
  rL LLVM

https://reviews.llvm.org/D31191

Files:
  source/Initialization/SystemInitializerCommon.cpp


Index: source/Initialization/SystemInitializerCommon.cpp
===
--- source/Initialization/SystemInitializerCommon.cpp
+++ source/Initialization/SystemInitializerCommon.cpp
@@ -26,7 +26,7 @@
 #include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h"
 #endif
 
-#if defined(__linux__) || defined(__FreeBSD__)
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__)
 #include "Plugins/Process/POSIX/ProcessPOSIXLog.h"
 #endif
 
@@ -93,7 +93,7 @@
 #if defined(__APPLE__)
   ObjectFileMachO::Initialize();
 #endif
-#if defined(__linux__) || defined(__FreeBSD__)
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__)
   ProcessPOSIXLog::Initialize();
 #endif
 #if defined(_MSC_VER)


Index: source/Initialization/SystemInitializerCommon.cpp
===
--- source/Initialization/SystemInitializerCommon.cpp
+++ source/Initialization/SystemInitializerCommon.cpp
@@ -26,7 +26,7 @@
 #include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h"
 #endif
 
-#if defined(__linux__) || defined(__FreeBSD__)
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__)
 #include "Plugins/Process/POSIX/ProcessPOSIXLog.h"
 #endif
 
@@ -93,7 +93,7 @@
 #if defined(__APPLE__)
   ObjectFileMachO::Initialize();
 #endif
-#if defined(__linux__) || defined(__FreeBSD__)
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__)
   ProcessPOSIXLog::Initialize();
 #endif
 #if defined(_MSC_VER)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D31138: Add stub for PluginProcessNetBSD

2017-03-21 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski updated this revision to Diff 92490.
krytarowski edited the summary of this revision.
krytarowski added a comment.

Cut down the unused functions from the Native Process NetBSD Plugin.


Repository:
  rL LLVM

https://reviews.llvm.org/D31138

Files:
  source/Plugins/Process/CMakeLists.txt
  source/Plugins/Process/NetBSD/CMakeLists.txt
  source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
  source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
  source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp
  source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h
  source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
  source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
  tools/lldb-server/CMakeLists.txt

Index: tools/lldb-server/CMakeLists.txt
===
--- tools/lldb-server/CMakeLists.txt
+++ tools/lldb-server/CMakeLists.txt
@@ -17,6 +17,7 @@
 if ( CMAKE_SYSTEM_NAME MATCHES "NetBSD" )
 include_directories(
   ../../../../llvm/include
+  ../../source/Plugins/Process/NetBSD
   ../../source/Plugins/Process/POSIX
   )
 endif ()
Index: source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
===
--- /dev/null
+++ source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
@@ -0,0 +1,31 @@
+//===-- NativeThreadNetBSD.h -- -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef liblldb_NativeThreadNetBSD_H_
+#define liblldb_NativeThreadNetBSD_H_
+
+#include "lldb/Host/common/NativeThreadProtocol.h"
+
+namespace lldb_private {
+namespace process_netbsd {
+
+class NativeProcessNetBSD;
+
+class NativeThreadNetBSD : public NativeThreadProtocol {
+  friend class NativeProcessNetBSD;
+
+public:
+  NativeThreadNetBSD(NativeProcessNetBSD *process, lldb::tid_t tid);
+};
+
+typedef std::shared_ptr NativeThreadNetBSDSP;
+} // namespace process_netbsd
+} // namespace lldb_private
+
+#endif // #ifndef liblldb_NativeThreadNetBSD_H_
Index: source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
===
--- /dev/null
+++ source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
@@ -0,0 +1,21 @@
+//===-- NativeThreadNetBSD.cpp  -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "NativeThreadNetBSD.h"
+#include "NativeRegisterContextNetBSD.h"
+
+#include "NativeProcessNetBSD.h"
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace lldb_private::process_netbsd;
+
+NativeThreadNetBSD::NativeThreadNetBSD(NativeProcessNetBSD *process,
+   lldb::tid_t tid)
+: NativeThreadProtocol(process, tid) {}
Index: source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h
===
--- /dev/null
+++ source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h
@@ -0,0 +1,41 @@
+//===-- NativeRegisterContextNetBSD.h ---*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef lldb_NativeRegisterContextNetBSD_h
+#define lldb_NativeRegisterContextNetBSD_h
+
+#include "lldb/Host/common/NativeRegisterContextRegisterInfo.h"
+#include "lldb/Host/common/NativeThreadProtocol.h"
+
+#include "Plugins/Process/NetBSD/NativeProcessNetBSD.h"
+
+namespace lldb_private {
+namespace process_netbsd {
+
+class NativeRegisterContextNetBSD : public NativeRegisterContextRegisterInfo {
+public:
+  NativeRegisterContextNetBSD(NativeThreadProtocol _thread,
+  uint32_t concrete_frame_idx,
+  RegisterInfoInterface *reg_info_interface_p);
+
+  // This function is implemented in the NativeRegisterContextNetBSD_*
+  // subclasses to create a new instance of the host specific
+  // NativeRegisterContextNetBSD. The implementations can't collide as only one
+  // NativeRegisterContextNetBSD_* variant should be compiled into the final
+  // executable.
+  static NativeRegisterContextNetBSD *
+  CreateHostNativeRegisterContextNetBSD(const ArchSpec _arch,
+NativeThreadProtocol _thread,
+uint32_t concrete_frame_idx);
+};
+
+} // namespace process_netbsd
+} // namespace 

[Lldb-commits] [PATCH] D31138: Add stub for PluginProcessNetBSD

2017-03-21 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski updated this revision to Diff 92492.
krytarowski added a comment.

Style fix.


Repository:
  rL LLVM

https://reviews.llvm.org/D31138

Files:
  source/Plugins/Process/CMakeLists.txt
  source/Plugins/Process/NetBSD/CMakeLists.txt
  source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
  source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
  source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp
  source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h
  source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
  source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
  tools/lldb-server/CMakeLists.txt

Index: tools/lldb-server/CMakeLists.txt
===
--- tools/lldb-server/CMakeLists.txt
+++ tools/lldb-server/CMakeLists.txt
@@ -17,6 +17,7 @@
 if ( CMAKE_SYSTEM_NAME MATCHES "NetBSD" )
 include_directories(
   ../../../../llvm/include
+  ../../source/Plugins/Process/NetBSD
   ../../source/Plugins/Process/POSIX
   )
 endif ()
Index: source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
===
--- /dev/null
+++ source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
@@ -0,0 +1,31 @@
+//===-- NativeThreadNetBSD.h -- -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef liblldb_NativeThreadNetBSD_H_
+#define liblldb_NativeThreadNetBSD_H_
+
+#include "lldb/Host/common/NativeThreadProtocol.h"
+
+namespace lldb_private {
+namespace process_netbsd {
+
+class NativeProcessNetBSD;
+
+class NativeThreadNetBSD : public NativeThreadProtocol {
+  friend class NativeProcessNetBSD;
+
+public:
+  NativeThreadNetBSD(NativeProcessNetBSD *process, lldb::tid_t tid);
+};
+
+typedef std::shared_ptr NativeThreadNetBSDSP;
+} // namespace process_netbsd
+} // namespace lldb_private
+
+#endif // #ifndef liblldb_NativeThreadNetBSD_H_
Index: source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
===
--- /dev/null
+++ source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
@@ -0,0 +1,21 @@
+//===-- NativeThreadNetBSD.cpp  -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "NativeThreadNetBSD.h"
+#include "NativeRegisterContextNetBSD.h"
+
+#include "NativeProcessNetBSD.h"
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace lldb_private::process_netbsd;
+
+NativeThreadNetBSD::NativeThreadNetBSD(NativeProcessNetBSD *process,
+   lldb::tid_t tid)
+: NativeThreadProtocol(process, tid) {}
Index: source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h
===
--- /dev/null
+++ source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h
@@ -0,0 +1,41 @@
+//===-- NativeRegisterContextNetBSD.h ---*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef lldb_NativeRegisterContextNetBSD_h
+#define lldb_NativeRegisterContextNetBSD_h
+
+#include "lldb/Host/common/NativeRegisterContextRegisterInfo.h"
+#include "lldb/Host/common/NativeThreadProtocol.h"
+
+#include "Plugins/Process/NetBSD/NativeProcessNetBSD.h"
+
+namespace lldb_private {
+namespace process_netbsd {
+
+class NativeRegisterContextNetBSD : public NativeRegisterContextRegisterInfo {
+public:
+  NativeRegisterContextNetBSD(NativeThreadProtocol _thread,
+  uint32_t concrete_frame_idx,
+  RegisterInfoInterface *reg_info_interface_p);
+
+  // This function is implemented in the NativeRegisterContextNetBSD_*
+  // subclasses to create a new instance of the host specific
+  // NativeRegisterContextNetBSD. The implementations can't collide as only one
+  // NativeRegisterContextNetBSD_* variant should be compiled into the final
+  // executable.
+  static NativeRegisterContextNetBSD *
+  CreateHostNativeRegisterContextNetBSD(const ArchSpec _arch,
+NativeThreadProtocol _thread,
+uint32_t concrete_frame_idx);
+};
+
+} // namespace process_netbsd
+} // namespace lldb_private
+
+#endif // #ifndef lldb_NativeRegisterContextNetBSD_h
Index: 

[Lldb-commits] [PATCH] D31131: [LLDB] OpenBSD support

2017-03-21 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added inline comments.



Comment at: source/Host/openbsd/HostInfoOpenBSD.cpp:20
+
+uint32_t HostInfoOpenBSD::GetMaxThreadNameLength() { return 16; }
+

The need for this has been removed in trunk.


Repository:
  rL LLVM

https://reviews.llvm.org/D31131



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


[Lldb-commits] [PATCH] D31079: Replace std::ofstream with llvm::raw_fd_ostream

2017-03-21 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL298375: Replace std::ofstream with llvm::raw_fd_ostream 
(authored by labath).

Changed prior to commit:
  https://reviews.llvm.org/D31079?vs=92144=92484#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31079

Files:
  lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp
  lldb/trunk/source/Target/Platform.cpp
  lldb/trunk/tools/lldb-server/lldb-platform.cpp


Index: lldb/trunk/source/Target/Platform.cpp
===
--- lldb/trunk/source/Target/Platform.cpp
+++ lldb/trunk/source/Target/Platform.cpp
@@ -1645,8 +1645,9 @@
 const FileSpec _file_spec) {
   Error error;
 
-  std::ofstream dst(dst_file_spec.GetPath(), std::ios::out | std::ios::binary);
-  if (!dst.is_open()) {
+  std::error_code EC;
+  llvm::raw_fd_ostream dst(dst_file_spec.GetPath(), EC, llvm::sys::fs::F_None);
+  if (EC) {
 error.SetErrorStringWithFormat("unable to open destination file: %s",
dst_file_spec.GetPath().c_str());
 return error;
Index: lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp
===
--- lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp
+++ lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp
@@ -402,13 +402,14 @@
 return error;
 
   const auto output_filename = output_file_spec.GetPath();
-  std::ofstream dst(output_filename, std::ios::out | std::ios::binary);
-  if (!dst.is_open())
+  std::error_code EC;
+  llvm::raw_fd_ostream dst(output_filename, EC, llvm::sys::fs::F_None);
+  if (EC)
 return Error("Unable to open local file %s", output_filename.c_str());
 
   dst.write(_buffer[0], output_buffer.size());
   dst.close();
-  if (!dst)
+  if (dst.has_error())
 return Error("Failed to write file %s", output_filename.c_str());
   return Error();
 }
@@ -428,8 +429,9 @@
   const auto local_file_path = local_file.GetPath();
   llvm::FileRemover local_file_remover(local_file_path);
 
-  std::ofstream dst(local_file_path, std::ios::out | std::ios::binary);
-  if (!dst.is_open())
+  std::error_code EC;
+  llvm::raw_fd_ostream dst(local_file_path, EC, llvm::sys::fs::F_None);
+  if (EC)
 return Error("Unable to open local file %s", local_file_path.c_str());
 
   const auto remote_file_path = remote_file.GetPath(false);
@@ -447,6 +449,9 @@
 if (!eof)
   dst.write([0], chunk.size());
   }
+  dst.close();
+  if (dst.has_error())
+return Error("Failed to write file %s", local_file_path.c_str());
 
   local_file_remover.releaseFile();
   return error;
Index: lldb/trunk/tools/lldb-server/lldb-platform.cpp
===
--- lldb/trunk/tools/lldb-server/lldb-platform.cpp
+++ lldb/trunk/tools/lldb-server/lldb-platform.cpp
@@ -106,23 +106,25 @@
 return Error("Failed to create directory %s: %s",
  temp_file_spec.GetCString(), error.AsCString());
 
-  llvm::SmallString temp_file_path;
+  llvm::SmallString<64> temp_file_path;
   temp_file_spec.AppendPathComponent("port-file.%%");
-  auto err_code = llvm::sys::fs::createUniqueFile(temp_file_spec.GetCString(),
+  int FD;
+  auto err_code = llvm::sys::fs::createUniqueFile(temp_file_spec.GetPath(), FD,
   temp_file_path);
   if (err_code)
 return Error("Failed to create temp file: %s", err_code.message().c_str());
 
-  llvm::FileRemover tmp_file_remover(temp_file_path.c_str());
+  llvm::FileRemover tmp_file_remover(temp_file_path);
 
   {
-std::ofstream temp_file(temp_file_path.c_str(), std::ios::out);
-if (!temp_file.is_open())
-  return Error("Failed to open temp file %s", temp_file_path.c_str());
+llvm::raw_fd_ostream temp_file(FD, true);
 temp_file << socket_id;
+temp_file.close();
+if (temp_file.has_error())
+  return Error("Failed to write to port file.");
   }
 
-  err_code = llvm::sys::fs::rename(temp_file_path.c_str(), 
file_spec.GetPath());
+  err_code = llvm::sys::fs::rename(temp_file_path, file_spec.GetPath());
   if (err_code)
 return Error("Failed to rename file %s to %s: %s", temp_file_path.c_str(),
  file_spec.GetPath().c_str(), err_code.message().c_str());


Index: lldb/trunk/source/Target/Platform.cpp
===
--- lldb/trunk/source/Target/Platform.cpp
+++ lldb/trunk/source/Target/Platform.cpp
@@ -1645,8 +1645,9 @@
 const FileSpec _file_spec) {
   Error error;
 
-  std::ofstream dst(dst_file_spec.GetPath(), std::ios::out | std::ios::binary);
-  if (!dst.is_open()) {
+  std::error_code EC;
+  llvm::raw_fd_ostream dst(dst_file_spec.GetPath(), EC, llvm::sys::fs::F_None);
+  if (EC) {
 error.SetErrorStringWithFormat("unable to open destination file: %s",
  

[Lldb-commits] [lldb] r298375 - Replace std::ofstream with llvm::raw_fd_ostream

2017-03-21 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue Mar 21 08:49:50 2017
New Revision: 298375

URL: http://llvm.org/viewvc/llvm-project?rev=298375=rev
Log:
Replace std::ofstream with llvm::raw_fd_ostream

Summary:
ofstream does not handle paths with non-ascii characters correctly on
windows, so I am switching these to llvm streams to fix that.

Reviewers: zturner, eugene

Subscribers: lldb-commits

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

Modified:
lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp
lldb/trunk/source/Target/Platform.cpp
lldb/trunk/tools/lldb-server/lldb-platform.cpp

Modified: lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp?rev=298375=298374=298375=diff
==
--- lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp Tue Mar 21 
08:49:50 2017
@@ -402,13 +402,14 @@ Error AdbClient::ShellToFile(const char
 return error;
 
   const auto output_filename = output_file_spec.GetPath();
-  std::ofstream dst(output_filename, std::ios::out | std::ios::binary);
-  if (!dst.is_open())
+  std::error_code EC;
+  llvm::raw_fd_ostream dst(output_filename, EC, llvm::sys::fs::F_None);
+  if (EC)
 return Error("Unable to open local file %s", output_filename.c_str());
 
   dst.write(_buffer[0], output_buffer.size());
   dst.close();
-  if (!dst)
+  if (dst.has_error())
 return Error("Failed to write file %s", output_filename.c_str());
   return Error();
 }
@@ -428,8 +429,9 @@ Error AdbClient::SyncService::internalPu
   const auto local_file_path = local_file.GetPath();
   llvm::FileRemover local_file_remover(local_file_path);
 
-  std::ofstream dst(local_file_path, std::ios::out | std::ios::binary);
-  if (!dst.is_open())
+  std::error_code EC;
+  llvm::raw_fd_ostream dst(local_file_path, EC, llvm::sys::fs::F_None);
+  if (EC)
 return Error("Unable to open local file %s", local_file_path.c_str());
 
   const auto remote_file_path = remote_file.GetPath(false);
@@ -447,6 +449,9 @@ Error AdbClient::SyncService::internalPu
 if (!eof)
   dst.write([0], chunk.size());
   }
+  dst.close();
+  if (dst.has_error())
+return Error("Failed to write file %s", local_file_path.c_str());
 
   local_file_remover.releaseFile();
   return error;

Modified: lldb/trunk/source/Target/Platform.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Platform.cpp?rev=298375=298374=298375=diff
==
--- lldb/trunk/source/Target/Platform.cpp (original)
+++ lldb/trunk/source/Target/Platform.cpp Tue Mar 21 08:49:50 2017
@@ -1645,8 +1645,9 @@ Error Platform::DownloadModuleSlice(cons
 const FileSpec _file_spec) {
   Error error;
 
-  std::ofstream dst(dst_file_spec.GetPath(), std::ios::out | std::ios::binary);
-  if (!dst.is_open()) {
+  std::error_code EC;
+  llvm::raw_fd_ostream dst(dst_file_spec.GetPath(), EC, llvm::sys::fs::F_None);
+  if (EC) {
 error.SetErrorStringWithFormat("unable to open destination file: %s",
dst_file_spec.GetPath().c_str());
 return error;

Modified: lldb/trunk/tools/lldb-server/lldb-platform.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/lldb-platform.cpp?rev=298375=298374=298375=diff
==
--- lldb/trunk/tools/lldb-server/lldb-platform.cpp (original)
+++ lldb/trunk/tools/lldb-server/lldb-platform.cpp Tue Mar 21 08:49:50 2017
@@ -106,23 +106,25 @@ static Error save_socket_id_to_file(cons
 return Error("Failed to create directory %s: %s",
  temp_file_spec.GetCString(), error.AsCString());
 
-  llvm::SmallString temp_file_path;
+  llvm::SmallString<64> temp_file_path;
   temp_file_spec.AppendPathComponent("port-file.%%");
-  auto err_code = llvm::sys::fs::createUniqueFile(temp_file_spec.GetCString(),
+  int FD;
+  auto err_code = llvm::sys::fs::createUniqueFile(temp_file_spec.GetPath(), FD,
   temp_file_path);
   if (err_code)
 return Error("Failed to create temp file: %s", err_code.message().c_str());
 
-  llvm::FileRemover tmp_file_remover(temp_file_path.c_str());
+  llvm::FileRemover tmp_file_remover(temp_file_path);
 
   {
-std::ofstream temp_file(temp_file_path.c_str(), std::ios::out);
-if (!temp_file.is_open())
-  return Error("Failed to open temp file %s", temp_file_path.c_str());
+llvm::raw_fd_ostream temp_file(FD, true);
 temp_file << socket_id;
+temp_file.close();
+if (temp_file.has_error())
+  return Error("Failed to write to port file.");
   }
 
-  err_code = llvm::sys::fs::rename(temp_file_path.c_str(), 
file_spec.GetPath());
+  err_code = 

[Lldb-commits] [lldb] r298374 - Remove ProcFileReader

2017-03-21 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue Mar 21 08:49:45 2017
New Revision: 298374

URL: http://llvm.org/viewvc/llvm-project?rev=298374=rev
Log:
Remove ProcFileReader

This removes the last usage of ProcFileReader from NativeProcessLinux
and then deletes the class itself.

Removed:
lldb/trunk/source/Plugins/Process/Linux/ProcFileReader.cpp
lldb/trunk/source/Plugins/Process/Linux/ProcFileReader.h
Modified:
lldb/trunk/source/Plugins/Process/Linux/CMakeLists.txt
lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp

Modified: lldb/trunk/source/Plugins/Process/Linux/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/CMakeLists.txt?rev=298374=298373=298374=diff
==
--- lldb/trunk/source/Plugins/Process/Linux/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/Process/Linux/CMakeLists.txt Tue Mar 21 08:49:45 
2017
@@ -11,7 +11,6 @@ add_lldb_library(lldbPluginProcessLinux
   NativeRegisterContextLinux_mips64.cpp
   NativeRegisterContextLinux_s390x.cpp
   NativeThreadLinux.cpp
-  ProcFileReader.cpp
   SingleStepCheck.cpp
 
   LINK_LIBS

Modified: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp?rev=298374=298373=298374=diff
==
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp Tue Mar 21 
08:49:45 2017
@@ -46,7 +46,6 @@
 
 #include "NativeThreadLinux.h"
 #include "Plugins/Process/POSIX/ProcessPOSIXLog.h"
-#include "ProcFileReader.h"
 #include "Procfs.h"
 
 #include "llvm/Support/FileSystem.h"
@@ -1432,11 +1431,11 @@ Error NativeProcessLinux::Kill() {
 }
 
 static Error
-ParseMemoryRegionInfoFromProcMapsLine(const std::string _line,
+ParseMemoryRegionInfoFromProcMapsLine(llvm::StringRef _line,
   MemoryRegionInfo _region_info) {
   memory_region_info.Clear();
 
-  StringExtractor line_extractor(maps_line.c_str());
+  StringExtractor line_extractor(maps_line);
 
   // Format: {address_start_hex}-{address_end_hex} perms offset  dev   inode
   // pathname
@@ -1597,36 +1596,36 @@ Error NativeProcessLinux::PopulateMemory
 return Error();
   }
 
-  Error error = ProcFileReader::ProcessLineByLine(
-  GetID(), "maps", [&](const std::string ) -> bool {
-MemoryRegionInfo info;
-const Error parse_error =
-ParseMemoryRegionInfoFromProcMapsLine(line, info);
-if (parse_error.Success()) {
-  m_mem_region_cache.emplace_back(
-  info, FileSpec(info.GetName().GetCString(), true));
-  return true;
-} else {
-  LLDB_LOG(log, "failed to parse proc maps line '{0}': {1}", line,
-   parse_error);
-  return false;
-}
-  });
-
-  // If we had an error, we'll mark unsupported.
-  if (error.Fail()) {
+  auto BufferOrError = getProcFile(GetID(), "maps");
+  if (!BufferOrError) {
 m_supports_mem_region = LazyBool::eLazyBoolNo;
-return error;
-  } else if (m_mem_region_cache.empty()) {
+return BufferOrError.getError();
+  }
+  StringRef Rest = BufferOrError.get()->getBuffer();
+  while (! Rest.empty()) {
+StringRef Line;
+std::tie(Line, Rest) = Rest.split('\n');
+MemoryRegionInfo info;
+const Error parse_error = ParseMemoryRegionInfoFromProcMapsLine(Line, 
info);
+if (parse_error.Fail()) {
+  LLDB_LOG(log, "failed to parse proc maps line '{0}': {1}", Line,
+   parse_error);
+  m_supports_mem_region = LazyBool::eLazyBoolNo;
+  return parse_error;
+}
+m_mem_region_cache.emplace_back(
+info, FileSpec(info.GetName().GetCString(), true));
+  }
+
+  if (m_mem_region_cache.empty()) {
 // No entries after attempting to read them.  This shouldn't happen if
 // /proc/{pid}/maps is supported. Assume we don't support map entries
 // via procfs.
+m_supports_mem_region = LazyBool::eLazyBoolNo;
 LLDB_LOG(log,
  "failed to find any procfs maps entries, assuming no support "
  "for memory region metadata retrieval");
-m_supports_mem_region = LazyBool::eLazyBoolNo;
-error.SetErrorString("not supported");
-return error;
+return Error("not supported");
   }
 
   LLDB_LOG(log, "read {0} memory region entries from /proc/{1}/maps",

Removed: lldb/trunk/source/Plugins/Process/Linux/ProcFileReader.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/ProcFileReader.cpp?rev=298373=auto
==
--- lldb/trunk/source/Plugins/Process/Linux/ProcFileReader.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/ProcFileReader.cpp (removed)
@@ -1,103 +0,0 @@
-//===-- 

[Lldb-commits] [PATCH] D31146: Enable AUXV and QPassSignals in gdb-remote for NetBSD

2017-03-21 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In https://reviews.llvm.org/D31146#706249, @krytarowski wrote:

> I'm still evaluating whether to implement on the kernel side 
> `PT_SET_SIGPASS`/`PT_GET_SIGPASS`. Some software like floating point can use 
> it heavily.


Also there are programs which use SIGALRM or realtime signals very extensively, 
and those can get very much slowed down by a debugger. I think this would be a 
great addition, particularly as stopping a process is a much heavier operation 
on netbsd. I wish linux had that.


Repository:
  rL LLVM

https://reviews.llvm.org/D31146



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


[Lldb-commits] [PATCH] D31129: Remove remaining platform specific code from FileSpec

2017-03-21 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In https://reviews.llvm.org/D31129#705597, @zturner wrote:

> See what you think about this.  I've created a folder called `Mocks` under 
> `Utility`, and created a new target out of it.  `UtilityTests` links against 
> it, and so does `InterpreterTests`.  To do this I had to add the lldb project 
> root as an include directory, this way you can write `#include 
> "unittests/Utility/Mocks/MockTildeExpressionResolver.h"`.  Another 
> possibility would be to create `lldb/unittests/Mocks/Mocks/Utility`, and then 
> add `lldb/unittests/Mocks` as an include folder.  This way you could write 
> `#include "Mocks/Utility/MockTildeExpressionResolver.h"`.  I don't have a 
> strong preference either way.
>
> I explicitly chose NOT to make one single target for all mocks (although 
> there is only one right now obviously), because then you would have 
> `UtilityTests` bringing in mocks from projects it doesn't depend on, and thus 
> it would link against those projects as well, breaking the library layering.


It's not exactly the pinnacle of elegance, but I think this is better (and I 
don't know how I would improve it). The only thing I am not sure about is the 
`Mocks` folder name. I am thinking that we may run into the situation where we 
have some other test-only code we want to share, but it is not strictly a 
"mock". The only function that comes to mind right now is the 
`CreateConnectedSockets` from SocketTest.cpp -- I could have to reused this in 
gdb-remote tests, although I eventually opted for reimplementing it, as I could 
make it a lot simpler for this special case. (Although in this case it may have 
made sense to add a function like that to the regular codebase). I don't really 
have a good suggestion for a name though, so maybe we can leave this until a 
real case for it comes up.


https://reviews.llvm.org/D31129



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


[Lldb-commits] [PATCH] D31146: Enable AUXV and QPassSignals in gdb-remote for NetBSD

2017-03-21 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added a comment.

I'm still evaluating whether to implement on the kernel side 
`PT_SET_SIGPASS`/`PT_GET_SIGPASS`. Some software like floating point can use it 
heavily.


Repository:
  rL LLVM

https://reviews.llvm.org/D31146



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


[Lldb-commits] [PATCH] D31138: Add stub for PluginProcessNetBSD

2017-03-21 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added a comment.

In https://reviews.llvm.org/D31138#706216, @labath wrote:

> I like the idea of adding boilerplate first, so that we can than better focus 
> on the important stuff later. However, I think you've have gone a bit too far 
> with it -- you introduce a lot of functions I am pretty sure will not be 
> necessary for your case, or that should be handled differently (software 
> single stepping stuff, handling of linux thread stopping, ...).
>
> Could we trim this down to just the functions that are necessary to get this 
> building (basically just virtual overrides -- no private functions or 
> members)? Those can be always added along with the patch that implements 
> them, and then we will be in a better position to review it.


I will go for it. Your idea is good. I originally planned to trim unneeded 
chunks afterwards, but this direction is cleaner.


Repository:
  rL LLVM

https://reviews.llvm.org/D31138



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


[Lldb-commits] [PATCH] D31146: Enable AUXV and QPassSignals in gdb-remote for NetBSD

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

At one point we will need to come up with a better way to control these 
features.


Repository:
  rL LLVM

https://reviews.llvm.org/D31146



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


[Lldb-commits] [PATCH] D31138: Add stub for PluginProcessNetBSD

2017-03-21 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I like the idea of adding boilerplate first, so that we can than better focus 
on the important stuff later. However, I think you've have gone a bit too far 
with it -- you introduce a lot of functions I am pretty sure will not be 
necessary for your case, or that should be handled differently (software single 
stepping stuff, handling of linux thread stopping, ...).

Could we trim this down to just the functions that are necessary to get this 
building (basically just virtual overrides -- no private functions or members)? 
Those can be always added along with the patch that implements them, and then 
we will be in a better position to review it.


Repository:
  rL LLVM

https://reviews.llvm.org/D31138



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


[Lldb-commits] [PATCH] D31172: Move stop info override callback code from ArchSpec into Process

2017-03-21 Thread Zachary Turner via Phabricator via lldb-commits
zturner created this revision.

The only real consumer of this is the `Process` class, so it makes sense (both 
conceptually and from a layering standpoint) to hide this in the Process plugin.

This is intended to be NFC.


https://reviews.llvm.org/D31172

Files:
  lldb/include/lldb/Core/ArchSpec.h
  lldb/include/lldb/Target/Process.h
  lldb/source/Core/ArchSpec.cpp
  lldb/source/Interpreter/CommandObject.cpp
  lldb/source/Target/Process.cpp
  lldb/source/Target/Thread.cpp

Index: lldb/source/Target/Thread.cpp
===
--- lldb/source/Target/Thread.cpp
+++ lldb/source/Target/Thread.cpp
@@ -441,10 +441,7 @@
 if (m_stop_info_override_stop_id != process_stop_id) {
   m_stop_info_override_stop_id = process_stop_id;
   if (m_stop_info_sp) {
-ArchSpec::StopInfoOverrideCallbackType callback =
-GetProcess()->GetStopInfoOverrideCallback();
-if (callback)
-  callback(*this);
+GetProcess()->InvokeStopInfoOverrideCallback(*this);
   }
 }
   }
Index: lldb/source/Target/Process.cpp
===
--- lldb/source/Target/Process.cpp
+++ lldb/source/Target/Process.cpp
@@ -17,7 +17,9 @@
 #include "llvm/Support/Threading.h"
 
 // Project includes
+#include "Plugins/Process/Utility/ARMDefines.h"
 #include "Plugins/Process/Utility/InferiorCallPOSIX.h"
+#include "Plugins/Process/Utility/InstructionUtils.h"
 #include "lldb/Breakpoint/BreakpointLocation.h"
 #include "lldb/Breakpoint/StoppointCallbackContext.h"
 #include "lldb/Core/Debugger.h"
@@ -2397,6 +2399,104 @@
   return bytes_written;
 }
 
+static void StopInfoOverrideCallbackTypeARM(lldb_private::Thread ) {
+  // We need to check if we are stopped in Thumb mode in a IT instruction
+  // and detect if the condition doesn't pass. If this is the case it means
+  // we won't actually execute this instruction. If this happens we need to
+  // clear the stop reason to no thread plans think we are stopped for a
+  // reason and the plans should keep going.
+  //
+  // We do this because when single stepping many ARM processes, debuggers
+  // often use the BVR/BCR registers that says "stop when the PC is not
+  // equal to its current value". This method of stepping means we can end
+  // up stopping on instructions inside an if/then block that wouldn't get
+  // executed. By fixing this we can stop the debugger from seeming like
+  // you stepped through both the "if" _and_ the "else" clause when source
+  // level stepping because the debugger stops regardless due to the BVR/BCR
+  // triggering a stop.
+  //
+  // It also means we can set breakpoints on instructions inside an an
+  // if/then block and correctly skip them if we use the BKPT instruction.
+  // The ARM and Thumb BKPT instructions are unconditional even when executed
+  // in a Thumb IT block.
+  //
+  // If your debugger inserts software traps in ARM/Thumb code, it will
+  // need to use 16 and 32 bit instruction for 16 and 32 bit thumb
+  // instructions respectively. If your debugger inserts a 16 bit thumb
+  // trap on top of a 32 bit thumb instruction for an opcode that is inside
+  // an if/then, it will change the it/then to conditionally execute your
+  // 16 bit trap and then cause your program to crash if it executes the
+  // trailing 16 bits (the second half of the 32 bit thumb instruction you
+  // partially overwrote).
+
+  RegisterContextSP reg_ctx_sp(thread.GetRegisterContext());
+  if (reg_ctx_sp) {
+const uint32_t cpsr = reg_ctx_sp->GetFlags(0);
+if (cpsr != 0) {
+  // Read the J and T bits to get the ISETSTATE
+  const uint32_t J = Bit32(cpsr, 24);
+  const uint32_t T = Bit32(cpsr, 5);
+  const uint32_t ISETSTATE = J << 1 | T;
+  if (ISETSTATE == 0) {
+// NOTE: I am pretty sure we want to enable the code below
+// that detects when we stop on an instruction in ARM mode
+// that is conditional and the condition doesn't pass. This
+// can happen if you set a breakpoint on an instruction that
+// is conditional. We currently will _always_ stop on the
+// instruction which is bad. You can also run into this while
+// single stepping and you could appear to run code in the "if"
+// and in the "else" clause because it would stop at all of the
+// conditional instructions in both.
+// In such cases, we really don't want to stop at this location.
+// I will check with the lldb-dev list first before I enable this.
+#if 0
+// ARM mode: check for condition on intsruction
+const addr_t pc = reg_ctx_sp->GetPC();
+Error error;
+// If we fail to read the opcode we will get UINT64_MAX as the
+// result in "opcode" which we can use to detect if we read a
+// valid opcode.
+const uint64_t opcode = thread.GetProcess()->ReadUnsignedIntegerFromMemory(pc, 4, UINT64_MAX, error);
+if (opcode <= UINT32_MAX)
+{
+  const uint32_t condition = 

Re: [Lldb-commits] [lldb] r298338 - Revert r298334 until Zachary has a chance to fix the buildbot failure

2017-03-21 Thread Zachary Turner via lldb-commits
I found it, but in the future would you mind including a link to the
buildbot?

On Mon, Mar 20, 2017 at 9:57 PM Jason Molenda via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> Author: jmolenda
> Date: Mon Mar 20 23:45:10 2017
> New Revision: 298338
>
> URL: http://llvm.org/viewvc/llvm-project?rev=298338=rev
> Log:
> Revert r298334 until Zachary has a chance to fix the buildbot failure
> on macosx.
>
> Modified:
> lldb/trunk/include/lldb/Host/FileSystem.h
> lldb/trunk/source/Host/common/File.cpp
> lldb/trunk/source/Host/common/Host.cpp
> lldb/trunk/source/Host/macosx/Host.mm
> lldb/trunk/source/Host/posix/DomainSocket.cpp
> lldb/trunk/source/Host/posix/FileSystem.cpp
> lldb/trunk/source/Host/posix/PipePosix.cpp
> lldb/trunk/source/Host/windows/FileSystem.cpp
> lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
>
> lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
> lldb/trunk/source/Target/ModuleCache.cpp
> lldb/trunk/source/Target/Platform.cpp
>
> Modified: lldb/trunk/include/lldb/Host/FileSystem.h
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=298338=298337=298338=diff
>
> ==
> --- lldb/trunk/include/lldb/Host/FileSystem.h (original)
> +++ lldb/trunk/include/lldb/Host/FileSystem.h Mon Mar 20 23:45:10 2017
> @@ -26,15 +26,30 @@ public:
>static const char *DEV_NULL;
>static const char *PATH_CONVERSION_ERROR;
>
> +  static FileSpec::PathSyntax GetNativePathSyntax();
> +
> +  static lldb::user_id_t GetFileSize(const FileSpec _spec);
> +  static bool GetFileExists(const FileSpec _spec);
> +
> +  static Error Hardlink(const FileSpec , const FileSpec );
> +  static int GetHardlinkCount(const FileSpec _spec);
>static Error Symlink(const FileSpec , const FileSpec );
>static Error Readlink(const FileSpec , FileSpec );
> +  static Error Unlink(const FileSpec _spec);
>
>static Error ResolveSymbolicLink(const FileSpec , FileSpec );
>
> +  /// Return \b true if \a spec is on a locally mounted file system, \b
> false
> +  /// otherwise.
> +  static bool IsLocal(const FileSpec );
> +
>/// Wraps ::fopen in a platform-independent way. Once opened, FILEs can
> be
>/// manipulated and closed with the normal ::fread, ::fclose, etc.
> functions.
>static FILE *Fopen(const char *path, const char *mode);
>
> +  /// Wraps ::stat in a platform-independent way.
> +  static int Stat(const char *path, struct stat *stats);
> +
>static llvm::sys::TimePoint<> GetModificationTime(const FileSpec
> _spec);
>  };
>  }
>
> Modified: lldb/trunk/source/Host/common/File.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/File.cpp?rev=298338=298337=298338=diff
>
> ==
> --- lldb/trunk/source/Host/common/File.cpp (original)
> +++ lldb/trunk/source/Host/common/File.cpp Mon Mar 20 23:45:10 2017
> @@ -24,11 +24,11 @@
>  #endif
>
>  #include "llvm/Support/ConvertUTF.h"
> -#include "llvm/Support/FileSystem.h"
>  #include "llvm/Support/Process.h" // for
> llvm::sys::Process::FileDescriptorHasColors()
>
>  #include "lldb/Host/Config.h"
>  #include "lldb/Host/FileSpec.h"
> +#include "lldb/Host/FileSystem.h"
>  #include "lldb/Utility/DataBufferHeap.h"
>  #include "lldb/Utility/Error.h"
>  #include "lldb/Utility/Log.h"
> @@ -249,12 +249,14 @@ Error File::Open(const char *path, uint3
>
>  uint32_t File::GetPermissions(const FileSpec _spec, Error ) {
>if (file_spec) {
> -error.Clear();
> -auto Perms = llvm::sys::fs::getPermissions(file_spec.GetPath());
> -if (Perms)
> -  return *Perms;
> -error = Error(Perms.getError());
> -return 0;
> +struct stat file_stats;
> +int stat_result = FileSystem::Stat(file_spec.GetCString(),
> _stats);
> +if (stat_result == -1)
> +  error.SetErrorToErrno();
> +else {
> +  error.Clear();
> +  return file_stats.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
> +}
>} else
>  error.SetErrorString("empty file spec");
>return 0;
>
> Modified: lldb/trunk/source/Host/common/Host.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=298338=298337=298338=diff
>
> ==
> --- lldb/trunk/source/Host/common/Host.cpp (original)
> +++ lldb/trunk/source/Host/common/Host.cpp Mon Mar 20 23:45:10 2017
> @@ -51,6 +51,7 @@
>
>  #include "lldb/Core/ArchSpec.h"
>  #include "lldb/Host/FileSpec.h"
> +#include "lldb/Host/FileSystem.h"
>  #include "lldb/Host/Host.h"
>  #include "lldb/Host/HostInfo.h"
>  #include "lldb/Host/HostProcess.h"
> @@ -597,7 +598,8 @@ Error Host::RunShellCommand(const Args &
>  }
>}
>
> -  llvm::sys::fs::remove(output_file_spec.GetPath());
> +  if (FileSystem::GetFileExists(output_file_spec))
> +

[Lldb-commits] [lldb] r298340 - Resubmit r298334 after fixing OSX build errors.

2017-03-21 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Tue Mar 21 00:47:57 2017
New Revision: 298340

URL: http://llvm.org/viewvc/llvm-project?rev=298340=rev
Log:
Resubmit r298334 after fixing OSX build errors.

Hopefully this works, I can't test since I don't have Mac
hardware, however.

Modified:
lldb/trunk/include/lldb/Host/FileSystem.h
lldb/trunk/source/Host/common/File.cpp
lldb/trunk/source/Host/common/Host.cpp
lldb/trunk/source/Host/macosx/Host.mm
lldb/trunk/source/Host/posix/DomainSocket.cpp
lldb/trunk/source/Host/posix/FileSystem.cpp
lldb/trunk/source/Host/posix/PipePosix.cpp
lldb/trunk/source/Host/windows/FileSystem.cpp
lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
lldb/trunk/source/Target/ModuleCache.cpp
lldb/trunk/source/Target/Platform.cpp

Modified: lldb/trunk/include/lldb/Host/FileSystem.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=298340=298339=298340=diff
==
--- lldb/trunk/include/lldb/Host/FileSystem.h (original)
+++ lldb/trunk/include/lldb/Host/FileSystem.h Tue Mar 21 00:47:57 2017
@@ -26,30 +26,15 @@ public:
   static const char *DEV_NULL;
   static const char *PATH_CONVERSION_ERROR;
 
-  static FileSpec::PathSyntax GetNativePathSyntax();
-
-  static lldb::user_id_t GetFileSize(const FileSpec _spec);
-  static bool GetFileExists(const FileSpec _spec);
-
-  static Error Hardlink(const FileSpec , const FileSpec );
-  static int GetHardlinkCount(const FileSpec _spec);
   static Error Symlink(const FileSpec , const FileSpec );
   static Error Readlink(const FileSpec , FileSpec );
-  static Error Unlink(const FileSpec _spec);
 
   static Error ResolveSymbolicLink(const FileSpec , FileSpec );
 
-  /// Return \b true if \a spec is on a locally mounted file system, \b false
-  /// otherwise.
-  static bool IsLocal(const FileSpec );
-
   /// Wraps ::fopen in a platform-independent way. Once opened, FILEs can be
   /// manipulated and closed with the normal ::fread, ::fclose, etc. functions.
   static FILE *Fopen(const char *path, const char *mode);
 
-  /// Wraps ::stat in a platform-independent way.
-  static int Stat(const char *path, struct stat *stats);
-
   static llvm::sys::TimePoint<> GetModificationTime(const FileSpec _spec);
 };
 }

Modified: lldb/trunk/source/Host/common/File.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/File.cpp?rev=298340=298339=298340=diff
==
--- lldb/trunk/source/Host/common/File.cpp (original)
+++ lldb/trunk/source/Host/common/File.cpp Tue Mar 21 00:47:57 2017
@@ -24,11 +24,11 @@
 #endif
 
 #include "llvm/Support/ConvertUTF.h"
+#include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Process.h" // for 
llvm::sys::Process::FileDescriptorHasColors()
 
 #include "lldb/Host/Config.h"
 #include "lldb/Host/FileSpec.h"
-#include "lldb/Host/FileSystem.h"
 #include "lldb/Utility/DataBufferHeap.h"
 #include "lldb/Utility/Error.h"
 #include "lldb/Utility/Log.h"
@@ -249,14 +249,12 @@ Error File::Open(const char *path, uint3
 
 uint32_t File::GetPermissions(const FileSpec _spec, Error ) {
   if (file_spec) {
-struct stat file_stats;
-int stat_result = FileSystem::Stat(file_spec.GetCString(), _stats);
-if (stat_result == -1)
-  error.SetErrorToErrno();
-else {
-  error.Clear();
-  return file_stats.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
-}
+error.Clear();
+auto Perms = llvm::sys::fs::getPermissions(file_spec.GetPath());
+if (Perms)
+  return *Perms;
+error = Error(Perms.getError());
+return 0;
   } else
 error.SetErrorString("empty file spec");
   return 0;

Modified: lldb/trunk/source/Host/common/Host.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=298340=298339=298340=diff
==
--- lldb/trunk/source/Host/common/Host.cpp (original)
+++ lldb/trunk/source/Host/common/Host.cpp Tue Mar 21 00:47:57 2017
@@ -51,7 +51,6 @@
 
 #include "lldb/Core/ArchSpec.h"
 #include "lldb/Host/FileSpec.h"
-#include "lldb/Host/FileSystem.h"
 #include "lldb/Host/Host.h"
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Host/HostProcess.h"
@@ -598,8 +597,7 @@ Error Host::RunShellCommand(const Args &
 }
   }
 
-  if (FileSystem::GetFileExists(output_file_spec))
-FileSystem::Unlink(output_file_spec);
+  llvm::sys::fs::remove(output_file_spec.GetPath());
   return error;
 }
 

Modified: lldb/trunk/source/Host/macosx/Host.mm
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Host.mm?rev=298340=298339=298340=diff
==
--- lldb/trunk/source/Host/macosx/Host.mm (original)
+++