pkgsrc-WIP-changes archive

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

lldb-netbsd: Resurrect PT_STEP, TRAP_TRACE, TRAP_EXEC



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Wed Mar 29 02:46:07 2017 +0200
Changeset:	67b71dc4cadba48ff0be0ab25e0e85c0726a5234

Modified Files:
	lldb-netbsd/distinfo
	lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp
Removed Files:
	lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_CMakeLists.txt
	lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h
	lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.h
	lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp
	lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h

Log Message:
lldb-netbsd: Resurrect PT_STEP, TRAP_TRACE, TRAP_EXEC

This is work in progress to rebase to new trunk.

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=67b71dc4cadba48ff0be0ab25e0e85c0726a5234

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

diffstat:
 lldb-netbsd/distinfo                               |  7 +--
 ...ch-source_Plugins_Process_NetBSD_CMakeLists.txt |  2 -
 ..._Plugins_Process_NetBSD_NativeProcessNetBSD.cpp | 70 ++++++++++++++++++++++
 ...ce_Plugins_Process_NetBSD_NativeProcessNetBSD.h |  2 -
 ...ns_Process_NetBSD_NativeRegisterContextNetBSD.h |  2 -
 ...e_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp |  2 -
 ...rce_Plugins_Process_NetBSD_NativeThreadNetBSD.h |  2 -
 7 files changed, 71 insertions(+), 16 deletions(-)

diffs:
diff --git a/lldb-netbsd/distinfo b/lldb-netbsd/distinfo
index 3475bb4595..514a56a3d3 100644
--- a/lldb-netbsd/distinfo
+++ b/lldb-netbsd/distinfo
@@ -16,15 +16,10 @@ SHA1 (patch-source_CMakeLists.txt) = 5dacabc3f39c23bdfd432b5a4895866157b97aa0
 SHA1 (patch-source_Host_common_Host.cpp) = 7d48b8bb1e4350ba6d3ddc6357b9b8dc82d6b32d
 SHA1 (patch-source_Host_netbsd_Host.cpp) = 92ea9aa9c21d11126e7532a860e59f408175d8d4
 SHA1 (patch-source_Plugins_DynamicLoader_POSIX-DYLD_DYLDRendezvous.cpp) = 32d683eb388ded96e7f9aedec827202b5b056392
-SHA1 (patch-source_Plugins_Process_NetBSD_CMakeLists.txt) = adc83b19e793491b1c6ea0fd8b46cd9f32e592fc
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp) = adc83b19e793491b1c6ea0fd8b46cd9f32e592fc
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h) = adc83b19e793491b1c6ea0fd8b46cd9f32e592fc
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp) = 571634cea5b2fc369e4ff2c5807b81cf820ff380
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.cpp) = b167df99822ea185082ff5fb03683653cbadc685
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.h) = adc83b19e793491b1c6ea0fd8b46cd9f32e592fc
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.cpp) = bbd23695df72cde26bbad7280a801d677f75e73b
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.h) = d883851599eb3278df6f3b2b5854ede3589713f5
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp) = adc83b19e793491b1c6ea0fd8b46cd9f32e592fc
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h) = adc83b19e793491b1c6ea0fd8b46cd9f32e592fc
 SHA1 (patch-source_Plugins_Process_elf-core_ProcessElfCore.cpp) = 0a64e526ed3eca089ee54d3bb54385f4d26fc7d1
 SHA1 (patch-source_Plugins_Process_elf-core_ThreadElfCore.cpp) = 3427bd2e2de3cd2947123c2f20ed8d5082a16ace
 SHA1 (patch-source_Plugins_Process_minidump_ProcessMinidump.cpp) = a71464df2ef56b8b2c8905e8169a85a05cfd27ba
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_CMakeLists.txt b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_CMakeLists.txt
deleted file mode 100644
index afc76512f4..0000000000
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_CMakeLists.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-$NetBSD$
-
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp
index afc76512f4..9597a1862a 100644
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp
@@ -1,2 +1,72 @@
 $NetBSD$
 
+--- source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp.orig	2017-03-29 00:14:15.000000000 +0000
++++ source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
+@@ -235,6 +235,41 @@ void NativeProcessNetBSD::MonitorSIGTRAP
+       }
+       SetState(StateType::eStateStopped, true);
+       break;
++    case TRAP_TRACE:
++      for (const auto &thread_sp : m_threads) {
++        static_pointer_cast<NativeThreadNetBSD>(thread_sp)->SetStoppedByTrace();
++      }
++      SetState(StateType::eStateStopped, true);
++      break;
++    case TRAP_EXEC:
++      {
++      // Clear old threads
++      m_threads.clear();
++
++      // Initialize new thread
++      struct ptrace_lwpinfo info = {};
++      Error error = PtraceWrapper(PT_LWPINFO, pid, &info, sizeof(info));
++      if (error.Fail()) {
++        SetState(StateType::eStateInvalid);
++        return;
++      }
++      // Reinitialize from scratch threads and register them in process
++      while (info.pl_lwpid != 0) {
++        NativeThreadNetBSDSP thread_sp = AddThread(info.pl_lwpid);
++        thread_sp->SetStoppedByExec();
++        error = PtraceWrapper(PT_LWPINFO, pid, &info, sizeof(info));
++        if (error.Fail()) {
++          SetState(StateType::eStateInvalid);
++          return;
++        }
++      }
++
++      // Let our delegate know we have just exec'd.
++      NotifyDidExec();
++
++      SetState(StateType::eStateStopped, true);
++      }
++      break;
+     }
+   }
+ }
+@@ -403,7 +438,14 @@ Error NativeProcessNetBSD::Resume(const 
+     break;
+   }
+   case eStateStepping:
+-    return Error("Not implemented");
++    // Run the thread, possibly feeding it the signal.
++    Error error = NativeProcessNetBSD::PtraceWrapper(PT_STEP, GetID(),(void *)1, action->signal);
++    if (!error.Success())
++      return error;
++    for (const auto &thread_sp : m_threads) {
++      static_pointer_cast<NativeThreadNetBSD>(thread_sp)->SetStepping();
++    }
++    SetState(eStateStepping, true)
+     break;
+ 
+   case eStateSuspended:
+@@ -850,9 +892,6 @@ NativeThreadNetBSDSP NativeProcessNetBSD
+ ::pid_t NativeProcessNetBSD::Attach(lldb::pid_t pid, Error &error) {
+   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
+ 
+-  // Use a map to keep track of the threads which we have attached/need to
+-  // attach.
+-  Host::TidMap tids_to_attach;
+   if (pid <= 1) {
+     error.SetErrorToGenericError();
+     error.SetErrorString("Attaching to process 1 is not allowed.");
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h
deleted file mode 100644
index afc76512f4..0000000000
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h
+++ /dev/null
@@ -1,2 +0,0 @@
-$NetBSD$
-
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.h b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.h
deleted file mode 100644
index afc76512f4..0000000000
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.h
+++ /dev/null
@@ -1,2 +0,0 @@
-$NetBSD$
-
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp
deleted file mode 100644
index afc76512f4..0000000000
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp
+++ /dev/null
@@ -1,2 +0,0 @@
-$NetBSD$
-
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h
deleted file mode 100644
index afc76512f4..0000000000
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h
+++ /dev/null
@@ -1,2 +0,0 @@
-$NetBSD$
-


Home | Main Index | Thread Index | Old Index