[Lldb-commits] 'process kill' is not working

Filipe Cabecinhas filcab at gmail.com
Thu Jun 21 10:28:30 PDT 2012


Sorry, just a correction. I never get a sigpipe. Just a “Bad file descriptor” error. And here is the full log I got for it (what error I get, I never know):  

648 +21.543217 sec [9d6b/160f]: getpkt: $k#00  
649 +0.000051 sec [9d6b/0303]: MachProcess::Kill ()  
650 +0.000014 sec [9d6b/0303]: MachProcess::DoSIGSTOP() state = Stopped  
651 +0.000007 sec [9d6b/0303]: MachProcess::DisableAllBreakpoints (remove = 1 )  
652 +0.000007 sec [9d6b/0303]: MachProcess::DisableBreakpoint ( breakID = 3, remove = 1 ) addr = 0x7fff5fc0b269  
653 +0.000060 sec [9d6b/0303]: MachProcess::DisableBreakpoint ( breakID = 3, remove = 1 ) addr = 0x7fff5fc0b269 => success                                                                                                                 


654 +0.000010 sec [9d6b/0303]: MachProcess::DisableAllWatchpoints (remove = 1 )
655 +0.000006 sec [9d6b/0303]: MachProcess::DoSIGSTOP() state = Stopped -- resuming process  
656 +0.000016 sec [9d6b/0303]: Replying to exception 0...  
657 +0.000010 sec [9d6b/0303]: ::mach_msg ( msg->{bits = 0x12, size = 36, remote_port = 0x1d17, local_port = 0, reserved = 0x0, id = 0x9c9}, option = 0x41, send_size = 36, rcv_size = 0, rcv_name = 0, timeout = 0, notify = 0)
658 +0.000013 sec [9d6b/0303]: MachThreadList::UpdateThreadList (pid = 9d6a, update = 1) process stop count = 6  
659 +0.000016 sec [9d6b/0303]: ::task_threads ( task = 0x1a03, thread_list => 0x1023f2000, thread_list_count => 1 ) err = 0x00000000
660 +0.000016 sec [9d6b/0303]: MachThread::SetState ( Suspended ) for tid = 0x1e03  
661 +0.000006 sec [9d6b/0303]: MachThread::Suspend ( )  
662 +0.000025 sec [9d6b/0303]: ::thread_suspend (1e03) err = 0x00000000  
663 +0.000011 sec [9d6b/0303]: DNBArchImplX86_64::ThreadWillResume() GetDBGState() => 0x00000000.  
664 +0.000007 sec [9d6b/0303]: MachProcess::SetState ( Running )  
665 +0.000015 sec [9d6b/0303]: ::task_info ( target_task = 0x1a03, flavor = TASK_BASIC_INFO, task_info_out => 0x7fff61e62738, task_info_outCnt => 10 ) err = 0x00000000
666 +0.000008 sec [9d6b/0303]: ::task_resume ( target_task = 0x1a03 ) err = 0x00000000  
667 +0.000006 sec [9d6b/0303]: MachProcess::DoSIGSTOP() state = Running -- sending SIGSTOP  
668 +0.000006 sec [9d6b/0303]: MachProcess::Signal (signal = 17, timeout = 0x7fff61e62878)  
669 +0.000012 sec [9d6b/0303]: MachProcess::Signal (signal = 17, timeout = 0x7fff61e62878) waiting for signal to stopprocess...
670 +0.000022 sec [9d6b/1c03]: ::mach_msg ( msg->{bits = 0x80001112, size = 84 remote_port = 0x1d1b, local_port = 0x1b03, reserved = 0x2945f1c8, id = 0x965}, option = 0x402, send_size = 0, rcv_size = 1024, rcv_name = 0x1b03, timeout = 0, notify = 0) err = 0x00000000
671 +0.000016 sec [9d6b/1c03]: ::catch_mach_exception_raise ( exc_port = 0x1b03, thd_port = 0x1e03, tsk_port = 0x1a03, exc_type = 5 ( EXC_SOFTWARE ), exc_data[2] = { 0x10003, 0x11 })
672 +0.000023 sec [9d6b/1c03]: ::task_suspend ( target_task = 0x1a03 ) err = 0x00000000  
673 +0.000006 sec [9d6b/1c03]: MachProcess::ExceptionMessageReceived ( )  
674 +0.000014 sec [9d6b/1c03]: error: ::mach_msg ( msg->{bits = 0, size = 0 remote_port = 0, local_port = 0, reserved = 0x0, id = 0x0}, option = 0x502, send_size = 0, rcv_size = 1024, rcv_name = 0x1b03, timeout = 0, notify = 0) err = (ipc/rcv) timed out (0x10004003)                                                                                      


