Skip to content

[lldb] The test TestCancelAttach.py hangs on Windows host with Linux target #115618

@slydiman

Description

@slydiman

Issue 1:
TestCancelAttach.py, line 33
The call self.target.AttachToProcessWithName(lldb.SBListener(), "LLDB-No-Such-Process", True, self.error) in the AttachThread never return in case of Windows host and Linux target.

Issue 2:
The test failed here

if thread.is_alive():
    self.fail("The attach thread is alive after timeout interval")

but the main thread will still wait for the AttachThread until timeout 10 min.

The issue 1 is most important.
The callstack is the following

m_events_condition.wait(lock);
lldb_private::Listener::GetEventInternal(const lldb_private::Timeout<std::ratio<1,1000000>> & timeout, lldb_private::Broadcaster * broadcaster, unsigned int event_type_mask, std::shared_ptr<lldb_private::Event> & event_sp) at \llvm-project\lldb\source\Utility\Listener.cpp(275)
lldb_private::Listener::GetEventForBroadcasterWithType(lldb_private::Broadcaster * broadcaster, unsigned int event_type_mask, std::shared_ptr<lldb_private::Event> & event_sp, const lldb_private::Timeout<std::ratio<1,1000000>> & timeout) at \llvm-project\lldb\source\Utility\Listener.cpp(300)
lldb_private::Process::GetStateChangedEvents(std::shared_ptr<lldb_private::Event> & event_sp, const lldb_private::Timeout<std::ratio<1,1000000>> & timeout, std::shared_ptr<lldb_private::Listener> hijack_listener_sp) at \llvm-project\lldb\source\Target\Process.cpp(980)
lldb_private::Process::WaitForProcessToStop(const lldb_private::Timeout<std::ratio<1,1000000>> & timeout, std::shared_ptr<lldb_private::Event> * event_sp_ptr, bool wait_always, std::shared_ptr<lldb_private::Listener> hijack_listener_sp, lldb_private::Stream * stream, bool use_run_lock, SelectMostRelevant select_most_relevant) at \llvm-project\lldb\source\Target\Process.cpp(690)
lldb_private::Target::Attach(lldb_private::ProcessAttachInfo & attach_info, lldb_private::Stream * stream) at \llvm-project\lldb\source\Target\Target.cpp(3551)
AttachToProcess(lldb_private::ProcessAttachInfo & attach_info, lldb_private::Target & target) at \llvm-project\lldb\source\API\SBTarget.cpp(94)
lldb::SBTarget::AttachToProcessWithName(lldb::SBListener & listener, const char * name, bool wait_for, lldb::SBError & error) at \llvm-project\lldb\source\API\SBTarget.cpp(519)
_wrap_SBTarget_AttachToProcessWithName(_object * self, _object * args) at \tools\lldb\bindings\python\LLDBWrapPython.cpp(65404)

Note process_sp = platform_sp->Attach(attach_info, GetDebugger(), this, error); at \llvm-project\lldb\source\Target\Target.cpp(3526)
runs gdbserver and puts vAttachWait command with LLDB-No-Such-Process to the event queue. But this packet never sent to the target (and no response). Something is wrong with listeners/broadcasters.

Unfortunately I cannot debug (compare) it on Linux host right now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions