pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lldb-netbsd: Kill procfs and PT_STEP walkaround (Linux/arm64)



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Mon Dec 19 01:38:01 2016 +0100
Changeset:	2e6f052e8a898bc87b35178f75b76eaad79f4d99

Modified Files:
	lldb-netbsd/distinfo
Removed Files:
	lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_ProcFileReader.cpp
	lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_ProcFileReader.h
	lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_Procfs.h
	lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_SingleStepCheck.cpp
	lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_SingleStepCheck.h

Log Message:
lldb-netbsd: Kill procfs and PT_STEP walkaround (Linux/arm64)

The procfs filesystem won't be used on NetBSD for LLDB.

Sponsored by <The NetBSD Foundation>

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=2e6f052e8a898bc87b35178f75b76eaad79f4d99

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 lldb-netbsd/distinfo                               |   5 -
 ...ource_Plugins_Process_NetBSD_ProcFileReader.cpp | 108 ---------------------
 ...-source_Plugins_Process_NetBSD_ProcFileReader.h |  42 --------
 .../patch-source_Plugins_Process_NetBSD_Procfs.h   |  36 -------
 ...urce_Plugins_Process_NetBSD_SingleStepCheck.cpp |  32 ------
 ...source_Plugins_Process_NetBSD_SingleStepCheck.h |  45 ---------
 6 files changed, 268 deletions(-)

