Open andykaylor opened 11 years ago
mentioned in issue llvm/llvm-bugzilla-archive#28455
mentioned in issue llvm/llvm-bugzilla-archive#25081
reported fixed on FreeBSD in https://reviews.llvm.org/D90757
Bug llvm/llvm-bugzilla-archive#28455 has been marked as a duplicate of this bug.
Another test failing in the same way on FreeBSD now:
Ran 5 tests in 6.281s
RESULT: FAILED (0 passes, 1 failures, 0 errors, 0 skipped, 4 expected failures, 0 unexpected successes)
[TestThreadStates.py FAILED]
Bug llvm/llvm-bugzilla-archive#25081 has been marked as a duplicate of this bug.
With my FreeBSD thread WIP I see the same failure in test_state_after_breakpoint_with_dwarf.
What is odd is that I don't even see SBThread::IsStopped() getting called.
I enabled logging to run the test:
export LLDB_LOG="lldb_unit_test.log"
export LLDB_LOG_OPTION="api step process thread event expr state"
and in the log I see:
SBDebugger(0x80159b600)::GetSelectedTarget () => SBTarget(0x80b696100): a.out
SBTarget(0x80b696100)::GetProcess () => SBProcess(0x801736000)
SBProcess(0x801736000)::GetNumThreads () => 1
SBProcess(0x801736000)::GetThreadAtIndex (index=0) => SBThread(0x80b701e00)
SBTarget(0x80b696100)::GetProcess () => SBProcess(0x801736000)
SBProcess(0x801736000)::GetTarget () => SBTarget(0x80b696100)
SBTarget(0x80b696100)::GetExecutable () => SBFileSpec(0x80b6abb20)
SBFileSpec(0x80b6abb20)::GetPath (dst_path="/tank/emaste/src/llvm/tools/lldb/test/functionalities/thread/state/a.out", dst_len=1024) => 72
SBProcess(0x801736000)::GetState () => stopped
SBProcess(0x801736000)::GetNumThreads () => 1
I can confirm that the GetThreadAtIndex (index=0) call corresponds to the python test code "thread = process.GetThreadAtIndex(0)"
So I think it may actually be that the SWIG / python interface has some issue rather than the thread's state actually being incorrect.
Having written a test for this, I see that the test fails on Darwin platforms as well.
Extended Description
The state of Thread objects is not properly maintained on Linux. Even when debugging single-threaded inferiors, the thread state does not always properly reflect the actual state of the thread.