teak-llvm/lldb/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/TestObjCiVarIMP.py
Kate Stone b9c1b51e45 *** This commit represents a complete reformatting of the LLDB source code
*** to conform to clang-format’s LLVM style.  This kind of mass change has
*** two obvious implications:

Firstly, merging this particular commit into a downstream fork may be a huge
effort.  Alternatively, it may be worth merging all changes up to this commit,
performing the same reformatting operation locally, and then discarding the
merge for this particular commit.  The commands used to accomplish this
reformatting were as follows (with current working directory as the root of
the repository):

    find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} +
    find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ;

The version of clang-format used was 3.9.0, and autopep8 was 1.2.4.

Secondly, “blame” style tools will generally point to this commit instead of
a meaningful prior commit.  There are alternatives available that will attempt
to look through this change and find the appropriate prior commit.  YMMV.

llvm-svn: 280751
2016-09-06 20:57:50 +00:00

71 lines
2.0 KiB
Python

"""
Test that dynamically discovered ivars of type IMP do not crash LLDB
"""
from __future__ import print_function
import os
import time
import re
import lldb
from lldbsuite.support import seven
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
def execute_command(command):
# print('%% %s' % (command))
(exit_status, output) = seven.get_command_status_output(command)
# if output:
# print(output)
# print('status = %u' % (exit_status))
return exit_status
class ObjCiVarIMPTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipUnlessDarwin
@no_debug_info_test
def test_imp_ivar_type(self):
"""Test that dynamically discovered ivars of type IMP do not crash LLDB"""
if self.getArchitecture() == 'i386':
# rdar://problem/9946499
self.skipTest("Dynamic types for ObjC V1 runtime not implemented")
execute_command("make repro")
def cleanup():
execute_command("make cleanup")
self.addTearDownHook(cleanup)
exe = os.path.join(os.getcwd(), "a.out")
# Create a target from the debugger.
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
# Set up our breakpoint
bkpt = lldbutil.run_break_set_by_source_regexp(self, "break here")
# Now launch the process, and do not stop at the entry point.
process = target.LaunchSimple(
None, None, self.get_process_working_directory())
self.assertTrue(process.GetState() == lldb.eStateStopped,
PROCESS_STOPPED)
self.expect(
'frame variable --ptr-depth=1 --show-types -d run -- object',
substrs=[
'(MyClass *) object = 0x',
'(void *) myImp = 0x'])
self.expect(
'disassemble --start-address `((MyClass*)object)->myImp`',
substrs=['-[MyClass init]'])