LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 18066 - FreeBSD test test_step_single_thread_with_dwarf (TestThreadStepOut.ThreadStepOutTestCase) fails as process does not exit
Summary: FreeBSD test test_step_single_thread_with_dwarf (TestThreadStepOut.ThreadStep...
Status: NEW
Alias: None
Product: lldb
Classification: Unclassified
Component: All Bugs (show other bugs)
Version: unspecified
Hardware: PC FreeBSD
: P normal
Assignee: LLDB commit list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-26 09:21 PST by emaste
Modified: 2020-12-07 00:34 PST (History)
2 users (show)

See Also:
Fixed By Commit(s):


Attachments
LLDb stdout - demonstarting bug in libthr.so.3: pthread_kill() (4.76 KB, text/plain)
2014-01-31 15:33 PST, John Wolfe
Details

Note You need to log in before you can comment on or make changes to this bug.
Description emaste 2013-11-26 09:21:55 PST
This test fails on the assertion
        # At this point, the inferior process should have exited.               
        self.assertTrue(self.inferior_process.GetState() == lldb.eStateExited, PROCESS_EXITED)

output:
runCmd: thread list
output: Process 84775 stopped
* thread #2: tid = 102403, 0x00000000004008a3 a.out`thread_func(input=0x0000000000000000) + 323 at main.cpp:43, stop reason = step out
  thread #3: tid = 101935, 0x0000000000400744 a.out`step_out_of_here() + 4 at main.cpp:33, stop reason = breakpoint 1.1
  thread #1: tid = 103003, 0x000000080082a4dc libthr.so.3 at _umtx_op_err.S:37


Expecting sub string: * thread #2
Matched

runCmd: thread backtrace all
output: * thread #2: tid = 102403, 0x00000000004008a3 a.out`thread_func(input=0x0000000000000000) + 323 at main.cpp:43, stop reason = step out
  * frame #0: 0x00000000004008a3 a.out`thread_func(input=0x0000000000000000) + 323 at main.cpp:43
    frame #1: 0x0000000800822d34 libthr.so.3`thread_start(curthread=0x0000000801807c00) + 260 at thr_create.c:284

  thread #3: tid = 101935, 0x0000000000400744 a.out`step_out_of_here() + 4 at main.cpp:33, stop reason = breakpoint 1.1
    frame #0: 0x0000000000400744 a.out`step_out_of_here() + 4 at main.cpp:33
    frame #1: 0x00000000004008a3 a.out`thread_func(input=0x0000000000000000) + 323 at main.cpp:43
    frame #2: 0x0000000800822d34 libthr.so.3`thread_start(curthread=0x0000000801807800) + 260 at thr_create.c:284

  thread #1: tid = 103003, 0x000000080082a4dc libthr.so.3 at _umtx_op_err.S:37
    frame #0: 0x000000080082a4dc libthr.so.3 at _umtx_op_err.S:37


Expecting sub string: main.cpp:43
Matched

Expecting sub string: main.cpp:33
Matched

runCmd: continue
output: Process 84775 resuming
Process 84775 stopped


FAILURE




Running the commands manually shows that the inferior stops again with stop reason = trace, rather then exiting.

(lldb) thread step-out -m this-thread
Process 84825 stopped
* thread #2: tid = 103032, 0x00000000004008a3 a.out`thread_func(input=0x0000000000000000) + 323 at main.cpp:43, stop reason = step out
    frame #0: 0x00000000004008a3 a.out`thread_func(input=0x0000000000000000) + 323 at main.cpp:43
   40       pseudo_barrier_wait(g_barrier);
   41  
   42       // Do something
-> 43       step_out_of_here(); // Expect to stop here after step-out (clang)
   44  
   45       // Return
   46       return NULL;  // Expect to stop here after step-out (icc and gcc)
  thread #3: tid = 103013, 0x0000000000400744 a.out`step_out_of_here() + 4 at main.cpp:33, stop reason = breakpoint 1.1
    frame #0: 0x0000000000400744 a.out`step_out_of_here() + 4 at main.cpp:33
   30   volatile int g_test = 0;
   31  
   32   void step_out_of_here() {
-> 33     g_test += 5; // Set breakpoint here
   34   }
   35  
   36   void *
(lldb) c
Process 84825 resuming
Process 84825 stopped
* thread #2: tid = 103032, 0x00000000004008ad a.out`thread_func(input=0x0000000000000000) + 333 at main.cpp:46, stop reason = trace
    frame #0: 0x00000000004008ad a.out`thread_func(input=0x0000000000000000) + 333 at main.cpp:46
   43       step_out_of_here(); // Expect to stop here after step-out (clang)
   44  
   45       // Return
-> 46       return NULL;  // Expect to stop here after step-out (icc and gcc)
   47   }
   48  
   49   int main ()
