pkgsrc-WIP-changes archive

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

lldb-netbsd: Enable TRAP_LWP events



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Mon Apr 24 13:13:43 2017 +0200
Changeset:	48c9c91b0b96b06062e03982763c0a4acc240221

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

Log Message:
lldb-netbsd: Enable TRAP_LWP events

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=48c9c91b0b96b06062e03982763c0a4acc240221

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

diffstat:
 lldb-netbsd/distinfo                               |  2 +
 ..._Plugins_Process_NetBSD_NativeProcessNetBSD.cpp | 47 ++++++++++++++++++++++
 ...ce_Plugins_Process_NetBSD_NativeProcessNetBSD.h | 13 ++++++
 3 files changed, 62 insertions(+)

diffs:
diff --git a/lldb-netbsd/distinfo b/lldb-netbsd/distinfo
index dee7f2b49f..195b6fe4ad 100644
--- a/lldb-netbsd/distinfo
+++ b/lldb-netbsd/distinfo
@@ -13,5 +13,7 @@ SHA1 (llvm-3.6.2.src.tar.xz) = 7a00257eb2bc9431e4c77c3a36b033072c54bc7e
 RMD160 (llvm-3.6.2.src.tar.xz) = 521cbc5fe2925ea3c6e90c7a31f752a04045c972
 Size (llvm-3.6.2.src.tar.xz) = 12802380 bytes
 SHA1 (patch-source_Plugins_ObjectFile_ELF_ObjectFileELF.cpp) = 76d47d654951d36dc493611dfa636c1dcff0c3af
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp) = 025b382752b8d21633fb4e5572f5445cfc7ef598
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h) = 61e3deeb3cdceea4dd976a2526231169b0c3d5c5
 SHA1 (patch-source_Plugins_Process_elf-core_ProcessElfCore.cpp) = 16d6404b9565bee3a8dd67e9743eeb36bf20d613
 SHA1 (patch-source_Plugins_Process_elf-core_ProcessElfCore.h) = 902ce5e0187aa2649986db08c79af7291b852727
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp
new file mode 100644
index 0000000000..d6eaf9e643
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp
@@ -0,0 +1,47 @@
+$NetBSD$
+
+--- source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp.orig	2017-04-19 03:59:21.000000000 +0000
++++ source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
+@@ -778,6 +778,17 @@ Error NativeProcessNetBSD::LaunchInferio
+          "Could not sync with inferior process.");
+ 
+   LLDB_LOG(log, "inferior started, now in stopped state");
++  error = SetDefaultPtraceOpts(pid);
++  if (error.Fail()) {
++    LLDB_LOG(log, "failed to set default ptrace options: {0}", error);
++
++    // Mark the inferior as invalid.
++    // FIXME this could really use a new state - eStateLaunchFailure.  For now,
++    // using eStateInvalid.
++    SetState(StateType::eStateInvalid);
++
++    return error;
++  }
+ 
+   // Release the master terminal descriptor and pass it off to the
+   // NativeProcessNetBSD instance.  Similarly stash the inferior pid.
+@@ -945,6 +956,10 @@ NativeThreadNetBSDSP NativeProcessNetBSD
+     return -1;
+   }
+ 
++  error = SetDefaultPtraceOpts(tid);
++  if (error.Fail())
++    return -1;
++
+   for (const auto &thread_sp : m_threads) {
+     static_pointer_cast<NativeThreadNetBSD>(thread_sp)->SetStoppedBySignal(
+         SIGSTOP);
+@@ -1071,3 +1086,13 @@ Error NativeProcessNetBSD::ReinitializeT
+ 
+   return error;
+ }
++
++Error NativeProcessNetBSD::SetDefaultPtraceOpts() {
++  ptrace_event_t event;
++
++  // Trace thread (LWP) creation and termination
++  // These events will trigger SIGTRAP with si_code TRAP_LWP
++  event.pe_set_event = PTRACE_LWP_CREATE | PTRACE_LWP_EXIT;
++
++  return PtraceWrapper(PT_SET_EVENT_MASK, GetID(), &event, sizeof(event));
++}
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h
new file mode 100644
index 0000000000..11573e7c22
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- source/Plugins/Process/NetBSD/NativeProcessNetBSD.h.orig	2017-03-30 22:14:30.000000000 +0000
++++ source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
+@@ -133,6 +133,8 @@ private:
+   ::pid_t Attach(lldb::pid_t pid, Error &error);
+ 
+   Error ReinitializeThreads();
++
++  Error SetDefaultPtraceOpts();
+ };
+ 
+ } // namespace process_netbsd


Home | Main Index | Thread Index | Old Index