[Lldb-commits] [lldb] r242515 - [MainLoop] Fix assertion failure
Pavel Labath
labath at google.com
Fri Jul 17 03:08:38 PDT 2015
Author: labath
Date: Fri Jul 17 05:08:38 2015
New Revision: 242515
URL: http://llvm.org/viewvc/llvm-project?rev=242515&view=rev
Log:
[MainLoop] Fix assertion failure
Upon connection termination the waitable handle of an IOObject gets reset to an invalid handle.
This caused a problem since we used the object->GetWaitableHandle as a key to the set of
registered events. The fix is to use something more immutable as a key: we make a copy of the
original waitable handle, instead of holding onto the IOObject.
Modified:
lldb/trunk/include/lldb/Host/MainLoopBase.h
lldb/trunk/include/lldb/Host/posix/MainLoopPosix.h
lldb/trunk/source/Host/posix/MainLoopPosix.cpp
Modified: lldb/trunk/include/lldb/Host/MainLoopBase.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/MainLoopBase.h?rev=242515&r1=242514&r2=242515&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/MainLoopBase.h (original)
+++ lldb/trunk/include/lldb/Host/MainLoopBase.h Fri Jul 17 05:08:38 2015
@@ -60,25 +60,25 @@ public:
protected:
ReadHandleUP
CreateReadHandle(const lldb::IOObjectSP &object_sp)
- { return ReadHandleUP(new ReadHandle(*this, object_sp)); }
+ { return ReadHandleUP(new ReadHandle(*this, object_sp->GetWaitableHandle())); }
virtual void
- UnregisterReadObject(const lldb::IOObjectSP &object_sp)
+ UnregisterReadObject(IOObject::WaitableHandle handle)
{ llvm_unreachable("Not implemented"); }
private:
class ReadHandle
{
public:
- ~ReadHandle() { m_mainloop.UnregisterReadObject(m_object_sp); }
+ ~ReadHandle() { m_mainloop.UnregisterReadObject(m_handle); }
private:
- ReadHandle(MainLoopBase &mainloop, const lldb::IOObjectSP &object_sp)
- : m_mainloop(mainloop), m_object_sp(object_sp)
+ ReadHandle(MainLoopBase &mainloop, IOObject::WaitableHandle handle)
+ : m_mainloop(mainloop), m_handle(handle)
{ }
MainLoopBase &m_mainloop;
- lldb::IOObjectSP m_object_sp;
+ IOObject::WaitableHandle m_handle;
friend class MainLoopBase;
DISALLOW_COPY_AND_ASSIGN(ReadHandle);
Modified: lldb/trunk/include/lldb/Host/posix/MainLoopPosix.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/posix/MainLoopPosix.h?rev=242515&r1=242514&r2=242515&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/posix/MainLoopPosix.h (original)
+++ lldb/trunk/include/lldb/Host/posix/MainLoopPosix.h Fri Jul 17 05:08:38 2015
@@ -60,7 +60,7 @@ public:
protected:
void
- UnregisterReadObject(const lldb::IOObjectSP &object_sp) override;
+ UnregisterReadObject(IOObject::WaitableHandle handle) override;
void
UnregisterSignal(int signo);
Modified: lldb/trunk/source/Host/posix/MainLoopPosix.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/MainLoopPosix.cpp?rev=242515&r1=242514&r2=242515&view=diff
==============================================================================
--- lldb/trunk/source/Host/posix/MainLoopPosix.cpp (original)
+++ lldb/trunk/source/Host/posix/MainLoopPosix.cpp Fri Jul 17 05:08:38 2015
@@ -94,9 +94,9 @@ MainLoopPosix::RegisterSignal(int signo,
}
void
-MainLoopPosix::UnregisterReadObject(const lldb::IOObjectSP &object_sp)
+MainLoopPosix::UnregisterReadObject(IOObject::WaitableHandle handle)
{
- bool erased = m_read_fds.erase(object_sp->GetWaitableHandle());
+ bool erased = m_read_fds.erase(handle);
(void) erased;
assert(erased);
}
More information about the lldb-commits
mailing list