675 +0.000007 sec [9d6b/1c03]: void MachProcess::ExceptionMessageBundleComplete(): 1 exception messages.
676 +0.000008 sec [9d6b/1c03]: MachThreadList::UpdateThreadList (pid = 9d6a, update = 1) process stop count = 6  
677 +0.000021 sec [9d6b/1c03]: ::task_threads ( task = 0x1a03, thread_list => 0x1023f2000, thread_list_count => 1 ) err = 0x00000000
678 +0.000028 sec [9d6b/1c03]: thread = 0x1e03 calling thread_abort_safely (tid) => 0 (GetGPRState() for stop_count = 6)
679 +0.000046 sec [9d6b/1c03]: ::thread_get_state (0x1e03, 4, &gpr, 42) => 0x00000000  
    rax = 0000000100000ec0 rbx = 0000000000000000 rcx = 00007fff5fbff7d8 rdx = 00007fff5fbff6b0  
    rdi = 0000000100000f5c rsi = 00007fff5fbff6a0 rbp = 00007fff5fbff680 rsp = 00007fff5fbff670  
    r8 = 0000000000000016 r9 = 0000000000000000 r10 = 000000000000002c r11 = 0000000000000206  
    r12 = 0000000000000000 r13 = 0000000000000000 r14 = 0000000000000000 r15 = 0000000000000000  
    rip = 0000000100000f16  
    flg = 0000000000000202 cs = 000000000000002b fs = 0000000000000000 gs = 0000000000000000  