diffs:
diff --git a/lldb-netbsd/distinfo b/lldb-netbsd/distinfo
index f5fab48..c6936c6 100644
--- a/lldb-netbsd/distinfo
+++ b/lldb-netbsd/distinfo
@@ -29,11 +29,6 @@ SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.c
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.h) = 18c60c7828dfa356dfe2cc6910a63137bb6143d3
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp) = 2af7386b293d6a087fddd6b62a6712195bcd0892
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h) = b65394500b6c5d01fcf3294a57ec5a8a086df45a
-SHA1 (patch-source_Plugins_Process_NetBSD_ProcFileReader.cpp) = dff1193e16aa79d8a577a3db4a9056521911d6f1
-SHA1 (patch-source_Plugins_Process_NetBSD_ProcFileReader.h) = c8393049c7303b466d3ce98ec5581a3155b71aff
-SHA1 (patch-source_Plugins_Process_NetBSD_Procfs.h) = 5994fa837260136b78cd0b4988dafc6f96ca1e3d
-SHA1 (patch-source_Plugins_Process_NetBSD_SingleStepCheck.cpp) = 3144f1ad3c33c43c6aa429f2490fdc0cebec1958
-SHA1 (patch-source_Plugins_Process_NetBSD_SingleStepCheck.h) = bc4196768184baca74068a48bb47413c7254d1ce
 SHA1 (patch-tools_lldb-mi_MICmnBase.cpp) = 851c82ac61e1241018755fbd7236af00379ac986
 SHA1 (patch-tools_lldb-mi_MICmnBase.h) = f550d5e10bcf02fb46472733acdbb820791f22e5
 SHA1 (patch-tools_lldb-mi_MIDriver.cpp) = bf1b5399e82bcfe54d6d852f64ed155328f2064d
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_ProcFileReader.cpp b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_ProcFileReader.cpp
deleted file mode 100644
index a532928..0000000
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_ProcFileReader.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-$NetBSD$
-
---- source/Plugins/Process/NetBSD/ProcFileReader.cpp.orig	2016-12-17 13:23:23.785197270 +0000
-+++ source/Plugins/Process/NetBSD/ProcFileReader.cpp
-@@ -0,0 +1,103 @@
-+//===-- ProcFileReader.cpp --------------------------------------*- C++ -*-===//
-+//
-+//                     The LLVM Compiler Infrastructure
-+//
-+// This file is distributed under the University of Illinois Open Source
-+// License. See LICENSE.TXT for details.
-+//
-+//===----------------------------------------------------------------------===//
-+
-+#include "Plugins/Process/NetBSD/ProcFileReader.h"
-+
-+// C Headers
-+#include <fcntl.h>
-+#include <inttypes.h>
-+#include <limits.h>
-+#include <stdio.h>
-+#include <sys/stat.h>
-+
-+// C++ Headers
-+#include <fstream>
-+
-+// LLDB Headers
-+#include "lldb/Core/DataBufferHeap.h"
-+#include "lldb/Core/Error.h"
-+
-+using namespace lldb_private;
-+using namespace lldb_private::process_netbsd;
-+
-+lldb::DataBufferSP ProcFileReader::ReadIntoDataBuffer(lldb::pid_t pid,
-+                                                      const char *name) {
-+  int fd;
-+  char path[PATH_MAX];
-+
-+  // Make sure we've got a nil terminated buffer for all the folks calling
-+  // GetBytes() directly off our returned DataBufferSP if we hit an error.
-+  lldb::DataBufferSP buf_sp(new DataBufferHeap(1, 0));
-+
-+  // Ideally, we would simply create a FileSpec and call ReadFileContents.
-+  // However, files in procfs have zero size (since they are, in general,
-+  // dynamically generated by the kernel) which is incompatible with the
-+  // current ReadFileContents implementation. Therefore we simply stream the
-+  // data into a DataBuffer ourselves.
-+  if (snprintf(path, PATH_MAX, "/proc/%" PRIu64 "/%s", pid, name) > 0) {
-+    if ((fd = open(path, O_RDONLY, 0)) >= 0) {
-+      size_t bytes_read = 0;
-+      std::unique_ptr<DataBufferHeap> buf_ap(new DataBufferHeap(1024, 0));
-+
-+      for (;;) {
-+        size_t avail = buf_ap->GetByteSize() - bytes_read;
-+        ssize_t status = read(fd, buf_ap->GetBytes() + bytes_read, avail);
-+
-+        if (status < 0)
-+          break;
-+
-+        if (status == 0) {
-+          buf_ap->SetByteSize(bytes_read);
-+          buf_sp.reset(buf_ap.release());
-+          break;
-+        }
-+
-+        bytes_read += status;
-+
-+        if (avail - status == 0)
-+          buf_ap->SetByteSize(2 * buf_ap->GetByteSize());
-+      }
-+
-+      close(fd);
-+    }
-+  }
-+
-+  return buf_sp;
-+}
-+
-+Error ProcFileReader::ProcessLineByLine(
-+    lldb::pid_t pid, const char *name,
-+    std::function<bool(const std::string &line)> line_parser) {
-+  Error error;
-+
-+  // Try to open the /proc/{pid}/maps entry.
-+  char filename[PATH_MAX];
-+  snprintf(filename, sizeof(filename), "/proc/%" PRIu64 "/%s", pid, name);
-+  filename[sizeof(filename) - 1] = '\0';
-+
-+  std::ifstream proc_file(filename);
-+  if (proc_file.fail()) {
-+    error.SetErrorStringWithFormat("failed to open file '%s'", filename);
-+    return error;
-+  }
-+
-+  // Read the file line by line, processing until either end of file or when the
-+  // line_parser returns false.
-+  std::string line;
-+  bool should_continue = true;
-+
-+  while (should_continue && std::getline(proc_file, line)) {
-+    // Pass the line over to the line_parser for processing.  If the line_parser
-+    // returns false, we
-+    // stop processing.
-+    should_continue = line_parser(line);
-+  }
-+
-+  return error;
-+}
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_ProcFileReader.h b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_ProcFileReader.h
deleted file mode 100644
index 9d0f966..0000000
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_ProcFileReader.h
+++ /dev/null
@@ -1,42 +0,0 @@
-$NetBSD$
-
---- source/Plugins/Process/NetBSD/ProcFileReader.h.orig	2016-12-17 13:23:23.785303988 +0000
-+++ source/Plugins/Process/NetBSD/ProcFileReader.h
-@@ -0,0 +1,37 @@
-+//===-- ProcFileReader.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_ProcFileReader_h_
-+#define liblldb_ProcFileReader_h_
-+
-+#include <functional>
-+
-+#include "lldb/lldb-forward.h"
-+#include "lldb/lldb-types.h"
-+
-+namespace lldb_private {
-+namespace process_netbsd {
-+
-+class ProcFileReader {
-+public:
-+  static lldb::DataBufferSP ReadIntoDataBuffer(lldb::pid_t pid,
-+                                               const char *name);
-+
-+  /// Parse the /proc/{@a pid}/{@a name} file line by line, passing each line to
-+  /// line_parser, until
-+  /// either end of file or until line_parser returns false.
-+  static Error
-+  ProcessLineByLine(lldb::pid_t pid, const char *name,
-+                    std::function<bool(const std::string &line)> line_parser);
-+};
-+
-+} // namespace process_netbsd
-+} // namespace lldb_private
-+
-+#endif // #ifndef liblldb_ProcFileReader_h_
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_Procfs.h b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_Procfs.h
deleted file mode 100644
index 1418fe6..0000000
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_Procfs.h
+++ /dev/null
@@ -1,36 +0,0 @@
-$NetBSD$
-
---- source/Plugins/Process/NetBSD/Procfs.h.orig	2016-12-17 13:23:23.785403906 +0000
-+++ source/Plugins/Process/NetBSD/Procfs.h
-@@ -0,0 +1,31 @@
-+//===-- Procfs.h ---------------------------------------------- -*- C++ -*-===//
-+//
-+//                     The LLVM Compiler Infrastructure
-+//
-+// This file is distributed under the University of Illinois Open Source
-+// License. See LICENSE.TXT for details.
-+//
-+//===----------------------------------------------------------------------===//
-+
-+// source/Plugins/Process/NetBSD/Procfs.h defines the symbols we need from
-+// sys/procfs.h on Android/NetBSD for all supported architectures.
-+
-+#include <sys/ptrace.h>
-+
-+#ifdef __ANDROID__
-+#if defined(__arm64__) || defined(__aarch64__)
-+typedef unsigned long elf_greg_t;
-+typedef elf_greg_t
-+    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
-+typedef struct user_fpsimd_state elf_fpregset_t;
-+#ifndef NT_FPREGSET
-+#define NT_FPREGSET NT_PRFPREG
-+#endif // NT_FPREGSET
-+#elif defined(__mips__)
-+#ifndef NT_FPREGSET
-+#define NT_FPREGSET NT_PRFPREG
-+#endif // NT_FPREGSET
-+#endif
-+#else // __ANDROID__
-+#include <sys/procfs.h>
-+#endif // __ANDROID__
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_SingleStepCheck.cpp b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_SingleStepCheck.cpp
deleted file mode 100644
index bea9134..0000000
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_SingleStepCheck.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-$NetBSD$
-
---- source/Plugins/Process/NetBSD/SingleStepCheck.cpp.orig	2016-12-17 13:23:23.785537353 +0000
-+++ source/Plugins/Process/NetBSD/SingleStepCheck.cpp
-@@ -0,0 +1,27 @@
-+//===-- SingleStepCheck.cpp ----------------------------------- -*- C++ -*-===//
-+//
-+//                     The LLVM Compiler Infrastructure
-+//
-+// This file is distributed under the University of Illinois Open Source
-+// License. See LICENSE.TXT for details.
-+//
-+//===----------------------------------------------------------------------===//
-+
-+#include "SingleStepCheck.h"
-+
-+#include <sched.h>
-+#include <signal.h>
-+#include <sys/wait.h>
-+#include <unistd.h>
-+
-+#include "NativeProcessNetBSD.h"
-+
-+#include "llvm/Support/Compiler.h"
-+
-+#include "lldb/Core/Error.h"
-+#include "lldb/Core/Log.h"
-+#include "lldb/Host/netbsd/Ptrace.h"
-+
-+using namespace lldb_private::process_netbsd;
-+
-+bool impl::SingleStepWorkaroundNeeded() { return false; }
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_SingleStepCheck.h b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_SingleStepCheck.h
deleted file mode 100644
index d7b30d4..0000000
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_SingleStepCheck.h
+++ /dev/null
@@ -1,45 +0,0 @@
-$NetBSD$
-
---- source/Plugins/Process/NetBSD/SingleStepCheck.h.orig	2016-12-17 13:23:23.785649014 +0000
-+++ source/Plugins/Process/NetBSD/SingleStepCheck.h
-@@ -0,0 +1,40 @@
-+//===-- SingleStepCheck.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_SingleStepCheck_H_
-+#define liblldb_SingleStepCheck_H_
-+
-+namespace lldb_private {
-+namespace process_netbsd {
-+
-+namespace impl {
-+extern bool SingleStepWorkaroundNeeded();
-+}
-+
-+// arm64 netbsd had a bug which prevented single-stepping and watchpoints from
-+// working on non-boot
-+// cpus, due to them being incorrectly initialized after coming out of suspend.
-+// This issue is
-+// particularly affecting android M, which uses suspend ("doze mode") quite
-+// aggressively. This
-+// code detects that situation and makes single-stepping work by doing all the
-+// step operations on
-+// the boot cpu.
-+//
-+// The underlying issue has been fixed in android N and netbsd 4.4. This code can
-+// be removed once
-+// these systems become obsolete.
-+inline bool SingleStepWorkaroundNeeded() {
-+  static bool value = impl::SingleStepWorkaroundNeeded();
-+  return value;
-+}
-+} // end namespace process_netbsd
-+} // end namespace lldb_private
-+
-+#endif // #ifndef liblldb_SingleStepCheck_H_


Home | Main Index | Thread Index | Old Index