Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LLDB thread states aren't properly maintained #16196

Open
andykaylor opened this issue Apr 23, 2013 · 8 comments
Open

LLDB thread states aren't properly maintained #16196

andykaylor opened this issue Apr 23, 2013 · 8 comments
Labels
bugzilla Issues migrated from bugzilla lldb

Comments

@andykaylor
Copy link
Contributor

Bugzilla Link 15824
Version unspecified
OS All
CC @emaste

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.

@andykaylor
Copy link
Contributor Author

Having written a test for this, I see that the test fails on Darwin platforms as well.

@emaste
Copy link
Member

emaste commented Sep 8, 2013

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.

@labath
Copy link
Collaborator

labath commented Oct 7, 2015

*** Bug llvm/llvm-bugzilla-archive#25081 has been marked as a duplicate of this bug. ***

@emaste
Copy link
Member

emaste commented Dec 22, 2015

Another test failing in the same way on FreeBSD now:

======================================================================
FAIL: test_state_after_continue_dwarf (TestThreadStates.ThreadStateTestCase)
Test thread state after continue.

Traceback (most recent call last):
File "/tank/emaste/src/llvm/tools/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 2263, in dwarf_test_method
return attrvalue(self)
File "/tank/emaste/src/llvm/tools/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 608, in wrapper
func(*args, **kwargs)
File "/tank/emaste/src/llvm/tools/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 608, in wrapper
func(*args, **kwargs)
File "/tank/emaste/src/llvm/tools/lldb/packages/Python/lldbsuite/test/functionalities/thread/state/TestThreadStates.py", line 34, in test_state_after_continue
self.thread_state_after_continue_test()
File "/tank/emaste/src/llvm/tools/lldb/packages/Python/lldbsuite/test/functionalities/thread/state/TestThreadStates.py", line 141, in thread_state_after_continue_test
self.wait_for_running_event()
File "/tank/emaste/src/llvm/tools/lldb/packages/Python/lldbsuite/test/functionalities/thread/state/TestThreadStates.py", line 106, in wait_for_running_event
lldbutil.expect_state_changes(self, listener, [lldb.eStateRunning])
File "/tank/emaste/src/llvm/tools/lldb/packages/Python/lldbsuite/test/lldbutil.py", line 750, in expect_state_changes
test.assertEqual(expected_state, got_state)
AssertionError: 6 != 4
Config=x86_64-/usr/bin/clang

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]

@labath
Copy link
Collaborator

labath commented Jul 7, 2016

*** Bug llvm/llvm-bugzilla-archive#28455 has been marked as a duplicate of this bug. ***

@emaste
Copy link
Member

emaste commented Nov 4, 2020

reported fixed on FreeBSD in https://reviews.llvm.org/D90757

@llvmbot
Copy link
Collaborator

llvmbot commented Nov 26, 2021

mentioned in issue llvm/llvm-bugzilla-archive#25081

@labath
Copy link
Collaborator

labath commented Nov 26, 2021

mentioned in issue llvm/llvm-bugzilla-archive#28455

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla lldb
Projects
None yet
Development

No branches or pull requests

4 participants