680 +0.000030 sec [9d6b/1c03]: MachThread::RestoreSuspendCountAfterStop ( )  
681 +0.000019 sec [9d6b/1c03]: ::thread_resume (1e03) err = 0x00000000  
682 +0.000015 sec [9d6b/1c03]: MachThread::SetState ( Stopped ) for tid = 0x1e03  
683 +0.000013 sec [9d6b/1c03]: exc_msg { bits = 0x80001112 size = 0x00000054 remote-port = 0x00001d1b local-port = 0x00001b03 reserved = 0x2945f1c8 id = 0x00000965 }
684 +0.000011 sec [9d6b/1c03]: reply_msg { bits = 0x00000012 size = 0x00000024 remote-port = 0x00001d1b local-port = 0x00000000 reserved = 0x00000000 id = 0x000009c9 }
685 +0.000009 sec [9d6b/1c03]: state { task_port = 0x1a03, thread_port = 0x1e03, exc_type = 5 (EXC_SOFTWARE) ...
686 +0.000008 sec [9d6b/1c03]: exc_data: EXC_SOFT_SIGNAL (17 (SIGSTOP))  
687 +0.000013 sec [9d6b/1c03]: [ 0] # 1 tid: 0x1e03, pc: 0x0000000100000f16, sp: 0x00007fff5fbff670, breakID: 0, user: 0.003997, system: 0.003336, cpu: 0, policy: 1, run_state: 3 (waiting), flags: 0, suspend_count: 0 (current 0), sleep_time: 0
688 +0.000009 sec [9d6b/1c03]: DNBBreakpointList::FindIDByAddress ( addr = 0x0000000100000f16 ) => NONE  
689 +0.000008 sec [9d6b/1c03]: MachProcess::SetState ( Stopped )  
690 +0.000020 sec [9d6b/1c03]: ::task_info ( target_task = 0x1a03, flavor = TASK_BASIC_INFO, task_info_out => 0x1026035e0, task_info_outCnt => 10 ) err = 0x00000000
691 +0.000004 sec [9d6b/0303]: MachProcess::Signal (signal = 17, timeout = 0x7fff61e62878) state = Stopped            


692 +0.000008 sec [9d6b/1c03]: got a timeout, continuing...  
693 +0.000017 sec [9d6b/0303]: MachProcess::Kill() DoSIGSTOP() state = Stopped  
694 +0.000017 sec [9d6b/1c03]: ::mach_msg ( msg->{bits = 0, size = 0 remote_port = 0, local_port = 0, reserved = 0x0, id = 0x0}, option = 0x402, send_size = 0, rcv_size = 1024, rcv_name = 0x1b03, timeout = 0, notify = 0)
695 +0.000025 sec [9d6b/0303]: MachProcess::Kill() DoSIGSTOP() ::ptrace (PT_KILL, pid=40298, 0, 0) => 0x00000000 ((null))
696 +0.000017 sec [9d6b/0303]: Replying to exception 0...  
697 +0.000020 sec [9d6b/0303]: error: ::ptrace (request = PT_THUPDATE, pid = 0x9d6a, tid = 0x1e03, signal = 0) err = Resource busy (0x00000010)
698 +0.000014 sec [9d6b/0303]: ::mach_msg ( msg->{bits = 0x12, size = 36, remote_port = 0x1d1b, local_port = 0, reserved = 0x0, id = 0x9c9}, option = 0x41, send_size = 36, rcv_size = 0, rcv_name = 0, timeout = 0, notify = 0)
699 +0.000016 sec [9d6b/0303]: MachThreadList::UpdateThreadList (pid = 9d6a, update = 1) process stop count = 7  
700 +0.000015 sec [9d6b/0303]: error: ::task_threads ( task = 0x1a03, thread_list => 0x0, thread_list_count => 0 ) err = (os/kern) invalid argument (0x00000004)
701 +0.000008 sec [9d6b/0303]: MachThread::SetState ( Running ) for tid = 0x1e03  
702 +0.000005 sec [9d6b/0303]: MachThread::Resume ( )  
703 +0.000005 sec [9d6b/0303]: MachThread::SetSuspendCountBeforeResume ( )  
704 +0.000008 sec [9d6b/0303]: DNBArchImplX86_64::ThreadWillResume() GetDBGState() => 0x00000025.  
705 +0.000006 sec [9d6b/0303]: MachProcess::SetState ( Running )  
706 +0.000015 sec [9d6b/0303]: error: ::task_info ( target_task = 0x1a03, flavor = TASK_BASIC_INFO, task_info_out => 0x7fff61e62898, task_info_outCnt => 10 ) err = (os/kern) invalid argument (0x00000004)
707 +0.000033 sec [9d6b/0303]: putpkt: $W09#00  
708 +0.000097 sec [9d6b/2003]: waitpid_process_thread (): waitpid (pid = 40298, &status, 0) => 40298, status = 9, errno = 0
709 +0.000014 sec [9d6b/2003]: waitpid_process_thread (): setting exit status for pid = 40298 to 9  
710 +0.000021 sec [9d6b/2003]: MachProcess::SetState ( Exited )  
711 +0.000041 sec [9d6b/0303]: MachProcess::GetAvailableSTDOUT (&0x7fff61e62b10[256]) ...  
712 +0.000043 sec [9d6b/0303]: putpkt: $X00#00  
713 +0.000030 sec [9d6b/160f]: error: ::read ( 2, 0x1025809c0, 1024 ) => -1 err = Bad file descriptor (0x00000009)




Thanks,

  Filipe


On Thursday, June 21, 2012 at 6:05 PM, Filipe Cabecinhas wrote:

> Hi all,  
>  
> I recently noticed that 'process kill' doesn't work for me (in trunk).
>  
> It seems that the timeout for waiting for replies is 1 sec, but debugserver takes longer and I get errors on both sides:
> lldb (timeout on GDBRemoteCommunication::WaitForPacketWithTimeoutMicroSecondsNoLock):
> Process 35242 exited with status = 6 (0x00000006) failed to send the k packet
>  
> debugserver:
> SIGPIPE when writing to the closed socket (on some cases), which makes it exit.
>  
> on other cases, it seems to hang (see the log below) on mach_msg
>  
> Worse: Right now I can't replicate the SIGPIPE version of the hang. Neither running lldb on Xcode (no breakpoints), nor running the same binary (~/Library/Developer/…) on the console.
>  
> I'm posting here because the person who wrote the code may figure out why it's failing faster than me :)
>  
> Regards,  
>  
> Filipe
>  
> P.S: More verbose logs:
> lldb not working (gdb-remote.{async,packets,process,verbose}, lldb.process)
>  
> <lldb.driver.main-thread> < 5> send packet: $k#00
> <lldb.driver.main-thread> size_t GDBRemoteCommunication::WaitForPacketWithTimeoutMicroSecondsNoLock(StringExtractorGDBRemote &, uint32_t): Read (buffer, (sizeof(buffer), timeout_usec = 0xf4240, status = timed out, error = Resource temporarily unavailable) => bytes_read = 0
> <lldb.driver.main-thread> error: failed to get response for 'k'
> <lldb.driver.main-thread> ProcessGDBRemote::DoDestroy - failed to send k packet
> <lldb.driver.main-thread> Process::SetExitStatus (status=6 (0x00000006), description="failed to send the k packet")
> <lldb.driver.main-thread> Process::SetPrivateState (exited)
> <lldb.driver.main-thread> Process::SetPrivateState (exited) stop_id = 7
> <lldb.driver.main-thread> ProcessGDBRemote::StopAsyncThread ()
> <lldb.process.internal-state(pid=36796)> Process::HandlePrivateEvent (pid = 36796) broadcasting new state exited (old state stopped) to public
> <lldb.driver.main-thread> Process::ControlPrivateStateThread (signal = 1)
> <lldb.driver.main-thread> Sending control event of type: 1.
> <lldb.driver.main-thread> The control event killed the private state thread without having to cancel.
> com.apple.root.default-priority ProcessGDBRemote::MonitorDebugserverProcess (baton=0x7fe98d05a800, pid=36797, signo=2 (0x2), exit_status=-1)
> com.apple.root.default-priority Process::SetProcessExitStatus (baton=0x0, pid=36796, exited=1, signal=9, exit_status=-1)
> com.apple.root.default-priority Process::SetExitStatus (status=-1 (0xffffffff), description="SIGKILL")
> com.apple.root.default-priority Process::SetExitStatus () ignoring exit status because state was already set to eStateExited
> <lldb.driver.main-thread> Process::SetPublicState (exited)
> <lldb.driver.main-thread> error: failed to send 'qThreadStopInfo1e03'
> (lldb) <lldb.driver.main-thread> error: failed to get response for 'qThreadStopInfo1e03'
> Process 36796 exited with status = 6 (0x00000006) failed to send the k packet
> (lldb)
>  
>  
> lldb on Xcode (marginally working… We still have some error messages)
>  
> <lldb.driver.main-thread> < 5> send packet: $k#00
> <lldb.driver.main-thread> size_t GDBRemoteCommunication::WaitForPacketWithTimeoutMicroSecondsNoLock(StringExtractorGDBRemote &, uint32_t): Read (buffer, (sizeof(buffer), timeout_usec = 0xf4240, status = success, error = (null)) => bytes_read = 7
> <lldb.driver.main-thread> < 7> read packet: $W09#00
> <lldb.driver.main-thread> ProcessGDBRemote::StopAsyncThread ()
> <lldb.driver.main-thread> error: failed to send 'qThreadStopInfo1f03'
> <lldb.driver.main-thread> error: failed to get response for 'qThreadStopInfo1f03'
> [KProcess 37912 exited with status = -1 (0xffffffff) SIGKILL
> (lldb) com.apple.root.default-priority ProcessGDBRemote::MonitorDebugserverProcess (baton=0x7fdc4282a200, pid=37913, signo=2 (0x2), exit_status=-1)
> qq
> <lldb.driver.main-thread> error: failed to send 'z0,100000824,1'
> <lldb.driver.main-thread> error: failed to get response for 'z0,100000824,1'
>  
>  
>  
>  
> debugserver (default flags in ProcessGDBRemote.cpp:2262 (0x802e0e))
>  
> 752 +34.279230 sec [8fbd/160f]: getpkt: $k#00
> 753 +0.000071 sec [8fbd/0303]: MachProcess::Kill ()
> 754 +0.000028 sec [8fbd/0303]: MachProcess::DoSIGSTOP() state = Stopped
> 755 +0.000014 sec [8fbd/0303]: MachProcess::DisableAllBreakpoints (remove = 1 )
> 756 +0.000013 sec [8fbd/0303]: MachProcess::DisableBreakpoint ( breakID = 2, remove = 1 ) addr = 0x100000f16
> 757 +0.000119 sec [8fbd/0303]: MachProcess::DisableBreakpoint ( breakID = 2, remove = 1 ) addr = 0x100000f16 => success
> 758 +0.000041 sec [8fbd/0303]: MachProcess::DisableBreakpoint ( breakID = 3, remove = 1 ) addr = 0x7fff5fc0b269
> 759 +0.000063 sec [8fbd/0303]: MachProcess::DisableBreakpoint ( breakID = 3, remove = 1 ) addr = 0x7fff5fc0b269 => success
> 760 +0.000012 sec [8fbd/0303]: MachProcess::DisableAllWatchpoints (remove = 1 )
> 761 +0.000009 sec [8fbd/0303]: MachProcess::DoSIGSTOP() state = Stopped -- resuming process
> 762 +0.000021 sec [8fbd/0303]: Replying to exception 0...
> 763 +0.000015 sec [8fbd/0303]: ::mach_msg ( msg->{bits = 0x12, size = 36, remote_port = 0x1d17, local_port = 0, reserved = 0x0, id = 0x9c9}, option = 0x41, send_size = 36, rcv_size = 0, rcv_name = 0, timeout = 0, notify = 0)
> 764 +0.000019 sec [8fbd/0303]: MachThreadList::UpdateThreadList (pid = 8fbc, update = 1) process stop count = 6
> 765 +0.000021 sec [8fbd/0303]: ::task_threads ( task = 0x1a03, thread_list => 0x1040f8000, thread_list_count => 1 ) err = 0x00000000
> 766 +0.000024 sec [8fbd/0303]: MachThread::SetState ( Suspended ) for tid = 0x1e03
> 767 +0.000010 sec [8fbd/0303]: MachThread::Suspend ( )
> 768 +0.000045 sec [8fbd/0303]: ::thread_suspend (1e03) err = 0x00000000
> 769 +0.000029 sec [8fbd/0303]: DNBArchImplX86_64::ThreadWillResume() GetDBGState() => 0x00000000.
> 770 +0.000015 sec [8fbd/0303]: MachProcess::SetState ( Running )
> 771 +0.000035 sec [8fbd/0303]: ::task_info ( target_task = 0x1a03, flavor = TASK_BASIC_INFO, task_info_out => 0x7fff63b68738, task_info_outCnt => 10 ) err = 0x00000000
> 772 +0.000024 sec [8fbd/0303]: ::task_resume ( target_task = 0x1a03 ) err = 0x00000000
> 773 +0.000015 sec [8fbd/0303]: MachProcess::DoSIGSTOP() state = Running -- sending SIGSTOP
> 774 +0.000014 sec [8fbd/0303]: MachProcess::Signal (signal = 17, timeout = 0x7fff63b68878)
> 775 +0.000029 sec [8fbd/0303]: MachProcess::Signal (signal = 17, timeout = 0x7fff63b68878) waiting for signal to stop process...
> 776 +0.000030 sec [8fbd/1c03]: ::mach_msg ( msg->{bits = 0x80001112, size = 84 remote_port = 0x1d1b, local_port = 0x1b03, reserved = 0x0, id = 0x965}, option = 0x402, send_size = 0, rcv_size = 1024, rcv_name = 0x1b03, timeout = 0, notify = 0) err = 0x00000000
> 777 +0.000023 sec [8fbd/1c03]: ::catch_mach_exception_raise ( exc_port = 0x1b03, thd_port = 0x1e03, tsk_port = 0x1a03, exc_type = 5 ( EXC_SOFTWARE ), exc_data[2] = { 0x10003, 0x11 })
> 778 +0.000035 sec [8fbd/1c03]: ::task_suspend ( target_task = 0x1a03 ) err = 0x00000000
> 779 +0.000009 sec [8fbd/1c03]: MachProcess::ExceptionMessageReceived ( )
> 780 +0.000020 sec [8fbd/1c03]: error: ::mach_msg ( msg->{bits = 0, size = 0 remote_port = 0, local_port = 0, reserved = 0x0, id = 0x0}, option = 0x502, send_size = 0, rcv_size = 1024, rcv_name = 0x1b03, timeout = 0, notify = 0) err = (ipc/rcv) timed out (0x10004003)
> 781 +0.000011 sec [8fbd/1c03]: void MachProcess::ExceptionMessageBundleComplete(): 1 exception messages.
> 782 +0.000009 sec [8fbd/1c03]: MachThreadList::UpdateThreadList (pid = 8fbc, update = 1) process stop count = 6
> 783 +0.000022 sec [8fbd/1c03]: ::task_threads ( task = 0x1a03, thread_list => 0x1040f8000, thread_list_count => 1 ) err = 0x00000000
> 784 +0.000028 sec [8fbd/1c03]: thread = 0x1e03 calling thread_abort_safely (tid) => 0 (GetGPRState() for stop_count = 6)
> 785 +0.000022 sec [8fbd/1c03]: ::thread_get_state (0x1e03, 4, &gpr, 42) => 0x00000000
> rax = 0000000100000ec0 rbx = 0000000000000000 rcx = 00007fff5fbff7d8 rdx = 00007fff5fbff6b0
> rdi = 0000000100000f5c rsi = 00007fff5fbff6a0 rbp = 00007fff5fbff680 rsp = 00007fff5fbff670
> r8 = 0000000000000016 r9 = 0000000000000000 r10 = 000000000000002c r11 = 0000000000000206
> r12 = 0000000000000000 r13 = 0000000000000000 r14 = 0000000000000000 r15 = 0000000000000000
> rip = 0000000100000f16
> flg = 0000000000000202 cs = 000000000000002b fs = 0000000000000000 gs = 0000000000000000
> 786 +0.000028 sec [8fbd/1c03]: MachThread::RestoreSuspendCountAfterStop ( )
> 787 +0.000017 sec [8fbd/1c03]: ::thread_resume (1e03) err = 0x00000000
> 788 +0.000012 sec [8fbd/1c03]: MachThread::SetState ( Stopped ) for tid = 0x1e03
> 789 +0.000013 sec [8fbd/1c03]: exc_msg { bits = 0x80001112 size = 0x00000054 remote-port = 0x00001d1b local-port = 0x00001b03 reserved = 0x00000000 id = 0x00000965 }
> 790 +0.000024 sec [8fbd/1c03]: reply_msg { bits = 0x00000012 size = 0x00000024 remote-port = 0x00001d1b local-port = 0x00000000 reserved = 0x00000000 id = 0x000009c9 }
> 791 +0.000010 sec [8fbd/1c03]: state { task_port = 0x1a03, thread_port = 0x1e03, exc_type = 5 (EXC_SOFTWARE) ...
> 792 +0.000008 sec [8fbd/1c03]: exc_data: EXC_SOFT_SIGNAL (17 (SIGSTOP))
> 793 +0.000013 sec [8fbd/1c03]: [ 0] # 1 tid: 0x1e03, pc: 0x0000000100000f16, sp: 0x00007fff5fbff670, breakID: 0, user: 0.004191, system: 0.003995, cpu: 0, policy: 1, run_state: 3 (waiting), flags: 0, suspend_count: 0 (current 0), sleep_time: 0
> 794 +0.000010 sec [8fbd/1c03]: DNBBreakpointList::FindIDByAddress ( addr = 0x0000000100000f16 ) => NONE
> 795 +0.000008 sec [8fbd/1c03]: MachProcess::SetState ( Stopped )
> 796 +0.000023 sec [8fbd/1c03]: ::task_info ( target_task = 0x1a03, flavor = TASK_BASIC_INFO, task_info_out => 0x1043035e0, task_info_outCnt => 10 ) err = 0x00000000
> 797 +0.000009 sec [8fbd/1c03]: got a timeout, continuing...
> 798 +0.000012 sec [8fbd/1c03]: ::mach_msg ( msg->{bits = 0, size = 0 remote_port = 0, local_port = 0, reserved = 0x0, id = 0x0}, option = 0x402, send_size = 0, rcv_size = 1024, rcv_name = 0x1b03, timeout = 0, notify = 0)







More information about the lldb-commits mailing list