Comment 1 John Wolfe 2014-01-31 15:33:18 PST
Created attachment 11987 [details]
LLDb stdout - demonstarting bug in libthr.so.3: pthread_kill()
Comment 2 John Wolfe 2014-01-31 15:40:14 PST
Extremely sorry,  The attachment 'LLDB stdout - pthread_kill() bug ' was attached to the wrong PR.
Comment 3 emaste 2020-11-05 12:46:06 PST
As of today
$ bin/lldb-dotest -p TestThreadStepOut -f test_step_single_thread_dwarf
reports XFAIL for this test; I have not confirmed that the issue is the same as reported in 2013.
Comment 4 Michał Górny 2020-12-07 00:34:27 PST
Well, the test is broken at the moment, apparently due to API change:

ERROR: test_step_single_thread_dwarf (TestThreadStepOut.ThreadStepOutTestCase)
    Test thread step out on one thread via command interpreter.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/home/mgorny/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 1823, in test_method
    return attrvalue(self)
  File "/usr/home/mgorny/llvm-project/lldb/packages/Python/lldbsuite/test/decorators.py", line 105, in wrapper
    func(*args, **kwargs)
  File "/usr/home/mgorny/llvm-project/lldb/packages/Python/lldbsuite/test/decorators.py", line 105, in wrapper
    func(*args, **kwargs)
  File "/usr/home/mgorny/llvm-project/lldb/packages/Python/lldbsuite/test/decorators.py", line 105, in wrapper
    func(*args, **kwargs)
  File "/usr/home/mgorny/llvm-project/lldb/test/API/functionalities/thread/step_out/TestThreadStepOut.py", line 31, in test_step_single_thread
    self.step_out_test(self.step_out_single_thread_with_cmd)
  File "/usr/home/mgorny/llvm-project/lldb/test/API/functionalities/thread/step_out/TestThreadStepOut.py", line 148, in step_out_test
    bkpt_threads = lldbutil.continue_to_breakpoint(bkpt)
TypeError: continue_to_breakpoint() missing 1 required positional argument: 'bkpt'
Config=x86_64-/home/mgorny/llvm-project/_build/bin/clang



However, if I fix it, all three cases fail with a new message:

FAIL: test_step_single_thread_dwarf (TestThreadStepOut.ThreadStepOutTestCase)
    Test thread step out on one thread via command interpreter.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/home/mgorny/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 1823, in test_method
    return attrvalue(self)
  File "/usr/home/mgorny/llvm-project/lldb/packages/Python/lldbsuite/test/decorators.py", line 105, in wrapper
    func(*args, **kwargs)
  File "/usr/home/mgorny/llvm-project/lldb/packages/Python/lldbsuite/test/decorators.py", line 105, in wrapper
    func(*args, **kwargs)
  File "/usr/home/mgorny/llvm-project/lldb/packages/Python/lldbsuite/test/decorators.py", line 105, in wrapper
    func(*args, **kwargs)
  File "/usr/home/mgorny/llvm-project/lldb/test/API/functionalities/thread/step_out/TestThreadStepOut.py", line 31, in test_step_single_thread
    self.step_out_test(self.step_out_single_thread_with_cmd)
  File "/usr/home/mgorny/llvm-project/lldb/test/API/functionalities/thread/step_out/TestThreadStepOut.py", line 150, in step_out_test
    self.assertEqual(len(bkpt_threads), 1, "Second thread stopped")
AssertionError: 2 != 1 : Second thread stopped
Config=x86_64-/home/mgorny/llvm-project/_build/bin/clang


On Linux, it seems to suffer from some weird Makefile issue.