@@ -379,6 +379,29 @@ void NativeProcessNetBSD::MonitorSignal(lldb::pid_t pid, int signal) {
379
379
SetState (StateType::eStateStopped, true );
380
380
}
381
381
382
+ Status NativeProcessNetBSD::StopProcess (lldb::pid_t pid) {
383
+ #ifdef PT_STOP
384
+ return PtraceWrapper (PT_STOP, pid);
385
+ #else
386
+ Log *log = GetLog (POSIXLog::Ptrace);
387
+ Status error;
388
+ int ret;
389
+
390
+ errno = 0 ;
391
+ ret = kill (pid, SIGSTOP);
392
+
393
+ if (ret == -1 )
394
+ error.SetErrorToErrno ();
395
+
396
+ LLDB_LOG (log, " kill({0}, SIGSTOP)" , pid);
397
+
398
+ if (error.Fail ())
399
+ LLDB_LOG (log, " kill() failed: {0}" , error);
400
+
401
+ return error;
402
+ #endif
403
+ }
404
+
382
405
Status NativeProcessNetBSD::PtraceWrapper (int req, lldb::pid_t pid, void *addr,
383
406
int data, int *result) {
384
407
Log *log = GetLog (POSIXLog::Ptrace);
@@ -531,7 +554,7 @@ Status NativeProcessNetBSD::Resume(const ResumeActionList &resume_actions) {
531
554
return ret;
532
555
}
533
556
534
- Status NativeProcessNetBSD::Halt () { return PtraceWrapper (PT_STOP, GetID ()); }
557
+ Status NativeProcessNetBSD::Halt () { return StopProcess ( GetID ()); }
535
558
536
559
Status NativeProcessNetBSD::Detach () {
537
560
Status error;
@@ -555,9 +578,7 @@ Status NativeProcessNetBSD::Signal(int signo) {
555
578
return error;
556
579
}
557
580
558
- Status NativeProcessNetBSD::Interrupt () {
559
- return PtraceWrapper (PT_STOP, GetID ());
560
- }
581
+ Status NativeProcessNetBSD::Interrupt () { return StopProcess (GetID ()); }
561
582
562
583
Status NativeProcessNetBSD::Kill () {
563
584
Log *log = GetLog (POSIXLog::Process);
0 commit comments