pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
lldb-netbsd: Set thread running/stepping on creation
Module Name: pkgsrc-wip
Committed By: Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By: kamil
Date: Wed Apr 26 00:20:46 2017 +0200
Changeset: b23438ef2489ab0c5fda530856713f54504221ec
Modified Files:
lldb-netbsd/distinfo
lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp
Log Message:
lldb-netbsd: Set thread running/stepping on creation
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=b23438ef2489ab0c5fda530856713f54504221ec
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 | 61 ++++++++++++++--------
2 files changed, 39 insertions(+), 24 deletions(-)
diffs:
diff --git a/lldb-netbsd/distinfo b/lldb-netbsd/distinfo
index 6225342b7d..467e43a841 100644
--- a/lldb-netbsd/distinfo
+++ b/lldb-netbsd/distinfo
@@ -13,7 +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) = b679b0c0f49d7654fffc134f15a213e96b77cbff
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp) = 288f34fab5a692710941046358b84e5e98ca59da
SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h) = 0dbad0c386c14eec866f469deb9b49e689391891
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
index bead60b2bc..128a2553dc 100644
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp
@@ -56,7 +56,7 @@ $NetBSD$
case TRAP_EXEC: {
Error error = ReinitializeThreads();
if (error.Fail()) {
-@@ -254,11 +266,44 @@ void NativeProcessNetBSD::MonitorSIGTRAP
+@@ -254,11 +266,59 @@ void NativeProcessNetBSD::MonitorSIGTRAP
// Let our delegate know we have just exec'd.
NotifyDidExec();
@@ -78,9 +78,19 @@ $NetBSD$
+ GetID(), info.psi_lwpid, error);
+ }
+ switch (state.pe_report_event) {
-+ case PTRACE_LWP_CREATE:
-+ AddThread(state.pe_lwp);
-+ break;
++ case PTRACE_LWP_CREATE: {
++ auto thread = AddThread(state.pe_lwp);
++ switch (GetState()) {
++ case eStateRunning:
++ thread->SetRunning();
++ break;
++ case eStateStepping:
++ thread->SetStepping();
++ break;
++ default:
++ llvm_unreachable("Unexpected state");
++ }
++ } break;
+ case PTRACE_LWP_EXIT:
+ error = RemoveThread(state.pe_lwp);
+ if (error.Fail()) {
@@ -90,21 +100,26 @@ $NetBSD$
+ default:
+ llvm_unreachable("Unexpected state");
+ };
-+ if (GetState() == eStateRunning || GetState() == eStateStepping) {
-+ error = NativeProcessNetBSD::PtraceWrapper(
-+ GetState() == eStateRunning ? PT_CONTINUE : PT_STEP, GetID(),
-+ (void *)1, 0);
-+ if (error.Fail()) {
-+ LLDB_LOG(log, "received error while resuming process: {0} ", error);
-+ }
-+ } else {
++ switch (GetState()) {
++ case eStateRunning:
++ error = NativeProcessNetBSD::PtraceWrapper(PT_CONTINUE, GetID(),
++ (void *)1, 0);
++ break;
++ case eStateStepping:
++ error =
++ NativeProcessNetBSD::PtraceWrapper(PT_STEP, GetID(), (void *)1, 0);
++ break;
++ default:
+ llvm_unreachable("Unexpected state");
+ }
++ if (error.Fail()) {
++ LLDB_LOG(log, "received error while resuming process: {0} ", error);
++ }
+ } break;
case TRAP_DBREG: {
// If a watchpoint was hit, report it
uint32_t wp_index;
-@@ -267,16 +312,25 @@ void NativeProcessNetBSD::MonitorSIGTRAP
+@@ -267,16 +327,25 @@ void NativeProcessNetBSD::MonitorSIGTRAP
->GetRegisterContext()
->GetWatchpointHitIndex(wp_index,
(uintptr_t)info.psi_siginfo.si_addr);
@@ -134,7 +149,7 @@ $NetBSD$
SetState(StateType::eStateStopped, true);
break;
}
-@@ -287,19 +341,33 @@ void NativeProcessNetBSD::MonitorSIGTRAP
+@@ -287,19 +356,33 @@ void NativeProcessNetBSD::MonitorSIGTRAP
->GetRegisterContext()
->GetHardwareBreakHitIndex(bp_index,
(uintptr_t)info.psi_siginfo.si_addr);
@@ -172,7 +187,7 @@ $NetBSD$
} break;
}
}
-@@ -311,10 +379,23 @@ void NativeProcessNetBSD::MonitorSignal(
+@@ -311,10 +394,23 @@ void NativeProcessNetBSD::MonitorSignal(
const auto siginfo_err =
PtraceWrapper(PT_GET_SIGINFO, pid, &info, sizeof(info));
@@ -192,14 +207,14 @@ $NetBSD$
+ SetState(StateType::eStateInvalid);
+ return;
+ }
-+ static_pointer_cast<NativeThreadNetBSD>(m_threads[index])->SetStoppedBySignal(
-+ info.psi_siginfo.si_signo, &info.psi_siginfo);
++ static_pointer_cast<NativeThreadNetBSD>(m_threads[index])
++ ->SetStoppedBySignal(info.psi_siginfo.si_signo, &info.psi_siginfo);
}
+
SetState(StateType::eStateStopped, true);
}
-@@ -812,6 +893,18 @@ Error NativeProcessNetBSD::LaunchInferio
+@@ -812,6 +908,18 @@ Error NativeProcessNetBSD::LaunchInferio
return error;
}
@@ -218,7 +233,7 @@ $NetBSD$
for (const auto &thread_sp : m_threads) {
static_pointer_cast<NativeThreadNetBSD>(thread_sp)->SetStoppedBySignal(
SIGSTOP);
-@@ -898,6 +991,42 @@ void NativeProcessNetBSD::SigchldHandler
+@@ -898,6 +1006,42 @@ void NativeProcessNetBSD::SigchldHandler
MonitorCallback(wait_pid, signal);
}
@@ -261,7 +276,7 @@ $NetBSD$
NativeThreadNetBSDSP NativeProcessNetBSD::AddThread(lldb::tid_t thread_id) {
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD));
-@@ -912,6 +1041,7 @@ NativeThreadNetBSDSP NativeProcessNetBSD
+@@ -912,6 +1056,7 @@ NativeThreadNetBSDSP NativeProcessNetBSD
auto thread_sp = std::make_shared<NativeThreadNetBSD>(this, thread_id);
m_threads.push_back(thread_sp);
@@ -269,7 +284,7 @@ $NetBSD$
return thread_sp;
}
-@@ -945,6 +1075,10 @@ NativeThreadNetBSDSP NativeProcessNetBSD
+@@ -945,6 +1090,10 @@ NativeThreadNetBSDSP NativeProcessNetBSD
return -1;
}
@@ -280,7 +295,7 @@ $NetBSD$
for (const auto &thread_sp : m_threads) {
static_pointer_cast<NativeThreadNetBSD>(thread_sp)->SetStoppedBySignal(
SIGSTOP);
-@@ -1062,7 +1196,7 @@ Error NativeProcessNetBSD::ReinitializeT
+@@ -1062,7 +1211,7 @@ Error NativeProcessNetBSD::ReinitializeT
}
// Reinitialize from scratch threads and register them in process
while (info.pl_lwpid != 0) {
@@ -289,7 +304,7 @@ $NetBSD$
error = PtraceWrapper(PT_LWPINFO, GetID(), &info, sizeof(info));
if (error.Fail()) {
return error;
-@@ -1071,3 +1205,13 @@ Error NativeProcessNetBSD::ReinitializeT
+@@ -1071,3 +1220,13 @@ Error NativeProcessNetBSD::ReinitializeT
return error;
}
Home |
Main Index |
Thread Index |
Old Index