[Bug 30526] New: deadlock when calling SBThread::GetSelectedFrame

Bug ID 30526
Summary deadlock when calling SBThread::GetSelectedFrame
Product lldb
Version 3.9
Hardware PC
OS Windows NT
Status NEW
Severity normal
Priority P
Component All Bugs
Assignee lldb-dev@lists.llvm.org
Reporter cc.tapa@gmail.com
CC llvm-bugs@lists.llvm.org
Classification Unclassified

I have thread working with lldb events.

void LLDBRunner::eventsThread()
{
  while (1)
  {
    lldb::SBEvent ev;
    m_debugData->listener.WaitForEvent(UINT32_MAX, ev);

    lldb::SBThread thread = m_debugData->currentProcess.GetSelectedThread();
    lldb::SBFrame frame = thread.GetSelectedFrame();
  }
}

Sometimes(but not always) this thread hangs up when calling
thread.GetSelectedFrame();

Call stack:
    liblldb.dll!llvm::sys::MutexImpl::acquire() Line 41    C++
     liblldb.dll!llvm::sys::SmartMutex<0>::lock() Line 101    C++
    
liblldb.dll!llvm::sys::SmartScopedLock<0>::SmartScopedLock<0>(llvm::sys::SmartMutex<0>
& m) Line 147    C++
     liblldb.dll!lldb_private::ProcessWindowsLive::DoReadMemory(unsigned
__int64 vm_addr, void * buf, unsigned int size, lldb_private::Error & error)
Line 704    C++
     liblldb.dll!lldb_private::Process::ReadMemoryFromInferior(unsigned __int64
addr, void * buf, unsigned int size, lldb_private::Error & error) Line 2506   
C++
     liblldb.dll!lldb_private::MemoryCache::Read(unsigned __int64 addr, void *
dst, unsigned int dst_len, lldb_private::Error & error) Line 268    C++
     liblldb.dll!lldb_private::Process::ReadMemory(unsigned __int64 addr, void
* buf, unsigned int size, lldb_private::Error & error) Line 2355    C++
    
liblldb.dll!lldb_private::RegisterContext::ReadRegisterValueFromMemory(const
lldb_private::RegisterInfo * reg_info, unsigned __int64 src_addr, unsigned int
src_len, lldb_private::RegisterValue & reg_value) Line 409    C++
    
liblldb.dll!lldb_private::RegisterContextLLDB::ReadRegisterValueFromRegisterLocation(lldb_private::UnwindLLDB::RegisterLocation
regloc, const lldb_private::RegisterInfo * reg_info,
lldb_private::RegisterValue & value) Line 1083    C++
    
liblldb.dll!lldb_private::RegisterContextLLDB::ReadGPRValue(lldb::RegisterKind
register_kind, unsigned int regnum, unsigned __int64 & value) Line 1919    C++
     liblldb.dll!lldb_private::RegisterContextLLDB::ReadPC(unsigned __int64 &
pc) Line 2066    C++
     liblldb.dll!lldb_private::UnwindLLDB::GetOneMoreFrame(lldb_private::ABI *
abi) Line 265    C++
     liblldb.dll!lldb_private::UnwindLLDB::AddOneMoreFrame(lldb_private::ABI *
abi) Line 357    C++
    
liblldb.dll!lldb_private::UnwindLLDB::UpdateUnwindPlanForFirstFrameIfInvalid(lldb_private::ABI
* abi) Line 332    C++
     liblldb.dll!lldb_private::UnwindLLDB::AddFirstFrame() Line 118    C++
     liblldb.dll!lldb_private::UnwindLLDB::DoGetFrameInfoAtIndex(unsigned int
idx, unsigned __int64 & cfa, unsigned __int64 & pc) Line 422    C++
     liblldb.dll!lldb_private::Unwind::GetFrameInfoAtIndex(unsigned int
frame_idx, unsigned __int64 & cfa, unsigned __int64 & pc) Line 72    C++
     liblldb.dll!lldb_private::StackFrameList::GetFramesUpTo(unsigned int
end_idx) Line 299    C++
     liblldb.dll!lldb_private::StackFrameList::GetFrameAtIndex(unsigned int
idx) Line 541    C++
     liblldb.dll!lldb_private::Thread::GetSelectedFrame() Line 364    C++
     liblldb.dll!lldb::SBThread::GetSelectedFrame() Line 1471    C++
     ssl-rt.dll!Debugger::LLDBRunner::checkCurrentFunctionIsOkey() Line 143   
C++
     ssl-rt.dll!Debugger::LLDBRunner::eventsThread() Line 263    C++