teak-llvm/lldb/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py
Abhishek Aggarwal be994649b4 Fix to solve Bug 23139 & Bug 23560
Summary:
 - Reason of both bugs:

   1. For the very first frame, Unwinder doesn't check the validity
      of Full UnwindPlan before creating StackFrame from it:

        When 'process launch' command is run after setting a breakpoint
        in inferior, the Unwinder runs and saves only Frame 0 (the frame
        in which breakpoint was set) in thread's StackFrameList i.e.
        m_curr_frames_sp. However, it doesn't check the validity of the
        Full UnwindPlan for this frame by unwinding 2 more frames further.

   2. Unwinder doesn't update the CFA value of Cursor when Full UnwindPlan
      fails and FallBack UnwindPlan succeeds in providing valid CFA values
      for frames:

        Sometimes during unwinding of stack frames, the Full UnwindPlan
        inside the RegisterContextLLDB object may fail to provide valid
        CFA values for these frames. Then the Fallback UnwindPlan is used
        to unwind the frames.

        If the Fallback UnwindPlan succeeds, then it provides a valid new
        CFA value. The RegisterContextLLDB::m_cfa field of Cursor object
        is updated during the Fallback UnwindPlan execution. However,
        UnwindLLDB misses the implementation to update the 'cfa' field
        of this Cursor with this valid new CFA value.

 - This patch fixes both these issues.

 - Remove XFAIL in test files corresponding to these 2 Bugs

Change-Id: I932ea407545ceee2d628f946ecc61a4806d4cc86
Signed-off-by: Abhishek Aggarwal <abhishek.a.aggarwal@intel.com>

Reviewers: jingham, lldb-commits, jasonmolenda

Subscribers: lldb-commits, ovyalov, tberghammer

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

llvm-svn: 253026
2015-11-13 10:47:49 +00:00

91 lines
3.6 KiB
Python

"""Test the lldb public C++ api breakpoint callbacks."""
from __future__ import print_function
# __package__ = "lldbsuite.test"
import os, re
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
import subprocess
class SBBreakpointCallbackCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipIfRemote
@skipIfNoSBHeaders
@skipIfWindows # clang-cl does not support throw or catch (llvm.org/pr24538)
def test_breakpoint_callback(self):
"""Test the that SBBreakpoint callback is invoked when a breakpoint is hit. """
self.build_and_test('driver.cpp test_breakpoint_callback.cpp',
'test_breakpoint_callback')
@skipIfRemote
@skipIfNoSBHeaders
@skipIfWindows # clang-cl does not support throw or catch (llvm.org/pr24538)
@expectedFlakeyFreeBSD
def test_sb_api_listener_event_description(self):
""" Test the description of an SBListener breakpoint event is valid."""
self.build_and_test('driver.cpp listener_test.cpp test_listener_event_description.cpp',
'test_listener_event_description')
pass
@skipIfRemote
@skipIfNoSBHeaders
@skipIfWindows # clang-cl does not support throw or catch (llvm.org/pr24538)
@expectedFlakeyFreeBSD
@expectedFlakeyLinux # Driver occasionally returns '1' as exit status
def test_sb_api_listener_event_process_state(self):
""" Test that a registered SBListener receives events when a process
changes state.
"""
self.build_and_test('driver.cpp listener_test.cpp test_listener_event_process_state.cpp',
'test_listener_event_process_state')
pass
@skipIfRemote
@skipIfNoSBHeaders
@skipIfWindows # clang-cl does not support throw or catch (llvm.org/pr24538)
@expectedFlakeyFreeBSD
@expectedFailureAll("llvm.org/pr23139", oslist=["linux"], compiler="gcc", compiler_version=[">=","4.8"], archs=["x86_64"])
def test_sb_api_listener_resume(self):
""" Test that a process can be resumed from a non-main thread. """
self.build_and_test('driver.cpp listener_test.cpp test_listener_resume.cpp',
'test_listener_resume')
pass
def build_and_test(self, sources, test_name, args = None):
""" Build LLDB test from sources, and run expecting 0 exit code """
# These tests link against host lldb API.
# Compiler's target triple must match liblldb triple
# because remote is disabled, we can assume that the os is the same
# still need to check architecture
if self.getLldbArchitecture() != self.getArchitecture():
self.skipTest("This test is only run if the target arch is the same as the lldb binary arch")
self.inferior = 'inferior_program'
self.buildProgram('inferior.cpp', self.inferior)
self.addTearDownHook(lambda: os.remove(self.inferior))
self.buildDriver(sources, test_name)
self.addTearDownHook(lambda: os.remove(test_name))
test_exe = os.path.join(os.getcwd(), test_name)
self.signBinary(test_exe)
exe = [test_exe, self.inferior]
env = {self.dylibPath : self.getLLDBLibraryEnvVal()}
if self.TraceOn():
print("Running test %s" % " ".join(exe))
check_call(exe, env=env)
else:
with open(os.devnull, 'w') as fnull:
check_call(exe, env=env, stdout=fnull, stderr=fnull)
def build_program(self, sources, program):
return self.buildDriver(sources, program)