Fix TestThreadAPI on Linux

On Linux malloc calls itself in some case. Change the test case to
handle this scenario.

llvm-svn: 240651
This commit is contained in:
Tamas Berghammer 2015-06-25 15:19:22 +00:00
parent 13894c7f35
commit 09d74b7140
1 changed files with 4 additions and 6 deletions

View File

@ -75,7 +75,6 @@ class ThreadAPITestCase(TestBase):
self.step_out_of_malloc_into_function_b(self.exe_name)
@expectedFailureFreeBSD # llvm.org/pr20476
@expectedFailureLinux # need to 'thread step-out' twice to get out of malloc
@python_api_test
@dwarf_test
def test_step_out_of_malloc_into_function_b_with_dwarf(self):
@ -175,7 +174,6 @@ class ThreadAPITestCase(TestBase):
breakpoint = target.BreakpointCreateByName('malloc')
self.assertTrue(breakpoint, VALID_BREAKPOINT)
self.runCmd("breakpoint list")
# Launch the process, and do not stop at the entry point.
process = target.LaunchSimple (None, None, self.get_process_working_directory())
@ -184,7 +182,6 @@ class ThreadAPITestCase(TestBase):
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
caller_symbol = get_caller_symbol(thread)
#print "caller symbol of malloc:", caller_symbol
if not caller_symbol:
self.fail("Test failed: could not locate the caller symbol of malloc")
@ -198,13 +195,14 @@ class ThreadAPITestCase(TestBase):
if caller_symbol == "b(int)":
break
#self.runCmd("thread backtrace")
#self.runCmd("process status")
process.Continue()
# On Linux malloc calls itself in some case. Remove the breakpoint because we don't want
# to hit it during step-out.
target.BreakpointDelete(breakpoint.GetID())
thread.StepOut()
self.runCmd("thread backtrace")
#self.runCmd("process status")
self.assertTrue(thread.GetFrameAtIndex(0).GetLineEntry().GetLine() == self.step_out_of_malloc,
"step out of malloc into function b is successful")