pkgsrc-WIP-changes archive

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

lldb-netbsd: add a preliminary patch for auxv reading



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Mon Feb 6 23:23:47 2017 +0100
Changeset:	ff003a84dfa52fd71e26291ae874dd2d524be3fc

Modified Files:
	lldb-netbsd/distinfo
Added Files:
	lldb-netbsd/patches/patch-source_Host_netbsd_Host.cpp

Log Message:
lldb-netbsd: add a preliminary patch for auxv reading

Work in progress.

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=ff003a84dfa52fd71e26291ae874dd2d524be3fc

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

diffstat:
 lldb-netbsd/distinfo                               |  1 +
 .../patches/patch-source_Host_netbsd_Host.cpp      | 48 ++++++++++++++++++++++
 2 files changed, 49 insertions(+)

diffs:
diff --git a/lldb-netbsd/distinfo b/lldb-netbsd/distinfo
index c37a01b274..51256dd190 100644
--- a/lldb-netbsd/distinfo
+++ b/lldb-netbsd/distinfo
@@ -17,6 +17,7 @@ SHA1 (patch-include_lldb_Host_netbsd_HostThreadNetBSD.h) = 79f207cdb9da2ef57d39e
 SHA1 (patch-source_CMakeLists.txt) = 5dacabc3f39c23bdfd432b5a4895866157b97aa0
 SHA1 (patch-source_Host_common_Host.cpp) = 7d48b8bb1e4350ba6d3ddc6357b9b8dc82d6b32d
 SHA1 (patch-source_Host_common_NativeProcessProtocol.cpp) = 23cc7da280b2123cf0206f3d5660d2647935edbc
+SHA1 (patch-source_Host_netbsd_Host.cpp) = bc19754c964ea8242f6bf83ef7b3d3c4bf02c35b
 SHA1 (patch-source_Host_netbsd_HostThreadNetBSD.cpp) = a1b0fbdad062309a845cfefe4469614fbbe9d20e
 SHA1 (patch-source_Host_netbsd_ThisThread.cpp) = f0d32c81bc1b8fe9aeb86519ea46ba2cb16571c2
 SHA1 (patch-source_Initialization_SystemInitializerCommon.cpp) = 80c850b980fe2902f10e441df7a18f428dd1154a
diff --git a/lldb-netbsd/patches/patch-source_Host_netbsd_Host.cpp b/lldb-netbsd/patches/patch-source_Host_netbsd_Host.cpp
new file mode 100644
index 0000000000..f46c6ccdcd
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Host_netbsd_Host.cpp
@@ -0,0 +1,48 @@
+$NetBSD$
+
+--- source/Host/netbsd/Host.cpp.orig	2017-02-04 18:35:35.000000000 +0000
++++ source/Host/netbsd/Host.cpp
+@@ -1,5 +1,4 @@
+-//===-- source/Host/netbsd/Host.cpp ------------------------------*- C++
+-//-*-===//
++//===-- source/Host/netbsd/Host.cpp -----------------------------*- C++ -*-===//
+ //
+ //                     The LLVM Compiler Infrastructure
+ //
+@@ -260,7 +259,35 @@ bool Host::GetProcessInfo(lldb::pid_t pi
+ }
+ 
+ lldb::DataBufferSP Host::GetAuxvData(lldb_private::Process *process) {
+-  return lldb::DataBufferSP();
++  /*
++   * ELF_AUX_ENTRIES is currently restricted to kernel
++   * (<sys/exec_elf.h> r. 1.155 specifies 15)
++   *
++   * ptrace(2) returns the whole AUXV including extra fiels after AT_NULL this
++   * information isn't needed.
++   */
++  size_t auxv_size = 100 * sizeof(AuxInfo);
++  DataBufferSP buf_sp;
++
++  std::unique_ptr<DataBufferHeap> buf_ap(new DataBufferHeap(auxv_size, 0));
++
++  struct ptrace_io_desc io = {
++    .piod_op = PIOD_READ_AUXV,
++    .piod_offs = 0,
++    .piod_addr = buf_ap->GetBytes(),
++    .piod_len = auxv_size
++  };
++
++  if (ptrace(PT_IO, process->GetID(), &io, 0) == -1) {
++    perror("ptrace failed on auxv");
++  } else if (io.piod_len < 1) {
++    perror("empty result for auxv");
++  } else {
++    /* Everything fine */
++    buf_sp.reset(buf_ap.release());
++  }
++
++  return buf_sp;
+ }
+ 
+ Error Host::ShellExpandArguments(ProcessLaunchInfo &launch_info) {


Home | Main Index | Thread Index | Old Index