HomePhabricator

Fix deadlock due to thread list locking in 'bt all' with obj-c

Authored by sas on Mar 17 2016, 11:52 AM.

Description

Fix deadlock due to thread list locking in 'bt all' with obj-c

Summary:
The gdb-remote async thread cannot modify thread state while the main thread
holds a lock on the state. Don't use locking thread iteration for bt all.

Specifically, the deadlock manifests when lldb attempts to JIT code to
symbolicate objective c while backtracing. As part of this code path,
SetPrivateState() is called on an async thread. This async thread will
block waiting for the thread_list lock held by the main thread in
CommandObjectIterateOverThreads. The main thread will also block on the
async thread during DoResume (although with a timeout), leading to a
deadlock. Due to the timeout, the deadlock is not immediately apparent,
but the inferior will be left in an invalid state after the bt all completes,
and objective-c symbols will not be successfully resolved in the backtrace.

Reviewers: andrew.w.kaylor, jingham, clayborg

Subscribers: sas, lldb-commits

Differential Revision: http://reviews.llvm.org/D18075

Change by Francis Ricci <fjricci@fb.com>

llvm-svn: 263735

Details

Committed
sasMar 17 2016, 11:52 AM
Differential Revision
D18075: Fix deadlock due to thread list locking in 'bt all' with obj-c
Parents
rG7b390ec4cde7: [InstCombine] Combine A->B->A BitCast
Branches
Unknown
Tags
Unknown