aboutsummaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite/test/functionalities
diff options
context:
space:
mode:
Diffstat (limited to 'packages/Python/lldbsuite/test/functionalities')
-rw-r--r--packages/Python/lldbsuite/test/functionalities/abbreviation/TestAbbreviations.py37
-rw-r--r--packages/Python/lldbsuite/test/functionalities/abbreviation/TestCommonShortSpellings.py9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/apropos_with_process/TestAproposWithProcess.py12
-rw-r--r--packages/Python/lldbsuite/test/functionalities/archives/TestBSDArchives.py41
-rw-r--r--packages/Python/lldbsuite/test/functionalities/asan/TestMemoryHistory.py114
-rw-r--r--packages/Python/lldbsuite/test/functionalities/asan/TestReportData.py57
-rw-r--r--packages/Python/lldbsuite/test/functionalities/attach_resume/TestAttachResume.py45
-rw-r--r--packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/TestFdLeak.py77
-rw-r--r--packages/Python/lldbsuite/test/functionalities/backticks/TestBackticksWithoutATarget.py7
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestAddressBreakpoints.py36
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py29
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_case_sensitivity/TestBreakpointCaseSensitivity.py66
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py215
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py52
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py43
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/bktptcmd.py7
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py155
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ids/TestBreakpointIDs.py75
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py69
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py24
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_language/TestBreakpointLanguage.py106
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py66
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py141
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/main.c54
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py64
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py27
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py19
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py65
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py91
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/TestCPPExceptionBreakpoint.py27
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/TestDebugBreak.py21
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/dummy_target_breakpoints/TestBreakpointsWithNoTargets.py33
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/inlined_breakpoints/TestInlinedBreakpoints.py38
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/objc/TestObjCBreakpoints.py95
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/TestBreakpointSerialization.py288
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/main.c54
-rw-r--r--packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/TestSourceRegexBreakpoints.py76
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_history/TestCommandHistory.py138
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_regex/TestCommandRegex.py17
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_script/TestCommandScript.py92
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_script/bug11569.py3
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_script/import/TestImport.py28
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_script/import/bar/bar.py17
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_script/import/bar/barutil.py2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_script/import/dummymodule.py2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_script/import/foo/bar/foobar.py5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_script/import/foo/foo.py5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_script/import/foo/foo2.py10
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/TestRdar12586188.py18
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/fail12586188.py2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/fail212586188.py2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitA.py5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitB.py5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/__init__.py9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_script/mysto.py28
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_script/welcome.py23
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_script_alias/TestCommandScriptAlias.py15
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_script_alias/tcsacmd.py17
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py51
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/custom_command.py20
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_source/TestCommandSource.py7
-rw-r--r--packages/Python/lldbsuite/test/functionalities/command_source/my.py1
-rw-r--r--packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py172
-rw-r--r--packages/Python/lldbsuite/test/functionalities/conditional_break/TestConditionalBreak.py38
-rw-r--r--packages/Python/lldbsuite/test/functionalities/conditional_break/conditional_break.py6
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/basic/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/basic/TestDarwinLogBasic.py35
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/basic/main.c32
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/common/darwin_log_common.h6
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity-chain/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity-chain/TestDarwinLogFilterMatchActivityChain.py123
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity-chain/main.c43
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity/TestDarwinLogFilterMatchActivity.py127
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity/main.c43
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/category/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/category/TestDarwinLogFilterMatchCategory.py127
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/category/main.c43
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/message/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/message/TestDarwinLogFilterMatchMessage.py147
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/message/main.c35
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/subsystem/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/subsystem/TestDarwinLogFilterMatchSubsystem.py127
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/subsystem/main.c43
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity-chain/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity-chain/TestDarwinLogFilterRegexActivityChain.py138
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity-chain/main.c43
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity/TestDarwinLogFilterRegexActivity.py143
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity/main.c43
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/category/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/category/TestDarwinLogFilterRegexCategory.py143
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/category/main.c43
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/message/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/message/TestDarwinLogFilterRegexMessage.py128
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/message/main.c35
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/subsystem/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/subsystem/TestDarwinLogFilterRegexSubsystem.py160
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/subsystem/main.c43
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/format/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/format/TestDarwinLogMessageFormat.py188
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/format/main.c41
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/source/debug/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/source/debug/TestDarwinLogSourceDebug.py81
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/source/debug/main.c34
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/source/info/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/source/info/TestDarwinLogSourceInfo.py84
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/source/info/main.c34
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/boolreference/TestFormattersBoolRefPtr.py40
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/compactvectors/TestCompactVectors.py38
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py341
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-categories/TestDataFormatterCategories.py298
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py274
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-disabling/TestDataFormatterDisabling.py48
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-enum-format/TestDataFormatterEnumFormat.py34
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-globals/TestDataFormatterGlobals.py32
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-named-summaries/TestDataFormatterNamedSummaries.py117
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py373
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/TestDataFormatterNSIndexPath.py115
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/main.m31
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsstring/TestDataFormatterNSString.py91
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-proper-plurals/TestFormattersOneIsSingular.py36
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-ptr-to-array/TestPtrToArrayFormatting.py18
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py189
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/fooSynthProvider.py49
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/ftsp.py58
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-script/TestDataFormatterScript.py128
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py227
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py496
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py38
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py56
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/main.cpp25
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/TestInitializerList.py29
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/TestDataFormatterLibccIterator.py47
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/main.cpp14
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/TestDataFormatterLibcxxList.py210
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/loop/TestDataFormatterLibcxxListLoop.py44
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py334
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multimap/TestDataFormatterLibccMultiMap.py332
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/TestDataFormatterLibcxxMultiSet.py98
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/set/TestDataFormatterLibcxxSet.py9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py76
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/TestDataFormatterUnordered.py27
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/TestDataFormatterLibcxxVBool.py49
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py170
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/TestDataFormatterStdIterator.py49
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py202
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py370
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py39
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/TestDataFormatterStdString.py40
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/Makefile8
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/TestDataFormatterStdTuple.py49
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/main.cpp9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/Makefile8
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py61
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/main.cpp22
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/TestDataFormatterStdVBool.py49
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py189
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py199
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthtype/TestDataFormatterSynthType.py14
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthtype/myIntSynthProvider.py42
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py63
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthval/main.cpp12
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthval/myIntSynthProvider.py42
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/dump_dynamic/TestDumpDynamic.py5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/format-propagation/TestFormatPropagation.py32
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/frameformat_smallstruct/TestFrameFormatSmallStruct.py14
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/hexcaps/TestDataFormatterHexCaps.py47
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/TestDataFormatterLanguageCategoryUpdates.py59
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/nsarraysynth/TestNSArraySynthetic.py80
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/nsdictionarysynth/TestNSDictionarySynthetic.py96
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/nssetsynth/TestNSSetSynthetic.py76
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/ostypeformatting/TestFormattersOsType.py14
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/parray/TestPrintArray.py104
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/poarray/TestPrintObjectArray.py74
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/ptr_ref_typedef/TestPtrRef2Typedef.py28
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/pyobjsynthprovider/Makefile (renamed from packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/Makefile)2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/pyobjsynthprovider/TestPyObjSynthProvider.py73
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/pyobjsynthprovider/main.cpp (renamed from packages/Python/lldbsuite/test/functionalities/type_lookup/main.m)14
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/pyobjsynthprovider/provider.py16
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/refpointer-recursion/TestDataFormatterRefPtrRecursion.py20
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/setvaluefromcstring/TestSetValueFromCString.py4
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/stringprinter/TestStringPrinter.py5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/summary-string-onfail/Test-rdar-9974002.py106
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/TestSyntheticCapping.py40
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/fooSynthProvider.py24
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/synthupdate/TestSyntheticFilterRecompute.py36
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/type_summary_list_arg/TestTypeSummaryListArg.py36
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/type_summary_list_script/TestTypeSummaryListScript.py24
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/type_summary_list_script/tslsformatters.py4
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/typedef_array/TestTypedefArray.py5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/user-format-vs-summary/TestUserFormatVsSummary.py39
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/var-in-aggregate-misuse/TestVarInAggregateMisuse.py50
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/varscript_formatting/TestDataFormatterVarScriptFormatting.py25
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/varscript_formatting/helperfunc.py5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/data-formatter/vector-types/TestVectorTypesFormatting.py64
-rw-r--r--packages/Python/lldbsuite/test/functionalities/dead-strip/TestDeadStrip.py38
-rw-r--r--packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py36
-rw-r--r--packages/Python/lldbsuite/test/functionalities/dynamic_value_child_count/TestDynamicValueChildCount.py46
-rw-r--r--packages/Python/lldbsuite/test/functionalities/embedded_interpreter/TestConvenienceVariables.py58
-rw-r--r--packages/Python/lldbsuite/test/functionalities/exec/TestExec.py66
-rw-r--r--packages/Python/lldbsuite/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py30
-rw-r--r--packages/Python/lldbsuite/test/functionalities/fat_archives/TestFatArchives.py44
-rw-r--r--packages/Python/lldbsuite/test/functionalities/format/TestFormats.py22
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/TestArray.py29
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/main.c9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame-diagnose/bad-reference/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame-diagnose/bad-reference/TestBadReference.py26
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame-diagnose/bad-reference/main.cpp22
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame-diagnose/complicated-expression/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame-diagnose/complicated-expression/TestComplicatedExpression.py29
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame-diagnose/complicated-expression/main.c26
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-argument/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-argument/TestDiagnoseDereferenceArgument.py29
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-argument/main.c22
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-function-return/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-function-return/TestDiagnoseDereferenceFunctionReturn.py32
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-function-return/main.c12
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-this/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-this/TestDiagnoseDereferenceThis.py29
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-this/main.cpp15
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame-diagnose/inheritance/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame-diagnose/inheritance/TestDiagnoseInheritance.py26
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame-diagnose/inheritance/main.cpp69
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame-diagnose/local-variable/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame-diagnose/local-variable/TestLocalVariable.py26
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame-diagnose/local-variable/main.c4
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame-diagnose/virtual-method-call/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame-diagnose/virtual-method-call/TestDiagnoseDereferenceVirtualMethodCall.py26
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame-diagnose/virtual-method-call/main.cpp16
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame_var_scope/Makefile3
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame_var_scope/TestFrameVariableScope.py5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/frame_var_scope/main.c21
-rw-r--r--packages/Python/lldbsuite/test/functionalities/inferior-assert/TestInferiorAssert.py163
-rw-r--r--packages/Python/lldbsuite/test/functionalities/inferior-changed/TestInferiorChanged.py30
-rw-r--r--packages/Python/lldbsuite/test/functionalities/inferior-crashing/TestInferiorCrashing.py119
-rw-r--r--packages/Python/lldbsuite/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py103
-rw-r--r--packages/Python/lldbsuite/test/functionalities/inline-stepping/TestInlineStepping.py193
-rw-r--r--packages/Python/lldbsuite/test/functionalities/jitloader_gdb/TestJITLoaderGDB.py10
-rw-r--r--packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py85
-rw-r--r--packages/Python/lldbsuite/test/functionalities/llvm/TestLLVM.py23
-rw-r--r--packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py223
-rw-r--r--packages/Python/lldbsuite/test/functionalities/longjmp/TestLongjmp.py23
-rw-r--r--packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py12
-rw-r--r--packages/Python/lldbsuite/test/functionalities/memory/find/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/memory/find/TestMemoryFind.py71
-rw-r--r--packages/Python/lldbsuite/test/functionalities/memory/find/main.cpp17
-rw-r--r--packages/Python/lldbsuite/test/functionalities/memory/read/TestMemoryRead.py69
-rw-r--r--packages/Python/lldbsuite/test/functionalities/multidebugger_commands/TestMultipleDebuggersCommands.py38
-rw-r--r--packages/Python/lldbsuite/test/functionalities/nested_alias/TestNestedAlias.py49
-rw-r--r--packages/Python/lldbsuite/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py16
-rw-r--r--packages/Python/lldbsuite/test/functionalities/nosucharch/TestNoSuchArch.py18
-rw-r--r--packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py8
-rw-r--r--packages/Python/lldbsuite/test/functionalities/paths/TestPaths.py35
-rw-r--r--packages/Python/lldbsuite/test/functionalities/platform/TestPlatformCommand.py42
-rw-r--r--packages/Python/lldbsuite/test/functionalities/plugins/commands/TestPluginCommands.py26
-rw-r--r--packages/Python/lldbsuite/test/functionalities/plugins/commands/plugin.cpp.template (renamed from packages/Python/lldbsuite/test/functionalities/plugins/commands/plugin.cpp)10
-rw-r--r--packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py157
-rw-r--r--packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/operating_system.py120
-rw-r--r--packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/operating_system2.py104
-rw-r--r--packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py249
-rw-r--r--packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/altmain.c (renamed from packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/altmain.c)0
-rw-r--r--packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/altmain.core (renamed from packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/altmain.core)bin40960 -> 40960 bytes
-rwxr-xr-xpackages/Python/lldbsuite/test/functionalities/postmortem/elf-core/altmain.out (renamed from packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/altmain.out)bin2330 -> 2330 bytes
-rw-r--r--packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/fpr_sse.cpp38
-rw-r--r--packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/TestGCore.py52
-rw-r--r--packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/linux-i386.corebin0 -> 12324 bytes
-rw-r--r--packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/linux-x86_64.corebin0 -> 19008 bytes
-rw-r--r--packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/main.cpp63
-rwxr-xr-xpackages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/main.mk5
-rwxr-xr-xpackages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/make-core.sh56
-rw-r--r--packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-fpr_sse_i386.corebin0 -> 32768 bytes
-rw-r--r--packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-fpr_sse_x86_64.corebin0 -> 40960 bytes
-rw-r--r--packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-i386.core (renamed from packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/i386.core)bin28672 -> 28672 bytes
-rwxr-xr-xpackages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-i386.out (renamed from packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/i386.out)bin1971 -> 1971 bytes
-rw-r--r--packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-s390x.core (renamed from packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/s390x.core)bin16384 -> 16384 bytes
-rwxr-xr-xpackages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-s390x.out (renamed from packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/s390x.out)bin2824 -> 2824 bytes
-rw-r--r--packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-x86_64.core (renamed from packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/x86_64.core)bin40960 -> 40960 bytes
-rwxr-xr-xpackages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-x86_64.out (renamed from packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/x86_64.out)bin2575 -> 2575 bytes
-rw-r--r--packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/main.c (renamed from packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/main.c)0
-rwxr-xr-xpackages/Python/lldbsuite/test/functionalities/postmortem/elf-core/make-core.sh (renamed from packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/make-core.sh)39
-rw-r--r--packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/TestLinuxCoreThreads.py61
-rw-r--r--packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/linux-i386.corebin0 -> 24576 bytes
-rw-r--r--packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/linux-x86_64.corebin0 -> 32768 bytes
-rw-r--r--packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/main.cpp63
-rwxr-xr-xpackages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/main.mk5
-rwxr-xr-xpackages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/make-core.sh64
-rw-r--r--packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/TestLinuxCore.py164
-rw-r--r--packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py161
-rw-r--r--packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/install_breakpad.cpp16
-rwxr-xr-xpackages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64bin0 -> 7279 bytes
-rw-r--r--packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64.cpp12
-rw-r--r--packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64.dmpbin0 -> 63592 bytes
-rwxr-xr-xpackages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64_not_crashedbin0 -> 7675 bytes
-rw-r--r--packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64_not_crashed.cpp22
-rw-r--r--packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64_not_crashed.dmpbin0 -> 63744 bytes
-rw-r--r--packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/makefile.txt29
-rw-r--r--packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py29
-rw-r--r--packages/Python/lldbsuite/test/functionalities/postmortem/wow64_minidump/TestWow64MiniDump.py11
-rw-r--r--packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py7
-rw-r--r--packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py13
-rw-r--r--packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py21
-rw-r--r--packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py96
-rw-r--r--packages/Python/lldbsuite/test/functionalities/process_save_core/TestProcessSaveCore.py21
-rw-r--r--packages/Python/lldbsuite/test/functionalities/ptr_refs/TestPtrRefs.py22
-rw-r--r--packages/Python/lldbsuite/test/functionalities/recursion/TestValueObjectRecursion.py38
-rw-r--r--packages/Python/lldbsuite/test/functionalities/register/intel_avx/Makefile7
-rw-r--r--packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestYMMRegister.py75
-rw-r--r--packages/Python/lldbsuite/test/functionalities/register/intel_avx/main.c67
-rw-r--r--packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/Makefile7
-rw-r--r--packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/TestMPXRegisters.py69
-rw-r--r--packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/main.cpp57
-rw-r--r--packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/Makefile7
-rw-r--r--packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/TestBoundViolation.py57
-rw-r--r--packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/main.cpp40
-rw-r--r--packages/Python/lldbsuite/test/functionalities/register/register_command/Makefile (renamed from packages/Python/lldbsuite/test/functionalities/register/Makefile)2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py (renamed from packages/Python/lldbsuite/test/functionalities/register/TestRegisters.py)235
-rw-r--r--packages/Python/lldbsuite/test/functionalities/register/register_command/a.cpp (renamed from packages/Python/lldbsuite/test/functionalities/register/a.cpp)0
-rw-r--r--packages/Python/lldbsuite/test/functionalities/register/register_command/main.cpp (renamed from packages/Python/lldbsuite/test/functionalities/register/main.cpp)0
-rw-r--r--packages/Python/lldbsuite/test/functionalities/rerun/TestRerun.py31
-rw-r--r--packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py220
-rw-r--r--packages/Python/lldbsuite/test/functionalities/set-data/TestSetData.py36
-rw-r--r--packages/Python/lldbsuite/test/functionalities/signal/TestSendSignal.py27
-rw-r--r--packages/Python/lldbsuite/test/functionalities/signal/handle-segv/TestHandleSegv.py21
-rw-r--r--packages/Python/lldbsuite/test/functionalities/signal/raise/TestRaise.py150
-rw-r--r--packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py14
-rw-r--r--packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/TestStepNoDebug.py98
-rw-r--r--packages/Python/lldbsuite/test/functionalities/stop-hook/TestStopHookCmd.py41
-rw-r--r--packages/Python/lldbsuite/test/functionalities/stop-hook/TestStopHookMechanism.py66
-rw-r--r--packages/Python/lldbsuite/test/functionalities/stop-hook/multiple_threads/TestStopHookMultipleThreads.py55
-rw-r--r--packages/Python/lldbsuite/test/functionalities/target_command/TestTargetCommand.py205
-rw-r--r--packages/Python/lldbsuite/test/functionalities/testid/TestTestId.py17
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/TestNumThreads.py22
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/backtrace_all/TestBacktraceAll.py33
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/break_after_join/TestBreakAfterJoin.py45
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentEvents.py525
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_delay_breakpoint_one_signal/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_delay_breakpoint_one_signal/TestConcurrentBreakpointDelayBreakpointOneSignal.py23
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_one_delay_breakpoint_threads/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_one_delay_breakpoint_threads/TestConcurrentBreakpointOneDelayBreakpointThreads.py22
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoints_delayed_breakpoint_one_watchpoint/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoints_delayed_breakpoint_one_watchpoint/TestConcurrentBreakpointsDelayedBreakpointOneWatchpoint.py25
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_break/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_break/TestConcurrentCrashWithBreak.py21
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_signal/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_signal/TestConcurrentCrashWithSignal.py21
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint/TestConcurrentCrashWithWatchpoint.py22
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint_breakpoint_signal/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint_breakpoint_signal/TestConcurrentCrashWithWatchpointBreakpointSignal.py25
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_break/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_break/TestConcurrentDelaySignalBreak.py23
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_watch/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_watch/TestConcurrentDelaySignalWatch.py24
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_watch_break/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_watch_break/TestConcurrentDelayWatchBreak.py24
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_signal/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_signal/TestConcurrentDelayedCrashWithBreakpointSignal.py23
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_watchpoint/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_watchpoint/TestConcurrentDelayedCrashWithBreakpointWatchpoint.py24
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_breakpoints/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_breakpoints/TestConcurrentManyBreakpoints.py23
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_crash/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_crash/TestConcurrentManyCrash.py23
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_signals/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_signals/TestConcurrentManySignals.py23
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_watchpoints/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_watchpoints/TestConcurrentManyWatchpoints.py23
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/n_watch_n_break/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/n_watch_n_break/TestConcurrentNWatchNBreak.py23
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_break/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_break/TestConcurrentSignalBreak.py21
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_break/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_break/TestConcurrentSignalDelayBreak.py23
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_watch/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_watch/TestConcurrentSignalDelayWatch.py24
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_n_watch_n_break/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_n_watch_n_break/TestConcurrentSignalNWatchNBreak.py24
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch/TestConcurrentSignalWatch.py22
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch_break/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch_break/TestConcurrentSignalWatchBreak.py24
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoint_threads/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoint_threads/TestConcurrentTwoBreakpointThreads.py21
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_delay_signal/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_delay_signal/TestConcurrentTwoBreakpointsOneDelaySignal.py23
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_signal/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_signal/TestConcurrentTwoBreakpointsOneSignal.py21
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_watchpoint/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_watchpoint/TestConcurrentTwoBreakpointsOneWatchpoint.py24
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoint_threads/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoint_threads/TestConcurrentTwoWatchpointThreads.py22
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_breakpoint/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_breakpoint/TestConcurrentTwoWatchpointsOneBreakpoint.py24
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_delay_breakpoint/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_delay_breakpoint/TestConcurrentTwoWatchpointsOneDelayBreakpoint.py24
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_signal/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_signal/TestConcurrentTwoWatchpointsOneSignal.py22
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break/TestConcurrentWatchBreak.py24
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break_delay/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break_delay/TestConcurrentWatchBreakDelay.py24
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_delay_watchpoint_one_breakpoint/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_delay_watchpoint_one_breakpoint/TestConcurrentWatchpointDelayWatchpointOneBreakpoint.py24
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_with_delay_watchpoint_threads/Makefile9
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_with_delay_watchpoint_threads/TestConcurrentWatchpointWithDelayWatchpointThreads.py23
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py32
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py57
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/create_during_step/TestCreateDuringStep.py128
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/exit_during_break/TestExitDuringBreak.py48
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/exit_during_step/TestExitDuringStep.py84
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py54
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/multi_break/TestMultipleBreakpoints.py52
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/state/TestThreadStates.py161
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/step_out/TestThreadStepOut.py115
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/step_until/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/step_until/TestStepUntil.py92
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/step_until/main.c20
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/thread_exit/TestThreadExit.py78
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py71
-rw-r--r--packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break_plus_condition/TestThreadSpecificBpPlusCondition.py43
-rw-r--r--packages/Python/lldbsuite/test/functionalities/tsan/basic/TestTsanBasic.py62
-rw-r--r--packages/Python/lldbsuite/test/functionalities/tsan/cpp_global_location/TestTsanCPPGlobalLocation.py45
-rw-r--r--packages/Python/lldbsuite/test/functionalities/tsan/global_location/TestTsanGlobalLocation.py47
-rw-r--r--packages/Python/lldbsuite/test/functionalities/tsan/multiple/TestTsanMultiple.py61
-rw-r--r--packages/Python/lldbsuite/test/functionalities/tsan/thread_leak/TestTsanThreadLeak.py34
-rw-r--r--packages/Python/lldbsuite/test/functionalities/tsan/thread_numbers/TestTsanThreadNumbers.py57
-rw-r--r--packages/Python/lldbsuite/test/functionalities/tty/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/tty/TestTerminal.py35
-rw-r--r--packages/Python/lldbsuite/test/functionalities/tty/main.c10
-rw-r--r--packages/Python/lldbsuite/test/functionalities/type_completion/TestTypeCompletion.py115
-rw-r--r--packages/Python/lldbsuite/test/functionalities/type_lookup/Makefile2
-rw-r--r--packages/Python/lldbsuite/test/functionalities/type_lookup/TestTypeLookup.py28
-rw-r--r--packages/Python/lldbsuite/test/functionalities/type_lookup/main.mm58
-rw-r--r--packages/Python/lldbsuite/test/functionalities/unwind/ehframe/TestEhFrameUnwind.py17
-rw-r--r--packages/Python/lldbsuite/test/functionalities/unwind/ehframe/main.c32
-rw-r--r--packages/Python/lldbsuite/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py26
-rw-r--r--packages/Python/lldbsuite/test/functionalities/unwind/sigtramp/TestSigtrampUnwind.py40
-rw-r--r--packages/Python/lldbsuite/test/functionalities/unwind/standard/TestStandardUnwind.py78
-rw-r--r--packages/Python/lldbsuite/test/functionalities/value_md5_crash/TestValueMD5Crash.py20
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py71
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py52
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/TestWatchpointMultipleSlots.py97
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/main.c29
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/TestMultipleHits.py58
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/main.cpp29
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py86
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py23
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py26
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py238
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py107
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py123
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/watchpoint_command.py7
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py54
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/TestWatchpointDisable.py88
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/main.c13
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/TestWatchpointEvents.py89
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_on_vectors/TestValueOfVectorVariable.py22
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py65
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py35
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/TestWatchpointSizes.py69
470 files changed, 16695 insertions, 6710 deletions
diff --git a/packages/Python/lldbsuite/test/functionalities/abbreviation/TestAbbreviations.py b/packages/Python/lldbsuite/test/functionalities/abbreviation/TestAbbreviations.py
index 6423ecf27aeb..b3095c758f9b 100644
--- a/packages/Python/lldbsuite/test/functionalities/abbreviation/TestAbbreviations.py
+++ b/packages/Python/lldbsuite/test/functionalities/abbreviation/TestAbbreviations.py
@@ -5,19 +5,20 @@ Test some lldb command abbreviations and aliases for proper resolution.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class AbbreviationsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@no_debug_info_test
- def test_command_abbreviations_and_aliases (self):
+ def test_command_abbreviations_and_aliases(self):
command_interpreter = self.dbg.GetCommandInterpreter()
self.assertTrue(command_interpreter, VALID_COMMAND_INTERPRETER)
result = lldb.SBCommandReturnObject()
@@ -47,9 +48,12 @@ class AbbreviationsTestCase(TestBase):
self.assertTrue(result.GetError().startswith("Ambiguous command"))
# Make sure an unabbreviated command is not mangled.
- command_interpreter.ResolveCommand("breakpoint set --name main --line 123", result)
+ command_interpreter.ResolveCommand(
+ "breakpoint set --name main --line 123", result)
self.assertTrue(result.Succeeded())
- self.assertEqual("breakpoint set --name main --line 123", result.GetOutput())
+ self.assertEqual(
+ "breakpoint set --name main --line 123",
+ result.GetOutput())
# Create some aliases.
self.runCmd("com a alias com al")
@@ -69,33 +73,40 @@ class AbbreviationsTestCase(TestBase):
self.runCmd("alias pltty process launch -s -o %1 -e %1")
command_interpreter.ResolveCommand("pltty /dev/tty0", result)
self.assertTrue(result.Succeeded())
- self.assertEqual("process launch -s -o /dev/tty0 -e /dev/tty0", result.GetOutput())
+ self.assertEqual(
+ "process launch -s -o /dev/tty0 -e /dev/tty0",
+ result.GetOutput())
self.runCmd("alias xyzzy breakpoint set -n %1 -l %2")
command_interpreter.ResolveCommand("xyzzy main 123", result)
self.assertTrue(result.Succeeded())
- self.assertEqual("breakpoint set -n main -l 123", result.GetOutput().strip())
+ self.assertEqual(
+ "breakpoint set -n main -l 123",
+ result.GetOutput().strip())
# And again, without enough parameters.
command_interpreter.ResolveCommand("xyzzy main", result)
self.assertFalse(result.Succeeded())
# Check a command that wants the raw input.
- command_interpreter.ResolveCommand(r'''sc print("\n\n\tHello!\n")''', result)
+ command_interpreter.ResolveCommand(
+ r'''sc print("\n\n\tHello!\n")''', result)
self.assertTrue(result.Succeeded())
- self.assertEqual(r'''script print("\n\n\tHello!\n")''', result.GetOutput())
+ self.assertEqual(
+ r'''script print("\n\n\tHello!\n")''',
+ result.GetOutput())
# Prompt changing stuff should be tested, but this doesn't seem like the
# right test to do it in. It has nothing to do with aliases or abbreviations.
#self.runCmd("com sou ./change_prompt.lldb")
- #self.expect("settings show prompt",
+ # self.expect("settings show prompt",
# startstr = 'prompt (string) = "[with-three-trailing-spaces] "')
#self.runCmd("settings clear prompt")
- #self.expect("settings show prompt",
+ # self.expect("settings show prompt",
# startstr = 'prompt (string) = "(lldb) "')
#self.runCmd("se se prompt 'Sycamore> '")
- #self.expect("se sh prompt",
+ # self.expect("se sh prompt",
# startstr = 'prompt (string) = "Sycamore> "')
#self.runCmd("se cl prompt")
- #self.expect("set sh prompt",
+ # self.expect("set sh prompt",
# startstr = 'prompt (string) = "(lldb) "')
diff --git a/packages/Python/lldbsuite/test/functionalities/abbreviation/TestCommonShortSpellings.py b/packages/Python/lldbsuite/test/functionalities/abbreviation/TestCommonShortSpellings.py
index fa6f3f306898..519b93efebe2 100644
--- a/packages/Python/lldbsuite/test/functionalities/abbreviation/TestCommonShortSpellings.py
+++ b/packages/Python/lldbsuite/test/functionalities/abbreviation/TestCommonShortSpellings.py
@@ -6,19 +6,20 @@ many commands remain available even after we add/delete commands in the future.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class CommonShortSpellingsTestCase(TestBase):
-
+
mydir = TestBase.compute_mydir(__file__)
@no_debug_info_test
- def test_abbrevs2 (self):
+ def test_abbrevs2(self):
command_interpreter = self.dbg.GetCommandInterpreter()
self.assertTrue(command_interpreter, VALID_COMMAND_INTERPRETER)
result = lldb.SBCommandReturnObject()
diff --git a/packages/Python/lldbsuite/test/functionalities/apropos_with_process/TestAproposWithProcess.py b/packages/Python/lldbsuite/test/functionalities/apropos_with_process/TestAproposWithProcess.py
index 66ed3ff73298..aecbab1b363f 100644
--- a/packages/Python/lldbsuite/test/functionalities/apropos_with_process/TestAproposWithProcess.py
+++ b/packages/Python/lldbsuite/test/functionalities/apropos_with_process/TestAproposWithProcess.py
@@ -5,13 +5,14 @@ Test that apropos env doesn't crash trying to touch the process plugin commmand
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class AproposWithProcessTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -29,16 +30,17 @@ class AproposWithProcessTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break in main() aftre the variables are assigned values.
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped', 'stop reason = breakpoint'])
+ substrs=['stopped', 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
self.runCmd('apropos env')
diff --git a/packages/Python/lldbsuite/test/functionalities/archives/TestBSDArchives.py b/packages/Python/lldbsuite/test/functionalities/archives/TestBSDArchives.py
index b419ad97a694..f825eaa86e85 100644
--- a/packages/Python/lldbsuite/test/functionalities/archives/TestBSDArchives.py
+++ b/packages/Python/lldbsuite/test/functionalities/archives/TestBSDArchives.py
@@ -3,13 +3,14 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class BSDArchivesTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -18,10 +19,18 @@ class BSDArchivesTestCase(TestBase):
# Call super's setUp().
TestBase.setUp(self)
# Find the line number in a(int) to break at.
- self.line = line_number('a.c', '// Set file and line breakpoint inside a().')
+ self.line = line_number(
+ 'a.c', '// Set file and line breakpoint inside a().')
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24527. Makefile.rules doesn't know how to build static libs on Windows")
- @expectedFailureAll(oslist=["linux"], archs=["arm", "aarch64"], bugnumber="llvm.org/pr27795")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24527. Makefile.rules doesn't know how to build static libs on Windows")
+ @expectedFailureAll(
+ oslist=["linux"],
+ archs=[
+ "arm",
+ "aarch64"],
+ bugnumber="llvm.org/pr27795")
def test(self):
"""Break inside a() and b() defined within libfoo.a."""
self.build()
@@ -30,30 +39,32 @@ class BSDArchivesTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside a() by file and line first.
- lldbutil.run_break_set_by_file_and_line (self, "a.c", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "a.c", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# Break at a(int) first.
self.expect("frame variable", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['(int) arg = 1'])
+ substrs=['(int) arg = 1'])
self.expect("frame variable __a_global", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['(int) __a_global = 1'])
+ substrs=['(int) __a_global = 1'])
# Set breakpoint for b() next.
- lldbutil.run_break_set_by_symbol (self, "b", num_expected_locations=1, sym_exact=True)
+ lldbutil.run_break_set_by_symbol(
+ self, "b", num_expected_locations=1, sym_exact=True)
# Continue the program, we should break at b(int) next.
self.runCmd("continue")
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
self.expect("frame variable", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['(int) arg = 2'])
+ substrs=['(int) arg = 2'])
self.expect("frame variable __b_global", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['(int) __b_global = 2'])
+ substrs=['(int) __b_global = 2'])
diff --git a/packages/Python/lldbsuite/test/functionalities/asan/TestMemoryHistory.py b/packages/Python/lldbsuite/test/functionalities/asan/TestMemoryHistory.py
index 6416bccc483d..7bddc0cadccf 100644
--- a/packages/Python/lldbsuite/test/functionalities/asan/TestMemoryHistory.py
+++ b/packages/Python/lldbsuite/test/functionalities/asan/TestMemoryHistory.py
@@ -5,25 +5,28 @@ Test that ASan memory history provider returns correct stack traces
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbplatform
from lldbsuite.test import lldbutil
+
class AsanTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @expectedFailureAll(oslist=["linux"], bugnumber="non-core functionality, need to reenable and fix later (DES 2014.11.07)")
- @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default
+ @expectedFailureAll(
+ oslist=["linux"],
+ bugnumber="non-core functionality, need to reenable and fix later (DES 2014.11.07)")
+ @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default
@skipIfRemote
- @skipUnlessCompilerRt
- def test (self):
- self.build ()
- self.asan_tests ()
+ @skipUnlessAddressSanitizer
+ def test(self):
+ self.build()
+ self.asan_tests()
def setUp(self):
# Call super's setUp().
@@ -33,68 +36,99 @@ class AsanTestCase(TestBase):
self.line_free = line_number('main.c', '// free line')
self.line_breakpoint = line_number('main.c', '// break line')
- def asan_tests (self):
- exe = os.path.join (os.getcwd(), "a.out")
- self.expect("file " + exe, patterns = [ "Current executable set to .*a.out" ])
+ def asan_tests(self):
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.expect(
+ "file " + exe,
+ patterns=["Current executable set to .*a.out"])
self.runCmd("breakpoint set -f main.c -l %d" % self.line_breakpoint)
# "memory history" command should not work without a process
self.expect("memory history 0",
- error = True,
- substrs = ["invalid process"])
+ error=True,
+ substrs=["invalid process"])
self.runCmd("run")
stop_reason = self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason()
if stop_reason == lldb.eStopReasonExec:
- # On OS X 10.10 and older, we need to re-exec to enable interceptors.
+ # On OS X 10.10 and older, we need to re-exec to enable
+ # interceptors.
self.runCmd("continue")
# the stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped', 'stop reason = breakpoint'])
+ substrs=['stopped', 'stop reason = breakpoint'])
# test that the ASan dylib is present
- self.expect("image lookup -n __asan_describe_address", "__asan_describe_address should be present",
- substrs = ['1 match found'])
+ self.expect(
+ "image lookup -n __asan_describe_address",
+ "__asan_describe_address should be present",
+ substrs=['1 match found'])
# test the 'memory history' command
- self.expect("memory history 'pointer'",
- substrs = [
- 'Memory allocated by Thread', 'a.out`f1', 'main.c:%d' % self.line_malloc,
- 'Memory deallocated by Thread', 'a.out`f2', 'main.c:%d' % self.line_free])
+ self.expect(
+ "memory history 'pointer'",
+ substrs=[
+ 'Memory allocated by Thread',
+ 'a.out`f1',
+ 'main.c:%d' %
+ self.line_malloc,
+ 'Memory deallocated by Thread',
+ 'a.out`f2',
+ 'main.c:%d' %
+ self.line_free])
# do the same using SB API
process = self.dbg.GetSelectedTarget().process
val = process.GetSelectedThread().GetSelectedFrame().EvaluateExpression("pointer")
addr = val.GetValueAsUnsigned()
- threads = process.GetHistoryThreads(addr);
+ threads = process.GetHistoryThreads(addr)
self.assertEqual(threads.GetSize(), 2)
-
+
history_thread = threads.GetThreadAtIndex(0)
self.assertTrue(history_thread.num_frames >= 2)
- self.assertEqual(history_thread.frames[1].GetLineEntry().GetFileSpec().GetFilename(), "main.c")
- self.assertEqual(history_thread.frames[1].GetLineEntry().GetLine(), self.line_free)
-
+ self.assertEqual(history_thread.frames[1].GetLineEntry(
+ ).GetFileSpec().GetFilename(), "main.c")
+ self.assertEqual(
+ history_thread.frames[1].GetLineEntry().GetLine(),
+ self.line_free)
+
history_thread = threads.GetThreadAtIndex(1)
self.assertTrue(history_thread.num_frames >= 2)
- self.assertEqual(history_thread.frames[1].GetLineEntry().GetFileSpec().GetFilename(), "main.c")
- self.assertEqual(history_thread.frames[1].GetLineEntry().GetLine(), self.line_malloc)
-
- # let's free the container (SBThreadCollection) and see if the SBThreads still live
+ self.assertEqual(history_thread.frames[1].GetLineEntry(
+ ).GetFileSpec().GetFilename(), "main.c")
+ self.assertEqual(
+ history_thread.frames[1].GetLineEntry().GetLine(),
+ self.line_malloc)
+
+ # let's free the container (SBThreadCollection) and see if the
+ # SBThreads still live
threads = None
self.assertTrue(history_thread.num_frames >= 2)
- self.assertEqual(history_thread.frames[1].GetLineEntry().GetFileSpec().GetFilename(), "main.c")
- self.assertEqual(history_thread.frames[1].GetLineEntry().GetLine(), self.line_malloc)
-
+ self.assertEqual(history_thread.frames[1].GetLineEntry(
+ ).GetFileSpec().GetFilename(), "main.c")
+ self.assertEqual(
+ history_thread.frames[1].GetLineEntry().GetLine(),
+ self.line_malloc)
+
# ASan will break when a report occurs and we'll try the API then
self.runCmd("continue")
- self.expect("thread list", "Process should be stopped due to ASan report",
- substrs = ['stopped', 'stop reason = Use of deallocated memory detected'])
-
- # make sure the 'memory history' command still works even when we're generating a report now
- self.expect("memory history 'another_pointer'",
- substrs = [
- 'Memory allocated by Thread', 'a.out`f1', 'main.c:%d' % self.line_malloc2])
+ self.expect(
+ "thread list",
+ "Process should be stopped due to ASan report",
+ substrs=[
+ 'stopped',
+ 'stop reason = Use of deallocated memory'])
+
+ # make sure the 'memory history' command still works even when we're
+ # generating a report now
+ self.expect(
+ "memory history 'another_pointer'",
+ substrs=[
+ 'Memory allocated by Thread',
+ 'a.out`f1',
+ 'main.c:%d' %
+ self.line_malloc2])
diff --git a/packages/Python/lldbsuite/test/functionalities/asan/TestReportData.py b/packages/Python/lldbsuite/test/functionalities/asan/TestReportData.py
index b02732ddeddf..0943d99ee834 100644
--- a/packages/Python/lldbsuite/test/functionalities/asan/TestReportData.py
+++ b/packages/Python/lldbsuite/test/functionalities/asan/TestReportData.py
@@ -5,25 +5,29 @@ Test the AddressSanitizer runtime support for report breakpoint and data extract
from __future__ import print_function
-
-import os, time
+import os
+import time
import json
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class AsanTestReportDataCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @expectedFailureAll(oslist=["linux"], bugnumber="non-core functionality, need to reenable and fix later (DES 2014.11.07)")
- @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default
+ @expectedFailureAll(
+ oslist=["linux"],
+ bugnumber="non-core functionality, need to reenable and fix later (DES 2014.11.07)")
+ @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default
@skipIfRemote
- @skipUnlessCompilerRt
+ @skipUnlessAddressSanitizer
+ @expectedFailureAll(archs=['i386'], bugnumber="rdar://28658860")
def test(self):
- self.build ()
- self.asan_tests ()
+ self.build()
+ self.asan_tests()
def setUp(self):
# Call super's setUp().
@@ -34,26 +38,43 @@ class AsanTestReportDataCase(TestBase):
self.line_breakpoint = line_number('main.c', '// break line')
self.line_crash = line_number('main.c', '// BOOM line')
- def asan_tests (self):
- exe = os.path.join (os.getcwd(), "a.out")
- self.expect("file " + exe, patterns = [ "Current executable set to .*a.out" ])
+ def asan_tests(self):
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.expect(
+ "file " + exe,
+ patterns=["Current executable set to .*a.out"])
self.runCmd("run")
stop_reason = self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason()
if stop_reason == lldb.eStopReasonExec:
- # On OS X 10.10 and older, we need to re-exec to enable interceptors.
+ # On OS X 10.10 and older, we need to re-exec to enable
+ # interceptors.
self.runCmd("continue")
- self.expect("thread list", "Process should be stopped due to ASan report",
- substrs = ['stopped', 'stop reason = Use of deallocated memory detected'])
+ self.expect(
+ "thread list",
+ "Process should be stopped due to ASan report",
+ substrs=[
+ 'stopped',
+ 'stop reason = Use of deallocated memory'])
- self.assertEqual(self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason(), lldb.eStopReasonInstrumentation)
+ self.assertEqual(
+ self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason(),
+ lldb.eStopReasonInstrumentation)
self.expect("bt", "The backtrace should show the crashing line",
- substrs = ['main.c:%d' % self.line_crash])
-
- self.expect("thread info -s", "The extended stop info should contain the ASan provided fields",
- substrs = ["access_size", "access_type", "address", "pc", "description", "heap-use-after-free"])
+ substrs=['main.c:%d' % self.line_crash])
+
+ self.expect(
+ "thread info -s",
+ "The extended stop info should contain the ASan provided fields",
+ substrs=[
+ "access_size",
+ "access_type",
+ "address",
+ "pc",
+ "description",
+ "heap-use-after-free"])
output_lines = self.res.GetOutput().split('\n')
json_line = '\n'.join(output_lines[2:])
diff --git a/packages/Python/lldbsuite/test/functionalities/attach_resume/TestAttachResume.py b/packages/Python/lldbsuite/test/functionalities/attach_resume/TestAttachResume.py
index 54463c56827a..b348e72606ad 100644
--- a/packages/Python/lldbsuite/test/functionalities/attach_resume/TestAttachResume.py
+++ b/packages/Python/lldbsuite/test/functionalities/attach_resume/TestAttachResume.py
@@ -5,8 +5,8 @@ Test process attach/resume.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
@@ -14,6 +14,7 @@ from lldbsuite.test import lldbutil
exe_name = "AttachResume" # Must match Makefile
+
class AttachResumeTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -41,35 +42,53 @@ class AttachResumeTestCase(TestBase):
process = self.dbg.GetSelectedTarget().GetProcess()
self.runCmd("c")
- lldbutil.expect_state_changes(self, listener, process, [lldb.eStateRunning])
+ lldbutil.expect_state_changes(
+ self, listener, process, [
+ lldb.eStateRunning])
self.runCmd("process interrupt")
- lldbutil.expect_state_changes(self, listener, process, [lldb.eStateStopped])
+ lldbutil.expect_state_changes(
+ self, listener, process, [
+ lldb.eStateStopped])
# be sure to continue/interrupt/continue (r204504)
self.runCmd("c")
- lldbutil.expect_state_changes(self, listener, process, [lldb.eStateRunning])
+ lldbutil.expect_state_changes(
+ self, listener, process, [
+ lldb.eStateRunning])
self.runCmd("process interrupt")
- lldbutil.expect_state_changes(self, listener, process, [lldb.eStateStopped])
+ lldbutil.expect_state_changes(
+ self, listener, process, [
+ lldb.eStateStopped])
# Second interrupt should have no effect.
- self.expect("process interrupt", patterns=["Process is not running"], error=True)
+ self.expect(
+ "process interrupt",
+ patterns=["Process is not running"],
+ error=True)
# check that this breakpoint is auto-cleared on detach (r204752)
- self.runCmd("br set -f main.cpp -l %u" % (line_number('main.cpp', '// Set breakpoint here')))
+ self.runCmd("br set -f main.cpp -l %u" %
+ (line_number('main.cpp', '// Set breakpoint here')))
self.runCmd("c")
- lldbutil.expect_state_changes(self, listener, process, [lldb.eStateRunning, lldb.eStateStopped])
+ lldbutil.expect_state_changes(
+ self, listener, process, [
+ lldb.eStateRunning, lldb.eStateStopped])
self.expect('br list', 'Breakpoint not hit',
- substrs = ['hit count = 1'])
+ substrs=['hit count = 1'])
# Make sure the breakpoint is not hit again.
- self.expect("expr debugger_flag = false", substrs=[" = false"]);
+ self.expect("expr debugger_flag = false", substrs=[" = false"])
self.runCmd("c")
- lldbutil.expect_state_changes(self, listener, process, [lldb.eStateRunning])
+ lldbutil.expect_state_changes(
+ self, listener, process, [
+ lldb.eStateRunning])
# make sure to detach while in running state (r204759)
self.runCmd("detach")
- lldbutil.expect_state_changes(self, listener, process, [lldb.eStateDetached])
+ lldbutil.expect_state_changes(
+ self, listener, process, [
+ lldb.eStateDetached])
diff --git a/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/TestFdLeak.py b/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/TestFdLeak.py
index e31eac48ad7a..867b6053a570 100644
--- a/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/TestFdLeak.py
+++ b/packages/Python/lldbsuite/test/functionalities/avoids-fd-leak/TestFdLeak.py
@@ -5,7 +5,6 @@ Test whether a process started by lldb has no extra file descriptors open.
from __future__ import print_function
-
import os
import lldb
from lldbsuite.test import lldbutil
@@ -28,55 +27,79 @@ class AvoidsFdLeakTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@expectedFailure(python_leaky_fd_version, "bugs.freebsd.org/197376")
- @expectedFailureAll(oslist=['freebsd'], bugnumber="llvm.org/pr25624 still failing with Python 2.7.10")
- @skipIfWindows # The check for descriptor leakage needs to be implemented differently here.
- @skipIfTargetAndroid() # Android have some other file descriptors open by the shell
- def test_fd_leak_basic (self):
+ @expectedFailureAll(
+ oslist=['freebsd'],
+ bugnumber="llvm.org/pr25624 still failing with Python 2.7.10")
+ # The check for descriptor leakage needs to be implemented differently
+ # here.
+ @skipIfWindows
+ @skipIfTargetAndroid() # Android have some other file descriptors open by the shell
+ def test_fd_leak_basic(self):
self.do_test([])
@expectedFailure(python_leaky_fd_version, "bugs.freebsd.org/197376")
- @expectedFailureAll(oslist=['freebsd'], bugnumber="llvm.org/pr25624 still failing with Python 2.7.10")
- @skipIfWindows # The check for descriptor leakage needs to be implemented differently here.
- @skipIfTargetAndroid() # Android have some other file descriptors open by the shell
- def test_fd_leak_log (self):
+ @expectedFailureAll(
+ oslist=['freebsd'],
+ bugnumber="llvm.org/pr25624 still failing with Python 2.7.10")
+ # The check for descriptor leakage needs to be implemented differently
+ # here.
+ @skipIfWindows
+ @skipIfTargetAndroid() # Android have some other file descriptors open by the shell
+ def test_fd_leak_log(self):
self.do_test(["log enable -f '/dev/null' lldb commands"])
- def do_test (self, commands):
+ def do_test(self, commands):
self.build()
- exe = os.path.join (os.getcwd(), "a.out")
+ exe = os.path.join(os.getcwd(), "a.out")
for c in commands:
self.runCmd(c)
target = self.dbg.CreateTarget(exe)
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
- self.assertTrue(process.GetState() == lldb.eStateExited, "Process should have exited.")
- self.assertTrue(process.GetExitStatus() == 0,
- "Process returned non-zero status. Were incorrect file descriptors passed?")
+ self.assertTrue(
+ process.GetState() == lldb.eStateExited,
+ "Process should have exited.")
+ self.assertTrue(
+ process.GetExitStatus() == 0,
+ "Process returned non-zero status. Were incorrect file descriptors passed?")
@expectedFailure(python_leaky_fd_version, "bugs.freebsd.org/197376")
- @expectedFailureAll(oslist=['freebsd'], bugnumber="llvm.org/pr25624 still failing with Python 2.7.10")
- @skipIfWindows # The check for descriptor leakage needs to be implemented differently here.
- @skipIfTargetAndroid() # Android have some other file descriptors open by the shell
- def test_fd_leak_multitarget (self):
+ @expectedFailureAll(
+ oslist=['freebsd'],
+ bugnumber="llvm.org/pr25624 still failing with Python 2.7.10")
+ # The check for descriptor leakage needs to be implemented differently
+ # here.
+ @skipIfWindows
+ @skipIfTargetAndroid() # Android have some other file descriptors open by the shell
+ def test_fd_leak_multitarget(self):
self.build()
- exe = os.path.join (os.getcwd(), "a.out")
+ exe = os.path.join(os.getcwd(), "a.out")
target = self.dbg.CreateTarget(exe)
- breakpoint = target.BreakpointCreateBySourceRegex ('Set breakpoint here', lldb.SBFileSpec ("main.c", False))
+ breakpoint = target.BreakpointCreateBySourceRegex(
+ 'Set breakpoint here', lldb.SBFileSpec("main.c", False))
self.assertTrue(breakpoint, VALID_BREAKPOINT)
- process1 = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process1 = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process1, PROCESS_IS_VALID)
- self.assertTrue(process1.GetState() == lldb.eStateStopped, "Process should have been stopped.")
+ self.assertTrue(
+ process1.GetState() == lldb.eStateStopped,
+ "Process should have been stopped.")
target2 = self.dbg.CreateTarget(exe)
- process2 = target2.LaunchSimple (None, None, self.get_process_working_directory())
+ process2 = target2.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process2, PROCESS_IS_VALID)
- self.assertTrue(process2.GetState() == lldb.eStateExited, "Process should have exited.")
- self.assertTrue(process2.GetExitStatus() == 0,
- "Process returned non-zero status. Were incorrect file descriptors passed?")
+ self.assertTrue(
+ process2.GetState() == lldb.eStateExited,
+ "Process should have exited.")
+ self.assertTrue(
+ process2.GetExitStatus() == 0,
+ "Process returned non-zero status. Were incorrect file descriptors passed?")
diff --git a/packages/Python/lldbsuite/test/functionalities/backticks/TestBackticksWithoutATarget.py b/packages/Python/lldbsuite/test/functionalities/backticks/TestBackticksWithoutATarget.py
index 851e4d376b38..528e52565b5e 100644
--- a/packages/Python/lldbsuite/test/functionalities/backticks/TestBackticksWithoutATarget.py
+++ b/packages/Python/lldbsuite/test/functionalities/backticks/TestBackticksWithoutATarget.py
@@ -5,13 +5,14 @@ Test that backticks without a target should work (not infinite looping).
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class BackticksWithNoTargetTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -20,4 +21,4 @@ class BackticksWithNoTargetTestCase(TestBase):
def test_backticks_no_target(self):
"""A simple test of backticks without a target."""
self.expect("print `1+2-3`",
- substrs = [' = 0'])
+ substrs=[' = 0'])
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestAddressBreakpoints.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestAddressBreakpoints.py
index 9442a076e2a3..9b116a0a0a24 100644
--- a/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestAddressBreakpoints.py
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestAddressBreakpoints.py
@@ -5,18 +5,21 @@ Test address breakpoints set with shared library of SBAddress work correctly.
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
import lldbsuite.test.lldbutil as lldbutil
from lldbsuite.test.lldbtest import *
+
class AddressBreakpointTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- def test_address_breakpoints (self):
+ NO_DEBUG_INFO_TESTCASE = True
+
+ def test_address_breakpoints(self):
"""Test address breakpoints set with shared library of SBAddress work correctly."""
self.build()
self.address_breakpoints()
@@ -34,9 +37,10 @@ class AddressBreakpointTestCase(TestBase):
self.assertTrue(target, VALID_TARGET)
# Now create a breakpoint on main.c by name 'c'.
- breakpoint = target.BreakpointCreateBySourceRegex("Set a breakpoint here", lldb.SBFileSpec("main.c"))
+ breakpoint = target.BreakpointCreateBySourceRegex(
+ "Set a breakpoint here", lldb.SBFileSpec("main.c"))
self.assertTrue(breakpoint and
- breakpoint.GetNumLocations() == 1,
+ breakpoint.GetNumLocations() >= 1,
VALID_BREAKPOINT)
# Get the breakpoint location from breakpoint after we verified that,
@@ -48,7 +52,7 @@ class AddressBreakpointTestCase(TestBase):
# Next get the address from the location, and create an address breakpoint using
# that address:
-
+
address = location.GetAddress()
target.BreakpointDelete(breakpoint.GetID())
@@ -61,16 +65,18 @@ class AddressBreakpointTestCase(TestBase):
flags = launch_info.GetLaunchFlags()
flags &= ~lldb.eLaunchFlagDisableASLR
launch_info.SetLaunchFlags(flags)
-
+
error = lldb.SBError()
- process = target.Launch (launch_info, error)
+ process = target.Launch(launch_info, error)
self.assertTrue(process, PROCESS_IS_VALID)
# Did we hit our breakpoint?
- from lldbsuite.test.lldbutil import get_threads_stopped_at_breakpoint
- threads = get_threads_stopped_at_breakpoint (process, breakpoint)
- self.assertTrue(len(threads) == 1, "There should be a thread stopped at our breakpoint")
+ from lldbsuite.test.lldbutil import get_threads_stopped_at_breakpoint
+ threads = get_threads_stopped_at_breakpoint(process, breakpoint)
+ self.assertTrue(
+ len(threads) == 1,
+ "There should be a thread stopped at our breakpoint")
# The hit count for the breakpoint should be 1.
self.assertTrue(breakpoint.GetHitCount() == 1)
@@ -82,10 +88,12 @@ class AddressBreakpointTestCase(TestBase):
launch_info.SetLaunchFlags(flags)
process = target.Launch(launch_info, error)
- self.assertTrue (process, PROCESS_IS_VALID)
+ self.assertTrue(process, PROCESS_IS_VALID)
- thread = get_threads_stopped_at_breakpoint (process, breakpoint)
- self.assertTrue(len(threads) == 1, "There should be a thread stopped at our breakpoint")
+ thread = get_threads_stopped_at_breakpoint(process, breakpoint)
+ self.assertTrue(
+ len(threads) == 1,
+ "There should be a thread stopped at our breakpoint")
# The hit count for the breakpoint should now be 2.
self.assertTrue(breakpoint.GetHitCount() == 2)
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py
index 73b3ef5eae28..ca05356f9696 100644
--- a/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py
@@ -5,18 +5,21 @@ Test that breakpoints set on a bad address say they are bad.
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
import lldbsuite.test.lldbutil as lldbutil
from lldbsuite.test.lldbtest import *
+
class BadAddressBreakpointTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- def test_bad_address_breakpoints (self):
+ NO_DEBUG_INFO_TESTCASE = True
+
+ def test_bad_address_breakpoints(self):
"""Test that breakpoints set on a bad address say they are bad."""
self.build()
self.address_breakpoints()
@@ -34,7 +37,8 @@ class BadAddressBreakpointTestCase(TestBase):
self.assertTrue(target, VALID_TARGET)
# Now create a breakpoint on main.c by name 'c'.
- breakpoint = target.BreakpointCreateBySourceRegex("Set a breakpoint here", lldb.SBFileSpec("main.c"))
+ breakpoint = target.BreakpointCreateBySourceRegex(
+ "Set a breakpoint here", lldb.SBFileSpec("main.c"))
self.assertTrue(breakpoint and
breakpoint.GetNumLocations() == 1,
VALID_BREAKPOINT)
@@ -47,16 +51,18 @@ class BadAddressBreakpointTestCase(TestBase):
VALID_BREAKPOINT_LOCATION)
launch_info = lldb.SBLaunchInfo(None)
-
+
error = lldb.SBError()
- process = target.Launch (launch_info, error)
+ process = target.Launch(launch_info, error)
self.assertTrue(process, PROCESS_IS_VALID)
# Did we hit our breakpoint?
- from lldbsuite.test.lldbutil import get_threads_stopped_at_breakpoint
- threads = get_threads_stopped_at_breakpoint (process, breakpoint)
- self.assertTrue(len(threads) == 1, "There should be a thread stopped at our breakpoint")
+ from lldbsuite.test.lldbutil import get_threads_stopped_at_breakpoint
+ threads = get_threads_stopped_at_breakpoint(process, breakpoint)
+ self.assertTrue(
+ len(threads) == 1,
+ "There should be a thread stopped at our breakpoint")
# The hit count for the breakpoint should be 1.
self.assertTrue(breakpoint.GetHitCount() == 1)
@@ -72,6 +78,5 @@ class BadAddressBreakpointTestCase(TestBase):
for bp_loc in bkpt:
self.assertTrue(bp_loc.IsResolved() == False)
else:
- self.fail("Could not find an illegal address at which to set a bad breakpoint.")
-
-
+ self.fail(
+ "Could not find an illegal address at which to set a bad breakpoint.")
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_case_sensitivity/TestBreakpointCaseSensitivity.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_case_sensitivity/TestBreakpointCaseSensitivity.py
index aa4ee14ffc5a..88ccc4644192 100644
--- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_case_sensitivity/TestBreakpointCaseSensitivity.py
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_case_sensitivity/TestBreakpointCaseSensitivity.py
@@ -9,6 +9,7 @@ from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
from lldbsuite.test import lldbplatform, lldbplatformutil
+
class BreakpointCaseSensitivityTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
BREAKPOINT_TEXT = 'Set a breakpoint here'
@@ -18,14 +19,13 @@ class BreakpointCaseSensitivityTestCase(TestBase):
TestBase.setUp(self)
self.line = line_number('main.c', self.BREAKPOINT_TEXT)
- @skipIf(oslist=no_match(['windows'])) # Skip for non-windows platforms
+ @skipIf(hostoslist=no_match(['windows'])) # Skip for non-windows platforms
def test_breakpoint_matches_file_with_different_case(self):
"""Set breakpoint on file, should match files with different case on Windows"""
self.build()
self.case_sensitivity_breakpoint(True)
- @skipIf(oslist=['windows']) # Skip for windows platforms
- @expectedFailureAll() # Failing for unknown reason on non-Windows platforms.
+ @skipIf(hostoslist=['windows']) # Skip for windows platforms
def test_breakpoint_doesnt_match_file_with_different_case(self):
"""Set breakpoint on file, shouldn't match files with different case on POSIX systems"""
self.build()
@@ -33,19 +33,19 @@ class BreakpointCaseSensitivityTestCase(TestBase):
def case_sensitivity_breakpoint(self, case_insensitive):
"""Set breakpoint on file, should match files with different case if case_insensitive is True"""
-
+
# use different case to check CreateTarget
exe = 'a.out'
if case_insensitive:
exe = exe.upper()
-
+
exe = os.path.join(os.getcwd(), exe)
# Create a target by the debugger.
self.target = self.dbg.CreateTarget(exe)
self.assertTrue(self.target, VALID_TARGET)
- cwd = self.get_process_working_directory();
-
+ cwd = os.getcwd()
+
# try both BreakpointCreateByLocation and BreakpointCreateBySourceRegex
for regex in [False, True]:
# should always hit
@@ -68,47 +68,55 @@ class BreakpointCaseSensitivityTestCase(TestBase):
def check_breakpoint(self, file, source_regex, should_hit):
"""
Check breakpoint hit at given file set by given method
-
+
file:
File where insert the breakpoint
-
+
source_regex:
True for testing using BreakpointCreateBySourceRegex,
False for BreakpointCreateByLocation
-
+
should_hit:
True if the breakpoint should hit, False otherwise
"""
-
- desc = ' file %s set by %s' % (file, 'regex' if source_regex else 'location')
+
+ desc = ' file %s set by %s' % (
+ file, 'regex' if source_regex else 'location')
if source_regex:
- breakpoint = self.target.BreakpointCreateBySourceRegex(self.BREAKPOINT_TEXT,
- lldb.SBFileSpec(file))
- else:
- breakpoint = self.target.BreakpointCreateByLocation(file, self.line)
-
+ breakpoint = self.target.BreakpointCreateBySourceRegex(
+ self.BREAKPOINT_TEXT, lldb.SBFileSpec(file))
+ else:
+ breakpoint = self.target.BreakpointCreateByLocation(
+ file, self.line)
+
self.assertEqual(breakpoint and breakpoint.GetNumLocations() == 1,
- should_hit,
- VALID_BREAKPOINT + desc)
+ should_hit,
+ VALID_BREAKPOINT + desc)
# Get the breakpoint location from breakpoint after we verified that,
# indeed, it has one location.
location = breakpoint.GetLocationAtIndex(0)
- self.assertEqual(location and location.IsEnabled(),
- should_hit,
- VALID_BREAKPOINT_LOCATION + desc)
-
- process = self.target.LaunchSimple(None, None, self.get_process_working_directory())
+
+ self.assertEqual(location.IsValid(),
+ should_hit,
+ VALID_BREAKPOINT_LOCATION + desc)
+
+ process = self.target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID + desc)
if should_hit:
# Did we hit our breakpoint?
- from lldbsuite.test.lldbutil import get_threads_stopped_at_breakpoint
- threads = get_threads_stopped_at_breakpoint (process, breakpoint)
- self.assertEqual(len(threads), 1, "There should be a thread stopped at breakpoint" + desc)
+ from lldbsuite.test.lldbutil import get_threads_stopped_at_breakpoint
+ threads = get_threads_stopped_at_breakpoint(process, breakpoint)
+ self.assertEqual(
+ len(threads),
+ 1,
+ "There should be a thread stopped at breakpoint" +
+ desc)
# The hit count for the breakpoint should be 1.
self.assertEqual(breakpoint.GetHitCount(), 1)
-
+
else:
# check the breakpoint was not hit
self.assertEqual(lldb.eStateExited, process.GetState())
@@ -116,6 +124,6 @@ class BreakpointCaseSensitivityTestCase(TestBase):
# let process finish
process.Continue()
-
+
# cleanup
self.target.BreakpointDelete(breakpoint.GetID())
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
index 78d14b7d7705..e67a6332d9d2 100644
--- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
@@ -5,13 +5,14 @@ Test lldb breakpoint command add/list/delete.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class BreakpointCommandTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -27,7 +28,7 @@ class BreakpointCommandTestCase(TestBase):
"""Test a sequence of breakpoint command add, list, and delete."""
self.build()
self.breakpoint_command_sequence()
- self.breakpoint_command_script_parameters ()
+ self.breakpoint_command_script_parameters()
def setUp(self):
# Call super's setUp().
@@ -36,7 +37,8 @@ class BreakpointCommandTestCase(TestBase):
self.line = line_number('main.c', '// Set break point at this line.')
# disable "There is a running process, kill it and restart?" prompt
self.runCmd("settings set auto-confirm true")
- self.addTearDownHook(lambda: self.runCmd("settings clear auto-confirm"))
+ self.addTearDownHook(
+ lambda: self.runCmd("settings clear auto-confirm"))
def breakpoint_command_sequence(self):
"""Test a sequence of breakpoint command add, list, and delete."""
@@ -45,45 +47,64 @@ class BreakpointCommandTestCase(TestBase):
# Add three breakpoints on the same line. The first time we don't specify the file,
# since the default file is the one containing main:
- lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1, loc_exact=True)
- lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
- lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
- # Breakpoint 4 - set at the same location as breakpoint 1 to test setting breakpoint commands on two breakpoints at a time
- lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
+ # Breakpoint 4 - set at the same location as breakpoint 1 to test
+ # setting breakpoint commands on two breakpoints at a time
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.line, num_expected_locations=1, loc_exact=True)
# Now add callbacks for the breakpoints just created.
- self.runCmd("breakpoint command add -s command -o 'frame variable --show-types --scope' 1 4")
- self.runCmd("breakpoint command add -s python -o 'here = open(\"output.txt\", \"w\"); here.write(\"lldb\\n\"); here.close()' 2")
- self.runCmd("breakpoint command add --python-function bktptcmd.function 3")
+ self.runCmd(
+ "breakpoint command add -s command -o 'frame variable --show-types --scope' 1 4")
+ self.runCmd(
+ "breakpoint command add -s python -o 'here = open(\"output.txt\", \"w\"); here.write(\"lldb\\n\"); here.close()' 2")
+ self.runCmd(
+ "breakpoint command add --python-function bktptcmd.function 3")
# Check that the breakpoint commands are correctly set.
# The breakpoint list now only contains breakpoint 1.
- self.expect("breakpoint list", "Breakpoints 1 & 2 created",
- substrs = ["2: file = 'main.c', line = %d, exact_match = 0, locations = 1" % self.line],
- patterns = ["1: file = '.*main.c', line = %d, exact_match = 0, locations = 1" % self.line] )
-
- self.expect("breakpoint list -f", "Breakpoints 1 & 2 created",
- substrs = ["2: file = 'main.c', line = %d, exact_match = 0, locations = 1" % self.line],
- patterns = ["1: file = '.*main.c', line = %d, exact_match = 0, locations = 1" % self.line,
- "1.1: .+at main.c:%d, .+unresolved, hit count = 0" % self.line,
- "2.1: .+at main.c:%d, .+unresolved, hit count = 0" % self.line])
+ self.expect(
+ "breakpoint list", "Breakpoints 1 & 2 created", substrs=[
+ "2: file = 'main.c', line = %d, exact_match = 0, locations = 1" %
+ self.line], patterns=[
+ "1: file = '.*main.c', line = %d, exact_match = 0, locations = 1" %
+ self.line])
+
+ self.expect(
+ "breakpoint list -f",
+ "Breakpoints 1 & 2 created",
+ substrs=[
+ "2: file = 'main.c', line = %d, exact_match = 0, locations = 1" %
+ self.line],
+ patterns=[
+ "1: file = '.*main.c', line = %d, exact_match = 0, locations = 1" %
+ self.line,
+ "1.1: .+at main.c:%d, .+unresolved, hit count = 0" %
+ self.line,
+ "2.1: .+at main.c:%d, .+unresolved, hit count = 0" %
+ self.line])
self.expect("breakpoint command list 1", "Breakpoint 1 command ok",
- substrs = ["Breakpoint commands:",
- "frame variable --show-types --scope"])
+ substrs=["Breakpoint commands:",
+ "frame variable --show-types --scope"])
self.expect("breakpoint command list 2", "Breakpoint 2 command ok",
- substrs = ["Breakpoint commands:",
- "here = open",
- "here.write",
- "here.close()"])
+ substrs=["Breakpoint commands (Python):",
+ "here = open",
+ "here.write",
+ "here.close()"])
self.expect("breakpoint command list 3", "Breakpoint 3 command ok",
- substrs = ["Breakpoint commands:",
- "bktptcmd.function(frame, bp_loc, internal_dict)"])
+ substrs=["Breakpoint commands (Python):",
+ "bktptcmd.function(frame, bp_loc, internal_dict)"])
self.expect("breakpoint command list 4", "Breakpoint 4 command ok",
- substrs = ["Breakpoint commands:",
- "frame variable --show-types --scope"])
+ substrs=["Breakpoint commands:",
+ "frame variable --show-types --scope"])
self.runCmd("breakpoint delete 4")
@@ -93,43 +114,68 @@ class BreakpointCommandTestCase(TestBase):
# and then specify only one file. The first time we should get two locations,
# the second time only one:
- lldbutil.run_break_set_by_regexp (self, r"._MyFunction", num_expected_locations=2)
-
- lldbutil.run_break_set_by_regexp (self, r"._MyFunction", extra_options="-f a.c", num_expected_locations=1)
-
- lldbutil.run_break_set_by_regexp (self, r"._MyFunction", extra_options="-f a.c -f b.c", num_expected_locations=2)
+ lldbutil.run_break_set_by_regexp(
+ self, r"._MyFunction", num_expected_locations=2)
+
+ lldbutil.run_break_set_by_regexp(
+ self,
+ r"._MyFunction",
+ extra_options="-f a.c",
+ num_expected_locations=1)
+
+ lldbutil.run_break_set_by_regexp(
+ self,
+ r"._MyFunction",
+ extra_options="-f a.c -f b.c",
+ num_expected_locations=2)
# Now try a source regex breakpoint:
- lldbutil.run_break_set_by_source_regexp (self, r"is about to return [12]0", extra_options="-f a.c -f b.c", num_expected_locations=2)
-
- lldbutil.run_break_set_by_source_regexp (self, r"is about to return [12]0", extra_options="-f a.c", num_expected_locations=1)
-
+ lldbutil.run_break_set_by_source_regexp(
+ self,
+ r"is about to return [12]0",
+ extra_options="-f a.c -f b.c",
+ num_expected_locations=2)
+
+ lldbutil.run_break_set_by_source_regexp(
+ self,
+ r"is about to return [12]0",
+ extra_options="-f a.c",
+ num_expected_locations=1)
+
# Run the program. Remove 'output.txt' if it exists.
self.RemoveTempFile("output.txt")
self.RemoveTempFile("output2.txt")
self.runCmd("run", RUN_SUCCEEDED)
- # Check that the file 'output.txt' exists and contains the string "lldb".
+ # Check that the file 'output.txt' exists and contains the string
+ # "lldb".
# The 'output.txt' file should now exist.
- self.assertTrue(os.path.isfile("output.txt"),
- "'output.txt' exists due to breakpoint command for breakpoint 2.")
- self.assertTrue(os.path.isfile("output2.txt"),
- "'output2.txt' exists due to breakpoint command for breakpoint 3.")
+ self.assertTrue(
+ os.path.isfile("output.txt"),
+ "'output.txt' exists due to breakpoint command for breakpoint 2.")
+ self.assertTrue(
+ os.path.isfile("output2.txt"),
+ "'output2.txt' exists due to breakpoint command for breakpoint 3.")
# Read the output file produced by running the program.
with open('output.txt', 'r') as f:
output = f.read()
- self.expect(output, "File 'output.txt' and the content matches", exe=False,
- startstr = "lldb")
+ self.expect(
+ output,
+ "File 'output.txt' and the content matches",
+ exe=False,
+ startstr="lldb")
with open('output2.txt', 'r') as f:
output = f.read()
- self.expect(output, "File 'output2.txt' and the content matches", exe=False,
- startstr = "lldb")
-
+ self.expect(
+ output,
+ "File 'output2.txt' and the content matches",
+ exe=False,
+ startstr="lldb")
# Finish the program.
self.runCmd("process continue")
@@ -140,21 +186,31 @@ class BreakpointCommandTestCase(TestBase):
# Remove breakpoint 2.
self.runCmd("breakpoint delete 2")
- self.expect("breakpoint command list 1",
- startstr = "Breakpoint 1 does not have an associated command.")
- self.expect("breakpoint command list 2", error=True,
- startstr = "error: '2' is not a currently valid breakpoint ID.")
+ self.expect(
+ "breakpoint command list 1",
+ startstr="Breakpoint 1 does not have an associated command.")
+ self.expect(
+ "breakpoint command list 2",
+ error=True,
+ startstr="error: '2' is not a currently valid breakpoint ID.")
# The breakpoint list now only contains breakpoint 1.
- self.expect("breakpoint list -f", "Breakpoint 1 exists",
- patterns = ["1: file = '.*main.c', line = %d, exact_match = 0, locations = 1, resolved = 1" %
- self.line,
- "hit count = 1"])
+ self.expect(
+ "breakpoint list -f",
+ "Breakpoint 1 exists",
+ patterns=[
+ "1: file = '.*main.c', line = %d, exact_match = 0, locations = 1, resolved = 1" %
+ self.line,
+ "hit count = 1"])
# Not breakpoint 2.
- self.expect("breakpoint list -f", "No more breakpoint 2", matching=False,
- substrs = ["2: file = 'main.c', line = %d, exact_match = 0, locations = 1, resolved = 1" %
- self.line])
+ self.expect(
+ "breakpoint list -f",
+ "No more breakpoint 2",
+ matching=False,
+ substrs=[
+ "2: file = 'main.c', line = %d, exact_match = 0, locations = 1, resolved = 1" %
+ self.line])
# Run the program again, with breakpoint 1 remaining.
self.runCmd("run", RUN_SUCCEEDED)
@@ -163,20 +219,21 @@ class BreakpointCommandTestCase(TestBase):
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 2.
self.expect("breakpoint list -f", BREAKPOINT_HIT_TWICE,
- substrs = ['resolved, hit count = 2'])
+ substrs=['resolved, hit count = 2'])
- def breakpoint_command_script_parameters (self):
+ def breakpoint_command_script_parameters(self):
"""Test that the frame and breakpoint location are being properly passed to the script breakpoint command function."""
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Add a breakpoint.
- lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
# Now add callbacks for the breakpoints just created.
self.runCmd("breakpoint command add -s python -o 'here = open(\"output-2.txt\", \"w\"); here.write(str(frame) + \"\\n\"); here.write(str(bp_loc) + \"\\n\"); here.close()' 1")
@@ -184,24 +241,30 @@ class BreakpointCommandTestCase(TestBase):
# Remove 'output-2.txt' if it already exists.
if (os.path.exists('output-2.txt')):
- os.remove ('output-2.txt')
+ os.remove('output-2.txt')
- # Run program, hit breakpoint, and hopefully write out new version of 'output-2.txt'
- self.runCmd ("run", RUN_SUCCEEDED)
+ # Run program, hit breakpoint, and hopefully write out new version of
+ # 'output-2.txt'
+ self.runCmd("run", RUN_SUCCEEDED)
- # Check that the file 'output.txt' exists and contains the string "lldb".
+ # Check that the file 'output.txt' exists and contains the string
+ # "lldb".
# The 'output-2.txt' file should now exist.
- self.assertTrue(os.path.isfile("output-2.txt"),
- "'output-2.txt' exists due to breakpoint command for breakpoint 1.")
+ self.assertTrue(
+ os.path.isfile("output-2.txt"),
+ "'output-2.txt' exists due to breakpoint command for breakpoint 1.")
# Read the output file produced by running the program.
with open('output-2.txt', 'r') as f:
output = f.read()
- self.expect (output, "File 'output-2.txt' and the content matches", exe=False,
- startstr = "frame #0:",
- patterns = ["1.* where = .*main .* resolved, hit count = 1" ])
+ self.expect(
+ output,
+ "File 'output-2.txt' and the content matches",
+ exe=False,
+ startstr="frame #0:",
+ patterns=["1.* where = .*main .* resolved, hit count = 1"])
# Now remove 'output-2.txt'
- os.remove ('output-2.txt')
+ os.remove('output-2.txt')
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py
index 4f8ab9e115de..01af8369aaf1 100644
--- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py
@@ -5,7 +5,6 @@ Test that you can set breakpoint commands successfully with the Python API's:
from __future__ import print_function
-
import os
import re
import sys
@@ -14,6 +13,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class PythonBreakpointCommandSettingTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -23,36 +23,42 @@ class PythonBreakpointCommandSettingTestCase(TestBase):
def test_step_out_python(self):
"""Test stepping out using avoid-no-debug with dsyms."""
self.build()
- self.do_set_python_command_from_python ()
+ self.do_set_python_command_from_python()
- def setUp (self):
+ def setUp(self):
TestBase.setUp(self)
self.main_source = "main.c"
self.main_source_spec = lldb.SBFileSpec(self.main_source)
-
- def do_set_python_command_from_python (self):
+ def do_set_python_command_from_python(self):
exe = os.path.join(os.getcwd(), "a.out")
error = lldb.SBError()
self.target = self.dbg.CreateTarget(exe)
self.assertTrue(self.target, VALID_TARGET)
- body_bkpt = self.target.BreakpointCreateBySourceRegex("Set break point at this line.", self.main_source_spec)
+ body_bkpt = self.target.BreakpointCreateBySourceRegex(
+ "Set break point at this line.", self.main_source_spec)
self.assertTrue(body_bkpt, VALID_BREAKPOINT)
- func_bkpt = self.target.BreakpointCreateBySourceRegex("Set break point at this line.", self.main_source_spec)
+ func_bkpt = self.target.BreakpointCreateBySourceRegex(
+ "Set break point at this line.", self.main_source_spec)
self.assertTrue(func_bkpt, VALID_BREAKPOINT)
- # Also test that setting a source regex breakpoint with an empty file spec list sets it on all files:
- no_files_bkpt = self.target.BreakpointCreateBySourceRegex("Set a breakpoint here", lldb.SBFileSpecList(), lldb.SBFileSpecList())
+ # Also test that setting a source regex breakpoint with an empty file
+ # spec list sets it on all files:
+ no_files_bkpt = self.target.BreakpointCreateBySourceRegex(
+ "Set a breakpoint here", lldb.SBFileSpecList(), lldb.SBFileSpecList())
self.assertTrue(no_files_bkpt, VALID_BREAKPOINT)
num_locations = no_files_bkpt.GetNumLocations()
- self.assertTrue(num_locations >= 2, "Got at least two breakpoint locations")
+ self.assertTrue(
+ num_locations >= 2,
+ "Got at least two breakpoint locations")
got_one_in_A = False
got_one_in_B = False
for idx in range(0, num_locations):
- comp_unit = no_files_bkpt.GetLocationAtIndex(idx).GetAddress().GetSymbolContext(lldb.eSymbolContextCompUnit).GetCompileUnit().GetFileSpec()
+ comp_unit = no_files_bkpt.GetLocationAtIndex(idx).GetAddress().GetSymbolContext(
+ lldb.eSymbolContextCompUnit).GetCompileUnit().GetFileSpec()
print("Got comp unit: ", comp_unit.GetFilename())
if comp_unit.GetFilename() == "a.c":
got_one_in_A = True
@@ -69,28 +75,36 @@ class PythonBreakpointCommandSettingTestCase(TestBase):
import TestBreakpointCommandsFromPython\n\
TestBreakpointCommandsFromPython.PythonBreakpointCommandSettingTestCase.my_var = 20\n\
print('Hit breakpoint')")
- self.assertTrue (error.Success(), "Failed to set the script callback body: %s."%(error.GetCString()))
+ self.assertTrue(
+ error.Success(),
+ "Failed to set the script callback body: %s." %
+ (error.GetCString()))
- self.dbg.HandleCommand("command script import --allow-reload ./bktptcmd.py")
+ self.dbg.HandleCommand(
+ "command script import --allow-reload ./bktptcmd.py")
func_bkpt.SetScriptCallbackFunction("bktptcmd.function")
- # We will use the function that touches a text file, so remove it first:
+ # We will use the function that touches a text file, so remove it
+ # first:
self.RemoveTempFile("output2.txt")
# Now launch the process, and do not stop at entry point.
- self.process = self.target.LaunchSimple (None, None, self.get_process_working_directory())
+ self.process = self.target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(self.process, PROCESS_IS_VALID)
# Now finish, and make sure the return value is correct.
- threads = lldbutil.get_threads_stopped_at_breakpoint (self.process, body_bkpt)
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ self.process, body_bkpt)
self.assertTrue(len(threads) == 1, "Stopped at inner breakpoint.")
self.thread = threads[0]
-
+
self.assertTrue(PythonBreakpointCommandSettingTestCase.my_var == 20)
# Check for the function version as well, which produced this file:
# Remember to clean up after ourselves...
- self.assertTrue(os.path.isfile("output2.txt"),
- "'output2.txt' exists due to breakpoint command for breakpoint function.")
+ self.assertTrue(
+ os.path.isfile("output2.txt"),
+ "'output2.txt' exists due to breakpoint command for breakpoint function.")
self.RemoveTempFile("output2.txt")
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py
index 1ea71cbde45c..baf237bf0764 100644
--- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py
@@ -5,12 +5,13 @@ Test _regexp-break command which uses regular expression matching to dispatch to
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class RegexpBreakCommandTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -25,27 +26,47 @@ class RegexpBreakCommandTestCase(TestBase):
TestBase.setUp(self)
# Find the line number to break inside main().
self.source = 'main.c'
- self.line = line_number(self.source, '// Set break point at this line.')
+ self.line = line_number(
+ self.source, '// Set break point at this line.')
def regexp_break_command(self):
"""Test the super consie "b" command, which is analias for _regexp-break."""
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- break_results = lldbutil.run_break_set_command (self, "b %d" % self.line)
- lldbutil.check_breakpoint_result (self, break_results, file_name='main.c', line_number=self.line, num_locations=1)
+ break_results = lldbutil.run_break_set_command(
+ self, "b %d" %
+ self.line)
+ lldbutil.check_breakpoint_result(
+ self,
+ break_results,
+ file_name='main.c',
+ line_number=self.line,
+ num_locations=1)
- break_results = lldbutil.run_break_set_command (self, "b %s:%d" % (self.source, self.line))
- lldbutil.check_breakpoint_result (self, break_results, file_name='main.c', line_number=self.line, num_locations=1)
+ break_results = lldbutil.run_break_set_command(
+ self, "b %s:%d" % (self.source, self.line))
+ lldbutil.check_breakpoint_result(
+ self,
+ break_results,
+ file_name='main.c',
+ line_number=self.line,
+ num_locations=1)
# Check breakpoint with full file path.
full_path = os.path.join(os.getcwd(), self.source)
- break_results = lldbutil.run_break_set_command (self, "b %s:%d" % (full_path, self.line))
- lldbutil.check_breakpoint_result (self, break_results, file_name='main.c', line_number=self.line, num_locations=1)
+ break_results = lldbutil.run_break_set_command(
+ self, "b %s:%d" % (full_path, self.line))
+ lldbutil.check_breakpoint_result(
+ self,
+ break_results,
+ file_name='main.c',
+ line_number=self.line,
+ num_locations=1)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/bktptcmd.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/bktptcmd.py
index 4bbb0327eacd..cf1fc2cf02c9 100644
--- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/bktptcmd.py
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/bktptcmd.py
@@ -1,6 +1,7 @@
from __future__ import print_function
+
def function(frame, bp_loc, dict):
- there = open("output2.txt", "w");
- print("lldb", file=there)
- there.close()
+ there = open("output2.txt", "w")
+ print("lldb", file=there)
+ there.close()
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
index 0d34dd85dc50..3fd9b13c7119 100644
--- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
@@ -5,43 +5,57 @@ Test breakpoint conditions with 'breakpoint modify -c <expr> id'.
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class BreakpointConditionsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @skipIfWindows # Requires EE to support COFF on Windows (http://llvm.org/pr22232)
+ # Requires EE to support COFF on Windows (http://llvm.org/pr22232)
+ @skipIfWindows
def test_breakpoint_condition_and_run_command(self):
"""Exercise breakpoint condition with 'breakpoint modify -c <expr> id'."""
self.build()
self.breakpoint_conditions()
- @skipIfWindows # Requires EE to support COFF on Windows (http://llvm.org/pr22232)
+ # Requires EE to support COFF on Windows (http://llvm.org/pr22232)
+ @skipIfWindows
def test_breakpoint_condition_inline_and_run_command(self):
"""Exercise breakpoint condition inline with 'breakpoint set'."""
self.build()
self.breakpoint_conditions(inline=True)
- @skipIfWindows # Requires EE to support COFF on Windows (http://llvm.org/pr22232)
+ # Requires EE to support COFF on Windows (http://llvm.org/pr22232)
+ @skipIfWindows
@add_test_categories(['pyapi'])
def test_breakpoint_condition_and_python_api(self):
"""Use Python APIs to set breakpoint conditions."""
self.build()
self.breakpoint_conditions_python()
+ # Requires EE to support COFF on Windows (http://llvm.org/pr22232)
+ @skipIfWindows
+ @add_test_categories(['pyapi'])
+ def test_breakpoint_invalid_condition_and_python_api(self):
+ """Use Python APIs to set breakpoint conditions."""
+ self.build()
+ self.breakpoint_invalid_conditions_python()
+
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
# Find the line number to of function 'c'.
- self.line1 = line_number('main.c', '// Find the line number of function "c" here.')
- self.line2 = line_number('main.c', "// Find the line number of c's parent call here.")
+ self.line1 = line_number(
+ 'main.c', '// Find the line number of function "c" here.')
+ self.line2 = line_number(
+ 'main.c', "// Find the line number of c's parent call here.")
def breakpoint_conditions(self, inline=False):
"""Exercise breakpoint condition with 'breakpoint modify -c <expr> id'."""
@@ -50,10 +64,16 @@ class BreakpointConditionsTestCase(TestBase):
if inline:
# Create a breakpoint by function name 'c' and set the condition.
- lldbutil.run_break_set_by_symbol (self, "c", extra_options="-c 'val == 3'", num_expected_locations=1, sym_exact=True)
+ lldbutil.run_break_set_by_symbol(
+ self,
+ "c",
+ extra_options="-c 'val == 3'",
+ num_expected_locations=1,
+ sym_exact=True)
else:
# Create a breakpoint by function name 'c'.
- lldbutil.run_break_set_by_symbol (self, "c", num_expected_locations=1, sym_exact=True)
+ lldbutil.run_break_set_by_symbol(
+ self, "c", num_expected_locations=1, sym_exact=True)
# And set a condition on the breakpoint to stop on when 'val == 3'.
self.runCmd("breakpoint modify -c 'val == 3' 1")
@@ -63,67 +83,52 @@ class BreakpointConditionsTestCase(TestBase):
# The process should be stopped at this point.
self.expect("process status", PROCESS_STOPPED,
- patterns = ['Process .* stopped'])
+ patterns=['Process .* stopped'])
# 'frame variable --show-types val' should return 3 due to breakpoint condition.
- self.expect("frame variable --show-types val", VARIABLES_DISPLAYED_CORRECTLY,
- startstr = '(int) val = 3')
+ self.expect(
+ "frame variable --show-types val",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ startstr='(int) val = 3')
# Also check the hit count, which should be 3, by design.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = ["resolved = 1",
- "Condition: val == 3",
- "hit count = 1"])
+ substrs=["resolved = 1",
+ "Condition: val == 3",
+ "hit count = 1"])
# The frame #0 should correspond to main.c:36, the executable statement
- # in function name 'c'. And the parent frame should point to main.c:24.
+ # in function name 'c'. And the parent frame should point to
+ # main.c:24.
self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT_CONDITION,
- #substrs = ["stop reason = breakpoint"],
- patterns = ["frame #0.*main.c:%d" % self.line1,
- "frame #1.*main.c:%d" % self.line2])
+ #substrs = ["stop reason = breakpoint"],
+ patterns=["frame #0.*main.c:%d" % self.line1,
+ "frame #1.*main.c:%d" % self.line2])
# Test that "breakpoint modify -c ''" clears the condition for the last
# created breakpoint, so that when the breakpoint hits, val == 1.
self.runCmd("process kill")
self.runCmd("breakpoint modify -c ''")
- self.expect("breakpoint list -f", BREAKPOINT_STATE_CORRECT, matching=False,
- substrs = ["Condition:"])
+ self.expect(
+ "breakpoint list -f",
+ BREAKPOINT_STATE_CORRECT,
+ matching=False,
+ substrs=["Condition:"])
# Now run the program again.
self.runCmd("run", RUN_SUCCEEDED)
# The process should be stopped at this point.
self.expect("process status", PROCESS_STOPPED,
- patterns = ['Process .* stopped'])
+ patterns=['Process .* stopped'])
# 'frame variable --show-types val' should return 1 since it is the first breakpoint hit.
- self.expect("frame variable --show-types val", VARIABLES_DISPLAYED_CORRECTLY,
- startstr = '(int) val = 1')
+ self.expect(
+ "frame variable --show-types val",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ startstr='(int) val = 1')
self.runCmd("process kill")
- self.runCmd("breakpoint disable")
-
- self.runCmd("breakpoint set -p Loop")
- arch = self.getArchitecture()
- if arch in ['x86_64', 'i386']:
- self.runCmd("breakpoint modify -c ($eax&&i)")
- elif arch in ['aarch64']:
- self.runCmd("breakpoint modify -c ($x0&&i)")
- elif arch in ['arm']:
- self.runCmd("breakpoint modify -c ($r0&&i)")
- elif re.match("mips",arch):
- self.runCmd("breakpoint modify -c ($r2&&i)")
- elif arch in ['s390x']:
- self.runCmd("breakpoint modify -c ($r2&&i)")
- self.runCmd("run")
-
- self.expect("process status", PROCESS_STOPPED,
- patterns = ['Process .* stopped'])
-
- self.runCmd("continue")
-
- self.expect("process status", PROCESS_EXITED,
- patterns = ['Process .* exited'])
def breakpoint_conditions_python(self):
"""Use Python APIs to set breakpoint conditions."""
@@ -140,7 +145,8 @@ class BreakpointConditionsTestCase(TestBase):
breakpoint.GetNumLocations() == 1,
VALID_BREAKPOINT)
- # We didn't associate a thread index with the breakpoint, so it should be invalid.
+ # We didn't associate a thread index with the breakpoint, so it should
+ # be invalid.
self.assertTrue(breakpoint.GetThreadIndex() == lldb.UINT32_MAX,
"The thread index should be invalid")
# The thread name should be invalid, too.
@@ -149,7 +155,8 @@ class BreakpointConditionsTestCase(TestBase):
# Let's set the thread index for this breakpoint and verify that it is,
# indeed, being set correctly.
- breakpoint.SetThreadIndex(1) # There's only one thread for the process.
+ # There's only one thread for the process.
+ breakpoint.SetThreadIndex(1)
self.assertTrue(breakpoint.GetThreadIndex() == 1,
"The thread index has been set correctly")
@@ -163,16 +170,19 @@ class BreakpointConditionsTestCase(TestBase):
# Set the condition on the breakpoint location.
location.SetCondition('val == 3')
self.expect(location.GetCondition(), exe=False,
- startstr = 'val == 3')
+ startstr='val == 3')
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# Frame #0 should be on self.line1 and the break condition should hold.
from lldbsuite.test.lldbutil import get_stopped_thread
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint condition")
frame0 = thread.GetFrameAtIndex(0)
var = frame0.FindValue('val', lldb.eValueTypeVariableArgument)
self.assertTrue(frame0.GetLineEntry().GetLine() == self.line1 and
@@ -184,5 +194,44 @@ class BreakpointConditionsTestCase(TestBase):
# Test that the condition expression didn't create a result variable:
options = lldb.SBExpressionOptions()
value = frame0.EvaluateExpression("$0", options)
- self.assertTrue(value.GetError().Fail(), "Conditions should not make result variables.")
+ self.assertTrue(value.GetError().Fail(),
+ "Conditions should not make result variables.")
process.Continue()
+
+ def breakpoint_invalid_conditions_python(self):
+ """Use Python APIs to set breakpoint conditions."""
+ exe = os.path.join(os.getcwd(), "a.out")
+
+ # Create a target by the debugger.
+ target = self.dbg.CreateTarget(exe)
+ self.assertTrue(target, VALID_TARGET)
+
+ # Now create a breakpoint on main.c by name 'c'.
+ breakpoint = target.BreakpointCreateByName('c', 'a.out')
+ #print("breakpoint:", breakpoint)
+ self.assertTrue(breakpoint and
+ breakpoint.GetNumLocations() == 1,
+ VALID_BREAKPOINT)
+
+ # Set the condition on the breakpoint.
+ breakpoint.SetCondition('no_such_variable == not_this_one_either')
+ self.expect(breakpoint.GetCondition(), exe=False,
+ startstr='no_such_variable == not_this_one_either')
+
+ # Now launch the process, and do not stop at entry point.
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
+ self.assertTrue(process, PROCESS_IS_VALID)
+
+ # Frame #0 should be on self.line1 and the break condition should hold.
+ from lldbsuite.test.lldbutil import get_stopped_thread
+ thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint condition")
+ frame0 = thread.GetFrameAtIndex(0)
+ var = frame0.FindValue('val', lldb.eValueTypeVariableArgument)
+ self.assertTrue(frame0.GetLineEntry().GetLine() == self.line1)
+
+ # The hit count for the breakpoint should be 1.
+ self.assertTrue(breakpoint.GetHitCount() == 1)
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ids/TestBreakpointIDs.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ids/TestBreakpointIDs.py
index b7edf2a6e4d5..621bd4a55f06 100644
--- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ids/TestBreakpointIDs.py
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ids/TestBreakpointIDs.py
@@ -5,47 +5,56 @@ Test lldb breakpoint ids.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class BreakpointIDTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- def test (self):
+ def test(self):
self.build()
- exe = os.path.join (os.getcwd(), "a.out")
+ exe = os.path.join(os.getcwd(), "a.out")
self.expect("file " + exe,
- patterns = [ "Current executable set to .*a.out" ])
-
-
- bpno = lldbutil.run_break_set_by_symbol (self, 'product', num_expected_locations=-1, sym_exact=False)
- self.assertTrue (bpno == 1, "First breakpoint number is 1.")
-
- bpno = lldbutil.run_break_set_by_symbol (self, 'sum', num_expected_locations=-1, sym_exact=False)
- self.assertTrue (bpno == 2, "Second breakpoint number is 2.")
-
- bpno = lldbutil.run_break_set_by_symbol (self, 'junk', num_expected_locations=0, sym_exact=False)
- self.assertTrue (bpno == 3, "Third breakpoint number is 3.")
-
- self.expect ("breakpoint disable 1.1 - 2.2 ",
- COMMAND_FAILED_AS_EXPECTED, error = True,
- startstr = "error: Invalid range: Ranges that specify particular breakpoint locations must be within the same major breakpoint; you specified two different major breakpoints, 1 and 2.")
-
- self.expect ("breakpoint disable 2 - 2.2",
- COMMAND_FAILED_AS_EXPECTED, error = True,
- startstr = "error: Invalid breakpoint id range: Either both ends of range must specify a breakpoint location, or neither can specify a breakpoint location.")
-
- self.expect ("breakpoint disable 2.1 - 2",
- COMMAND_FAILED_AS_EXPECTED, error = True,
- startstr = "error: Invalid breakpoint id range: Either both ends of range must specify a breakpoint location, or neither can specify a breakpoint location.")
-
- self.expect ("breakpoint disable 2.1 - 2.2",
- startstr = "2 breakpoints disabled.")
-
- self.expect ("breakpoint enable 2.*",
- patterns = [ ".* breakpoints enabled."] )
+ patterns=["Current executable set to .*a.out"])
+
+ bpno = lldbutil.run_break_set_by_symbol(
+ self, 'product', num_expected_locations=-1, sym_exact=False)
+ self.assertTrue(bpno == 1, "First breakpoint number is 1.")
+
+ bpno = lldbutil.run_break_set_by_symbol(
+ self, 'sum', num_expected_locations=-1, sym_exact=False)
+ self.assertTrue(bpno == 2, "Second breakpoint number is 2.")
+
+ bpno = lldbutil.run_break_set_by_symbol(
+ self, 'junk', num_expected_locations=0, sym_exact=False)
+ self.assertTrue(bpno == 3, "Third breakpoint number is 3.")
+
+ self.expect(
+ "breakpoint disable 1.1 - 2.2 ",
+ COMMAND_FAILED_AS_EXPECTED,
+ error=True,
+ startstr="error: Invalid range: Ranges that specify particular breakpoint locations must be within the same major breakpoint; you specified two different major breakpoints, 1 and 2.")
+
+ self.expect(
+ "breakpoint disable 2 - 2.2",
+ COMMAND_FAILED_AS_EXPECTED,
+ error=True,
+ startstr="error: Invalid breakpoint id range: Either both ends of range must specify a breakpoint location, or neither can specify a breakpoint location.")
+
+ self.expect(
+ "breakpoint disable 2.1 - 2",
+ COMMAND_FAILED_AS_EXPECTED,
+ error=True,
+ startstr="error: Invalid breakpoint id range: Either both ends of range must specify a breakpoint location, or neither can specify a breakpoint location.")
+
+ self.expect("breakpoint disable 2.1 - 2.2",
+ startstr="2 breakpoints disabled.")
+
+ self.expect("breakpoint enable 2.*",
+ patterns=[".* breakpoints enabled."])
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py
index 05ef1c6d94c7..09e20bc5ac35 100644
--- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py
@@ -5,14 +5,15 @@ Test breakpoint ignore count features.
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class BreakpointIgnoreCountTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -32,11 +33,16 @@ class BreakpointIgnoreCountTestCase(TestBase):
# Call super's setUp().
TestBase.setUp(self)
# Find the line number to of function 'c'.
- self.line1 = line_number('main.c', '// Find the line number of function "c" here.')
- self.line2 = line_number('main.c', '// b(2) -> c(2) Find the call site of b(2).')
- self.line3 = line_number('main.c', '// a(3) -> c(3) Find the call site of c(3).')
- self.line4 = line_number('main.c', '// a(3) -> c(3) Find the call site of a(3).')
- self.line5 = line_number('main.c', '// Find the call site of c in main.')
+ self.line1 = line_number(
+ 'main.c', '// Find the line number of function "c" here.')
+ self.line2 = line_number(
+ 'main.c', '// b(2) -> c(2) Find the call site of b(2).')
+ self.line3 = line_number(
+ 'main.c', '// a(3) -> c(3) Find the call site of c(3).')
+ self.line4 = line_number(
+ 'main.c', '// a(3) -> c(3) Find the call site of a(3).')
+ self.line5 = line_number(
+ 'main.c', '// Find the call site of c in main.')
def breakpoint_ignore_count(self):
"""Exercise breakpoint ignore count with 'breakpoint set -i <count>'."""
@@ -44,26 +50,33 @@ class BreakpointIgnoreCountTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Create a breakpoint in main.c at line1.
- lldbutil.run_break_set_by_file_and_line (self, 'main.c', self.line1, extra_options='-i 1', num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self,
+ 'main.c',
+ self.line1,
+ extra_options='-i 1',
+ num_expected_locations=1,
+ loc_exact=True)
# Now run the program.
self.runCmd("run", RUN_SUCCEEDED)
# The process should be stopped at this point.
self.expect("process status", PROCESS_STOPPED,
- patterns = ['Process .* stopped'])
+ patterns=['Process .* stopped'])
- # Also check the hit count, which should be 2, due to ignore count of 1.
+ # Also check the hit count, which should be 2, due to ignore count of
+ # 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_THRICE,
- substrs = ["resolved = 1",
- "hit count = 2"])
+ substrs=["resolved = 1",
+ "hit count = 2"])
# The frame #0 should correspond to main.c:37, the executable statement
# in function name 'c'. And frame #2 should point to main.c:45.
self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT_IGNORE_COUNT,
- #substrs = ["stop reason = breakpoint"],
- patterns = ["frame #0.*main.c:%d" % self.line1,
- "frame #2.*main.c:%d" % self.line2])
+ #substrs = ["stop reason = breakpoint"],
+ patterns=["frame #0.*main.c:%d" % self.line1,
+ "frame #2.*main.c:%d" % self.line2])
# continue -i 1 is the same as setting the ignore count to 1 again, try that:
# Now run the program.
@@ -71,21 +84,20 @@ class BreakpointIgnoreCountTestCase(TestBase):
# The process should be stopped at this point.
self.expect("process status", PROCESS_STOPPED,
- patterns = ['Process .* stopped'])
+ patterns=['Process .* stopped'])
- # Also check the hit count, which should be 2, due to ignore count of 1.
+ # Also check the hit count, which should be 2, due to ignore count of
+ # 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_THRICE,
- substrs = ["resolved = 1",
- "hit count = 4"])
+ substrs=["resolved = 1",
+ "hit count = 4"])
# The frame #0 should correspond to main.c:37, the executable statement
# in function name 'c'. And frame #2 should point to main.c:45.
self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT_IGNORE_COUNT,
- #substrs = ["stop reason = breakpoint"],
- patterns = ["frame #0.*main.c:%d" % self.line1,
- "frame #1.*main.c:%d" % self.line5])
-
-
+ #substrs = ["stop reason = breakpoint"],
+ patterns=["frame #0.*main.c:%d" % self.line1,
+ "frame #1.*main.c:%d" % self.line5])
def breakpoint_ignore_count_python(self):
"""Use Python APIs to set breakpoint ignore count."""
@@ -114,15 +126,18 @@ class BreakpointIgnoreCountTestCase(TestBase):
"SetIgnoreCount() works correctly")
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# Frame#0 should be on main.c:37, frame#1 should be on main.c:25, and
# frame#2 should be on main.c:48.
- #lldbutil.print_stacktraces(process)
+ # lldbutil.print_stacktraces(process)
from lldbsuite.test.lldbutil import get_stopped_thread
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint")
frame0 = thread.GetFrameAtIndex(0)
frame1 = thread.GetFrameAtIndex(1)
frame2 = thread.GetFrameAtIndex(2)
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py
index b1e0d3deeae7..255b6f7fa292 100644
--- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py
@@ -1,10 +1,11 @@
"""
-Test specific to MIPS
+Test specific to MIPS
"""
from __future__ import print_function
-import os, time
+import os
+import time
import re
import unittest2
import lldb
@@ -12,6 +13,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class AvoidBreakpointInDelaySlotAPITestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -21,8 +23,8 @@ class AvoidBreakpointInDelaySlotAPITestCase(TestBase):
self.build()
exe = os.path.join(os.getcwd(), "a.out")
self.expect("file " + exe,
- patterns = [ "Current executable set to .*a.out.*" ])
-
+ patterns=["Current executable set to .*a.out.*"])
+
# Create a target by the debugger.
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
@@ -33,7 +35,8 @@ class AvoidBreakpointInDelaySlotAPITestCase(TestBase):
VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
list = target.FindFunctions('foo', lldb.eFunctionNameTypeAuto)
@@ -44,7 +47,7 @@ class AvoidBreakpointInDelaySlotAPITestCase(TestBase):
self.assertTrue(function)
self.function(function, target)
- def function (self, function, target):
+ def function(self, function, target):
"""Iterate over instructions in function and place a breakpoint on delay slot instruction"""
# Get the list of all instructions in the function
insts = function.GetInstructions(target)
@@ -56,7 +59,7 @@ class AvoidBreakpointInDelaySlotAPITestCase(TestBase):
branchinstaddress = inst.GetAddress().GetLoadAddress(target)
# Get next instruction i.e delay slot instruction.
- delayinst = insts.GetInstructionAtIndex(i+1)
+ delayinst = insts.GetInstructionAtIndex(i + 1)
delayinstaddr = delayinst.GetAddress().GetLoadAddress(target)
# Set breakpoint on delay slot instruction
@@ -71,9 +74,10 @@ class AvoidBreakpointInDelaySlotAPITestCase(TestBase):
# Get the address where breakpoint is actually set.
bpaddr = location.GetLoadAddress()
-
- # Breakpoint address should be adjusted to the address of branch instruction.
- self.assertTrue(branchinstaddress == bpaddr)
+
+ # Breakpoint address should be adjusted to the address of
+ # branch instruction.
+ self.assertTrue(branchinstaddress == bpaddr)
i += 1
else:
i += 1
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_language/TestBreakpointLanguage.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_language/TestBreakpointLanguage.py
index 94fc7bf79f63..214c110afcd6 100644
--- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_language/TestBreakpointLanguage.py
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_language/TestBreakpointLanguage.py
@@ -6,14 +6,15 @@ parser.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
import shutil
import subprocess
+
class TestBreakpointLanguage(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -23,7 +24,7 @@ class TestBreakpointLanguage(TestBase):
TestBase.setUp(self)
# Find the line number to break inside main().
- def check_location_file (self, bp, loc, test_name):
+ def check_location_file(self, bp, loc, test_name):
bp_loc = bp.GetLocationAtIndex(loc)
addr = bp_loc.GetAddress()
comp_unit = addr.GetCompileUnit()
@@ -37,22 +38,40 @@ class TestBreakpointLanguage(TestBase):
# Create a target by the debugger.
exe = os.path.join(os.getcwd(), "a.out")
error = lldb.SBError()
- # Don't read in dependencies so we don't come across false matches that
+ # Don't read in dependencies so we don't come across false matches that
# add unwanted breakpoint hits.
self.target = self.dbg.CreateTarget(exe, None, None, False, error)
self.assertTrue(self.target, VALID_TARGET)
- cpp_bp = self.target.BreakpointCreateByRegex("func_from", lldb.eLanguageTypeC_plus_plus, lldb.SBFileSpecList(), lldb.SBFileSpecList())
- self.assertTrue(cpp_bp.GetNumLocations() == 1, "Only one C++ symbol matches")
+ cpp_bp = self.target.BreakpointCreateByRegex(
+ "func_from",
+ lldb.eLanguageTypeC_plus_plus,
+ lldb.SBFileSpecList(),
+ lldb.SBFileSpecList())
+ self.assertTrue(
+ cpp_bp.GetNumLocations() == 1,
+ "Only one C++ symbol matches")
self.assertTrue(self.check_location_file(cpp_bp, 0, "b.cpp"))
- c_bp = self.target.BreakpointCreateByRegex("func_from", lldb.eLanguageTypeC, lldb.SBFileSpecList(), lldb.SBFileSpecList())
- self.assertTrue(c_bp.GetNumLocations() == 1, "Only one C symbol matches")
+ c_bp = self.target.BreakpointCreateByRegex(
+ "func_from",
+ lldb.eLanguageTypeC,
+ lldb.SBFileSpecList(),
+ lldb.SBFileSpecList())
+ self.assertTrue(
+ c_bp.GetNumLocations() == 1,
+ "Only one C symbol matches")
self.assertTrue(self.check_location_file(c_bp, 0, "a.c"))
-
- objc_bp = self.target.BreakpointCreateByRegex("func_from", lldb.eLanguageTypeObjC, lldb.SBFileSpecList(), lldb.SBFileSpecList())
- self.assertTrue(objc_bp.GetNumLocations() == 0, "No ObjC symbol matches")
-
+
+ objc_bp = self.target.BreakpointCreateByRegex(
+ "func_from",
+ lldb.eLanguageTypeObjC,
+ lldb.SBFileSpecList(),
+ lldb.SBFileSpecList())
+ self.assertTrue(
+ objc_bp.GetNumLocations() == 0,
+ "No ObjC symbol matches")
+
def test_by_name_breakpoint_language(self):
"""Test that the name regex breakpoint commands obey the language filter."""
@@ -60,26 +79,59 @@ class TestBreakpointLanguage(TestBase):
# Create a target by the debugger.
exe = os.path.join(os.getcwd(), "a.out")
error = lldb.SBError()
- # Don't read in dependencies so we don't come across false matches that
+ # Don't read in dependencies so we don't come across false matches that
# add unwanted breakpoint hits.
self.target = self.dbg.CreateTarget(exe, None, None, False, error)
self.assertTrue(self.target, VALID_TARGET)
- cpp_bp = self.target.BreakpointCreateByName("func_from_cpp", lldb.eFunctionNameTypeAuto, lldb.eLanguageTypeC_plus_plus, lldb.SBFileSpecList(), lldb.SBFileSpecList())
- self.assertTrue(cpp_bp.GetNumLocations() == 1, "Only one C++ symbol matches")
+ cpp_bp = self.target.BreakpointCreateByName(
+ "func_from_cpp",
+ lldb.eFunctionNameTypeAuto,
+ lldb.eLanguageTypeC_plus_plus,
+ lldb.SBFileSpecList(),
+ lldb.SBFileSpecList())
+ self.assertTrue(
+ cpp_bp.GetNumLocations() == 1,
+ "Only one C++ symbol matches")
self.assertTrue(self.check_location_file(cpp_bp, 0, "b.cpp"))
- no_cpp_bp = self.target.BreakpointCreateByName("func_from_c", lldb.eFunctionNameTypeAuto, lldb.eLanguageTypeC_plus_plus, lldb.SBFileSpecList(), lldb.SBFileSpecList())
- self.assertTrue(no_cpp_bp.GetNumLocations() == 0, "And the C one doesn't match")
-
- c_bp = self.target.BreakpointCreateByName("func_from_c", lldb.eFunctionNameTypeAuto, lldb.eLanguageTypeC, lldb.SBFileSpecList(), lldb.SBFileSpecList())
- self.assertTrue(c_bp.GetNumLocations() == 1, "Only one C symbol matches")
+ no_cpp_bp = self.target.BreakpointCreateByName(
+ "func_from_c",
+ lldb.eFunctionNameTypeAuto,
+ lldb.eLanguageTypeC_plus_plus,
+ lldb.SBFileSpecList(),
+ lldb.SBFileSpecList())
+ self.assertTrue(
+ no_cpp_bp.GetNumLocations() == 0,
+ "And the C one doesn't match")
+
+ c_bp = self.target.BreakpointCreateByName(
+ "func_from_c",
+ lldb.eFunctionNameTypeAuto,
+ lldb.eLanguageTypeC,
+ lldb.SBFileSpecList(),
+ lldb.SBFileSpecList())
+ self.assertTrue(
+ c_bp.GetNumLocations() == 1,
+ "Only one C symbol matches")
self.assertTrue(self.check_location_file(c_bp, 0, "a.c"))
-
- no_c_bp = self.target.BreakpointCreateByName("func_from_cpp", lldb.eFunctionNameTypeAuto, lldb.eLanguageTypeC, lldb.SBFileSpecList(), lldb.SBFileSpecList())
- self.assertTrue(no_c_bp.GetNumLocations() == 0, "And the C++ one doesn't match")
-
- objc_bp = self.target.BreakpointCreateByName("func_from_cpp", lldb.eFunctionNameTypeAuto, lldb.eLanguageTypeObjC, lldb.SBFileSpecList(), lldb.SBFileSpecList())
- self.assertTrue(objc_bp.GetNumLocations() == 0, "No ObjC symbol matches")
-
+ no_c_bp = self.target.BreakpointCreateByName(
+ "func_from_cpp",
+ lldb.eFunctionNameTypeAuto,
+ lldb.eLanguageTypeC,
+ lldb.SBFileSpecList(),
+ lldb.SBFileSpecList())
+ self.assertTrue(
+ no_c_bp.GetNumLocations() == 0,
+ "And the C++ one doesn't match")
+
+ objc_bp = self.target.BreakpointCreateByName(
+ "func_from_cpp",
+ lldb.eFunctionNameTypeAuto,
+ lldb.eLanguageTypeObjC,
+ lldb.SBFileSpecList(),
+ lldb.SBFileSpecList())
+ self.assertTrue(
+ objc_bp.GetNumLocations() == 0,
+ "No ObjC symbol matches")
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
index 707b6502e91c..fdbd622f767b 100644
--- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
@@ -5,13 +5,14 @@ Test breakpoint commands for a breakpoint ID with multiple locations.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class BreakpointLocationsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -34,55 +35,72 @@ class BreakpointLocationsTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# This should create a breakpoint with 3 locations.
- lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=3)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", self.line, num_expected_locations=3)
# The breakpoint list should show 3 locations.
- self.expect("breakpoint list -f", "Breakpoint locations shown correctly",
- substrs = ["1: file = 'main.c', line = %d, exact_match = 0, locations = 3" % self.line],
- patterns = ["where = a.out`func_inlined .+unresolved, hit count = 0",
- "where = a.out`main .+\[inlined\].+unresolved, hit count = 0"])
+ self.expect(
+ "breakpoint list -f",
+ "Breakpoint locations shown correctly",
+ substrs=[
+ "1: file = 'main.c', line = %d, exact_match = 0, locations = 3" %
+ self.line],
+ patterns=[
+ "where = a.out`func_inlined .+unresolved, hit count = 0",
+ "where = a.out`main .+\[inlined\].+unresolved, hit count = 0"])
# The 'breakpoint disable 3.*' command should fail gracefully.
self.expect("breakpoint disable 3.*",
"Disabling an invalid breakpoint should fail gracefully",
error=True,
- startstr = "error: '3' is not a valid breakpoint ID.")
+ startstr="error: '3' is not a valid breakpoint ID.")
# The 'breakpoint disable 1.*' command should disable all 3 locations.
- self.expect("breakpoint disable 1.*", "All 3 breakpoint locatons disabled correctly",
- startstr = "3 breakpoints disabled.")
+ self.expect(
+ "breakpoint disable 1.*",
+ "All 3 breakpoint locatons disabled correctly",
+ startstr="3 breakpoints disabled.")
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
# We should not stopped on any breakpoint at all.
self.expect("process status", "No stopping on any disabled breakpoint",
- patterns = ["^Process [0-9]+ exited with status = 0"])
+ patterns=["^Process [0-9]+ exited with status = 0"])
# The 'breakpoint enable 1.*' command should enable all 3 breakpoints.
- self.expect("breakpoint enable 1.*", "All 3 breakpoint locatons enabled correctly",
- startstr = "3 breakpoints enabled.")
+ self.expect(
+ "breakpoint enable 1.*",
+ "All 3 breakpoint locatons enabled correctly",
+ startstr="3 breakpoints enabled.")
# The 'breakpoint disable 1.1' command should disable 1 location.
- self.expect("breakpoint disable 1.1", "1 breakpoint locatons disabled correctly",
- startstr = "1 breakpoints disabled.")
+ self.expect(
+ "breakpoint disable 1.1",
+ "1 breakpoint locatons disabled correctly",
+ startstr="1 breakpoints disabled.")
- # Run the program againt. We should stop on the two breakpoint locations.
+ # Run the program againt. We should stop on the two breakpoint
+ # locations.
self.runCmd("run", RUN_SUCCEEDED)
# Stopped once.
self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ["stop reason = breakpoint 1."])
+ substrs=["stop reason = breakpoint 1."])
# Continue the program, there should be another stop.
self.runCmd("process continue")
# Stopped again.
self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ["stop reason = breakpoint 1."])
-
- # At this point, 1.1 has a hit count of 0 and the other a hit count of 1".
- self.expect("breakpoint list -f", "The breakpoints should report correct hit counts",
- patterns = ["1\.1: .+ unresolved, hit count = 0 +Options: disabled",
- "1\.2: .+ resolved, hit count = 1",
- "1\.3: .+ resolved, hit count = 1"])
+ substrs=["stop reason = breakpoint 1."])
+
+ # At this point, 1.1 has a hit count of 0 and the other a hit count of
+ # 1".
+ self.expect(
+ "breakpoint list -f",
+ "The breakpoints should report correct hit counts",
+ patterns=[
+ "1\.1: .+ unresolved, hit count = 0 +Options: disabled",
+ "1\.2: .+ resolved, hit count = 1",
+ "1\.3: .+ resolved, hit count = 1"])
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/Makefile
new file mode 100644
index 000000000000..b09a579159d4
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+C_SOURCES := main.c
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py
new file mode 100644
index 000000000000..cc31ef80e8a3
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py
@@ -0,0 +1,141 @@
+"""
+Test breakpoint names.
+"""
+
+from __future__ import print_function
+
+
+import os
+import time
+import re
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class BreakpointNames(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ @add_test_categories(['pyapi'])
+ def test_setting_names(self):
+ """Use Python APIs to test that we can set breakpoint names."""
+ self.build()
+ self.setup_target()
+ self.do_check_names()
+
+ def test_illegal_names(self):
+ """Use Python APIs to test that we don't allow illegal names."""
+ self.build()
+ self.setup_target()
+ self.do_check_illegal_names()
+
+ def test_using_names(self):
+ """Use Python APIs to test that operations on names works correctly."""
+ self.build()
+ self.setup_target()
+ self.do_check_using_names()
+
+ def setup_target(self):
+ exe = os.path.join(os.getcwd(), "a.out")
+
+ # Create a targets we are making breakpoint in and copying to:
+ self.target = self.dbg.CreateTarget(exe)
+ self.assertTrue(self.target, VALID_TARGET)
+ self.main_file_spec = lldb.SBFileSpec(os.path.join(os.getcwd(), "main.c"))
+
+ def setUp(self):
+ # Call super's setUp().
+ TestBase.setUp(self)
+
+ def do_check_names(self):
+ """Use Python APIs to check that we can set & retrieve breakpoint names"""
+ bkpt = self.target.BreakpointCreateByLocation(self.main_file_spec, 10)
+ bkpt_name = "ABreakpoint"
+ other_bkpt_name = "_AnotherBreakpoint"
+
+ # Add a name and make sure we match it:
+ success = bkpt.AddName(bkpt_name)
+ self.assertTrue(success, "We couldn't add a legal name to a breakpoint.")
+
+ matches = bkpt.MatchesName(bkpt_name)
+ self.assertTrue(matches, "We didn't match the name we just set")
+
+ # Make sure we don't match irrelevant names:
+ matches = bkpt.MatchesName("NotABreakpoint")
+ self.assertTrue(not matches, "We matched a name we didn't set.")
+
+ # Add another name, make sure that works too:
+ bkpt.AddName(other_bkpt_name)
+
+ matches = bkpt.MatchesName(bkpt_name)
+ self.assertTrue(matches, "Adding a name means we didn't match the name we just set")
+
+ # Remove the name and make sure we no longer match it:
+ bkpt.RemoveName(bkpt_name)
+ matches = bkpt.MatchesName(bkpt_name)
+ self.assertTrue(not matches,"We still match a name after removing it.")
+
+ # Make sure the name list has the remaining name:
+ name_list = lldb.SBStringList()
+ bkpt.GetNames(name_list)
+ num_names = name_list.GetSize()
+ self.assertTrue(num_names == 1, "Name list has %d items, expected 1."%(num_names))
+
+ name = name_list.GetStringAtIndex(0)
+ self.assertTrue(name == other_bkpt_name, "Remaining name was: %s expected %s."%(name, other_bkpt_name))
+
+ def do_check_illegal_names(self):
+ """Use Python APIs to check that we reject illegal names."""
+ bkpt = self.target.BreakpointCreateByLocation(self.main_file_spec, 10)
+ success = bkpt.AddName("-CantStartWithADash")
+ self.assertTrue(not success,"We allowed a name starting with a dash.")
+
+ success = bkpt.AddName("1CantStartWithANumber")
+ self.assertTrue(not success, "We allowed a name starting with a number.")
+
+ success = bkpt.AddName("^CantStartWithNonAlpha")
+ self.assertTrue(not success, "We allowed a name starting with an ^.")
+
+ success = bkpt.AddName("CantHave-ADash")
+ self.assertTrue(not success, "We allowed a name with a dash in it.")
+
+ success = bkpt.AddName("Cant Have Spaces")
+ self.assertTrue(not success, "We allowed a name with spaces.")
+
+ # Check from the command line as well:
+ retval =lldb.SBCommandReturnObject()
+ self.dbg.GetCommandInterpreter().HandleCommand("break set -n whatever -N has-dashes", retval)
+ self.assertTrue(not retval.Succeeded(), "break set succeeded with: illegal name")
+
+ def do_check_using_names(self):
+ """Use Python APIs to check names work in place of breakpoint ID's."""
+
+ bkpt = self.target.BreakpointCreateByLocation(self.main_file_spec, 10)
+ bkpt_name = "ABreakpoint"
+ other_bkpt_name= "_AnotherBreakpoint"
+
+ # Add a name and make sure we match it:
+ success = bkpt.AddName(bkpt_name)
+ self.assertTrue(success, "We couldn't add a legal name to a breakpoint.")
+
+ bkpts = lldb.SBBreakpointList(self.target)
+ self.target.FindBreakpointsByName(bkpt_name, bkpts)
+
+ self.assertTrue(bkpts.GetSize() == 1, "One breakpoint matched.")
+ found_bkpt = bkpts.GetBreakpointAtIndex(0)
+ self.assertTrue(bkpt.GetID() == found_bkpt.GetID(),"The right breakpoint.")
+
+ retval = lldb.SBCommandReturnObject()
+ self.dbg.GetCommandInterpreter().HandleCommand("break disable %s"%(bkpt_name), retval)
+ self.assertTrue(retval.Succeeded(), "break disable failed with: %s."%(retval.GetError()))
+ self.assertTrue(not bkpt.IsEnabled(), "We didn't disable the breakpoint.")
+
+ # Also make sure we don't apply commands to non-matching names:
+ self.dbg.GetCommandInterpreter().HandleCommand("break modify --one-shot 1 %s"%(bkpt_name), retval)
+ self.assertTrue(retval.Succeeded(), "break modify failed with: %s."%(retval.GetError()))
+ self.assertTrue(not bkpt.IsOneShot(), "We applied one-shot to the wrong breakpoint.")
+
+
+
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/main.c b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/main.c
new file mode 100644
index 000000000000..b74b37b48b08
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/main.c
@@ -0,0 +1,54 @@
+//===-- main.c --------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+#include <stdio.h>
+
+// This simple program is to demonstrate the capability of the lldb command
+// "breakpoint modify -i <count> breakpt-id" to set the number of times a
+// breakpoint is skipped before stopping. Ignore count can also be set upon
+// breakpoint creation by 'breakpoint set ... -i <count>'.
+
+int a(int);
+int b(int);
+int c(int);
+
+int a(int val)
+{
+ if (val <= 1)
+ return b(val);
+ else if (val >= 3)
+ return c(val); // a(3) -> c(3) Find the call site of c(3).
+
+ return val;
+}
+
+int b(int val)
+{
+ return c(val);
+}
+
+int c(int val)
+{
+ return val + 3; // Find the line number of function "c" here.
+}
+
+int main (int argc, char const *argv[])
+{
+ int A1 = a(1); // a(1) -> b(1) -> c(1)
+ printf("a(1) returns %d\n", A1);
+
+ int B2 = b(2); // b(2) -> c(2) Find the call site of b(2).
+ printf("b(2) returns %d\n", B2);
+
+ int A3 = a(3); // a(3) -> c(3) Find the call site of a(3).
+ printf("a(3) returns %d\n", A3);
+
+ int C1 = c(5); // Find the call site of c in main.
+ printf ("c(5) returns %d\n", C1);
+ return 0;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py
index 29afec202339..c0c2267a8362 100644
--- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py
@@ -5,12 +5,12 @@ Test breakpoint command for different options.
from __future__ import print_function
-
import os
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class BreakpointOptionsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -32,38 +32,59 @@ class BreakpointOptionsTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# This should create a breakpoint with 1 locations.
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, extra_options = "-K 1", num_expected_locations = 1)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, extra_options = "-K 0", num_expected_locations = 1)
+ lldbutil.run_break_set_by_file_and_line(
+ self,
+ "main.cpp",
+ self.line,
+ extra_options="-K 1",
+ num_expected_locations=1)
+ lldbutil.run_break_set_by_file_and_line(
+ self,
+ "main.cpp",
+ self.line,
+ extra_options="-K 0",
+ num_expected_locations=1)
# This should create a breakpoint 0 locations.
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, extra_options = "-m 0", num_expected_locations = 0)
+ lldbutil.run_break_set_by_file_and_line(
+ self,
+ "main.cpp",
+ self.line,
+ extra_options="-m 0",
+ num_expected_locations=0)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
# Stopped once.
self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ["stop reason = breakpoint 2."])
+ substrs=["stop reason = breakpoint 2."])
# Check the list of breakpoint.
- self.expect("breakpoint list -f", "Breakpoint locations shown correctly",
- substrs = ["1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % self.line,
- "2: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % self.line,
- "3: file = 'main.cpp', line = %d, exact_match = 1, locations = 0" % self.line])
+ self.expect(
+ "breakpoint list -f",
+ "Breakpoint locations shown correctly",
+ substrs=[
+ "1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" %
+ self.line,
+ "2: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" %
+ self.line,
+ "3: file = 'main.cpp', line = %d, exact_match = 1, locations = 0" %
+ self.line])
# Continue the program, there should be another stop.
self.runCmd("process continue")
# Stopped again.
self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ["stop reason = breakpoint 1."])
+ substrs=["stop reason = breakpoint 1."])
# Continue the program, we should exit.
self.runCmd("process continue")
# We should exit.
self.expect("process status", "Process exited successfully",
- patterns = ["^Process [0-9]+ exited with status = 0"])
+ patterns=["^Process [0-9]+ exited with status = 0"])
def breakpoint_options_language_test(self):
"""Test breakpoint command for language option."""
@@ -71,23 +92,34 @@ class BreakpointOptionsTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# This should create a breakpoint with 1 locations.
- lldbutil.run_break_set_by_symbol (self, 'ns::func', sym_exact=False, extra_options = "-L c++", num_expected_locations=1)
+ lldbutil.run_break_set_by_symbol(
+ self,
+ 'ns::func',
+ sym_exact=False,
+ extra_options="-L c++",
+ num_expected_locations=1)
# This should create a breakpoint with 0 locations.
- lldbutil.run_break_set_by_symbol (self, 'ns::func', sym_exact=False, extra_options = "-L c", num_expected_locations=0)
+ lldbutil.run_break_set_by_symbol(
+ self,
+ 'ns::func',
+ sym_exact=False,
+ extra_options="-L c",
+ num_expected_locations=0)
self.runCmd("settings set target.language c")
- lldbutil.run_break_set_by_symbol (self, 'ns::func', sym_exact=False, num_expected_locations=0)
+ lldbutil.run_break_set_by_symbol(
+ self, 'ns::func', sym_exact=False, num_expected_locations=0)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
# Stopped once.
self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ["stop reason = breakpoint 1."])
+ substrs=["stop reason = breakpoint 1."])
# Continue the program, we should exit.
self.runCmd("process continue")
# We should exit.
self.expect("process status", "Process exited successfully",
- patterns = ["^Process [0-9]+ exited with status = 0"])
+ patterns=["^Process [0-9]+ exited with status = 0"])
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py
index 4ca93765b656..2410f2ee82b3 100644
--- a/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py
@@ -6,6 +6,7 @@ import os
import lldb
from lldbsuite.test.lldbtest import *
+
class BreakpointSetRestart(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -16,12 +17,13 @@ class BreakpointSetRestart(TestBase):
cwd = os.getcwd()
exe = os.path.join(cwd, 'a.out')
-
+
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
self.dbg.SetAsync(True)
- process = target.LaunchSimple(None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
event = lldb.SBEvent()
@@ -29,15 +31,22 @@ class BreakpointSetRestart(TestBase):
while self.dbg.GetListener().WaitForEvent(2, event):
if lldb.SBProcess.GetStateFromEvent(event) == lldb.eStateRunning:
break
-
- bp = target.BreakpointCreateBySourceRegex(self.BREAKPOINT_TEXT,
- lldb.SBFileSpec(os.path.join(cwd, 'main.cpp')))
- self.assertTrue(bp.IsValid() and bp.GetNumLocations() == 1, VALID_BREAKPOINT)
+
+ bp = target.BreakpointCreateBySourceRegex(
+ self.BREAKPOINT_TEXT, lldb.SBFileSpec(
+ os.path.join(
+ cwd, 'main.cpp')))
+ self.assertTrue(
+ bp.IsValid() and bp.GetNumLocations() == 1,
+ VALID_BREAKPOINT)
while self.dbg.GetListener().WaitForEvent(2, event):
- if lldb.SBProcess.GetStateFromEvent(event) == lldb.eStateStopped and lldb.SBProcess.GetRestartedFromEvent(event):
+ if lldb.SBProcess.GetStateFromEvent(
+ event) == lldb.eStateStopped and lldb.SBProcess.GetRestartedFromEvent(event):
continue
if lldb.SBProcess.GetStateFromEvent(event) == lldb.eStateRunning:
continue
- self.fail("Setting a breakpoint generated an unexpected event: %s" % lldb.SBDebugger.StateAsCString(lldb.SBProcess.GetStateFromEvent(event)))
-
+ self.fail(
+ "Setting a breakpoint generated an unexpected event: %s" %
+ lldb.SBDebugger.StateAsCString(
+ lldb.SBProcess.GetStateFromEvent(event)))
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py
index 4933d6d01d44..e4672fbbf1ba 100644
--- a/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py
@@ -4,7 +4,6 @@ Test breakpoint command with AT_comp_dir set to symbolic link.
from __future__ import print_function
-
import os
import shutil
import lldb
@@ -17,6 +16,7 @@ _EXE_NAME = 'CompDirSymLink' # Must match Makefile
_SRC_FILE = 'main.cpp'
_COMP_DIR_SYM_LINK_PROP = 'plugin.symbol-file.dwarf.comp-dir-symlink-paths'
+
class CompDirSymLinkTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -32,14 +32,18 @@ class CompDirSymLinkTestCase(TestBase):
def test_symlink_paths_set(self):
pwd_symlink = self.create_src_symlink()
self.doBuild(pwd_symlink)
- self.runCmd("settings set %s %s" % (_COMP_DIR_SYM_LINK_PROP, pwd_symlink))
+ self.runCmd(
+ "settings set %s %s" %
+ (_COMP_DIR_SYM_LINK_PROP, pwd_symlink))
lldbutil.run_break_set_by_file_and_line(self, self.src_path, self.line)
@skipIf(hostoslist=no_match(["linux"]))
def test_symlink_paths_set_procselfcwd(self):
pwd_symlink = '/proc/self/cwd'
self.doBuild(pwd_symlink)
- self.runCmd("settings set %s %s" % (_COMP_DIR_SYM_LINK_PROP, pwd_symlink))
+ self.runCmd(
+ "settings set %s %s" %
+ (_COMP_DIR_SYM_LINK_PROP, pwd_symlink))
lldbutil.run_break_set_by_file_and_line(self, self.src_path, self.line)
@skipIf(hostoslist=["windows"])
@@ -47,12 +51,17 @@ class CompDirSymLinkTestCase(TestBase):
pwd_symlink = self.create_src_symlink()
self.doBuild(pwd_symlink)
self.runCmd('settings clear ' + _COMP_DIR_SYM_LINK_PROP)
- self.assertRaises(AssertionError, lldbutil.run_break_set_by_file_and_line, self, self.src_path, self.line)
+ self.assertRaises(
+ AssertionError,
+ lldbutil.run_break_set_by_file_and_line,
+ self,
+ self.src_path,
+ self.line)
def create_src_symlink(self):
pwd_symlink = os.path.join(os.getcwd(), 'pwd_symlink')
if os.path.exists(pwd_symlink):
- os.unlink(pwd_symlink)
+ os.unlink(pwd_symlink)
os.symlink(os.getcwd(), pwd_symlink)
self.addTearDownHook(lambda: os.remove(pwd_symlink))
return pwd_symlink
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py
index 472479391c02..312f2944102e 100644
--- a/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py
@@ -5,35 +5,42 @@ Test that we handle breakpoints on consecutive instructions correctly.
from __future__ import print_function
-
import unittest2
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ConsecutiveBreakpointsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
def prepare_test(self):
self.build()
- exe = os.path.join (os.getcwd(), "a.out")
+ exe = os.path.join(os.getcwd(), "a.out")
# Create a target by the debugger.
self.target = self.dbg.CreateTarget(exe)
self.assertTrue(self.target, VALID_TARGET)
- breakpoint1 = self.target.BreakpointCreateBySourceRegex("Set breakpoint here", lldb.SBFileSpec("main.cpp"))
- self.assertTrue(breakpoint1 and breakpoint1.GetNumLocations() == 1, VALID_BREAKPOINT)
+ breakpoint1 = self.target.BreakpointCreateBySourceRegex(
+ "Set breakpoint here", lldb.SBFileSpec("main.cpp"))
+ self.assertTrue(
+ breakpoint1 and breakpoint1.GetNumLocations() == 1,
+ VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- self.process = self.target.LaunchSimple (None, None, self.get_process_working_directory())
+ self.process = self.target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertIsNotNone(self.process, PROCESS_IS_VALID)
# We should be stopped at the first breakpoint
- self.thread = lldbutil.get_one_thread_stopped_at_breakpoint(self.process, breakpoint1)
- self.assertIsNotNone(self.thread, "Expected one thread to be stopped at breakpoint 1")
+ self.thread = lldbutil.get_one_thread_stopped_at_breakpoint(
+ self.process, breakpoint1)
+ self.assertIsNotNone(
+ self.thread,
+ "Expected one thread to be stopped at breakpoint 1")
# Set breakpoint to the next instruction
frame = self.thread.GetFrameAtIndex(0)
@@ -42,8 +49,11 @@ class ConsecutiveBreakpointsTestCase(TestBase):
instructions = self.target.ReadInstructions(address, 2)
self.assertTrue(len(instructions) == 2)
self.bkpt_address = instructions[1].GetAddress()
- self.breakpoint2 = self.target.BreakpointCreateByAddress(self.bkpt_address.GetLoadAddress(self.target))
- self.assertTrue(self.breakpoint2 and self.breakpoint2.GetNumLocations() == 1, VALID_BREAKPOINT)
+ self.breakpoint2 = self.target.BreakpointCreateByAddress(
+ self.bkpt_address.GetLoadAddress(self.target))
+ self.assertTrue(
+ self.breakpoint2 and self.breakpoint2.GetNumLocations() == 1,
+ VALID_BREAKPOINT)
def finish_test(self):
# Run the process until termination
@@ -58,8 +68,11 @@ class ConsecutiveBreakpointsTestCase(TestBase):
self.process.Continue()
self.assertEquals(self.process.GetState(), lldb.eStateStopped)
# We should be stopped at the second breakpoint
- self.thread = lldbutil.get_one_thread_stopped_at_breakpoint(self.process, self.breakpoint2)
- self.assertIsNotNone(self.thread, "Expected one thread to be stopped at breakpoint 2")
+ self.thread = lldbutil.get_one_thread_stopped_at_breakpoint(
+ self.process, self.breakpoint2)
+ self.assertIsNotNone(
+ self.thread,
+ "Expected one thread to be stopped at breakpoint 2")
self.finish_test()
@@ -72,10 +85,15 @@ class ConsecutiveBreakpointsTestCase(TestBase):
self.thread.StepInstruction(step_over)
self.assertEquals(self.process.GetState(), lldb.eStateStopped)
- self.assertEquals(self.thread.GetFrameAtIndex(0).GetPCAddress().GetLoadAddress(self.target),
- self.bkpt_address.GetLoadAddress(self.target))
- self.thread = lldbutil.get_one_thread_stopped_at_breakpoint(self.process, self.breakpoint2)
- self.assertIsNotNone(self.thread, "Expected one thread to be stopped at breakpoint 2")
+ self.assertEquals(
+ self.thread.GetFrameAtIndex(0).GetPCAddress().GetLoadAddress(
+ self.target), self.bkpt_address.GetLoadAddress(
+ self.target))
+ self.thread = lldbutil.get_one_thread_stopped_at_breakpoint(
+ self.process, self.breakpoint2)
+ self.assertIsNotNone(
+ self.thread,
+ "Expected one thread to be stopped at breakpoint 2")
self.finish_test()
@@ -84,8 +102,9 @@ class ConsecutiveBreakpointsTestCase(TestBase):
"""Test that single step stops, even though the second breakpoint is not valid."""
self.prepare_test()
- # Choose a thread other than the current one. A non-existing thread is fine.
- thread_index = self.process.GetNumThreads()+1
+ # Choose a thread other than the current one. A non-existing thread is
+ # fine.
+ thread_index = self.process.GetNumThreads() + 1
self.assertFalse(self.process.GetThreadAtIndex(thread_index).IsValid())
self.breakpoint2.SetThreadIndex(thread_index)
@@ -93,9 +112,13 @@ class ConsecutiveBreakpointsTestCase(TestBase):
self.thread.StepInstruction(step_over)
self.assertEquals(self.process.GetState(), lldb.eStateStopped)
- self.assertEquals(self.thread.GetFrameAtIndex(0).GetPCAddress().GetLoadAddress(self.target),
- self.bkpt_address.GetLoadAddress(self.target))
- self.assertEquals(self.thread.GetStopReason(), lldb.eStopReasonPlanComplete,
- "Stop reason should be 'plan complete'")
+ self.assertEquals(
+ self.thread.GetFrameAtIndex(0).GetPCAddress().GetLoadAddress(
+ self.target), self.bkpt_address.GetLoadAddress(
+ self.target))
+ self.assertEquals(
+ self.thread.GetStopReason(),
+ lldb.eStopReasonPlanComplete,
+ "Stop reason should be 'plan complete'")
self.finish_test()
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py
index c2aa597214ed..adec9fa5dddb 100644
--- a/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py
@@ -5,60 +5,64 @@ Test lldb breakpoint ids.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestCPPBreakpointLocations(TestBase):
mydir = TestBase.compute_mydir(__file__)
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24764")
- def test (self):
- self.build ()
- self.breakpoint_id_tests ()
+ def test(self):
+ self.build()
+ self.breakpoint_id_tests()
def verify_breakpoint_locations(self, target, bp_dict):
-
+
name = bp_dict['name']
names = bp_dict['loc_names']
- bp = target.BreakpointCreateByName (name)
- self.assertEquals(bp.GetNumLocations(), len(names), "Make sure we find the right number of breakpoint locations")
-
+ bp = target.BreakpointCreateByName(name)
+ self.assertEquals(
+ bp.GetNumLocations(),
+ len(names),
+ "Make sure we find the right number of breakpoint locations")
+
bp_loc_names = list()
for bp_loc in bp:
bp_loc_names.append(bp_loc.GetAddress().GetFunction().GetName())
-
+
for name in names:
found = name in bp_loc_names
if not found:
print("Didn't find '%s' in: %s" % (name, bp_loc_names))
- self.assertTrue (found, "Make sure we find all required locations")
-
- def breakpoint_id_tests (self):
-
+ self.assertTrue(found, "Make sure we find all required locations")
+
+ def breakpoint_id_tests(self):
+
# Create a target by the debugger.
exe = os.path.join(os.getcwd(), "a.out")
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
bp_dicts = [
- { 'name' : 'func1', 'loc_names' : [ 'a::c::func1()', 'b::c::func1()'] },
- { 'name' : 'func2', 'loc_names' : [ 'a::c::func2()', 'c::d::func2()'] },
- { 'name' : 'func3', 'loc_names' : [ 'a::c::func3()', 'b::c::func3()', 'c::d::func3()'] },
- { 'name' : 'c::func1', 'loc_names' : [ 'a::c::func1()', 'b::c::func1()'] },
- { 'name' : 'c::func2', 'loc_names' : [ 'a::c::func2()'] },
- { 'name' : 'c::func3', 'loc_names' : [ 'a::c::func3()', 'b::c::func3()'] },
- { 'name' : 'a::c::func1', 'loc_names' : [ 'a::c::func1()'] },
- { 'name' : 'b::c::func1', 'loc_names' : [ 'b::c::func1()'] },
- { 'name' : 'c::d::func2', 'loc_names' : [ 'c::d::func2()'] },
- { 'name' : 'a::c::func1()', 'loc_names' : [ 'a::c::func1()'] },
- { 'name' : 'b::c::func1()', 'loc_names' : [ 'b::c::func1()'] },
- { 'name' : 'c::d::func2()', 'loc_names' : [ 'c::d::func2()'] },
+ {'name': 'func1', 'loc_names': ['a::c::func1()', 'b::c::func1()']},
+ {'name': 'func2', 'loc_names': ['a::c::func2()', 'c::d::func2()']},
+ {'name': 'func3', 'loc_names': ['a::c::func3()', 'b::c::func3()', 'c::d::func3()']},
+ {'name': 'c::func1', 'loc_names': ['a::c::func1()', 'b::c::func1()']},
+ {'name': 'c::func2', 'loc_names': ['a::c::func2()']},
+ {'name': 'c::func3', 'loc_names': ['a::c::func3()', 'b::c::func3()']},
+ {'name': 'a::c::func1', 'loc_names': ['a::c::func1()']},
+ {'name': 'b::c::func1', 'loc_names': ['b::c::func1()']},
+ {'name': 'c::d::func2', 'loc_names': ['c::d::func2()']},
+ {'name': 'a::c::func1()', 'loc_names': ['a::c::func1()']},
+ {'name': 'b::c::func1()', 'loc_names': ['b::c::func1()']},
+ {'name': 'c::d::func2()', 'loc_names': ['c::d::func2()']},
]
-
+
for bp_dict in bp_dicts:
self.verify_breakpoint_locations(target, bp_dict)
@@ -68,28 +72,43 @@ class TestCPPBreakpointLocations(TestBase):
exe = os.path.join(os.getcwd(), "a.out")
target = self.dbg.CreateTarget(exe)
- # Don't skip prologue, so we can check the breakpoint address more easily
+ # Don't skip prologue, so we can check the breakpoint address more
+ # easily
self.runCmd("settings set target.skip-prologue false")
try:
names = ['~c', 'c::~c', 'c::~c()']
loc_names = {'a::c::~c()', 'b::c::~c()'}
- # TODO: For windows targets we should put windows mangled names here
- symbols = ['_ZN1a1cD1Ev', '_ZN1a1cD2Ev', '_ZN1b1cD1Ev', '_ZN1b1cD2Ev']
+ # TODO: For windows targets we should put windows mangled names
+ # here
+ symbols = [
+ '_ZN1a1cD1Ev',
+ '_ZN1a1cD2Ev',
+ '_ZN1b1cD1Ev',
+ '_ZN1b1cD2Ev']
for name in names:
bp = target.BreakpointCreateByName(name)
- bp_loc_names = { bp_loc.GetAddress().GetFunction().GetName() for bp_loc in bp }
- self.assertEquals(bp_loc_names, loc_names, "Breakpoint set on the correct symbol")
+ bp_loc_names = {bp_loc.GetAddress().GetFunction().GetName()
+ for bp_loc in bp}
+ self.assertEquals(
+ bp_loc_names,
+ loc_names,
+ "Breakpoint set on the correct symbol")
- bp_addresses = { bp_loc.GetLoadAddress() for bp_loc in bp }
+ bp_addresses = {bp_loc.GetLoadAddress() for bp_loc in bp}
symbol_addresses = set()
for symbol in symbols:
sc_list = target.FindSymbols(symbol, lldb.eSymbolTypeCode)
- self.assertEquals(sc_list.GetSize(), 1, "Found symbol " + symbol)
+ self.assertEquals(
+ sc_list.GetSize(), 1, "Found symbol " + symbol)
symbol = sc_list.GetContextAtIndex(0).GetSymbol()
- symbol_addresses.add(symbol.GetStartAddress().GetLoadAddress(target))
+ symbol_addresses.add(
+ symbol.GetStartAddress().GetLoadAddress(target))
- self.assertEquals(symbol_addresses, bp_addresses, "Breakpoint set on correct address")
+ self.assertEquals(
+ symbol_addresses,
+ bp_addresses,
+ "Breakpoint set on correct address")
finally:
self.runCmd("settings clear target.skip-prologue")
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/TestCPPExceptionBreakpoint.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/TestCPPExceptionBreakpoint.py
index 2aac3a9600d3..3019e1c1c557 100644
--- a/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/TestCPPExceptionBreakpoint.py
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/TestCPPExceptionBreakpoint.py
@@ -5,7 +5,6 @@ Test that you can set breakpoint and hit the C++ language exception breakpoint
from __future__ import print_function
-
import os
import re
import sys
@@ -14,6 +13,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestCPPExceptionBreakpoint (TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -24,26 +24,31 @@ class TestCPPExceptionBreakpoint (TestBase):
def test_cpp_exception_breakpoint(self):
"""Test setting and hitting the C++ exception breakpoint."""
self.build()
- self.do_cpp_exception_bkpt ()
+ self.do_cpp_exception_bkpt()
- def setUp (self):
+ def setUp(self):
TestBase.setUp(self)
self.main_source = "main.c"
self.main_source_spec = lldb.SBFileSpec(self.main_source)
-
- def do_cpp_exception_bkpt (self):
+ def do_cpp_exception_bkpt(self):
exe = os.path.join(os.getcwd(), "a.out")
error = lldb.SBError()
self.target = self.dbg.CreateTarget(exe)
self.assertTrue(self.target, VALID_TARGET)
- exception_bkpt = self.target.BreakpointCreateForException(lldb.eLanguageTypeC_plus_plus, False, True)
- self.assertTrue (exception_bkpt.IsValid(), "Created exception breakpoint.")
+ exception_bkpt = self.target.BreakpointCreateForException(
+ lldb.eLanguageTypeC_plus_plus, False, True)
+ self.assertTrue(
+ exception_bkpt.IsValid(),
+ "Created exception breakpoint.")
- process = self.target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = self.target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
-
- thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, exception_bkpt)
- self.assertTrue (len(thread_list) == 1, "One thread stopped at the exception breakpoint.")
+
+ thread_list = lldbutil.get_threads_stopped_at_breakpoint(
+ process, exception_bkpt)
+ self.assertTrue(len(thread_list) == 1,
+ "One thread stopped at the exception breakpoint.")
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/TestDebugBreak.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/TestDebugBreak.py
index de61f9e88f1b..d044827e0084 100644
--- a/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/TestDebugBreak.py
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/TestDebugBreak.py
@@ -10,6 +10,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class DebugBreakTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -23,19 +24,23 @@ class DebugBreakTestCase(TestBase):
# Run the program.
target = self.dbg.CreateTarget(exe)
- process = target.LaunchSimple(None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
# We've hit the first stop, so grab the frame.
self.assertEqual(process.GetState(), lldb.eStateStopped)
- stop_reason = lldb.eStopReasonException if (lldbplatformutil.getPlatform()=="windows" or lldbplatformutil.getPlatform()=="macosx") else lldb.eStopReasonSignal
+ stop_reason = lldb.eStopReasonException if (lldbplatformutil.getPlatform(
+ ) == "windows" or lldbplatformutil.getPlatform() == "macosx") else lldb.eStopReasonSignal
thread = lldbutil.get_stopped_thread(process, stop_reason)
- self.assertIsNotNone(thread, "Unable to find thread stopped at the __debugbreak()")
+ self.assertIsNotNone(
+ thread, "Unable to find thread stopped at the __debugbreak()")
frame = thread.GetFrameAtIndex(0)
# We should be in funciton 'bar'.
self.assertTrue(frame.IsValid())
function_name = frame.GetFunctionName()
- self.assertTrue('bar' in function_name, "Unexpected function name {}".format(function_name))
+ self.assertTrue('bar' in function_name,
+ "Unexpected function name {}".format(function_name))
# We should be able to evaluate the parameter foo.
value = frame.EvaluateExpression('*foo')
@@ -45,10 +50,10 @@ class DebugBreakTestCase(TestBase):
# subsequent stop.
counter = 1
while counter < 20:
- value = frame.EvaluateExpression('count')
- self.assertEqual(value.GetValueAsSigned(), counter)
- counter += 2
- process.Continue()
+ value = frame.EvaluateExpression('count')
+ self.assertEqual(value.GetValueAsSigned(), counter)
+ counter += 2
+ process.Continue()
# The inferior should exit after the last iteration.
self.assertEqual(process.GetState(), lldb.eStateExited)
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/dummy_target_breakpoints/TestBreakpointsWithNoTargets.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/dummy_target_breakpoints/TestBreakpointsWithNoTargets.py
index f2693e6ed593..a934ad356ac6 100644
--- a/packages/Python/lldbsuite/test/functionalities/breakpoint/dummy_target_breakpoints/TestBreakpointsWithNoTargets.py
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/dummy_target_breakpoints/TestBreakpointsWithNoTargets.py
@@ -5,12 +5,13 @@ Test breakpoint commands set before we have a target
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class BreakpointInDummyTarget (TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -25,43 +26,49 @@ class BreakpointInDummyTarget (TestBase):
TestBase.setUp(self)
# Find the line number to break inside main().
self.line = line_number('main.c', 'Set a breakpoint on this line.')
- self.line2 = line_number ('main.c', 'Set another on this line.')
+ self.line2 = line_number('main.c', 'Set another on this line.')
def dummy_breakpoint_test(self):
"""Test breakpoint set before we have a target. """
# This should create a breakpoint with 3 locations.
- lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=0)
- lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line2, num_expected_locations=0)
-
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", self.line, num_expected_locations=0)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", self.line2, num_expected_locations=0)
+
# This is the function to remove breakpoints from the dummy target
# to get a clean slate for the next test case.
def cleanup():
self.runCmd('breakpoint delete -D -f', check=False)
self.runCmd('breakpoint list', check=False)
-
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
-
+
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# The breakpoint list should show 3 locations.
- self.expect("breakpoint list -f", "Breakpoint locations shown correctly",
- substrs = ["1: file = 'main.c', line = %d, exact_match = 0, locations = 1" % self.line,
- "2: file = 'main.c', line = %d, exact_match = 0, locations = 1" % self.line2])
+ self.expect(
+ "breakpoint list -f",
+ "Breakpoint locations shown correctly",
+ substrs=[
+ "1: file = 'main.c', line = %d, exact_match = 0, locations = 1" %
+ self.line,
+ "2: file = 'main.c', line = %d, exact_match = 0, locations = 1" %
+ self.line2])
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
# Stopped once.
self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ["stop reason = breakpoint 1."])
+ substrs=["stop reason = breakpoint 1."])
# Continue the program, there should be another stop.
self.runCmd("process continue")
# Stopped again.
self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ["stop reason = breakpoint 2."])
+ substrs=["stop reason = breakpoint 2."])
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/inlined_breakpoints/TestInlinedBreakpoints.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/inlined_breakpoints/TestInlinedBreakpoints.py
index d04178bda78d..fe8f430096d9 100644
--- a/packages/Python/lldbsuite/test/functionalities/breakpoint/inlined_breakpoints/TestInlinedBreakpoints.py
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/inlined_breakpoints/TestInlinedBreakpoints.py
@@ -6,12 +6,13 @@ another source file) works correctly.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class InlinedBreakpointsTestCase(TestBase):
"""Bug fixed: rdar://problem/8464339"""
@@ -26,32 +27,43 @@ class InlinedBreakpointsTestCase(TestBase):
# Call super's setUp().
TestBase.setUp(self)
# Find the line number to break inside basic_type.cpp.
- self.line = line_number('basic_type.cpp', '// Set break point at this line.')
+ self.line = line_number(
+ 'basic_type.cpp',
+ '// Set break point at this line.')
def inlined_breakpoints(self):
"""Test 'b basic_types.cpp:176' does break (where int.cpp includes basic_type.cpp)."""
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- # With the inline-breakpoint-strategy, our file+line breakpoint should not resolve to a location.
+ # With the inline-breakpoint-strategy, our file+line breakpoint should
+ # not resolve to a location.
self.runCmd('settings set target.inline-breakpoint-strategy headers')
- # Set a breakpoint and fail because it is in an inlined source implemenation file
- lldbutil.run_break_set_by_file_and_line (self, "basic_type.cpp", self.line, num_expected_locations=0)
+ # Set a breakpoint and fail because it is in an inlined source
+ # implemenation file
+ lldbutil.run_break_set_by_file_and_line(
+ self, "basic_type.cpp", self.line, num_expected_locations=0)
- # Now enable breakpoints in implementation files and see the breakpoint set succeed
+ # Now enable breakpoints in implementation files and see the breakpoint
+ # set succeed
self.runCmd('settings set target.inline-breakpoint-strategy always')
# And add hooks to restore the settings during tearDown().
- self.addTearDownHook(
- lambda: self.runCmd("settings set target.inline-breakpoint-strategy always"))
+ self.addTearDownHook(lambda: self.runCmd(
+ "settings set target.inline-breakpoint-strategy always"))
- lldbutil.run_break_set_by_file_and_line (self, "basic_type.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self,
+ "basic_type.cpp",
+ self.line,
+ num_expected_locations=1,
+ loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
# And it should break at basic_type.cpp:176.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint',
- 'basic_type.cpp:%d' % self.line])
+ substrs=['stopped',
+ 'stop reason = breakpoint',
+ 'basic_type.cpp:%d' % self.line])
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/objc/TestObjCBreakpoints.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/objc/TestObjCBreakpoints.py
index c48cee1bd2b2..f43bbb7515c1 100644
--- a/packages/Python/lldbsuite/test/functionalities/breakpoint/objc/TestObjCBreakpoints.py
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/objc/TestObjCBreakpoints.py
@@ -6,8 +6,8 @@ parser.
from __future__ import print_function
-
-import os, time
+import os
+import time
import shutil
import subprocess
import lldb
@@ -15,6 +15,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
@skipUnlessDarwin
class TestObjCBreakpoints(TestBase):
@@ -34,20 +35,37 @@ class TestObjCBreakpoints(TestBase):
self.line = line_number(self.main_source, '// Set breakpoint here')
def check_category_breakpoints(self):
- name_bp = self.target.BreakpointCreateByName ("myCategoryFunction")
- selector_bp = self.target.BreakpointCreateByName ("myCategoryFunction", lldb.eFunctionNameTypeSelector, lldb.SBFileSpecList(), lldb.SBFileSpecList())
- self.assertTrue(name_bp.GetNumLocations() == selector_bp.GetNumLocations(), 'Make sure setting a breakpoint by name "myCategoryFunction" sets a breakpoint even though it is in a category')
+ name_bp = self.target.BreakpointCreateByName("myCategoryFunction")
+ selector_bp = self.target.BreakpointCreateByName(
+ "myCategoryFunction",
+ lldb.eFunctionNameTypeSelector,
+ lldb.SBFileSpecList(),
+ lldb.SBFileSpecList())
+ self.assertTrue(
+ name_bp.GetNumLocations() == selector_bp.GetNumLocations(),
+ 'Make sure setting a breakpoint by name "myCategoryFunction" sets a breakpoint even though it is in a category')
for bp_loc in selector_bp:
function_name = bp_loc.GetAddress().GetSymbol().GetName()
- self.assertTrue(" myCategoryFunction]" in function_name, 'Make sure all function names have " myCategoryFunction]" in their names')
-
- category_bp = self.target.BreakpointCreateByName ("-[MyClass(MyCategory) myCategoryFunction]")
- stripped_bp = self.target.BreakpointCreateByName ("-[MyClass myCategoryFunction]")
- stripped2_bp = self.target.BreakpointCreateByName ("[MyClass myCategoryFunction]")
- self.assertTrue(category_bp.GetNumLocations() == 1, "Make sure we can set a breakpoint using a full objective C function name with the category included (-[MyClass(MyCategory) myCategoryFunction])")
- self.assertTrue(stripped_bp.GetNumLocations() == 1, "Make sure we can set a breakpoint using a full objective C function name without the category included (-[MyClass myCategoryFunction])")
- self.assertTrue(stripped2_bp.GetNumLocations() == 1, "Make sure we can set a breakpoint using a full objective C function name without the category included ([MyClass myCategoryFunction])")
-
+ self.assertTrue(
+ " myCategoryFunction]" in function_name,
+ 'Make sure all function names have " myCategoryFunction]" in their names')
+
+ category_bp = self.target.BreakpointCreateByName(
+ "-[MyClass(MyCategory) myCategoryFunction]")
+ stripped_bp = self.target.BreakpointCreateByName(
+ "-[MyClass myCategoryFunction]")
+ stripped2_bp = self.target.BreakpointCreateByName(
+ "[MyClass myCategoryFunction]")
+ self.assertTrue(
+ category_bp.GetNumLocations() == 1,
+ "Make sure we can set a breakpoint using a full objective C function name with the category included (-[MyClass(MyCategory) myCategoryFunction])")
+ self.assertTrue(
+ stripped_bp.GetNumLocations() == 1,
+ "Make sure we can set a breakpoint using a full objective C function name without the category included (-[MyClass myCategoryFunction])")
+ self.assertTrue(
+ stripped2_bp.GetNumLocations() == 1,
+ "Make sure we can set a breakpoint using a full objective C function name without the category included ([MyClass myCategoryFunction])")
+
def check_objc_breakpoints(self, have_dsym):
"""Test constant string generation amd comparison by the expression parser."""
@@ -60,36 +78,55 @@ class TestObjCBreakpoints(TestBase):
self.assertTrue(self.target, VALID_TARGET)
#----------------------------------------------------------------------
- # Set breakpoints on all selectors whose name is "count". This should
- # catch breakpoints that are both C functions _and_ anything whose
+ # Set breakpoints on all selectors whose name is "count". This should
+ # catch breakpoints that are both C functions _and_ anything whose
# selector is "count" because just looking at "count" we can't tell
# definitively if the name is a selector or a C function
#----------------------------------------------------------------------
- name_bp = self.target.BreakpointCreateByName ("count")
- selector_bp = self.target.BreakpointCreateByName ("count", lldb.eFunctionNameTypeSelector, lldb.SBFileSpecList(), lldb.SBFileSpecList())
- self.assertTrue(name_bp.GetNumLocations() >= selector_bp.GetNumLocations(), 'Make sure we get at least the same amount of breakpoints if not more when setting by name "count"')
- self.assertTrue(selector_bp.GetNumLocations() > 50, 'Make sure we find a lot of "count" selectors') # There are 93 on the latest MacOSX
+ name_bp = self.target.BreakpointCreateByName("count")
+ selector_bp = self.target.BreakpointCreateByName(
+ "count",
+ lldb.eFunctionNameTypeSelector,
+ lldb.SBFileSpecList(),
+ lldb.SBFileSpecList())
+ self.assertTrue(
+ name_bp.GetNumLocations() >= selector_bp.GetNumLocations(),
+ 'Make sure we get at least the same amount of breakpoints if not more when setting by name "count"')
+ self.assertTrue(
+ selector_bp.GetNumLocations() > 50,
+ 'Make sure we find a lot of "count" selectors') # There are 93 on the latest MacOSX
for bp_loc in selector_bp:
function_name = bp_loc.GetAddress().GetSymbol().GetName()
- self.assertTrue(" count]" in function_name, 'Make sure all function names have " count]" in their names')
+ self.assertTrue(
+ " count]" in function_name,
+ 'Make sure all function names have " count]" in their names')
#----------------------------------------------------------------------
# Set breakpoints on all selectors whose name is "isEqual:". This should
# catch breakpoints that are only ObjC selectors because no C function
# can end with a :
#----------------------------------------------------------------------
- name_bp = self.target.BreakpointCreateByName ("isEqual:")
- selector_bp = self.target.BreakpointCreateByName ("isEqual:", lldb.eFunctionNameTypeSelector, lldb.SBFileSpecList(), lldb.SBFileSpecList())
- self.assertTrue(name_bp.GetNumLocations() == selector_bp.GetNumLocations(), 'Make sure setting a breakpoint by name "isEqual:" only sets selector breakpoints')
+ name_bp = self.target.BreakpointCreateByName("isEqual:")
+ selector_bp = self.target.BreakpointCreateByName(
+ "isEqual:",
+ lldb.eFunctionNameTypeSelector,
+ lldb.SBFileSpecList(),
+ lldb.SBFileSpecList())
+ self.assertTrue(
+ name_bp.GetNumLocations() == selector_bp.GetNumLocations(),
+ 'Make sure setting a breakpoint by name "isEqual:" only sets selector breakpoints')
for bp_loc in selector_bp:
function_name = bp_loc.GetAddress().GetSymbol().GetName()
- self.assertTrue(" isEqual:]" in function_name, 'Make sure all function names have " isEqual:]" in their names')
-
+ self.assertTrue(
+ " isEqual:]" in function_name,
+ 'Make sure all function names have " isEqual:]" in their names')
+
self.check_category_breakpoints()
-
+
if have_dsym:
shutil.rmtree(exe + ".dSYM")
- self.assertTrue(subprocess.call(['/usr/bin/strip', '-Sx', exe]) == 0, 'stripping dylib succeeded')
-
+ self.assertTrue(subprocess.call(
+ ['/usr/bin/strip', '-Sx', exe]) == 0, 'stripping dylib succeeded')
+
# Check breakpoints again, this time using the symbol table only
self.check_category_breakpoints()
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/Makefile b/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/Makefile
new file mode 100644
index 000000000000..b09a579159d4
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+C_SOURCES := main.c
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/TestBreakpointSerialization.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/TestBreakpointSerialization.py
new file mode 100644
index 000000000000..6f93994a4664
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/TestBreakpointSerialization.py
@@ -0,0 +1,288 @@
+"""
+Test breakpoint serialization.
+"""
+
+from __future__ import print_function
+
+
+import os
+import time
+import re
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class BreakpointSerialization(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ @add_test_categories(['pyapi'])
+ def test_resolvers(self):
+ """Use Python APIs to test that we serialize resolvers."""
+ self.build()
+ self.setup_targets_and_cleanup()
+ self.do_check_resolvers()
+
+ def test_filters(self):
+ """Use Python APIs to test that we serialize search filters correctly."""
+ self.build()
+ self.setup_targets_and_cleanup()
+ self.do_check_filters()
+
+ def test_options(self):
+ """Use Python APIs to test that we serialize breakpoint options correctly."""
+ self.build()
+ self.setup_targets_and_cleanup()
+ self.do_check_options()
+
+ def test_appending(self):
+ """Use Python APIs to test that we serialize breakpoint options correctly."""
+ self.build()
+ self.setup_targets_and_cleanup()
+ self.do_check_appending()
+
+ def test_name_filters(self):
+ """Use python APIs to test that reading in by name works correctly."""
+ self.build()
+ self.setup_targets_and_cleanup()
+ self.do_check_names()
+
+ def setup_targets_and_cleanup(self):
+ def cleanup ():
+ self.RemoveTempFile(self.bkpts_file_path)
+
+ if self.orig_target.IsValid():
+ self.dbg.DeleteTarget(self.orig_target)
+ self.dbg.DeleteTarget(self.copy_target)
+
+ self.addTearDownHook(cleanup)
+ self.RemoveTempFile(self.bkpts_file_path)
+
+ exe = os.path.join(os.getcwd(), "a.out")
+
+ # Create the targets we are making breakpoints in and copying them to:
+ self.orig_target = self.dbg.CreateTarget(exe)
+ self.assertTrue(self.orig_target, VALID_TARGET)
+
+ self.copy_target = self.dbg.CreateTarget(exe)
+ self.assertTrue(self.copy_target, VALID_TARGET)
+
+ def setUp(self):
+ # Call super's setUp().
+ TestBase.setUp(self)
+
+ self.bkpts_file_path = os.path.join(os.getcwd(), "breakpoints.json")
+ self.bkpts_file_spec = lldb.SBFileSpec(self.bkpts_file_path)
+
+ def check_equivalence(self, source_bps, do_write = True):
+
+ error = lldb.SBError()
+
+ if (do_write):
+ error = self.orig_target.BreakpointsWriteToFile(self.bkpts_file_spec, source_bps)
+ self.assertTrue(error.Success(), "Failed writing breakpoints to file: %s."%(error.GetCString()))
+
+ copy_bps = lldb.SBBreakpointList(self.copy_target)
+ error = self.copy_target.BreakpointsCreateFromFile(self.bkpts_file_spec, copy_bps)
+ self.assertTrue(error.Success(), "Failed reading breakpoints from file: %s"%(error.GetCString()))
+
+ num_source_bps = source_bps.GetSize()
+ num_copy_bps = copy_bps.GetSize()
+ self.assertTrue(num_source_bps == num_copy_bps, "Didn't get same number of input and output breakpoints - orig: %d copy: %d"%(num_source_bps, num_copy_bps))
+
+ for i in range(0, num_source_bps):
+ source_bp = source_bps.GetBreakpointAtIndex(i)
+ source_desc = lldb.SBStream()
+ source_bp.GetDescription(source_desc, False)
+ source_text = source_desc.GetData()
+
+ # I am assuming here that the breakpoints will get written out in breakpoint ID order, and
+ # read back in ditto. That is true right now, and I can't see any reason to do it differently
+ # but if we do we can go to writing the breakpoints one by one, or sniffing the descriptions to
+ # see which one is which.
+ copy_id = source_bp.GetID()
+ copy_bp = copy_bps.FindBreakpointByID(copy_id)
+ self.assertTrue(copy_bp.IsValid(), "Could not find copy breakpoint %d."%(copy_id))
+
+ copy_desc = lldb.SBStream()
+ copy_bp.GetDescription(copy_desc, False)
+ copy_text = copy_desc.GetData()
+
+ # These two should be identical.
+ # print ("Source text for %d is %s."%(i, source_text))
+ self.assertTrue (source_text == copy_text, "Source and dest breakpoints are not identical: \nsource: %s\ndest: %s"%(source_text, copy_text))
+
+ def do_check_resolvers(self):
+ """Use Python APIs to check serialization of breakpoint resolvers"""
+
+ empty_module_list = lldb.SBFileSpecList()
+ empty_cu_list = lldb.SBFileSpecList()
+ blubby_file_spec = lldb.SBFileSpec(os.path.join(os.getcwd(), "blubby.c"))
+
+ # It isn't actually important for these purposes that these breakpoint
+ # actually have locations.
+ source_bps = lldb.SBBreakpointList(self.orig_target)
+ source_bps.Append(self.orig_target.BreakpointCreateByLocation("blubby.c", 666))
+ # Make sure we do one breakpoint right:
+ self.check_equivalence(source_bps)
+ source_bps.Clear()
+
+ source_bps.Append(self.orig_target.BreakpointCreateByName("blubby", lldb.eFunctionNameTypeAuto, empty_module_list, empty_cu_list))
+ source_bps.Append(self.orig_target.BreakpointCreateByName("blubby", lldb.eFunctionNameTypeFull, empty_module_list,empty_cu_list))
+ source_bps.Append(self.orig_target.BreakpointCreateBySourceRegex("dont really care", blubby_file_spec))
+
+ # And some number greater than one:
+ self.check_equivalence(source_bps)
+
+ def do_check_filters(self):
+ """Use Python APIs to check serialization of breakpoint filters."""
+ module_list = lldb.SBFileSpecList()
+ module_list.Append(lldb.SBFileSpec("SomeBinary"))
+ module_list.Append(lldb.SBFileSpec("SomeOtherBinary"))
+
+ cu_list = lldb.SBFileSpecList()
+ cu_list.Append(lldb.SBFileSpec("SomeCU.c"))
+ cu_list.Append(lldb.SBFileSpec("AnotherCU.c"))
+ cu_list.Append(lldb.SBFileSpec("ThirdCU.c"))
+
+ blubby_file_spec = lldb.SBFileSpec(os.path.join(os.getcwd(), "blubby.c"))
+
+ # It isn't actually important for these purposes that these breakpoint
+ # actually have locations.
+ source_bps = lldb.SBBreakpointList(self.orig_target)
+ bkpt = self.orig_target.BreakpointCreateByLocation(blubby_file_spec, 666, 0, module_list)
+ source_bps.Append(bkpt)
+
+ # Make sure we do one right:
+ self.check_equivalence(source_bps)
+ source_bps.Clear()
+
+ bkpt = self.orig_target.BreakpointCreateByName("blubby", lldb.eFunctionNameTypeAuto, module_list, cu_list)
+ source_bps.Append(bkpt)
+ bkpt = self.orig_target.BreakpointCreateByName("blubby", lldb.eFunctionNameTypeFull, module_list, cu_list)
+ source_bps.Append(bkpt)
+ bkpt = self.orig_target.BreakpointCreateBySourceRegex("dont really care", blubby_file_spec)
+ source_bps.Append(bkpt)
+
+ # And some number greater than one:
+ self.check_equivalence(source_bps)
+
+ def do_check_options(self):
+ """Use Python APIs to check serialization of breakpoint options."""
+
+ empty_module_list = lldb.SBFileSpecList()
+ empty_cu_list = lldb.SBFileSpecList()
+ blubby_file_spec = lldb.SBFileSpec(os.path.join(os.getcwd(), "blubby.c"))
+
+ # It isn't actually important for these purposes that these breakpoint
+ # actually have locations.
+ source_bps = lldb.SBBreakpointList(self.orig_target)
+
+ bkpt = self.orig_target.BreakpointCreateByLocation("blubby.c", 666)
+ bkpt.SetEnabled(False)
+ bkpt.SetOneShot(True)
+ bkpt.SetThreadID(10)
+ source_bps.Append(bkpt)
+
+ # Make sure we get one right:
+ self.check_equivalence(source_bps)
+ source_bps.Clear()
+
+ bkpt = self.orig_target.BreakpointCreateByName("blubby", lldb.eFunctionNameTypeAuto, empty_module_list, empty_cu_list)
+ bkpt.SetIgnoreCount(10)
+ bkpt.SetThreadName("grubby")
+ source_bps.Append(bkpt)
+
+ bkpt = self.orig_target.BreakpointCreateByName("blubby", lldb.eFunctionNameTypeFull, empty_module_list,empty_cu_list)
+ bkpt.SetCondition("something != something_else")
+ bkpt.SetQueueName("grubby")
+ bkpt.AddName("FirstName")
+ bkpt.AddName("SecondName")
+ bkpt.SetScriptCallbackBody('\tprint("I am a function that prints.")\n\tprint("I don\'t do anything else")\n')
+ source_bps.Append(bkpt)
+
+ bkpt = self.orig_target.BreakpointCreateBySourceRegex("dont really care", blubby_file_spec)
+ cmd_list = lldb.SBStringList()
+ cmd_list.AppendString("frame var")
+ cmd_list.AppendString("thread backtrace")
+
+ bkpt.SetCommandLineCommands(cmd_list)
+ source_bps.Append(bkpt)
+
+ self.check_equivalence(source_bps)
+
+ def do_check_appending(self):
+ """Use Python APIs to check appending to already serialized options."""
+
+ empty_module_list = lldb.SBFileSpecList()
+ empty_cu_list = lldb.SBFileSpecList()
+ blubby_file_spec = lldb.SBFileSpec(os.path.join(os.getcwd(), "blubby.c"))
+
+ # It isn't actually important for these purposes that these breakpoint
+ # actually have locations.
+
+ all_bps = lldb.SBBreakpointList(self.orig_target)
+ source_bps = lldb.SBBreakpointList(self.orig_target)
+
+ bkpt = self.orig_target.BreakpointCreateByLocation("blubby.c", 666)
+ bkpt.SetEnabled(False)
+ bkpt.SetOneShot(True)
+ bkpt.SetThreadID(10)
+ source_bps.Append(bkpt)
+ all_bps.Append(bkpt)
+
+ error = lldb.SBError()
+ error = self.orig_target.BreakpointsWriteToFile(self.bkpts_file_spec, source_bps)
+ self.assertTrue(error.Success(), "Failed writing breakpoints to file: %s."%(error.GetCString()))
+
+ source_bps.Clear()
+
+ bkpt = self.orig_target.BreakpointCreateByName("blubby", lldb.eFunctionNameTypeAuto, empty_module_list, empty_cu_list)
+ bkpt.SetIgnoreCount(10)
+ bkpt.SetThreadName("grubby")
+ source_bps.Append(bkpt)
+ all_bps.Append(bkpt)
+
+ bkpt = self.orig_target.BreakpointCreateByName("blubby", lldb.eFunctionNameTypeFull, empty_module_list,empty_cu_list)
+ bkpt.SetCondition("something != something_else")
+ bkpt.SetQueueName("grubby")
+ bkpt.AddName("FirstName")
+ bkpt.AddName("SecondName")
+
+ source_bps.Append(bkpt)
+ all_bps.Append(bkpt)
+
+ error = self.orig_target.BreakpointsWriteToFile(self.bkpts_file_spec, source_bps, True)
+ self.assertTrue(error.Success(), "Failed appending breakpoints to file: %s."%(error.GetCString()))
+
+ self.check_equivalence(all_bps)
+
+ def do_check_names(self):
+ bkpt = self.orig_target.BreakpointCreateByLocation("blubby.c", 666)
+ good_bkpt_name = "GoodBreakpoint"
+ write_bps = lldb.SBBreakpointList(self.orig_target)
+ bkpt.AddName(good_bkpt_name)
+ write_bps.Append(bkpt)
+
+ error = lldb.SBError()
+ error = self.orig_target.BreakpointsWriteToFile(self.bkpts_file_spec, write_bps)
+ self.assertTrue(error.Success(), "Failed writing breakpoints to file: %s."%(error.GetCString()))
+
+ copy_bps = lldb.SBBreakpointList(self.copy_target)
+ names_list = lldb.SBStringList()
+ names_list.AppendString("NoSuchName")
+
+ error = self.copy_target.BreakpointsCreateFromFile(self.bkpts_file_spec, names_list, copy_bps)
+ self.assertTrue(error.Success(), "Failed reading breakpoints from file: %s"%(error.GetCString()))
+ self.assertTrue(copy_bps.GetSize() == 0, "Found breakpoints with a nonexistent name.")
+
+ names_list.AppendString(good_bkpt_name)
+ error = self.copy_target.BreakpointsCreateFromFile(self.bkpts_file_spec, names_list, copy_bps)
+ self.assertTrue(error.Success(), "Failed reading breakpoints from file: %s"%(error.GetCString()))
+ self.assertTrue(copy_bps.GetSize() == 1, "Found the matching breakpoint.")
+
+
+
+
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/main.c b/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/main.c
new file mode 100644
index 000000000000..b74b37b48b08
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/main.c
@@ -0,0 +1,54 @@
+//===-- main.c --------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+#include <stdio.h>
+
+// This simple program is to demonstrate the capability of the lldb command
+// "breakpoint modify -i <count> breakpt-id" to set the number of times a
+// breakpoint is skipped before stopping. Ignore count can also be set upon
+// breakpoint creation by 'breakpoint set ... -i <count>'.
+
+int a(int);
+int b(int);
+int c(int);
+
+int a(int val)
+{
+ if (val <= 1)
+ return b(val);
+ else if (val >= 3)
+ return c(val); // a(3) -> c(3) Find the call site of c(3).
+
+ return val;
+}
+
+int b(int val)
+{
+ return c(val);
+}
+
+int c(int val)
+{
+ return val + 3; // Find the line number of function "c" here.
+}
+
+int main (int argc, char const *argv[])
+{
+ int A1 = a(1); // a(1) -> b(1) -> c(1)
+ printf("a(1) returns %d\n", A1);
+
+ int B2 = b(2); // b(2) -> c(2) Find the call site of b(2).
+ printf("b(2) returns %d\n", B2);
+
+ int A3 = a(3); // a(3) -> c(3) Find the call site of a(3).
+ printf("a(3) returns %d\n", A3);
+
+ int C1 = c(5); // Find the call site of c in main.
+ printf ("c(5) returns %d\n", C1);
+ return 0;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/TestSourceRegexBreakpoints.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/TestSourceRegexBreakpoints.py
index 81cab927d214..791cc70a7498 100644
--- a/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/TestSourceRegexBreakpoints.py
+++ b/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/TestSourceRegexBreakpoints.py
@@ -5,26 +5,27 @@ This test just tests the source file & function restrictions.
from __future__ import print_function
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestSourceRegexBreakpoints(TestBase):
mydir = TestBase.compute_mydir(__file__)
- def test_location (self):
+ def test_location(self):
self.build()
self.source_regex_locations()
- def test_restrictions (self):
- self.build ()
- self.source_regex_restrictions ()
-
+ def test_restrictions(self):
+ self.build()
+ self.source_regex_restrictions()
- def source_regex_locations (self):
+ def source_regex_locations(self):
""" Test that restricting source expressions to files & to functions. """
# Create a target by the debugger.
exe = os.path.join(os.getcwd(), "a.out")
@@ -39,24 +40,28 @@ class TestSourceRegexBreakpoints(TestBase):
func_names.AppendString("a_func")
source_regex = "Set . breakpoint here"
- main_break = target.BreakpointCreateBySourceRegex (source_regex,
- lldb.SBFileSpecList(),
- target_files,
- func_names)
+ main_break = target.BreakpointCreateBySourceRegex(
+ source_regex, lldb.SBFileSpecList(), target_files, func_names)
num_locations = main_break.GetNumLocations()
- self.assertTrue(num_locations == 1, "a.c in a_func should give one breakpoint, got %d."%(num_locations))
+ self.assertTrue(
+ num_locations == 1,
+ "a.c in a_func should give one breakpoint, got %d." %
+ (num_locations))
loc = main_break.GetLocationAtIndex(0)
self.assertTrue(loc.IsValid(), "Got a valid location.")
address = loc.GetAddress()
- self.assertTrue(address.IsValid(), "Got a valid address from the location.")
-
+ self.assertTrue(
+ address.IsValid(),
+ "Got a valid address from the location.")
+
a_func_line = line_number("a.c", "Set A breakpoint here")
line_entry = address.GetLineEntry()
self.assertTrue(line_entry.IsValid(), "Got a valid line entry.")
- self.assertTrue(line_entry.line == a_func_line, "Our line number matches the one lldbtest found.")
+ self.assertTrue(line_entry.line == a_func_line,
+ "Our line number matches the one lldbtest found.")
- def source_regex_restrictions (self):
+ def source_regex_restrictions(self):
""" Test that restricting source expressions to files & to functions. """
# Create a target by the debugger.
exe = os.path.join(os.getcwd(), "a.out")
@@ -67,34 +72,35 @@ class TestSourceRegexBreakpoints(TestBase):
target_files = lldb.SBFileSpecList()
target_files.Append(lldb.SBFileSpec("main.c"))
source_regex = "Set . breakpoint here"
- main_break = target.BreakpointCreateBySourceRegex (source_regex,
- lldb.SBFileSpecList(),
- target_files,
- lldb.SBStringList())
+ main_break = target.BreakpointCreateBySourceRegex(
+ source_regex, lldb.SBFileSpecList(), target_files, lldb.SBStringList())
num_locations = main_break.GetNumLocations()
- self.assertTrue(num_locations == 2, "main.c should have 2 matches, got %d."%(num_locations))
+ self.assertTrue(
+ num_locations == 2,
+ "main.c should have 2 matches, got %d." %
+ (num_locations))
# Now look in both files:
target_files.Append(lldb.SBFileSpec("a.c"))
- main_break = target.BreakpointCreateBySourceRegex (source_regex,
- lldb.SBFileSpecList(),
- target_files,
- lldb.SBStringList())
+ main_break = target.BreakpointCreateBySourceRegex(
+ source_regex, lldb.SBFileSpecList(), target_files, lldb.SBStringList())
- num_locations =main_break.GetNumLocations()
- self.assertTrue(num_locations == 4, "main.c and a.c should have 4 matches, got %d."%(num_locations))
+ num_locations = main_break.GetNumLocations()
+ self.assertTrue(
+ num_locations == 4,
+ "main.c and a.c should have 4 matches, got %d." %
+ (num_locations))
# Now restrict it to functions:
func_names = lldb.SBStringList()
func_names.AppendString("main_func")
- main_break = target.BreakpointCreateBySourceRegex (source_regex,
- lldb.SBFileSpecList(),
- target_files,
- func_names)
-
- num_locations =main_break.GetNumLocations()
- self.assertTrue(num_locations == 2, "main_func in main.c and a.c should have 2 matches, got %d."%(num_locations))
-
+ main_break = target.BreakpointCreateBySourceRegex(
+ source_regex, lldb.SBFileSpecList(), target_files, func_names)
+ num_locations = main_break.GetNumLocations()
+ self.assertTrue(
+ num_locations == 2,
+ "main_func in main.c and a.c should have 2 matches, got %d." %
+ (num_locations))
diff --git a/packages/Python/lldbsuite/test/functionalities/command_history/TestCommandHistory.py b/packages/Python/lldbsuite/test/functionalities/command_history/TestCommandHistory.py
index 66ba8d07622d..17b7b6d395db 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_history/TestCommandHistory.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_history/TestCommandHistory.py
@@ -5,13 +5,13 @@ Test the command history mechanism
from __future__ import print_function
-
import os
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class CommandHistoryTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -19,52 +19,90 @@ class CommandHistoryTestCase(TestBase):
@no_debug_info_test
def test_history(self):
self.runCmd('command history --clear', inHistory=False)
- self.runCmd('breakpoint list', check=False, inHistory=True) #0
- self.runCmd('register read', check=False, inHistory=True) #1
- self.runCmd('apropos hello', check=False, inHistory=True) #2
- self.runCmd('memory write', check=False, inHistory=True) #3
- self.runCmd('log list', check=False, inHistory=True) #4
- self.runCmd('disassemble', check=False, inHistory=True) #5
- self.runCmd('expression 1', check=False, inHistory=True) #6
- self.runCmd('type summary list -w default', check=False, inHistory=True) #7
- self.runCmd('version', check=False, inHistory=True) #8
- self.runCmd('frame select 1', check=False, inHistory=True) #9
-
- self.expect ("command history -s 3 -c 3", inHistory=True,
- substrs = ['3: memory write','4: log list','5: disassemble'])
-
- self.expect ("command history -s 3 -e 3", inHistory=True,
- substrs = ['3: memory write'])
-
- self.expect ("command history -s 6 -e 7", inHistory=True,
- substrs = ['6: expression 1','7: type summary list -w default'])
-
- self.expect ("command history -c 2", inHistory=True,
- substrs = ['0: breakpoint list','1: register read'])
-
- self.expect ("command history -e 3 -c 1", inHistory=True,
- substrs = ['3: memory write'])
-
- self.expect ("command history -e 2", inHistory=True,
- substrs = ['0: breakpoint list','1: register read','2: apropos hello'])
-
- self.expect ("command history -s 12", inHistory=True,
- substrs = ['12: command history -s 6 -e 7','13: command history -c 2','14: command history -e 3 -c 1','15: command history -e 2','16: command history -s 12'])
-
- self.expect ("command history -s end -c 3", inHistory=True,
- substrs = ['15: command history -e 2','16: command history -s 12','17: command history -s end -c 3'])
-
- self.expect ("command history -s end -e 15", inHistory=True,
- substrs = ['15: command history -e 2','16: command history -s 12','17: command history -s end -c 3','command history -s end -e 15'])
-
- self.expect ("command history -s 5 -c 1", inHistory=True,
- substrs = ['5: disassemble'])
-
- self.expect ("command history -c 1 -s 5", inHistory=True,
- substrs = ['5: disassemble'])
-
- self.expect ("command history -c 1 -e 3", inHistory=True,
- substrs = ['3: memory write'])
-
- self.expect ("command history -c 1 -e 3 -s 5",error=True, inHistory=True,
- substrs = ['error: --count, --start-index and --end-index cannot be all specified in the same invocation'])
+ self.runCmd('breakpoint list', check=False, inHistory=True) # 0
+ self.runCmd('register read', check=False, inHistory=True) # 1
+ self.runCmd('apropos hello', check=False, inHistory=True) # 2
+ self.runCmd('memory write', check=False, inHistory=True) # 3
+ self.runCmd('log list', check=False, inHistory=True) # 4
+ self.runCmd('disassemble', check=False, inHistory=True) # 5
+ self.runCmd('expression 1', check=False, inHistory=True) # 6
+ self.runCmd(
+ 'type summary list -w default',
+ check=False,
+ inHistory=True) # 7
+ self.runCmd('version', check=False, inHistory=True) # 8
+ self.runCmd('frame select 1', check=False, inHistory=True) # 9
+
+ self.expect(
+ "command history -s 3 -c 3",
+ inHistory=True,
+ substrs=[
+ '3: memory write',
+ '4: log list',
+ '5: disassemble'])
+
+ self.expect("command history -s 3 -e 3", inHistory=True,
+ substrs=['3: memory write'])
+
+ self.expect(
+ "command history -s 6 -e 7",
+ inHistory=True,
+ substrs=[
+ '6: expression 1',
+ '7: type summary list -w default'])
+
+ self.expect("command history -c 2", inHistory=True,
+ substrs=['0: breakpoint list', '1: register read'])
+
+ self.expect("command history -e 3 -c 1", inHistory=True,
+ substrs=['3: memory write'])
+
+ self.expect(
+ "command history -e 2",
+ inHistory=True,
+ substrs=[
+ '0: breakpoint list',
+ '1: register read',
+ '2: apropos hello'])
+
+ self.expect(
+ "command history -s 12",
+ inHistory=True,
+ substrs=[
+ '12: command history -s 6 -e 7',
+ '13: command history -c 2',
+ '14: command history -e 3 -c 1',
+ '15: command history -e 2',
+ '16: command history -s 12'])
+
+ self.expect(
+ "command history -s end -c 3",
+ inHistory=True,
+ substrs=[
+ '15: command history -e 2',
+ '16: command history -s 12',
+ '17: command history -s end -c 3'])
+
+ self.expect(
+ "command history -s end -e 15",
+ inHistory=True,
+ substrs=[
+ '15: command history -e 2',
+ '16: command history -s 12',
+ '17: command history -s end -c 3',
+ 'command history -s end -e 15'])
+
+ self.expect("command history -s 5 -c 1", inHistory=True,
+ substrs=['5: disassemble'])
+
+ self.expect("command history -c 1 -s 5", inHistory=True,
+ substrs=['5: disassemble'])
+
+ self.expect("command history -c 1 -e 3", inHistory=True,
+ substrs=['3: memory write'])
+
+ self.expect(
+ "command history -c 1 -e 3 -s 5",
+ error=True,
+ inHistory=True,
+ substrs=['error: --count, --start-index and --end-index cannot be all specified in the same invocation'])
diff --git a/packages/Python/lldbsuite/test/functionalities/command_regex/TestCommandRegex.py b/packages/Python/lldbsuite/test/functionalities/command_regex/TestCommandRegex.py
index 5b680ec65de5..e1c5b4b48258 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_regex/TestCommandRegex.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_regex/TestCommandRegex.py
@@ -5,18 +5,20 @@ Test lldb 'commands regex' command which allows the user to create a regular exp
from __future__ import print_function
-
import os
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class CommandRegexTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
+ @expectedFailureAll(
+ hostoslist=["windows"],
+ bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
@no_debug_info_test
def test_command_regex(self):
"""Test a simple scenario of 'command regex' invocation and subsequent use."""
@@ -25,7 +27,8 @@ class CommandRegexTestCase(TestBase):
regex_prompt = "Enter one of more sed substitution commands in the form: 's/<regex>/<subst>/'.\r\nTerminate the substitution list with an empty line.\r\n"
regex_prompt1 = "\r\n"
- child = pexpect.spawn('%s %s' % (lldbtest_config.lldbExec, self.lldbOption))
+ child = pexpect.spawn('%s %s' %
+ (lldbtest_config.lldbExec, self.lldbOption))
# Turn on logging for what the child sends back.
if self.TraceOn():
child.logfile_read = sys.stdout
@@ -44,11 +47,13 @@ class CommandRegexTestCase(TestBase):
child.sendline('Help__')
# If we see the familiar 'help' output, the test is done.
child.expect('Debugger commands:')
- # Try and incorrectly remove "Help__" using "command unalias" and verify we fail
+ # Try and incorrectly remove "Help__" using "command unalias" and
+ # verify we fail
child.sendline('command unalias Help__')
- child.expect_exact("error: 'Help__' is not an alias, it is a debugger command which can be removed using the 'command delete' command")
+ child.expect_exact(
+ "error: 'Help__' is not an alias, it is a debugger command which can be removed using the 'command delete' command")
child.expect_exact(prompt)
-
+
# Delete the regex command using "command delete"
child.sendline('command delete Help__')
child.expect_exact(prompt)
diff --git a/packages/Python/lldbsuite/test/functionalities/command_script/TestCommandScript.py b/packages/Python/lldbsuite/test/functionalities/command_script/TestCommandScript.py
index 97e52231e818..d562cb1511ac 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_script/TestCommandScript.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_script/TestCommandScript.py
@@ -5,33 +5,34 @@ Test lldb Python commands.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
+
class CmdPythonTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- def test (self):
- self.build ()
- self.pycmd_tests ()
+ def test(self):
+ self.build()
+ self.pycmd_tests()
- def pycmd_tests (self):
+ def pycmd_tests(self):
self.runCmd("command source py_import")
# Verify command that specifies eCommandRequiresTarget returns failure
# without a target.
self.expect('targetname',
- substrs = ['a.out'], matching=False, error=True)
+ substrs=['a.out'], matching=False, error=True)
- exe = os.path.join (os.getcwd(), "a.out")
+ exe = os.path.join(os.getcwd(), "a.out")
self.expect("file " + exe,
- patterns = [ "Current executable set to .*a.out" ])
+ patterns=["Current executable set to .*a.out"])
self.expect('targetname',
- substrs = ['a.out'], matching=True, error=False)
+ substrs=['a.out'], matching=True, error=False)
# This is the function to remove the custom commands in order to have a
# clean slate for the next test case.
@@ -57,86 +58,89 @@ class CmdPythonTestCase(TestBase):
self.HideStdout()
self.expect('welcome Enrico',
- substrs = ['Hello Enrico, welcome to LLDB']);
-
+ substrs=['Hello Enrico, welcome to LLDB'])
+
self.expect("help welcome",
- substrs = ['Just a docstring for welcome_impl',
- 'A command that says hello to LLDB users'])
+ substrs=['Just a docstring for welcome_impl',
+ 'A command that says hello to LLDB users'])
self.expect("help",
- substrs = ['For more information run',
- 'welcome'])
+ substrs=['For more information run',
+ 'welcome'])
self.expect("help -a",
- substrs = ['For more information run',
- 'welcome'])
+ substrs=['For more information run',
+ 'welcome'])
self.expect("help -u", matching=False,
- substrs = ['For more information run'])
+ substrs=['For more information run'])
- self.runCmd("command script delete welcome");
+ self.runCmd("command script delete welcome")
self.expect('welcome Enrico', matching=False, error=True,
- substrs = ['Hello Enrico, welcome to LLDB']);
+ substrs=['Hello Enrico, welcome to LLDB'])
self.expect('targetname fail', error=True,
- substrs = ['a test for error in command'])
+ substrs=['a test for error in command'])
self.expect('command script list',
- substrs = ['targetname',
- 'For more information run'])
+ substrs=['targetname',
+ 'For more information run'])
self.expect("help targetname",
- substrs = ['Expects', '\'raw\'', 'input',
- 'help', 'raw-input'])
+ substrs=['Expects', '\'raw\'', 'input',
+ 'help', 'raw-input'])
self.expect("longwait",
- substrs = ['Done; if you saw the delays I am doing OK'])
+ substrs=['Done; if you saw the delays I am doing OK'])
self.runCmd("b main")
self.runCmd("run")
self.runCmd("mysto 3")
self.expect("frame variable array",
- substrs = ['[0] = 79630','[1] = 388785018','[2] = 0'])
+ substrs=['[0] = 79630', '[1] = 388785018', '[2] = 0'])
self.runCmd("mysto 3")
self.expect("frame variable array",
- substrs = ['[0] = 79630','[4] = 388785018','[5] = 0'])
+ substrs=['[0] = 79630', '[4] = 388785018', '[5] = 0'])
# we cannot use the stepover command to check for async execution mode since LLDB
# seems to get confused when events start to queue up
self.expect("tell_sync",
- substrs = ['running sync'])
+ substrs=['running sync'])
self.expect("tell_async",
- substrs = ['running async'])
+ substrs=['running async'])
self.expect("tell_curr",
- substrs = ['I am running sync'])
-
+ substrs=['I am running sync'])
+
# check that the execution context is passed in to commands that ask for it
- self.expect("takes_exe_ctx", substrs = ["a.out"])
+ self.expect("takes_exe_ctx", substrs=["a.out"])
# Test that a python command can redefine itself
self.expect('command script add -f foobar welcome -h "just some help"')
-
+
self.runCmd("command script clear")
# Test that re-defining an existing command works
- self.runCmd('command script add my_command --class welcome.WelcomeCommand')
- self.expect('my_command Blah', substrs = ['Hello Blah, welcome to LLDB'])
+ self.runCmd(
+ 'command script add my_command --class welcome.WelcomeCommand')
+ self.expect('my_command Blah', substrs=['Hello Blah, welcome to LLDB'])
- self.runCmd('command script add my_command --class welcome.TargetnameCommand')
- self.expect('my_command', substrs = ['a.out'])
+ self.runCmd(
+ 'command script add my_command --class welcome.TargetnameCommand')
+ self.expect('my_command', substrs=['a.out'])
self.runCmd("command script clear")
-
+
self.expect('command script list', matching=False,
- substrs = ['targetname',
- 'longwait'])
+ substrs=['targetname',
+ 'longwait'])
self.expect('command script add -f foobar frame', error=True,
- substrs = ['cannot add command'])
+ substrs=['cannot add command'])
# http://llvm.org/bugs/show_bug.cgi?id=11569
- # LLDBSwigPythonCallCommand crashes when a command script returns an object
+ # LLDBSwigPythonCallCommand crashes when a command script returns an
+ # object
self.runCmd('command script add -f bug11569 bug11569')
# This should not crash.
self.runCmd('bug11569', check=False)
diff --git a/packages/Python/lldbsuite/test/functionalities/command_script/bug11569.py b/packages/Python/lldbsuite/test/functionalities/command_script/bug11569.py
index 93897d88098f..3c124de79bf3 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_script/bug11569.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_script/bug11569.py
@@ -3,5 +3,4 @@ def bug11569(debugger, args, result, dict):
http://llvm.org/bugs/show_bug.cgi?id=11569
LLDBSwigPythonCallCommand crashes when a command script returns an object.
"""
- return ["return", "a", "non-string", "should", "not", "crash", "LLDB"];
-
+ return ["return", "a", "non-string", "should", "not", "crash", "LLDB"]
diff --git a/packages/Python/lldbsuite/test/functionalities/command_script/import/TestImport.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/TestImport.py
index 01c3f35bf300..01e7902b0f32 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_script/import/TestImport.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_script/import/TestImport.py
@@ -3,13 +3,15 @@
from __future__ import print_function
-
-import os, sys, time
+import os
+import sys
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ImportTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -47,29 +49,31 @@ class ImportTestCase(TestBase):
self.runCmd("command script import ./bar/bar.py --allow-reload")
self.expect("command script import ./nosuchfile.py",
- error=True, startstr='error: module importing failed')
+ error=True, startstr='error: module importing failed')
self.expect("command script import ./nosuchfolder/",
- error=True, startstr='error: module importing failed')
+ error=True, startstr='error: module importing failed')
self.expect("command script import ./foo/foo.py", error=False)
self.runCmd("command script import --allow-reload ./thepackage")
- self.expect("TPcommandA",substrs=["hello world A"])
- self.expect("TPcommandB",substrs=["hello world B"])
+ self.expect("TPcommandA", substrs=["hello world A"])
+ self.expect("TPcommandB", substrs=["hello world B"])
self.runCmd("script import dummymodule")
self.expect("command script import ./dummymodule.py", error=False)
- self.expect("command script import --allow-reload ./dummymodule.py", error=False)
+ self.expect(
+ "command script import --allow-reload ./dummymodule.py",
+ error=False)
self.runCmd("command script add -f foo.foo_function foocmd")
self.runCmd("command script add -f foobar.foo_function foobarcmd")
self.runCmd("command script add -f bar.bar_function barcmd")
self.expect("foocmd hello",
- substrs = ['foo says', 'hello'])
+ substrs=['foo says', 'hello'])
self.expect("foo2cmd hello",
- substrs = ['foo2 says', 'hello'])
+ substrs=['foo2 says', 'hello'])
self.expect("barcmd hello",
- substrs = ['barutil says', 'bar told me', 'hello'])
+ substrs=['barutil says', 'bar told me', 'hello'])
self.expect("barothercmd hello",
- substrs = ['barutil says', 'bar told me', 'hello'])
+ substrs=['barutil says', 'bar told me', 'hello'])
self.expect("foobarcmd hello",
- substrs = ['foobar says', 'hello'])
+ substrs=['foobar says', 'hello'])
diff --git a/packages/Python/lldbsuite/test/functionalities/command_script/import/bar/bar.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/bar/bar.py
index bbc41f3b217d..444e00976ad9 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_script/import/bar/bar.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_script/import/bar/bar.py
@@ -1,12 +1,15 @@
from __future__ import print_function
+
def bar_function(debugger, args, result, dict):
- global UtilityModule
- print(UtilityModule.barutil_function("bar told me " + args), file=result)
- return None
+ global UtilityModule
+ print(UtilityModule.barutil_function("bar told me " + args), file=result)
+ return None
+
def __lldb_init_module(debugger, session_dict):
- global UtilityModule
- UtilityModule = __import__("barutil")
- debugger.HandleCommand("command script add -f bar.bar_function barothercmd")
- return None \ No newline at end of file
+ global UtilityModule
+ UtilityModule = __import__("barutil")
+ debugger.HandleCommand(
+ "command script add -f bar.bar_function barothercmd")
+ return None
diff --git a/packages/Python/lldbsuite/test/functionalities/command_script/import/bar/barutil.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/bar/barutil.py
index 0d3d2eb1b2d7..70ecea300578 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_script/import/bar/barutil.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_script/import/bar/barutil.py
@@ -1,2 +1,2 @@
def barutil_function(x):
- return "barutil says: " + x
+ return "barutil says: " + x
diff --git a/packages/Python/lldbsuite/test/functionalities/command_script/import/dummymodule.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/dummymodule.py
index dcc724ec9c23..668a5b90ea4f 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_script/import/dummymodule.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_script/import/dummymodule.py
@@ -1,2 +1,2 @@
def no_useful_code(foo):
- return foo
+ return foo
diff --git a/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/bar/foobar.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/bar/foobar.py
index 659ded22c901..6ef71064c9a9 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/bar/foobar.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/bar/foobar.py
@@ -1,5 +1,6 @@
from __future__ import print_function
+
def foo_function(debugger, args, result, dict):
- print("foobar says " + args, file=result)
- return None
+ print("foobar says " + args, file=result)
+ return None
diff --git a/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/foo.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/foo.py
index 51cc0c3bab19..1ccc38929396 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/foo.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/foo.py
@@ -1,5 +1,6 @@
from __future__ import print_function
+
def foo_function(debugger, args, result, dict):
- print("foo says " + args, file=result)
- return None
+ print("foo says " + args, file=result)
+ return None
diff --git a/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/foo2.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/foo2.py
index 6863454ca6ef..71657c299c21 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/foo2.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_script/import/foo/foo2.py
@@ -1,9 +1,11 @@
from __future__ import print_function
+
def foo2_function(debugger, args, result, dict):
- print("foo2 says " + args, file=result)
- return None
+ print("foo2 says " + args, file=result)
+ return None
+
def __lldb_init_module(debugger, session_dict):
- debugger.HandleCommand("command script add -f foo2.foo2_function foo2cmd")
- return None \ No newline at end of file
+ debugger.HandleCommand("command script add -f foo2.foo2_function foo2cmd")
+ return None
diff --git a/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/TestRdar12586188.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/TestRdar12586188.py
index 4f7ebebd4dd2..01fd51385836 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/TestRdar12586188.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/TestRdar12586188.py
@@ -3,13 +3,15 @@
from __future__ import print_function
-
-import os, sys, time
+import os
+import sys
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class Rdar12586188TestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -27,7 +29,11 @@ class Rdar12586188TestCase(TestBase):
def run_test(self):
"""Check that we handle an ImportError in a special way when command script importing files."""
- self.expect("command script import ./fail12586188.py --allow-reload",
- error=True, substrs = ['raise ImportError("I do not want to be imported")'])
- self.expect("command script import ./fail212586188.py --allow-reload",
- error=True, substrs = ['raise ValueError("I do not want to be imported")'])
+ self.expect(
+ "command script import ./fail12586188.py --allow-reload",
+ error=True,
+ substrs=['raise ImportError("I do not want to be imported")'])
+ self.expect(
+ "command script import ./fail212586188.py --allow-reload",
+ error=True,
+ substrs=['raise ValueError("I do not want to be imported")'])
diff --git a/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/fail12586188.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/fail12586188.py
index add85a73f853..ea385e03e046 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/fail12586188.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/fail12586188.py
@@ -1,4 +1,4 @@
def f(x):
- return x + 1
+ return x + 1
raise ImportError("I do not want to be imported")
diff --git a/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/fail212586188.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/fail212586188.py
index 1549a036590f..8dbc0e67ba19 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/fail212586188.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_script/import/rdar-12586188/fail212586188.py
@@ -1,4 +1,4 @@
def f(x):
- return x + 1
+ return x + 1
raise ValueError("I do not want to be imported")
diff --git a/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitA.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitA.py
index fb65305d205c..9694b084295f 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitA.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitA.py
@@ -1,6 +1,7 @@
import six
+
def command(debugger, command, result, internal_dict):
- result.PutCString(six.u("hello world A"))
- return None
+ result.PutCString(six.u("hello world A"))
+ return None
diff --git a/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitB.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitB.py
index 60b31b89f6da..94a333bc696b 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitB.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/TPunitB.py
@@ -1,6 +1,7 @@
import six
+
def command(debugger, command, result, internal_dict):
- result.PutCString(six.u("hello world B"))
- return None
+ result.PutCString(six.u("hello world B"))
+ return None
diff --git a/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/__init__.py b/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/__init__.py
index 1181462af868..24cdea60f2c4 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/__init__.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_script/import/thepackage/__init__.py
@@ -3,6 +3,9 @@ from __future__ import absolute_import
from . import TPunitA
from . import TPunitB
-def __lldb_init_module(debugger,*args):
- debugger.HandleCommand("command script add -f thepackage.TPunitA.command TPcommandA")
- debugger.HandleCommand("command script add -f thepackage.TPunitB.command TPcommandB")
+
+def __lldb_init_module(debugger, *args):
+ debugger.HandleCommand(
+ "command script add -f thepackage.TPunitA.command TPcommandA")
+ debugger.HandleCommand(
+ "command script add -f thepackage.TPunitB.command TPcommandB")
diff --git a/packages/Python/lldbsuite/test/functionalities/command_script/mysto.py b/packages/Python/lldbsuite/test/functionalities/command_script/mysto.py
index 656cd1502930..88a20cb4567f 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_script/mysto.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_script/mysto.py
@@ -5,19 +5,21 @@ import sys
import os
import time
+
def StepOver(debugger, args, result, dict):
- """
- Step over a given number of times instead of only just once
- """
- arg_split = args.split(" ")
- print(type(arg_split))
- count = int(arg_split[0])
- for i in range(0,count):
- debugger.GetSelectedTarget().GetProcess().GetSelectedThread().StepOver(lldb.eOnlyThisThread)
- print("step<%d>"%i)
+ """
+ Step over a given number of times instead of only just once
+ """
+ arg_split = args.split(" ")
+ print(type(arg_split))
+ count = int(arg_split[0])
+ for i in range(0, count):
+ debugger.GetSelectedTarget().GetProcess(
+ ).GetSelectedThread().StepOver(lldb.eOnlyThisThread)
+ print("step<%d>" % i)
-def __lldb_init_module(debugger, session_dict):
- # by default, --synchronicity is set to synchronous
- debugger.HandleCommand("command script add -f mysto.StepOver mysto")
- return None
+def __lldb_init_module(debugger, session_dict):
+ # by default, --synchronicity is set to synchronous
+ debugger.HandleCommand("command script add -f mysto.StepOver mysto")
+ return None
diff --git a/packages/Python/lldbsuite/test/functionalities/command_script/welcome.py b/packages/Python/lldbsuite/test/functionalities/command_script/welcome.py
index 5dbf09fbbec2..0539d7c17211 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_script/welcome.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_script/welcome.py
@@ -1,18 +1,23 @@
from __future__ import print_function
-import lldb, sys
+import lldb
+import sys
+
class WelcomeCommand(object):
+
def __init__(self, debugger, session_dict):
pass
-
+
def get_short_help(self):
return "Just a docstring for welcome_impl\nA command that says hello to LLDB users"
-
+
def __call__(self, debugger, args, exe_ctx, result):
- print('Hello ' + args + ', welcome to LLDB', file=result);
- return None;
+ print('Hello ' + args + ', welcome to LLDB', file=result)
+ return None
+
class TargetnameCommand(object):
+
def __init__(self, debugger, session_dict):
pass
@@ -22,10 +27,11 @@ class TargetnameCommand(object):
print('Current target ' + file.GetFilename(), file=result)
if args == 'fail':
result.SetError('a test for error in command')
-
+
def get_flags(self):
return lldb.eCommandRequiresTarget
+
def print_wait_impl(debugger, args, result, dict):
result.SetImmediateOutputFile(sys.stdout)
print('Trying to do long task..', file=result)
@@ -35,12 +41,13 @@ def print_wait_impl(debugger, args, result, dict):
time.sleep(1)
print('Done; if you saw the delays I am doing OK', file=result)
+
def check_for_synchro(debugger, args, result, dict):
- if debugger.GetAsync() == True:
+ if debugger.GetAsync():
print('I am running async', file=result)
if debugger.GetAsync() == False:
print('I am running sync', file=result)
+
def takes_exe_ctx(debugger, args, exe_ctx, result, dict):
print(str(exe_ctx.GetTarget()), file=result)
-
diff --git a/packages/Python/lldbsuite/test/functionalities/command_script_alias/TestCommandScriptAlias.py b/packages/Python/lldbsuite/test/functionalities/command_script_alias/TestCommandScriptAlias.py
index 694728a9f9c0..eb63c7079893 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_script_alias/TestCommandScriptAlias.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_script_alias/TestCommandScriptAlias.py
@@ -5,18 +5,20 @@ Test lldb Python commands.
from __future__ import print_function
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
+
class CommandScriptAliasTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- def test (self):
- self.pycmd_tests ()
+ def test(self):
+ self.pycmd_tests()
- def pycmd_tests (self):
+ def pycmd_tests(self):
self.runCmd("command script import tcsacmd.py")
self.runCmd("command script add -f tcsacmd.some_command_here attach")
@@ -32,6 +34,7 @@ class CommandScriptAliasTestCase(TestBase):
if not self.TraceOn():
self.HideStdout()
- self.expect('attach a', substrs = ['Victory is mine']);
+ self.expect('attach a', substrs=['Victory is mine'])
self.runCmd("command script delete attach")
- self.runCmd('attach noprocessexistswiththisname', check=False) # this can't crash but we don't care whether the actual attach works
+ # this can't crash but we don't care whether the actual attach works
+ self.runCmd('attach noprocessexistswiththisname', check=False)
diff --git a/packages/Python/lldbsuite/test/functionalities/command_script_alias/tcsacmd.py b/packages/Python/lldbsuite/test/functionalities/command_script_alias/tcsacmd.py
index 6c60e3ca1a55..d5bb6131210c 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_script_alias/tcsacmd.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_script_alias/tcsacmd.py
@@ -1,11 +1,12 @@
from __future__ import print_function
-import lldb, sys
+import lldb
+import sys
-def some_command_here(debugger, command, result, d):
- if command == "a":
- print("Victory is mine", file=result)
- return True
- else:
- print("Sadness for all", file=result)
- return False
+def some_command_here(debugger, command, result, d):
+ if command == "a":
+ print("Victory is mine", file=result)
+ return True
+ else:
+ print("Sadness for all", file=result)
+ return False
diff --git a/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py b/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
index a843d08a97d4..975ad32689b2 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
@@ -5,14 +5,15 @@ Test that LLDB correctly allows scripted commands to set an immediate output fil
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test.lldbpexpect import *
from lldbsuite.test import lldbutil
+
class CommandScriptImmediateOutputTestCase (PExpectTest):
mydir = TestBase.compute_mydir(__file__)
@@ -22,10 +23,12 @@ class CommandScriptImmediateOutputTestCase (PExpectTest):
# Call super's setUp().
PExpectTest.setUp(self)
- @skipIfRemote # test not remote-ready llvm.org/pr24813
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
+ @skipIfRemote # test not remote-ready llvm.org/pr24813
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
@expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr26139")
- def test_command_script_immediate_output_console (self):
+ def test_command_script_immediate_output_console(self):
"""Test that LLDB correctly allows scripted commands to set immediate output to the console."""
self.launch(timeout=10)
@@ -33,27 +36,33 @@ class CommandScriptImmediateOutputTestCase (PExpectTest):
prompt = "\(lldb\) "
self.sendline('command script import %s' % script, patterns=[prompt])
- self.sendline('command script add -f custom_command.command_function mycommand', patterns=[prompt])
- self.sendline('mycommand', patterns='this is a test string, just a test string')
+ self.sendline(
+ 'command script add -f custom_command.command_function mycommand',
+ patterns=[prompt])
+ self.sendline(
+ 'mycommand',
+ patterns='this is a test string, just a test string')
self.sendline('command script delete mycommand', patterns=[prompt])
self.quit(gracefully=False)
- @skipIfRemote # test not remote-ready llvm.org/pr24813
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
+ @skipIfRemote # test not remote-ready llvm.org/pr24813
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
@expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr26139")
- def test_command_script_immediate_output_file (self):
+ def test_command_script_immediate_output_file(self):
"""Test that LLDB correctly allows scripted commands to set immediate output to a file."""
self.launch(timeout=10)
- test_files = {os.path.join(os.getcwd(), 'read.txt') :'r',
- os.path.join(os.getcwd(), 'write.txt') :'w',
- os.path.join(os.getcwd(), 'append.txt') :'a',
- os.path.join(os.getcwd(), 'write_plus.txt') :'w+',
- os.path.join(os.getcwd(), 'read_plus.txt') :'r+',
- os.path.join(os.getcwd(), 'append_plus.txt') :'a+'}
+ test_files = {os.path.join(os.getcwd(), 'read.txt'): 'r',
+ os.path.join(os.getcwd(), 'write.txt'): 'w',
+ os.path.join(os.getcwd(), 'append.txt'): 'a',
+ os.path.join(os.getcwd(), 'write_plus.txt'): 'w+',
+ os.path.join(os.getcwd(), 'read_plus.txt'): 'r+',
+ os.path.join(os.getcwd(), 'append_plus.txt'): 'a+'}
starter_string = 'Starter Garbage\n'
- write_string = 'writing to file with mode: '
+ write_string = 'writing to file with mode: '
for path, mode in test_files.iteritems():
with open(path, 'w+') as init:
@@ -64,7 +73,9 @@ class CommandScriptImmediateOutputTestCase (PExpectTest):
self.sendline('command script import %s' % script, patterns=[prompt])
- self.sendline('command script add -f custom_command.write_file mywrite', patterns=[prompt])
+ self.sendline(
+ 'command script add -f custom_command.write_file mywrite',
+ patterns=[prompt])
for path, mode in test_files.iteritems():
command = 'mywrite "' + path + '" ' + mode
@@ -79,8 +90,8 @@ class CommandScriptImmediateOutputTestCase (PExpectTest):
if mode in ['r', 'a', 'a+']:
self.assertEquals(result.readline(), starter_string)
if mode in ['w', 'w+', 'r+', 'a', 'a+']:
- self.assertEquals(result.readline(), write_string + mode + '\n')
+ self.assertEquals(
+ result.readline(), write_string + mode + '\n')
self.assertTrue(os.path.isfile(path))
os.remove(path)
-
diff --git a/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/custom_command.py b/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/custom_command.py
index 30a3cfb9093c..e0c24055c838 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/custom_command.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/custom_command.py
@@ -3,15 +3,17 @@ from __future__ import print_function
import sys
import shlex
+
def command_function(debugger, command, exe_ctx, result, internal_dict):
- result.SetImmediateOutputFile(sys.__stdout__)
- print('this is a test string, just a test string', file=result)
+ result.SetImmediateOutputFile(sys.__stdout__)
+ print('this is a test string, just a test string', file=result)
+
def write_file(debugger, command, exe_ctx, result, internal_dict):
- args = shlex.split(command)
- path = args[0]
- mode = args[1]
- with open(path, mode) as f:
- result.SetImmediateOutputFile(f)
- if not mode in ['r']:
- print('writing to file with mode: ' + mode, file=result)
+ args = shlex.split(command)
+ path = args[0]
+ mode = args[1]
+ with open(path, mode) as f:
+ result.SetImmediateOutputFile(f)
+ if not mode in ['r']:
+ print('writing to file with mode: ' + mode, file=result)
diff --git a/packages/Python/lldbsuite/test/functionalities/command_source/TestCommandSource.py b/packages/Python/lldbsuite/test/functionalities/command_source/TestCommandSource.py
index 0d4eb0776e79..cee9bd272189 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_source/TestCommandSource.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_source/TestCommandSource.py
@@ -7,13 +7,14 @@ See also http://llvm.org/viewvc/llvm-project?view=rev&revision=109673.
from __future__ import print_function
-
-import os, sys
+import os
+import sys
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class CommandSourceTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -35,4 +36,4 @@ class CommandSourceTestCase(TestBase):
import datetime
self.expect(result.GetOutput(), "script my.date() runs successfully",
exe=False,
- substrs = [str(datetime.date.today())])
+ substrs=[str(datetime.date.today())])
diff --git a/packages/Python/lldbsuite/test/functionalities/command_source/my.py b/packages/Python/lldbsuite/test/functionalities/command_source/my.py
index cb2fd012e4bd..bd97fda3cbbf 100644
--- a/packages/Python/lldbsuite/test/functionalities/command_source/my.py
+++ b/packages/Python/lldbsuite/test/functionalities/command_source/my.py
@@ -1,5 +1,6 @@
from __future__ import print_function
+
def date():
import datetime
today = datetime.date.today()
diff --git a/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py b/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
index 7a9ded03ad20..9f55f64b2be5 100644
--- a/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
+++ b/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
@@ -5,7 +5,6 @@ Test the lldb command line completion mechanism.
from __future__ import print_function
-
import os
import lldb
from lldbsuite.test.decorators import *
@@ -13,6 +12,7 @@ from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbplatform
from lldbsuite.test import lldbutil
+
class CommandLineCompletionTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -27,29 +27,31 @@ class CommandLineCompletionTestCase(TestBase):
pass
@expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr24679")
- @skipIfFreeBSD # timing out on the FreeBSD buildbot
+ @skipIfFreeBSD # timing out on the FreeBSD buildbot
@no_debug_info_test
def test_at(self):
"""Test that 'at' completes to 'attach '."""
self.complete_from_to('at', 'attach ')
@expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr24679")
- @skipIfFreeBSD # timing out on the FreeBSD buildbot
+ @skipIfFreeBSD # timing out on the FreeBSD buildbot
@no_debug_info_test
def test_de(self):
"""Test that 'de' completes to 'detach '."""
self.complete_from_to('de', 'detach ')
@expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr24679")
- @skipIfFreeBSD # timing out on the FreeBSD buildbot
+ @skipIfFreeBSD # timing out on the FreeBSD buildbot
@no_debug_info_test
def test_process_attach_dash_dash_con(self):
"""Test that 'process attach --con' completes to 'process attach --continue '."""
- self.complete_from_to('process attach --con', 'process attach --continue ')
+ self.complete_from_to(
+ 'process attach --con',
+ 'process attach --continue ')
# <rdar://problem/11052829>
@expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr24679")
- @skipIfFreeBSD # timing out on the FreeBSD buildbot
+ @skipIfFreeBSD # timing out on the FreeBSD buildbot
@no_debug_info_test
def test_infinite_loop_while_completing(self):
"""Test that 'process print hello\' completes to itself and does not infinite loop."""
@@ -57,147 +59,176 @@ class CommandLineCompletionTestCase(TestBase):
turn_off_re_match=True)
@expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr24679")
- @skipIfFreeBSD # timing out on the FreeBSD buildbot
+ @skipIfFreeBSD # timing out on the FreeBSD buildbot
@no_debug_info_test
def test_watchpoint_co(self):
"""Test that 'watchpoint co' completes to 'watchpoint command '."""
self.complete_from_to('watchpoint co', 'watchpoint command ')
@expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr24679")
- @skipIfFreeBSD # timing out on the FreeBSD buildbot
+ @skipIfFreeBSD # timing out on the FreeBSD buildbot
@no_debug_info_test
def test_watchpoint_command_space(self):
"""Test that 'watchpoint command ' completes to ['Available completions:', 'add', 'delete', 'list']."""
- self.complete_from_to('watchpoint command ', ['Available completions:', 'add', 'delete', 'list'])
+ self.complete_from_to(
+ 'watchpoint command ', [
+ 'Available completions:', 'add', 'delete', 'list'])
@expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr24679")
- @skipIfFreeBSD # timing out on the FreeBSD buildbot
+ @skipIfFreeBSD # timing out on the FreeBSD buildbot
@no_debug_info_test
def test_watchpoint_command_a(self):
"""Test that 'watchpoint command a' completes to 'watchpoint command add '."""
- self.complete_from_to('watchpoint command a', 'watchpoint command add ')
+ self.complete_from_to(
+ 'watchpoint command a',
+ 'watchpoint command add ')
@expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr24679")
- @skipIfFreeBSD # timing out on the FreeBSD buildbot
+ @skipIfFreeBSD # timing out on the FreeBSD buildbot
@no_debug_info_test
def test_watchpoint_set_variable_dash_w(self):
"""Test that 'watchpoint set variable -w' completes to 'watchpoint set variable -w '."""
- self.complete_from_to('watchpoint set variable -w', 'watchpoint set variable -w ')
+ self.complete_from_to(
+ 'watchpoint set variable -w',
+ 'watchpoint set variable -w ')
@expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr24679")
- @skipIfFreeBSD # timing out on the FreeBSD buildbot
+ @skipIfFreeBSD # timing out on the FreeBSD buildbot
@no_debug_info_test
def test_watchpoint_set_variable_dash_w_space(self):
"""Test that 'watchpoint set variable -w ' completes to ['Available completions:', 'read', 'write', 'read_write']."""
- self.complete_from_to('watchpoint set variable -w ', ['Available completions:', 'read', 'write', 'read_write'])
+ self.complete_from_to('watchpoint set variable -w ',
+ ['Available completions:', 'read', 'write', 'read_write'])
@expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr24679")
- @skipIfFreeBSD # timing out on the FreeBSD buildbot
+ @skipIfFreeBSD # timing out on the FreeBSD buildbot
@no_debug_info_test
def test_watchpoint_set_ex(self):
"""Test that 'watchpoint set ex' completes to 'watchpoint set expression '."""
- self.complete_from_to('watchpoint set ex', 'watchpoint set expression ')
+ self.complete_from_to(
+ 'watchpoint set ex',
+ 'watchpoint set expression ')
@expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr24679")
- @skipIfFreeBSD # timing out on the FreeBSD buildbot
+ @skipIfFreeBSD # timing out on the FreeBSD buildbot
@no_debug_info_test
def test_watchpoint_set_var(self):
"""Test that 'watchpoint set var' completes to 'watchpoint set variable '."""
self.complete_from_to('watchpoint set var', 'watchpoint set variable ')
@expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr24679")
- @skipIfFreeBSD # timing out on the FreeBSD buildbot
+ @skipIfFreeBSD # timing out on the FreeBSD buildbot
@no_debug_info_test
def test_watchpoint_set_variable_dash_w_read_underbar(self):
"""Test that 'watchpoint set variable -w read_' completes to 'watchpoint set variable -w read_write'."""
- self.complete_from_to('watchpoint set variable -w read_', 'watchpoint set variable -w read_write')
+ self.complete_from_to(
+ 'watchpoint set variable -w read_',
+ 'watchpoint set variable -w read_write')
@expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr24679")
- @skipIfFreeBSD # timing out on the FreeBSD buildbot
+ @skipIfFreeBSD # timing out on the FreeBSD buildbot
@no_debug_info_test
def test_help_fi(self):
"""Test that 'help fi' completes to ['Available completions:', 'file', 'finish']."""
- self.complete_from_to('help fi', ['Available completions:', 'file', 'finish'])
+ self.complete_from_to(
+ 'help fi', [
+ 'Available completions:', 'file', 'finish'])
@expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr24679")
- @skipIfFreeBSD # timing out on the FreeBSD buildbot
+ @skipIfFreeBSD # timing out on the FreeBSD buildbot
@no_debug_info_test
def test_help_watchpoint_s(self):
"""Test that 'help watchpoint s' completes to 'help watchpoint set '."""
self.complete_from_to('help watchpoint s', 'help watchpoint set ')
@expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr24679")
- @skipIfFreeBSD # timing out on the FreeBSD buildbot
+ @skipIfFreeBSD # timing out on the FreeBSD buildbot
@no_debug_info_test
def test_settings_append_target_er(self):
"""Test that 'settings append target.er' completes to 'settings append target.error-path'."""
- self.complete_from_to('settings append target.er', 'settings append target.error-path')
+ self.complete_from_to(
+ 'settings append target.er',
+ 'settings append target.error-path')
@expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr24679")
- @skipIfFreeBSD # timing out on the FreeBSD buildbot
+ @skipIfFreeBSD # timing out on the FreeBSD buildbot
@no_debug_info_test
def test_settings_insert_after_target_en(self):
"""Test that 'settings insert-after target.env' completes to 'settings insert-after target.env-vars'."""
- self.complete_from_to('settings insert-after target.env', 'settings insert-after target.env-vars')
+ self.complete_from_to(
+ 'settings insert-after target.env',
+ 'settings insert-after target.env-vars')
@expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr24679")
- @skipIfFreeBSD # timing out on the FreeBSD buildbot
+ @skipIfFreeBSD # timing out on the FreeBSD buildbot
@no_debug_info_test
def test_settings_insert_before_target_en(self):
"""Test that 'settings insert-before target.env' completes to 'settings insert-before target.env-vars'."""
- self.complete_from_to('settings insert-before target.env', 'settings insert-before target.env-vars')
+ self.complete_from_to(
+ 'settings insert-before target.env',
+ 'settings insert-before target.env-vars')
@expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr24679")
- @skipIfFreeBSD # timing out on the FreeBSD buildbot
+ @skipIfFreeBSD # timing out on the FreeBSD buildbot
@no_debug_info_test
def test_settings_replace_target_ru(self):
"""Test that 'settings replace target.ru' completes to 'settings replace target.run-args'."""
- self.complete_from_to('settings replace target.ru', 'settings replace target.run-args')
+ self.complete_from_to(
+ 'settings replace target.ru',
+ 'settings replace target.run-args')
@expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr24679")
- @skipIfFreeBSD # timing out on the FreeBSD buildbot
+ @skipIfFreeBSD # timing out on the FreeBSD buildbot
@no_debug_info_test
def test_settings_s(self):
"""Test that 'settings s' completes to ['Available completions:', 'set', 'show']."""
- self.complete_from_to('settings s', ['Available completions:', 'set', 'show'])
+ self.complete_from_to(
+ 'settings s', [
+ 'Available completions:', 'set', 'show'])
@expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr24679")
- @skipIfFreeBSD # timing out on the FreeBSD buildbot
+ @skipIfFreeBSD # timing out on the FreeBSD buildbot
@no_debug_info_test
def test_settings_set_th(self):
- """Test that 'settings set th' completes to 'settings set thread-format'."""
- self.complete_from_to('settings set th', 'settings set thread-format')
+ """Test that 'settings set thread-f' completes to 'settings set thread-format'."""
+ self.complete_from_to('settings set thread-f', 'settings set thread-format')
@expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr24679")
- @skipIfFreeBSD # timing out on the FreeBSD buildbot
+ @skipIfFreeBSD # timing out on the FreeBSD buildbot
@no_debug_info_test
def test_settings_s_dash(self):
"""Test that 'settings set -' completes to 'settings set -g'."""
self.complete_from_to('settings set -', 'settings set -g')
@expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr24679")
- @skipIfFreeBSD # timing out on the FreeBSD buildbot
+ @skipIfFreeBSD # timing out on the FreeBSD buildbot
@no_debug_info_test
def test_settings_clear_th(self):
- """Test that 'settings clear th' completes to 'settings clear thread-format'."""
- self.complete_from_to('settings clear th', 'settings clear thread-format')
+ """Test that 'settings clear thread-f' completes to 'settings clear thread-format'."""
+ self.complete_from_to(
+ 'settings clear thread-f',
+ 'settings clear thread-format')
@expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr24679")
- @skipIfFreeBSD # timing out on the FreeBSD buildbot
+ @skipIfFreeBSD # timing out on the FreeBSD buildbot
@no_debug_info_test
def test_settings_set_ta(self):
"""Test that 'settings set ta' completes to 'settings set target.'."""
- self.complete_from_to('settings set target.ma', 'settings set target.max-')
+ self.complete_from_to(
+ 'settings set target.ma',
+ 'settings set target.max-')
@expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr24679")
- @skipIfFreeBSD # timing out on the FreeBSD buildbot
+ @skipIfFreeBSD # timing out on the FreeBSD buildbot
@no_debug_info_test
def test_settings_set_target_exec(self):
"""Test that 'settings set target.exec' completes to 'settings set target.exec-search-paths '."""
- self.complete_from_to('settings set target.exec', 'settings set target.exec-search-paths')
+ self.complete_from_to(
+ 'settings set target.exec',
+ 'settings set target.exec-search-paths')
@expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr24679")
- @skipIfFreeBSD # timing out on the FreeBSD buildbot
+ @skipIfFreeBSD # timing out on the FreeBSD buildbot
@no_debug_info_test
def test_settings_set_target_pr(self):
"""Test that 'settings set target.pr' completes to ['Available completions:',
@@ -208,21 +239,25 @@ class CommandLineCompletionTestCase(TestBase):
'target.process.'])
@expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr24679")
- @skipIfFreeBSD # timing out on the FreeBSD buildbot
+ @skipIfFreeBSD # timing out on the FreeBSD buildbot
@no_debug_info_test
def test_settings_set_target_process(self):
"""Test that 'settings set target.process' completes to 'settings set target.process.'."""
- self.complete_from_to('settings set target.process', 'settings set target.process.')
+ self.complete_from_to(
+ 'settings set target.process',
+ 'settings set target.process.')
@expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr24679")
- @skipIfFreeBSD # timing out on the FreeBSD buildbot
+ @skipIfFreeBSD # timing out on the FreeBSD buildbot
@no_debug_info_test
def test_settings_set_target_process_dot(self):
"""Test that 'settings set target.process.t' completes to 'settings set target.process.thread.'."""
- self.complete_from_to('settings set target.process.t', 'settings set target.process.thread.')
+ self.complete_from_to(
+ 'settings set target.process.t',
+ 'settings set target.process.thread.')
@expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr24679")
- @skipIfFreeBSD # timing out on the FreeBSD buildbot
+ @skipIfFreeBSD # timing out on the FreeBSD buildbot
@no_debug_info_test
def test_settings_set_target_process_thread_dot(self):
"""Test that 'settings set target.process.thread.' completes to ['Available completions:',
@@ -233,31 +268,39 @@ class CommandLineCompletionTestCase(TestBase):
'target.process.thread.trace-thread'])
@expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr24679")
- @skipIfFreeBSD # timing out on the FreeBSD buildbot
+ @skipIfFreeBSD # timing out on the FreeBSD buildbot
@no_debug_info_test
def test_target_space(self):
"""Test that 'target ' completes to ['Available completions:', 'create', 'delete', 'list',
'modules', 'select', 'stop-hook', 'variable']."""
self.complete_from_to('target ',
- ['Available completions:', 'create', 'delete', 'list',
- 'modules', 'select', 'stop-hook', 'variable'])
+ ['Available completions:',
+ 'create',
+ 'delete',
+ 'list',
+ 'modules',
+ 'select',
+ 'stop-hook',
+ 'variable'])
@expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr24679")
- @skipIfFreeBSD # timing out on the FreeBSD buildbot
+ @skipIfFreeBSD # timing out on the FreeBSD buildbot
@no_debug_info_test
def test_target_create_dash_co(self):
"""Test that 'target create --co' completes to 'target variable --core '."""
self.complete_from_to('target create --co', 'target create --core ')
@expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr24679")
- @skipIfFreeBSD # timing out on the FreeBSD buildbot
+ @skipIfFreeBSD # timing out on the FreeBSD buildbot
@no_debug_info_test
def test_target_va(self):
"""Test that 'target va' completes to 'target variable '."""
self.complete_from_to('target va', 'target variable ')
@expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr24679")
- @expectedFailureAll(oslist=lldbplatform.darwin_all, bugnumber="llvm.org/pr25485")
+ @expectedFailureAll(
+ oslist=lldbplatform.darwin_all,
+ bugnumber="llvm.org/pr25485,<rdar://problem/28573448>")
def test_symbol_name(self):
self.build()
self.complete_from_to('''file a.out
@@ -277,7 +320,7 @@ class CommandLineCompletionTestCase(TestBase):
# later on.
if not isinstance(patterns, list):
patterns = [patterns]
-
+
# The default lldb prompt.
prompt = "(lldb) "
@@ -304,7 +347,7 @@ class CommandLineCompletionTestCase(TestBase):
# stop further logging.
child.logfile_send = None
child.logfile_read = None
-
+
with open('child_send.txt', 'r') as fs:
if self.TraceOn():
print("\n\nContents of child_send.txt:")
@@ -318,10 +361,13 @@ class CommandLineCompletionTestCase(TestBase):
# The matching could be verbatim or using generic re pattern.
for p in patterns:
# Test that str_input completes to our patterns or substrings.
- # If each pattern/substring matches from_child, the completion mechanism works!
+ # If each pattern/substring matches from_child, the completion
+ # mechanism works!
if turn_off_re_match:
- self.expect(from_child, msg=COMPLETION_MSG(str_input, p), exe=False,
- substrs = [p])
+ self.expect(
+ from_child, msg=COMPLETION_MSG(
+ str_input, p), exe=False, substrs=[p])
else:
- self.expect(from_child, msg=COMPLETION_MSG(str_input, p), exe=False,
- patterns = [p])
+ self.expect(
+ from_child, msg=COMPLETION_MSG(
+ str_input, p), exe=False, patterns=[p])
diff --git a/packages/Python/lldbsuite/test/functionalities/conditional_break/TestConditionalBreak.py b/packages/Python/lldbsuite/test/functionalities/conditional_break/TestConditionalBreak.py
index 7fcb44f0b3ec..cec06e48f1cf 100644
--- a/packages/Python/lldbsuite/test/functionalities/conditional_break/TestConditionalBreak.py
+++ b/packages/Python/lldbsuite/test/functionalities/conditional_break/TestConditionalBreak.py
@@ -5,8 +5,8 @@ Test conditionally break on a function and inspect its variables.
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
@@ -18,6 +18,7 @@ from lldbsuite.test import lldbutil
#
# This class currently fails for clang as well as llvm-gcc.
+
class ConditionalBreakTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -33,7 +34,9 @@ class ConditionalBreakTestCase(TestBase):
self.build()
self.simulate_conditional_break_by_user()
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr26265: args in frames other than #0 are not evaluated correctly")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr26265: args in frames other than #0 are not evaluated correctly")
def do_conditional_break(self):
"""Exercise some thread and frame APIs to break if c() is called by a()."""
exe = os.path.join(os.getcwd(), "a.out")
@@ -45,7 +48,8 @@ class ConditionalBreakTestCase(TestBase):
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
@@ -54,7 +58,8 @@ class ConditionalBreakTestCase(TestBase):
STOPPED_DUE_TO_BREAKPOINT)
# Find the line number where a's parent frame function is c.
- line = line_number('main.c',
+ line = line_number(
+ 'main.c',
"// Find the line number where c's parent frame is a here.")
# Suppose we are only interested in the call scenario where c()'s
@@ -66,15 +71,17 @@ class ConditionalBreakTestCase(TestBase):
for j in range(10):
if self.TraceOn():
print("j is: ", j)
- thread = lldbutil.get_one_thread_stopped_at_breakpoint(process, breakpoint)
- self.assertIsNotNone(thread, "Expected one thread to be stopped at the breakpoint")
-
+ thread = lldbutil.get_one_thread_stopped_at_breakpoint(
+ process, breakpoint)
+ self.assertIsNotNone(
+ thread, "Expected one thread to be stopped at the breakpoint")
+
if thread.GetNumFrames() >= 2:
frame0 = thread.GetFrameAtIndex(0)
name0 = frame0.GetFunction().GetName()
frame1 = thread.GetFrameAtIndex(1)
name1 = frame1.GetFunction().GetName()
- #lldbutil.print_stacktrace(thread)
+ # lldbutil.print_stacktrace(thread)
self.assertTrue(name0 == "c", "Break on function c()")
if (name1 == "a"):
# By design, we know that a() calls c() only from main.c:27.
@@ -83,7 +90,8 @@ class ConditionalBreakTestCase(TestBase):
self.assertTrue(frame1.GetLineEntry().GetLine() == line,
"Immediate caller a() at main.c:%d" % line)
- # And the local variable 'val' should have a value of (int) 3.
+ # And the local variable 'val' should have a value of (int)
+ # 3.
val = frame1.FindVariable("val")
self.assertEqual("int", val.GetTypeName())
self.assertEqual("3", val.GetValue())
@@ -109,28 +117,28 @@ class ConditionalBreakTestCase(TestBase):
self.runCmd("file a.out")
self.runCmd("command source .lldb")
- self.runCmd ("break list")
+ self.runCmd("break list")
if self.TraceOn():
print("About to run.")
self.runCmd("run", RUN_SUCCEEDED)
- self.runCmd ("break list")
+ self.runCmd("break list")
if self.TraceOn():
print("Done running")
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped', 'stop reason = breakpoint'])
+ substrs=['stopped', 'stop reason = breakpoint'])
# The frame info for frame #0 points to a.out`c and its immediate caller
# (frame #1) points to a.out`a.
self.expect("frame info", "We should stop at c()",
- substrs = ["a.out`c"])
+ substrs=["a.out`c"])
# Select our parent frame as the current frame.
self.runCmd("frame select 1")
self.expect("frame info", "The immediate caller should be a()",
- substrs = ["a.out`a"])
+ substrs=["a.out`a"])
diff --git a/packages/Python/lldbsuite/test/functionalities/conditional_break/conditional_break.py b/packages/Python/lldbsuite/test/functionalities/conditional_break/conditional_break.py
index b30a34e56b14..a62dd923af9d 100644
--- a/packages/Python/lldbsuite/test/functionalities/conditional_break/conditional_break.py
+++ b/packages/Python/lldbsuite/test/functionalities/conditional_break/conditional_break.py
@@ -1,6 +1,7 @@
import sys
import lldb
+
def stop_if_called_from_a(frame, bp_loc, dict):
thread = frame.GetThread()
@@ -19,12 +20,11 @@ def stop_if_called_from_a(frame, bp_loc, dict):
should_stop = True
if thread.GetNumFrames() >= 2:
- if (thread.frames[0].function.name == 'c' and thread.frames[1].function.name == 'a'):
+ if (thread.frames[0].function.name ==
+ 'c' and thread.frames[1].function.name == 'a'):
should_stop = True
else:
should_stop = False
dbg.SetAsync(old_async)
return should_stop
-
-
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/basic/Makefile b/packages/Python/lldbsuite/test/functionalities/darwin_log/basic/Makefile
new file mode 100644
index 000000000000..b09a579159d4
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/basic/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+C_SOURCES := main.c
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/basic/TestDarwinLogBasic.py b/packages/Python/lldbsuite/test/functionalities/darwin_log/basic/TestDarwinLogBasic.py
new file mode 100644
index 000000000000..85281a97c572
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/basic/TestDarwinLogBasic.py
@@ -0,0 +1,35 @@
+"""
+Test basic DarwinLog functionality provided by the StructuredDataDarwinLog
+plugin.
+
+These tests are currently only supported when running against Darwin
+targets.
+"""
+
+# System imports
+from __future__ import print_function
+
+# LLDB imports
+from lldbsuite.test import darwin_log
+from lldbsuite.test import decorators
+from lldbsuite.test import lldbtest
+
+
+class TestDarwinLogBasic(darwin_log.DarwinLogEventBasedTestBase):
+
+ mydir = lldbtest.TestBase.compute_mydir(__file__)
+
+ @decorators.add_test_categories(['pyapi'])
+ @decorators.skipUnlessDarwin
+ @decorators.expectedFailureAll(archs=["i386"], bugnumber="rdar://28655626")
+ def test_SBStructuredData_gets_broadcasted(self):
+ """Exercise SBStructuredData API."""
+
+ # Run the test.
+ log_entries = self.do_test(None, max_entry_count=2)
+
+ # Validate that we received our two log entries.
+ self.assertEqual(len(log_entries), 1,
+ "Expected one log entry to arrive via events.")
+ self.assertEqual(log_entries[0]['message'], "Hello, world",
+ "Log message should match expected content.")
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/basic/main.c b/packages/Python/lldbsuite/test/functionalities/darwin_log/basic/main.c
new file mode 100644
index 000000000000..e6554564411f
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/basic/main.c
@@ -0,0 +1,32 @@
+//===-- main.c --------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <os/log.h>
+#include <stdio.h>
+
+#include "../common/darwin_log_common.h"
+
+int main(int argc, char** argv)
+{
+ os_log_t logger = os_log_create("org.llvm.lldb.test", "basic-test");
+ if (!logger)
+ return 1;
+
+ // Note we cannot use the os_log() line as the breakpoint because, as of
+ // the initial writing of this test, we get multiple breakpoints for that
+ // line, which confuses the pexpect test logic.
+ printf("About to log\n"); // break here
+ os_log(logger, "Hello, world");
+
+ // Sleep, as the darwin log reporting doesn't always happen until a bit
+ // later. We need the message to come out before the process terminates.
+ sleep(FINAL_WAIT_SECONDS);
+
+ return 0;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/common/darwin_log_common.h b/packages/Python/lldbsuite/test/functionalities/darwin_log/common/darwin_log_common.h
new file mode 100644
index 000000000000..de923b949116
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/common/darwin_log_common.h
@@ -0,0 +1,6 @@
+// The number of seconds to wait at the end of the test inferior before
+// exiting. This delay is needed to ensure the logging infrastructure
+// has flushed out the message. If we finished before all messages were
+// flushed, then the test will never see the unflushed messages, causing
+// some test logic to fail.
+#define FINAL_WAIT_SECONDS 5
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity-chain/Makefile b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity-chain/Makefile
new file mode 100644
index 000000000000..4f4176f23f3c
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity-chain/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../../../make
+
+C_SOURCES := main.c
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity-chain/TestDarwinLogFilterMatchActivityChain.py b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity-chain/TestDarwinLogFilterMatchActivityChain.py
new file mode 100644
index 000000000000..f8ce069478fd
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity-chain/TestDarwinLogFilterMatchActivityChain.py
@@ -0,0 +1,123 @@
+"""
+Test basic DarwinLog functionality provided by the StructuredDataDarwinLog
+plugin.
+
+These tests are currently only supported when running against Darwin
+targets.
+"""
+
+from __future__ import print_function
+
+import lldb
+import os
+import re
+
+from lldbsuite.test import decorators
+from lldbsuite.test import lldbtest
+from lldbsuite.test import darwin_log
+
+
+class TestDarwinLogFilterMatchActivityChain(darwin_log.DarwinLogTestBase):
+
+ mydir = lldbtest.TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ # Call super's setUp().
+ super(TestDarwinLogFilterMatchActivityChain, self).setUp()
+
+ # Source filename.
+ self.source = 'main.c'
+
+ # Output filename.
+ self.exe_name = 'a.out'
+ self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}
+
+ # Locate breakpoint.
+ self.line = lldbtest.line_number(self.source, '// break here')
+
+ def tearDown(self):
+ # Shut down the process if it's still running.
+ if self.child:
+ self.runCmd('process kill')
+ self.expect_prompt()
+ self.runCmd('quit')
+
+ # Let parent clean up
+ super(TestDarwinLogFilterMatchActivityChain, self).tearDown()
+
+ # ==========================================================================
+ # activity-chain filter tests
+ # ==========================================================================
+
+ @decorators.skipUnlessDarwin
+ def test_filter_accept_activity_chain_match(self):
+ """Test that fall-through reject, accept full-match activity chain works."""
+ self.do_test(
+ ["--no-match-accepts false",
+ "--filter \"accept activity-chain match "
+ "parent-activity:child-activity\""])
+
+ # We should only see the second log message as we only accept
+ # that activity.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 1) and (
+ self.child.match.group(2) == "cat2"),
+ "first log line should not be present, second log line "
+ "should be")
+
+ @decorators.skipUnlessDarwin
+ def test_filter_reject_activity_chain_partial_match(self):
+ """Test that fall-through reject, doesn't accept only partial match of activity-chain."""
+ self.do_test(
+ ["--no-match-accepts false",
+ # Match the second fully.
+ "--filter \"accept activity-chain match parent-activity:child-activity\"",
+ "--filter \"accept activity-chain match parent-ac\""]) # Only partially match the first.
+
+ # We should only see the second log message as we only accept
+ # that activity.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 1) and (
+ self.child.match.group(2) == "cat2"),
+ "first log line should not be present, second log line "
+ "should be")
+
+ @decorators.skipUnlessDarwin
+ def test_filter_reject_activity_chain_full_match(self):
+ """Test that fall-through accept, reject match activity-chain works."""
+ self.do_test(
+ ["--no-match-accepts true",
+ "--filter \"reject activity-chain match parent-activity\""])
+
+ # We should only see the second log message as we rejected the first
+ # via activity-chain rejection.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 1) and (
+ self.child.match.group(2) == "cat2"),
+ "first log line should not be present, second log line "
+ "should be")
+
+ @decorators.skipUnlessDarwin
+ def test_filter_accept_activity_chain_second_rule(self):
+ """Test that fall-through reject, accept activity-chain on second rule works."""
+ self.do_test(
+ ["--no-match-accepts false",
+ "--filter \"accept activity-chain match non-existent\"",
+ "--filter \"accept activity-chain match parent-activity:child-activity\""])
+
+ # We should only see the second message since we reject by default,
+ # the first filter doesn't match any, and the second filter matches
+ # the activity-chain of the second log message.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 1) and (
+ self.child.match.group(2) == "cat2"),
+ "first log line should not be present, second log line "
+ "should be")
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity-chain/main.c b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity-chain/main.c
new file mode 100644
index 000000000000..c93474eedb01
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity-chain/main.c
@@ -0,0 +1,43 @@
+//===-- main.c --------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <os/activity.h>
+#include <os/log.h>
+#include <stdio.h>
+
+#include "../../../common/darwin_log_common.h"
+
+int main(int argc, char** argv)
+{
+ os_log_t logger_sub1 = os_log_create("org.llvm.lldb.test.sub1", "cat1");
+ os_log_t logger_sub2 = os_log_create("org.llvm.lldb.test.sub2", "cat2");
+ if (!logger_sub1 || !logger_sub2)
+ return 1;
+
+ // Note we cannot use the os_log() line as the breakpoint because, as of
+ // the initial writing of this test, we get multiple breakpoints for that
+ // line, which confuses the pexpect test logic.
+ printf("About to log\n"); // break here
+ os_activity_t parent_activity = os_activity_create("parent-activity",
+ OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT);
+ os_activity_apply(parent_activity, ^{
+ os_log(logger_sub1, "source-log-sub1-cat1");
+ os_activity_t child_activity = os_activity_create("child-activity",
+ OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT);
+ os_activity_apply(child_activity, ^{
+ os_log(logger_sub2, "source-log-sub2-cat2");
+ });
+ });
+
+ // Sleep, as the darwin log reporting doesn't always happen until a bit
+ // later. We need the message to come out before the process terminates.
+ sleep(FINAL_WAIT_SECONDS);
+
+ return 0;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity/Makefile b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity/Makefile
new file mode 100644
index 000000000000..4f4176f23f3c
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../../../make
+
+C_SOURCES := main.c
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity/TestDarwinLogFilterMatchActivity.py b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity/TestDarwinLogFilterMatchActivity.py
new file mode 100644
index 000000000000..12a430295a77
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity/TestDarwinLogFilterMatchActivity.py
@@ -0,0 +1,127 @@
+"""
+Test basic DarwinLog functionality provided by the StructuredDataDarwinLog
+plugin.
+
+These tests are currently only supported when running against Darwin
+targets.
+"""
+
+from __future__ import print_function
+
+import lldb
+import os
+import re
+
+from lldbsuite.test import decorators
+from lldbsuite.test import lldbtest
+from lldbsuite.test import darwin_log
+
+
+class TestDarwinLogFilterMatchActivity(darwin_log.DarwinLogTestBase):
+
+ mydir = lldbtest.TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ # Call super's setUp().
+ super(TestDarwinLogFilterMatchActivity, self).setUp()
+
+ # Source filename.
+ self.source = 'main.c'
+
+ # Output filename.
+ self.exe_name = 'a.out'
+ self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}
+
+ # Locate breakpoint.
+ self.line = lldbtest.line_number(self.source, '// break here')
+
+ def tearDown(self):
+ # Shut down the process if it's still running.
+ if self.child:
+ self.runCmd('process kill')
+ self.expect_prompt()
+ self.runCmd('quit')
+
+ # Let parent clean up
+ super(TestDarwinLogFilterMatchActivity, self).tearDown()
+
+ # ==========================================================================
+ # activity filter tests
+ # ==========================================================================
+
+ @decorators.skipUnlessDarwin
+ def test_filter_accept_activity_match(self):
+ """Test that fall-through reject, accept match activity works."""
+ self.do_test(
+ ["--no-match-accepts false",
+ "--filter \"accept activity match child-activity\""]
+ )
+
+ # We should only see the second log message as we only accept
+ # that activity.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 1) and (
+ self.child.match.group(2) == "cat2"),
+ "first log line should not be present, second log line "
+ "should be")
+
+ @decorators.skipUnlessDarwin
+ def test_filter_reject_activity_partial_match(self):
+ """Test that fall-through reject, accept match activity via partial match does not accept."""
+ self.do_test(
+ ["--no-match-accepts false",
+ # Fully match second message.
+ "--filter \"accept activity match child-activity\"",
+ "--filter \"accept activity match parent-\""] # Only partially match first message.
+ )
+
+ # We should only see the second log message as we only accept
+ # that activity.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 1) and (
+ self.child.match.group(2) == "cat2"),
+ "first log line should not be present, second log line "
+ "should be")
+
+ @decorators.skipUnlessDarwin
+ def test_filter_reject_activity_full_match(self):
+ """Test that fall-through accept, reject match activity works."""
+ self.do_test(
+ ["--no-match-accepts true",
+ "--filter \"reject activity match parent-activity\""]
+ )
+
+ # We should only see the second log message as we rejected the first
+ # via activity rejection.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 1) and (
+ self.child.match.group(2) == "cat2"),
+ "first log line should not be present, second log line "
+ "should be")
+
+ @decorators.skipUnlessDarwin
+ def test_filter_accept_activity_second_rule(self):
+ """Test that fall-through reject, accept regex activity on second rule works."""
+ self.do_test(
+ ["--no-match-accepts false",
+ "--filter \"accept activity match non-existent\"",
+ "--filter \"accept activity match child-activity\""
+ ]
+ )
+
+ # We should only see the second message since we reject by default,
+ # the first filter doesn't match any, and the second filter matches
+ # the activity of the second log message.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 1) and (
+ self.child.match.group(2) == "cat2"),
+ "first log line should not be present, second log line "
+ "should be")
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity/main.c b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity/main.c
new file mode 100644
index 000000000000..c93474eedb01
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/activity/main.c
@@ -0,0 +1,43 @@
+//===-- main.c --------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <os/activity.h>
+#include <os/log.h>
+#include <stdio.h>
+
+#include "../../../common/darwin_log_common.h"
+
+int main(int argc, char** argv)
+{
+ os_log_t logger_sub1 = os_log_create("org.llvm.lldb.test.sub1", "cat1");
+ os_log_t logger_sub2 = os_log_create("org.llvm.lldb.test.sub2", "cat2");
+ if (!logger_sub1 || !logger_sub2)
+ return 1;
+
+ // Note we cannot use the os_log() line as the breakpoint because, as of
+ // the initial writing of this test, we get multiple breakpoints for that
+ // line, which confuses the pexpect test logic.
+ printf("About to log\n"); // break here
+ os_activity_t parent_activity = os_activity_create("parent-activity",
+ OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT);
+ os_activity_apply(parent_activity, ^{
+ os_log(logger_sub1, "source-log-sub1-cat1");
+ os_activity_t child_activity = os_activity_create("child-activity",
+ OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT);
+ os_activity_apply(child_activity, ^{
+ os_log(logger_sub2, "source-log-sub2-cat2");
+ });
+ });
+
+ // Sleep, as the darwin log reporting doesn't always happen until a bit
+ // later. We need the message to come out before the process terminates.
+ sleep(FINAL_WAIT_SECONDS);
+
+ return 0;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/category/Makefile b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/category/Makefile
new file mode 100644
index 000000000000..4f4176f23f3c
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/category/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../../../make
+
+C_SOURCES := main.c
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/category/TestDarwinLogFilterMatchCategory.py b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/category/TestDarwinLogFilterMatchCategory.py
new file mode 100644
index 000000000000..8ce4d4135d18
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/category/TestDarwinLogFilterMatchCategory.py
@@ -0,0 +1,127 @@
+"""
+Test basic DarwinLog functionality provided by the StructuredDataDarwinLog
+plugin.
+
+These tests are currently only supported when running against Darwin
+targets.
+"""
+
+from __future__ import print_function
+
+import lldb
+import os
+import re
+
+from lldbsuite.test import decorators
+from lldbsuite.test import lldbtest
+from lldbsuite.test import darwin_log
+
+
+class TestDarwinLogFilterMatchCategory(darwin_log.DarwinLogTestBase):
+
+ mydir = lldbtest.TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ # Call super's setUp().
+ super(TestDarwinLogFilterMatchCategory, self).setUp()
+
+ # Source filename.
+ self.source = 'main.c'
+
+ # Output filename.
+ self.exe_name = 'a.out'
+ self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}
+
+ # Locate breakpoint.
+ self.line = lldbtest.line_number(self.source, '// break here')
+
+ def tearDown(self):
+ # Shut down the process if it's still running.
+ if self.child:
+ self.runCmd('process kill')
+ self.expect_prompt()
+ self.runCmd('quit')
+
+ # Let parent clean up
+ super(TestDarwinLogFilterMatchCategory, self).tearDown()
+
+ # ==========================================================================
+ # category filter tests
+ # ==========================================================================
+
+ @decorators.skipUnlessDarwin
+ def test_filter_accept_category_full_match(self):
+ """Test that fall-through reject, accept match single category works."""
+ self.do_test(
+ ["--no-match-accepts false",
+ "--filter \"accept category match cat2\""]
+ )
+
+ # We should only see the second log message as we only accept
+ # that category.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 1) and (
+ self.child.match.group(2) == "cat2"),
+ "first log line should not be present, second log line "
+ "should be")
+
+ @decorators.skipUnlessDarwin
+ def test_filter_reject_category_partial_match(self):
+ """Test that fall-through reject, accept regex category via partial match works."""
+ self.do_test(
+ ["--no-match-accepts false",
+ # Fully match the second message.
+ "--filter \"accept category match cat2\"",
+ "--filter \"accept category match at1\""] # Only partially match first message. Should not show up.
+ )
+
+ # We should only see the second log message as we only accept
+ # that category.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 1) and (
+ self.child.match.group(2) == "cat2"),
+ "first log line should not be present, second log line "
+ "should be")
+
+ @decorators.skipUnlessDarwin
+ def test_filter_reject_category_full_match(self):
+ """Test that fall-through accept, reject match category works."""
+ self.do_test(
+ ["--no-match-accepts true",
+ "--filter \"reject category match cat1\""]
+ )
+
+ # We should only see the second log message as we rejected the first
+ # via category rejection.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 1) and (
+ self.child.match.group(2) == "cat2"),
+ "first log line should not be present, second log line "
+ "should be")
+
+ @decorators.skipUnlessDarwin
+ def test_filter_accept_category_second_rule(self):
+ """Test that fall-through reject, accept match category on second rule works."""
+ self.do_test(
+ ["--no-match-accepts false",
+ "--filter \"accept category match non-existent\"",
+ "--filter \"accept category match cat2\""
+ ]
+ )
+
+ # We should only see the second message since we reject by default,
+ # the first filter doesn't match any, and the second filter matches
+ # the category of the second log message.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 1) and (
+ self.child.match.group(2) == "cat2"),
+ "first log line should not be present, second log line "
+ "should be")
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/category/main.c b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/category/main.c
new file mode 100644
index 000000000000..c93474eedb01
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/category/main.c
@@ -0,0 +1,43 @@
+//===-- main.c --------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <os/activity.h>
+#include <os/log.h>
+#include <stdio.h>
+
+#include "../../../common/darwin_log_common.h"
+
+int main(int argc, char** argv)
+{
+ os_log_t logger_sub1 = os_log_create("org.llvm.lldb.test.sub1", "cat1");
+ os_log_t logger_sub2 = os_log_create("org.llvm.lldb.test.sub2", "cat2");
+ if (!logger_sub1 || !logger_sub2)
+ return 1;
+
+ // Note we cannot use the os_log() line as the breakpoint because, as of
+ // the initial writing of this test, we get multiple breakpoints for that
+ // line, which confuses the pexpect test logic.
+ printf("About to log\n"); // break here
+ os_activity_t parent_activity = os_activity_create("parent-activity",
+ OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT);
+ os_activity_apply(parent_activity, ^{
+ os_log(logger_sub1, "source-log-sub1-cat1");
+ os_activity_t child_activity = os_activity_create("child-activity",
+ OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT);
+ os_activity_apply(child_activity, ^{
+ os_log(logger_sub2, "source-log-sub2-cat2");
+ });
+ });
+
+ // Sleep, as the darwin log reporting doesn't always happen until a bit
+ // later. We need the message to come out before the process terminates.
+ sleep(FINAL_WAIT_SECONDS);
+
+ return 0;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/message/Makefile b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/message/Makefile
new file mode 100644
index 000000000000..4f4176f23f3c
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/message/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../../../make
+
+C_SOURCES := main.c
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/message/TestDarwinLogFilterMatchMessage.py b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/message/TestDarwinLogFilterMatchMessage.py
new file mode 100644
index 000000000000..b7664ddd8071
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/message/TestDarwinLogFilterMatchMessage.py
@@ -0,0 +1,147 @@
+"""
+Test basic DarwinLog functionality provided by the StructuredDataDarwinLog
+plugin.
+
+These tests are currently only supported when running against Darwin
+targets.
+"""
+
+from __future__ import print_function
+
+import lldb
+import os
+import re
+
+from lldbsuite.test import decorators
+from lldbsuite.test import lldbtest
+from lldbsuite.test import darwin_log
+
+
+class TestDarwinLogFilterMatchMessage(darwin_log.DarwinLogTestBase):
+
+ mydir = lldbtest.TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ # Call super's setUp().
+ super(TestDarwinLogFilterMatchMessage, self).setUp()
+
+ # Source filename.
+ self.source = 'main.c'
+
+ # Output filename.
+ self.exe_name = 'a.out'
+ self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}
+
+ # Locate breakpoint.
+ self.line = lldbtest.line_number(self.source, '// break here')
+
+ self.strict_sources = True
+
+ # Turn on process monitor logging while we work out issues.
+ self.enable_process_monitor_logging = True
+
+ def tearDown(self):
+ # Shut down the process if it's still running.
+ if self.child:
+ self.runCmd('process kill')
+ self.expect_prompt()
+ self.runCmd('quit')
+
+ # Let parent clean up
+ super(TestDarwinLogFilterMatchMessage, self).tearDown()
+
+ # ==========================================================================
+ # category filter tests
+ # ==========================================================================
+
+ EXPECT_REGEXES = [
+ re.compile(r"log message ([^-]+)-(\S+)"),
+ re.compile(r"exited with status")
+ ]
+
+ @decorators.skipUnlessDarwin
+ @decorators.expectedFailureAll(oslist=["macosx"],
+ bugnumber="llvm.org/pr30299")
+ def test_filter_accept_message_full_match(self):
+ """Test that fall-through reject, accept match whole message works."""
+ self.do_test(
+ ["--no-match-accepts false",
+ "--filter \"accept message match log message sub2-cat2\""],
+ expect_regexes=self.EXPECT_REGEXES
+ )
+
+ # We should only see the second log message as we only accept
+ # that message contents.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 1) and (
+ self.child.match.group(2) == "cat2"),
+ "first log line should not be present, second log line "
+ "should be")
+
+ @decorators.skipUnlessDarwin
+ @decorators.expectedFailureAll(oslist=["macosx"],
+ bugnumber="llvm.org/pr30299")
+ def test_filter_no_accept_message_partial_match(self):
+ """Test that fall-through reject, match message via partial content match doesn't accept."""
+ self.do_test(
+ ["--no-match-accepts false",
+ "--filter \"accept message match log message sub2-cat2\"",
+ "--filter \"accept message match sub1-cat1\""],
+ expect_regexes=self.EXPECT_REGEXES
+ )
+
+ # We should only see the second log message as the partial match on
+ # the first message should not pass.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 1) and (
+ self.child.match.group(2) == "cat2"),
+ "first log line should not be present, second log line "
+ "should be")
+
+ @decorators.skipUnlessDarwin
+ @decorators.expectedFailureAll(oslist=["macosx"],
+ bugnumber="llvm.org/pr30299")
+ def test_filter_reject_category_full_match(self):
+ """Test that fall-through accept, reject match message works."""
+ self.do_test(
+ ["--no-match-accepts true",
+ "--filter \"reject message match log message sub1-cat1\""],
+ expect_regexes=self.EXPECT_REGEXES
+ )
+
+ # We should only see the second log message as we rejected the first
+ # via message contents rejection.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 1) and (
+ self.child.match.group(2) == "cat2"),
+ "first log line should not be present, second log line "
+ "should be")
+
+ @decorators.skipUnlessDarwin
+ @decorators.expectedFailureAll(oslist=["macosx"],
+ bugnumber="llvm.org/pr30299")
+ def test_filter_accept_category_second_rule(self):
+ """Test that fall-through reject, accept match category on second rule works."""
+ self.do_test(
+ ["--no-match-accepts false",
+ "--filter \"accept message match non-existent\"",
+ "--filter \"accept message match log message sub2-cat2\""],
+ expect_regexes=self.EXPECT_REGEXES
+ )
+
+ # We should only see the second message since we reject by default,
+ # the first filter doesn't match any, and the second filter matches
+ # the category of the second log message.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 1) and (
+ self.child.match.group(2) == "cat2"),
+ "first log line should not be present, second log line "
+ "should be")
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/message/main.c b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/message/main.c
new file mode 100644
index 000000000000..f851e23d8800
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/message/main.c
@@ -0,0 +1,35 @@
+//===-- main.c --------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <os/activity.h>
+#include <os/log.h>
+#include <stdio.h>
+
+#include "../../../common/darwin_log_common.h"
+
+int main(int argc, char** argv)
+{
+ os_log_t logger_sub1 = os_log_create("org.llvm.lldb.test.sub1", "cat1");
+ os_log_t logger_sub2 = os_log_create("org.llvm.lldb.test.sub2", "cat2");
+ if (!logger_sub1 || !logger_sub2)
+ return 1;
+
+ // Note we cannot use the os_log() line as the breakpoint because, as of
+ // the initial writing of this test, we get multiple breakpoints for that
+ // line, which confuses the pexpect test logic.
+ printf("About to log\n"); // break here
+ os_log(logger_sub1, "log message sub%d-cat%d", 1, 1);
+ os_log(logger_sub2, "log message sub%d-cat%d", 2, 2);
+
+ // Sleep, as the darwin log reporting doesn't always happen until a bit
+ // later. We need the message to come out before the process terminates.
+ sleep(1);
+
+ return 0;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/subsystem/Makefile b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/subsystem/Makefile
new file mode 100644
index 000000000000..4f4176f23f3c
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/subsystem/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../../../make
+
+C_SOURCES := main.c
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/subsystem/TestDarwinLogFilterMatchSubsystem.py b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/subsystem/TestDarwinLogFilterMatchSubsystem.py
new file mode 100644
index 000000000000..5afe649e16a2
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/subsystem/TestDarwinLogFilterMatchSubsystem.py
@@ -0,0 +1,127 @@
+"""
+Test basic DarwinLog functionality provided by the StructuredDataDarwinLog
+plugin.
+
+These tests are currently only supported when running against Darwin
+targets.
+"""
+
+from __future__ import print_function
+
+import lldb
+import os
+import re
+
+from lldbsuite.test import decorators
+from lldbsuite.test import lldbtest
+from lldbsuite.test import darwin_log
+
+
+class TestDarwinLogFilterMatchSubsystem(darwin_log.DarwinLogTestBase):
+
+ mydir = lldbtest.TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ # Call super's setUp().
+ super(TestDarwinLogFilterMatchSubsystem, self).setUp()
+
+ # Source filename.
+ self.source = 'main.c'
+
+ # Output filename.
+ self.exe_name = 'a.out'
+ self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}
+
+ # Locate breakpoint.
+ self.line = lldbtest.line_number(self.source, '// break here')
+
+ def tearDown(self):
+ # Shut down the process if it's still running.
+ if self.child:
+ self.runCmd('process kill')
+ self.expect_prompt()
+ self.runCmd('quit')
+
+ # Let parent clean up
+ super(TestDarwinLogFilterMatchSubsystem, self).tearDown()
+
+ # ==========================================================================
+ # subsystem filter tests
+ # ==========================================================================
+
+ @decorators.skipUnlessDarwin
+ def test_filter_accept_subsystem_full_match(self):
+ """Test that fall-through reject, accept match single subsystem works."""
+ self.do_test(
+ ["--no-match-accepts false",
+ "--filter \"accept subsystem match org.llvm.lldb.test.sub2\""]
+ )
+
+ # We should only see the second log message as we only accept
+ # that subsystem.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 0) and (
+ self.child.match.group(1) == "sub2"),
+ "first log line should not be present, second log line "
+ "should be")
+
+ @decorators.skipUnlessDarwin
+ def test_filter_reject_subsystem_partial_match(self):
+ """Test that fall-through reject, doesn't accept match subsystem via partial-match."""
+ self.do_test(
+ ["--no-match-accepts false",
+ # Fully match second message subsystem.
+ "--filter \"accept subsystem match org.llvm.lldb.test.sub2\"",
+ "--filter \"accept subsystem match sub1\""] # Only partially match first subsystem.
+ )
+
+ # We should only see the second log message as we only accept
+ # that subsystem.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 0) and (
+ self.child.match.group(1) == "sub2"),
+ "first log line should not be present, second log line "
+ "should be")
+
+ @decorators.skipUnlessDarwin
+ def test_filter_reject_subsystem_full_match(self):
+ """Test that fall-through accept, reject match subsystem works."""
+ self.do_test(
+ ["--no-match-accepts true",
+ "--filter \"reject subsystem match org.llvm.lldb.test.sub1\""]
+ )
+
+ # We should only see the second log message as we rejected the first
+ # via subsystem rejection.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 0) and (
+ self.child.match.group(1) == "sub2"),
+ "first log line should not be present, second log line "
+ "should be")
+
+ @decorators.skipUnlessDarwin
+ def test_filter_accept_subsystem_second_rule(self):
+ """Test that fall-through reject, accept match subsystem on second rule works."""
+ self.do_test(
+ ["--no-match-accepts false",
+ "--filter \"accept subsystem match non-existent\"",
+ "--filter \"accept subsystem match org.llvm.lldb.test.sub2\""
+ ]
+ )
+
+ # We should only see the second message since we reject by default,
+ # the first filter doesn't match any, and the second filter matches
+ # the subsystem of the second log message.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 0) and (
+ self.child.match.group(1) == "sub2"),
+ "first log line should not be present, second log line "
+ "should be")
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/subsystem/main.c b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/subsystem/main.c
new file mode 100644
index 000000000000..c93474eedb01
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/exact_match/subsystem/main.c
@@ -0,0 +1,43 @@
+//===-- main.c --------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <os/activity.h>
+#include <os/log.h>
+#include <stdio.h>
+
+#include "../../../common/darwin_log_common.h"
+
+int main(int argc, char** argv)
+{
+ os_log_t logger_sub1 = os_log_create("org.llvm.lldb.test.sub1", "cat1");
+ os_log_t logger_sub2 = os_log_create("org.llvm.lldb.test.sub2", "cat2");
+ if (!logger_sub1 || !logger_sub2)
+ return 1;
+
+ // Note we cannot use the os_log() line as the breakpoint because, as of
+ // the initial writing of this test, we get multiple breakpoints for that
+ // line, which confuses the pexpect test logic.
+ printf("About to log\n"); // break here
+ os_activity_t parent_activity = os_activity_create("parent-activity",
+ OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT);
+ os_activity_apply(parent_activity, ^{
+ os_log(logger_sub1, "source-log-sub1-cat1");
+ os_activity_t child_activity = os_activity_create("child-activity",
+ OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT);
+ os_activity_apply(child_activity, ^{
+ os_log(logger_sub2, "source-log-sub2-cat2");
+ });
+ });
+
+ // Sleep, as the darwin log reporting doesn't always happen until a bit
+ // later. We need the message to come out before the process terminates.
+ sleep(FINAL_WAIT_SECONDS);
+
+ return 0;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity-chain/Makefile b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity-chain/Makefile
new file mode 100644
index 000000000000..4f4176f23f3c
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity-chain/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../../../make
+
+C_SOURCES := main.c
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity-chain/TestDarwinLogFilterRegexActivityChain.py b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity-chain/TestDarwinLogFilterRegexActivityChain.py
new file mode 100644
index 000000000000..74be57aeef85
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity-chain/TestDarwinLogFilterRegexActivityChain.py
@@ -0,0 +1,138 @@
+"""
+Test basic DarwinLog functionality provided by the StructuredDataDarwinLog
+plugin.
+
+These tests are currently only supported when running against Darwin
+targets.
+"""
+
+from __future__ import print_function
+
+import lldb
+import os
+import re
+
+from lldbsuite.test import decorators
+from lldbsuite.test import lldbtest
+from lldbsuite.test import darwin_log
+
+
+class TestDarwinLogFilterRegexActivityChain(darwin_log.DarwinLogTestBase):
+
+ mydir = lldbtest.TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ # Call super's setUp().
+ super(TestDarwinLogFilterRegexActivityChain, self).setUp()
+
+ # Source filename.
+ self.source = 'main.c'
+
+ # Output filename.
+ self.exe_name = 'a.out'
+ self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}
+
+ # Locate breakpoint.
+ self.line = lldbtest.line_number(self.source, '// break here')
+
+ def tearDown(self):
+ # Shut down the process if it's still running.
+ if self.child:
+ self.runCmd('process kill')
+ self.expect_prompt()
+ self.runCmd('quit')
+
+ # Let parent clean up
+ super(TestDarwinLogFilterRegexActivityChain, self).tearDown()
+
+ # ==========================================================================
+ # activity-chain filter tests
+ # ==========================================================================
+
+ @decorators.skipUnlessDarwin
+ def test_filter_accept_activity_chain_full_match(self):
+ """Test that fall-through reject, accept full-match activity chain works."""
+ self.do_test(
+ ["--no-match-accepts false",
+ "--filter \"accept activity-chain regex "
+ "parent-activity:child-activity\""])
+
+ # We should only see the second log message as we only accept
+ # that activity.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 1) and (
+ self.child.match.group(2) == "cat2"),
+ "first log line should not be present, second log line "
+ "should be")
+
+ @decorators.skipUnlessDarwin
+ def test_filter_accept_activity_chain_partial_match(self):
+ """Test that fall-through reject, accept activity-chain via partial match works."""
+ self.do_test(
+ ["--no-match-accepts false",
+ "--filter \"accept activity-chain regex :child-activity\""])
+
+ # We should only see the second log message as we only accept
+ # that activity.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 1) and (
+ self.child.match.group(2) == "cat2"),
+ "first log line should not be present, second log line "
+ "should be")
+
+ @decorators.skipUnlessDarwin
+ def test_filter_reject_activity_chain_full_match(self):
+ """Test that fall-through accept, reject activity-chain works."""
+ self.do_test(
+ ["--no-match-accepts true",
+ "--filter \"reject activity-chain regex parent-activity:child-..tivity\""])
+
+ # We should only see the second log message as we rejected the first
+ # via activity-chain rejection.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 1) and (
+ self.child.match.group(2) == "cat1"),
+ "first log line should not be present, second log line "
+ "should be")
+
+ @decorators.skipUnlessDarwin
+ def test_filter_reject_activity_chain_partial_match(self):
+ """Test that fall-through accept, reject activity-chain by partial match works."""
+ self.do_test(
+ ["--no-match-accepts true",
+ "--filter \"reject activity-chain regex ^p[^:]+$\""])
+
+ # We should only see the second log message as we rejected the first
+ # via activity-chain rejection.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 1) and (
+ self.child.match.group(2) == "cat2"),
+ "first log line should not be present, second log line "
+ "should be")
+
+ @decorators.skipUnlessDarwin
+ def test_filter_accept_activity_chain_second_rule(self):
+ """Test that fall-through reject, accept activity-chain on second rule works."""
+ self.do_test(
+ ["--no-match-accepts false",
+ "--filter \"accept activity-chain regex non-existent\"",
+ "--filter \"accept activity-chain regex child-activity\""])
+
+ # We should only see the second message since we reject by default,
+ # the first filter doesn't match any, and the second filter matches
+ # the activity-chain of the second log message.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 1) and (
+ self.child.match.group(2) == "cat2"),
+ "first log line should not be present, second log line "
+ "should be")
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity-chain/main.c b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity-chain/main.c
new file mode 100644
index 000000000000..c93474eedb01
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity-chain/main.c
@@ -0,0 +1,43 @@
+//===-- main.c --------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <os/activity.h>
+#include <os/log.h>
+#include <stdio.h>
+
+#include "../../../common/darwin_log_common.h"
+
+int main(int argc, char** argv)
+{
+ os_log_t logger_sub1 = os_log_create("org.llvm.lldb.test.sub1", "cat1");
+ os_log_t logger_sub2 = os_log_create("org.llvm.lldb.test.sub2", "cat2");
+ if (!logger_sub1 || !logger_sub2)
+ return 1;
+
+ // Note we cannot use the os_log() line as the breakpoint because, as of
+ // the initial writing of this test, we get multiple breakpoints for that
+ // line, which confuses the pexpect test logic.
+ printf("About to log\n"); // break here
+ os_activity_t parent_activity = os_activity_create("parent-activity",
+ OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT);
+ os_activity_apply(parent_activity, ^{
+ os_log(logger_sub1, "source-log-sub1-cat1");
+ os_activity_t child_activity = os_activity_create("child-activity",
+ OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT);
+ os_activity_apply(child_activity, ^{
+ os_log(logger_sub2, "source-log-sub2-cat2");
+ });
+ });
+
+ // Sleep, as the darwin log reporting doesn't always happen until a bit
+ // later. We need the message to come out before the process terminates.
+ sleep(FINAL_WAIT_SECONDS);
+
+ return 0;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity/Makefile b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity/Makefile
new file mode 100644
index 000000000000..4f4176f23f3c
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../../../make
+
+C_SOURCES := main.c
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity/TestDarwinLogFilterRegexActivity.py b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity/TestDarwinLogFilterRegexActivity.py
new file mode 100644
index 000000000000..55f015403d1f
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity/TestDarwinLogFilterRegexActivity.py
@@ -0,0 +1,143 @@
+"""
+Test basic DarwinLog functionality provided by the StructuredDataDarwinLog
+plugin.
+
+These tests are currently only supported when running against Darwin
+targets.
+"""
+
+from __future__ import print_function
+
+import lldb
+import os
+import re
+
+from lldbsuite.test import decorators
+from lldbsuite.test import lldbtest
+from lldbsuite.test import darwin_log
+
+
+class TestDarwinLogFilterRegexActivity(darwin_log.DarwinLogTestBase):
+
+ mydir = lldbtest.TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ # Call super's setUp().
+ super(TestDarwinLogFilterRegexActivity, self).setUp()
+
+ # Source filename.
+ self.source = 'main.c'
+
+ # Output filename.
+ self.exe_name = 'a.out'
+ self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}
+
+ # Locate breakpoint.
+ self.line = lldbtest.line_number(self.source, '// break here')
+
+ def tearDown(self):
+ # Shut down the process if it's still running.
+ if self.child:
+ self.runCmd('process kill')
+ self.expect_prompt()
+ self.runCmd('quit')
+
+ # Let parent clean up
+ super(TestDarwinLogFilterRegexActivity, self).tearDown()
+
+ # ==========================================================================
+ # activity filter tests
+ # ==========================================================================
+
+ @decorators.skipUnlessDarwin
+ def test_filter_accept_activity_full_match(self):
+ """Test that fall-through reject, accept regex full-match activity works."""
+ self.do_test(
+ ["--no-match-accepts false",
+ "--filter \"accept activity regex child-activity\""]
+ )
+
+ # We should only see the second log message as we only accept
+ # that activity.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 1) and (
+ self.child.match.group(2) == "cat2"),
+ "first log line should not be present, second log line "
+ "should be")
+
+ @decorators.skipUnlessDarwin
+ def test_filter_accept_activity_partial_match(self):
+ """Test that fall-through reject, regex accept activity via partial match works."""
+ self.do_test(
+ ["--no-match-accepts false",
+ "--filter \"accept activity regex child-.*\""]
+ )
+
+ # We should only see the second log message as we only accept
+ # that activity.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 1) and (
+ self.child.match.group(2) == "cat2"),
+ "first log line should not be present, second log line "
+ "should be")
+
+ @decorators.skipUnlessDarwin
+ def test_filter_reject_activity_full_match(self):
+ """Test that fall-through accept, reject regex activity works."""
+ self.do_test(
+ ["--no-match-accepts true",
+ "--filter \"reject activity regex parent-activity\""]
+ )
+
+ # We should only see the second log message as we rejected the first
+ # via activity rejection.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 1) and (
+ self.child.match.group(2) == "cat2"),
+ "first log line should not be present, second log line "
+ "should be")
+
+ @decorators.skipUnlessDarwin
+ def test_filter_reject_activity_partial_match(self):
+ """Test that fall-through accept, reject regex activity by partial match works."""
+ self.do_test(
+ ["--no-match-accepts true",
+ "--filter \"reject activity regex p.+-activity\""]
+ )
+
+ # We should only see the second log message as we rejected the first
+ # via activity rejection.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 1) and (
+ self.child.match.group(2) == "cat2"),
+ "first log line should not be present, second log line "
+ "should be")
+
+ @decorators.skipUnlessDarwin
+ def test_filter_accept_activity_second_rule(self):
+ """Test that fall-through reject, accept regex activity on second rule works."""
+ self.do_test(
+ ["--no-match-accepts false",
+ "--filter \"accept activity regex non-existent\"",
+ "--filter \"accept activity regex child-activity\""
+ ]
+ )
+
+ # We should only see the second message since we reject by default,
+ # the first filter doesn't match any, and the second filter matches
+ # the activity of the second log message.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 1) and (
+ self.child.match.group(2) == "cat2"),
+ "first log line should not be present, second log line "
+ "should be")
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity/main.c b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity/main.c
new file mode 100644
index 000000000000..c93474eedb01
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/activity/main.c
@@ -0,0 +1,43 @@
+//===-- main.c --------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <os/activity.h>
+#include <os/log.h>
+#include <stdio.h>
+
+#include "../../../common/darwin_log_common.h"
+
+int main(int argc, char** argv)
+{
+ os_log_t logger_sub1 = os_log_create("org.llvm.lldb.test.sub1", "cat1");
+ os_log_t logger_sub2 = os_log_create("org.llvm.lldb.test.sub2", "cat2");
+ if (!logger_sub1 || !logger_sub2)
+ return 1;
+
+ // Note we cannot use the os_log() line as the breakpoint because, as of
+ // the initial writing of this test, we get multiple breakpoints for that
+ // line, which confuses the pexpect test logic.
+ printf("About to log\n"); // break here
+ os_activity_t parent_activity = os_activity_create("parent-activity",
+ OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT);
+ os_activity_apply(parent_activity, ^{
+ os_log(logger_sub1, "source-log-sub1-cat1");
+ os_activity_t child_activity = os_activity_create("child-activity",
+ OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT);
+ os_activity_apply(child_activity, ^{
+ os_log(logger_sub2, "source-log-sub2-cat2");
+ });
+ });
+
+ // Sleep, as the darwin log reporting doesn't always happen until a bit
+ // later. We need the message to come out before the process terminates.
+ sleep(FINAL_WAIT_SECONDS);
+
+ return 0;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/category/Makefile b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/category/Makefile
new file mode 100644
index 000000000000..4f4176f23f3c
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/category/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../../../make
+
+C_SOURCES := main.c
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/category/TestDarwinLogFilterRegexCategory.py b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/category/TestDarwinLogFilterRegexCategory.py
new file mode 100644
index 000000000000..6786d6f009b0
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/category/TestDarwinLogFilterRegexCategory.py
@@ -0,0 +1,143 @@
+"""
+Test basic DarwinLog functionality provided by the StructuredDataDarwinLog
+plugin.
+
+These tests are currently only supported when running against Darwin
+targets.
+"""
+
+from __future__ import print_function
+
+import lldb
+import os
+import re
+
+from lldbsuite.test import decorators
+from lldbsuite.test import lldbtest
+from lldbsuite.test import darwin_log
+
+
+class TestDarwinLogFilterRegexCategory(darwin_log.DarwinLogTestBase):
+
+ mydir = lldbtest.TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ # Call super's setUp().
+ super(TestDarwinLogFilterRegexCategory, self).setUp()
+
+ # Source filename.
+ self.source = 'main.c'
+
+ # Output filename.
+ self.exe_name = 'a.out'
+ self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}
+
+ # Locate breakpoint.
+ self.line = lldbtest.line_number(self.source, '// break here')
+
+ def tearDown(self):
+ # Shut down the process if it's still running.
+ if self.child:
+ self.runCmd('process kill')
+ self.expect_prompt()
+ self.runCmd('quit')
+
+ # Let parent clean up
+ super(TestDarwinLogFilterRegexCategory, self).tearDown()
+
+ # ==========================================================================
+ # category filter tests
+ # ==========================================================================
+
+ @decorators.skipUnlessDarwin
+ def test_filter_accept_category_full_match(self):
+ """Test that fall-through reject, accept regex single category works."""
+ self.do_test(
+ ["--no-match-accepts false",
+ "--filter \"accept category regex cat2\""]
+ )
+
+ # We should only see the second log message as we only accept
+ # that category.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 1) and (
+ self.child.match.group(2) == "cat2"),
+ "first log line should not be present, second log line "
+ "should be")
+
+ @decorators.skipUnlessDarwin
+ def test_filter_accept_category_partial_match(self):
+ """Test that fall-through reject, accept regex category via partial match works."""
+ self.do_test(
+ ["--no-match-accepts false",
+ "--filter \"accept category regex .+2\""]
+ )
+
+ # We should only see the second log message as we only accept
+ # that category.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 1) and (
+ self.child.match.group(2) == "cat2"),
+ "first log line should not be present, second log line "
+ "should be")
+
+ @decorators.skipUnlessDarwin
+ def test_filter_reject_category_full_match(self):
+ """Test that fall-through accept, reject regex category works."""
+ self.do_test(
+ ["--no-match-accepts true",
+ "--filter \"reject category regex cat1\""]
+ )
+
+ # We should only see the second log message as we rejected the first
+ # via category rejection.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 1) and (
+ self.child.match.group(2) == "cat2"),
+ "first log line should not be present, second log line "
+ "should be")
+
+ @decorators.skipUnlessDarwin
+ def test_filter_reject_category_partial_match(self):
+ """Test that fall-through accept, reject regex category by partial match works."""
+ self.do_test(
+ ["--no-match-accepts true",
+ "--filter \"reject category regex t1\""]
+ )
+
+ # We should only see the second log message as we rejected the first
+ # via category rejection.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 1) and (
+ self.child.match.group(2) == "cat2"),
+ "first log line should not be present, second log line "
+ "should be")
+
+ @decorators.skipUnlessDarwin
+ def test_filter_accept_category_second_rule(self):
+ """Test that fall-through reject, accept regex category on second rule works."""
+ self.do_test(
+ ["--no-match-accepts false",
+ "--filter \"accept category regex non-existent\"",
+ "--filter \"accept category regex cat2\""
+ ]
+ )
+
+ # We should only see the second message since we reject by default,
+ # the first filter doesn't match any, and the second filter matches
+ # the category of the second log message.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 1) and (
+ self.child.match.group(2) == "cat2"),
+ "first log line should not be present, second log line "
+ "should be")
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/category/main.c b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/category/main.c
new file mode 100644
index 000000000000..c93474eedb01
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/category/main.c
@@ -0,0 +1,43 @@
+//===-- main.c --------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <os/activity.h>
+#include <os/log.h>
+#include <stdio.h>
+
+#include "../../../common/darwin_log_common.h"
+
+int main(int argc, char** argv)
+{
+ os_log_t logger_sub1 = os_log_create("org.llvm.lldb.test.sub1", "cat1");
+ os_log_t logger_sub2 = os_log_create("org.llvm.lldb.test.sub2", "cat2");
+ if (!logger_sub1 || !logger_sub2)
+ return 1;
+
+ // Note we cannot use the os_log() line as the breakpoint because, as of
+ // the initial writing of this test, we get multiple breakpoints for that
+ // line, which confuses the pexpect test logic.
+ printf("About to log\n"); // break here
+ os_activity_t parent_activity = os_activity_create("parent-activity",
+ OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT);
+ os_activity_apply(parent_activity, ^{
+ os_log(logger_sub1, "source-log-sub1-cat1");
+ os_activity_t child_activity = os_activity_create("child-activity",
+ OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT);
+ os_activity_apply(child_activity, ^{
+ os_log(logger_sub2, "source-log-sub2-cat2");
+ });
+ });
+
+ // Sleep, as the darwin log reporting doesn't always happen until a bit
+ // later. We need the message to come out before the process terminates.
+ sleep(FINAL_WAIT_SECONDS);
+
+ return 0;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/message/Makefile b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/message/Makefile
new file mode 100644
index 000000000000..4f4176f23f3c
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/message/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../../../make
+
+C_SOURCES := main.c
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/message/TestDarwinLogFilterRegexMessage.py b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/message/TestDarwinLogFilterRegexMessage.py
new file mode 100644
index 000000000000..eceedce2954e
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/message/TestDarwinLogFilterRegexMessage.py
@@ -0,0 +1,128 @@
+"""
+Test basic DarwinLog functionality provided by the StructuredDataDarwinLog
+plugin.
+
+These tests are currently only supported when running against Darwin
+targets.
+"""
+
+# System imports
+from __future__ import print_function
+
+import re
+
+# LLDB imports
+import lldb
+
+from lldbsuite.test import decorators
+from lldbsuite.test import lldbtest
+from lldbsuite.test import darwin_log
+
+
+class TestDarwinLogFilterRegexMessage(darwin_log.DarwinLogEventBasedTestBase):
+
+ mydir = lldbtest.TestBase.compute_mydir(__file__)
+
+ @decorators.skipUnlessDarwin
+ @decorators.expectedFailureAll(oslist=["macosx"],
+ bugnumber="llvm.org/pr30299")
+ def test_filter_accept_message_full_match(self):
+ """Test that fall-through reject, accept regex whole message works."""
+ log_entries = self.do_test(
+ ["--no-match-accepts false",
+ # Note below, the four '\' characters are to get us two
+ # backslashes over on the gdb-remote side, which then
+ # becomes one as the cstr interprets it as an escape
+ # sequence. This needs to be rationalized. Initially I
+ # supported std::regex ECMAScript, which has the
+ # [[:digit:]] character classes and such. That was much
+ # more tenable. The backslashes have to travel through
+ # so many layers of escaping. (And note if you take
+ # off the Python raw string marker here, you need to put
+ # in 8 backslashes to go to two on the remote side.)
+ r'--filter "accept message regex log message sub2-cat\\\\d+"'])
+
+ # We should have received at least one log entry.
+ self.assertIsNotNone(log_entries,
+ "Log entry list should not be None.")
+ self.assertEqual(len(log_entries), 1,
+ "Should receive one log entry.")
+ self.assertRegexpMatches(log_entries[0]["message"], r"sub2-cat2",
+ "First os_log call should have been skipped.")
+
+ @decorators.skipUnlessDarwin
+ @decorators.expectedFailureAll(oslist=["macosx"],
+ bugnumber="llvm.org/pr30299")
+ def test_filter_accept_message_partial_match(self):
+ """Test that fall-through reject, accept regex message via partial
+ match works."""
+ log_entries = self.do_test(
+ ["--no-match-accepts false",
+ "--filter \"accept message regex [^-]+2\""])
+
+ # We should only see the second log message as we only accept
+ # that message contents.
+ self.assertIsNotNone(log_entries,
+ "Log entry list should not be None.")
+ self.assertEqual(len(log_entries), 1,
+ "Should receive one log entry.")
+ self.assertRegexpMatches(log_entries[0]["message"], r"sub2-cat2",
+ "First os_log call should have been skipped.")
+
+ @decorators.skipUnlessDarwin
+ @decorators.expectedFailureAll(oslist=["macosx"],
+ bugnumber="llvm.org/pr30299")
+ def test_filter_reject_message_full_match(self):
+ """Test that fall-through accept, reject regex message works."""
+ log_entries = self.do_test(
+ ["--no-match-accepts true",
+ "--filter \"reject message regex log message sub1-cat1\""])
+
+ # We should only see the second log message as we rejected the first
+ # via message contents rejection.
+ self.assertIsNotNone(log_entries,
+ "Log entry list should not be None.")
+ self.assertEqual(len(log_entries), 1,
+ "Should receive one log entry.")
+ self.assertRegexpMatches(log_entries[0]["message"], r"sub2-cat2",
+ "First os_log call should have been skipped.")
+
+ @decorators.skipUnlessDarwin
+ @decorators.expectedFailureAll(oslist=["macosx"],
+ bugnumber="llvm.org/pr30299")
+ def test_filter_reject_message_partial_match(self):
+ """Test that fall-through accept, reject regex message by partial
+ match works."""
+ log_entries = self.do_test(
+ ["--no-match-accepts true",
+ "--filter \"reject message regex t1\""])
+
+ # We should only see the second log message as we rejected the first
+ # via partial message contents rejection.
+ self.assertIsNotNone(log_entries,
+ "Log entry list should not be None.")
+ self.assertEqual(len(log_entries), 1,
+ "Should receive one log entry.")
+ self.assertRegexpMatches(log_entries[0]["message"], r"sub2-cat2",
+ "First os_log call should have been skipped.")
+
+ @decorators.skipUnlessDarwin
+ @decorators.expectedFailureAll(oslist=["macosx"],
+ bugnumber="llvm.org/pr30299")
+ def test_filter_accept_message_second_rule(self):
+ """Test that fall-through reject, accept regex message on second rule
+ works."""
+ log_entries = self.do_test(
+ ["--no-match-accepts false",
+ "--filter \"accept message regex non-existent\"",
+ "--filter \"accept message regex cat2\""])
+
+ # We should only see the second message since we reject by default,
+ # the first filter doesn't match any, and the second filter matches
+ # the message of the second log message.
+ self.assertIsNotNone(log_entries,
+ "Log entry list should not be None.")
+ self.assertEqual(len(log_entries), 1,
+ "Should receive one log entry.")
+ self.assertRegexpMatches(log_entries[0]["message"], r"sub2-cat2",
+ "First os_log call should have been skipped.")
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/message/main.c b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/message/main.c
new file mode 100644
index 000000000000..5648ddae74b8
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/message/main.c
@@ -0,0 +1,35 @@
+//===-- main.c --------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <os/activity.h>
+#include <os/log.h>
+#include <stdio.h>
+
+#include "../../../common/darwin_log_common.h"
+
+int main(int argc, char** argv)
+{
+ os_log_t logger_sub1 = os_log_create("org.llvm.lldb.test.sub1", "cat1");
+ os_log_t logger_sub2 = os_log_create("org.llvm.lldb.test.sub2", "cat2");
+ if (!logger_sub1 || !logger_sub2)
+ return 1;
+
+ // Note we cannot use the os_log() line as the breakpoint because, as of
+ // the initial writing of this test, we get multiple breakpoints for that
+ // line, which confuses the pexpect test logic.
+ printf("About to log\n"); // break here
+ os_log(logger_sub1, "log message sub%d-cat%d", 1, 1);
+ os_log(logger_sub2, "log message sub%d-cat%d", 2, 2);
+
+ // Sleep, as the darwin log reporting doesn't always happen until a bit
+ // later. We need the message to come out before the process terminates.
+ sleep(FINAL_WAIT_SECONDS);
+
+ return 0;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/subsystem/Makefile b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/subsystem/Makefile
new file mode 100644
index 000000000000..4f4176f23f3c
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/subsystem/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../../../make
+
+C_SOURCES := main.c
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/subsystem/TestDarwinLogFilterRegexSubsystem.py b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/subsystem/TestDarwinLogFilterRegexSubsystem.py
new file mode 100644
index 000000000000..28677b54c75d
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/subsystem/TestDarwinLogFilterRegexSubsystem.py
@@ -0,0 +1,160 @@
+"""
+Test basic DarwinLog functionality provided by the StructuredDataDarwinLog
+plugin.
+
+These tests are currently only supported when running against Darwin
+targets.
+"""
+
+from __future__ import print_function
+
+import lldb
+import os
+import re
+
+from lldbsuite.test import decorators
+from lldbsuite.test import lldbtest
+from lldbsuite.test import darwin_log
+
+
+class TestDarwinLogFilterRegexSubsystem(darwin_log.DarwinLogTestBase):
+
+ mydir = lldbtest.TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ # Call super's setUp().
+ super(TestDarwinLogFilterRegexSubsystem, self).setUp()
+
+ # Source filename.
+ self.source = 'main.c'
+
+ # Output filename.
+ self.exe_name = 'a.out'
+ self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}
+
+ # Locate breakpoint.
+ self.line = lldbtest.line_number(self.source, '// break here')
+
+ def tearDown(self):
+ # Shut down the process if it's still running.
+ if self.child:
+ self.runCmd('process kill')
+ self.expect_prompt()
+ self.runCmd('quit')
+
+ # Let parent clean up
+ super(TestDarwinLogFilterRegexSubsystem, self).tearDown()
+
+ # ==========================================================================
+ # basic filter tests
+ # ==========================================================================
+
+ @decorators.skipUnlessDarwin
+ def test_fallthrough_reject(self):
+ """Test that a single fall-through reject regex rule rejects all logging."""
+ self.do_test(
+ ["--no-match-accepts false"]
+ )
+
+ # We should not match any log lines.
+ self.assertIsNotNone(self.child.match)
+ self.assertFalse((len(self.child.match.groups()) > 0) and
+ (self.child.match.group(1) in ["sub1", "sub2"]),
+ "log line should not have been received")
+
+ # ==========================================================================
+ # subsystem filter tests
+ # ==========================================================================
+
+ @decorators.skipUnlessDarwin
+ def test_filter_accept_subsystem_full_match(self):
+ """Test that fall-through reject, accept regex single subsystem works."""
+ self.do_test(
+ ["--no-match-accepts false",
+ "--filter \"accept subsystem regex org.llvm.lldb.test.sub2\""]
+ )
+
+ # We should only see the second log message as we only accept
+ # that subsystem.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 0) and (
+ self.child.match.group(1) == "sub2"),
+ "first log line should not be present, second log line "
+ "should be")
+
+ @decorators.skipUnlessDarwin
+ def test_filter_accept_subsystem_partial_match(self):
+ """Test that fall-through reject, accept regex subsystem via partial-match works."""
+ self.do_test(
+ ["--no-match-accepts false",
+ "--filter \"accept subsystem regex org.llvm.+.sub2\""]
+ )
+
+ # We should only see the second log message as we only accept
+ # that subsystem.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 0) and (
+ self.child.match.group(1) == "sub2"),
+ "first log line should not be present, second log line "
+ "should be")
+
+ @decorators.skipUnlessDarwin
+ def test_filter_reject_subsystem_full_match(self):
+ """Test that fall-through accept, reject regex subsystem works."""
+ self.do_test(
+ ["--no-match-accepts true",
+ "--filter \"reject subsystem regex org.llvm.lldb.test.sub1\""]
+ )
+
+ # We should only see the second log message as we rejected the first
+ # via subsystem rejection.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 0) and (
+ self.child.match.group(1) == "sub2"),
+ "first log line should not be present, second log line "
+ "should be")
+
+ @decorators.skipUnlessDarwin
+ def test_filter_reject_subsystem_partial_match(self):
+ """Test that fall-through accept, reject regex subsystem by partial match works."""
+ self.do_test(
+ ["--no-match-accepts true",
+ "--filter \"reject subsystem regex org.*sub1\""]
+ )
+
+ # We should only see the second log message as we rejected the first
+ # via subsystem rejection.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 0) and (
+ self.child.match.group(1) == "sub2"),
+ "first log line should not be present, second log line "
+ "should be")
+
+ @decorators.skipUnlessDarwin
+ def test_filter_accept_subsystem_second_rule(self):
+ """Test that fall-through reject, accept regex subsystem on second rule works."""
+ self.do_test(
+ ["--no-match-accepts false",
+ "--filter \"accept subsystem regex non-existent\"",
+ "--filter \"accept subsystem regex org.llvm.lldb.test.sub2\""
+ ]
+ )
+
+ # We should only see the second message since we reject by default,
+ # the first filter doesn't match any, and the second filter matches
+ # the subsystem of the second log message.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 0) and (
+ self.child.match.group(1) == "sub2"),
+ "first log line should not be present, second log line "
+ "should be")
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/subsystem/main.c b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/subsystem/main.c
new file mode 100644
index 000000000000..c93474eedb01
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/filter/regex/subsystem/main.c
@@ -0,0 +1,43 @@
+//===-- main.c --------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <os/activity.h>
+#include <os/log.h>
+#include <stdio.h>
+
+#include "../../../common/darwin_log_common.h"
+
+int main(int argc, char** argv)
+{
+ os_log_t logger_sub1 = os_log_create("org.llvm.lldb.test.sub1", "cat1");
+ os_log_t logger_sub2 = os_log_create("org.llvm.lldb.test.sub2", "cat2");
+ if (!logger_sub1 || !logger_sub2)
+ return 1;
+
+ // Note we cannot use the os_log() line as the breakpoint because, as of
+ // the initial writing of this test, we get multiple breakpoints for that
+ // line, which confuses the pexpect test logic.
+ printf("About to log\n"); // break here
+ os_activity_t parent_activity = os_activity_create("parent-activity",
+ OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT);
+ os_activity_apply(parent_activity, ^{
+ os_log(logger_sub1, "source-log-sub1-cat1");
+ os_activity_t child_activity = os_activity_create("child-activity",
+ OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT);
+ os_activity_apply(child_activity, ^{
+ os_log(logger_sub2, "source-log-sub2-cat2");
+ });
+ });
+
+ // Sleep, as the darwin log reporting doesn't always happen until a bit
+ // later. We need the message to come out before the process terminates.
+ sleep(FINAL_WAIT_SECONDS);
+
+ return 0;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/format/Makefile b/packages/Python/lldbsuite/test/functionalities/darwin_log/format/Makefile
new file mode 100644
index 000000000000..b09a579159d4
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/format/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+C_SOURCES := main.c
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/format/TestDarwinLogMessageFormat.py b/packages/Python/lldbsuite/test/functionalities/darwin_log/format/TestDarwinLogMessageFormat.py
new file mode 100644
index 000000000000..65822cab430a
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/format/TestDarwinLogMessageFormat.py
@@ -0,0 +1,188 @@
+"""
+Test DarwinLog log message formatting options provided by the
+StructuredDataDarwinLog plugin.
+
+These tests are currently only supported when running against Darwin
+targets.
+"""
+
+from __future__ import print_function
+
+import lldb
+import re
+
+from lldbsuite.test import decorators
+from lldbsuite.test import lldbtest
+from lldbsuite.test import darwin_log
+
+
+class TestDarwinLogMessageFormat(darwin_log.DarwinLogTestBase):
+
+ mydir = lldbtest.TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ # Call super's setUp().
+ super(TestDarwinLogMessageFormat, self).setUp()
+
+ # Source filename.
+ self.source = 'main.c'
+
+ # Output filename.
+ self.exe_name = 'a.out'
+ self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}
+
+ # Locate breakpoint.
+ self.line = lldbtest.line_number(self.source, '// break here')
+
+ def tearDown(self):
+ # Shut down the process if it's still running.
+ if self.child:
+ self.runCmd('process kill')
+ self.expect_prompt()
+ self.runCmd('quit')
+
+ # Let parent clean up
+ super(TestDarwinLogMessageFormat, self).tearDown()
+
+ # ==========================================================================
+ # Test settings around log message formatting
+ # ==========================================================================
+
+ REGEXES = [
+ re.compile(r"\[([^]]+)\] This is the log message."), # Match log
+ # with header.
+ re.compile(r"This is the log message."), # Match no-header content.
+ re.compile(r"exited with status") # Fallback if no log emitted.
+ ]
+
+ @decorators.skipUnlessDarwin
+ def test_display_without_header_works(self):
+ """Test that turning off log message headers works as advertised."""
+ self.do_test([], expect_regexes=self.REGEXES)
+
+ # We should not match the first pattern as we shouldn't have header
+ # content.
+ self.assertIsNotNone(self.child.match)
+ self.assertFalse((len(self.child.match.groups()) > 0) and
+ (self.child.match.group(1) != ""),
+ "we should not have seen a header")
+
+ @decorators.skipUnlessDarwin
+ def test_display_with_header_works(self):
+ """Test that displaying any header works."""
+ self.do_test(
+ ["--timestamp-relative", "--subsystem", "--category",
+ "--activity-chain"],
+ expect_regexes=self.REGEXES,
+ settings_commands=[
+ "display-header true"
+ ])
+
+ # We should match the first pattern as we should have header
+ # content.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue((len(self.child.match.groups()) > 0) and
+ (self.child.match.group(1) != ""),
+ "we should have printed a header")
+
+ def assert_header_contains_timestamp(self, header):
+ fields = header.split(',')
+ self.assertGreater(len(fields), 0,
+ "there should have been header content present")
+ self.assertRegexpMatches(fields[0],
+ r"^\d+:\d{2}:\d{2}.\d{9}$",
+ "time field should match expected format")
+
+ @decorators.skipUnlessDarwin
+ def test_header_timefield_only_works(self):
+ """Test that displaying a header with only the timestamp works."""
+ self.do_test(["--timestamp-relative"], expect_regexes=self.REGEXES)
+
+ # We should match the first pattern as we should have header
+ # content.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue((len(self.child.match.groups()) > 0) and
+ (self.child.match.group(1) != ""),
+ "we should have printed a header")
+ header = self.child.match.group(1)
+ self.assertEqual(len(header.split(',')), 1,
+ "there should only be one header field")
+ self.assert_header_contains_timestamp(header)
+
+ @decorators.skipUnlessDarwin
+ def test_header_subsystem_only_works(self):
+ """Test that displaying a header with only the subsystem works."""
+ self.do_test(["--subsystem"], expect_regexes=self.REGEXES)
+
+ # We should match the first pattern as we should have header
+ # content.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue((len(self.child.match.groups()) > 0) and
+ (self.child.match.group(1) != ""),
+ "we should have printed a header")
+ header = self.child.match.group(1)
+ self.assertEqual(len(header.split(',')), 1,
+ "there should only be one header field")
+ self.assertEquals(header,
+ "subsystem=org.llvm.lldb.test.sub1")
+
+ @decorators.skipUnlessDarwin
+ def test_header_category_only_works(self):
+ """Test that displaying a header with only the category works."""
+ self.do_test(["--category"], expect_regexes=self.REGEXES)
+
+ # We should match the first pattern as we should have header
+ # content.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue((len(self.child.match.groups()) > 0) and
+ (self.child.match.group(1) != ""),
+ "we should have printed a header")
+ header = self.child.match.group(1)
+ self.assertEqual(len(header.split(',')), 1,
+ "there should only be one header field")
+ self.assertEquals(header,
+ "category=cat1")
+
+ @decorators.skipUnlessDarwin
+ def test_header_activity_chain_only_works(self):
+ """Test that displaying a header with only the activity chain works."""
+ self.do_test(["--activity-chain"], expect_regexes=self.REGEXES)
+
+ # We should match the first pattern as we should have header
+ # content.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue((len(self.child.match.groups()) > 0) and
+ (self.child.match.group(1) != ""),
+ "we should have printed a header")
+ header = self.child.match.group(1)
+ self.assertEqual(len(header.split(',')), 1,
+ "there should only be one header field")
+ self.assertEquals(header,
+ "activity-chain=parent-activity:child-activity")
+
+ # @decorators.skipUnlessDarwin
+ # def test_header_activity_no_chain_only_works(self):
+ # """Test that displaying a header with only the activity works."""
+ # self.do_test(
+ # [],
+ # expect_regexes=self.REGEXES,
+ # settings_commands=[
+ # "display-header true",
+ # "format-include-timestamp false",
+ # "format-include-activity true",
+ # "format-include-category false",
+ # "format-include-subsystem false",
+ # "display-activity-chain false"
+ # ])
+
+ # # We should match the first pattern as we should have header
+ # # content.
+ # self.assertIsNotNone(self.child.match)
+ # self.assertTrue((len(self.child.match.groups()) > 0) and
+ # (self.child.match.group(1) != ""),
+ # "we should have printed a header")
+ # header = self.child.match.group(1)
+ # self.assertEqual(len(header.split(',')), 1,
+ # "there should only be one header field")
+ # self.assertEquals(header,
+ # "activity=child-activity")
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/format/main.c b/packages/Python/lldbsuite/test/functionalities/darwin_log/format/main.c
new file mode 100644
index 000000000000..e371a547438a
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/format/main.c
@@ -0,0 +1,41 @@
+//===-- main.c --------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <os/activity.h>
+#include <os/log.h>
+#include <stdio.h>
+
+#include "../common/darwin_log_common.h"
+
+int main(int argc, char** argv)
+{
+ os_log_t logger_sub1 = os_log_create("org.llvm.lldb.test.sub1", "cat1");
+ if (!logger_sub1)
+ return 1;
+
+ // Note we cannot use the os_log() line as the breakpoint because, as of
+ // the initial writing of this test, we get multiple breakpoints for that
+ // line, which confuses the pexpect test logic.
+ printf("About to log\n"); // break here
+ os_activity_t parent_activity = os_activity_create("parent-activity",
+ OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT);
+ os_activity_apply(parent_activity, ^{
+ os_activity_t child_activity = os_activity_create("child-activity",
+ OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT);
+ os_activity_apply(child_activity, ^{
+ os_log(logger_sub1, "This is the log message.");
+ });
+ });
+
+ // Sleep, as the darwin log reporting doesn't always happen until a bit
+ // later. We need the message to come out before the process terminates.
+ sleep(FINAL_WAIT_SECONDS);
+
+ return 0;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/source/debug/Makefile b/packages/Python/lldbsuite/test/functionalities/darwin_log/source/debug/Makefile
new file mode 100644
index 000000000000..214cedd96f1a
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/source/debug/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../../make
+
+C_SOURCES := main.c
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/source/debug/TestDarwinLogSourceDebug.py b/packages/Python/lldbsuite/test/functionalities/darwin_log/source/debug/TestDarwinLogSourceDebug.py
new file mode 100644
index 000000000000..85b8e30f6064
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/source/debug/TestDarwinLogSourceDebug.py
@@ -0,0 +1,81 @@
+"""
+Test DarwinLog "source include debug-level" functionality provided by the
+StructuredDataDarwinLog plugin.
+
+These tests are currently only supported when running against Darwin
+targets.
+"""
+
+from __future__ import print_function
+
+import lldb
+import os
+import re
+
+from lldbsuite.test import decorators
+from lldbsuite.test import lldbtest
+from lldbsuite.test import darwin_log
+
+
+class TestDarwinLogSourceDebug(darwin_log.DarwinLogTestBase):
+
+ mydir = lldbtest.TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ # Call super's setUp().
+ super(TestDarwinLogSourceDebug, self).setUp()
+
+ # Source filename.
+ self.source = 'main.c'
+
+ # Output filename.
+ self.exe_name = 'a.out'
+ self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}
+
+ # Locate breakpoint.
+ self.line = lldbtest.line_number(self.source, '// break here')
+
+ # Indicate we want strict-sources behavior.
+ self.strict_sources = True
+
+ def tearDown(self):
+ # Shut down the process if it's still running.
+ if self.child:
+ self.runCmd('process kill')
+ self.expect_prompt()
+ self.runCmd('quit')
+
+ # Let parent clean up
+ super(TestDarwinLogSourceDebug, self).tearDown()
+
+ # ==========================================================================
+ # source include/exclude debug filter tests
+ # ==========================================================================
+
+ @decorators.skipUnlessDarwin
+ def test_source_default_exclude_debug(self):
+ """Test that default excluding of debug-level log messages works."""
+ self.do_test([])
+
+ # We should only see the second log message as the first is a
+ # debug-level message and we're not including debug-level messages.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 1) and (
+ self.child.match.group(2) == "cat2"),
+ "first log line should not be present, second log line "
+ "should be")
+
+ @decorators.skipUnlessDarwin
+ def test_source_explicitly_include_debug(self):
+ """Test that explicitly including debug-level log messages works."""
+ self.do_test(["--debug"])
+
+ # We should only see the second log message as the first is a
+ # debug-level message and we're not including debug-level messages.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue((len(self.child.match.groups()) > 1) and
+ (self.child.match.group(2) == "cat1"),
+ "first log line should be present since we're "
+ "including debug-level log messages")
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/source/debug/main.c b/packages/Python/lldbsuite/test/functionalities/darwin_log/source/debug/main.c
new file mode 100644
index 000000000000..1f5cd1aa6c70
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/source/debug/main.c
@@ -0,0 +1,34 @@
+//===-- main.c --------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <os/log.h>
+#include <stdio.h>
+
+#include "../../common/darwin_log_common.h"
+
+int main(int argc, char** argv)
+{
+ os_log_t logger_sub1 = os_log_create("org.llvm.lldb.test.sub1", "cat1");
+ os_log_t logger_sub2 = os_log_create("org.llvm.lldb.test.sub2", "cat2");
+ if (!logger_sub1 || !logger_sub2)
+ return 1;
+
+ // Note we cannot use the os_log() line as the breakpoint because, as of
+ // the initial writing of this test, we get multiple breakpoints for that
+ // line, which confuses the pexpect test logic.
+ printf("About to log\n"); // break here
+ os_log_debug(logger_sub1, "source-log-sub1-cat1");
+ os_log(logger_sub2, "source-log-sub2-cat2");
+
+ // Sleep, as the darwin log reporting doesn't always happen until a bit
+ // later. We need the message to come out before the process terminates.
+ sleep(FINAL_WAIT_SECONDS);
+
+ return 0;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/source/info/Makefile b/packages/Python/lldbsuite/test/functionalities/darwin_log/source/info/Makefile
new file mode 100644
index 000000000000..214cedd96f1a
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/source/info/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../../make
+
+C_SOURCES := main.c
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/source/info/TestDarwinLogSourceInfo.py b/packages/Python/lldbsuite/test/functionalities/darwin_log/source/info/TestDarwinLogSourceInfo.py
new file mode 100644
index 000000000000..44348374636d
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/source/info/TestDarwinLogSourceInfo.py
@@ -0,0 +1,84 @@
+"""
+Test DarwinLog "source include info-level" functionality provided by the
+StructuredDataDarwinLog plugin.
+
+These tests are currently only supported when running against Darwin
+targets.
+"""
+
+from __future__ import print_function
+
+import lldb
+import os
+import re
+
+from lldbsuite.test import decorators
+from lldbsuite.test import lldbtest
+from lldbsuite.test import darwin_log
+
+
+class TestDarwinLogSourceInfo(darwin_log.DarwinLogTestBase):
+
+ mydir = lldbtest.TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ # Call super's setUp().
+ super(TestDarwinLogSourceInfo, self).setUp()
+
+ # Source filename.
+ self.source = 'main.c'
+
+ # Output filename.
+ self.exe_name = 'a.out'
+ self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}
+
+ # Locate breakpoint.
+ self.line = lldbtest.line_number(self.source, '// break here')
+
+ # Indicate we want strict-sources behavior.
+ self.strict_sources = True
+
+ def tearDown(self):
+ # Shut down the process if it's still running.
+ if self.child:
+ self.runCmd('process kill')
+ self.expect_prompt()
+ self.runCmd('quit')
+
+ # Let parent clean up
+ super(TestDarwinLogSourceInfo, self).tearDown()
+
+ # ==========================================================================
+ # source include/exclude debug filter tests
+ # ==========================================================================
+
+ @decorators.skipUnlessDarwin
+ @decorators.expectedFailureAll(bugnumber="rdar://27316264")
+ def test_source_exclude_info_level(self):
+ """Test that default excluding of info-level log messages works."""
+ self.do_test([])
+
+ # We should only see the second log message as the first is an
+ # info-level message and we're not including debug-level messages.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue(
+ (len(
+ self.child.match.groups()) > 1) and (
+ self.child.match.group(2) == "cat2"),
+ "first log line should not be present, second log line "
+ "should be")
+
+ @decorators.skipUnlessDarwin
+ def test_source_include_info_level(self):
+ """Test that explicitly including info-level log messages works."""
+ self.do_test(
+ ["--info"]
+ )
+
+ # We should only see the second log message as the first is a
+ # debug-level message and we're not including debug-level messages.
+ self.assertIsNotNone(self.child.match)
+ self.assertTrue((len(self.child.match.groups()) > 1) and
+ (self.child.match.group(2) == "cat1"),
+ "first log line should be present since we're "
+ "including info-level log messages")
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/source/info/main.c b/packages/Python/lldbsuite/test/functionalities/darwin_log/source/info/main.c
new file mode 100644
index 000000000000..5ab6f39c0079
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/source/info/main.c
@@ -0,0 +1,34 @@
+//===-- main.c --------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <os/log.h>
+#include <stdio.h>
+
+#include "../../common/darwin_log_common.h"
+
+int main(int argc, char** argv)
+{
+ os_log_t logger_sub1 = os_log_create("org.llvm.lldb.test.sub1", "cat1");
+ os_log_t logger_sub2 = os_log_create("org.llvm.lldb.test.sub2", "cat2");
+ if (!logger_sub1 || !logger_sub2)
+ return 1;
+
+ // Note we cannot use the os_log() line as the breakpoint because, as of
+ // the initial writing of this test, we get multiple breakpoints for that
+ // line, which confuses the pexpect test logic.
+ printf("About to log\n"); // break here
+ os_log_info(logger_sub1, "source-log-sub1-cat1");
+ os_log(logger_sub2, "source-log-sub2-cat2");
+
+ // Sleep, as the darwin log reporting doesn't always happen until a bit
+ // later. We need the message to come out before the process terminates.
+ sleep(FINAL_WAIT_SECONDS);
+
+ return 0;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/boolreference/TestFormattersBoolRefPtr.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/boolreference/TestFormattersBoolRefPtr.py
index fb3511ebd91d..0459058f3ae9 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/boolreference/TestFormattersBoolRefPtr.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/boolreference/TestFormattersBoolRefPtr.py
@@ -5,14 +5,15 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
import datetime
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class DataFormatterBoolRefPtr(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -33,14 +34,15 @@ class DataFormatterBoolRefPtr(TestBase):
"""Test the formatters we use for BOOL& and BOOL* in Objective-C."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.mm", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.mm", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -52,28 +54,28 @@ class DataFormatterBoolRefPtr(TestBase):
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
+ isiOS = (lldbplatformutil.getPlatform() == 'ios')
+
# Now check that we use the right summary for BOOL&
self.expect('frame variable yes_ref',
- substrs = ['YES'])
+ substrs=['YES'])
self.expect('frame variable no_ref',
- substrs = ['NO'])
- self.expect('frame variable unset_ref',
- substrs = ['12'])
-
+ substrs=['NO'])
+ if not(isiOS):
+ self.expect('frame variable unset_ref', substrs=['12'])
# Now check that we use the right summary for BOOL*
self.expect('frame variable yes_ptr',
- substrs = ['YES'])
+ substrs=['YES'])
self.expect('frame variable no_ptr',
- substrs = ['NO'])
- self.expect('frame variable unset_ptr',
- substrs = ['12'])
-
+ substrs=['NO'])
+ if not(isiOS):
+ self.expect('frame variable unset_ptr', substrs=['12'])
# Now check that we use the right summary for BOOL
self.expect('frame variable yes',
- substrs = ['YES'])
+ substrs=['YES'])
self.expect('frame variable no',
- substrs = ['NO'])
- self.expect('frame variable unset',
- substrs = ['12'])
+ substrs=['NO'])
+ if not(isiOS):
+ self.expect('frame variable unset', substrs=['12'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/compactvectors/TestCompactVectors.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/compactvectors/TestCompactVectors.py
index 914c5260ac24..9b430c726e12 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/compactvectors/TestCompactVectors.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/compactvectors/TestCompactVectors.py
@@ -5,13 +5,14 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class CompactVectorsFormattingTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -28,14 +29,15 @@ class CompactVectorsFormattingTestCase(TestBase):
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -45,15 +47,17 @@ class CompactVectorsFormattingTestCase(TestBase):
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
- self.expect('frame variable',
- substrs = ['(vFloat) valueFL = (1.25, 0, 0.25, 0)',
- '(int16_t [8]) valueI16 = (1, 0, 4, 0, 0, 1, 0, 4)',
- '(int32_t [4]) valueI32 = (1, 0, 4, 0)',
- '(vDouble) valueDL = (1.25, 2.25)',
- '(vUInt8) valueU8 = (0x01, 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)',
- '(vUInt16) valueU16 = (1, 0, 4, 0, 0, 1, 0, 4)',
- '(vUInt32) valueU32 = (1, 2, 3, 4)',
- "(vSInt8) valueS8 = (1, 0, 4, 0, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0)",
- '(vSInt16) valueS16 = (1, 0, 4, 0, 0, 1, 0, 4)',
- '(vSInt32) valueS32 = (4, 3, 2, 1)',
- '(vBool32) valueBool32 = (0, 1, 0, 1)'])
+ self.expect(
+ 'frame variable',
+ substrs=[
+ '(vFloat) valueFL = (1.25, 0, 0.25, 0)',
+ '(int16_t [8]) valueI16 = (1, 0, 4, 0, 0, 1, 0, 4)',
+ '(int32_t [4]) valueI32 = (1, 0, 4, 0)',
+ '(vDouble) valueDL = (1.25, 2.25)',
+ '(vUInt8) valueU8 = (0x01, 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)',
+ '(vUInt16) valueU16 = (1, 0, 4, 0, 0, 1, 0, 4)',
+ '(vUInt32) valueU32 = (1, 2, 3, 4)',
+ "(vSInt8) valueS8 = (1, 0, 4, 0, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0)",
+ '(vSInt16) valueS16 = (1, 0, 4, 0, 0, 1, 0, 4)',
+ '(vSInt32) valueS32 = (4, 3, 2, 1)',
+ '(vBool32) valueBool32 = (0, 1, 0, 1)'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py
index 8166d1540ca3..050f5236445b 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py
@@ -5,12 +5,13 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class AdvDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -26,103 +27,116 @@ class AdvDataFormatterTestCase(TestBase):
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
def cleanup():
self.runCmd('type format clear', check=False)
self.runCmd('type summary clear', check=False)
- self.runCmd("settings set target.max-children-count 256", check=False)
-
+ self.runCmd(
+ "settings set target.max-children-count 256",
+ check=False)
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
self.runCmd("type summary add --summary-string \"pippo\" \"i_am_cool\"")
- self.runCmd("type summary add --summary-string \"pluto\" -x \"i_am_cool[a-z]*\"")
+ self.runCmd(
+ "type summary add --summary-string \"pluto\" -x \"i_am_cool[a-z]*\"")
self.expect("frame variable cool_boy",
- substrs = ['pippo'])
+ substrs=['pippo'])
self.expect("frame variable cooler_boy",
- substrs = ['pluto'])
+ substrs=['pluto'])
self.runCmd("type summary delete i_am_cool")
-
+
self.expect("frame variable cool_boy",
- substrs = ['pluto'])
+ substrs=['pluto'])
self.runCmd("type summary clear")
-
- self.runCmd("type summary add --summary-string \"${var[]}\" -x \"int \\[[0-9]\\]")
+
+ self.runCmd(
+ "type summary add --summary-string \"${var[]}\" -x \"int \\[[0-9]\\]")
self.expect("frame variable int_array",
- substrs = ['1,2,3,4,5'])
+ substrs=['1,2,3,4,5'])
# this will fail if we don't do [] as regex correctly
- self.runCmd('type summary add --summary-string "${var[].integer}" "i_am_cool[]')
-
+ self.runCmd(
+ 'type summary add --summary-string "${var[].integer}" "i_am_cool[]')
+
self.expect("frame variable cool_array",
- substrs = ['1,1,1,1,6'])
+ substrs=['1,1,1,1,6'])
self.runCmd("type summary clear")
-
- self.runCmd("type summary add --summary-string \"${var[1-0]%x}\" \"int\"")
-
+
+ self.runCmd(
+ "type summary add --summary-string \"${var[1-0]%x}\" \"int\"")
+
self.expect("frame variable iAmInt",
- substrs = ['01'])
-
- self.runCmd("type summary add --summary-string \"${var[0-1]%x}\" \"int\"")
-
+ substrs=['01'])
+
+ self.runCmd(
+ "type summary add --summary-string \"${var[0-1]%x}\" \"int\"")
+
self.expect("frame variable iAmInt",
- substrs = ['01'])
+ substrs=['01'])
self.runCmd("type summary clear")
self.runCmd("type summary add --summary-string \"${var[0-1]%x}\" int")
- self.runCmd("type summary add --summary-string \"${var[0-31]%x}\" float")
-
+ self.runCmd(
+ "type summary add --summary-string \"${var[0-31]%x}\" float")
+
self.expect("frame variable *pointer",
- substrs = ['0x',
- '2'])
+ substrs=['0x',
+ '2'])
- # check fix for <rdar://problem/11338654> LLDB crashes when using a "type summary" that uses bitfields with no format
+ # check fix for <rdar://problem/11338654> LLDB crashes when using a
+ # "type summary" that uses bitfields with no format
self.runCmd("type summary add --summary-string \"${var[0-1]}\" int")
self.expect("frame variable iAmInt",
- substrs = ['9 1'])
+ substrs=['9 1'])
self.expect("frame variable cool_array[3].floating",
- substrs = ['0x'])
-
- self.runCmd("type summary add --summary-string \"low bits are ${*var[0-1]} tgt is ${*var}\" \"int *\"")
+ substrs=['0x'])
+
+ self.runCmd(
+ "type summary add --summary-string \"low bits are ${*var[0-1]} tgt is ${*var}\" \"int *\"")
self.expect("frame variable pointer",
- substrs = ['low bits are',
- 'tgt is 6'])
+ substrs=['low bits are',
+ 'tgt is 6'])
- self.expect("frame variable int_array --summary-string \"${*var[0-1]}\"",
- substrs = ['3'])
+ self.expect(
+ "frame variable int_array --summary-string \"${*var[0-1]}\"",
+ substrs=['3'])
self.runCmd("type summary clear")
-
- self.runCmd('type summary add --summary-string \"${var[0-1]}\" -x \"int \[[0-9]\]\"')
+
+ self.runCmd(
+ 'type summary add --summary-string \"${var[0-1]}\" -x \"int \[[0-9]\]\"')
self.expect("frame variable int_array",
- substrs = ['1,2'])
+ substrs=['1,2'])
- self.runCmd('type summary add --summary-string \"${var[0-1]}\" "int []"')
+ self.runCmd(
+ 'type summary add --summary-string \"${var[0-1]}\" "int []"')
self.expect("frame variable int_array",
- substrs = ['1,2'])
+ substrs=['1,2'])
self.runCmd("type summary clear")
@@ -130,156 +144,179 @@ class AdvDataFormatterTestCase(TestBase):
self.runCmd("type summary add -c i_am_cool")
self.expect("frame variable cool_array",
- substrs = ['[0]',
- '[1]',
- '[2]',
- '[3]',
- '[4]',
- 'integer',
- 'character',
- 'floating'])
-
- self.runCmd("type summary add --summary-string \"int = ${*var.int_pointer}, float = ${*var.float_pointer}\" IWrapPointers")
+ substrs=['[0]',
+ '[1]',
+ '[2]',
+ '[3]',
+ '[4]',
+ 'integer',
+ 'character',
+ 'floating'])
+
+ self.runCmd(
+ "type summary add --summary-string \"int = ${*var.int_pointer}, float = ${*var.float_pointer}\" IWrapPointers")
self.expect("frame variable wrapper",
- substrs = ['int = 4',
- 'float = 1.1'])
+ substrs=['int = 4',
+ 'float = 1.1'])
+
+ self.runCmd(
+ "type summary add --summary-string \"low bits = ${*var.int_pointer[2]}\" IWrapPointers -p")
- self.runCmd("type summary add --summary-string \"low bits = ${*var.int_pointer[2]}\" IWrapPointers -p")
-
self.expect("frame variable wrapper",
- substrs = ['low bits = 1'])
-
+ substrs=['low bits = 1'])
+
self.expect("frame variable *wrap_pointer",
- substrs = ['low bits = 1'])
+ substrs=['low bits = 1'])
self.runCmd("type summary clear")
- self.expect("frame variable int_array --summary-string \"${var[0][0-2]%hex}\"",
- substrs = ['0x',
- '7'])
+ self.expect(
+ "frame variable int_array --summary-string \"${var[0][0-2]%hex}\"",
+ substrs=[
+ '0x',
+ '7'])
self.runCmd("type summary clear")
- self.runCmd("type summary add --summary-string \"${*var[].x[0-3]%hex} is a bitfield on a set of integers\" -x \"SimpleWithPointers \[[0-9]\]\"")
+ self.runCmd(
+ "type summary add --summary-string \"${*var[].x[0-3]%hex} is a bitfield on a set of integers\" -x \"SimpleWithPointers \[[0-9]\]\"")
- self.expect("frame variable couple --summary-string \"${*var.sp.x[0-2]} are low bits of integer ${*var.sp.x}. If I pretend it is an array I get ${var.sp.x[0-5]}\"",
- substrs = ['1 are low bits of integer 9.',
- 'If I pretend it is an array I get [9,'])
+ self.expect(
+ "frame variable couple --summary-string \"${*var.sp.x[0-2]} are low bits of integer ${*var.sp.x}. If I pretend it is an array I get ${var.sp.x[0-5]}\"",
+ substrs=[
+ '1 are low bits of integer 9.',
+ 'If I pretend it is an array I get [9,'])
# if the summary has an error, we still display the value
- self.expect("frame variable couple --summary-string \"${*var.sp.foo[0-2]\"",
- substrs = ['(Couple) couple = {','x = 0x','y = 0x','z = 0x','s = 0x'])
-
-
- self.runCmd("type summary add --summary-string \"${*var.sp.x[0-2]} are low bits of integer ${*var.sp.x}. If I pretend it is an array I get ${var.sp.x[0-5]}\" Couple")
+ self.expect(
+ "frame variable couple --summary-string \"${*var.sp.foo[0-2]\"",
+ substrs=[
+ '(Couple) couple = {',
+ 'x = 0x',
+ 'y = 0x',
+ 'z = 0x',
+ 's = 0x'])
+
+ self.runCmd(
+ "type summary add --summary-string \"${*var.sp.x[0-2]} are low bits of integer ${*var.sp.x}. If I pretend it is an array I get ${var.sp.x[0-5]}\" Couple")
self.expect("frame variable sparray",
- substrs = ['[0x0000000f,0x0000000c,0x00000009]'])
-
- # check that we can format a variable in a summary even if a format is defined for its datatype
+ substrs=['[0x0000000f,0x0000000c,0x00000009]'])
+
+ # check that we can format a variable in a summary even if a format is
+ # defined for its datatype
self.runCmd("type format add -f hex int")
- self.runCmd("type summary add --summary-string \"x=${var.x%d}\" Simple")
+ self.runCmd(
+ "type summary add --summary-string \"x=${var.x%d}\" Simple")
self.expect("frame variable a_simple_object",
- substrs = ['x=3'])
+ substrs=['x=3'])
self.expect("frame variable a_simple_object", matching=False,
- substrs = ['0x0'])
+ substrs=['0x0'])
# now check that the default is applied if we do not hand out a format
self.runCmd("type summary add --summary-string \"x=${var.x}\" Simple")
self.expect("frame variable a_simple_object", matching=False,
- substrs = ['x=3'])
+ substrs=['x=3'])
self.expect("frame variable a_simple_object", matching=True,
- substrs = ['x=0x00000003'])
+ substrs=['x=0x00000003'])
# check that we can correctly cap the number of children shown
self.runCmd("settings set target.max-children-count 5")
self.expect('frame variable a_long_guy', matching=True,
- substrs = ['a_1',
- 'b_1',
- 'c_1',
- 'd_1',
- 'e_1',
- '...'])
+ substrs=['a_1',
+ 'b_1',
+ 'c_1',
+ 'd_1',
+ 'e_1',
+ '...'])
# check that no further stuff is printed (not ALL values are checked!)
self.expect('frame variable a_long_guy', matching=False,
- substrs = ['f_1',
- 'g_1',
- 'h_1',
- 'i_1',
- 'j_1',
- 'q_1',
- 'a_2',
- 'f_2',
- 't_2',
- 'w_2'])
+ substrs=['f_1',
+ 'g_1',
+ 'h_1',
+ 'i_1',
+ 'j_1',
+ 'q_1',
+ 'a_2',
+ 'f_2',
+ 't_2',
+ 'w_2'])
self.runCmd("settings set target.max-children-count 1")
self.expect('frame variable a_long_guy', matching=True,
- substrs = ['a_1',
- '...'])
+ substrs=['a_1',
+ '...'])
self.expect('frame variable a_long_guy', matching=False,
- substrs = ['b_1',
- 'c_1',
- 'd_1',
- 'e_1'])
+ substrs=['b_1',
+ 'c_1',
+ 'd_1',
+ 'e_1'])
self.expect('frame variable a_long_guy', matching=False,
- substrs = ['f_1',
- 'g_1',
- 'h_1',
- 'i_1',
- 'j_1',
- 'q_1',
- 'a_2',
- 'f_2',
- 't_2',
- 'w_2'])
+ substrs=['f_1',
+ 'g_1',
+ 'h_1',
+ 'i_1',
+ 'j_1',
+ 'q_1',
+ 'a_2',
+ 'f_2',
+ 't_2',
+ 'w_2'])
self.runCmd("settings set target.max-children-count 30")
self.expect('frame variable a_long_guy', matching=True,
- substrs = ['a_1',
- 'b_1',
- 'c_1',
- 'd_1',
- 'e_1',
- 'z_1',
- 'a_2',
- 'b_2',
- 'c_2',
- 'd_2',
- '...'])
+ substrs=['a_1',
+ 'b_1',
+ 'c_1',
+ 'd_1',
+ 'e_1',
+ 'z_1',
+ 'a_2',
+ 'b_2',
+ 'c_2',
+ 'd_2',
+ '...'])
self.expect('frame variable a_long_guy', matching=False,
- substrs = ['e_2',
- 'n_2',
- 'r_2',
- 'i_2',
- 'k_2',
- 'o_2'])
-
- # override the cap
- self.expect('frame variable a_long_guy --show-all-children', matching=True,
- substrs = ['a_1',
- 'b_1',
- 'c_1',
- 'd_1',
- 'e_1',
- 'z_1',
- 'a_2',
- 'b_2',
- 'c_2',
- 'd_2'])
- self.expect('frame variable a_long_guy --show-all-children', matching=True,
- substrs = ['e_2',
- 'n_2',
- 'r_2',
- 'i_2',
- 'k_2',
- 'o_2'])
- self.expect('frame variable a_long_guy --show-all-children', matching=False,
- substrs = ['...'])
+ substrs=['e_2',
+ 'n_2',
+ 'r_2',
+ 'i_2',
+ 'k_2',
+ 'o_2'])
+
+ # override the cap
+ self.expect(
+ 'frame variable a_long_guy --show-all-children',
+ matching=True,
+ substrs=[
+ 'a_1',
+ 'b_1',
+ 'c_1',
+ 'd_1',
+ 'e_1',
+ 'z_1',
+ 'a_2',
+ 'b_2',
+ 'c_2',
+ 'd_2'])
+ self.expect(
+ 'frame variable a_long_guy --show-all-children',
+ matching=True,
+ substrs=[
+ 'e_2',
+ 'n_2',
+ 'r_2',
+ 'i_2',
+ 'k_2',
+ 'o_2'])
+ self.expect(
+ 'frame variable a_long_guy --show-all-children',
+ matching=False,
+ substrs=['...'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-categories/TestDataFormatterCategories.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-categories/TestDataFormatterCategories.py
index f8209f03d0c2..2d01eb79e188 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-categories/TestDataFormatterCategories.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-categories/TestDataFormatterCategories.py
@@ -5,13 +5,14 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class CategoriesDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -27,14 +28,15 @@ class CategoriesDataFormatterTestCase(TestBase):
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case (most of these categories do not
@@ -46,286 +48,312 @@ class CategoriesDataFormatterTestCase(TestBase):
self.runCmd('type category delete Category2', check=False)
self.runCmd('type category delete NewCategory', check=False)
self.runCmd("type category delete CircleCategory", check=False)
- self.runCmd("type category delete RectangleStarCategory", check=False)
+ self.runCmd(
+ "type category delete RectangleStarCategory",
+ check=False)
self.runCmd("type category delete BaseCategory", check=False)
-
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
# Add a summary to a new category and check that it works
- self.runCmd("type summary add Rectangle --summary-string \"ARectangle\" -w NewCategory")
+ self.runCmd(
+ "type summary add Rectangle --summary-string \"ARectangle\" -w NewCategory")
self.expect("frame variable r1 r2 r3", matching=False,
- substrs = ['r1 = ARectangle',
- 'r2 = ARectangle',
- 'r3 = ARectangle'])
-
+ substrs=['r1 = ARectangle',
+ 'r2 = ARectangle',
+ 'r3 = ARectangle'])
+
self.runCmd("type category enable NewCategory")
self.expect("frame variable r1 r2 r3", matching=True,
- substrs = ['r1 = ARectangle',
- 'r2 = ARectangle',
- 'r3 = ARectangle'])
-
+ substrs=['r1 = ARectangle',
+ 'r2 = ARectangle',
+ 'r3 = ARectangle'])
+
# Disable the category and check that the old stuff is there
self.runCmd("type category disable NewCategory")
self.expect("frame variable r1 r2 r3",
- substrs = ['r1 = {',
- 'r2 = {',
- 'r3 = {'])
+ substrs=['r1 = {',
+ 'r2 = {',
+ 'r3 = {'])
# Re-enable the category and check that it works
self.runCmd("type category enable NewCategory")
self.expect("frame variable r1 r2 r3",
- substrs = ['r1 = ARectangle',
- 'r2 = ARectangle',
- 'r3 = ARectangle'])
+ substrs=['r1 = ARectangle',
+ 'r2 = ARectangle',
+ 'r3 = ARectangle'])
# Delete the category and the old stuff should be there
self.runCmd("type category delete NewCategory")
self.expect("frame variable r1 r2 r3",
- substrs = ['r1 = {',
- 'r2 = {',
- 'r3 = {'])
-
- # Add summaries to two different categories and check that we can switch
- self.runCmd("type summary add --summary-string \"Width = ${var.w}, Height = ${var.h}\" Rectangle -w Category1")
+ substrs=['r1 = {',
+ 'r2 = {',
+ 'r3 = {'])
+
+ # Add summaries to two different categories and check that we can
+ # switch
+ self.runCmd(
+ "type summary add --summary-string \"Width = ${var.w}, Height = ${var.h}\" Rectangle -w Category1")
self.runCmd("type summary add --python-script \"return 'Area = ' + str( int(valobj.GetChildMemberWithName('w').GetValue()) * int(valobj.GetChildMemberWithName('h').GetValue()) );\" Rectangle -w Category2")
# check that enable A B is the same as enable B enable A
self.runCmd("type category enable Category1 Category2")
-
+
self.expect("frame variable r1 r2 r3",
- substrs = ['r1 = Width = ',
- 'r2 = Width = ',
- 'r3 = Width = '])
+ substrs=['r1 = Width = ',
+ 'r2 = Width = ',
+ 'r3 = Width = '])
self.runCmd("type category disable Category1")
self.expect("frame variable r1 r2 r3",
- substrs = ['r1 = Area = ',
- 'r2 = Area = ',
- 'r3 = Area = '])
+ substrs=['r1 = Area = ',
+ 'r2 = Area = ',
+ 'r3 = Area = '])
# switch again
self.runCmd("type category enable Category1")
self.expect("frame variable r1 r2 r3",
- substrs = ['r1 = Width = ',
- 'r2 = Width = ',
- 'r3 = Width = '])
+ substrs=['r1 = Width = ',
+ 'r2 = Width = ',
+ 'r3 = Width = '])
# Re-enable the category and show that the preference is persisted
self.runCmd("type category disable Category2")
self.runCmd("type category enable Category2")
-
+
self.expect("frame variable r1 r2 r3",
- substrs = ['r1 = Area = ',
- 'r2 = Area = ',
- 'r3 = Area = '])
+ substrs=['r1 = Area = ',
+ 'r2 = Area = ',
+ 'r3 = Area = '])
# Now delete the favorite summary
self.runCmd("type summary delete Rectangle -w Category2")
self.expect("frame variable r1 r2 r3",
- substrs = ['r1 = Width = ',
- 'r2 = Width = ',
- 'r3 = Width = '])
+ substrs=['r1 = Width = ',
+ 'r2 = Width = ',
+ 'r3 = Width = '])
# Delete the summary from the default category (that does not have it)
self.runCmd("type summary delete Rectangle", check=False)
self.expect("frame variable r1 r2 r3",
- substrs = ['r1 = Width = ',
- 'r2 = Width = ',
- 'r3 = Width = '])
+ substrs=['r1 = Width = ',
+ 'r2 = Width = ',
+ 'r3 = Width = '])
# Now add another summary to another category and switch back and forth
self.runCmd("type category delete Category1 Category2")
- self.runCmd("type summary add Rectangle -w Category1 --summary-string \"Category1\"")
- self.runCmd("type summary add Rectangle -w Category2 --summary-string \"Category2\"")
+ self.runCmd(
+ "type summary add Rectangle -w Category1 --summary-string \"Category1\"")
+ self.runCmd(
+ "type summary add Rectangle -w Category2 --summary-string \"Category2\"")
self.runCmd("type category enable Category2")
self.runCmd("type category enable Category1")
-
+
self.runCmd("type summary list -w Category1")
- self.expect("type summary list -w NoSuchCategoryHere", substrs=['no matching results found'])
-
+ self.expect("type summary list -w NoSuchCategoryHere",
+ substrs=['no matching results found'])
+
self.expect("frame variable r1 r2 r3",
- substrs = ['r1 = Category1',
- 'r2 = Category1',
- 'r3 = Category1'])
+ substrs=['r1 = Category1',
+ 'r2 = Category1',
+ 'r3 = Category1'])
self.runCmd("type category disable Category1")
self.expect("frame variable r1 r2 r3",
- substrs = ['r1 = Category2',
- 'r2 = Category2',
- 'r3 = Category2'])
+ substrs=['r1 = Category2',
+ 'r2 = Category2',
+ 'r3 = Category2'])
# Check that re-enabling an enabled category works
self.runCmd("type category enable Category1")
self.expect("frame variable r1 r2 r3",
- substrs = ['r1 = Category1',
- 'r2 = Category1',
- 'r3 = Category1'])
+ substrs=['r1 = Category1',
+ 'r2 = Category1',
+ 'r3 = Category1'])
self.runCmd("type category delete Category1")
self.runCmd("type category delete Category2")
self.expect("frame variable r1 r2 r3",
- substrs = ['r1 = {',
- 'r2 = {',
- 'r3 = {'])
-
- # Check that multiple summaries can go into one category
- self.runCmd("type summary add -w Category1 --summary-string \"Width = ${var.w}, Height = ${var.h}\" Rectangle")
- self.runCmd("type summary add -w Category1 --summary-string \"Radius = ${var.r}\" Circle")
-
+ substrs=['r1 = {',
+ 'r2 = {',
+ 'r3 = {'])
+
+ # Check that multiple summaries can go into one category
+ self.runCmd(
+ "type summary add -w Category1 --summary-string \"Width = ${var.w}, Height = ${var.h}\" Rectangle")
+ self.runCmd(
+ "type summary add -w Category1 --summary-string \"Radius = ${var.r}\" Circle")
+
self.runCmd("type category enable Category1")
self.expect("frame variable r1 r2 r3",
- substrs = ['r1 = Width = ',
- 'r2 = Width = ',
- 'r3 = Width = '])
+ substrs=['r1 = Width = ',
+ 'r2 = Width = ',
+ 'r3 = Width = '])
self.expect("frame variable c1 c2 c3",
- substrs = ['c1 = Radius = ',
- 'c2 = Radius = ',
- 'c3 = Radius = '])
+ substrs=['c1 = Radius = ',
+ 'c2 = Radius = ',
+ 'c3 = Radius = '])
self.runCmd("type summary delete Circle -w Category1")
-
+
self.expect("frame variable c1 c2 c3",
- substrs = ['c1 = {',
- 'c2 = {',
- 'c3 = {'])
+ substrs=['c1 = {',
+ 'c2 = {',
+ 'c3 = {'])
# Add a regex based summary to a category
- self.runCmd("type summary add -w Category1 --summary-string \"Radius = ${var.r}\" -x Circle")
+ self.runCmd(
+ "type summary add -w Category1 --summary-string \"Radius = ${var.r}\" -x Circle")
self.expect("frame variable r1 r2 r3",
- substrs = ['r1 = Width = ',
- 'r2 = Width = ',
- 'r3 = Width = '])
+ substrs=['r1 = Width = ',
+ 'r2 = Width = ',
+ 'r3 = Width = '])
self.expect("frame variable c1 c2 c3",
- substrs = ['c1 = Radius = ',
- 'c2 = Radius = ',
- 'c3 = Radius = '])
+ substrs=['c1 = Radius = ',
+ 'c2 = Radius = ',
+ 'c3 = Radius = '])
# Delete it
self.runCmd("type summary delete Circle -w Category1")
self.expect("frame variable c1 c2 c3",
- substrs = ['c1 = {',
- 'c2 = {',
- 'c3 = {'])
-
- # Change a summary inside a category and check that the change is reflected
- self.runCmd("type summary add Circle -w Category1 --summary-string \"summary1\"")
+ substrs=['c1 = {',
+ 'c2 = {',
+ 'c3 = {'])
+
+ # Change a summary inside a category and check that the change is
+ # reflected
+ self.runCmd(
+ "type summary add Circle -w Category1 --summary-string \"summary1\"")
self.expect("frame variable c1 c2 c3",
- substrs = ['c1 = summary1',
- 'c2 = summary1',
- 'c3 = summary1'])
+ substrs=['c1 = summary1',
+ 'c2 = summary1',
+ 'c3 = summary1'])
+
+ self.runCmd(
+ "type summary add Circle -w Category1 --summary-string \"summary2\"")
- self.runCmd("type summary add Circle -w Category1 --summary-string \"summary2\"")
-
self.expect("frame variable c1 c2 c3",
- substrs = ['c1 = summary2',
- 'c2 = summary2',
- 'c3 = summary2'])
+ substrs=['c1 = summary2',
+ 'c2 = summary2',
+ 'c3 = summary2'])
# Check that our order of priority works. Start by clearing categories
self.runCmd("type category delete Category1")
- self.runCmd("type summary add Shape -w BaseCategory --summary-string \"AShape\"")
+ self.runCmd(
+ "type summary add Shape -w BaseCategory --summary-string \"AShape\"")
self.runCmd("type category enable BaseCategory")
self.expect("print (Shape*)&c1",
- substrs = ['AShape'])
+ substrs=['AShape'])
self.expect("print (Shape*)&r1",
- substrs = ['AShape'])
+ substrs=['AShape'])
self.expect("print (Shape*)c_ptr",
- substrs = ['AShape'])
+ substrs=['AShape'])
self.expect("print (Shape*)r_ptr",
- substrs = ['AShape'])
+ substrs=['AShape'])
- self.runCmd("type summary add Circle -w CircleCategory --summary-string \"ACircle\"")
- self.runCmd("type summary add Rectangle -w RectangleCategory --summary-string \"ARectangle\"")
+ self.runCmd(
+ "type summary add Circle -w CircleCategory --summary-string \"ACircle\"")
+ self.runCmd(
+ "type summary add Rectangle -w RectangleCategory --summary-string \"ARectangle\"")
self.runCmd("type category enable CircleCategory")
self.expect("frame variable c1",
- substrs = ['ACircle'])
+ substrs=['ACircle'])
self.expect("frame variable c_ptr",
- substrs = ['ACircle'])
+ substrs=['ACircle'])
- self.runCmd("type summary add \"Rectangle *\" -w RectangleStarCategory --summary-string \"ARectangleStar\"")
+ self.runCmd(
+ "type summary add \"Rectangle *\" -w RectangleStarCategory --summary-string \"ARectangleStar\"")
self.runCmd("type category enable RectangleStarCategory")
self.expect("frame variable c1 r1 c_ptr r_ptr",
- substrs = ['ACircle',
- 'ARectangleStar'])
+ substrs=['ACircle',
+ 'ARectangleStar'])
self.runCmd("type category enable RectangleCategory")
self.expect("frame variable c1 r1 c_ptr r_ptr",
- substrs = ['ACircle',
- 'ACircle',
- 'ARectangle'])
+ substrs=['ACircle',
+ 'ACircle',
+ 'ARectangle'])
# Check that abruptly deleting an enabled category does not crash us
self.runCmd("type category delete RectangleCategory")
self.expect("frame variable c1 r1 c_ptr r_ptr",
- substrs = ['ACircle',
- '(Rectangle) r1 = ', 'w = 5', 'h = 6',
- 'ACircle',
- 'ARectangleStar'])
-
+ substrs=['ACircle',
+ '(Rectangle) r1 = ', 'w = 5', 'h = 6',
+ 'ACircle',
+ 'ARectangleStar'])
+
# check that list commands work
self.expect("type category list",
- substrs = ['RectangleStarCategory (enabled)'])
+ substrs=['RectangleStarCategory (enabled)'])
self.expect("type summary list",
- substrs = ['ARectangleStar'])
+ substrs=['ARectangleStar'])
# Disable a category and check that it fallsback
self.runCmd("type category disable CircleCategory")
-
+
# check that list commands work
self.expect("type category list",
- substrs = ['CircleCategory (disabled'])
+ substrs=['CircleCategory (disabled'])
self.expect("frame variable c1 r_ptr",
- substrs = ['AShape',
- 'ARectangleStar'])
+ substrs=['AShape',
+ 'ARectangleStar'])
# check that filters work into categories
- self.runCmd("type filter add Rectangle --child w --category RectangleCategory")
+ self.runCmd(
+ "type filter add Rectangle --child w --category RectangleCategory")
self.runCmd("type category enable RectangleCategory")
- self.runCmd("type summary add Rectangle --category RectangleCategory --summary-string \" \" -e")
+ self.runCmd(
+ "type summary add Rectangle --category RectangleCategory --summary-string \" \" -e")
self.expect('frame variable r2',
- substrs = ['w = 9'])
+ substrs=['w = 9'])
self.runCmd("type summary add Rectangle --summary-string \" \" -e")
self.expect('frame variable r2', matching=False,
- substrs = ['h = 16'])
+ substrs=['h = 16'])
# Now delete all categories
- self.runCmd("type category delete CircleCategory RectangleStarCategory BaseCategory RectangleCategory")
+ self.runCmd(
+ "type category delete CircleCategory RectangleStarCategory BaseCategory RectangleCategory")
# check that a deleted category with filter does not blow us up
self.expect('frame variable r2',
- substrs = ['w = 9',
- 'h = 16'])
+ substrs=['w = 9',
+ 'h = 16'])
# and also validate that one can print formatters for a language
- self.expect('type summary list -l c++', substrs=['vector', 'map', 'list', 'string'])
+ self.expect(
+ 'type summary list -l c++',
+ substrs=[
+ 'vector',
+ 'map',
+ 'list',
+ 'string'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py
index 99443a04f672..0518a75051bb 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py
@@ -5,13 +5,14 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class CppDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -22,24 +23,27 @@ class CppDataFormatterTestCase(TestBase):
# Find the line number to break at.
self.line = line_number('main.cpp', '// Set break point at this line.')
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24462: Data formatters have problems on Windows")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24462: Data formatters have problems on Windows")
def test_with_run_command(self):
"""Test that that file and class static variables display correctly."""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
self.expect("frame variable",
- substrs = ['(Speed) SPILookHex = 5.55' # Speed by default is 5.55.
- ]);
+ substrs=['(Speed) SPILookHex = 5.55' # Speed by default is 5.55.
+ ])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -57,210 +61,238 @@ class CppDataFormatterTestCase(TestBase):
# The type format list should show our custom formats.
self.expect("type format list",
- substrs = ['RealNumber',
- 'Speed',
- 'BitField',
- 'Type1',
- 'Type2'])
+ substrs=['RealNumber',
+ 'Speed',
+ 'BitField',
+ 'Type1',
+ 'Type2'])
self.expect("frame variable",
- patterns = ['\(Speed\) SPILookHex = 0x[0-9a-f]+' # Speed should look hex-ish now.
- ]);
-
+ patterns=['\(Speed\) SPILookHex = 0x[0-9a-f]+' # Speed should look hex-ish now.
+ ])
+
# gcc4.2 on Mac OS X skips typedef chains in the DWARF output
- if self.getCompiler() in ['clang', 'llvm-gcc']:
+ if self.getCompiler() in ['clang', 'llvm-gcc']:
self.expect("frame variable",
- patterns = ['\(SignalMask\) SMILookHex = 0x[0-9a-f]+' # SignalMask should look hex-ish now.
- ]);
+ patterns=['\(SignalMask\) SMILookHex = 0x[0-9a-f]+' # SignalMask should look hex-ish now.
+ ])
self.expect("frame variable", matching=False,
- patterns = ['\(Type4\) T4ILookChar = 0x[0-9a-f]+' # Type4 should NOT look hex-ish now.
- ]);
-
+ patterns=['\(Type4\) T4ILookChar = 0x[0-9a-f]+' # Type4 should NOT look hex-ish now.
+ ])
+
# Now let's delete the 'Speed' custom format.
self.runCmd("type format delete Speed")
# The type format list should not show 'Speed' at this point.
self.expect("type format list", matching=False,
- substrs = ['Speed'])
+ substrs=['Speed'])
# Delete type format for 'Speed', we should expect an error message.
self.expect("type format delete Speed", error=True,
- substrs = ['no custom formatter for Speed'])
-
- self.runCmd("type summary add --summary-string \"arr = ${var%s}\" -x \"char \\[[0-9]+\\]\" -v")
-
+ substrs=['no custom formatter for Speed'])
+
+ self.runCmd(
+ "type summary add --summary-string \"arr = ${var%s}\" -x \"char \\[[0-9]+\\]\" -v")
+
self.expect("frame variable strarr",
- substrs = ['arr = "Hello world!"'])
-
+ substrs=['arr = "Hello world!"'])
+
self.runCmd("type summary clear")
-
- self.runCmd("type summary add --summary-string \"ptr = ${var%s}\" \"char *\" -v")
-
+
+ self.runCmd(
+ "type summary add --summary-string \"ptr = ${var%s}\" \"char *\" -v")
+
self.expect("frame variable strptr",
- substrs = ['ptr = "Hello world!"'])
-
- self.runCmd("type summary add --summary-string \"arr = ${var%s}\" -x \"char \\[[0-9]+\\]\" -v")
-
+ substrs=['ptr = "Hello world!"'])
+
+ self.runCmd(
+ "type summary add --summary-string \"arr = ${var%s}\" -x \"char \\[[0-9]+\\]\" -v")
+
self.expect("frame variable strarr",
- substrs = ['arr = "Hello world!'])
+ substrs=['arr = "Hello world!'])
- # check that rdar://problem/10011145 (Standard summary format for char[] doesn't work as the result of "expr".) is solved
+ # check that rdar://problem/10011145 (Standard summary format for
+ # char[] doesn't work as the result of "expr".) is solved
self.expect("p strarr",
- substrs = ['arr = "Hello world!'])
+ substrs=['arr = "Hello world!'])
self.expect("frame variable strptr",
- substrs = ['ptr = "Hello world!"'])
+ substrs=['ptr = "Hello world!"'])
self.expect("p strptr",
- substrs = ['ptr = "Hello world!"'])
+ substrs=['ptr = "Hello world!"'])
- self.expect("p (char*)\"1234567890123456789012345678901234567890123456789012345678901234ABC\"",
- substrs = ['(char *) $', ' = ptr = ', ' "1234567890123456789012345678901234567890123456789012345678901234ABC"'])
+ self.expect(
+ "p (char*)\"1234567890123456789012345678901234567890123456789012345678901234ABC\"",
+ substrs=[
+ '(char *) $',
+ ' = ptr = ',
+ ' "1234567890123456789012345678901234567890123456789012345678901234ABC"'])
self.runCmd("type summary add -c Point")
-
+
self.expect("frame variable iAmSomewhere",
- substrs = ['x = 4',
- 'y = 6'])
-
+ substrs=['x = 4',
+ 'y = 6'])
+
self.expect("type summary list",
- substrs = ['Point',
- 'one-line'])
+ substrs=['Point',
+ 'one-line'])
self.runCmd("type summary add --summary-string \"y=${var.y%x}\" Point")
self.expect("frame variable iAmSomewhere",
- substrs = ['y=0x'])
-
- self.runCmd("type summary add --summary-string \"y=${var.y},x=${var.x}\" Point")
-
+ substrs=['y=0x'])
+
+ self.runCmd(
+ "type summary add --summary-string \"y=${var.y},x=${var.x}\" Point")
+
self.expect("frame variable iAmSomewhere",
- substrs = ['y=6',
- 'x=4'])
+ substrs=['y=6',
+ 'x=4'])
self.runCmd("type summary add --summary-string \"hello\" Point -e")
self.expect("type summary list",
- substrs = ['Point',
- 'show children'])
-
+ substrs=['Point',
+ 'show children'])
+
self.expect("frame variable iAmSomewhere",
- substrs = ['hello',
- 'x = 4',
- '}'])
+ substrs=['hello',
+ 'x = 4',
+ '}'])
- self.runCmd("type summary add --summary-string \"Sign: ${var[31]%B} Exponent: ${var[23-30]%x} Mantissa: ${var[0-22]%u}\" ShowMyGuts")
+ self.runCmd(
+ "type summary add --summary-string \"Sign: ${var[31]%B} Exponent: ${var[23-30]%x} Mantissa: ${var[0-22]%u}\" ShowMyGuts")
self.expect("frame variable cool_pointer->floating",
- substrs = ['Sign: true',
- 'Exponent: 0x',
- '80'])
+ substrs=['Sign: true',
+ 'Exponent: 0x',
+ '80'])
self.runCmd("type summary add --summary-string \"a test\" i_am_cool")
self.expect("frame variable cool_pointer",
- substrs = ['a test'])
+ substrs=['a test'])
+
+ self.runCmd(
+ "type summary add --summary-string \"a test\" i_am_cool --skip-pointers")
- self.runCmd("type summary add --summary-string \"a test\" i_am_cool --skip-pointers")
-
self.expect("frame variable cool_pointer",
- substrs = ['a test'],
- matching = False)
+ substrs=['a test'],
+ matching=False)
- self.runCmd("type summary add --summary-string \"${var[1-3]}\" \"int [5]\"")
+ self.runCmd(
+ "type summary add --summary-string \"${var[1-3]}\" \"int [5]\"")
self.expect("frame variable int_array",
- substrs = ['2',
- '3',
- '4'])
+ substrs=['2',
+ '3',
+ '4'])
self.runCmd("type summary clear")
- self.runCmd("type summary add --summary-string \"${var[0-2].integer}\" \"i_am_cool *\"")
- self.runCmd("type summary add --summary-string \"${var[2-4].integer}\" \"i_am_cool [5]\"")
+ self.runCmd(
+ "type summary add --summary-string \"${var[0-2].integer}\" \"i_am_cool *\"")
+ self.runCmd(
+ "type summary add --summary-string \"${var[2-4].integer}\" \"i_am_cool [5]\"")
self.expect("frame variable cool_array",
- substrs = ['1,1,6'])
+ substrs=['1,1,6'])
self.expect("frame variable cool_pointer",
- substrs = ['3,0,0'])
+ substrs=['3,0,0'])
# test special symbols for formatting variables into summaries
- self.runCmd("type summary add --summary-string \"cool object @ ${var%L}\" i_am_cool")
+ self.runCmd(
+ "type summary add --summary-string \"cool object @ ${var%L}\" i_am_cool")
self.runCmd("type summary delete \"i_am_cool [5]\"")
-
+
# this test might fail if the compiler tries to store
# these values into registers.. hopefully this is not
# going to be the case
self.expect("frame variable cool_array",
- substrs = ['[0] = cool object @ 0x',
- '[1] = cool object @ 0x',
- '[2] = cool object @ 0x',
- '[3] = cool object @ 0x',
- '[4] = cool object @ 0x'])
-
- # test getting similar output by exploiting ${var} = 'type @ location' for aggregates
+ substrs=['[0] = cool object @ 0x',
+ '[1] = cool object @ 0x',
+ '[2] = cool object @ 0x',
+ '[3] = cool object @ 0x',
+ '[4] = cool object @ 0x'])
+
+ # test getting similar output by exploiting ${var} = 'type @ location'
+ # for aggregates
self.runCmd("type summary add --summary-string \"${var}\" i_am_cool")
-
+
# this test might fail if the compiler tries to store
# these values into registers.. hopefully this is not
# going to be the case
self.expect("frame variable cool_array",
- substrs = ['[0] = i_am_cool @ 0x',
- '[1] = i_am_cool @ 0x',
- '[2] = i_am_cool @ 0x',
- '[3] = i_am_cool @ 0x',
- '[4] = i_am_cool @ 0x'])
-
-
- # test getting same output by exploiting %T and %L together for aggregates
- self.runCmd("type summary add --summary-string \"${var%T} @ ${var%L}\" i_am_cool")
-
+ substrs=['[0] = i_am_cool @ 0x',
+ '[1] = i_am_cool @ 0x',
+ '[2] = i_am_cool @ 0x',
+ '[3] = i_am_cool @ 0x',
+ '[4] = i_am_cool @ 0x'])
+
+ # test getting same output by exploiting %T and %L together for
+ # aggregates
+ self.runCmd(
+ "type summary add --summary-string \"${var%T} @ ${var%L}\" i_am_cool")
+
# this test might fail if the compiler tries to store
# these values into registers.. hopefully this is not
# going to be the case
self.expect("frame variable cool_array",
- substrs = ['[0] = i_am_cool @ 0x',
- '[1] = i_am_cool @ 0x',
- '[2] = i_am_cool @ 0x',
- '[3] = i_am_cool @ 0x',
- '[4] = i_am_cool @ 0x'])
-
+ substrs=['[0] = i_am_cool @ 0x',
+ '[1] = i_am_cool @ 0x',
+ '[2] = i_am_cool @ 0x',
+ '[3] = i_am_cool @ 0x',
+ '[4] = i_am_cool @ 0x'])
+
self.runCmd("type summary add --summary-string \"goofy\" i_am_cool")
- self.runCmd("type summary add --summary-string \"${var.second_cool%S}\" i_am_cooler")
+ self.runCmd(
+ "type summary add --summary-string \"${var.second_cool%S}\" i_am_cooler")
self.expect("frame variable the_coolest_guy",
- substrs = ['(i_am_cooler) the_coolest_guy = goofy'])
+ substrs=['(i_am_cooler) the_coolest_guy = goofy'])
# check that unwanted type specifiers are removed
self.runCmd("type summary delete i_am_cool")
- self.runCmd("type summary add --summary-string \"goofy\" \"class i_am_cool\"")
+ self.runCmd(
+ "type summary add --summary-string \"goofy\" \"class i_am_cool\"")
self.expect("frame variable the_coolest_guy",
- substrs = ['(i_am_cooler) the_coolest_guy = goofy'])
+ substrs=['(i_am_cooler) the_coolest_guy = goofy'])
self.runCmd("type summary delete i_am_cool")
- self.runCmd("type summary add --summary-string \"goofy\" \"enum i_am_cool\"")
+ self.runCmd(
+ "type summary add --summary-string \"goofy\" \"enum i_am_cool\"")
self.expect("frame variable the_coolest_guy",
- substrs = ['(i_am_cooler) the_coolest_guy = goofy'])
+ substrs=['(i_am_cooler) the_coolest_guy = goofy'])
self.runCmd("type summary delete i_am_cool")
- self.runCmd("type summary add --summary-string \"goofy\" \"struct i_am_cool\"")
+ self.runCmd(
+ "type summary add --summary-string \"goofy\" \"struct i_am_cool\"")
self.expect("frame variable the_coolest_guy",
- substrs = ['(i_am_cooler) the_coolest_guy = goofy'])
+ substrs=['(i_am_cooler) the_coolest_guy = goofy'])
# many spaces, but we still do the right thing
self.runCmd("type summary delete i_am_cool")
- self.runCmd("type summary add --summary-string \"goofy\" \"union i_am_cool\"")
+ self.runCmd(
+ "type summary add --summary-string \"goofy\" \"union i_am_cool\"")
self.expect("frame variable the_coolest_guy",
- substrs = ['(i_am_cooler) the_coolest_guy = goofy'])
+ substrs=['(i_am_cooler) the_coolest_guy = goofy'])
# but that not *every* specifier is removed
self.runCmd("type summary delete i_am_cool")
- self.runCmd("type summary add --summary-string \"goofy\" \"wrong i_am_cool\"")
+ self.runCmd(
+ "type summary add --summary-string \"goofy\" \"wrong i_am_cool\"")
self.expect("frame variable the_coolest_guy", matching=False,
- substrs = ['(i_am_cooler) the_coolest_guy = goofy'])
-
- # check that formats are not sticking since that is the behavior we want
- self.expect("frame variable iAmInt --format hex", substrs = ['(int) iAmInt = 0x00000001'])
- self.expect("frame variable iAmInt", matching=False, substrs = ['(int) iAmInt = 0x00000001'])
- self.expect("frame variable iAmInt", substrs = ['(int) iAmInt = 1'])
+ substrs=['(i_am_cooler) the_coolest_guy = goofy'])
+
+ # check that formats are not sticking since that is the behavior we
+ # want
+ self.expect("frame variable iAmInt --format hex",
+ substrs=['(int) iAmInt = 0x00000001'])
+ self.expect(
+ "frame variable iAmInt",
+ matching=False,
+ substrs=['(int) iAmInt = 0x00000001'])
+ self.expect("frame variable iAmInt", substrs=['(int) iAmInt = 1'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-disabling/TestDataFormatterDisabling.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-disabling/TestDataFormatterDisabling.py
index 2c2e08431175..e192943f381e 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-disabling/TestDataFormatterDisabling.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-disabling/TestDataFormatterDisabling.py
@@ -5,13 +5,14 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class DataFormatterDisablingTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -22,62 +23,69 @@ class DataFormatterDisablingTestCase(TestBase):
# Find the line number to break at.
self.line = line_number('main.cpp', '// Set break point at this line.')
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24462, Data formatters have problems on Windows")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24462, Data formatters have problems on Windows")
def test_with_run_command(self):
"""Check that we can properly disable all data formatter categories."""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
def cleanup():
- self.runCmd('type category enable *', check=False)
+ self.runCmd('type category enable *', check=False)
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
#self.runCmd('type category enable system VectorTypes libcxx gnu-libstdc++ CoreGraphics CoreServices AppKit CoreFoundation objc default', check=False)
- self.expect('type category list', substrs = ['system','enabled',])
+ self.expect('type category list', substrs=['system', 'enabled', ])
self.expect("frame variable numbers",
- substrs = ['[0] = 1', '[3] = 1234'])
+ substrs=['[0] = 1', '[3] = 1234'])
- self.expect('frame variable string1', substrs = ['hello world'])
+ self.expect('frame variable string1', substrs=['hello world'])
# now disable them all and check that nothing is formatted
self.runCmd('type category disable *')
self.expect("frame variable numbers", matching=False,
- substrs = ['[0] = 1', '[3] = 1234'])
+ substrs=['[0] = 1', '[3] = 1234'])
+
+ self.expect(
+ 'frame variable string1',
+ matching=False,
+ substrs=['hello world'])
- self.expect('frame variable string1', matching=False, substrs = ['hello world'])
+ self.expect('type summary list', substrs=[
+ 'Category: system (disabled)'])
- self.expect('type summary list', substrs=['Category: system (disabled)'])
+ self.expect('type category list', substrs=['system', 'disabled', ])
- self.expect('type category list', substrs = ['system','disabled',])
-
# now enable and check that we are back to normal
self.runCmd("type category enable *")
- self.expect('type category list', substrs = ['system','enabled'])
+ self.expect('type category list', substrs=['system', 'enabled'])
self.expect("frame variable numbers",
- substrs = ['[0] = 1', '[3] = 1234'])
+ substrs=['[0] = 1', '[3] = 1234'])
- self.expect('frame variable string1', substrs = ['hello world'])
+ self.expect('frame variable string1', substrs=['hello world'])
- self.expect('type category list', substrs = ['system','enabled'])
+ self.expect('type category list', substrs=['system', 'enabled'])
# last check - our cleanup will re-enable everything
self.runCmd('type category disable *')
- self.expect('type category list', substrs = ['system','disabled'])
+ self.expect('type category list', substrs=['system', 'disabled'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-enum-format/TestDataFormatterEnumFormat.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-enum-format/TestDataFormatterEnumFormat.py
index 1659ade74a06..710cfa8fe12c 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-enum-format/TestDataFormatterEnumFormat.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-enum-format/TestDataFormatterEnumFormat.py
@@ -5,12 +5,13 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class EnumFormatTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -26,21 +27,22 @@ class EnumFormatTestCase(TestBase):
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
self.expect("frame variable",
- substrs = ['(Foo) f = Case45',
- '(int) x = 1',
- '(int) y = 45',
- '(int) z = 43'
- ]);
+ substrs=['(Foo) f = Case45',
+ '(int) x = 1',
+ '(int) y = 45',
+ '(int) z = 43'
+ ])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -55,11 +57,11 @@ class EnumFormatTestCase(TestBase):
# The type format list should show our custom formats.
self.expect("type format list -w default",
- substrs = ['int: as type Foo'])
+ substrs=['int: as type Foo'])
self.expect("frame variable",
- substrs = ['(Foo) f = Case45',
- '(int) x = Case1',
- '(int) y = Case45',
- '(int) z = 43'
- ]);
+ substrs=['(Foo) f = Case45',
+ '(int) x = Case1',
+ '(int) y = Case45',
+ '(int) z = 43'
+ ])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-globals/TestDataFormatterGlobals.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-globals/TestDataFormatterGlobals.py
index df3bef091c89..d3d93dabc7fb 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-globals/TestDataFormatterGlobals.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-globals/TestDataFormatterGlobals.py
@@ -5,12 +5,13 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class GlobalsDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -26,7 +27,8 @@ class GlobalsDataFormatterTestCase(TestBase):
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -41,27 +43,29 @@ class GlobalsDataFormatterTestCase(TestBase):
# Simply check we can get at global variables
self.expect("target variable g_point",
- substrs = ['JustATest'])
+ substrs=['JustATest'])
self.expect("target variable g_point_pointer",
- substrs = ['(Point *) g_point_pointer ='])
+ substrs=['(Point *) g_point_pointer ='])
# Print some information about the variables
# (we ignore the actual values)
- self.runCmd("type summary add --summary-string \"(x=${var.x},y=${var.y})\" Point")
+ self.runCmd(
+ "type summary add --summary-string \"(x=${var.x},y=${var.y})\" Point")
self.expect("target variable g_point",
- substrs = ['x=',
- 'y='])
-
+ substrs=['x=',
+ 'y='])
+
self.expect("target variable g_point_pointer",
- substrs = ['(Point *) g_point_pointer ='])
+ substrs=['(Point *) g_point_pointer ='])
# Test Python code on resulting SBValue
- self.runCmd("type summary add --python-script \"return 'x=' + str(valobj.GetChildMemberWithName('x').GetValue());\" Point")
+ self.runCmd(
+ "type summary add --python-script \"return 'x=' + str(valobj.GetChildMemberWithName('x').GetValue());\" Point")
self.expect("target variable g_point",
- substrs = ['x='])
-
+ substrs=['x='])
+
self.expect("target variable g_point_pointer",
- substrs = ['(Point *) g_point_pointer ='])
+ substrs=['(Point *) g_point_pointer ='])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-named-summaries/TestDataFormatterNamedSummaries.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-named-summaries/TestDataFormatterNamedSummaries.py
index e9ac79ad08e2..f4f0a4859896 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-named-summaries/TestDataFormatterNamedSummaries.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-named-summaries/TestDataFormatterNamedSummaries.py
@@ -5,12 +5,13 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class NamedSummariesDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -26,15 +27,16 @@ class NamedSummariesDataFormatterTestCase(TestBase):
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
-
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
+
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
def cleanup():
@@ -44,81 +46,88 @@ class NamedSummariesDataFormatterTestCase(TestBase):
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
- self.runCmd("type summary add --summary-string \"AllUseIt: x=${var.x} {y=${var.y}} {z=${var.z}}\" --name AllUseIt")
- self.runCmd("type summary add --summary-string \"First: x=${var.x} y=${var.y} dummy=${var.dummy}\" First")
- self.runCmd("type summary add --summary-string \"Second: x=${var.x} y=${var.y%hex}\" Second")
- self.runCmd("type summary add --summary-string \"Third: x=${var.x} z=${var.z}\" Third")
-
+ self.runCmd(
+ "type summary add --summary-string \"AllUseIt: x=${var.x} {y=${var.y}} {z=${var.z}}\" --name AllUseIt")
+ self.runCmd(
+ "type summary add --summary-string \"First: x=${var.x} y=${var.y} dummy=${var.dummy}\" First")
+ self.runCmd(
+ "type summary add --summary-string \"Second: x=${var.x} y=${var.y%hex}\" Second")
+ self.runCmd(
+ "type summary add --summary-string \"Third: x=${var.x} z=${var.z}\" Third")
+
self.expect('type summary list', substrs=['AllUseIt'])
-
+
self.expect("frame variable first",
- substrs = ['First: x=12'])
+ substrs=['First: x=12'])
self.expect("frame variable first --summary AllUseIt",
- substrs = ['AllUseIt: x=12'])
-
+ substrs=['AllUseIt: x=12'])
+
# We *DO NOT* remember the summary choice anymore
self.expect("frame variable first", matching=False,
- substrs = ['AllUseIt: x=12'])
+ substrs=['AllUseIt: x=12'])
self.expect("frame variable first",
- substrs = ['First: x=12'])
+ substrs=['First: x=12'])
+
+ self.runCmd("thread step-over") # 2
- self.runCmd("thread step-over") # 2
-
self.expect("frame variable first",
- substrs = ['First: x=12'])
-
+ substrs=['First: x=12'])
+
self.expect("frame variable first --summary AllUseIt",
- substrs = ['AllUseIt: x=12',
- 'y=34'])
+ substrs=['AllUseIt: x=12',
+ 'y=34'])
self.expect("frame variable second --summary AllUseIt",
- substrs = ['AllUseIt: x=65',
- 'y=43.25'])
+ substrs=['AllUseIt: x=65',
+ 'y=43.25'])
self.expect("frame variable third --summary AllUseIt",
- substrs = ['AllUseIt: x=96',
- 'z=',
- 'E'])
+ substrs=['AllUseIt: x=96',
+ 'z=',
+ 'E'])
+
+ self.runCmd("thread step-over") # 3
- self.runCmd("thread step-over") # 3
-
self.expect("frame variable second",
- substrs = ['Second: x=65',
- 'y=0x'])
-
+ substrs=['Second: x=65',
+ 'y=0x'])
+
# <rdar://problem/11576143> decided that invalid summaries will raise an error
# instead of just defaulting to the base summary
- self.expect("frame variable second --summary NoSuchSummary",error=True,
- substrs = ['must specify a valid named summary'])
-
+ self.expect(
+ "frame variable second --summary NoSuchSummary",
+ error=True,
+ substrs=['must specify a valid named summary'])
+
self.runCmd("thread step-over")
-
- self.runCmd("type summary add --summary-string \"FirstAndFriends: x=${var.x} {y=${var.y}} {z=${var.z}}\" First --name FirstAndFriends")
-
+
+ self.runCmd(
+ "type summary add --summary-string \"FirstAndFriends: x=${var.x} {y=${var.y}} {z=${var.z}}\" First --name FirstAndFriends")
+
self.expect("frame variable first",
- substrs = ['FirstAndFriends: x=12',
- 'y=34'])
+ substrs=['FirstAndFriends: x=12',
+ 'y=34'])
self.runCmd("type summary delete First")
-
+
self.expect("frame variable first --summary FirstAndFriends",
- substrs = ['FirstAndFriends: x=12',
- 'y=34'])
-
+ substrs=['FirstAndFriends: x=12',
+ 'y=34'])
+
self.expect("frame variable first", matching=True,
- substrs = ['x = 12',
- 'y = 34'])
-
+ substrs=['x = 12',
+ 'y = 34'])
+
self.runCmd("type summary delete FirstAndFriends")
self.expect("type summary delete NoSuchSummary", error=True)
self.runCmd("type summary delete AllUseIt")
-
+
self.expect("frame variable first", matching=False,
- substrs = ['FirstAndFriends'])
+ substrs=['FirstAndFriends'])
- self.runCmd("thread step-over") # 4
+ self.runCmd("thread step-over") # 4
- self.expect("frame variable first",matching=False,
- substrs = ['FirstAndFriends: x=12',
- 'y=34'])
+ self.expect("frame variable first", matching=False,
+ substrs=['FirstAndFriends: x=12',
+ 'y=34'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
index d7d4118d1d6a..d0a1728b87e6 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
@@ -6,14 +6,15 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
import datetime
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ObjCDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -24,7 +25,7 @@ class ObjCDataFormatterTestCase(TestBase):
self.build()
self.plain_data_formatter_commands()
- def appkit_tester_impl(self,commands):
+ def appkit_tester_impl(self, commands):
self.build()
self.appkit_common_data_formatters_command()
commands()
@@ -49,25 +50,21 @@ class ObjCDataFormatterTestCase(TestBase):
"""Test formatters for NSURL."""
self.appkit_tester_impl(self.nsurl_data_formatter_commands)
-
@skipUnlessDarwin
def test_nserror_with_run_command(self):
"""Test formatters for NSError."""
self.appkit_tester_impl(self.nserror_data_formatter_commands)
-
@skipUnlessDarwin
def test_nsbundle_with_run_command(self):
"""Test formatters for NSBundle."""
self.appkit_tester_impl(self.nsbundle_data_formatter_commands)
-
@skipUnlessDarwin
def test_nsexception_with_run_command(self):
"""Test formatters for NSException."""
self.appkit_tester_impl(self.nsexception_data_formatter_commands)
-
@skipUnlessDarwin
def test_nsdate_with_run_command(self):
"""Test formatters for NSDate."""
@@ -101,14 +98,15 @@ class ObjCDataFormatterTestCase(TestBase):
"""Test basic ObjC formatting behavior."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -123,57 +121,58 @@ class ObjCDataFormatterTestCase(TestBase):
self.runCmd("type summary add --summary-string \"${var%@}\" MyClass")
self.expect("frame variable object2",
- substrs = ['MyOtherClass']);
-
+ substrs=['MyOtherClass'])
+
self.expect("frame variable *object2",
- substrs = ['MyOtherClass']);
+ substrs=['MyOtherClass'])
# Now let's delete the 'MyClass' custom summary.
self.runCmd("type summary delete MyClass")
# The type format list should not show 'MyClass' at this point.
self.expect("type summary list", matching=False,
- substrs = ['MyClass'])
+ substrs=['MyClass'])
self.runCmd("type summary add --summary-string \"a test\" MyClass")
-
+
self.expect("frame variable *object2",
- substrs = ['*object2 =',
- 'MyClass = a test',
- 'backup = ']);
-
+ substrs=['*object2 =',
+ 'MyClass = a test',
+ 'backup = '])
+
self.expect("frame variable object2", matching=False,
- substrs = ['a test']);
-
+ substrs=['a test'])
+
self.expect("frame variable object",
- substrs = ['a test']);
-
+ substrs=['a test'])
+
self.expect("frame variable *object",
- substrs = ['a test']);
+ substrs=['a test'])
self.expect('frame variable myclass',
- substrs = ['(Class) myclass = NSValue'])
+ substrs=['(Class) myclass = NSValue'])
self.expect('frame variable myclass2',
- substrs = ['(Class) myclass2 = ','NS','String'])
+ substrs=['(Class) myclass2 = ', 'NS', 'String'])
self.expect('frame variable myclass3',
- substrs = ['(Class) myclass3 = Molecule'])
+ substrs=['(Class) myclass3 = Molecule'])
self.expect('frame variable myclass4',
- substrs = ['(Class) myclass4 = NSMutableArray'])
+ substrs=['(Class) myclass4 = NSMutableArray'])
self.expect('frame variable myclass5',
- substrs = ['(Class) myclass5 = nil'])
+ substrs=['(Class) myclass5 = nil'])
def appkit_common_data_formatters_command(self):
"""Test formatters for AppKit classes."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -184,132 +183,183 @@ class ObjCDataFormatterTestCase(TestBase):
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
-
+
def nsnumber_data_formatter_commands(self):
# Now enable AppKit and check we are displaying Cocoa classes correctly
self.expect('frame variable num1 num2 num3 num4 num5 num6 num7 num9',
- substrs = ['(NSNumber *) num1 = ',' (int)5',
- '(NSNumber *) num2 = ',' (float)3.1',
- '(NSNumber *) num3 = ',' (double)3.14',
- '(NSNumber *) num4 = ',' (long)-2',
- '(NSNumber *) num5 = ',' (char)65',
- '(NSNumber *) num6 = ',' (long)255',
- '(NSNumber *) num7 = ','2000000',
- '(NSNumber *) num9 = ',' (short)-31616'])
+ substrs=['(NSNumber *) num1 = ', ' (int)5',
+ '(NSNumber *) num2 = ', ' (float)3.1',
+ '(NSNumber *) num3 = ', ' (double)3.14',
+ '(NSNumber *) num4 = ', ' (long)-2',
+ '(NSNumber *) num5 = ', ' (char)65',
+ '(NSNumber *) num6 = ', ' (long)255',
+ '(NSNumber *) num7 = ', '2000000',
+ '(NSNumber *) num9 = ', ' (short)-31616'])
self.expect('frame variable num_at1 num_at2 num_at3 num_at4',
- substrs = ['(NSNumber *) num_at1 = ',' (int)12',
- '(NSNumber *) num_at2 = ',' (int)-12',
- '(NSNumber *) num_at3 = ',' (double)12.5',
- '(NSNumber *) num_at4 = ',' (double)-12.5'])
+ substrs=['(NSNumber *) num_at1 = ', ' (int)12',
+ '(NSNumber *) num_at2 = ', ' (int)-12',
+ '(NSNumber *) num_at3 = ', ' (double)12.5',
+ '(NSNumber *) num_at4 = ', ' (double)-12.5'])
def nscontainers_data_formatter_commands(self):
- self.expect('frame variable newArray newDictionary newMutableDictionary cfarray_ref mutable_array_ref',
- substrs = ['(NSArray *) newArray = ','@"50 elements"',
- '(NSDictionary *) newDictionary = ',' 12 key/value pairs',
- '(NSDictionary *) newMutableDictionary = ',' 21 key/value pairs',
- '(CFArrayRef) cfarray_ref = ','@"3 elements"',
- '(CFMutableArrayRef) mutable_array_ref = ','@"11 elements"'])
+ self.expect(
+ 'frame variable newArray newDictionary newMutableDictionary cfarray_ref mutable_array_ref',
+ substrs=[
+ '(NSArray *) newArray = ',
+ '@"50 elements"',
+ '(NSDictionary *) newDictionary = ',
+ ' 12 key/value pairs',
+ '(NSDictionary *) newMutableDictionary = ',
+ ' 21 key/value pairs',
+ '(CFArrayRef) cfarray_ref = ',
+ '@"3 elements"',
+ '(CFMutableArrayRef) mutable_array_ref = ',
+ '@"11 elements"'])
self.expect('frame variable iset1 iset2 imset',
- substrs = ['4 indexes','512 indexes','10 indexes'])
+ substrs=['4 indexes', '512 indexes', '10 indexes'])
- self.expect('frame variable binheap_ref',
- substrs = ['(CFBinaryHeapRef) binheap_ref = ','@"21 items"'])
+ self.expect(
+ 'frame variable binheap_ref',
+ substrs=[
+ '(CFBinaryHeapRef) binheap_ref = ',
+ '@"21 items"'])
- self.expect('expression -d run -- [NSArray new]', substrs=['@"0 elements"'])
+ self.expect(
+ 'expression -d run -- (NSArray*)[NSArray new]',
+ substrs=['@"0 elements"'])
def nsdata_data_formatter_commands(self):
- self.expect('frame variable immutableData mutableData data_ref mutable_data_ref mutable_string_ref',
- substrs = ['(NSData *) immutableData = ',' 4 bytes',
- '(NSData *) mutableData = ',' 14 bytes',
- '(CFDataRef) data_ref = ','@"5 bytes"',
- '(CFMutableDataRef) mutable_data_ref = ','@"5 bytes"',
- '(CFMutableStringRef) mutable_string_ref = ',' @"Wish ya knew"'])
+ self.expect(
+ 'frame variable immutableData mutableData data_ref mutable_data_ref mutable_string_ref',
+ substrs=[
+ '(NSData *) immutableData = ',
+ ' 4 bytes',
+ '(NSData *) mutableData = ',
+ ' 14 bytes',
+ '(CFDataRef) data_ref = ',
+ '@"5 bytes"',
+ '(CFMutableDataRef) mutable_data_ref = ',
+ '@"5 bytes"',
+ '(CFMutableStringRef) mutable_string_ref = ',
+ ' @"Wish ya knew"'])
def nsurl_data_formatter_commands(self):
- self.expect('frame variable cfurl_ref cfchildurl_ref cfgchildurl_ref',
- substrs = ['(CFURLRef) cfurl_ref = ','@"http://www.foo.bar',
- 'cfchildurl_ref = ','@"page.html -- http://www.foo.bar',
- '(CFURLRef) cfgchildurl_ref = ','@"?whatever -- http://www.foo.bar/page.html"'])
-
- self.expect('frame variable nsurl nsurl2 nsurl3',
- substrs = ['(NSURL *) nsurl = ','@"http://www.foo.bar',
- '(NSURL *) nsurl2 =','@"page.html -- http://www.foo.bar',
- '(NSURL *) nsurl3 = ','@"?whatever -- http://www.foo.bar/page.html"'])
+ self.expect(
+ 'frame variable cfurl_ref cfchildurl_ref cfgchildurl_ref',
+ substrs=[
+ '(CFURLRef) cfurl_ref = ',
+ '@"http://www.foo.bar',
+ 'cfchildurl_ref = ',
+ '@"page.html -- http://www.foo.bar',
+ '(CFURLRef) cfgchildurl_ref = ',
+ '@"?whatever -- http://www.foo.bar/page.html"'])
+
+ self.expect(
+ 'frame variable nsurl nsurl2 nsurl3',
+ substrs=[
+ '(NSURL *) nsurl = ',
+ '@"http://www.foo.bar',
+ '(NSURL *) nsurl2 =',
+ '@"page.html -- http://www.foo.bar',
+ '(NSURL *) nsurl3 = ',
+ '@"?whatever -- http://www.foo.bar/page.html"'])
def nserror_data_formatter_commands(self):
self.expect('frame variable nserror',
- substrs = ['domain: @"Foobar" - code: 12'])
+ substrs=['domain: @"Foobar" - code: 12'])
self.expect('frame variable nserrorptr',
- substrs = ['domain: @"Foobar" - code: 12'])
+ substrs=['domain: @"Foobar" - code: 12'])
self.expect('frame variable nserror->_userInfo',
- substrs = ['2 key/value pairs'])
+ substrs=['2 key/value pairs'])
- self.expect('frame variable nserror->_userInfo --ptr-depth 1 -d run-target',
- substrs = ['@"a"','@"b"',"1","2"])
+ self.expect(
+ 'frame variable nserror->_userInfo --ptr-depth 1 -d run-target',
+ substrs=[
+ '@"a"',
+ '@"b"',
+ "1",
+ "2"])
def nsbundle_data_formatter_commands(self):
- self.expect('frame variable bundle_string bundle_url main_bundle',
- substrs = ['(NSBundle *) bundle_string = ',' @"/System/Library/Frameworks/Accelerate.framework"',
- '(NSBundle *) bundle_url = ',' @"/System/Library/Frameworks/Cocoa.framework"',
- '(NSBundle *) main_bundle = ','data-formatter-objc'])
+ self.expect(
+ 'frame variable bundle_string bundle_url main_bundle',
+ substrs=[
+ '(NSBundle *) bundle_string = ',
+ ' @"/System/Library/Frameworks/Accelerate.framework"',
+ '(NSBundle *) bundle_url = ',
+ ' @"/System/Library/Frameworks/Foundation.framework"',
+ '(NSBundle *) main_bundle = ',
+ 'data-formatter-objc'])
def nsexception_data_formatter_commands(self):
- self.expect('frame variable except0 except1 except2 except3',
- substrs = ['(NSException *) except0 = ','name: @"TheGuyWhoHasNoName" - reason: @"cuz it\'s funny"',
- '(NSException *) except1 = ','name: @"TheGuyWhoHasNoName~1" - reason: @"cuz it\'s funny"',
- '(NSException *) except2 = ','name: @"TheGuyWhoHasNoName`2" - reason: @"cuz it\'s funny"',
- '(NSException *) except3 = ','name: @"TheGuyWhoHasNoName/3" - reason: @"cuz it\'s funny"'])
+ self.expect(
+ 'frame variable except0 except1 except2 except3',
+ substrs=[
+ '(NSException *) except0 = ',
+ 'name: @"TheGuyWhoHasNoName" - reason: @"cuz it\'s funny"',
+ '(NSException *) except1 = ',
+ 'name: @"TheGuyWhoHasNoName~1" - reason: @"cuz it\'s funny"',
+ '(NSException *) except2 = ',
+ 'name: @"TheGuyWhoHasNoName`2" - reason: @"cuz it\'s funny"',
+ '(NSException *) except3 = ',
+ 'name: @"TheGuyWhoHasNoName/3" - reason: @"cuz it\'s funny"'])
def nsdate_data_formatter_commands(self):
- self.expect('frame variable date1 date2',
- patterns = ['(1985-04-10|1985-04-11)','(2011-01-01|2010-12-31)'])
+ self.expect(
+ 'frame variable date1 date2',
+ patterns=[
+ '(1985-04-10|1985-04-11)',
+ '(2011-01-01|2010-12-31)'])
# this test might fail if we hit the breakpoint late on December 31st of some given year
# and midnight comes between hitting the breakpoint and running this line of code
# hopefully the output will be revealing enough in that case :-)
now_year = '%s-' % str(datetime.datetime.now().year)
- self.expect('frame variable date3', substrs = [now_year])
- self.expect('frame variable date4', substrs = ['1970'])
- self.expect('frame variable date5', substrs = [now_year])
+ self.expect('frame variable date3', substrs=[now_year])
+ self.expect('frame variable date4', substrs=['1970'])
+ self.expect('frame variable date5', substrs=[now_year])
self.expect('frame variable date1_abs date2_abs',
- substrs = ['1985-04','2011-01'])
+ substrs=['1985-04', '2011-01'])
- self.expect('frame variable date3_abs', substrs = [now_year])
- self.expect('frame variable date4_abs', substrs = ['1970'])
- self.expect('frame variable date5_abs', substrs = [now_year])
+ self.expect('frame variable date3_abs', substrs=[now_year])
+ self.expect('frame variable date4_abs', substrs=['1970'])
+ self.expect('frame variable date5_abs', substrs=[now_year])
self.expect('frame variable cupertino home europe',
- substrs = ['@"America/Los_Angeles"',
- '@"Europe/Rome"',
- '@"Europe/Paris"'])
+ substrs=['@"America/Los_Angeles"',
+ '@"Europe/Rome"',
+ '@"Europe/Paris"'])
self.expect('frame variable cupertino_ns home_ns europe_ns',
- substrs = ['@"America/Los_Angeles"',
- '@"Europe/Rome"',
- '@"Europe/Paris"'])
-
- self.expect('frame variable mut_bv',
- substrs = ['(CFMutableBitVectorRef) mut_bv = ', '1110 0110 1011 0000 1101 1010 1000 1111 0011 0101 1101 0001 00'])
+ substrs=['@"America/Los_Angeles"',
+ '@"Europe/Rome"',
+ '@"Europe/Paris"'])
+ self.expect(
+ 'frame variable mut_bv',
+ substrs=[
+ '(CFMutableBitVectorRef) mut_bv = ',
+ '1110 0110 1011 0000 1101 1010 1000 1111 0011 0101 1101 0001 00'])
def expr_objc_data_formatter_commands(self):
"""Test common cases of expression parser <--> formatters interaction."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -323,36 +373,41 @@ class ObjCDataFormatterTestCase(TestBase):
# check that the formatters are able to deal safely and correctly
# with ValueObjects that the expression parser returns
- self.expect('expression ((id)@"Hello for long enough to avoid short string types")', matching=False,
- substrs = ['Hello for long enough to avoid short string types'])
+ self.expect(
+ 'expression ((id)@"Hello for long enough to avoid short string types")',
+ matching=False,
+ substrs=['Hello for long enough to avoid short string types'])
- self.expect('expression -d run -- ((id)@"Hello for long enough to avoid short string types")',
- substrs = ['Hello for long enough to avoid short string types'])
+ self.expect(
+ 'expression -d run -- ((id)@"Hello for long enough to avoid short string types")',
+ substrs=['Hello for long enough to avoid short string types'])
self.expect('expr -d run -- label1',
- substrs = ['Process Name'])
-
- self.expect('expr -d run -- @"Hello for long enough to avoid short string types"',
- substrs = ['Hello for long enough to avoid short string types'])
+ substrs=['Process Name'])
- self.expect('expr -d run --object-description -- @"Hello for long enough to avoid short string types"',
- substrs = ['Hello for long enough to avoid short string types'])
- self.expect('expr -d run --object-description -- @"Hello"', matching=False,
- substrs = ['@"Hello" Hello'])
+ self.expect(
+ 'expr -d run -- @"Hello for long enough to avoid short string types"',
+ substrs=['Hello for long enough to avoid short string types'])
+ self.expect(
+ 'expr -d run --object-description -- @"Hello for long enough to avoid short string types"',
+ substrs=['Hello for long enough to avoid short string types'])
+ self.expect('expr -d run --object-description -- @"Hello"',
+ matching=False, substrs=['@"Hello" Hello'])
def cf_data_formatter_commands(self):
"""Test formatters for Core OSX frameworks."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -361,50 +416,53 @@ class ObjCDataFormatterTestCase(TestBase):
self.runCmd('type summary clear', check=False)
self.runCmd('type synth clear', check=False)
-
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
# check formatters for common Objective-C types
- expect_strings = ['(CFGregorianUnits) cf_greg_units = 1 years, 3 months, 5 days, 12 hours, 5 minutes 7 seconds',
- '(CFRange) cf_range = location=4 length=4',
- '(NSPoint) ns_point = (x = 4, y = 4)',
- '(NSRange) ns_range = location=4, length=4',
- '(NSRect) ns_rect = (origin = (x = 1, y = 1), size = (width = 5, height = 5))',
- '(NSRectArray) ns_rect_arr = ((x = 1, y = 1), (width = 5, height = 5)), ...',
- '(NSSize) ns_size = (width = 5, height = 7)',
- '(CGSize) cg_size = (width = 1, height = 6)',
- '(CGPoint) cg_point = (x = 2, y = 7)',
- '(CGRect) cg_rect = (origin = (x = 1, y = 2), size = (width = 7, height = 7))',
- '(Rect) rect = (t=4, l=8, b=4, r=7)',
- '(Rect *) rect_ptr = (t=4, l=8, b=4, r=7)',
- '(Point) point = (v=7, h=12)',
- '(Point *) point_ptr = (v=7, h=12)',
- '1985',
- 'foo_selector_impl'];
-
+ expect_strings = [
+ '(CFGregorianUnits) cf_greg_units = 1 years, 3 months, 5 days, 12 hours, 5 minutes 7 seconds',
+ '(CFRange) cf_range = location=4 length=4',
+ '(NSPoint) ns_point = (x = 4, y = 4)',
+ '(NSRange) ns_range = location=4, length=4',
+ '(NSRect) ns_rect = (origin = (x = 1, y = 1), size = (width = 5, height = 5))',
+ '(NSRectArray) ns_rect_arr = ((x = 1, y = 1), (width = 5, height = 5)), ...',
+ '(NSSize) ns_size = (width = 5, height = 7)',
+ '(CGSize) cg_size = (width = 1, height = 6)',
+ '(CGPoint) cg_point = (x = 2, y = 7)',
+ '(CGRect) cg_rect = (origin = (x = 1, y = 2), size = (width = 7, height = 7))',
+ '(Rect) rect = (t=4, l=8, b=4, r=7)',
+ '(Rect *) rect_ptr = (t=4, l=8, b=4, r=7)',
+ '(Point) point = (v=7, h=12)',
+ '(Point *) point_ptr = (v=7, h=12)',
+ '1985',
+ 'foo_selector_impl']
+
if self.getArchitecture() in ['i386', 'x86_64']:
expect_strings.append('(HIPoint) hi_point = (x=7, y=12)')
- expect_strings.append('(HIRect) hi_rect = origin=(x = 3, y = 5) size=(width = 4, height = 6)')
- expect_strings.append('(RGBColor) rgb_color = red=3 green=56 blue=35')
- expect_strings.append('(RGBColor *) rgb_color_ptr = red=3 green=56 blue=35')
-
- self.expect("frame variable",
- substrs = expect_strings)
+ expect_strings.append(
+ '(HIRect) hi_rect = origin=(x = 3, y = 5) size=(width = 4, height = 6)')
+ expect_strings.append(
+ '(RGBColor) rgb_color = red=3 green=56 blue=35')
+ expect_strings.append(
+ '(RGBColor *) rgb_color_ptr = red=3 green=56 blue=35')
+ self.expect("frame variable",
+ substrs=expect_strings)
def kvo_data_formatter_commands(self):
"""Test the behavior of formatters when KVO is in use."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -420,18 +478,23 @@ class ObjCDataFormatterTestCase(TestBase):
# we should be able to dynamically figure out that the KVO implementor class
# is a subclass of Molecule, and use the appropriate summary for it
self.runCmd("type summary add -s JustAMoleculeHere Molecule")
- self.expect('frame variable molecule', substrs = ['JustAMoleculeHere'])
+ self.expect('frame variable molecule', substrs=['JustAMoleculeHere'])
self.runCmd("next")
self.expect("thread list",
- substrs = ['stopped',
- 'step over'])
- self.expect('frame variable molecule', substrs = ['JustAMoleculeHere'])
+ substrs=['stopped',
+ 'step over'])
+ self.expect('frame variable molecule', substrs=['JustAMoleculeHere'])
self.runCmd("next")
- # check that NSMutableDictionary's formatter is not confused when dealing with a KVO'd dictionary
- self.expect('frame variable newMutableDictionary', substrs = ['(NSDictionary *) newMutableDictionary = ',' 21 key/value pairs'])
+ # check that NSMutableDictionary's formatter is not confused when
+ # dealing with a KVO'd dictionary
+ self.expect(
+ 'frame variable newMutableDictionary',
+ substrs=[
+ '(NSDictionary *) newMutableDictionary = ',
+ ' 21 key/value pairs'])
- lldbutil.run_break_set_by_regexp (self, 'setAtoms')
+ lldbutil.run_break_set_by_regexp(self, 'setAtoms')
self.runCmd("continue")
- self.expect("frame variable _cmd",substrs = ['setAtoms:'])
+ self.expect("frame variable _cmd", substrs=['setAtoms:'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m
index 020e2fc6227a..1543ce6edb91 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m
@@ -463,7 +463,7 @@ int main (int argc, const char * argv[])
NSError **nserrorptr = &nserror;
NSBundle* bundle_string = [[NSBundle alloc] initWithPath:@"/System/Library/Frameworks/Accelerate.framework"];
- NSBundle* bundle_url = [[NSBundle alloc] initWithURL:[[NSURL alloc] initWithString:@"file://localhost/System/Library/Frameworks/Cocoa.framework"]];
+ NSBundle* bundle_url = [[NSBundle alloc] initWithURL:[[NSURL alloc] initWithString:@"file://localhost/System/Library/Frameworks/Foundation.framework"]];
NSBundle* main_bundle = [NSBundle mainBundle];
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/Makefile
new file mode 100644
index 000000000000..0d94c2247f14
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+OBJC_SOURCES := main.m
+
+CFLAGS_EXTRAS += -w
+
+include $(LEVEL)/Makefile.rules
+
+LDFLAGS += -framework Foundation
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/TestDataFormatterNSIndexPath.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/TestDataFormatterNSIndexPath.py
new file mode 100644
index 000000000000..2d66a941ed34
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/TestDataFormatterNSIndexPath.py
@@ -0,0 +1,115 @@
+# encoding: utf-8
+"""
+Test lldb data formatter subsystem.
+"""
+
+from __future__ import print_function
+
+
+import os
+import time
+import datetime
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class NSIndexPathDataFormatterTestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def appkit_tester_impl(self, commands):
+ self.build()
+ self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
+
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
+
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ # The stop reason of the thread should be breakpoint.
+ self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
+
+ # This is the function to remove the custom formats in order to have a
+ # clean slate for the next test case.
+ def cleanup():
+ self.runCmd('type format clear', check=False)
+ self.runCmd('type summary clear', check=False)
+ self.runCmd('type synth clear', check=False)
+
+ # Execute the cleanup function during test case tear down.
+ self.addTearDownHook(cleanup)
+ commands()
+
+ @skipUnlessDarwin
+ @expectedFailureAll(archs=['i386'], bugnumber="rdar://28656605")
+ def test_nsindexpath_with_run_command(self):
+ """Test formatters for NSIndexPath."""
+ self.appkit_tester_impl(self.nsindexpath_data_formatter_commands)
+
+ def setUp(self):
+ # Call super's setUp().
+ TestBase.setUp(self)
+ # Find the line number to break at.
+ self.line = line_number('main.m', '// break here')
+
+ def nsindexpath_data_formatter_commands(self):
+ # check 'frame variable'
+ self.expect(
+ 'frame variable --ptr-depth=1 -d run -- indexPath1',
+ substrs=['[0] = 1'])
+ self.expect(
+ 'frame variable --ptr-depth=1 -d run -- indexPath2',
+ substrs=[
+ '[0] = 1',
+ '[1] = 2'])
+ self.expect(
+ 'frame variable --ptr-depth=1 -d run -- indexPath3',
+ substrs=[
+ '[0] = 1',
+ '[1] = 2',
+ '[2] = 3'])
+ self.expect(
+ 'frame variable --ptr-depth=1 -d run -- indexPath4',
+ substrs=[
+ '[0] = 1',
+ '[1] = 2',
+ '[2] = 3',
+ '[3] = 4'])
+ self.expect(
+ 'frame variable --ptr-depth=1 -d run -- indexPath5',
+ substrs=[
+ '[0] = 1',
+ '[1] = 2',
+ '[2] = 3',
+ '[3] = 4',
+ '[4] = 5'])
+
+ # and 'expression'
+ self.expect(
+ 'expression --ptr-depth=1 -d run -- indexPath1',
+ substrs=['[0] = 1'])
+ self.expect(
+ 'expression --ptr-depth=1 -d run -- indexPath2',
+ substrs=[
+ '[0] = 1',
+ '[1] = 2'])
+ self.expect(
+ 'expression --ptr-depth=1 -d run -- indexPath3',
+ substrs=[
+ '[0] = 1',
+ '[1] = 2',
+ '[2] = 3'])
+ self.expect('expression --ptr-depth=1 -d run -- indexPath4',
+ substrs=['[0] = 1', '[1] = 2', '[2] = 3', '[3] = 4'])
+ self.expect(
+ 'expression --ptr-depth=1 -d run -- indexPath5',
+ substrs=[
+ '[0] = 1',
+ '[1] = 2',
+ '[2] = 3',
+ '[3] = 4',
+ '[4] = 5'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/main.m b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/main.m
new file mode 100644
index 000000000000..baaff180e34e
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsindexpath/main.m
@@ -0,0 +1,31 @@
+//===-- main.m ------------------------------------------------*- ObjC -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#import <Foundation/Foundation.h>
+
+int main(int argc, const char **argv)
+{
+ @autoreleasepool
+ {
+ const NSUInteger values[] = { 1, 2, 3, 4, 5 };
+
+ NSIndexPath* indexPath1 = [NSIndexPath indexPathWithIndexes:values length:1];
+ NSIndexPath* indexPath2 = [NSIndexPath indexPathWithIndexes:values length:2];
+ NSIndexPath* indexPath3 = [NSIndexPath indexPathWithIndexes:values length:3];
+ NSIndexPath* indexPath4 = [NSIndexPath indexPathWithIndexes:values length:4];
+ NSIndexPath* indexPath5 = [NSIndexPath indexPathWithIndexes:values length:5];
+
+ NSLog(@"%@", indexPath1); // break here
+ NSLog(@"%@", indexPath2);
+ NSLog(@"%@", indexPath3);
+ NSLog(@"%@", indexPath4);
+ NSLog(@"%@", indexPath5);
+ }
+ return 0;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsstring/TestDataFormatterNSString.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsstring/TestDataFormatterNSString.py
index f5c792593772..12e62f62ee97 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsstring/TestDataFormatterNSString.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsstring/TestDataFormatterNSString.py
@@ -6,30 +6,32 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import datetime
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class NSStringDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- def appkit_tester_impl(self,commands):
+ def appkit_tester_impl(self, commands):
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -38,7 +40,6 @@ class NSStringDataFormatterTestCase(TestBase):
self.runCmd('type summary clear', check=False)
self.runCmd('type synth clear', check=False)
-
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
commands()
@@ -58,7 +59,6 @@ class NSStringDataFormatterTestCase(TestBase):
"""Test formatters for NSString."""
self.appkit_tester_impl(self.nsstring_withNULs_commands)
-
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
@@ -67,42 +67,55 @@ class NSStringDataFormatterTestCase(TestBase):
def rdar11106605_commands(self):
"""Check that Unicode characters come out of CFString summary correctly."""
- self.expect('frame variable italian', substrs = ['L\'Italia è una Repubblica democratica, fondata sul lavoro. La sovranità appartiene al popolo, che la esercita nelle forme e nei limiti della Costituzione.'])
- self.expect('frame variable french', substrs = ['Que veut cette horde d\'esclaves, De traîtres, de rois conjurés?'])
- self.expect('frame variable german', substrs = ['Über-Ich und aus den Ansprüchen der sozialen Umwelt'])
- self.expect('frame variable japanese', substrs = ['色は匂へど散りぬるを'])
- self.expect('frame variable hebrew', substrs = ['לילה טוב'])
+ self.expect('frame variable italian', substrs=[
+ 'L\'Italia è una Repubblica democratica, fondata sul lavoro. La sovranità appartiene al popolo, che la esercita nelle forme e nei limiti della Costituzione.'])
+ self.expect('frame variable french', substrs=[
+ 'Que veut cette horde d\'esclaves, De traîtres, de rois conjurés?'])
+ self.expect('frame variable german', substrs=[
+ 'Über-Ich und aus den Ansprüchen der sozialen Umwelt'])
+ self.expect('frame variable japanese', substrs=['色は匂へど散りぬるを'])
+ self.expect('frame variable hebrew', substrs=['לילה טוב'])
def nsstring_data_formatter_commands(self):
self.expect('frame variable str0 str1 str2 str3 str4 str5 str6 str8 str9 str10 str11 label1 label2 processName str12',
- substrs = ['(NSString *) str1 = ',' @"A rather short ASCII NSString object is here"',
- # '(NSString *) str0 = ',' @"255"',
- '(NSString *) str1 = ',' @"A rather short ASCII NSString object is here"',
- '(NSString *) str2 = ',' @"A rather short UTF8 NSString object is here"',
- '(NSString *) str3 = ',' @"A string made with the at sign is here"',
- '(NSString *) str4 = ',' @"This is string number 4 right here"',
- '(NSString *) str5 = ',' @"{{1, 1}, {5, 5}}"',
- '(NSString *) str6 = ',' @"1ST"',
- '(NSString *) str8 = ',' @"hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime',
- '(NSString *) str9 = ',' @"a very much boring task to write a string this way!!',
- '(NSString *) str10 = ',' @"This is a Unicode string σ number 4 right here"',
- '(NSString *) str11 = ',' @"__NSCFString"',
- '(NSString *) label1 = ',' @"Process Name: "',
- '(NSString *) label2 = ',' @"Process Id: "',
- '(NSString *) str12 = ',' @"Process Name: a.out Process Id:'])
- self.expect('frame variable attrString mutableAttrString mutableGetConst',
- substrs = ['(NSAttributedString *) attrString = ',' @"hello world from foo"',
- '(NSAttributedString *) mutableAttrString = ',' @"hello world from foo"',
- '(NSString *) mutableGetConst = ',' @"foo said this string needs to be very long so much longer than whatever other string has been seen ever before by anyone of the mankind that of course this is still not long enough given what foo our friend foo our lovely dearly friend foo desired of us so i am adding more stuff here for the sake of it and for the joy of our friend who is named guess what just foo. hence, dear friend foo, stay safe, your string is now long enough to accommodate your testing need and I will make sure that if not we extend it with even more fuzzy random meaningless words pasted one after the other from a long tiresome friday evening spent working in my office. my office mate went home but I am still randomly typing just for the fun of seeing what happens of the length of a Mutable String in Cocoa if it goes beyond one byte.. so be it, dear foo"'])
-
- self.expect('expr -d run-target -- path',substrs = ['usr/blah/stuff'])
- self.expect('frame variable path',substrs = ['usr/blah/stuff'])
+ substrs=['(NSString *) str1 = ', ' @"A rather short ASCII NSString object is here"',
+ # '(NSString *) str0 = ',' @"255"',
+ '(NSString *) str1 = ', ' @"A rather short ASCII NSString object is here"',
+ '(NSString *) str2 = ', ' @"A rather short UTF8 NSString object is here"',
+ '(NSString *) str3 = ', ' @"A string made with the at sign is here"',
+ '(NSString *) str4 = ', ' @"This is string number 4 right here"',
+ '(NSString *) str5 = ', ' @"{{1, 1}, {5, 5}}"',
+ '(NSString *) str6 = ', ' @"1ST"',
+ '(NSString *) str8 = ', ' @"hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime',
+ '(NSString *) str9 = ', ' @"a very much boring task to write a string this way!!',
+ '(NSString *) str10 = ', ' @"This is a Unicode string σ number 4 right here"',
+ '(NSString *) str11 = ', ' @"__NSCFString"',
+ '(NSString *) label1 = ', ' @"Process Name: "',
+ '(NSString *) label2 = ', ' @"Process Id: "',
+ '(NSString *) str12 = ', ' @"Process Name: a.out Process Id:'])
+ self.expect(
+ 'frame variable attrString mutableAttrString mutableGetConst',
+ substrs=[
+ '(NSAttributedString *) attrString = ',
+ ' @"hello world from foo"',
+ '(NSAttributedString *) mutableAttrString = ',
+ ' @"hello world from foo"',
+ '(NSString *) mutableGetConst = ',
+ ' @"foo said this string needs to be very long so much longer than whatever other string has been seen ever before by anyone of the mankind that of course this is still not long enough given what foo our friend foo our lovely dearly friend foo desired of us so i am adding more stuff here for the sake of it and for the joy of our friend who is named guess what just foo. hence, dear friend foo, stay safe, your string is now long enough to accommodate your testing need and I will make sure that if not we extend it with even more fuzzy random meaningless words pasted one after the other from a long tiresome friday evening spent working in my office. my office mate went home but I am still randomly typing just for the fun of seeing what happens of the length of a Mutable String in Cocoa if it goes beyond one byte.. so be it, dear foo"'])
+
+ self.expect('expr -d run-target -- path', substrs=['usr/blah/stuff'])
+ self.expect('frame variable path', substrs=['usr/blah/stuff'])
def nsstring_withNULs_commands(self):
"""Check that the NSString formatter supports embedded NULs in the text"""
- self.expect('po strwithNULs', substrs=['a very much boring task to write'])
+ self.expect(
+ 'po strwithNULs',
+ substrs=['a very much boring task to write'])
self.expect('expr [strwithNULs length]', substrs=['54'])
- self.expect('frame variable strwithNULs', substrs=['@"a very much boring task to write\\0a string this way!!'])
- self.expect('po strwithNULs2', substrs=['a very much boring task to write'])
+ self.expect('frame variable strwithNULs', substrs=[
+ '@"a very much boring task to write\\0a string this way!!'])
+ self.expect('po strwithNULs2', substrs=[
+ 'a very much boring task to write'])
self.expect('expr [strwithNULs2 length]', substrs=['52'])
- self.expect('frame variable strwithNULs2', substrs=['@"a very much boring task to write\\0a string this way!!'])
+ self.expect('frame variable strwithNULs2', substrs=[
+ '@"a very much boring task to write\\0a string this way!!'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-proper-plurals/TestFormattersOneIsSingular.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-proper-plurals/TestFormattersOneIsSingular.py
index 3c9be04a2f6c..bf600219bced 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-proper-plurals/TestFormattersOneIsSingular.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-proper-plurals/TestFormattersOneIsSingular.py
@@ -5,14 +5,15 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
import datetime
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class DataFormatterOneIsSingularTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -33,14 +34,15 @@ class DataFormatterOneIsSingularTestCase(TestBase):
"""Test that 1 item is not as reported as 1 items."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -54,26 +56,26 @@ class DataFormatterOneIsSingularTestCase(TestBase):
# Now check that we are displaying Cocoa classes correctly
self.expect('frame variable key',
- substrs = ['@"1 element"'])
+ substrs=['@"1 element"'])
self.expect('frame variable key', matching=False,
- substrs = ['1 elements'])
+ substrs=['1 elements'])
self.expect('frame variable value',
- substrs = ['@"1 element"'])
+ substrs=['@"1 element"'])
self.expect('frame variable value', matching=False,
- substrs = ['1 elements'])
+ substrs=['1 elements'])
self.expect('frame variable dict',
- substrs = ['1 key/value pair'])
+ substrs=['1 key/value pair'])
self.expect('frame variable dict', matching=False,
- substrs = ['1 key/value pairs'])
+ substrs=['1 key/value pairs'])
self.expect('frame variable imset',
- substrs = ['1 index'])
+ substrs=['1 index'])
self.expect('frame variable imset', matching=False,
- substrs = ['1 indexes'])
+ substrs=['1 indexes'])
self.expect('frame variable binheap_ref',
- substrs = ['@"1 item"'])
+ substrs=['@"1 item"'])
self.expect('frame variable binheap_ref', matching=False,
- substrs = ['1 items'])
+ substrs=['1 items'])
self.expect('frame variable immutableData',
- substrs = ['1 byte'])
+ substrs=['1 byte'])
self.expect('frame variable immutableData', matching=False,
- substrs = ['1 bytes'])
+ substrs=['1 bytes'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-ptr-to-array/TestPtrToArrayFormatting.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-ptr-to-array/TestPtrToArrayFormatting.py
index 86cd3c427288..ebabe3076611 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-ptr-to-array/TestPtrToArrayFormatting.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-ptr-to-array/TestPtrToArrayFormatting.py
@@ -5,12 +5,13 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class PtrToArrayDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -30,14 +31,15 @@ class PtrToArrayDataFormatterTestCase(TestBase):
"""Test that LLDB handles the clang typeclass Paren correctly."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -49,9 +51,9 @@ class PtrToArrayDataFormatterTestCase(TestBase):
self.addTearDownHook(cleanup)
self.expect('p *(int (*)[3])foo',
- substrs = ['(int [3]) $','[0] = 1','[1] = 2','[2] = 3'])
+ substrs=['(int [3]) $', '[0] = 1', '[1] = 2', '[2] = 3'])
self.expect('p *(int (*)[3])foo', matching=False,
- substrs = ['01 00 00 00 02 00 00 00 03 00 00 00'])
+ substrs=['01 00 00 00 02 00 00 00 03 00 00 00'])
self.expect('p *(int (*)[3])foo', matching=False,
- substrs = ['0x000000030000000200000001'])
+ substrs=['0x000000030000000200000001'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py
index c7ff28874c5a..75d1853f6a71 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py
@@ -5,18 +5,19 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class PythonSynthDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @skipIfFreeBSD # llvm.org/pr20545 bogus output confuses buildbot parser
+ @skipIfFreeBSD # llvm.org/pr20545 bogus output confuses buildbot parser
def test_with_run_command(self):
"""Test data formatter commands."""
self.build()
@@ -27,20 +28,22 @@ class PythonSynthDataFormatterTestCase(TestBase):
self.build()
self.rdar10960550_formatter_commands()
-
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
# Find the line number to break at.
self.line = line_number('main.cpp', '// Set break point at this line.')
- self.line2 = line_number('main.cpp', '// Set cast break point at this line.')
- self.line3 = line_number('main.cpp', '// Set second cast break point at this line.')
+ self.line2 = line_number('main.cpp',
+ '// Set cast break point at this line.')
+ self.line3 = line_number(
+ 'main.cpp', '// Set second cast break point at this line.')
def data_formatter_commands(self):
"""Test using Python synthetic children provider."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
@@ -48,8 +51,8 @@ class PythonSynthDataFormatterTestCase(TestBase):
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -64,9 +67,9 @@ class PythonSynthDataFormatterTestCase(TestBase):
# print the f00_1 variable without a synth
self.expect("frame variable f00_1",
- substrs = ['a = 1',
- 'b = 2',
- 'r = 34']);
+ substrs=['a = 1',
+ 'b = 2',
+ 'r = 34'])
# now set up the synth
self.runCmd("script from fooSynthProvider import *")
@@ -81,30 +84,32 @@ class PythonSynthDataFormatterTestCase(TestBase):
# check that we get the two real vars and the fake_a variables
self.expect("frame variable f00_1",
- substrs = ['r = 34',
- 'fake_a = %d' % fake_a_val,
- 'a = 1']);
+ substrs=['r = 34',
+ 'fake_a = %d' % fake_a_val,
+ 'a = 1'])
# check that we do not get the extra vars
self.expect("frame variable f00_1", matching=False,
- substrs = ['b = 2']);
-
+ substrs=['b = 2'])
+
# check access to members by name
self.expect('frame variable f00_1.fake_a',
- substrs = ['%d' % fake_a_val])
-
+ substrs=['%d' % fake_a_val])
+
# check access to members by index
self.expect('frame variable f00_1[1]',
- substrs = ['%d' % fake_a_val])
-
+ substrs=['%d' % fake_a_val])
+
# put synthetic children in summary in several combinations
- self.runCmd("type summary add --summary-string \"fake_a=${svar.fake_a}\" foo")
+ self.runCmd(
+ "type summary add --summary-string \"fake_a=${svar.fake_a}\" foo")
self.expect('frame variable f00_1',
- substrs = ['fake_a=%d' % fake_a_val])
- self.runCmd("type summary add --summary-string \"fake_a=${svar[1]}\" foo")
+ substrs=['fake_a=%d' % fake_a_val])
+ self.runCmd(
+ "type summary add --summary-string \"fake_a=${svar[1]}\" foo")
self.expect('frame variable f00_1',
- substrs = ['fake_a=%d' % fake_a_val])
-
+ substrs=['fake_a=%d' % fake_a_val])
+
# clear the summary
self.runCmd("type summary delete foo")
@@ -117,9 +122,9 @@ class PythonSynthDataFormatterTestCase(TestBase):
fake_a_val = 0x00000200
self.expect("frame variable f00_1",
- substrs = ['r = 34',
- 'fake_a = %d' % fake_a_val,
- 'a = 2']);
+ substrs=['r = 34',
+ 'fake_a = %d' % fake_a_val,
+ 'a = 2'])
# check that altering the object also alters fake_a
self.runCmd("expr f00_1.a = 280")
@@ -130,9 +135,9 @@ class PythonSynthDataFormatterTestCase(TestBase):
fake_a_val = 0x00011800
self.expect("frame variable f00_1",
- substrs = ['r = 34',
- 'fake_a = %d' % fake_a_val,
- 'a = 280']);
+ substrs=['r = 34',
+ 'fake_a = %d' % fake_a_val,
+ 'a = 280'])
# check that expanding a pointer does the right thing
if process.GetByteOrder() == lldb.eByteOrderLittle:
@@ -141,94 +146,97 @@ class PythonSynthDataFormatterTestCase(TestBase):
fake_a_val = 0x00000c00
self.expect("frame variable --ptr-depth 1 f00_ptr",
- substrs = ['r = 45',
- 'fake_a = %d' % fake_a_val,
- 'a = 12'])
-
+ substrs=['r = 45',
+ 'fake_a = %d' % fake_a_val,
+ 'a = 12'])
+
# now add a filter.. it should fail
self.expect("type filter add foo --child b --child j", error=True,
- substrs = ['cannot add'])
-
+ substrs=['cannot add'])
+
# we get the synth again..
self.expect('frame variable f00_1', matching=False,
- substrs = ['b = 1',
- 'j = 17'])
+ substrs=['b = 1',
+ 'j = 17'])
self.expect("frame variable --ptr-depth 1 f00_ptr",
- substrs = ['r = 45',
- 'fake_a = %d' % fake_a_val,
- 'a = 12'])
-
+ substrs=['r = 45',
+ 'fake_a = %d' % fake_a_val,
+ 'a = 12'])
+
# now delete the synth and add the filter
self.runCmd("type synth delete foo")
self.runCmd("type filter add foo --child b --child j")
-
+
self.expect('frame variable f00_1',
- substrs = ['b = 2',
- 'j = 18'])
+ substrs=['b = 2',
+ 'j = 18'])
self.expect("frame variable --ptr-depth 1 f00_ptr", matching=False,
- substrs = ['r = 45',
- 'fake_a = %d' % fake_a_val,
- 'a = 12'])
-
+ substrs=['r = 45',
+ 'fake_a = %d' % fake_a_val,
+ 'a = 12'])
+
# now add the synth and it should fail
self.expect("type synth add -l fooSynthProvider foo", error=True,
- substrs = ['cannot add'])
-
+ substrs=['cannot add'])
+
# check the listing
self.expect('type synth list', matching=False,
- substrs = ['foo',
- 'Python class fooSynthProvider'])
- self.expect('type filter list',
- substrs = ['foo',
- '.b',
- '.j'])
-
+ substrs=['foo',
+ 'Python class fooSynthProvider'])
+ self.expect('type filter list',
+ substrs=['foo',
+ '.b',
+ '.j'])
+
# delete the filter, add the synth
self.runCmd("type filter delete foo")
self.runCmd("type synth add -l fooSynthProvider foo")
-
+
self.expect('frame variable f00_1', matching=False,
- substrs = ['b = 2',
- 'j = 18'])
- self.expect("frame variable --ptr-depth 1 f00_ptr",
- substrs = ['r = 45',
- 'fake_a = %d' % fake_a_val,
- 'a = 12'])
+ substrs=['b = 2',
+ 'j = 18'])
+ self.expect("frame variable --ptr-depth 1 f00_ptr",
+ substrs=['r = 45',
+ 'fake_a = %d' % fake_a_val,
+ 'a = 12'])
# check the listing
self.expect('type synth list',
- substrs = ['foo',
- 'Python class fooSynthProvider'])
+ substrs=['foo',
+ 'Python class fooSynthProvider'])
self.expect('type filter list', matching=False,
- substrs = ['foo',
- '.b',
- '.j'])
-
+ substrs=['foo',
+ '.b',
+ '.j'])
+
# delete the synth and check that we get good output
self.runCmd("type synth delete foo")
-
+
self.expect("frame variable f00_1",
- substrs = ['a = 280',
- 'b = 2',
- 'j = 18']);
+ substrs=['a = 280',
+ 'b = 2',
+ 'j = 18'])
self.expect("frame variable f00_1", matching=False,
- substrs = ['fake_a = '])
+ substrs=['fake_a = '])
def rdar10960550_formatter_commands(self):
"""Test that synthetic children persist stoppoints."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- # The second breakpoint is on a multi-line expression, so the comment can't be on the right line...
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line2, num_expected_locations=1, loc_exact=False)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line3, num_expected_locations=1, loc_exact=True)
+ # The second breakpoint is on a multi-line expression, so the comment
+ # can't be on the right line...
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line2, num_expected_locations=1, loc_exact=False)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line3, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -248,25 +256,28 @@ class PythonSynthDataFormatterTestCase(TestBase):
# but their values change correctly across stop-points - in order to do this, self.runCmd("next")
# does not work because it forces a wipe of the stack frame - this is why we are using this more contrived
# mechanism to achieve our goal of preserving test_cast as a VO
- test_cast = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame().FindVariable('test_cast')
+ test_cast = self.dbg.GetSelectedTarget().GetProcess(
+ ).GetSelectedThread().GetSelectedFrame().FindVariable('test_cast')
str_cast = str(test_cast)
if self.TraceOn():
- print(str_cast)
+ print(str_cast)
self.assertTrue(str_cast.find('A') != -1, 'could not find A in output')
self.assertTrue(str_cast.find('B') != -1, 'could not find B in output')
self.assertTrue(str_cast.find('C') != -1, 'could not find C in output')
self.assertTrue(str_cast.find('D') != -1, 'could not find D in output')
- self.assertTrue(str_cast.find("4 = '\\0'") != -1, 'could not find item 4 == 0')
+ self.assertTrue(
+ str_cast.find("4 = '\\0'") != -1,
+ 'could not find item 4 == 0')
self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().StepOver()
str_cast = str(test_cast)
if self.TraceOn():
- print(str_cast)
+ print(str_cast)
# we detect that all the values of the child objects have changed - but the counter-generated item
# is still fixed at 0 because it is cached - this would fail if update(self): in ftsp returned False
@@ -275,4 +286,6 @@ class PythonSynthDataFormatterTestCase(TestBase):
self.assertTrue(str_cast.find('X') != -1, 'could not find X in output')
self.assertTrue(str_cast.find('T') != -1, 'could not find T in output')
self.assertTrue(str_cast.find('F') != -1, 'could not find F in output')
- self.assertTrue(str_cast.find("4 = '\\0'") != -1, 'could not find item 4 == 0')
+ self.assertTrue(
+ str_cast.find("4 = '\\0'") != -1,
+ 'could not find item 4 == 0')
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/fooSynthProvider.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/fooSynthProvider.py
index 0dc2c233e2a6..45fb00468e08 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/fooSynthProvider.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/fooSynthProvider.py
@@ -1,23 +1,30 @@
import lldb
+
+
class fooSynthProvider:
- def __init__(self, valobj, dict):
- self.valobj = valobj;
- self.int_type = valobj.GetType().GetBasicType(lldb.eBasicTypeInt)
- def num_children(self):
- return 3;
- def get_child_at_index(self, index):
- if index == 0:
- child = self.valobj.GetChildMemberWithName('a');
- if index == 1:
- child = self.valobj.CreateChildAtOffset ('fake_a', 1, self.int_type);
- if index == 2:
- child = self.valobj.GetChildMemberWithName('r');
- return child;
- def get_child_index(self, name):
- if name == 'a':
- return 0;
- if name == 'fake_a':
- return 1;
- return 2;
- def update(self):
- return True \ No newline at end of file
+
+ def __init__(self, valobj, dict):
+ self.valobj = valobj
+ self.int_type = valobj.GetType().GetBasicType(lldb.eBasicTypeInt)
+
+ def num_children(self):
+ return 3
+
+ def get_child_at_index(self, index):
+ if index == 0:
+ child = self.valobj.GetChildMemberWithName('a')
+ if index == 1:
+ child = self.valobj.CreateChildAtOffset('fake_a', 1, self.int_type)
+ if index == 2:
+ child = self.valobj.GetChildMemberWithName('r')
+ return child
+
+ def get_child_index(self, name):
+ if name == 'a':
+ return 0
+ if name == 'fake_a':
+ return 1
+ return 2
+
+ def update(self):
+ return True
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/ftsp.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/ftsp.py
index d162b00db329..b96dbac6f503 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/ftsp.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-python-synth/ftsp.py
@@ -2,31 +2,39 @@ import lldb
counter = 0
+
class ftsp:
- def __init__(self, valobj, dict):
- self.valobj = valobj;
- def num_children(self):
- if self.char.IsValid():
- return 5;
- return 0;
- def get_child_index(self,name):
- return 0;
- def get_child_at_index(self,index):
- if index == 0:
- return self.x.Cast(self.char)
- if index == 4:
- return self.valobj.CreateValueFromExpression(str(index),'(char)('+str(self.count)+')')
- return self.x.CreateChildAtOffset(str(index),
- index,
- self.char);
- def update(self):
- self.x = self.valobj.GetChildMemberWithName('x');
- self.char = self.valobj.GetType().GetBasicType(lldb.eBasicTypeChar)
- global counter
- self.count = counter
- counter = counter + 1
- return True # important: if we return False here, or fail to return, the test will fail
+
+ def __init__(self, valobj, dict):
+ self.valobj = valobj
+
+ def num_children(self):
+ if self.char.IsValid():
+ return 5
+ return 0
+
+ def get_child_index(self, name):
+ return 0
+
+ def get_child_at_index(self, index):
+ if index == 0:
+ return self.x.Cast(self.char)
+ if index == 4:
+ return self.valobj.CreateValueFromExpression(
+ str(index), '(char)(' + str(self.count) + ')')
+ return self.x.CreateChildAtOffset(str(index),
+ index,
+ self.char)
+
+ def update(self):
+ self.x = self.valobj.GetChildMemberWithName('x')
+ self.char = self.valobj.GetType().GetBasicType(lldb.eBasicTypeChar)
+ global counter
+ self.count = counter
+ counter = counter + 1
+ return True # important: if we return False here, or fail to return, the test will fail
+
def __lldb_init_module(debugger, dict):
- global counter
- counter = 0 \ No newline at end of file
+ global counter
+ counter = 0
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-script/TestDataFormatterScript.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-script/TestDataFormatterScript.py
index 7ebc1c14ce13..3355ca16305b 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-script/TestDataFormatterScript.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-script/TestDataFormatterScript.py
@@ -5,12 +5,13 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class ScriptDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -30,14 +31,15 @@ class ScriptDataFormatterTestCase(TestBase):
"""Test that that file and class static variables display correctly."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -51,121 +53,133 @@ class ScriptDataFormatterTestCase(TestBase):
# Set the script here to ease the formatting
script = 'a = valobj.GetChildMemberWithName(\'integer\'); a_val = a.GetValue(); str = \'Hello from Python, \' + a_val + \' time\'; return str + (\'!\' if a_val == \'1\' else \'s!\');'
- self.runCmd("type summary add i_am_cool --python-script \"%s\"" % script)
+ self.runCmd(
+ "type summary add i_am_cool --python-script \"%s\"" %
+ script)
self.expect('type summary list i_am_cool', substrs=[script])
self.expect("frame variable one",
- substrs = ['Hello from Python',
- '1 time!'])
+ substrs=['Hello from Python',
+ '1 time!'])
self.expect("frame variable two",
- substrs = ['Hello from Python',
- '4 times!'])
-
- self.runCmd("n"); # skip ahead to make values change
+ substrs=['Hello from Python',
+ '4 times!'])
+
+ self.runCmd("n") # skip ahead to make values change
self.expect("frame variable three",
- substrs = ['Hello from Python, 10 times!',
- 'Hello from Python, 4 times!'])
+ substrs=['Hello from Python, 10 times!',
+ 'Hello from Python, 4 times!'])
+
+ self.runCmd("n") # skip ahead to make values change
- self.runCmd("n"); # skip ahead to make values change
-
self.expect("frame variable two",
- substrs = ['Hello from Python',
- '1 time!'])
+ substrs=['Hello from Python',
+ '1 time!'])
script = 'a = valobj.GetChildMemberWithName(\'integer\'); a_val = a.GetValue(); str = \'int says \' + a_val; return str;'
# Check that changes in the script are immediately reflected
- self.runCmd("type summary add i_am_cool --python-script \"%s\"" % script)
+ self.runCmd(
+ "type summary add i_am_cool --python-script \"%s\"" %
+ script)
self.expect("frame variable two",
- substrs = ['int says 1'])
-
+ substrs=['int says 1'])
+
self.expect("frame variable twoptr",
- substrs = ['int says 1'])
+ substrs=['int says 1'])
# Change the summary
- self.runCmd("type summary add --summary-string \"int says ${var.integer}, and float says ${var.floating}\" i_am_cool")
+ self.runCmd(
+ "type summary add --summary-string \"int says ${var.integer}, and float says ${var.floating}\" i_am_cool")
self.expect("frame variable two",
- substrs = ['int says 1',
- 'and float says 2.71'])
+ substrs=['int says 1',
+ 'and float says 2.71'])
# Try it for pointers
self.expect("frame variable twoptr",
- substrs = ['int says 1',
- 'and float says 2.71'])
+ substrs=['int says 1',
+ 'and float says 2.71'])
# Force a failure for pointers
- self.runCmd("type summary add i_am_cool -p --python-script \"%s\"" % script)
+ self.runCmd(
+ "type summary add i_am_cool -p --python-script \"%s\"" %
+ script)
self.expect("frame variable twoptr", matching=False,
- substrs = ['and float says 2.71'])
+ substrs=['and float says 2.71'])
- script = 'return \'Python summary\'';
+ script = 'return \'Python summary\''
- self.runCmd("type summary add --name test_summary --python-script \"%s\"" % script)
+ self.runCmd(
+ "type summary add --name test_summary --python-script \"%s\"" %
+ script)
# attach the Python named summary to someone
self.expect("frame variable one --summary test_summary",
- substrs = ['Python summary'])
+ substrs=['Python summary'])
# should not bind to the type
self.expect("frame variable two", matching=False,
- substrs = ['Python summary'])
+ substrs=['Python summary'])
# and should not stick to the variable
- self.expect("frame variable one",matching=False,
- substrs = ['Python summary'])
+ self.expect("frame variable one", matching=False,
+ substrs=['Python summary'])
- self.runCmd("type summary add i_am_cool --summary-string \"Text summary\"")
+ self.runCmd(
+ "type summary add i_am_cool --summary-string \"Text summary\"")
# should be temporary only
- self.expect("frame variable one",matching=False,
- substrs = ['Python summary'])
+ self.expect("frame variable one", matching=False,
+ substrs=['Python summary'])
# use the type summary
self.expect("frame variable two",
- substrs = ['Text summary'])
+ substrs=['Text summary'])
- self.runCmd("n"); # skip ahead to make values change
+ self.runCmd("n") # skip ahead to make values change
# both should use the type summary now
self.expect("frame variable one",
- substrs = ['Text summary'])
-
+ substrs=['Text summary'])
+
self.expect("frame variable two",
- substrs = ['Text summary'])
+ substrs=['Text summary'])
# disable type summary for pointers, and make a Python regex summary
- self.runCmd("type summary add i_am_cool -p --summary-string \"Text summary\"")
+ self.runCmd(
+ "type summary add i_am_cool -p --summary-string \"Text summary\"")
self.runCmd("type summary add -x cool --python-script \"%s\"" % script)
# variables should stick to the type summary
self.expect("frame variable one",
- substrs = ['Text summary'])
+ substrs=['Text summary'])
self.expect("frame variable two",
- substrs = ['Text summary'])
+ substrs=['Text summary'])
# array and pointer should match the Python one
self.expect("frame variable twoptr",
- substrs = ['Python summary'])
-
+ substrs=['Python summary'])
+
self.expect("frame variable array",
- substrs = ['Python summary'])
+ substrs=['Python summary'])
# return pointers to the type summary
- self.runCmd("type summary add i_am_cool --summary-string \"Text summary\"")
+ self.runCmd(
+ "type summary add i_am_cool --summary-string \"Text summary\"")
self.expect("frame variable one",
- substrs = ['Text summary'])
-
+ substrs=['Text summary'])
+
self.expect("frame variable two",
- substrs = ['Text summary'])
-
+ substrs=['Text summary'])
+
self.expect("frame variable twoptr",
- substrs = ['Text summary'])
-
+ substrs=['Text summary'])
+
self.expect("frame variable array",
- substrs = ['Python summary'])
+ substrs=['Python summary'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py
index c186f1465cf5..5b52277e8b7a 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py
@@ -5,19 +5,24 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class SkipSummaryDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @expectedFailureAll(oslist=['freebsd'], bugnumber="llvm.org/pr20548 fails to build on lab.llvm.org buildbot")
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24462, Data formatters have problems on Windows")
+ @expectedFailureAll(
+ oslist=['freebsd'],
+ bugnumber="llvm.org/pr20548 fails to build on lab.llvm.org buildbot")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24462, Data formatters have problems on Windows")
def test_with_run_command(self):
"""Test data formatter commands."""
self.build()
@@ -34,15 +39,15 @@ class SkipSummaryDataFormatterTestCase(TestBase):
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
#import lldbsuite.test.lldbutil as lldbutil
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
-
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -55,122 +60,146 @@ class SkipSummaryDataFormatterTestCase(TestBase):
# Setup the summaries for this scenario
#self.runCmd("type summary add --summary-string \"${var._M_dataplus._M_p}\" std::string")
- self.runCmd("type summary add --summary-string \"Level 1\" \"DeepData_1\"")
- self.runCmd("type summary add --summary-string \"Level 2\" \"DeepData_2\" -e")
- self.runCmd("type summary add --summary-string \"Level 3\" \"DeepData_3\"")
- self.runCmd("type summary add --summary-string \"Level 4\" \"DeepData_4\"")
- self.runCmd("type summary add --summary-string \"Level 5\" \"DeepData_5\"")
-
+ self.runCmd(
+ "type summary add --summary-string \"Level 1\" \"DeepData_1\"")
+ self.runCmd(
+ "type summary add --summary-string \"Level 2\" \"DeepData_2\" -e")
+ self.runCmd(
+ "type summary add --summary-string \"Level 3\" \"DeepData_3\"")
+ self.runCmd(
+ "type summary add --summary-string \"Level 4\" \"DeepData_4\"")
+ self.runCmd(
+ "type summary add --summary-string \"Level 5\" \"DeepData_5\"")
+
# Default case, just print out summaries
self.expect('frame variable',
- substrs = ['(DeepData_1) data1 = Level 1',
- '(DeepData_2) data2 = Level 2 {',
- 'm_child1 = Level 3',
- 'm_child2 = Level 3',
- 'm_child3 = Level 3',
- 'm_child4 = Level 3',
- '}'])
+ substrs=['(DeepData_1) data1 = Level 1',
+ '(DeepData_2) data2 = Level 2 {',
+ 'm_child1 = Level 3',
+ 'm_child2 = Level 3',
+ 'm_child3 = Level 3',
+ 'm_child4 = Level 3',
+ '}'])
# Skip the default (should be 1) levels of summaries
self.expect('frame variable --no-summary-depth',
- substrs = ['(DeepData_1) data1 = {',
- 'm_child1 = 0x',
- '}',
- '(DeepData_2) data2 = {',
- 'm_child1 = Level 3',
- 'm_child2 = Level 3',
- 'm_child3 = Level 3',
- 'm_child4 = Level 3',
- '}'])
+ substrs=['(DeepData_1) data1 = {',
+ 'm_child1 = 0x',
+ '}',
+ '(DeepData_2) data2 = {',
+ 'm_child1 = Level 3',
+ 'm_child2 = Level 3',
+ 'm_child3 = Level 3',
+ 'm_child4 = Level 3',
+ '}'])
# Now skip 2 levels of summaries
self.expect('frame variable --no-summary-depth=2',
- substrs = ['(DeepData_1) data1 = {',
- 'm_child1 = 0x',
- '}',
- '(DeepData_2) data2 = {',
- 'm_child1 = {',
- 'm_child1 = 0x',
- 'Level 4',
- 'm_child2 = {',
- 'm_child3 = {',
- '}'])
+ substrs=['(DeepData_1) data1 = {',
+ 'm_child1 = 0x',
+ '}',
+ '(DeepData_2) data2 = {',
+ 'm_child1 = {',
+ 'm_child1 = 0x',
+ 'Level 4',
+ 'm_child2 = {',
+ 'm_child3 = {',
+ '}'])
# Check that no "Level 3" comes out
- self.expect('frame variable data1.m_child1 --no-summary-depth=2', matching=False,
- substrs = ['Level 3'])
+ self.expect(
+ 'frame variable data1.m_child1 --no-summary-depth=2',
+ matching=False,
+ substrs=['Level 3'])
# Now expand a pointer with 2 level of skipped summaries
self.expect('frame variable data1.m_child1 --no-summary-depth=2',
- substrs = ['(DeepData_2 *) data1.m_child1 = 0x'])
+ substrs=['(DeepData_2 *) data1.m_child1 = 0x'])
# Deref and expand said pointer
self.expect('frame variable *data1.m_child1 --no-summary-depth=2',
- substrs = ['(DeepData_2) *data1.m_child1 = {',
- 'm_child2 = {',
- 'm_child1 = 0x',
- 'Level 4',
- '}'])
+ substrs=['(DeepData_2) *data1.m_child1 = {',
+ 'm_child2 = {',
+ 'm_child1 = 0x',
+ 'Level 4',
+ '}'])
# Expand an expression, skipping 2 layers of summaries
- self.expect('frame variable data1.m_child1->m_child2 --no-summary-depth=2',
- substrs = ['(DeepData_3) data1.m_child1->m_child2 = {',
- 'm_child2 = {',
- 'm_child1 = Level 5',
- 'm_child2 = Level 5',
- 'm_child3 = Level 5',
- '}'])
+ self.expect(
+ 'frame variable data1.m_child1->m_child2 --no-summary-depth=2',
+ substrs=[
+ '(DeepData_3) data1.m_child1->m_child2 = {',
+ 'm_child2 = {',
+ 'm_child1 = Level 5',
+ 'm_child2 = Level 5',
+ 'm_child3 = Level 5',
+ '}'])
# Expand same expression, skipping only 1 layer of summaries
- self.expect('frame variable data1.m_child1->m_child2 --no-summary-depth=1',
- substrs = ['(DeepData_3) data1.m_child1->m_child2 = {',
- 'm_child1 = 0x',
- 'Level 4',
- 'm_child2 = Level 4',
- '}'])
+ self.expect(
+ 'frame variable data1.m_child1->m_child2 --no-summary-depth=1',
+ substrs=[
+ '(DeepData_3) data1.m_child1->m_child2 = {',
+ 'm_child1 = 0x',
+ 'Level 4',
+ 'm_child2 = Level 4',
+ '}'])
# Bad debugging info on SnowLeopard gcc (Apple Inc. build 5666).
# Skip the following tests if the condition is met.
if self.getCompiler().endswith('gcc') and not self.getCompiler().endswith('llvm-gcc'):
- import re
- gcc_version_output = system([[lldbutil.which(self.getCompiler()), "-v"]])[1]
- #print("my output:", gcc_version_output)
- for line in gcc_version_output.split(os.linesep):
- m = re.search('\(Apple Inc\. build ([0-9]+)\)', line)
- #print("line:", line)
- if m:
- gcc_build = int(m.group(1))
- #print("gcc build:", gcc_build)
- if gcc_build >= 5666:
- # rdar://problem/9804600"
- self.skipTest("rdar://problem/9804600 wrong namespace for std::string in debug info")
+ import re
+ gcc_version_output = system(
+ [[lldbutil.which(self.getCompiler()), "-v"]])[1]
+ #print("my output:", gcc_version_output)
+ for line in gcc_version_output.split(os.linesep):
+ m = re.search('\(Apple Inc\. build ([0-9]+)\)', line)
+ #print("line:", line)
+ if m:
+ gcc_build = int(m.group(1))
+ #print("gcc build:", gcc_build)
+ if gcc_build >= 5666:
+ # rdar://problem/9804600"
+ self.skipTest(
+ "rdar://problem/9804600 wrong namespace for std::string in debug info")
# Expand same expression, skipping 3 layers of summaries
- self.expect('frame variable data1.m_child1->m_child2 --show-types --no-summary-depth=3',
- substrs = ['(DeepData_3) data1.m_child1->m_child2 = {',
- 'm_some_text = "Just a test"',
- 'm_child2 = {',
- 'm_some_text = "Just a test"'])
-
- # Expand within a standard string (might depend on the implementation of the C++ stdlib you use)
- self.expect('frame variable data1.m_child1->m_child2.m_child1.m_child2 --no-summary-depth=2',
- substrs = ['(DeepData_5) data1.m_child1->m_child2.m_child1.m_child2 = {',
- 'm_some_text = {',
- '_M_dataplus = (_M_p = "Just a test")'])
+ self.expect(
+ 'frame variable data1.m_child1->m_child2 --show-types --no-summary-depth=3',
+ substrs=[
+ '(DeepData_3) data1.m_child1->m_child2 = {',
+ 'm_some_text = "Just a test"',
+ 'm_child2 = {',
+ 'm_some_text = "Just a test"'])
+
+ # Expand within a standard string (might depend on the implementation
+ # of the C++ stdlib you use)
+ self.expect(
+ 'frame variable data1.m_child1->m_child2.m_child1.m_child2 --no-summary-depth=2',
+ substrs=[
+ '(DeepData_5) data1.m_child1->m_child2.m_child1.m_child2 = {',
+ 'm_some_text = {',
+ '_M_dataplus = (_M_p = "Just a test")'])
# Repeat the above, but only skip 1 level of summaries
- self.expect('frame variable data1.m_child1->m_child2.m_child1.m_child2 --no-summary-depth=1',
- substrs = ['(DeepData_5) data1.m_child1->m_child2.m_child1.m_child2 = {',
- 'm_some_text = "Just a test"',
- '}'])
-
- # Change summary and expand, first without --no-summary-depth then with --no-summary-depth
- self.runCmd("type summary add --summary-string \"${var.m_some_text}\" DeepData_5")
-
- self.expect('fr var data2.m_child4.m_child2.m_child2',
- substrs = ['(DeepData_5) data2.m_child4.m_child2.m_child2 = "Just a test"'])
-
- self.expect('fr var data2.m_child4.m_child2.m_child2 --no-summary-depth',
- substrs = ['(DeepData_5) data2.m_child4.m_child2.m_child2 = {',
- 'm_some_text = "Just a test"',
- '}'])
+ self.expect(
+ 'frame variable data1.m_child1->m_child2.m_child1.m_child2 --no-summary-depth=1',
+ substrs=[
+ '(DeepData_5) data1.m_child1->m_child2.m_child1.m_child2 = {',
+ 'm_some_text = "Just a test"',
+ '}'])
+
+ # Change summary and expand, first without --no-summary-depth then with
+ # --no-summary-depth
+ self.runCmd(
+ "type summary add --summary-string \"${var.m_some_text}\" DeepData_5")
+
+ self.expect('fr var data2.m_child4.m_child2.m_child2', substrs=[
+ '(DeepData_5) data2.m_child4.m_child2.m_child2 = "Just a test"'])
+
+ self.expect(
+ 'fr var data2.m_child4.m_child2.m_child2 --no-summary-depth',
+ substrs=[
+ '(DeepData_5) data2.m_child4.m_child2.m_child2 = {',
+ 'm_some_text = "Just a test"',
+ '}'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py
index b3f8ba7d048e..9e82f11ff36b 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py
@@ -5,18 +5,21 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class SmartArrayDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24462, Data formatters have problems on Windows")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24462, Data formatters have problems on Windows")
def test_with_run_command(self):
"""Test data formatter commands."""
self.build()
@@ -32,7 +35,8 @@ class SmartArrayDataFormatterTestCase(TestBase):
"""Test that that file and class static variables display correctly."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
@@ -40,9 +44,9 @@ class SmartArrayDataFormatterTestCase(TestBase):
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
-
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
+
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
def cleanup():
@@ -56,338 +60,400 @@ class SmartArrayDataFormatterTestCase(TestBase):
self.runCmd("type summary add --summary-string \"${var%V}\" SomeData")
self.expect("frame variable data",
- substrs = ['SomeData @ 0x'])
+ substrs=['SomeData @ 0x'])
# ${var%s}
- self.runCmd("type summary add --summary-string \"ptr = ${var%s}\" \"char *\"")
+ self.runCmd(
+ "type summary add --summary-string \"ptr = ${var%s}\" \"char *\"")
self.expect("frame variable strptr",
- substrs = ['ptr = \"',
- 'Hello world!'])
+ substrs=['ptr = \"',
+ 'Hello world!'])
self.expect("frame variable other.strptr",
- substrs = ['ptr = \"',
- 'Nested Hello world!'])
-
- self.runCmd("type summary add --summary-string \"arr = ${var%s}\" -x \"char \\[[0-9]+\\]\"")
-
+ substrs=['ptr = \"',
+ 'Nested Hello world!'])
+
+ self.runCmd(
+ "type summary add --summary-string \"arr = ${var%s}\" -x \"char \\[[0-9]+\\]\"")
+
self.expect("frame variable strarr",
- substrs = ['arr = \"',
- 'Hello world!'])
-
+ substrs=['arr = \"',
+ 'Hello world!'])
+
self.expect("frame variable other.strarr",
- substrs = ['arr = \"',
- 'Nested Hello world!'])
+ substrs=['arr = \"',
+ 'Nested Hello world!'])
self.expect("p strarr",
- substrs = ['arr = \"',
- 'Hello world!'])
+ substrs=['arr = \"',
+ 'Hello world!'])
self.expect("p other.strarr",
- substrs = ['arr = \"',
- 'Nested Hello world!'])
+ substrs=['arr = \"',
+ 'Nested Hello world!'])
# ${var%c}
- self.runCmd("type summary add --summary-string \"ptr = ${var%c}\" \"char *\"")
-
+ self.runCmd(
+ "type summary add --summary-string \"ptr = ${var%c}\" \"char *\"")
+
self.expect("frame variable strptr",
- substrs = ['ptr = \"',
- 'Hello world!'])
-
+ substrs=['ptr = \"',
+ 'Hello world!'])
+
self.expect("frame variable other.strptr",
- substrs = ['ptr = \"',
- 'Nested Hello world!'])
+ substrs=['ptr = \"',
+ 'Nested Hello world!'])
self.expect("p strptr",
- substrs = ['ptr = \"',
- 'Hello world!'])
+ substrs=['ptr = \"',
+ 'Hello world!'])
self.expect("p other.strptr",
- substrs = ['ptr = \"',
- 'Nested Hello world!'])
+ substrs=['ptr = \"',
+ 'Nested Hello world!'])
- self.runCmd("type summary add --summary-string \"arr = ${var%c}\" -x \"char \\[[0-9]+\\]\"")
+ self.runCmd(
+ "type summary add --summary-string \"arr = ${var%c}\" -x \"char \\[[0-9]+\\]\"")
self.expect("frame variable strarr",
- substrs = ['arr = \"',
- 'Hello world!'])
+ substrs=['arr = \"',
+ 'Hello world!'])
self.expect("frame variable other.strarr",
- substrs = ['arr = \"',
- 'Nested Hello world!'])
-
+ substrs=['arr = \"',
+ 'Nested Hello world!'])
+
self.expect("p strarr",
- substrs = ['arr = \"',
- 'Hello world!'])
+ substrs=['arr = \"',
+ 'Hello world!'])
self.expect("p other.strarr",
- substrs = ['arr = \"',
- 'Nested Hello world!'])
+ substrs=['arr = \"',
+ 'Nested Hello world!'])
# ${var%char[]}
- self.runCmd("type summary add --summary-string \"arr = ${var%char[]}\" -x \"char \\[[0-9]+\\]\"")
+ self.runCmd(
+ "type summary add --summary-string \"arr = ${var%char[]}\" -x \"char \\[[0-9]+\\]\"")
self.expect("frame variable strarr",
- substrs = ['arr = \"',
- 'Hello world!'])
+ substrs=['arr = \"',
+ 'Hello world!'])
self.expect("frame variable other.strarr",
- substrs = ['arr = ',
- 'Nested Hello world!'])
+ substrs=['arr = ',
+ 'Nested Hello world!'])
self.expect("p strarr",
- substrs = ['arr = \"',
- 'Hello world!'])
+ substrs=['arr = \"',
+ 'Hello world!'])
self.expect("p other.strarr",
- substrs = ['arr = ',
- 'Nested Hello world!'])
+ substrs=['arr = ',
+ 'Nested Hello world!'])
- self.runCmd("type summary add --summary-string \"ptr = ${var%char[]}\" \"char *\"")
+ self.runCmd(
+ "type summary add --summary-string \"ptr = ${var%char[]}\" \"char *\"")
self.expect("frame variable strptr",
- substrs = ['ptr = \"',
- 'Hello world!'])
-
+ substrs=['ptr = \"',
+ 'Hello world!'])
+
self.expect("frame variable other.strptr",
- substrs = ['ptr = \"',
- 'Nested Hello world!'])
+ substrs=['ptr = \"',
+ 'Nested Hello world!'])
self.expect("p strptr",
- substrs = ['ptr = \"',
- 'Hello world!'])
+ substrs=['ptr = \"',
+ 'Hello world!'])
self.expect("p other.strptr",
- substrs = ['ptr = \"',
- 'Nested Hello world!'])
+ substrs=['ptr = \"',
+ 'Nested Hello world!'])
# ${var%a}
- self.runCmd("type summary add --summary-string \"arr = ${var%a}\" -x \"char \\[[0-9]+\\]\"")
+ self.runCmd(
+ "type summary add --summary-string \"arr = ${var%a}\" -x \"char \\[[0-9]+\\]\"")
self.expect("frame variable strarr",
- substrs = ['arr = \"',
- 'Hello world!'])
+ substrs=['arr = \"',
+ 'Hello world!'])
self.expect("frame variable other.strarr",
- substrs = ['arr = ',
- 'Nested Hello world!'])
+ substrs=['arr = ',
+ 'Nested Hello world!'])
self.expect("p strarr",
- substrs = ['arr = \"',
- 'Hello world!'])
+ substrs=['arr = \"',
+ 'Hello world!'])
self.expect("p other.strarr",
- substrs = ['arr = ',
- 'Nested Hello world!'])
+ substrs=['arr = ',
+ 'Nested Hello world!'])
- self.runCmd("type summary add --summary-string \"ptr = ${var%a}\" \"char *\"")
+ self.runCmd(
+ "type summary add --summary-string \"ptr = ${var%a}\" \"char *\"")
self.expect("frame variable strptr",
- substrs = ['ptr = \"',
- 'Hello world!'])
+ substrs=['ptr = \"',
+ 'Hello world!'])
self.expect("frame variable other.strptr",
- substrs = ['ptr = \"',
- 'Nested Hello world!'])
+ substrs=['ptr = \"',
+ 'Nested Hello world!'])
self.expect("p strptr",
- substrs = ['ptr = \"',
- 'Hello world!'])
+ substrs=['ptr = \"',
+ 'Hello world!'])
self.expect("p other.strptr",
- substrs = ['ptr = \"',
- 'Nested Hello world!'])
+ substrs=['ptr = \"',
+ 'Nested Hello world!'])
+
+ self.runCmd(
+ "type summary add --summary-string \"ptr = ${var[]%char[]}\" \"char *\"")
- self.runCmd("type summary add --summary-string \"ptr = ${var[]%char[]}\" \"char *\"")
-
# I do not know the size of the data, but you are asking for a full array slice..
# use the ${var%char[]} to obtain a string as result
self.expect("frame variable strptr", matching=False,
- substrs = ['ptr = \"',
- 'Hello world!'])
-
+ substrs=['ptr = \"',
+ 'Hello world!'])
+
self.expect("frame variable other.strptr", matching=False,
- substrs = ['ptr = \"',
- 'Nested Hello world!'])
+ substrs=['ptr = \"',
+ 'Nested Hello world!'])
self.expect("p strptr", matching=False,
- substrs = ['ptr = \"',
- 'Hello world!'])
+ substrs=['ptr = \"',
+ 'Hello world!'])
self.expect("p other.strptr", matching=False,
- substrs = ['ptr = \"',
- 'Nested Hello world!'])
+ substrs=['ptr = \"',
+ 'Nested Hello world!'])
# You asked an array-style printout...
- self.runCmd("type summary add --summary-string \"ptr = ${var[0-1]%char[]}\" \"char *\"")
-
+ self.runCmd(
+ "type summary add --summary-string \"ptr = ${var[0-1]%char[]}\" \"char *\"")
+
self.expect("frame variable strptr",
- substrs = ['ptr = ',
- '[{H},{e}]'])
-
+ substrs=['ptr = ',
+ '[{H},{e}]'])
+
self.expect("frame variable other.strptr",
- substrs = ['ptr = ',
- '[{N},{e}]'])
+ substrs=['ptr = ',
+ '[{N},{e}]'])
self.expect("p strptr",
- substrs = ['ptr = ',
- '[{H},{e}]'])
+ substrs=['ptr = ',
+ '[{H},{e}]'])
self.expect("p other.strptr",
- substrs = ['ptr = ',
- '[{N},{e}]'])
+ substrs=['ptr = ',
+ '[{N},{e}]'])
# using [] is required here
- self.runCmd("type summary add --summary-string \"arr = ${var%x}\" \"int [5]\"")
-
- self.expect("frame variable intarr",matching=False,
- substrs = ['0x00000001,0x00000001,0x00000002,0x00000003,0x00000005'])
-
- self.expect("frame variable other.intarr", matching=False,
- substrs = ['0x00000009,0x00000008,0x00000007,0x00000006,0x00000005'])
-
- self.runCmd("type summary add --summary-string \"arr = ${var[]%x}\" \"int [5]\"")
-
- self.expect("frame variable intarr",
- substrs = ['intarr = arr =',
- '0x00000001,0x00000001,0x00000002,0x00000003,0x00000005'])
-
- self.expect("frame variable other.intarr",
- substrs = ['intarr = arr =',
- '0x00000009,0x00000008,0x00000007,0x00000006,0x00000005'])
+ self.runCmd(
+ "type summary add --summary-string \"arr = ${var%x}\" \"int [5]\"")
+
+ self.expect("frame variable intarr", matching=False, substrs=[
+ '0x00000001,0x00000001,0x00000002,0x00000003,0x00000005'])
+
+ self.expect("frame variable other.intarr", matching=False, substrs=[
+ '0x00000009,0x00000008,0x00000007,0x00000006,0x00000005'])
+
+ self.runCmd(
+ "type summary add --summary-string \"arr = ${var[]%x}\" \"int [5]\"")
+
+ self.expect(
+ "frame variable intarr",
+ substrs=[
+ 'intarr = arr =',
+ '0x00000001,0x00000001,0x00000002,0x00000003,0x00000005'])
+
+ self.expect(
+ "frame variable other.intarr",
+ substrs=[
+ 'intarr = arr =',
+ '0x00000009,0x00000008,0x00000007,0x00000006,0x00000005'])
# printing each array item as an array
- self.runCmd("type summary add --summary-string \"arr = ${var[]%uint32_t[]}\" \"int [5]\"")
-
- self.expect("frame variable intarr",
- substrs = ['intarr = arr =',
- '{0x00000001},{0x00000001},{0x00000002},{0x00000003},{0x00000005}'])
-
- self.expect("frame variable other.intarr",
- substrs = ['intarr = arr = ',
- '{0x00000009},{0x00000008},{0x00000007},{0x00000006},{0x00000005}'])
+ self.runCmd(
+ "type summary add --summary-string \"arr = ${var[]%uint32_t[]}\" \"int [5]\"")
+
+ self.expect(
+ "frame variable intarr",
+ substrs=[
+ 'intarr = arr =',
+ '{0x00000001},{0x00000001},{0x00000002},{0x00000003},{0x00000005}'])
+
+ self.expect(
+ "frame variable other.intarr",
+ substrs=[
+ 'intarr = arr = ',
+ '{0x00000009},{0x00000008},{0x00000007},{0x00000006},{0x00000005}'])
# printing full array as an array
- self.runCmd("type summary add --summary-string \"arr = ${var%uint32_t[]}\" \"int [5]\"")
-
- self.expect("frame variable intarr",
- substrs = ['intarr = arr =',
- '0x00000001,0x00000001,0x00000002,0x00000003,0x00000005'])
+ self.runCmd(
+ "type summary add --summary-string \"arr = ${var%uint32_t[]}\" \"int [5]\"")
- self.expect("frame variable other.intarr",
- substrs = ['intarr = arr =',
- '0x00000009,0x00000008,0x00000007,0x00000006,0x00000005'])
+ self.expect(
+ "frame variable intarr",
+ substrs=[
+ 'intarr = arr =',
+ '0x00000001,0x00000001,0x00000002,0x00000003,0x00000005'])
+
+ self.expect(
+ "frame variable other.intarr",
+ substrs=[
+ 'intarr = arr =',
+ '0x00000009,0x00000008,0x00000007,0x00000006,0x00000005'])
# printing each array item as an array
- self.runCmd("type summary add --summary-string \"arr = ${var[]%float32[]}\" \"float [7]\"")
-
- self.expect("frame variable flarr",
- substrs = ['flarr = arr =',
- '{78.5},{77.25},{78},{76.125},{76.75},{76.875},{77}'])
-
- self.expect("frame variable other.flarr",
- substrs = ['flarr = arr = ',
- '{25.5},{25.25},{25.125},{26.75},{27.375},{27.5},{26.125}'])
-
+ self.runCmd(
+ "type summary add --summary-string \"arr = ${var[]%float32[]}\" \"float [7]\"")
+
+ self.expect(
+ "frame variable flarr",
+ substrs=[
+ 'flarr = arr =',
+ '{78.5},{77.25},{78},{76.125},{76.75},{76.875},{77}'])
+
+ self.expect(
+ "frame variable other.flarr",
+ substrs=[
+ 'flarr = arr = ',
+ '{25.5},{25.25},{25.125},{26.75},{27.375},{27.5},{26.125}'])
+
# printing full array as an array
- self.runCmd("type summary add --summary-string \"arr = ${var%float32[]}\" \"float [7]\"")
-
+ self.runCmd(
+ "type summary add --summary-string \"arr = ${var%float32[]}\" \"float [7]\"")
+
self.expect("frame variable flarr",
- substrs = ['flarr = arr =',
- '78.5,77.25,78,76.125,76.75,76.875,77'])
-
+ substrs=['flarr = arr =',
+ '78.5,77.25,78,76.125,76.75,76.875,77'])
+
self.expect("frame variable other.flarr",
- substrs = ['flarr = arr =',
- '25.5,25.25,25.125,26.75,27.375,27.5,26.125'])
+ substrs=['flarr = arr =',
+ '25.5,25.25,25.125,26.75,27.375,27.5,26.125'])
# using array smart summary strings for pointers should make no sense
- self.runCmd("type summary add --summary-string \"arr = ${var%float32[]}\" \"float *\"")
- self.runCmd("type summary add --summary-string \"arr = ${var%int32_t[]}\" \"int *\"")
+ self.runCmd(
+ "type summary add --summary-string \"arr = ${var%float32[]}\" \"float *\"")
+ self.runCmd(
+ "type summary add --summary-string \"arr = ${var%int32_t[]}\" \"int *\"")
self.expect("frame variable flptr", matching=False,
- substrs = ['78.5,77.25,78,76.125,76.75,76.875,77'])
-
+ substrs=['78.5,77.25,78,76.125,76.75,76.875,77'])
+
self.expect("frame variable intptr", matching=False,
- substrs = ['1,1,2,3,5'])
+ substrs=['1,1,2,3,5'])
# use y and Y
- self.runCmd("type summary add --summary-string \"arr = ${var%y}\" \"float [7]\"")
- self.runCmd("type summary add --summary-string \"arr = ${var%y}\" \"int [5]\"")
+ self.runCmd(
+ "type summary add --summary-string \"arr = ${var%y}\" \"float [7]\"")
+ self.runCmd(
+ "type summary add --summary-string \"arr = ${var%y}\" \"int [5]\"")
if process.GetByteOrder() == lldb.eByteOrderLittle:
- self.expect("frame variable flarr",
- substrs = ['flarr = arr =',
- '00 00 9d 42,00 80 9a 42,00 00 9c 42,00 40 98 42,00 80 99 42,00 c0 99 42,00 00 9a 42'])
+ self.expect(
+ "frame variable flarr",
+ substrs=[
+ 'flarr = arr =',
+ '00 00 9d 42,00 80 9a 42,00 00 9c 42,00 40 98 42,00 80 99 42,00 c0 99 42,00 00 9a 42'])
else:
- self.expect("frame variable flarr",
- substrs = ['flarr = arr =',
- '42 9d 00 00,42 9a 80 00,42 9c 00 00,42 98 40 00,42 99 80 00,42 99 c0 00,42 9a 00 00'])
+ self.expect(
+ "frame variable flarr",
+ substrs=[
+ 'flarr = arr =',
+ '42 9d 00 00,42 9a 80 00,42 9c 00 00,42 98 40 00,42 99 80 00,42 99 c0 00,42 9a 00 00'])
if process.GetByteOrder() == lldb.eByteOrderLittle:
- self.expect("frame variable other.flarr",
- substrs = ['flarr = arr =',
- '00 00 cc 41,00 00 ca 41,00 00 c9 41,00 00 d6 41,00 00 db 41,00 00 dc 41,00 00 d1 41'])
+ self.expect(
+ "frame variable other.flarr",
+ substrs=[
+ 'flarr = arr =',
+ '00 00 cc 41,00 00 ca 41,00 00 c9 41,00 00 d6 41,00 00 db 41,00 00 dc 41,00 00 d1 41'])
else:
- self.expect("frame variable other.flarr",
- substrs = ['flarr = arr =',
- '41 cc 00 00,41 ca 00 00,41 c9 00 00,41 d6 00 00,41 db 00 00,41 dc 00 00,41 d1 00 00'])
+ self.expect(
+ "frame variable other.flarr",
+ substrs=[
+ 'flarr = arr =',
+ '41 cc 00 00,41 ca 00 00,41 c9 00 00,41 d6 00 00,41 db 00 00,41 dc 00 00,41 d1 00 00'])
if process.GetByteOrder() == lldb.eByteOrderLittle:
- self.expect("frame variable intarr",
- substrs = ['intarr = arr =',
- '01 00 00 00,01 00 00 00,02 00 00 00,03 00 00 00,05 00 00 00'])
+ self.expect(
+ "frame variable intarr",
+ substrs=[
+ 'intarr = arr =',
+ '01 00 00 00,01 00 00 00,02 00 00 00,03 00 00 00,05 00 00 00'])
else:
- self.expect("frame variable intarr",
- substrs = ['intarr = arr =',
- '00 00 00 01,00 00 00 01,00 00 00 02,00 00 00 03,00 00 00 05'])
+ self.expect(
+ "frame variable intarr",
+ substrs=[
+ 'intarr = arr =',
+ '00 00 00 01,00 00 00 01,00 00 00 02,00 00 00 03,00 00 00 05'])
if process.GetByteOrder() == lldb.eByteOrderLittle:
- self.expect("frame variable other.intarr",
- substrs = ['intarr = arr = ',
- '09 00 00 00,08 00 00 00,07 00 00 00,06 00 00 00,05 00 00 00'])
+ self.expect(
+ "frame variable other.intarr",
+ substrs=[
+ 'intarr = arr = ',
+ '09 00 00 00,08 00 00 00,07 00 00 00,06 00 00 00,05 00 00 00'])
else:
- self.expect("frame variable other.intarr",
- substrs = ['intarr = arr = ',
- '00 00 00 09,00 00 00 08,00 00 00 07,00 00 00 06,00 00 00 05'])
-
- self.runCmd("type summary add --summary-string \"arr = ${var%Y}\" \"float [7]\"")
- self.runCmd("type summary add --summary-string \"arr = ${var%Y}\" \"int [5]\"")
-
+ self.expect(
+ "frame variable other.intarr",
+ substrs=[
+ 'intarr = arr = ',
+ '00 00 00 09,00 00 00 08,00 00 00 07,00 00 00 06,00 00 00 05'])
+
+ self.runCmd(
+ "type summary add --summary-string \"arr = ${var%Y}\" \"float [7]\"")
+ self.runCmd(
+ "type summary add --summary-string \"arr = ${var%Y}\" \"int [5]\"")
+
if process.GetByteOrder() == lldb.eByteOrderLittle:
- self.expect("frame variable flarr",
- substrs = ['flarr = arr =',
- '00 00 9d 42 ...B,00 80 9a 42 ...B,00 00 9c 42 ...B,00 40 98 42 .@.B,00 80 99 42 ...B,00 c0 99 42 ...B,00 00 9a 42 ...B'])
+ self.expect(
+ "frame variable flarr",
+ substrs=[
+ 'flarr = arr =',
+ '00 00 9d 42 ...B,00 80 9a 42 ...B,00 00 9c 42 ...B,00 40 98 42 .@.B,00 80 99 42 ...B,00 c0 99 42 ...B,00 00 9a 42 ...B'])
else:
- self.expect("frame variable flarr",
- substrs = ['flarr = arr =',
- '42 9d 00 00 B...,42 9a 80 00 B...,42 9c 00 00 B...,42 98 40 00 B.@.,42 99 80 00 B...,42 99 c0 00 B...,42 9a 00 00 B...'])
+ self.expect(
+ "frame variable flarr",
+ substrs=[
+ 'flarr = arr =',
+ '42 9d 00 00 B...,42 9a 80 00 B...,42 9c 00 00 B...,42 98 40 00 B.@.,42 99 80 00 B...,42 99 c0 00 B...,42 9a 00 00 B...'])
if process.GetByteOrder() == lldb.eByteOrderLittle:
- self.expect("frame variable other.flarr",
- substrs = ['flarr = arr =',
- '00 00 cc 41 ...A,00 00 ca 41 ...A,00 00 c9 41 ...A,00 00 d6 41 ...A,00 00 db 41 ...A,00 00 dc 41 ...A,00 00 d1 41 ...A'])
+ self.expect(
+ "frame variable other.flarr",
+ substrs=[
+ 'flarr = arr =',
+ '00 00 cc 41 ...A,00 00 ca 41 ...A,00 00 c9 41 ...A,00 00 d6 41 ...A,00 00 db 41 ...A,00 00 dc 41 ...A,00 00 d1 41 ...A'])
else:
- self.expect("frame variable other.flarr",
- substrs = ['flarr = arr =',
- '41 cc 00 00 A...,41 ca 00 00 A...,41 c9 00 00 A...,41 d6 00 00 A...,41 db 00 00 A...,41 dc 00 00 A...,41 d1 00 00 A...'])
+ self.expect(
+ "frame variable other.flarr",
+ substrs=[
+ 'flarr = arr =',
+ '41 cc 00 00 A...,41 ca 00 00 A...,41 c9 00 00 A...,41 d6 00 00 A...,41 db 00 00 A...,41 dc 00 00 A...,41 d1 00 00 A...'])
if process.GetByteOrder() == lldb.eByteOrderLittle:
self.expect("frame variable intarr",
- substrs = ['intarr = arr =',
- '....,01 00 00 00',
- '....,05 00 00 00'])
+ substrs=['intarr = arr =',
+ '....,01 00 00 00',
+ '....,05 00 00 00'])
else:
self.expect("frame variable intarr",
- substrs = ['intarr = arr =',
- '....,00 00 00 01',
- '....,00 00 00 05'])
+ substrs=['intarr = arr =',
+ '....,00 00 00 01',
+ '....,00 00 00 05'])
if process.GetByteOrder() == lldb.eByteOrderLittle:
self.expect("frame variable other.intarr",
- substrs = ['intarr = arr = ',
- '09 00 00 00',
- '....,07 00 00 00'])
+ substrs=['intarr = arr = ',
+ '09 00 00 00',
+ '....,07 00 00 00'])
else:
self.expect("frame variable other.intarr",
- substrs = ['intarr = arr = ',
- '00 00 00 09',
- '....,00 00 00 07'])
+ substrs=['intarr = arr = ',
+ '00 00 00 09',
+ '....,00 00 00 07'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py
index 083f713c259d..2b63dbb1c83b 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/atomic/TestLibCxxAtomic.py
@@ -5,13 +5,14 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class LibCxxAtomicTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -23,30 +24,39 @@ class LibCxxAtomicTestCase(TestBase):
return var
@skipIf(compiler="gcc")
- @skipIfWindows # libc++ not ported to Windows yet
+ @skipIfWindows # libc++ not ported to Windows yet
def test(self):
"""Test that std::atomic as defined by libc++ is correctly printed by LLDB"""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- bkpt = self.target().FindBreakpointByID(lldbutil.run_break_set_by_source_regexp (self, "Set break point at this line."))
+ bkpt = self.target().FindBreakpointByID(
+ lldbutil.run_break_set_by_source_regexp(
+ self, "Set break point at this line."))
self.runCmd("run", RUN_SUCCEEDED)
- lldbutil.skip_if_library_missing(self, self.target(), lldbutil.PrintableRegex("libc\+\+"))
+ lldbutil.skip_if_library_missing(
+ self, self.target(), lldbutil.PrintableRegex("libc\+\+"))
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
-
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
+
s = self.get_variable('s')
i = self.get_variable('i')
-
- if self.TraceOn(): print(s)
- if self.TraceOn(): print(i)
-
+
+ if self.TraceOn():
+ print(s)
+ if self.TraceOn():
+ print(i)
+
self.assertTrue(i.GetValueAsUnsigned(0) == 5, "i == 5")
self.assertTrue(s.GetNumChildren() == 2, "s has two children")
- self.assertTrue(s.GetChildAtIndex(0).GetValueAsUnsigned(0) == 1, "s.x == 1")
- self.assertTrue(s.GetChildAtIndex(1).GetValueAsUnsigned(0) == 2, "s.y == 2")
+ self.assertTrue(
+ s.GetChildAtIndex(0).GetValueAsUnsigned(0) == 1,
+ "s.x == 1")
+ self.assertTrue(
+ s.GetChildAtIndex(1).GetValueAsUnsigned(0) == 2,
+ "s.y == 2")
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/Makefile
new file mode 100644
index 000000000000..fdd717119d95
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../../../make
+CXX_SOURCES := main.cpp
+CXXFLAGS += -std=c++11
+USE_LIBCPP := 1
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py
new file mode 100644
index 000000000000..6a832e02990a
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py
@@ -0,0 +1,56 @@
+"""
+Test lldb data formatter subsystem.
+"""
+
+from __future__ import print_function
+
+
+import os
+import time
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class LibCxxFunctionTestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def get_variable(self, name):
+ var = self.frame().FindVariable(name)
+ var.SetPreferDynamicValue(lldb.eDynamicCanRunTarget)
+ var.SetPreferSyntheticValue(True)
+ return var
+
+ @skipIf(compiler="gcc")
+ @skipIfWindows # libc++ not ported to Windows yet
+ def test(self):
+ """Test that std::function as defined by libc++ is correctly printed by LLDB"""
+ self.build()
+ self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
+
+ bkpt = self.target().FindBreakpointByID(
+ lldbutil.run_break_set_by_source_regexp(
+ self, "Set break point at this line."))
+
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ lldbutil.skip_if_library_missing(
+ self, self.target(), lldbutil.PrintableRegex("libc\+\+"))
+
+ # The stop reason of the thread should be breakpoint.
+ self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
+
+ f1 = self.get_variable('f1')
+ f2 = self.get_variable('f2')
+
+ if self.TraceOn():
+ print(f1)
+ if self.TraceOn():
+ print(f2)
+
+ self.assertTrue(f1.GetValueAsUnsigned(0) != 0, 'f1 has a valid value')
+ self.assertTrue(f2.GetValueAsUnsigned(0) != 0, 'f2 has a valid value')
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/main.cpp
new file mode 100644
index 000000000000..cfe689b29b01
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/main.cpp
@@ -0,0 +1,25 @@
+//===-- main.cpp --------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <functional>
+
+int foo(int x, int y) {
+ return x + y - 1;
+}
+
+int main ()
+{
+ int acc = 42;
+ std::function<int (int,int)> f1 = foo;
+ std::function<int (int)> f2 = [acc,f1] (int x) -> int {
+ return x+f1(acc,x);
+ };
+ return f1(acc,acc) + f2(acc); // Set break point at this line.
+}
+
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/TestInitializerList.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/TestInitializerList.py
index d452c1be69bf..f0857f420fc3 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/TestInitializerList.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/initializerlist/TestInitializerList.py
@@ -5,37 +5,44 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class InitializerListTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @skipIfWindows # libc++ not ported to Windows yet
+ @skipIfWindows # libc++ not ported to Windows yet
@skipIf(compiler="gcc")
- @expectedFailureAll(oslist=["linux"], bugnumber="fails on clang 3.5 and tot")
+ @expectedFailureAll(
+ oslist=["linux"],
+ bugnumber="fails on clang 3.5 and tot")
def test(self):
"""Test that that file and class static variables display correctly."""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- bkpt = self.target().FindBreakpointByID(lldbutil.run_break_set_by_source_regexp (self, "Set break point at this line."))
+ bkpt = self.target().FindBreakpointByID(
+ lldbutil.run_break_set_by_source_regexp(
+ self, "Set break point at this line."))
self.runCmd("run", RUN_SUCCEEDED)
- lldbutil.skip_if_library_missing(self, self.target(), lldbutil.PrintableRegex("libc\+\+"))
+ lldbutil.skip_if_library_missing(
+ self, self.target(), lldbutil.PrintableRegex("libc\+\+"))
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
- self.expect("frame variable ili", substrs = ['[1] = 2','[4] = 5'])
- self.expect("frame variable ils", substrs = ['[4] = "surprise it is a long string!! yay!!"'])
+ self.expect("frame variable ili", substrs=['[1] = 2', '[4] = 5'])
+ self.expect("frame variable ils", substrs=[
+ '[4] = "surprise it is a long string!! yay!!"'])
- self.expect('image list', substrs = self.getLibcPlusPlusLibs())
+ self.expect('image list', substrs=self.getLibcPlusPlusLibs())
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/TestDataFormatterLibccIterator.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/TestDataFormatterLibccIterator.py
index 23f6956cf3f0..5d23fcef04ce 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/TestDataFormatterLibccIterator.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/TestDataFormatterLibccIterator.py
@@ -5,13 +5,14 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class LibcxxIteratorDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -23,22 +24,24 @@ class LibcxxIteratorDataFormatterTestCase(TestBase):
self.line = line_number('main.cpp', '// Set break point at this line.')
@skipIf(compiler="gcc")
- @skipIfWindows # libc++ not ported to Windows yet
+ @skipIfWindows # libc++ not ported to Windows yet
def test_with_run_command(self):
"""Test that libc++ iterators format properly."""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=-1)
self.runCmd("run", RUN_SUCCEEDED)
- lldbutil.skip_if_library_missing(self, self.target(), lldbutil.PrintableRegex("libc\+\+"))
+ lldbutil.skip_if_library_missing(
+ self, self.target(), lldbutil.PrintableRegex("libc\+\+"))
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -47,21 +50,31 @@ class LibcxxIteratorDataFormatterTestCase(TestBase):
self.runCmd('type summary clear', check=False)
self.runCmd('type filter clear', check=False)
self.runCmd('type synth clear', check=False)
- self.runCmd("settings set target.max-children-count 256", check=False)
+ self.runCmd(
+ "settings set target.max-children-count 256",
+ check=False)
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
- self.expect('image list', substrs = self.getLibcPlusPlusLibs())
+ self.expect('image list', substrs=self.getLibcPlusPlusLibs())
- self.expect('frame variable ivI', substrs = ['item = 3'])
- self.expect('expr ivI', substrs = ['item = 3'])
+ self.expect('frame variable ivI', substrs=['item = 3'])
+ self.expect('expr ivI', substrs=['item = 3'])
- self.expect('frame variable iimI', substrs = ['first = 0','second = 12'])
- self.expect('expr iimI', substrs = ['first = 0','second = 12'])
+ self.expect(
+ 'frame variable iimI',
+ substrs=[
+ 'first = 43981',
+ 'second = 61681'])
+ self.expect('expr iimI', substrs=['first = 43981', 'second = 61681'])
- self.expect('frame variable simI', substrs = ['first = "world"','second = 42'])
- self.expect('expr simI', substrs = ['first = "world"','second = 42'])
+ self.expect(
+ 'frame variable simI',
+ substrs=[
+ 'first = "world"',
+ 'second = 42'])
+ self.expect('expr simI', substrs=['first = "world"', 'second = 42'])
- self.expect('frame variable svI', substrs = ['item = "hello"'])
- self.expect('expr svI', substrs = ['item = "hello"'])
+ self.expect('frame variable svI', substrs=['item = "hello"'])
+ self.expect('expr svI', substrs=['item = "hello"'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/main.cpp
index 97b37851f53d..058a79317d19 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/main.cpp
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/main.cpp
@@ -20,23 +20,23 @@ typedef string_vector::iterator svter;
int main()
{
- intint_map iim;
- iim[0] = 12;
-
+ intint_map iim;
+ iim[0xABCD] = 0xF0F1;
+
strint_map sim;
sim["world"] = 42;
-
+
int_vector iv;
iv.push_back(3);
-
+
string_vector sv;
sv.push_back("hello");
iimter iimI = iim.begin();
simter simI = sim.begin();
-
+
ivter ivI = iv.begin();
svter svI = sv.begin();
- return 0; // Set break point at this line.
+ return 0; // Set break point at this line.
} \ No newline at end of file
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/TestDataFormatterLibcxxList.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/TestDataFormatterLibcxxList.py
index 6fcdc37465db..dd97a9ab5977 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/TestDataFormatterLibcxxList.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/TestDataFormatterLibcxxList.py
@@ -5,13 +5,15 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time, re
+import os
+import time
+import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class LibcxxListDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -21,31 +23,38 @@ class LibcxxListDataFormatterTestCase(TestBase):
TestBase.setUp(self)
# Find the line number to break at.
self.line = line_number('main.cpp', '// Set break point at this line.')
- self.line2 = line_number('main.cpp', '// Set second break point at this line.')
- self.line3 = line_number('main.cpp', '// Set third break point at this line.')
- self.line4 = line_number('main.cpp', '// Set fourth break point at this line.')
+ self.line2 = line_number('main.cpp',
+ '// Set second break point at this line.')
+ self.line3 = line_number('main.cpp',
+ '// Set third break point at this line.')
+ self.line4 = line_number('main.cpp',
+ '// Set fourth break point at this line.')
@skipIf(compiler="gcc")
- @skipIfWindows # libc++ not ported to Windows yet
- @expectedFailureAll(oslist=["macosx"], bugnumber="rdar://25499635")
+ @skipIfWindows # libc++ not ported to Windows yet
def test_with_run_command(self):
"""Test that that file and class static variables display correctly."""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
-
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line2, num_expected_locations=-1)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line3, num_expected_locations=-1)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line4, num_expected_locations=-1)
+
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=-1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line2, num_expected_locations=-1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line3, num_expected_locations=-1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line4, num_expected_locations=-1)
self.runCmd("run", RUN_SUCCEEDED)
- lldbutil.skip_if_library_missing(self, self.target(), lldbutil.PrintableRegex("libc\+\+"))
+ lldbutil.skip_if_library_missing(
+ self, self.target(), lldbutil.PrintableRegex("libc\+\+"))
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -54,135 +63,154 @@ class LibcxxListDataFormatterTestCase(TestBase):
self.runCmd('type summary clear', check=False)
self.runCmd('type filter clear', check=False)
self.runCmd('type synth clear', check=False)
- self.runCmd("settings set target.max-children-count 256", check=False)
+ self.runCmd(
+ "settings set target.max-children-count 256",
+ check=False)
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
self.runCmd("frame variable numbers_list --show-types")
- self.runCmd("type summary add std::int_list std::string_list int_list string_list --summary-string \"list has ${svar%#} items\" -e")
+ self.runCmd(
+ "type summary add std::int_list std::string_list int_list string_list --summary-string \"list has ${svar%#} items\" -e")
self.runCmd("type format add -f hex int")
self.expect("frame variable numbers_list --raw", matching=False,
- substrs = ['list has 0 items',
- '{}'])
+ substrs=['list has 0 items',
+ '{}'])
self.expect("frame variable numbers_list",
- substrs = ['list has 0 items',
- '{}'])
+ substrs=['list has 0 items',
+ '{}'])
self.expect("p numbers_list",
- substrs = ['list has 0 items',
- '{}'])
+ substrs=['list has 0 items',
+ '{}'])
self.runCmd("n")
self.expect("frame variable numbers_list",
- substrs = ['list has 1 items',
- '[0] = ',
- '0x12345678'])
+ substrs=['list has 1 items',
+ '[0] = ',
+ '0x12345678'])
- self.runCmd("n");self.runCmd("n");self.runCmd("n");
+ self.runCmd("n")
+ self.runCmd("n")
+ self.runCmd("n")
self.expect("frame variable numbers_list",
- substrs = ['list has 4 items',
- '[0] = ',
- '0x12345678',
- '[1] =',
- '0x11223344',
- '[2] =',
- '0xbeeffeed',
- '[3] =',
- '0x00abba00'])
-
- self.runCmd("n");self.runCmd("n");
+ substrs=['list has 4 items',
+ '[0] = ',
+ '0x12345678',
+ '[1] =',
+ '0x11223344',
+ '[2] =',
+ '0xbeeffeed',
+ '[3] =',
+ '0x00abba00'])
+
+ self.runCmd("n")
+ self.runCmd("n")
self.expect("frame variable numbers_list",
- substrs = ['list has 6 items',
- '[0] = ',
- '0x12345678',
- '0x11223344',
- '0xbeeffeed',
- '0x00abba00',
- '[4] =',
- '0x0abcdef0',
- '[5] =',
- '0x0cab0cab'])
+ substrs=['list has 6 items',
+ '[0] = ',
+ '0x12345678',
+ '0x11223344',
+ '0xbeeffeed',
+ '0x00abba00',
+ '[4] =',
+ '0x0abcdef0',
+ '[5] =',
+ '0x0cab0cab'])
self.expect("p numbers_list",
- substrs = ['list has 6 items',
- '[0] = ',
- '0x12345678',
- '0x11223344',
- '0xbeeffeed',
- '0x00abba00',
- '[4] =',
- '0x0abcdef0',
- '[5] =',
- '0x0cab0cab'])
+ substrs=['list has 6 items',
+ '[0] = ',
+ '0x12345678',
+ '0x11223344',
+ '0xbeeffeed',
+ '0x00abba00',
+ '[4] =',
+ '0x0abcdef0',
+ '[5] =',
+ '0x0cab0cab'])
# check access-by-index
self.expect("frame variable numbers_list[0]",
- substrs = ['0x12345678']);
+ substrs=['0x12345678'])
self.expect("frame variable numbers_list[1]",
- substrs = ['0x11223344']);
+ substrs=['0x11223344'])
self.runCmd("n")
-
+
self.expect("frame variable numbers_list",
- substrs = ['list has 0 items',
- '{}'])
+ substrs=['list has 0 items',
+ '{}'])
+
+ self.runCmd("n")
+ self.runCmd("n")
+ self.runCmd("n")
+ self.runCmd("n")
- self.runCmd("n");self.runCmd("n");self.runCmd("n");self.runCmd("n");
-
self.expect("frame variable numbers_list",
- substrs = ['list has 4 items',
- '[0] = ', '1',
- '[1] = ', '2',
- '[2] = ', '3',
- '[3] = ', '4'])
+ substrs=['list has 4 items',
+ '[0] = ', '1',
+ '[1] = ', '2',
+ '[2] = ', '3',
+ '[3] = ', '4'])
# check that MightHaveChildren() gets it right
- self.assertTrue(self.frame().FindVariable("numbers_list").MightHaveChildren(), "numbers_list.MightHaveChildren() says False for non empty!")
+ self.assertTrue(
+ self.frame().FindVariable("numbers_list").MightHaveChildren(),
+ "numbers_list.MightHaveChildren() says False for non empty!")
self.runCmd("type format delete int")
self.runCmd("c")
self.expect("frame variable text_list",
- substrs = ['list has 3 items',
- '[0]', 'goofy',
- '[1]', 'is',
- '[2]', 'smart'])
+ substrs=['list has 3 items',
+ '[0]', 'goofy',
+ '[1]', 'is',
+ '[2]', 'smart'])
# check that MightHaveChildren() gets it right
- self.assertTrue(self.frame().FindVariable("text_list").MightHaveChildren(), "text_list.MightHaveChildren() says False for non empty!")
+ self.assertTrue(
+ self.frame().FindVariable("text_list").MightHaveChildren(),
+ "text_list.MightHaveChildren() says False for non empty!")
self.expect("p text_list",
- substrs = ['list has 3 items',
- '\"goofy\"',
- '\"is\"',
- '\"smart\"'])
-
+ substrs=['list has 3 items',
+ '\"goofy\"',
+ '\"is\"',
+ '\"smart\"'])
+
self.runCmd("n")
# check access-by-index
self.expect("frame variable text_list[0]",
- substrs = ['goofy']);
+ substrs=['goofy'])
self.expect("frame variable text_list[3]",
- substrs = ['!!!']);
-
+ substrs=['!!!'])
+
self.runCmd("continue")
-
+
# check that the list provider correctly updates if elements move
countingList = self.frame().FindVariable("countingList")
countingList.SetPreferDynamicValue(True)
countingList.SetPreferSyntheticValue(True)
-
- self.assertTrue(countingList.GetChildAtIndex(0).GetValueAsUnsigned(0) == 3141, "list[0] == 3141")
- self.assertTrue(countingList.GetChildAtIndex(1).GetValueAsUnsigned(0) == 3141, "list[1] == 3141")
-
+
+ self.assertTrue(countingList.GetChildAtIndex(
+ 0).GetValueAsUnsigned(0) == 3141, "list[0] == 3141")
+ self.assertTrue(countingList.GetChildAtIndex(
+ 1).GetValueAsUnsigned(0) == 3141, "list[1] == 3141")
+
self.runCmd("continue")
- self.assertTrue(countingList.GetChildAtIndex(0).GetValueAsUnsigned(0) == 3141, "uniqued list[0] == 3141")
- self.assertTrue(countingList.GetChildAtIndex(1).GetValueAsUnsigned(0) == 3142, "uniqued list[1] == 3142")
+ self.assertTrue(
+ countingList.GetChildAtIndex(0).GetValueAsUnsigned(0) == 3141,
+ "uniqued list[0] == 3141")
+ self.assertTrue(
+ countingList.GetChildAtIndex(1).GetValueAsUnsigned(0) == 3142,
+ "uniqued list[1] == 3142")
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/loop/TestDataFormatterLibcxxListLoop.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/loop/TestDataFormatterLibcxxListLoop.py
index 9e68e1dbc004..e2e082c795f7 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/loop/TestDataFormatterLibcxxListLoop.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/loop/TestDataFormatterLibcxxListLoop.py
@@ -6,19 +6,21 @@ corruption).
from __future__ import print_function
-
-import os, time, re
+import os
+import time
+import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class LibcxxListDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipIf(compiler="gcc")
- @skipIfWindows # libc++ not ported to Windows yet
+ @skipIfWindows # libc++ not ported to Windows yet
@add_test_categories(["pyapi"])
@skipIfDarwin # rdar://25499635
def test_with_run_command(self):
@@ -27,29 +29,47 @@ class LibcxxListDataFormatterTestCase(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target and target.IsValid(), "Target is valid")
- file_spec = lldb.SBFileSpec ("main.cpp", False)
- breakpoint1 = target.BreakpointCreateBySourceRegex('// Set break point at this line.', file_spec)
+ file_spec = lldb.SBFileSpec("main.cpp", False)
+ breakpoint1 = target.BreakpointCreateBySourceRegex(
+ '// Set break point at this line.', file_spec)
self.assertTrue(breakpoint1 and breakpoint1.IsValid())
- breakpoint2 = target.BreakpointCreateBySourceRegex('// Set second break point at this line.', file_spec)
+ breakpoint2 = target.BreakpointCreateBySourceRegex(
+ '// Set second break point at this line.', file_spec)
self.assertTrue(breakpoint2 and breakpoint2.IsValid())
# Run the program, it should stop at breakpoint 1.
- process = target.LaunchSimple(None, None, self.get_process_working_directory())
- lldbutil.skip_if_library_missing(self, target, lldbutil.PrintableRegex("libc\+\+"))
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
+ lldbutil.skip_if_library_missing(
+ self, target, lldbutil.PrintableRegex("libc\+\+"))
self.assertTrue(process and process.IsValid(), PROCESS_IS_VALID)
- self.assertEqual(len(lldbutil.get_threads_stopped_at_breakpoint(process, breakpoint1)), 1)
+ self.assertEqual(
+ len(lldbutil.get_threads_stopped_at_breakpoint(process, breakpoint1)), 1)
# verify our list is displayed correctly
- self.expect("frame variable *numbers_list", substrs=['[0] = 1', '[1] = 2', '[2] = 3', '[3] = 4', '[5] = 6'])
+ self.expect(
+ "frame variable *numbers_list",
+ substrs=[
+ '[0] = 1',
+ '[1] = 2',
+ '[2] = 3',
+ '[3] = 4',
+ '[5] = 6'])
# Continue to breakpoint 2.
process.Continue()
self.assertTrue(process and process.IsValid(), PROCESS_IS_VALID)
- self.assertEqual(len(lldbutil.get_threads_stopped_at_breakpoint(process, breakpoint2)), 1)
+ self.assertEqual(
+ len(lldbutil.get_threads_stopped_at_breakpoint(process, breakpoint2)), 1)
# The list is now inconsistent. However, we should be able to get the first three
# elements at least (and most importantly, not crash).
- self.expect("frame variable *numbers_list", substrs=['[0] = 1', '[1] = 2', '[2] = 3'])
+ self.expect(
+ "frame variable *numbers_list",
+ substrs=[
+ '[0] = 1',
+ '[1] = 2',
+ '[2] = 3'])
# Run to completion.
process.Continue()
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py
index cecc3178b318..7433a0b0da2c 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py
@@ -5,34 +5,38 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class LibcxxMapDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipIf(compiler="gcc")
- @skipIfWindows # libc++ not ported to Windows yet
+ @skipIfWindows # libc++ not ported to Windows yet
def test_with_run_command(self):
"""Test that that file and class static variables display correctly."""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- bkpt = self.target().FindBreakpointByID(lldbutil.run_break_set_by_source_regexp (self, "Set break point at this line."))
+ bkpt = self.target().FindBreakpointByID(
+ lldbutil.run_break_set_by_source_regexp(
+ self, "Set break point at this line."))
self.runCmd("run", RUN_SUCCEEDED)
- lldbutil.skip_if_library_missing(self, self.target(), lldbutil.PrintableRegex("libc\+\+"))
+ lldbutil.skip_if_library_missing(
+ self, self.target(), lldbutil.PrintableRegex("libc\+\+"))
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -41,259 +45,269 @@ class LibcxxMapDataFormatterTestCase(TestBase):
self.runCmd('type summary clear', check=False)
self.runCmd('type filter clear', check=False)
self.runCmd('type synth clear', check=False)
- self.runCmd("settings set target.max-children-count 256", check=False)
+ self.runCmd(
+ "settings set target.max-children-count 256",
+ check=False)
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
- self.expect('image list', substrs = self.getLibcPlusPlusLibs())
-
+ self.expect('image list', substrs=self.getLibcPlusPlusLibs())
+
self.expect('frame variable ii',
- substrs = ['size=0',
- '{}'])
+ substrs=['size=0',
+ '{}'])
lldbutil.continue_to_breakpoint(self.process(), bkpt)
self.expect('frame variable ii',
- substrs = ['size=2',
- '[0] = ',
- 'first = 0',
- 'second = 0',
- '[1] = ',
- 'first = 1',
- 'second = 1'])
+ substrs=['size=2',
+ '[0] = ',
+ 'first = 0',
+ 'second = 0',
+ '[1] = ',
+ 'first = 1',
+ 'second = 1'])
lldbutil.continue_to_breakpoint(self.process(), bkpt)
self.expect('frame variable ii',
- substrs = ['size=4',
- '[2] = ',
- 'first = 2',
- 'second = 0',
- '[3] = ',
- 'first = 3',
- 'second = 1'])
+ substrs=['size=4',
+ '[2] = ',
+ 'first = 2',
+ 'second = 0',
+ '[3] = ',
+ 'first = 3',
+ 'second = 1'])
lldbutil.continue_to_breakpoint(self.process(), bkpt)
self.expect("frame variable ii",
- substrs = ['size=8',
- '[5] = ',
- 'first = 5',
- 'second = 0',
- '[7] = ',
- 'first = 7',
- 'second = 1'])
+ substrs=['size=8',
+ '[5] = ',
+ 'first = 5',
+ 'second = 0',
+ '[7] = ',
+ 'first = 7',
+ 'second = 1'])
self.expect("p ii",
- substrs = ['size=8',
- '[5] = ',
- 'first = 5',
- 'second = 0',
- '[7] = ',
- 'first = 7',
- 'second = 1'])
+ substrs=['size=8',
+ '[5] = ',
+ 'first = 5',
+ 'second = 0',
+ '[7] = ',
+ 'first = 7',
+ 'second = 1'])
# check access-by-index
self.expect("frame variable ii[0]",
- substrs = ['first = 0',
- 'second = 0']);
+ substrs=['first = 0',
+ 'second = 0'])
self.expect("frame variable ii[3]",
- substrs = ['first =',
- 'second =']);
+ substrs=['first =',
+ 'second ='])
# check that MightHaveChildren() gets it right
- self.assertTrue(self.frame().FindVariable("ii").MightHaveChildren(), "ii.MightHaveChildren() says False for non empty!")
+ self.assertTrue(
+ self.frame().FindVariable("ii").MightHaveChildren(),
+ "ii.MightHaveChildren() says False for non empty!")
# check that the expression parser does not make use of
# synthetic children instead of running code
# TOT clang has a fix for this, which makes the expression command here succeed
# since this would make the test fail or succeed depending on clang version in use
# this is safer commented for the time being
- #self.expect("expression ii[8]", matching=False, error=True,
+ # self.expect("expression ii[8]", matching=False, error=True,
# substrs = ['1234567'])
- self.runCmd("continue");
-
+ self.runCmd("continue")
+
self.expect('frame variable ii',
- substrs = ['size=0',
- '{}'])
+ substrs=['size=0',
+ '{}'])
self.expect('frame variable si',
- substrs = ['size=0',
- '{}'])
+ substrs=['size=0',
+ '{}'])
- self.runCmd("continue");
+ self.runCmd("continue")
self.expect('frame variable si',
- substrs = ['size=1',
- '[0] = ',
- 'first = \"zero\"',
- 'second = 0'])
+ substrs=['size=1',
+ '[0] = ',
+ 'first = \"zero\"',
+ 'second = 0'])
lldbutil.continue_to_breakpoint(self.process(), bkpt)
self.expect("frame variable si",
- substrs = ['size=4',
- '[0] = ',
- 'first = \"zero\"',
- 'second = 0',
- '[1] = ',
- 'first = \"one\"',
- 'second = 1',
- '[2] = ',
- 'first = \"two\"',
- 'second = 2',
- '[3] = ',
- 'first = \"three\"',
- 'second = 3'])
+ substrs=['size=4',
+ '[0] = ',
+ 'first = \"zero\"',
+ 'second = 0',
+ '[1] = ',
+ 'first = \"one\"',
+ 'second = 1',
+ '[2] = ',
+ 'first = \"two\"',
+ 'second = 2',
+ '[3] = ',
+ 'first = \"three\"',
+ 'second = 3'])
self.expect("p si",
- substrs = ['size=4',
- '[0] = ',
- 'first = \"zero\"',
- 'second = 0',
- '[1] = ',
- 'first = \"one\"',
- 'second = 1',
- '[2] = ',
- 'first = \"two\"',
- 'second = 2',
- '[3] = ',
- 'first = \"three\"',
- 'second = 3'])
+ substrs=['size=4',
+ '[0] = ',
+ 'first = \"zero\"',
+ 'second = 0',
+ '[1] = ',
+ 'first = \"one\"',
+ 'second = 1',
+ '[2] = ',
+ 'first = \"two\"',
+ 'second = 2',
+ '[3] = ',
+ 'first = \"three\"',
+ 'second = 3'])
# check that MightHaveChildren() gets it right
- self.assertTrue(self.frame().FindVariable("si").MightHaveChildren(), "si.MightHaveChildren() says False for non empty!")
+ self.assertTrue(
+ self.frame().FindVariable("si").MightHaveChildren(),
+ "si.MightHaveChildren() says False for non empty!")
# check access-by-index
self.expect("frame variable si[0]",
- substrs = ['first = ', 'one',
- 'second = 1']);
-
+ substrs=['first = ', 'one',
+ 'second = 1'])
+
# check that the expression parser does not make use of
# synthetic children instead of running code
# TOT clang has a fix for this, which makes the expression command here succeed
# since this would make the test fail or succeed depending on clang version in use
# this is safer commented for the time being
- #self.expect("expression si[0]", matching=False, error=True,
+ # self.expect("expression si[0]", matching=False, error=True,
# substrs = ['first = ', 'zero'])
lldbutil.continue_to_breakpoint(self.process(), bkpt)
-
+
self.expect('frame variable si',
- substrs = ['size=0',
- '{}'])
+ substrs=['size=0',
+ '{}'])
lldbutil.continue_to_breakpoint(self.process(), bkpt)
-
+
self.expect('frame variable is',
- substrs = ['size=0',
- '{}'])
+ substrs=['size=0',
+ '{}'])
lldbutil.continue_to_breakpoint(self.process(), bkpt)
self.expect("frame variable is",
- substrs = ['size=4',
- '[0] = ',
- 'second = \"goofy\"',
- 'first = 85',
- '[1] = ',
- 'second = \"is\"',
- 'first = 1',
- '[2] = ',
- 'second = \"smart\"',
- 'first = 2',
- '[3] = ',
- 'second = \"!!!\"',
- 'first = 3'])
-
+ substrs=['size=4',
+ '[0] = ',
+ 'second = \"goofy\"',
+ 'first = 85',
+ '[1] = ',
+ 'second = \"is\"',
+ 'first = 1',
+ '[2] = ',
+ 'second = \"smart\"',
+ 'first = 2',
+ '[3] = ',
+ 'second = \"!!!\"',
+ 'first = 3'])
+
self.expect("p is",
- substrs = ['size=4',
- '[0] = ',
- 'second = \"goofy\"',
- 'first = 85',
- '[1] = ',
- 'second = \"is\"',
- 'first = 1',
- '[2] = ',
- 'second = \"smart\"',
- 'first = 2',
- '[3] = ',
- 'second = \"!!!\"',
- 'first = 3'])
+ substrs=['size=4',
+ '[0] = ',
+ 'second = \"goofy\"',
+ 'first = 85',
+ '[1] = ',
+ 'second = \"is\"',
+ 'first = 1',
+ '[2] = ',
+ 'second = \"smart\"',
+ 'first = 2',
+ '[3] = ',
+ 'second = \"!!!\"',
+ 'first = 3'])
# check that MightHaveChildren() gets it right
- self.assertTrue(self.frame().FindVariable("is").MightHaveChildren(), "is.MightHaveChildren() says False for non empty!")
+ self.assertTrue(
+ self.frame().FindVariable("is").MightHaveChildren(),
+ "is.MightHaveChildren() says False for non empty!")
# check access-by-index
self.expect("frame variable is[0]",
- substrs = ['first = ',
- 'second =']);
-
+ substrs=['first = ',
+ 'second ='])
+
# check that the expression parser does not make use of
# synthetic children instead of running code
# TOT clang has a fix for this, which makes the expression command here succeed
# since this would make the test fail or succeed depending on clang version in use
# this is safer commented for the time being
- #self.expect("expression is[0]", matching=False, error=True,
+ # self.expect("expression is[0]", matching=False, error=True,
# substrs = ['first = ', 'goofy'])
lldbutil.continue_to_breakpoint(self.process(), bkpt)
-
+
self.expect('frame variable is',
- substrs = ['size=0',
- '{}'])
+ substrs=['size=0',
+ '{}'])
lldbutil.continue_to_breakpoint(self.process(), bkpt)
-
+
self.expect('frame variable ss',
- substrs = ['size=0',
- '{}'])
+ substrs=['size=0',
+ '{}'])
lldbutil.continue_to_breakpoint(self.process(), bkpt)
self.expect("frame variable ss",
- substrs = ['size=3',
- '[0] = ',
- 'second = \"hello\"',
- 'first = \"ciao\"',
- '[1] = ',
- 'second = \"house\"',
- 'first = \"casa\"',
- '[2] = ',
- 'second = \"cat\"',
- 'first = \"gatto\"'])
-
+ substrs=['size=3',
+ '[0] = ',
+ 'second = \"hello\"',
+ 'first = \"ciao\"',
+ '[1] = ',
+ 'second = \"house\"',
+ 'first = \"casa\"',
+ '[2] = ',
+ 'second = \"cat\"',
+ 'first = \"gatto\"'])
+
self.expect("p ss",
- substrs = ['size=3',
- '[0] = ',
- 'second = \"hello\"',
- 'first = \"ciao\"',
- '[1] = ',
- 'second = \"house\"',
- 'first = \"casa\"',
- '[2] = ',
- 'second = \"cat\"',
- 'first = \"gatto\"'])
+ substrs=['size=3',
+ '[0] = ',
+ 'second = \"hello\"',
+ 'first = \"ciao\"',
+ '[1] = ',
+ 'second = \"house\"',
+ 'first = \"casa\"',
+ '[2] = ',
+ 'second = \"cat\"',
+ 'first = \"gatto\"'])
# check that MightHaveChildren() gets it right
- self.assertTrue(self.frame().FindVariable("ss").MightHaveChildren(), "ss.MightHaveChildren() says False for non empty!")
+ self.assertTrue(
+ self.frame().FindVariable("ss").MightHaveChildren(),
+ "ss.MightHaveChildren() says False for non empty!")
# check access-by-index
self.expect("frame variable ss[2]",
- substrs = ['gatto', 'cat']);
-
+ substrs=['gatto', 'cat'])
+
# check that the expression parser does not make use of
# synthetic children instead of running code
# TOT clang has a fix for this, which makes the expression command here succeed
# since this would make the test fail or succeed depending on clang version in use
# this is safer commented for the time being
- #self.expect("expression ss[3]", matching=False, error=True,
+ # self.expect("expression ss[3]", matching=False, error=True,
# substrs = ['gatto'])
lldbutil.continue_to_breakpoint(self.process(), bkpt)
-
+
self.expect('frame variable ss',
- substrs = ['size=0',
- '{}'])
+ substrs=['size=0',
+ '{}'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multimap/TestDataFormatterLibccMultiMap.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multimap/TestDataFormatterLibccMultiMap.py
index eb74818c91f5..66091e6e113f 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multimap/TestDataFormatterLibccMultiMap.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multimap/TestDataFormatterLibccMultiMap.py
@@ -5,35 +5,39 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class LibcxxMultiMapDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @skipIfWindows # libc++ not ported to Windows yet
+ @skipIfWindows # libc++ not ported to Windows yet
@skipIf(compiler="gcc")
def test_with_run_command(self):
"""Test that that file and class static variables display correctly."""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
-
- bkpt = self.target().FindBreakpointByID(lldbutil.run_break_set_by_source_regexp (self, "Set break point at this line."))
+
+ bkpt = self.target().FindBreakpointByID(
+ lldbutil.run_break_set_by_source_regexp(
+ self, "Set break point at this line."))
self.runCmd("run", RUN_SUCCEEDED)
- lldbutil.skip_if_library_missing(self, self.target(), lldbutil.PrintableRegex("libc\+\+"))
+ lldbutil.skip_if_library_missing(
+ self, self.target(), lldbutil.PrintableRegex("libc\+\+"))
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -42,259 +46,269 @@ class LibcxxMultiMapDataFormatterTestCase(TestBase):
self.runCmd('type summary clear', check=False)
self.runCmd('type filter clear', check=False)
self.runCmd('type synth clear', check=False)
- self.runCmd("settings set target.max-children-count 256", check=False)
+ self.runCmd(
+ "settings set target.max-children-count 256",
+ check=False)
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
- self.expect('image list', substrs = self.getLibcPlusPlusLibs())
-
+ self.expect('image list', substrs=self.getLibcPlusPlusLibs())
+
self.expect('frame variable ii',
- substrs = ['size=0',
- '{}'])
+ substrs=['size=0',
+ '{}'])
lldbutil.continue_to_breakpoint(self.process(), bkpt)
self.expect('frame variable ii',
- substrs = ['size=2',
- '[0] = ',
- 'first = 0',
- 'second = 0',
- '[1] = ',
- 'first = 1',
- 'second = 1'])
+ substrs=['size=2',
+ '[0] = ',
+ 'first = 0',
+ 'second = 0',
+ '[1] = ',
+ 'first = 1',
+ 'second = 1'])
lldbutil.continue_to_breakpoint(self.process(), bkpt)
self.expect('frame variable ii',
- substrs = ['size=4',
- '[2] = ',
- 'first = 2',
- 'second = 0',
- '[3] = ',
- 'first = 3',
- 'second = 1'])
+ substrs=['size=4',
+ '[2] = ',
+ 'first = 2',
+ 'second = 0',
+ '[3] = ',
+ 'first = 3',
+ 'second = 1'])
lldbutil.continue_to_breakpoint(self.process(), bkpt)
self.expect("frame variable ii",
- substrs = ['size=8',
- '[5] = ',
- 'first = 5',
- 'second = 0',
- '[7] = ',
- 'first = 7',
- 'second = 1'])
+ substrs=['size=8',
+ '[5] = ',
+ 'first = 5',
+ 'second = 0',
+ '[7] = ',
+ 'first = 7',
+ 'second = 1'])
self.expect("p ii",
- substrs = ['size=8',
- '[5] = ',
- 'first = 5',
- 'second = 0',
- '[7] = ',
- 'first = 7',
- 'second = 1'])
+ substrs=['size=8',
+ '[5] = ',
+ 'first = 5',
+ 'second = 0',
+ '[7] = ',
+ 'first = 7',
+ 'second = 1'])
# check access-by-index
self.expect("frame variable ii[0]",
- substrs = ['first = 0',
- 'second = 0']);
+ substrs=['first = 0',
+ 'second = 0'])
self.expect("frame variable ii[3]",
- substrs = ['first =',
- 'second =']);
+ substrs=['first =',
+ 'second ='])
# check that MightHaveChildren() gets it right
- self.assertTrue(self.frame().FindVariable("ii").MightHaveChildren(), "ii.MightHaveChildren() says False for non empty!")
+ self.assertTrue(
+ self.frame().FindVariable("ii").MightHaveChildren(),
+ "ii.MightHaveChildren() says False for non empty!")
# check that the expression parser does not make use of
# synthetic children instead of running code
# TOT clang has a fix for this, which makes the expression command here succeed
# since this would make the test fail or succeed depending on clang version in use
# this is safer commented for the time being
- #self.expect("expression ii[8]", matching=False, error=True,
+ # self.expect("expression ii[8]", matching=False, error=True,
# substrs = ['1234567'])
lldbutil.continue_to_breakpoint(self.process(), bkpt)
-
+
self.expect('frame variable ii',
- substrs = ['size=0',
- '{}'])
+ substrs=['size=0',
+ '{}'])
self.expect('frame variable si',
- substrs = ['size=0',
- '{}'])
+ substrs=['size=0',
+ '{}'])
lldbutil.continue_to_breakpoint(self.process(), bkpt)
self.expect('frame variable si',
- substrs = ['size=1',
- '[0] = ',
- 'first = \"zero\"',
- 'second = 0'])
+ substrs=['size=1',
+ '[0] = ',
+ 'first = \"zero\"',
+ 'second = 0'])
lldbutil.continue_to_breakpoint(self.process(), bkpt)
self.expect("frame variable si",
- substrs = ['size=4',
- '[0] = ',
- 'first = \"zero\"',
- 'second = 0',
- '[1] = ',
- 'first = \"one\"',
- 'second = 1',
- '[2] = ',
- 'first = \"two\"',
- 'second = 2',
- '[3] = ',
- 'first = \"three\"',
- 'second = 3'])
+ substrs=['size=4',
+ '[0] = ',
+ 'first = \"zero\"',
+ 'second = 0',
+ '[1] = ',
+ 'first = \"one\"',
+ 'second = 1',
+ '[2] = ',
+ 'first = \"two\"',
+ 'second = 2',
+ '[3] = ',
+ 'first = \"three\"',
+ 'second = 3'])
self.expect("p si",
- substrs = ['size=4',
- '[0] = ',
- 'first = \"zero\"',
- 'second = 0',
- '[1] = ',
- 'first = \"one\"',
- 'second = 1',
- '[2] = ',
- 'first = \"two\"',
- 'second = 2',
- '[3] = ',
- 'first = \"three\"',
- 'second = 3'])
+ substrs=['size=4',
+ '[0] = ',
+ 'first = \"zero\"',
+ 'second = 0',
+ '[1] = ',
+ 'first = \"one\"',
+ 'second = 1',
+ '[2] = ',
+ 'first = \"two\"',
+ 'second = 2',
+ '[3] = ',
+ 'first = \"three\"',
+ 'second = 3'])
# check that MightHaveChildren() gets it right
- self.assertTrue(self.frame().FindVariable("si").MightHaveChildren(), "si.MightHaveChildren() says False for non empty!")
+ self.assertTrue(
+ self.frame().FindVariable("si").MightHaveChildren(),
+ "si.MightHaveChildren() says False for non empty!")
# check access-by-index
self.expect("frame variable si[0]",
- substrs = ['first = ', 'one',
- 'second = 1']);
-
+ substrs=['first = ', 'one',
+ 'second = 1'])
+
# check that the expression parser does not make use of
# synthetic children instead of running code
# TOT clang has a fix for this, which makes the expression command here succeed
# since this would make the test fail or succeed depending on clang version in use
# this is safer commented for the time being
- #self.expect("expression si[0]", matching=False, error=True,
+ # self.expect("expression si[0]", matching=False, error=True,
# substrs = ['first = ', 'zero'])
lldbutil.continue_to_breakpoint(self.process(), bkpt)
-
+
self.expect('frame variable si',
- substrs = ['size=0',
- '{}'])
+ substrs=['size=0',
+ '{}'])
lldbutil.continue_to_breakpoint(self.process(), bkpt)
-
+
self.expect('frame variable is',
- substrs = ['size=0',
- '{}'])
+ substrs=['size=0',
+ '{}'])
lldbutil.continue_to_breakpoint(self.process(), bkpt)
self.expect("frame variable is",
- substrs = ['size=4',
- '[0] = ',
- 'second = \"goofy\"',
- 'first = 85',
- '[1] = ',
- 'second = \"is\"',
- 'first = 1',
- '[2] = ',
- 'second = \"smart\"',
- 'first = 2',
- '[3] = ',
- 'second = \"!!!\"',
- 'first = 3'])
-
+ substrs=['size=4',
+ '[0] = ',
+ 'second = \"goofy\"',
+ 'first = 85',
+ '[1] = ',
+ 'second = \"is\"',
+ 'first = 1',
+ '[2] = ',
+ 'second = \"smart\"',
+ 'first = 2',
+ '[3] = ',
+ 'second = \"!!!\"',
+ 'first = 3'])
+
self.expect("p is",
- substrs = ['size=4',
- '[0] = ',
- 'second = \"goofy\"',
- 'first = 85',
- '[1] = ',
- 'second = \"is\"',
- 'first = 1',
- '[2] = ',
- 'second = \"smart\"',
- 'first = 2',
- '[3] = ',
- 'second = \"!!!\"',
- 'first = 3'])
+ substrs=['size=4',
+ '[0] = ',
+ 'second = \"goofy\"',
+ 'first = 85',
+ '[1] = ',
+ 'second = \"is\"',
+ 'first = 1',
+ '[2] = ',
+ 'second = \"smart\"',
+ 'first = 2',
+ '[3] = ',
+ 'second = \"!!!\"',
+ 'first = 3'])
# check that MightHaveChildren() gets it right
- self.assertTrue(self.frame().FindVariable("is").MightHaveChildren(), "is.MightHaveChildren() says False for non empty!")
+ self.assertTrue(
+ self.frame().FindVariable("is").MightHaveChildren(),
+ "is.MightHaveChildren() says False for non empty!")
# check access-by-index
self.expect("frame variable is[0]",
- substrs = ['first = ',
- 'second =']);
-
+ substrs=['first = ',
+ 'second ='])
+
# check that the expression parser does not make use of
# synthetic children instead of running code
# TOT clang has a fix for this, which makes the expression command here succeed
# since this would make the test fail or succeed depending on clang version in use
# this is safer commented for the time being
- #self.expect("expression is[0]", matching=False, error=True,
+ # self.expect("expression is[0]", matching=False, error=True,
# substrs = ['first = ', 'goofy'])
lldbutil.continue_to_breakpoint(self.process(), bkpt)
-
+
self.expect('frame variable is',
- substrs = ['size=0',
- '{}'])
+ substrs=['size=0',
+ '{}'])
lldbutil.continue_to_breakpoint(self.process(), bkpt)
-
+
self.expect('frame variable ss',
- substrs = ['size=0',
- '{}'])
+ substrs=['size=0',
+ '{}'])
lldbutil.continue_to_breakpoint(self.process(), bkpt)
self.expect("frame variable ss",
- substrs = ['size=3',
- '[0] = ',
- 'second = \"hello\"',
- 'first = \"ciao\"',
- '[1] = ',
- 'second = \"house\"',
- 'first = \"casa\"',
- '[2] = ',
- 'second = \"cat\"',
- 'first = \"gatto\"'])
-
+ substrs=['size=3',
+ '[0] = ',
+ 'second = \"hello\"',
+ 'first = \"ciao\"',
+ '[1] = ',
+ 'second = \"house\"',
+ 'first = \"casa\"',
+ '[2] = ',
+ 'second = \"cat\"',
+ 'first = \"gatto\"'])
+
self.expect("p ss",
- substrs = ['size=3',
- '[0] = ',
- 'second = \"hello\"',
- 'first = \"ciao\"',
- '[1] = ',
- 'second = \"house\"',
- 'first = \"casa\"',
- '[2] = ',
- 'second = \"cat\"',
- 'first = \"gatto\"'])
+ substrs=['size=3',
+ '[0] = ',
+ 'second = \"hello\"',
+ 'first = \"ciao\"',
+ '[1] = ',
+ 'second = \"house\"',
+ 'first = \"casa\"',
+ '[2] = ',
+ 'second = \"cat\"',
+ 'first = \"gatto\"'])
# check that MightHaveChildren() gets it right
- self.assertTrue(self.frame().FindVariable("ss").MightHaveChildren(), "ss.MightHaveChildren() says False for non empty!")
+ self.assertTrue(
+ self.frame().FindVariable("ss").MightHaveChildren(),
+ "ss.MightHaveChildren() says False for non empty!")
# check access-by-index
self.expect("frame variable ss[2]",
- substrs = ['gatto', 'cat']);
-
+ substrs=['gatto', 'cat'])
+
# check that the expression parser does not make use of
# synthetic children instead of running code
# TOT clang has a fix for this, which makes the expression command here succeed
# since this would make the test fail or succeed depending on clang version in use
# this is safer commented for the time being
- #self.expect("expression ss[3]", matching=False, error=True,
+ # self.expect("expression ss[3]", matching=False, error=True,
# substrs = ['gatto'])
lldbutil.continue_to_breakpoint(self.process(), bkpt)
-
+
self.expect('frame variable ss',
- substrs = ['size=0',
- '{}'])
+ substrs=['size=0',
+ '{}'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/TestDataFormatterLibcxxMultiSet.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/TestDataFormatterLibcxxMultiSet.py
index cfdfd07ddec1..d40bce83e0af 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/TestDataFormatterLibcxxMultiSet.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/TestDataFormatterLibcxxMultiSet.py
@@ -5,34 +5,38 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class LibcxxMultiSetDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipIf(compiler="gcc")
- @skipIfWindows # libc++ not ported to Windows yet
+ @skipIfWindows # libc++ not ported to Windows yet
def test_with_run_command(self):
"""Test that that file and class static variables display correctly."""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
-
- bkpt = self.target().FindBreakpointByID(lldbutil.run_break_set_by_source_regexp (self, "Set break point at this line."))
+
+ bkpt = self.target().FindBreakpointByID(
+ lldbutil.run_break_set_by_source_regexp(
+ self, "Set break point at this line."))
self.runCmd("run", RUN_SUCCEEDED)
- lldbutil.skip_if_library_missing(self, self.target(), lldbutil.PrintableRegex("libc\+\+"))
+ lldbutil.skip_if_library_missing(
+ self, self.target(), lldbutil.PrintableRegex("libc\+\+"))
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -41,30 +45,78 @@ class LibcxxMultiSetDataFormatterTestCase(TestBase):
self.runCmd('type summary clear', check=False)
self.runCmd('type filter clear', check=False)
self.runCmd('type synth clear', check=False)
- self.runCmd("settings set target.max-children-count 256", check=False)
+ self.runCmd(
+ "settings set target.max-children-count 256",
+ check=False)
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
- self.expect('image list', substrs = self.getLibcPlusPlusLibs())
+ self.expect('image list', substrs=self.getLibcPlusPlusLibs())
- self.expect("frame variable ii",substrs = ["size=0","{}"])
+ self.expect("frame variable ii", substrs=["size=0", "{}"])
lldbutil.continue_to_breakpoint(self.process(), bkpt)
- self.expect("frame variable ii",substrs = ["size=6","[0] = 0","[1] = 1", "[2] = 2", "[3] = 3", "[4] = 4", "[5] = 5"])
+ self.expect(
+ "frame variable ii",
+ substrs=[
+ "size=6",
+ "[0] = 0",
+ "[1] = 1",
+ "[2] = 2",
+ "[3] = 3",
+ "[4] = 4",
+ "[5] = 5"])
lldbutil.continue_to_breakpoint(self.process(), bkpt)
- self.expect("frame variable ii",substrs = ["size=7","[2] = 2", "[3] = 3", "[6] = 6"])
- self.expect("p ii",substrs = ["size=7","[2] = 2", "[3] = 3", "[6] = 6"])
- self.expect("frame variable ii[2]",substrs = [" = 2"])
+ self.expect(
+ "frame variable ii",
+ substrs=[
+ "size=7",
+ "[2] = 2",
+ "[3] = 3",
+ "[6] = 6"])
+ self.expect(
+ "p ii",
+ substrs=[
+ "size=7",
+ "[2] = 2",
+ "[3] = 3",
+ "[6] = 6"])
+ self.expect("frame variable ii[2]", substrs=[" = 2"])
lldbutil.continue_to_breakpoint(self.process(), bkpt)
- self.expect("frame variable ii",substrs = ["size=0","{}"])
+ self.expect("frame variable ii", substrs=["size=0", "{}"])
lldbutil.continue_to_breakpoint(self.process(), bkpt)
- self.expect("frame variable ii",substrs = ["size=0","{}"])
- self.expect("frame variable ss",substrs = ["size=0","{}"])
+ self.expect("frame variable ii", substrs=["size=0", "{}"])
+ self.expect("frame variable ss", substrs=["size=0", "{}"])
lldbutil.continue_to_breakpoint(self.process(), bkpt)
- self.expect("frame variable ss",substrs = ["size=2",'[0] = "a"','[1] = "a very long string is right here"'])
+ self.expect(
+ "frame variable ss",
+ substrs=[
+ "size=2",
+ '[0] = "a"',
+ '[1] = "a very long string is right here"'])
lldbutil.continue_to_breakpoint(self.process(), bkpt)
- self.expect("frame variable ss",substrs = ["size=4",'[2] = "b"','[3] = "c"','[0] = "a"','[1] = "a very long string is right here"'])
- self.expect("p ss",substrs = ["size=4",'[2] = "b"','[3] = "c"','[0] = "a"','[1] = "a very long string is right here"'])
- self.expect("frame variable ss[2]",substrs = [' = "b"'])
+ self.expect(
+ "frame variable ss",
+ substrs=[
+ "size=4",
+ '[2] = "b"',
+ '[3] = "c"',
+ '[0] = "a"',
+ '[1] = "a very long string is right here"'])
+ self.expect(
+ "p ss",
+ substrs=[
+ "size=4",
+ '[2] = "b"',
+ '[3] = "c"',
+ '[0] = "a"',
+ '[1] = "a very long string is right here"'])
+ self.expect("frame variable ss[2]", substrs=[' = "b"'])
lldbutil.continue_to_breakpoint(self.process(), bkpt)
- self.expect("frame variable ss",substrs = ["size=3",'[0] = "a"','[1] = "a very long string is right here"','[2] = "c"'])
+ self.expect(
+ "frame variable ss",
+ substrs=[
+ "size=3",
+ '[0] = "a"',
+ '[1] = "a very long string is right here"',
+ '[2] = "c"'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/set/TestDataFormatterLibcxxSet.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/set/TestDataFormatterLibcxxSet.py
index 00c1e548cf6b..be1547ea5d8f 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/set/TestDataFormatterLibcxxSet.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/set/TestDataFormatterLibcxxSet.py
@@ -5,24 +5,25 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class LibcxxSetDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipIf(compiler="gcc")
- @skipIfWindows # libc++ not ported to Windows yet
+ @skipIfWindows # libc++ not ported to Windows yet
def test_with_run_command(self):
"""Test that that file and class static variables display correctly."""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
-
+
# bkpt = self.target().FindBreakpointByID(lldbutil.run_break_set_by_source_regexp (self, "Set break point at this line."))
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py
index 76eedb8c8919..b0e84121dded 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py
@@ -1,4 +1,4 @@
-#coding=utf8
+# coding=utf8
"""
Test lldb data formatter subsystem.
"""
@@ -6,13 +6,14 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class LibcxxStringDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -24,22 +25,24 @@ class LibcxxStringDataFormatterTestCase(TestBase):
self.line = line_number('main.cpp', '// Set break point at this line.')
@skipIf(compiler="gcc")
- @skipIfWindows # libc++ not ported to Windows yet
+ @skipIfWindows # libc++ not ported to Windows yet
def test_with_run_command(self):
"""Test that that file and class static variables display correctly."""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=-1)
self.runCmd("run", RUN_SUCCEEDED)
- lldbutil.skip_if_library_missing(self, self.target(), lldbutil.PrintableRegex("libc\+\+"))
+ lldbutil.skip_if_library_missing(
+ self, self.target(), lldbutil.PrintableRegex("libc\+\+"))
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -48,40 +51,51 @@ class LibcxxStringDataFormatterTestCase(TestBase):
self.runCmd('type summary clear', check=False)
self.runCmd('type filter clear', check=False)
self.runCmd('type synth clear', check=False)
- self.runCmd("settings set target.max-children-count 256", check=False)
+ self.runCmd(
+ "settings set target.max-children-count 256",
+ check=False)
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
- self.expect("frame variable",
- substrs = ['(std::__1::wstring) s = L"hello world! מזל טוב!"',
- '(std::__1::wstring) S = L"!!!!"',
- '(const wchar_t *) mazeltov = 0x','L"מזל טוב"',
- '(std::__1::string) q = "hello world"',
- '(std::__1::string) Q = "quite a long std::strin with lots of info inside it"',
- '(std::__1::string) IHaveEmbeddedZeros = "a\\0b\\0c\\0d"',
- '(std::__1::wstring) IHaveEmbeddedZerosToo = L"hello world!\\0てざ ル゜䋨ミ㠧槊 きゅへ狦穤襩 じゃ馩リョ 䤦監"'])
+ self.expect(
+ "frame variable",
+ substrs=[
+ '(std::__1::wstring) s = L"hello world! מזל טוב!"',
+ '(std::__1::wstring) S = L"!!!!"',
+ '(const wchar_t *) mazeltov = 0x',
+ 'L"מזל טוב"',
+ '(std::__1::string) q = "hello world"',
+ '(std::__1::string) Q = "quite a long std::strin with lots of info inside it"',
+ '(std::__1::string) IHaveEmbeddedZeros = "a\\0b\\0c\\0d"',
+ '(std::__1::wstring) IHaveEmbeddedZerosToo = L"hello world!\\0てざ ル゜䋨ミ㠧槊 きゅへ狦穤襩 じゃ馩リョ 䤦監"'])
self.runCmd("n")
- TheVeryLongOne = self.frame().FindVariable("TheVeryLongOne");
+ TheVeryLongOne = self.frame().FindVariable("TheVeryLongOne")
summaryOptions = lldb.SBTypeSummaryOptions()
summaryOptions.SetCapping(lldb.eTypeSummaryUncapped)
uncappedSummaryStream = lldb.SBStream()
- TheVeryLongOne.GetSummary(uncappedSummaryStream,summaryOptions)
+ TheVeryLongOne.GetSummary(uncappedSummaryStream, summaryOptions)
uncappedSummary = uncappedSummaryStream.GetData()
- self.assertTrue(uncappedSummary.find("someText") > 0, "uncappedSummary does not include the full string")
+ self.assertTrue(uncappedSummary.find("someText") > 0,
+ "uncappedSummary does not include the full string")
summaryOptions.SetCapping(lldb.eTypeSummaryCapped)
cappedSummaryStream = lldb.SBStream()
- TheVeryLongOne.GetSummary(cappedSummaryStream,summaryOptions)
+ TheVeryLongOne.GetSummary(cappedSummaryStream, summaryOptions)
cappedSummary = cappedSummaryStream.GetData()
- self.assertTrue(cappedSummary.find("someText") <= 0, "cappedSummary includes the full string")
-
- self.expect("frame variable",
- substrs = ['(std::__1::wstring) s = L"hello world! מזל טוב!"',
- '(std::__1::wstring) S = L"!!!!!"',
- '(const wchar_t *) mazeltov = 0x','L"מזל טוב"',
- '(std::__1::string) q = "hello world"',
- '(std::__1::string) Q = "quite a long std::strin with lots of info inside it"',
- '(std::__1::string) IHaveEmbeddedZeros = "a\\0b\\0c\\0d"',
- '(std::__1::wstring) IHaveEmbeddedZerosToo = L"hello world!\\0てざ ル゜䋨ミ㠧槊 きゅへ狦穤襩 じゃ馩リョ 䤦監"'])
+ self.assertTrue(
+ cappedSummary.find("someText") <= 0,
+ "cappedSummary includes the full string")
+
+ self.expect(
+ "frame variable",
+ substrs=[
+ '(std::__1::wstring) s = L"hello world! מזל טוב!"',
+ '(std::__1::wstring) S = L"!!!!!"',
+ '(const wchar_t *) mazeltov = 0x',
+ 'L"מזל טוב"',
+ '(std::__1::string) q = "hello world"',
+ '(std::__1::string) Q = "quite a long std::strin with lots of info inside it"',
+ '(std::__1::string) IHaveEmbeddedZeros = "a\\0b\\0c\\0d"',
+ '(std::__1::wstring) IHaveEmbeddedZerosToo = L"hello world!\\0てざ ル゜䋨ミ㠧槊 きゅへ狦穤襩 じゃ馩リョ 䤦監"'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/TestDataFormatterUnordered.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/TestDataFormatterUnordered.py
index 4765cd70f67c..8a08d38975cf 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/TestDataFormatterUnordered.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/TestDataFormatterUnordered.py
@@ -5,34 +5,37 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class LibcxxUnorderedDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @skipIfWindows # libc++ not ported to Windows yet
+ @skipIfWindows # libc++ not ported to Windows yet
@skipIf(compiler="gcc")
def test_with_run_command(self):
"""Test that that file and class static variables display correctly."""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_source_regexp (self, "Set break point at this line.")
+ lldbutil.run_break_set_by_source_regexp(
+ self, "Set break point at this line.")
self.runCmd("run", RUN_SUCCEEDED)
- lldbutil.skip_if_library_missing(self, self.target(), lldbutil.PrintableRegex("libc\+\+"))
+ lldbutil.skip_if_library_missing(
+ self, self.target(), lldbutil.PrintableRegex("libc\+\+"))
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -41,12 +44,14 @@ class LibcxxUnorderedDataFormatterTestCase(TestBase):
self.runCmd('type summary clear', check=False)
self.runCmd('type filter clear', check=False)
self.runCmd('type synth clear', check=False)
- self.runCmd("settings set target.max-children-count 256", check=False)
+ self.runCmd(
+ "settings set target.max-children-count 256",
+ check=False)
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
- self.expect('image list', substrs = self.getLibcPlusPlusLibs())
+ self.expect('image list', substrs=self.getLibcPlusPlusLibs())
self.look_for_content_and_continue(
"map", ['size=5 {', 'hello', 'world', 'this', 'is', 'me'])
@@ -72,6 +77,6 @@ class LibcxxUnorderedDataFormatterTestCase(TestBase):
'(\[\d\] = "world"(\\n|.)+){2}'])
def look_for_content_and_continue(self, var_name, patterns):
- self.expect( ("frame variable %s" % var_name), patterns=patterns)
- self.expect( ("frame variable %s" % var_name), patterns=patterns)
+ self.expect(("frame variable %s" % var_name), patterns=patterns)
+ self.expect(("frame variable %s" % var_name), patterns=patterns)
self.runCmd("continue")
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/TestDataFormatterLibcxxVBool.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/TestDataFormatterLibcxxVBool.py
index fe3b6c115e31..43d5ad4f1033 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/TestDataFormatterLibcxxVBool.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/TestDataFormatterLibcxxVBool.py
@@ -5,13 +5,14 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class LibcxxVBoolDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -23,22 +24,24 @@ class LibcxxVBoolDataFormatterTestCase(TestBase):
self.line = line_number('main.cpp', '// Set break point at this line.')
@skipIf(compiler="gcc")
- @skipIfWindows # libc++ not ported to Windows.
+ @skipIfWindows # libc++ not ported to Windows.
def test_with_run_command(self):
"""Test that that file and class static variables display correctly."""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.skip_if_library_missing(self, self.target(), lldbutil.PrintableRegex("libc\+\+"))
+ lldbutil.skip_if_library_missing(
+ self, self.target(), lldbutil.PrintableRegex("libc\+\+"))
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=-1)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -47,13 +50,33 @@ class LibcxxVBoolDataFormatterTestCase(TestBase):
self.runCmd('type summary clear', check=False)
self.runCmd('type filter clear', check=False)
self.runCmd('type synth clear', check=False)
- self.runCmd("settings set target.max-children-count 256", check=False)
+ self.runCmd(
+ "settings set target.max-children-count 256",
+ check=False)
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
- self.expect("frame variable vBool",
- substrs = ['size=49','[0] = false','[1] = true','[18] = false','[27] = true','[36] = false','[47] = true','[48] = true'])
-
- self.expect("expr vBool",
- substrs = ['size=49','[0] = false','[1] = true','[18] = false','[27] = true','[36] = false','[47] = true','[48] = true'])
+ self.expect(
+ "frame variable vBool",
+ substrs=[
+ 'size=49',
+ '[0] = false',
+ '[1] = true',
+ '[18] = false',
+ '[27] = true',
+ '[36] = false',
+ '[47] = true',
+ '[48] = true'])
+
+ self.expect(
+ "expr vBool",
+ substrs=[
+ 'size=49',
+ '[0] = false',
+ '[1] = true',
+ '[18] = false',
+ '[27] = true',
+ '[36] = false',
+ '[47] = true',
+ '[48] = true'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py
index 9a145fba73e8..719ed7300505 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py
@@ -5,34 +5,38 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class LibcxxVectorDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipIf(compiler="gcc")
- @skipIfWindows # libc++ not ported to Windows yet
+ @skipIfWindows # libc++ not ported to Windows yet
def test_with_run_command(self):
"""Test that that file and class static variables display correctly."""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
-
- lldbutil.skip_if_library_missing(self, self.target(), lldbutil.PrintableRegex("libc\+\+"))
- bkpt = self.target().FindBreakpointByID(lldbutil.run_break_set_by_source_regexp (self, "break here"))
+ lldbutil.skip_if_library_missing(
+ self, self.target(), lldbutil.PrintableRegex("libc\+\+"))
+
+ bkpt = self.target().FindBreakpointByID(
+ lldbutil.run_break_set_by_source_regexp(
+ self, "break here"))
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -41,51 +45,54 @@ class LibcxxVectorDataFormatterTestCase(TestBase):
self.runCmd('type summary clear', check=False)
self.runCmd('type filter clear', check=False)
self.runCmd('type synth clear', check=False)
- self.runCmd("settings set target.max-children-count 256", check=False)
+ self.runCmd(
+ "settings set target.max-children-count 256",
+ check=False)
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
# empty vectors (and storage pointers SHOULD BOTH BE NULL..)
self.expect("frame variable numbers",
- substrs = ['numbers = size=0'])
+ substrs=['numbers = size=0'])
lldbutil.continue_to_breakpoint(self.process(), bkpt)
-
+
# first value added
self.expect("frame variable numbers",
- substrs = ['numbers = size=1',
- '[0] = 1',
- '}'])
+ substrs=['numbers = size=1',
+ '[0] = 1',
+ '}'])
# add some more data
lldbutil.continue_to_breakpoint(self.process(), bkpt)
-
+
self.expect("frame variable numbers",
- substrs = ['numbers = size=4',
- '[0] = 1',
- '[1] = 12',
- '[2] = 123',
- '[3] = 1234',
- '}'])
+ substrs=['numbers = size=4',
+ '[0] = 1',
+ '[1] = 12',
+ '[2] = 123',
+ '[3] = 1234',
+ '}'])
self.expect("p numbers",
- substrs = ['$', 'size=4',
- '[0] = 1',
- '[1] = 12',
- '[2] = 123',
- '[3] = 1234',
- '}'])
-
-
+ substrs=['$', 'size=4',
+ '[0] = 1',
+ '[1] = 12',
+ '[2] = 123',
+ '[3] = 1234',
+ '}'])
+
# check access to synthetic children
- self.runCmd("type summary add --summary-string \"item 0 is ${var[0]}\" std::int_vect int_vect")
+ self.runCmd(
+ "type summary add --summary-string \"item 0 is ${var[0]}\" std::int_vect int_vect")
self.expect('frame variable numbers',
- substrs = ['item 0 is 1']);
-
- self.runCmd("type summary add --summary-string \"item 0 is ${svar[0]}\" std::int_vect int_vect")
+ substrs=['item 0 is 1'])
+
+ self.runCmd(
+ "type summary add --summary-string \"item 0 is ${svar[0]}\" std::int_vect int_vect")
self.expect('frame variable numbers',
- substrs = ['item 0 is 1']);
+ substrs=['item 0 is 1'])
# move on with synths
self.runCmd("type summary delete std::int_vect")
self.runCmd("type summary delete int_vect")
@@ -94,88 +101,89 @@ class LibcxxVectorDataFormatterTestCase(TestBase):
lldbutil.continue_to_breakpoint(self.process(), bkpt)
self.expect("frame variable numbers",
- substrs = ['numbers = size=7',
- '[0] = 1',
- '[1] = 12',
- '[2] = 123',
- '[3] = 1234',
- '[4] = 12345',
- '[5] = 123456',
- '[6] = 1234567',
- '}'])
-
+ substrs=['numbers = size=7',
+ '[0] = 1',
+ '[1] = 12',
+ '[2] = 123',
+ '[3] = 1234',
+ '[4] = 12345',
+ '[5] = 123456',
+ '[6] = 1234567',
+ '}'])
+
self.expect("p numbers",
- substrs = ['$', 'size=7',
- '[0] = 1',
- '[1] = 12',
- '[2] = 123',
- '[3] = 1234',
- '[4] = 12345',
- '[5] = 123456',
- '[6] = 1234567',
- '}'])
+ substrs=['$', 'size=7',
+ '[0] = 1',
+ '[1] = 12',
+ '[2] = 123',
+ '[3] = 1234',
+ '[4] = 12345',
+ '[5] = 123456',
+ '[6] = 1234567',
+ '}'])
# check access-by-index
self.expect("frame variable numbers[0]",
- substrs = ['1']);
+ substrs=['1'])
self.expect("frame variable numbers[1]",
- substrs = ['12']);
+ substrs=['12'])
self.expect("frame variable numbers[2]",
- substrs = ['123']);
+ substrs=['123'])
self.expect("frame variable numbers[3]",
- substrs = ['1234']);
+ substrs=['1234'])
# clear out the vector and see that we do the right thing once again
lldbutil.continue_to_breakpoint(self.process(), bkpt)
self.expect("frame variable numbers",
- substrs = ['numbers = size=0'])
+ substrs=['numbers = size=0'])
lldbutil.continue_to_breakpoint(self.process(), bkpt)
# first value added
self.expect("frame variable numbers",
- substrs = ['numbers = size=1',
- '[0] = 7',
- '}'])
+ substrs=['numbers = size=1',
+ '[0] = 7',
+ '}'])
# check if we can display strings
self.expect("frame variable strings",
- substrs = ['goofy',
- 'is',
- 'smart'])
+ substrs=['goofy',
+ 'is',
+ 'smart'])
self.expect("p strings",
- substrs = ['goofy',
- 'is',
- 'smart'])
+ substrs=['goofy',
+ 'is',
+ 'smart'])
# test summaries based on synthetic children
- self.runCmd("type summary add std::string_vect string_vect --summary-string \"vector has ${svar%#} items\" -e")
+ self.runCmd(
+ "type summary add std::string_vect string_vect --summary-string \"vector has ${svar%#} items\" -e")
self.expect("frame variable strings",
- substrs = ['vector has 3 items',
- 'goofy',
- 'is',
- 'smart'])
+ substrs=['vector has 3 items',
+ 'goofy',
+ 'is',
+ 'smart'])
self.expect("p strings",
- substrs = ['vector has 3 items',
- 'goofy',
- 'is',
- 'smart'])
+ substrs=['vector has 3 items',
+ 'goofy',
+ 'is',
+ 'smart'])
lldbutil.continue_to_breakpoint(self.process(), bkpt)
self.expect("frame variable strings",
- substrs = ['vector has 4 items'])
-
+ substrs=['vector has 4 items'])
+
# check access-by-index
self.expect("frame variable strings[0]",
- substrs = ['goofy']);
+ substrs=['goofy'])
self.expect("frame variable strings[1]",
- substrs = ['is']);
+ substrs=['is'])
lldbutil.continue_to_breakpoint(self.process(), bkpt)
self.expect("frame variable strings",
- substrs = ['vector has 0 items'])
+ substrs=['vector has 0 items'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/TestDataFormatterStdIterator.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/TestDataFormatterStdIterator.py
index dbaa37daa2d1..ce5087dbc288 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/TestDataFormatterStdIterator.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/TestDataFormatterStdIterator.py
@@ -5,13 +5,14 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class StdIteratorDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -22,21 +23,21 @@ class StdIteratorDataFormatterTestCase(TestBase):
# Find the line number to break at.
self.line = line_number('main.cpp', '// Set break point at this line.')
- @skipIfWindows # libstdcpp not ported to Windows
- @expectedFailureAll(compiler="icc", bugnumber="llvm.org/pr15301 LLDB prints incorrect sizes of STL containers")
+ @skipIfWindows # libstdcpp not ported to Windows
def test_with_run_command(self):
"""Test that libstdcpp iterators format properly."""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=-1)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -45,19 +46,29 @@ class StdIteratorDataFormatterTestCase(TestBase):
self.runCmd('type summary clear', check=False)
self.runCmd('type filter clear', check=False)
self.runCmd('type synth clear', check=False)
- self.runCmd("settings set target.max-children-count 256", check=False)
+ self.runCmd(
+ "settings set target.max-children-count 256",
+ check=False)
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
- self.expect('frame variable ivI', substrs = ['item = 3'])
- self.expect('expr ivI', substrs = ['item = 3'])
-
- self.expect('frame variable iimI', substrs = ['first = 0','second = 12'])
- self.expect('expr iimI', substrs = ['first = 0','second = 12'])
-
- self.expect('frame variable simI', substrs = ['first = "world"','second = 42'])
- self.expect('expr simI', substrs = ['first = "world"','second = 42'])
-
- self.expect('frame variable svI', substrs = ['item = "hello"'])
- self.expect('expr svI', substrs = ['item = "hello"'])
+ self.expect('frame variable ivI', substrs=['item = 3'])
+ self.expect('expr ivI', substrs=['item = 3'])
+
+ self.expect(
+ 'frame variable iimI',
+ substrs=[
+ 'first = 0',
+ 'second = 12'])
+ self.expect('expr iimI', substrs=['first = 0', 'second = 12'])
+
+ self.expect(
+ 'frame variable simI',
+ substrs=[
+ 'first = "world"',
+ 'second = 42'])
+ self.expect('expr simI', substrs=['first = "world"', 'second = 42'])
+
+ self.expect('frame variable svI', substrs=['item = "hello"'])
+ self.expect('expr svI', substrs=['item = "hello"'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py
index 55658af1f2a3..a7f8c4b1e174 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py
@@ -5,13 +5,14 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class StdListDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -21,23 +22,26 @@ class StdListDataFormatterTestCase(TestBase):
TestBase.setUp(self)
# Find the line numbers to break at for the different tests.
self.line = line_number('main.cpp', '// Set break point at this line.')
- self.optional_line = line_number('main.cpp', '// Optional break point at this line.')
- self.final_line = line_number('main.cpp', '// Set final break point at this line.')
+ self.optional_line = line_number(
+ 'main.cpp', '// Optional break point at this line.')
+ self.final_line = line_number(
+ 'main.cpp', '// Set final break point at this line.')
- @skipIfWindows # libstdcpp not ported to Windows
+ @skipIfWindows # libstdcpp not ported to Windows
def test_with_run_command(self):
"""Test that that file and class static variables display correctly."""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=-1)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -46,7 +50,9 @@ class StdListDataFormatterTestCase(TestBase):
self.runCmd('type summary clear', check=False)
self.runCmd('type filter clear', check=False)
self.runCmd('type synth clear', check=False)
- self.runCmd("settings set target.max-children-count 256", check=False)
+ self.runCmd(
+ "settings set target.max-children-count 256",
+ check=False)
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
@@ -56,134 +62,148 @@ class StdListDataFormatterTestCase(TestBase):
self.runCmd("type format add -f hex int")
self.expect("frame variable numbers_list --raw", matching=False,
- substrs = ['size=0',
- '{}'])
- self.expect("frame variable &numbers_list._M_impl._M_node --raw", matching=False,
- substrs = ['size=0',
- '{}'])
+ substrs=['size=0',
+ '{}'])
+ self.expect(
+ "frame variable &numbers_list._M_impl._M_node --raw",
+ matching=False,
+ substrs=[
+ 'size=0',
+ '{}'])
self.expect("frame variable numbers_list",
- substrs = ['size=0',
- '{}'])
+ substrs=['size=0',
+ '{}'])
self.expect("p numbers_list",
- substrs = ['size=0',
- '{}'])
+ substrs=['size=0',
+ '{}'])
self.runCmd("n")
self.expect("frame variable numbers_list",
- substrs = ['size=1',
- '[0] = ',
- '0x12345678'])
+ substrs=['size=1',
+ '[0] = ',
+ '0x12345678'])
- self.runCmd("n");self.runCmd("n");self.runCmd("n");
+ self.runCmd("n")
+ self.runCmd("n")
+ self.runCmd("n")
self.expect("frame variable numbers_list",
- substrs = ['size=4',
- '[0] = ',
- '0x12345678',
- '[1] =',
- '0x11223344',
- '[2] =',
- '0xbeeffeed',
- '[3] =',
- '0x00abba00'])
-
- self.runCmd("n");self.runCmd("n");
+ substrs=['size=4',
+ '[0] = ',
+ '0x12345678',
+ '[1] =',
+ '0x11223344',
+ '[2] =',
+ '0xbeeffeed',
+ '[3] =',
+ '0x00abba00'])
+
+ self.runCmd("n")
+ self.runCmd("n")
self.expect("frame variable numbers_list",
- substrs = ['size=6',
- '[0] = ',
- '0x12345678',
- '0x11223344',
- '0xbeeffeed',
- '0x00abba00',
- '[4] =',
- '0x0abcdef0',
- '[5] =',
- '0x0cab0cab'])
+ substrs=['size=6',
+ '[0] = ',
+ '0x12345678',
+ '0x11223344',
+ '0xbeeffeed',
+ '0x00abba00',
+ '[4] =',
+ '0x0abcdef0',
+ '[5] =',
+ '0x0cab0cab'])
self.expect("p numbers_list",
- substrs = ['size=6',
- '[0] = ',
- '0x12345678',
- '0x11223344',
- '0xbeeffeed',
- '0x00abba00',
- '[4] =',
- '0x0abcdef0',
- '[5] =',
- '0x0cab0cab'])
+ substrs=['size=6',
+ '[0] = ',
+ '0x12345678',
+ '0x11223344',
+ '0xbeeffeed',
+ '0x00abba00',
+ '[4] =',
+ '0x0abcdef0',
+ '[5] =',
+ '0x0cab0cab'])
# check access-by-index
self.expect("frame variable numbers_list[0]",
- substrs = ['0x12345678']);
+ substrs=['0x12345678'])
self.expect("frame variable numbers_list[1]",
- substrs = ['0x11223344']);
-
+ substrs=['0x11223344'])
+
# but check that expression does not rely on us
self.expect("expression numbers_list[0]", matching=False, error=True,
- substrs = ['0x12345678'])
+ substrs=['0x12345678'])
# check that MightHaveChildren() gets it right
- self.assertTrue(self.frame().FindVariable("numbers_list").MightHaveChildren(), "numbers_list.MightHaveChildren() says False for non empty!")
+ self.assertTrue(
+ self.frame().FindVariable("numbers_list").MightHaveChildren(),
+ "numbers_list.MightHaveChildren() says False for non empty!")
self.runCmd("n")
-
+
self.expect("frame variable numbers_list",
- substrs = ['size=0',
- '{}'])
+ substrs=['size=0',
+ '{}'])
+
+ self.runCmd("n")
+ self.runCmd("n")
+ self.runCmd("n")
+ self.runCmd("n")
- self.runCmd("n");self.runCmd("n");self.runCmd("n");self.runCmd("n");
-
self.expect("frame variable numbers_list",
- substrs = ['size=4',
- '[0] = ', '1',
- '[1] = ', '2',
- '[2] = ', '3',
- '[3] = ', '4'])
+ substrs=['size=4',
+ '[0] = ', '1',
+ '[1] = ', '2',
+ '[2] = ', '3',
+ '[3] = ', '4'])
self.runCmd("type format delete int")
self.runCmd("n")
-
+
self.expect("frame variable text_list",
- substrs = ['size=0',
- '{}'])
-
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.final_line, num_expected_locations=-1)
+ substrs=['size=0',
+ '{}'])
+
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.final_line, num_expected_locations=-1)
self.runCmd("c", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
self.expect("frame variable text_list",
- substrs = ['size=4',
- '[0]', 'goofy',
- '[1]', 'is',
- '[2]', 'smart',
- '[3]', '!!!'])
+ substrs=['size=4',
+ '[0]', 'goofy',
+ '[1]', 'is',
+ '[2]', 'smart',
+ '[3]', '!!!'])
self.expect("p text_list",
- substrs = ['size=4',
- '\"goofy\"',
- '\"is\"',
- '\"smart\"',
- '\"!!!\"'])
-
+ substrs=['size=4',
+ '\"goofy\"',
+ '\"is\"',
+ '\"smart\"',
+ '\"!!!\"'])
+
# check access-by-index
self.expect("frame variable text_list[0]",
- substrs = ['goofy']);
+ substrs=['goofy'])
self.expect("frame variable text_list[3]",
- substrs = ['!!!']);
-
+ substrs=['!!!'])
+
# but check that expression does not rely on us
self.expect("expression text_list[0]", matching=False, error=True,
- substrs = ['goofy'])
+ substrs=['goofy'])
# check that MightHaveChildren() gets it right
- self.assertTrue(self.frame().FindVariable("text_list").MightHaveChildren(), "text_list.MightHaveChildren() says False for non empty!")
+ self.assertTrue(
+ self.frame().FindVariable("text_list").MightHaveChildren(),
+ "text_list.MightHaveChildren() says False for non empty!")
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py
index ff99255aec0c..cdaec8392fe0 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py
@@ -5,13 +5,14 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class StdMapDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -22,22 +23,22 @@ class StdMapDataFormatterTestCase(TestBase):
# Find the line number to break at.
self.line = line_number('main.cpp', '// Set break point at this line.')
- @expectedFailureAll(compiler="icc", bugnumber="llvm.org/pr15301 LLDB prints incorrect sizes of STL containers")
- @skipIfWindows # libstdcpp not ported to Windows
+ @skipIfWindows # libstdcpp not ported to Windows
@skipIfFreeBSD
def test_with_run_command(self):
"""Test that that file and class static variables display correctly."""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_source_regexp (self, "Set break point at this line.")
+ lldbutil.run_break_set_by_source_regexp(
+ self, "Set break point at this line.")
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -46,278 +47,289 @@ class StdMapDataFormatterTestCase(TestBase):
self.runCmd('type summary clear', check=False)
self.runCmd('type filter clear', check=False)
self.runCmd('type synth clear', check=False)
- self.runCmd("settings set target.max-children-count 256", check=False)
+ self.runCmd(
+ "settings set target.max-children-count 256",
+ check=False)
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
self.runCmd("frame variable ii --show-types")
-
- self.runCmd("type summary add -x \"std::map<\" --summary-string \"map has ${svar%#} items\" -e")
-
+
+ self.runCmd(
+ "type summary add -x \"std::map<\" --summary-string \"map has ${svar%#} items\" -e")
+
self.expect('frame variable ii',
- substrs = ['map has 0 items',
- '{}'])
+ substrs=['map has 0 items',
+ '{}'])
- self.runCmd("c");
+ self.runCmd("c")
self.expect('frame variable ii',
- substrs = ['map has 2 items',
- '[0] = ',
- 'first = 0',
- 'second = 0',
- '[1] = ',
- 'first = 1',
- 'second = 1'])
+ substrs=['map has 2 items',
+ '[0] = ',
+ 'first = 0',
+ 'second = 0',
+ '[1] = ',
+ 'first = 1',
+ 'second = 1'])
- self.runCmd("c");
+ self.runCmd("c")
self.expect('frame variable ii',
- substrs = ['map has 4 items',
- '[2] = ',
- 'first = 2',
- 'second = 0',
- '[3] = ',
- 'first = 3',
- 'second = 1'])
+ substrs=['map has 4 items',
+ '[2] = ',
+ 'first = 2',
+ 'second = 0',
+ '[3] = ',
+ 'first = 3',
+ 'second = 1'])
- self.runCmd("c");
+ self.runCmd("c")
self.expect("frame variable ii",
- substrs = ['map has 9 items',
- '[5] = ',
- 'first = 5',
- 'second = 0',
- '[7] = ',
- 'first = 7',
- 'second = 1'])
-
+ substrs=['map has 9 items',
+ '[5] = ',
+ 'first = 5',
+ 'second = 0',
+ '[7] = ',
+ 'first = 7',
+ 'second = 1'])
+
self.expect("p ii",
- substrs = ['map has 9 items',
- '[5] = ',
- 'first = 5',
- 'second = 0',
- '[7] = ',
- 'first = 7',
- 'second = 1'])
+ substrs=['map has 9 items',
+ '[5] = ',
+ 'first = 5',
+ 'second = 0',
+ '[7] = ',
+ 'first = 7',
+ 'second = 1'])
# check access-by-index
self.expect("frame variable ii[0]",
- substrs = ['first = 0',
- 'second = 0']);
+ substrs=['first = 0',
+ 'second = 0'])
self.expect("frame variable ii[3]",
- substrs = ['first =',
- 'second =']);
-
+ substrs=['first =',
+ 'second ='])
+
self.expect("frame variable ii[8]", matching=True,
- substrs = ['1234567'])
+ substrs=['1234567'])
# check that MightHaveChildren() gets it right
- self.assertTrue(self.frame().FindVariable("ii").MightHaveChildren(), "ii.MightHaveChildren() says False for non empty!")
+ self.assertTrue(
+ self.frame().FindVariable("ii").MightHaveChildren(),
+ "ii.MightHaveChildren() says False for non empty!")
# check that the expression parser does not make use of
# synthetic children instead of running code
# TOT clang has a fix for this, which makes the expression command here succeed
# since this would make the test fail or succeed depending on clang version in use
# this is safer commented for the time being
- #self.expect("expression ii[8]", matching=False, error=True,
+ # self.expect("expression ii[8]", matching=False, error=True,
# substrs = ['1234567'])
self.runCmd("c")
-
+
self.expect('frame variable ii',
- substrs = ['map has 0 items',
- '{}'])
-
+ substrs=['map has 0 items',
+ '{}'])
+
self.runCmd("frame variable si --show-types")
self.expect('frame variable si',
- substrs = ['map has 0 items',
- '{}'])
+ substrs=['map has 0 items',
+ '{}'])
self.runCmd("c")
self.expect('frame variable si',
- substrs = ['map has 1 items',
- '[0] = ',
- 'first = \"zero\"',
- 'second = 0'])
+ substrs=['map has 1 items',
+ '[0] = ',
+ 'first = \"zero\"',
+ 'second = 0'])
- self.runCmd("c");
+ self.runCmd("c")
self.expect("frame variable si",
- substrs = ['map has 5 items',
- '[0] = ',
- 'first = \"zero\"',
- 'second = 0',
- '[1] = ',
- 'first = \"one\"',
- 'second = 1',
- '[2] = ',
- 'first = \"two\"',
- 'second = 2',
- '[3] = ',
- 'first = \"three\"',
- 'second = 3',
- '[4] = ',
- 'first = \"four\"',
- 'second = 4'])
+ substrs=['map has 5 items',
+ '[0] = ',
+ 'first = \"zero\"',
+ 'second = 0',
+ '[1] = ',
+ 'first = \"one\"',
+ 'second = 1',
+ '[2] = ',
+ 'first = \"two\"',
+ 'second = 2',
+ '[3] = ',
+ 'first = \"three\"',
+ 'second = 3',
+ '[4] = ',
+ 'first = \"four\"',
+ 'second = 4'])
self.expect("p si",
- substrs = ['map has 5 items',
- '[0] = ',
- 'first = \"zero\"',
- 'second = 0',
- '[1] = ',
- 'first = \"one\"',
- 'second = 1',
- '[2] = ',
- 'first = \"two\"',
- 'second = 2',
- '[3] = ',
- 'first = \"three\"',
- 'second = 3',
- '[4] = ',
- 'first = \"four\"',
- 'second = 4'])
+ substrs=['map has 5 items',
+ '[0] = ',
+ 'first = \"zero\"',
+ 'second = 0',
+ '[1] = ',
+ 'first = \"one\"',
+ 'second = 1',
+ '[2] = ',
+ 'first = \"two\"',
+ 'second = 2',
+ '[3] = ',
+ 'first = \"three\"',
+ 'second = 3',
+ '[4] = ',
+ 'first = \"four\"',
+ 'second = 4'])
# check access-by-index
self.expect("frame variable si[0]",
- substrs = ['first = ', 'four',
- 'second = 4']);
+ substrs=['first = ', 'four',
+ 'second = 4'])
# check that MightHaveChildren() gets it right
- self.assertTrue(self.frame().FindVariable("si").MightHaveChildren(), "si.MightHaveChildren() says False for non empty!")
+ self.assertTrue(
+ self.frame().FindVariable("si").MightHaveChildren(),
+ "si.MightHaveChildren() says False for non empty!")
# check that the expression parser does not make use of
# synthetic children instead of running code
# TOT clang has a fix for this, which makes the expression command here succeed
# since this would make the test fail or succeed depending on clang version in use
# this is safer commented for the time being
- #self.expect("expression si[0]", matching=False, error=True,
+ # self.expect("expression si[0]", matching=False, error=True,
# substrs = ['first = ', 'zero'])
self.runCmd("c")
-
+
self.expect('frame variable si',
- substrs = ['map has 0 items',
- '{}'])
+ substrs=['map has 0 items',
+ '{}'])
self.runCmd("frame variable is --show-types")
-
+
self.expect('frame variable is',
- substrs = ['map has 0 items',
- '{}'])
+ substrs=['map has 0 items',
+ '{}'])
- self.runCmd("c");
+ self.runCmd("c")
self.expect("frame variable is",
- substrs = ['map has 4 items',
- '[0] = ',
- 'second = \"goofy\"',
- 'first = 85',
- '[1] = ',
- 'second = \"is\"',
- 'first = 1',
- '[2] = ',
- 'second = \"smart\"',
- 'first = 2',
- '[3] = ',
- 'second = \"!!!\"',
- 'first = 3'])
-
+ substrs=['map has 4 items',
+ '[0] = ',
+ 'second = \"goofy\"',
+ 'first = 85',
+ '[1] = ',
+ 'second = \"is\"',
+ 'first = 1',
+ '[2] = ',
+ 'second = \"smart\"',
+ 'first = 2',
+ '[3] = ',
+ 'second = \"!!!\"',
+ 'first = 3'])
+
self.expect("p is",
- substrs = ['map has 4 items',
- '[0] = ',
- 'second = \"goofy\"',
- 'first = 85',
- '[1] = ',
- 'second = \"is\"',
- 'first = 1',
- '[2] = ',
- 'second = \"smart\"',
- 'first = 2',
- '[3] = ',
- 'second = \"!!!\"',
- 'first = 3'])
+ substrs=['map has 4 items',
+ '[0] = ',
+ 'second = \"goofy\"',
+ 'first = 85',
+ '[1] = ',
+ 'second = \"is\"',
+ 'first = 1',
+ '[2] = ',
+ 'second = \"smart\"',
+ 'first = 2',
+ '[3] = ',
+ 'second = \"!!!\"',
+ 'first = 3'])
# check access-by-index
self.expect("frame variable is[0]",
- substrs = ['first = ',
- 'second =']);
+ substrs=['first = ',
+ 'second ='])
# check that MightHaveChildren() gets it right
- self.assertTrue(self.frame().FindVariable("is").MightHaveChildren(), "is.MightHaveChildren() says False for non empty!")
+ self.assertTrue(
+ self.frame().FindVariable("is").MightHaveChildren(),
+ "is.MightHaveChildren() says False for non empty!")
# check that the expression parser does not make use of
# synthetic children instead of running code
# TOT clang has a fix for this, which makes the expression command here succeed
# since this would make the test fail or succeed depending on clang version in use
# this is safer commented for the time being
- #self.expect("expression is[0]", matching=False, error=True,
+ # self.expect("expression is[0]", matching=False, error=True,
# substrs = ['first = ', 'goofy'])
self.runCmd("c")
-
+
self.expect('frame variable is',
- substrs = ['map has 0 items',
- '{}'])
+ substrs=['map has 0 items',
+ '{}'])
self.runCmd("frame variable ss --show-types")
-
+
self.expect('frame variable ss',
- substrs = ['map has 0 items',
- '{}'])
+ substrs=['map has 0 items',
+ '{}'])
- self.runCmd("c");
+ self.runCmd("c")
self.expect("frame variable ss",
- substrs = ['map has 4 items',
- '[0] = ',
- 'second = \"hello\"',
- 'first = \"ciao\"',
- '[1] = ',
- 'second = \"house\"',
- 'first = \"casa\"',
- '[2] = ',
- 'second = \"cat\"',
- 'first = \"gatto\"',
- '[3] = ',
- 'second = \"..is always a Mac!\"',
- 'first = \"a Mac..\"'])
-
+ substrs=['map has 4 items',
+ '[0] = ',
+ 'second = \"hello\"',
+ 'first = \"ciao\"',
+ '[1] = ',
+ 'second = \"house\"',
+ 'first = \"casa\"',
+ '[2] = ',
+ 'second = \"cat\"',
+ 'first = \"gatto\"',
+ '[3] = ',
+ 'second = \"..is always a Mac!\"',
+ 'first = \"a Mac..\"'])
+
self.expect("p ss",
- substrs = ['map has 4 items',
- '[0] = ',
- 'second = \"hello\"',
- 'first = \"ciao\"',
- '[1] = ',
- 'second = \"house\"',
- 'first = \"casa\"',
- '[2] = ',
- 'second = \"cat\"',
- 'first = \"gatto\"',
- '[3] = ',
- 'second = \"..is always a Mac!\"',
- 'first = \"a Mac..\"'])
+ substrs=['map has 4 items',
+ '[0] = ',
+ 'second = \"hello\"',
+ 'first = \"ciao\"',
+ '[1] = ',
+ 'second = \"house\"',
+ 'first = \"casa\"',
+ '[2] = ',
+ 'second = \"cat\"',
+ 'first = \"gatto\"',
+ '[3] = ',
+ 'second = \"..is always a Mac!\"',
+ 'first = \"a Mac..\"'])
# check access-by-index
self.expect("frame variable ss[3]",
- substrs = ['gatto', 'cat']);
+ substrs=['gatto', 'cat'])
# check that MightHaveChildren() gets it right
- self.assertTrue(self.frame().FindVariable("ss").MightHaveChildren(), "ss.MightHaveChildren() says False for non empty!")
-
+ self.assertTrue(
+ self.frame().FindVariable("ss").MightHaveChildren(),
+ "ss.MightHaveChildren() says False for non empty!")
+
# check that the expression parser does not make use of
# synthetic children instead of running code
# TOT clang has a fix for this, which makes the expression command here succeed
# since this would make the test fail or succeed depending on clang version in use
# this is safer commented for the time being
- #self.expect("expression ss[3]", matching=False, error=True,
+ # self.expect("expression ss[3]", matching=False, error=True,
# substrs = ['gatto'])
self.runCmd("c")
-
+
self.expect('frame variable ss',
- substrs = ['map has 0 items',
- '{}'])
+ substrs=['map has 0 items',
+ '{}'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py
index 20b1a3d21156..8d940c2686a0 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py
@@ -4,43 +4,46 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class StdSmartPtrDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipIfFreeBSD
- @skipIfWindows # libstdcpp not ported to Windows
- @skipIfDarwin # doesn't compile on Darwin
+ @skipIfWindows # libstdcpp not ported to Windows
+ @skipIfDarwin # doesn't compile on Darwin
def test_with_run_command(self):
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_source_regexp (self, "Set break point at this line.")
+ lldbutil.run_break_set_by_source_regexp(
+ self, "Set break point at this line.")
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped', 'stop reason = breakpoint'])
+ substrs=['stopped', 'stop reason = breakpoint'])
+
+ self.expect("frame variable nsp", substrs=['nsp = nullptr'])
+ self.expect("frame variable isp", substrs=['isp = 123'])
+ self.expect("frame variable ssp", substrs=['ssp = "foobar"'])
- self.expect("frame variable nsp", substrs = ['nsp = nullptr'])
- self.expect("frame variable isp", substrs = ['isp = 123'])
- self.expect("frame variable ssp", substrs = ['ssp = "foobar"'])
+ self.expect("frame variable nwp", substrs=['nwp = nullptr'])
+ self.expect("frame variable iwp", substrs=['iwp = 123'])
+ self.expect("frame variable swp", substrs=['swp = "foobar"'])
- self.expect("frame variable nwp", substrs = ['nwp = nullptr'])
- self.expect("frame variable iwp", substrs = ['iwp = 123'])
- self.expect("frame variable swp", substrs = ['swp = "foobar"'])
-
self.runCmd("continue")
- self.expect("frame variable nsp", substrs = ['nsp = nullptr'])
- self.expect("frame variable isp", substrs = ['isp = nullptr'])
- self.expect("frame variable ssp", substrs = ['ssp = nullptr'])
+ self.expect("frame variable nsp", substrs=['nsp = nullptr'])
+ self.expect("frame variable isp", substrs=['isp = nullptr'])
+ self.expect("frame variable ssp", substrs=['ssp = nullptr'])
- self.expect("frame variable nwp", substrs = ['nwp = nullptr'])
- self.expect("frame variable iwp", substrs = ['iwp = nullptr'])
- self.expect("frame variable swp", substrs = ['swp = nullptr'])
+ self.expect("frame variable nwp", substrs=['nwp = nullptr'])
+ self.expect("frame variable iwp", substrs=['iwp = nullptr'])
+ self.expect("frame variable swp", substrs=['swp = nullptr'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/TestDataFormatterStdString.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/TestDataFormatterStdString.py
index fde2f791183a..67823c95f138 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/TestDataFormatterStdString.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/TestDataFormatterStdString.py
@@ -1,4 +1,4 @@
-#coding=utf8
+# coding=utf8
"""
Test lldb data formatter subsystem.
"""
@@ -6,13 +6,14 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class StdStringDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -23,20 +24,21 @@ class StdStringDataFormatterTestCase(TestBase):
# Find the line number to break at.
self.line = line_number('main.cpp', '// Set break point at this line.')
- @skipIfWindows # libstdcpp not ported to Windows
+ @skipIfWindows # libstdcpp not ported to Windows
def test_with_run_command(self):
"""Test that that file and class static variables display correctly."""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=-1)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -45,7 +47,9 @@ class StdStringDataFormatterTestCase(TestBase):
self.runCmd('type summary clear', check=False)
self.runCmd('type filter clear', check=False)
self.runCmd('type synth clear', check=False)
- self.runCmd("settings set target.max-children-count 256", check=False)
+ self.runCmd(
+ "settings set target.max-children-count 256",
+ check=False)
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
@@ -56,12 +60,22 @@ class StdStringDataFormatterTestCase(TestBase):
var_q = self.frame().FindVariable('q')
var_Q = self.frame().FindVariable('Q')
- self.assertTrue(var_s.GetSummary() == 'L"hello world! מזל טוב!"', "s summary wrong")
+ self.assertTrue(
+ var_s.GetSummary() == 'L"hello world! מזל טוב!"',
+ "s summary wrong")
self.assertTrue(var_S.GetSummary() == 'L"!!!!"', "S summary wrong")
- self.assertTrue(var_mazeltov.GetSummary() == 'L"מזל טוב"', "mazeltov summary wrong")
- self.assertTrue(var_q.GetSummary() == '"hello world"', "q summary wrong")
- self.assertTrue(var_Q.GetSummary() == '"quite a long std::strin with lots of info inside it"', "Q summary wrong")
+ self.assertTrue(
+ var_mazeltov.GetSummary() == 'L"מזל טוב"',
+ "mazeltov summary wrong")
+ self.assertTrue(
+ var_q.GetSummary() == '"hello world"',
+ "q summary wrong")
+ self.assertTrue(
+ var_Q.GetSummary() == '"quite a long std::strin with lots of info inside it"',
+ "Q summary wrong")
self.runCmd("next")
- self.assertTrue(var_S.GetSummary() == 'L"!!!!!"', "new S summary wrong")
+ self.assertTrue(
+ var_S.GetSummary() == 'L"!!!!!"',
+ "new S summary wrong")
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/Makefile
new file mode 100644
index 000000000000..beb2fd583e7a
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/Makefile
@@ -0,0 +1,8 @@
+LEVEL = ../../../../../make
+
+CXX_SOURCES := main.cpp
+
+USE_LIBSTDCPP := 1
+CFLAGS_EXTRAS += $(NO_LIMIT_DEBUG_INFO_FLAGS)
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/TestDataFormatterStdTuple.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/TestDataFormatterStdTuple.py
new file mode 100644
index 000000000000..56e231da8522
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/TestDataFormatterStdTuple.py
@@ -0,0 +1,49 @@
+"""
+Test lldb data formatter subsystem.
+"""
+
+from __future__ import print_function
+
+import os
+import time
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class StdTupleDataFormatterTestCase(TestBase):
+ mydir = TestBase.compute_mydir(__file__)
+
+ @skipIfFreeBSD
+ @skipIfWindows # libstdcpp not ported to Windows
+ @skipIfDarwin # doesn't compile on Darwin
+ def test_with_run_command(self):
+ self.build()
+ self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
+
+ lldbutil.run_break_set_by_source_regexp(
+ self, "Set break point at this line.")
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ # The stop reason of the thread should be breakpoint.
+ self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+ substrs=['stopped', 'stop reason = breakpoint'])
+
+ frame = self.frame()
+ self.assertTrue(frame.IsValid())
+
+ self.expect("frame variable ti", substrs=['[0] = 1'])
+ self.expect("frame variable ts", substrs=['[0] = "foobar"'])
+ self.expect("frame variable tt", substrs=['[0] = 1', '[1] = "baz"', '[2] = 2'])
+
+ self.assertEqual(1, frame.GetValueForVariablePath("ti[0]").GetValueAsUnsigned())
+ self.assertFalse(frame.GetValueForVariablePath("ti[1]").IsValid())
+
+ self.assertEqual('"foobar"', frame.GetValueForVariablePath("ts[0]").GetSummary())
+ self.assertFalse(frame.GetValueForVariablePath("ts[1]").IsValid())
+
+ self.assertEqual(1, frame.GetValueForVariablePath("tt[0]").GetValueAsUnsigned())
+ self.assertEqual('"baz"', frame.GetValueForVariablePath("tt[1]").GetSummary())
+ self.assertEqual(2, frame.GetValueForVariablePath("tt[2]").GetValueAsUnsigned())
+ self.assertFalse(frame.GetValueForVariablePath("tt[3]").IsValid())
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/main.cpp
new file mode 100644
index 000000000000..7247742ee6bb
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/main.cpp
@@ -0,0 +1,9 @@
+#include <memory>
+#include <string>
+
+int main() {
+ std::tuple<int> ti{1};
+ std::tuple<std::string> ts{"foobar"};
+ std::tuple<int, std::string, int> tt{1, "baz", 2};
+ return 0; // Set break point at this line.
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/Makefile
new file mode 100644
index 000000000000..beb2fd583e7a
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/Makefile
@@ -0,0 +1,8 @@
+LEVEL = ../../../../../make
+
+CXX_SOURCES := main.cpp
+
+USE_LIBSTDCPP := 1
+CFLAGS_EXTRAS += $(NO_LIMIT_DEBUG_INFO_FLAGS)
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py
new file mode 100644
index 000000000000..770d87178f50
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py
@@ -0,0 +1,61 @@
+"""
+Test lldb data formatter subsystem.
+"""
+
+from __future__ import print_function
+
+import os
+import time
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class StdUniquePtrDataFormatterTestCase(TestBase):
+ mydir = TestBase.compute_mydir(__file__)
+
+ @skipIfFreeBSD
+ @skipIfWindows # libstdcpp not ported to Windows
+ @skipIfDarwin # doesn't compile on Darwin
+ def test_with_run_command(self):
+ self.build()
+ self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
+
+ lldbutil.run_break_set_by_source_regexp(
+ self, "Set break point at this line.")
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ # The stop reason of the thread should be breakpoint.
+ self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+ substrs=['stopped', 'stop reason = breakpoint'])
+
+ frame = self.frame()
+ self.assertTrue(frame.IsValid())
+
+ self.expect("frame variable nup", substrs=['nup = nullptr'])
+ self.expect("frame variable iup", substrs=['iup = 0x', 'object = 123'])
+ self.expect("frame variable sup", substrs=['sup = 0x', 'object = "foobar"'])
+
+ self.expect("frame variable ndp", substrs=['ndp = nullptr'])
+ self.expect("frame variable idp", substrs=['idp = 0x', 'object = 456', 'deleter = ', 'a = 1', 'b = 2'])
+ self.expect("frame variable sdp", substrs=['sdp = 0x', 'object = "baz"', 'deleter = ', 'a = 3', 'b = 4'])
+
+ self.assertEqual(123, frame.GetValueForVariablePath("iup.object").GetValueAsUnsigned())
+ self.assertFalse(frame.GetValueForVariablePath("iup.deleter").IsValid())
+
+ self.assertEqual('"foobar"', frame.GetValueForVariablePath("sup.object").GetSummary())
+ self.assertFalse(frame.GetValueForVariablePath("sup.deleter").IsValid())
+
+ self.assertEqual(456, frame.GetValueForVariablePath("idp.object").GetValueAsUnsigned())
+ self.assertEqual('"baz"', frame.GetValueForVariablePath("sdp.object").GetSummary())
+
+ idp_deleter = frame.GetValueForVariablePath("idp.deleter")
+ self.assertTrue(idp_deleter.IsValid())
+ self.assertEqual(1, idp_deleter.GetChildMemberWithName("a").GetValueAsUnsigned())
+ self.assertEqual(2, idp_deleter.GetChildMemberWithName("b").GetValueAsUnsigned())
+
+ sdp_deleter = frame.GetValueForVariablePath("sdp.deleter")
+ self.assertTrue(sdp_deleter.IsValid())
+ self.assertEqual(3, sdp_deleter.GetChildMemberWithName("a").GetValueAsUnsigned())
+ self.assertEqual(4, sdp_deleter.GetChildMemberWithName("b").GetValueAsUnsigned())
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/main.cpp
new file mode 100644
index 000000000000..4a40309338c1
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/main.cpp
@@ -0,0 +1,22 @@
+#include <memory>
+#include <string>
+
+struct Deleter {
+ void operator()(void *) {}
+
+ int a;
+ int b;
+};
+
+int main() {
+ std::unique_ptr<char> nup;
+ std::unique_ptr<int> iup(new int{123});
+ std::unique_ptr<std::string> sup(new std::string("foobar"));
+
+ std::unique_ptr<char, Deleter> ndp;
+ std::unique_ptr<int, Deleter> idp(new int{456}, Deleter{1, 2});
+ std::unique_ptr<std::string, Deleter> sdp(new std::string("baz"),
+ Deleter{3, 4});
+
+ return 0; // Set break point at this line.
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/TestDataFormatterStdVBool.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/TestDataFormatterStdVBool.py
index f5cf7c04c3a7..17b369df3e6b 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/TestDataFormatterStdVBool.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/TestDataFormatterStdVBool.py
@@ -5,13 +5,14 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class StdVBoolDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -22,23 +23,25 @@ class StdVBoolDataFormatterTestCase(TestBase):
# Find the line number to break at.
self.line = line_number('main.cpp', '// Set break point at this line.')
- @expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr20548 fails to build on lab.llvm.org buildbot')
- @expectedFailureAll(compiler="icc", bugnumber="llvm.org/pr15301 LLDB prints incorrect sizes of STL containers")
- @skipIfWindows # libstdcpp not ported to Windows.
+ @expectedFailureAll(
+ oslist=['freebsd'],
+ bugnumber='llvm.org/pr20548 fails to build on lab.llvm.org buildbot')
+ @skipIfWindows # libstdcpp not ported to Windows.
@skipIfDarwin
def test_with_run_command(self):
"""Test that that file and class static variables display correctly."""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=-1)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -47,13 +50,33 @@ class StdVBoolDataFormatterTestCase(TestBase):
self.runCmd('type summary clear', check=False)
self.runCmd('type filter clear', check=False)
self.runCmd('type synth clear', check=False)
- self.runCmd("settings set target.max-children-count 256", check=False)
+ self.runCmd(
+ "settings set target.max-children-count 256",
+ check=False)
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
- self.expect("frame variable vBool",
- substrs = ['size=49','[0] = false','[1] = true','[18] = false','[27] = true','[36] = false','[47] = true','[48] = true'])
+ self.expect(
+ "frame variable vBool",
+ substrs=[
+ 'size=49',
+ '[0] = false',
+ '[1] = true',
+ '[18] = false',
+ '[27] = true',
+ '[36] = false',
+ '[47] = true',
+ '[48] = true'])
- self.expect("expr vBool",
- substrs = ['size=49','[0] = false','[1] = true','[18] = false','[27] = true','[36] = false','[47] = true','[48] = true'])
+ self.expect(
+ "expr vBool",
+ substrs=[
+ 'size=49',
+ '[0] = false',
+ '[1] = true',
+ '[18] = false',
+ '[27] = true',
+ '[36] = false',
+ '[47] = true',
+ '[48] = true'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py
index 4a352ef41c17..e4ec703495b3 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py
@@ -5,13 +5,14 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class StdVectorDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -23,21 +24,21 @@ class StdVectorDataFormatterTestCase(TestBase):
self.line = line_number('main.cpp', '// Set break point at this line.')
@skipIfFreeBSD
- @expectedFailureAll(compiler="icc", bugnumber="llvm.org/pr15301 LLDB prints incorrect sizes of STL containers")
- @skipIfWindows # libstdcpp not ported to Windows
+ @skipIfWindows # libstdcpp not ported to Windows
def test_with_run_command(self):
"""Test that that file and class static variables display correctly."""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_source_regexp (self, "Set break point at this line.")
+ lldbutil.run_break_set_by_source_regexp(
+ self, "Set break point at this line.")
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -46,163 +47,171 @@ class StdVectorDataFormatterTestCase(TestBase):
self.runCmd('type summary clear', check=False)
self.runCmd('type filter clear', check=False)
self.runCmd('type synth clear', check=False)
- self.runCmd("settings set target.max-children-count 256", check=False)
+ self.runCmd(
+ "settings set target.max-children-count 256",
+ check=False)
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
# empty vectors (and storage pointers SHOULD BOTH BE NULL..)
self.expect("frame variable numbers",
- substrs = ['numbers = size=0'])
+ substrs=['numbers = size=0'])
self.runCmd("c")
-
+
# first value added
self.expect("frame variable numbers",
- substrs = ['numbers = size=1',
- '[0] = 1',
- '}'])
+ substrs=['numbers = size=1',
+ '[0] = 1',
+ '}'])
# add some more data
- self.runCmd("c");
-
+ self.runCmd("c")
+
self.expect("frame variable numbers",
- substrs = ['numbers = size=4',
- '[0] = 1',
- '[1] = 12',
- '[2] = 123',
- '[3] = 1234',
- '}'])
+ substrs=['numbers = size=4',
+ '[0] = 1',
+ '[1] = 12',
+ '[2] = 123',
+ '[3] = 1234',
+ '}'])
self.expect("p numbers",
- substrs = ['$', 'size=4',
- '[0] = 1',
- '[1] = 12',
- '[2] = 123',
- '[3] = 1234',
- '}'])
-
-
+ substrs=['$', 'size=4',
+ '[0] = 1',
+ '[1] = 12',
+ '[2] = 123',
+ '[3] = 1234',
+ '}'])
+
# check access to synthetic children
- self.runCmd("type summary add --summary-string \"item 0 is ${var[0]}\" std::int_vect int_vect")
+ self.runCmd(
+ "type summary add --summary-string \"item 0 is ${var[0]}\" std::int_vect int_vect")
self.expect('frame variable numbers',
- substrs = ['item 0 is 1']);
-
- self.runCmd("type summary add --summary-string \"item 0 is ${svar[0]}\" std::int_vect int_vect")
+ substrs=['item 0 is 1'])
+
+ self.runCmd(
+ "type summary add --summary-string \"item 0 is ${svar[0]}\" std::int_vect int_vect")
#import time
- #time.sleep(19)
+ # time.sleep(19)
self.expect('frame variable numbers',
- substrs = ['item 0 is 1']);
+ substrs=['item 0 is 1'])
# move on with synths
self.runCmd("type summary delete std::int_vect")
self.runCmd("type summary delete int_vect")
# add some more data
- self.runCmd("c");
+ self.runCmd("c")
self.expect("frame variable numbers",
- substrs = ['numbers = size=7',
- '[0] = 1',
- '[1] = 12',
- '[2] = 123',
- '[3] = 1234',
- '[4] = 12345',
- '[5] = 123456',
- '[6] = 1234567',
- '}'])
-
+ substrs=['numbers = size=7',
+ '[0] = 1',
+ '[1] = 12',
+ '[2] = 123',
+ '[3] = 1234',
+ '[4] = 12345',
+ '[5] = 123456',
+ '[6] = 1234567',
+ '}'])
+
self.expect("p numbers",
- substrs = ['$', 'size=7',
- '[0] = 1',
- '[1] = 12',
- '[2] = 123',
- '[3] = 1234',
- '[4] = 12345',
- '[5] = 123456',
- '[6] = 1234567',
- '}'])
+ substrs=['$', 'size=7',
+ '[0] = 1',
+ '[1] = 12',
+ '[2] = 123',
+ '[3] = 1234',
+ '[4] = 12345',
+ '[5] = 123456',
+ '[6] = 1234567',
+ '}'])
# check access-by-index
self.expect("frame variable numbers[0]",
- substrs = ['1']);
+ substrs=['1'])
self.expect("frame variable numbers[1]",
- substrs = ['12']);
+ substrs=['12'])
self.expect("frame variable numbers[2]",
- substrs = ['123']);
+ substrs=['123'])
self.expect("frame variable numbers[3]",
- substrs = ['1234']);
-
+ substrs=['1234'])
+
# but check that expression does not rely on us
# (when expression gets to call into STL code correctly, we will have to find
# another way to check this)
self.expect("expression numbers[6]", matching=False, error=True,
- substrs = ['1234567'])
+ substrs=['1234567'])
# check that MightHaveChildren() gets it right
- self.assertTrue(self.frame().FindVariable("numbers").MightHaveChildren(), "numbers.MightHaveChildren() says False for non empty!")
+ self.assertTrue(
+ self.frame().FindVariable("numbers").MightHaveChildren(),
+ "numbers.MightHaveChildren() says False for non empty!")
# clear out the vector and see that we do the right thing once again
self.runCmd("c")
self.expect("frame variable numbers",
- substrs = ['numbers = size=0'])
+ substrs=['numbers = size=0'])
self.runCmd("c")
# first value added
self.expect("frame variable numbers",
- substrs = ['numbers = size=1',
- '[0] = 7',
- '}'])
+ substrs=['numbers = size=1',
+ '[0] = 7',
+ '}'])
# check if we can display strings
self.runCmd("c")
self.expect("frame variable strings",
- substrs = ['goofy',
- 'is',
- 'smart'])
+ substrs=['goofy',
+ 'is',
+ 'smart'])
self.expect("p strings",
- substrs = ['goofy',
- 'is',
- 'smart'])
+ substrs=['goofy',
+ 'is',
+ 'smart'])
# test summaries based on synthetic children
- self.runCmd("type summary add std::string_vect string_vect --summary-string \"vector has ${svar%#} items\" -e")
+ self.runCmd(
+ "type summary add std::string_vect string_vect --summary-string \"vector has ${svar%#} items\" -e")
self.expect("frame variable strings",
- substrs = ['vector has 3 items',
- 'goofy',
- 'is',
- 'smart'])
+ substrs=['vector has 3 items',
+ 'goofy',
+ 'is',
+ 'smart'])
self.expect("p strings",
- substrs = ['vector has 3 items',
- 'goofy',
- 'is',
- 'smart'])
+ substrs=['vector has 3 items',
+ 'goofy',
+ 'is',
+ 'smart'])
- self.runCmd("c");
+ self.runCmd("c")
self.expect("frame variable strings",
- substrs = ['vector has 4 items'])
-
+ substrs=['vector has 4 items'])
+
# check access-by-index
self.expect("frame variable strings[0]",
- substrs = ['goofy']);
+ substrs=['goofy'])
self.expect("frame variable strings[1]",
- substrs = ['is']);
-
+ substrs=['is'])
+
# but check that expression does not rely on us
# (when expression gets to call into STL code correctly, we will have to find
# another way to check this)
self.expect("expression strings[0]", matching=False, error=True,
- substrs = ['goofy'])
+ substrs=['goofy'])
# check that MightHaveChildren() gets it right
- self.assertTrue(self.frame().FindVariable("strings").MightHaveChildren(), "strings.MightHaveChildren() says False for non empty!")
+ self.assertTrue(
+ self.frame().FindVariable("strings").MightHaveChildren(),
+ "strings.MightHaveChildren() says False for non empty!")
self.runCmd("c")
self.expect("frame variable strings",
- substrs = ['vector has 0 items'])
+ substrs=['vector has 0 items'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py
index 8cebf20ddd2a..8fff07d89dca 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py
@@ -5,12 +5,13 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class SynthDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -26,14 +27,15 @@ class SynthDataFormatterTestCase(TestBase):
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -48,158 +50,171 @@ class SynthDataFormatterTestCase(TestBase):
# Pick some values and check that the basics work
self.runCmd("type filter add BagOfInts --child x --child z")
self.expect("frame variable int_bag",
- substrs = ['x = 6',
- 'z = 8'])
+ substrs=['x = 6',
+ 'z = 8'])
# Check we can still access the missing child by summary
- self.runCmd("type summary add BagOfInts --summary-string \"y=${var.y}\"")
+ self.runCmd(
+ "type summary add BagOfInts --summary-string \"y=${var.y}\"")
self.expect('frame variable int_bag',
- substrs = ['y=7'])
-
- # Even if we have synth children, the summary prevails
+ substrs=['y=7'])
+
+ # Even if we have synth children, the summary prevails
self.expect("frame variable int_bag", matching=False,
- substrs = ['x = 6',
- 'z = 8'])
-
+ substrs=['x = 6',
+ 'z = 8'])
+
# if we skip synth and summary show y
- self.expect("frame variable int_bag --synthetic-type false --no-summary-depth=1",
- substrs = ['x = 6',
- 'y = 7',
- 'z = 8'])
-
+ self.expect(
+ "frame variable int_bag --synthetic-type false --no-summary-depth=1",
+ substrs=[
+ 'x = 6',
+ 'y = 7',
+ 'z = 8'])
+
# if we ask for raw output same happens
self.expect("frame variable int_bag --raw-output",
- substrs = ['x = 6',
- 'y = 7',
- 'z = 8'])
-
+ substrs=['x = 6',
+ 'y = 7',
+ 'z = 8'])
+
# Summary+Synth must work together
- self.runCmd("type summary add BagOfInts --summary-string \"x=${var.x}\" -e")
+ self.runCmd(
+ "type summary add BagOfInts --summary-string \"x=${var.x}\" -e")
self.expect('frame variable int_bag',
- substrs = ['x=6',
- 'x = 6',
- 'z = 8'])
-
+ substrs=['x=6',
+ 'x = 6',
+ 'z = 8'])
+
# Same output, but using Python
- self.runCmd("type summary add BagOfInts --python-script \"return 'x=%s' % valobj.GetChildMemberWithName('x').GetValue()\" -e")
+ self.runCmd(
+ "type summary add BagOfInts --python-script \"return 'x=%s' % valobj.GetChildMemberWithName('x').GetValue()\" -e")
self.expect('frame variable int_bag',
- substrs = ['x=6',
- 'x = 6',
- 'z = 8'])
+ substrs=['x=6',
+ 'x = 6',
+ 'z = 8'])
# If I skip summaries, still give me the artificial children
self.expect("frame variable int_bag --no-summary-depth=1",
- substrs = ['x = 6',
- 'z = 8'])
+ substrs=['x = 6',
+ 'z = 8'])
# Delete synth and check that the view reflects it immediately
self.runCmd("type filter delete BagOfInts")
self.expect("frame variable int_bag",
- substrs = ['x = 6',
- 'y = 7',
- 'z = 8'])
+ substrs=['x = 6',
+ 'y = 7',
+ 'z = 8'])
- # Add the synth again and check that it's honored deeper in the hierarchy
+ # Add the synth again and check that it's honored deeper in the
+ # hierarchy
self.runCmd("type filter add BagOfInts --child x --child z")
self.expect('frame variable bag_bag',
- substrs = ['x = x=69 {',
- 'x = 69',
- 'z = 71',
- 'y = x=66 {',
- 'x = 66',
- 'z = 68'])
+ substrs=['x = x=69 {',
+ 'x = 69',
+ 'z = 71',
+ 'y = x=66 {',
+ 'x = 66',
+ 'z = 68'])
self.expect('frame variable bag_bag', matching=False,
- substrs = ['y = 70',
- 'y = 67'])
+ substrs=['y = 70',
+ 'y = 67'])
# Check that a synth can expand nested stuff
self.runCmd("type filter add BagOfBags --child x.y --child y.z")
self.expect('frame variable bag_bag',
- substrs = ['x.y = 70',
- 'y.z = 68'])
+ substrs=['x.y = 70',
+ 'y.z = 68'])
# ...even if we get -> and . wrong
self.runCmd("type filter add BagOfBags --child x.y --child \"y->z\"")
self.expect('frame variable bag_bag',
- substrs = ['x.y = 70',
- 'y->z = 68'])
+ substrs=['x.y = 70',
+ 'y->z = 68'])
# ...even bitfields
- self.runCmd("type filter add BagOfBags --child x.y --child \"y->z[1-2]\"")
+ self.runCmd(
+ "type filter add BagOfBags --child x.y --child \"y->z[1-2]\"")
self.expect('frame variable bag_bag --show-types',
- substrs = ['x.y = 70',
- '(int:2) y->z[1-2] = 2'])
+ substrs=['x.y = 70',
+ '(int:2) y->z[1-2] = 2'])
# ...even if we format the bitfields
- self.runCmd("type filter add BagOfBags --child x.y --child \"y->y[0-0]\"")
+ self.runCmd(
+ "type filter add BagOfBags --child x.y --child \"y->y[0-0]\"")
self.runCmd("type format add \"int:1\" -f bool")
self.expect('frame variable bag_bag --show-types',
- substrs = ['x.y = 70',
- '(int:1) y->y[0-0] = true'])
-
+ substrs=['x.y = 70',
+ '(int:1) y->y[0-0] = true'])
+
# ...even if we use one-liner summaries
self.runCmd("type summary add -c BagOfBags")
- self.expect('frame variable bag_bag',
- substrs = ['(BagOfBags) bag_bag = (x.y = 70, y->y[0-0] = true)'])
-
+ self.expect('frame variable bag_bag', substrs=[
+ '(BagOfBags) bag_bag = (x.y = 70, y->y[0-0] = true)'])
+
self.runCmd("type summary delete BagOfBags")
# now check we are dynamic (and arrays work)
- self.runCmd("type filter add Plenty --child bitfield --child array[0] --child array[2]")
+ self.runCmd(
+ "type filter add Plenty --child bitfield --child array[0] --child array[2]")
self.expect('frame variable plenty_of_stuff',
- substrs = ['bitfield = 1',
- 'array[0] = 5',
- 'array[2] = 3'])
-
+ substrs=['bitfield = 1',
+ 'array[0] = 5',
+ 'array[2] = 3'])
+
self.runCmd("n")
self.expect('frame variable plenty_of_stuff',
- substrs = ['bitfield = 17',
- 'array[0] = 5',
- 'array[2] = 3'])
-
+ substrs=['bitfield = 17',
+ 'array[0] = 5',
+ 'array[2] = 3'])
+
# skip synthetic children
self.expect('frame variable plenty_of_stuff --synthetic-type no',
- substrs = ['some_values = 0x',
- 'array = 0x',
- 'array_size = 5'])
+ substrs=['some_values = 0x',
+ 'array = 0x',
+ 'array_size = 5'])
-
# check flat printing with synthetic children
self.expect('frame variable plenty_of_stuff --flat',
- substrs = ['plenty_of_stuff.bitfield = 17',
- '*(plenty_of_stuff.array) = 5',
- '*(plenty_of_stuff.array) = 3'])
-
+ substrs=['plenty_of_stuff.bitfield = 17',
+ '*(plenty_of_stuff.array) = 5',
+ '*(plenty_of_stuff.array) = 3'])
+
# check that we do not lose location information for our children
self.expect('frame variable plenty_of_stuff --location',
- substrs = ['0x',
- ': bitfield = 17'])
+ substrs=['0x',
+ ': bitfield = 17'])
# check we work across pointer boundaries
self.expect('frame variable plenty_of_stuff.some_values --ptr-depth=1',
- substrs = ['(BagOfInts *) plenty_of_stuff.some_values',
- 'x = 5',
- 'z = 7'])
+ substrs=['(BagOfInts *) plenty_of_stuff.some_values',
+ 'x = 5',
+ 'z = 7'])
# but not if we don't want to
self.runCmd("type filter add BagOfInts --child x --child z -p")
self.expect('frame variable plenty_of_stuff.some_values --ptr-depth=1',
- substrs = ['(BagOfInts *) plenty_of_stuff.some_values',
- 'x = 5',
- 'y = 6',
- 'z = 7'])
+ substrs=['(BagOfInts *) plenty_of_stuff.some_values',
+ 'x = 5',
+ 'y = 6',
+ 'z = 7'])
# check we're dynamic even if nested
self.runCmd("type filter add BagOfBags --child x.z")
self.expect('frame variable bag_bag',
- substrs = ['x.z = 71'])
+ substrs=['x.z = 71'])
self.runCmd("n")
self.expect('frame variable bag_bag',
- substrs = ['x.z = 12'])
+ substrs=['x.z = 12'])
- self.runCmd('type summary add -e -s "I am always empty but have" EmptyStruct')
- self.expect('frame variable es', substrs = ["I am always empty but have {}"])
+ self.runCmd(
+ 'type summary add -e -s "I am always empty but have" EmptyStruct')
+ self.expect('frame variable es', substrs=[
+ "I am always empty but have {}"])
self.runCmd('type summary add -e -h -s "I am really empty" EmptyStruct')
- self.expect('frame variable es', substrs = ["I am really empty"])
- self.expect('frame variable es', substrs = ["I am really empty {}"], matching=False)
+ self.expect('frame variable es', substrs=["I am really empty"])
+ self.expect(
+ 'frame variable es',
+ substrs=["I am really empty {}"],
+ matching=False)
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthtype/TestDataFormatterSynthType.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthtype/TestDataFormatterSynthType.py
index 6a03456e5c32..75d3b4e5f5c2 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthtype/TestDataFormatterSynthType.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthtype/TestDataFormatterSynthType.py
@@ -5,13 +5,14 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class DataFormatterSynthTypeTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -22,20 +23,21 @@ class DataFormatterSynthTypeTestCase(TestBase):
# Find the line number to break at.
self.line = line_number('main.cpp', 'break here')
- @skipIfFreeBSD # llvm.org/pr20545 bogus output confuses buildbot parser
+ @skipIfFreeBSD # llvm.org/pr20545 bogus output confuses buildbot parser
def test_with_run_command(self):
"""Test using Python synthetic children provider to provide a typename."""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthtype/myIntSynthProvider.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthtype/myIntSynthProvider.py
index 42737140b112..fa47ca2cfe69 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthtype/myIntSynthProvider.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthtype/myIntSynthProvider.py
@@ -1,22 +1,30 @@
class myIntSynthProvider(object):
- def __init__(self, valobj, dict):
- self.valobj = valobj;
- self.val = self.valobj.GetChildMemberWithName("theValue")
- def num_children(self):
- return 0;
- def get_child_at_index(self, index):
- return None
- def get_child_index(self, name):
- return None
- def update(self):
- return False
- def has_children(self):
- return False
- def get_type_name(self):
- return "ThisTestPasses"
+
+ def __init__(self, valobj, dict):
+ self.valobj = valobj
+ self.val = self.valobj.GetChildMemberWithName("theValue")
+
+ def num_children(self):
+ return 0
+
+ def get_child_at_index(self, index):
+ return None
+
+ def get_child_index(self, name):
+ return None
+
+ def update(self):
+ return False
+
+ def has_children(self):
+ return False
+
+ def get_type_name(self):
+ return "ThisTestPasses"
class myArraySynthProvider(object):
+
def __init__(self, valobj, dict):
self.valobj = valobj
self.array = self.valobj.GetChildMemberWithName("array")
@@ -27,10 +35,10 @@ class myArraySynthProvider(object):
return max_count
def get_child_at_index(self, index):
- return None # Keep it simple when this is not tested here.
+ return None # Keep it simple when this is not tested here.
def get_child_index(self, name):
- return None # Keep it simple when this is not tested here.
+ return None # Keep it simple when this is not tested here.
def has_children(self):
return True
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py
index e7a34647a6de..6e7ac2c13f31 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py
@@ -5,13 +5,14 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class DataFormatterSynthValueTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -22,21 +23,24 @@ class DataFormatterSynthValueTestCase(TestBase):
# Find the line number to break at.
self.line = line_number('main.cpp', 'break here')
- @skipIfFreeBSD # llvm.org/pr20545 bogus output confuses buildbot parser
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24462, Data formatters have problems on Windows")
+ @skipIfFreeBSD # llvm.org/pr20545 bogus output confuses buildbot parser
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24462, Data formatters have problems on Windows")
def test_with_run_command(self):
"""Test using Python synthetic children provider to provide a value."""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -48,43 +52,64 @@ class DataFormatterSynthValueTestCase(TestBase):
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
-
+
x = self.frame().FindVariable("x")
x.SetPreferSyntheticValue(True)
y = self.frame().FindVariable("y")
y.SetPreferSyntheticValue(True)
z = self.frame().FindVariable("z")
z.SetPreferSyntheticValue(True)
+ q = self.frame().FindVariable("q")
+ z.SetPreferSyntheticValue(True)
x_val = x.GetValueAsUnsigned
y_val = y.GetValueAsUnsigned
z_val = z.GetValueAsUnsigned
-
+ q_val = q.GetValueAsUnsigned
+
if self.TraceOn():
- print("x_val = %s; y_val = %s; z_val = %s" % (x_val(),y_val(),z_val()))
+ print(
+ "x_val = %s; y_val = %s; z_val = %s; q_val = %s" %
+ (x_val(), y_val(), z_val(), q_val()))
self.assertFalse(x_val() == 3, "x == 3 before synthetics")
self.assertFalse(y_val() == 4, "y == 4 before synthetics")
self.assertFalse(z_val() == 7, "z == 7 before synthetics")
+ self.assertFalse(q_val() == 8, "q == 8 before synthetics")
# now set up the synth
self.runCmd("script from myIntSynthProvider import *")
self.runCmd("type synth add -l myIntSynthProvider myInt")
self.runCmd("type synth add -l myArraySynthProvider myArray")
-
+ self.runCmd("type synth add -l myIntSynthProvider myIntAndStuff")
+
if self.TraceOn():
- print("x_val = %s; y_val = %s; z_val = %s" % (x_val(),y_val(),z_val()))
-
+ print(
+ "x_val = %s; y_val = %s; z_val = %s; q_val = %s" %
+ (x_val(), y_val(), z_val(), q_val()))
+
self.assertTrue(x_val() == 3, "x != 3 after synthetics")
self.assertTrue(y_val() == 4, "y != 4 after synthetics")
self.assertTrue(z_val() == 7, "z != 7 after synthetics")
-
+ self.assertTrue(q_val() == 8, "q != 8 after synthetics")
+
self.expect("frame variable x", substrs=['3'])
- self.expect("frame variable x", substrs=['theValue = 3'], matching=False)
-
- # check that an aptly defined synthetic provider does not affect one-lining
- self.expect("expression struct S { myInt theInt{12}; }; S()", substrs = ['(theInt = 12)'])
-
+ self.expect(
+ "frame variable x",
+ substrs=['theValue = 3'],
+ matching=False)
+ self.expect("frame variable q", substrs=['8'])
+ self.expect(
+ "frame variable q",
+ substrs=['theValue = 8'],
+ matching=False)
+
+ # check that an aptly defined synthetic provider does not affect
+ # one-lining
+ self.expect(
+ "expression struct S { myInt theInt{12}; }; S()",
+ substrs=['(theInt = 12)'])
+
# check that we can use a synthetic value in a summary
self.runCmd("type summary add hasAnInt -s ${var.theInt}")
hi = self.frame().FindVariable("hi")
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthval/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthval/main.cpp
index accbf0a5a578..1a5925a05a65 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthval/main.cpp
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthval/main.cpp
@@ -5,6 +5,16 @@ class myInt {
int val() { return theValue; }
};
+class myIntAndStuff {
+private:
+ int theValue;
+ double theExtraFluff;
+public:
+ myIntAndStuff() : theValue(0), theExtraFluff(1.25) {}
+ myIntAndStuff(int _x) : theValue(_x), theExtraFluff(1.25) {}
+ int val() { return theValue; }
+};
+
class myArray {
public:
int array[16];
@@ -17,11 +27,13 @@ class hasAnInt {
};
myInt operator + (myInt x, myInt y) { return myInt(x.val() + y.val()); }
+myInt operator + (myInt x, myIntAndStuff y) { return myInt(x.val() + y.val()); }
int main() {
myInt x{3};
myInt y{4};
myInt z {x+y};
+ myIntAndStuff q {z.val()+1};
hasAnInt hi;
myArray ma;
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthval/myIntSynthProvider.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthval/myIntSynthProvider.py
index c8517a442932..82da6f9da928 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthval/myIntSynthProvider.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthval/myIntSynthProvider.py
@@ -1,22 +1,30 @@
class myIntSynthProvider(object):
- def __init__(self, valobj, dict):
- self.valobj = valobj;
- self.val = self.valobj.GetChildMemberWithName("theValue")
- def num_children(self):
- return 0;
- def get_child_at_index(self, index):
- return None
- def get_child_index(self, name):
- return None
- def update(self):
- return False
- def has_children(self):
- return False
- def get_value(self):
- return self.val
+
+ def __init__(self, valobj, dict):
+ self.valobj = valobj
+ self.val = self.valobj.GetChildMemberWithName("theValue")
+
+ def num_children(self):
+ return 0
+
+ def get_child_at_index(self, index):
+ return None
+
+ def get_child_index(self, name):
+ return None
+
+ def update(self):
+ return False
+
+ def has_children(self):
+ return False
+
+ def get_value(self):
+ return self.val
class myArraySynthProvider(object):
+
def __init__(self, valobj, dict):
self.valobj = valobj
self.array = self.valobj.GetChildMemberWithName("array")
@@ -27,10 +35,10 @@ class myArraySynthProvider(object):
return max_count
def get_child_at_index(self, index):
- return None # Keep it simple when this is not tested here.
+ return None # Keep it simple when this is not tested here.
def get_child_index(self, name):
- return None # Keep it simple when this is not tested here.
+ return None # Keep it simple when this is not tested here.
def has_children(self):
return True
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/dump_dynamic/TestDumpDynamic.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/dump_dynamic/TestDumpDynamic.py
index 886d09fda456..734e711fb7fc 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/dump_dynamic/TestDumpDynamic.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/dump_dynamic/TestDumpDynamic.py
@@ -2,4 +2,7 @@ from __future__ import absolute_import
from lldbsuite.test import lldbinline
-lldbinline.MakeInlineTest(__file__, globals(), [lldbinline.expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24663")])
+lldbinline.MakeInlineTest(
+ __file__, globals(), [
+ lldbinline.expectedFailureAll(
+ oslist=["windows"], bugnumber="llvm.org/pr24663")])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/format-propagation/TestFormatPropagation.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/format-propagation/TestFormatPropagation.py
index 5cb7c82c9e09..0c15c793e1fe 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/format-propagation/TestFormatPropagation.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/format-propagation/TestFormatPropagation.py
@@ -5,12 +5,13 @@ Check if changing Format on an SBValue correctly propagates that new format to c
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class FormatPropagationTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -27,14 +28,15 @@ class FormatPropagationTestCase(TestBase):
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -47,18 +49,24 @@ class FormatPropagationTestCase(TestBase):
# extract the parent and the children
frame = self.frame()
parent = self.frame().FindVariable("f")
- self.assertTrue(parent != None and parent.IsValid(),"could not find f")
+ self.assertTrue(
+ parent is not None and parent.IsValid(),
+ "could not find f")
X = parent.GetChildMemberWithName("X")
- self.assertTrue(X != None and X.IsValid(),"could not find X")
+ self.assertTrue(X is not None and X.IsValid(), "could not find X")
Y = parent.GetChildMemberWithName("Y")
- self.assertTrue(Y != None and Y.IsValid(),"could not find Y")
+ self.assertTrue(Y is not None and Y.IsValid(), "could not find Y")
# check their values now
self.assertTrue(X.GetValue() == "1", "X has an invalid value")
self.assertTrue(Y.GetValue() == "2", "Y has an invalid value")
# set the format on the parent
parent.SetFormat(lldb.eFormatHex)
- self.assertTrue(X.GetValue() == "0x00000001", "X has not changed format")
- self.assertTrue(Y.GetValue() == "0x00000002", "Y has not changed format")
+ self.assertTrue(
+ X.GetValue() == "0x00000001",
+ "X has not changed format")
+ self.assertTrue(
+ Y.GetValue() == "0x00000002",
+ "Y has not changed format")
# Step and check if the values make sense still
self.runCmd("next")
self.assertTrue(X.GetValue() == "0x00000004", "X has not become 4")
@@ -71,5 +79,7 @@ class FormatPropagationTestCase(TestBase):
parent.SetFormat(lldb.eFormatDefault)
X.SetFormat(lldb.eFormatHex)
Y.SetFormat(lldb.eFormatDefault)
- self.assertTrue(X.GetValue() == "0x00000004", "X is not hex as it asked")
+ self.assertTrue(
+ X.GetValue() == "0x00000004",
+ "X is not hex as it asked")
self.assertTrue(Y.GetValue() == "2", "Y is not defaulted")
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/frameformat_smallstruct/TestFrameFormatSmallStruct.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/frameformat_smallstruct/TestFrameFormatSmallStruct.py
index 555351998c2d..d6303fe8b73d 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/frameformat_smallstruct/TestFrameFormatSmallStruct.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/frameformat_smallstruct/TestFrameFormatSmallStruct.py
@@ -5,12 +5,13 @@ Test that the user can input a format but it will not prevail over summary forma
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class FrameFormatSmallStructTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -26,13 +27,14 @@ class FrameFormatSmallStructTestCase(TestBase):
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
- self.expect("thread list", substrs = ['addPair(p=(x = 3, y = -3))'])
+ self.expect("thread list", substrs=['addPair(p=(x = 3, y = -3))'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/hexcaps/TestDataFormatterHexCaps.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/hexcaps/TestDataFormatterHexCaps.py
index 3c28b68056f5..32fbf48dcc68 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/hexcaps/TestDataFormatterHexCaps.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/hexcaps/TestDataFormatterHexCaps.py
@@ -5,12 +5,13 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class DataFormatterHexCapsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -26,14 +27,15 @@ class DataFormatterHexCapsTestCase(TestBase):
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -45,38 +47,43 @@ class DataFormatterHexCapsTestCase(TestBase):
self.addTearDownHook(cleanup)
self.runCmd("type format add -f uppercase int")
-
+
self.expect('frame variable mine',
- substrs = ['mine = ',
- 'first = 0x001122AA', 'second = 0x1122BB44'])
+ substrs=['mine = ',
+ 'first = 0x001122AA', 'second = 0x1122BB44'])
self.runCmd("type format add -f hex int")
self.expect('frame variable mine',
- substrs = ['mine = ',
- 'first = 0x001122aa', 'second = 0x1122bb44'])
+ substrs=['mine = ',
+ 'first = 0x001122aa', 'second = 0x1122bb44'])
self.runCmd("type format delete int")
- self.runCmd("type summary add -s \"${var.first%X} and ${var.second%x}\" foo")
+ self.runCmd(
+ "type summary add -s \"${var.first%X} and ${var.second%x}\" foo")
self.expect('frame variable mine',
- substrs = ['(foo) mine = 0x001122AA and 0x1122bb44'])
+ substrs=['(foo) mine = 0x001122AA and 0x1122bb44'])
- self.runCmd("type summary add -s \"${var.first%X} and ${var.second%X}\" foo")
+ self.runCmd(
+ "type summary add -s \"${var.first%X} and ${var.second%X}\" foo")
self.runCmd("next")
self.runCmd("next")
self.expect('frame variable mine',
- substrs = ['(foo) mine = 0xAABBCCDD and 0x1122BB44'])
+ substrs=['(foo) mine = 0xAABBCCDD and 0x1122BB44'])
- self.runCmd("type summary add -s \"${var.first%x} and ${var.second%X}\" foo")
+ self.runCmd(
+ "type summary add -s \"${var.first%x} and ${var.second%X}\" foo")
self.expect('frame variable mine',
- substrs = ['(foo) mine = 0xaabbccdd and 0x1122BB44'])
+ substrs=['(foo) mine = 0xaabbccdd and 0x1122BB44'])
self.runCmd("next")
self.runCmd("next")
- self.runCmd("type summary add -s \"${var.first%x} and ${var.second%x}\" foo")
+ self.runCmd(
+ "type summary add -s \"${var.first%x} and ${var.second%x}\" foo")
self.expect('frame variable mine',
- substrs = ['(foo) mine = 0xaabbccdd and 0xff00ff00'])
- self.runCmd("type summary add -s \"${var.first%X} and ${var.second%X}\" foo")
+ substrs=['(foo) mine = 0xaabbccdd and 0xff00ff00'])
+ self.runCmd(
+ "type summary add -s \"${var.first%X} and ${var.second%X}\" foo")
self.expect('frame variable mine',
- substrs = ['(foo) mine = 0xAABBCCDD and 0xFF00FF00'])
+ substrs=['(foo) mine = 0xAABBCCDD and 0xFF00FF00'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/TestDataFormatterLanguageCategoryUpdates.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/TestDataFormatterLanguageCategoryUpdates.py
index f30733d2d81a..b7f60cfac41d 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/TestDataFormatterLanguageCategoryUpdates.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/language_category_updates/TestDataFormatterLanguageCategoryUpdates.py
@@ -5,12 +5,13 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class LanguageCategoryUpdatesTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -26,7 +27,11 @@ class LanguageCategoryUpdatesTestCase(TestBase):
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
def cleanup():
- if hasattr(self, 'type_category') and hasattr(self, 'type_specifier'):
+ if hasattr(
+ self,
+ 'type_category') and hasattr(
+ self,
+ 'type_specifier'):
self.type_category.DeleteTypeSummary(self.type_specifier)
# Execute the cleanup function during test case tear down.
@@ -35,25 +40,47 @@ class LanguageCategoryUpdatesTestCase(TestBase):
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
-
- self.expect("frame variable", substrs = ['(S)', 'object', '123', '456'], matching=True)
-
- self.type_category = self.dbg.GetCategory(lldb.eLanguageTypeC_plus_plus)
- type_summary = lldb.SBTypeSummary.CreateWithSummaryString("this is an object of type S")
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
+
+ self.expect(
+ "frame variable",
+ substrs=[
+ '(S)',
+ 'object',
+ '123',
+ '456'],
+ matching=True)
+
+ self.type_category = self.dbg.GetCategory(
+ lldb.eLanguageTypeC_plus_plus)
+ type_summary = lldb.SBTypeSummary.CreateWithSummaryString(
+ "this is an object of type S")
self.type_specifier = lldb.SBTypeNameSpecifier('S')
self.type_category.AddTypeSummary(self.type_specifier, type_summary)
- self.expect("frame variable", substrs = ['this is an object of type S'], matching=True)
-
- self.type_category.DeleteTypeSummary(self.type_specifier)
- self.expect("frame variable", substrs = ['this is an object of type S'], matching=False)
- self.expect("frame variable", substrs = ['(S)', 'object', '123', '456'], matching=True)
+ self.expect(
+ "frame variable",
+ substrs=['this is an object of type S'],
+ matching=True)
+ self.type_category.DeleteTypeSummary(self.type_specifier)
+ self.expect(
+ "frame variable",
+ substrs=['this is an object of type S'],
+ matching=False)
+ self.expect(
+ "frame variable",
+ substrs=[
+ '(S)',
+ 'object',
+ '123',
+ '456'],
+ matching=True)
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/nsarraysynth/TestNSArraySynthetic.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/nsarraysynth/TestNSArraySynthetic.py
index 871cc19373a4..87fc2d1802b7 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/nsarraysynth/TestNSArraySynthetic.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/nsarraysynth/TestNSArraySynthetic.py
@@ -5,14 +5,15 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
import datetime
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class NSArraySyntheticTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -29,14 +30,15 @@ class NSArraySyntheticTestCase(TestBase):
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -50,19 +52,59 @@ class NSArraySyntheticTestCase(TestBase):
# Now check that we are displaying Cocoa classes correctly
self.expect('frame variable arr',
- substrs = ['@"6 elements"'])
+ substrs=['@"6 elements"'])
self.expect('frame variable other_arr',
- substrs = ['@"4 elements"'])
- self.expect('frame variable arr --ptr-depth 1',
- substrs = ['@"6 elements"','[0] = 0x','[1] = 0x','[2] = 0x','[3] = 0x','[4] = 0x','[5] = 0x'])
- self.expect('frame variable other_arr --ptr-depth 1',
- substrs = ['@"4 elements"','[0] = 0x','[1] = 0x','[2] = 0x','[3] = 0x'])
- self.expect('frame variable arr --ptr-depth 1 -d no-run-target',
- substrs = ['@"6 elements"','@"hello"','@"world"','@"this"','@"is"','@"me"','@"http://www.apple.com'])
- self.expect('frame variable other_arr --ptr-depth 1 -d no-run-target',
- substrs = ['@"4 elements"','(int)5','@"a string"','@"6 elements"'])
- self.expect('frame variable other_arr --ptr-depth 2 -d no-run-target',
- substrs = ['@"4 elements"','@"6 elements" {','@"hello"','@"world"','@"this"','@"is"','@"me"','@"http://www.apple.com'])
+ substrs=['@"4 elements"'])
+ self.expect(
+ 'frame variable arr --ptr-depth 1',
+ substrs=[
+ '@"6 elements"',
+ '[0] = 0x',
+ '[1] = 0x',
+ '[2] = 0x',
+ '[3] = 0x',
+ '[4] = 0x',
+ '[5] = 0x'])
+ self.expect(
+ 'frame variable other_arr --ptr-depth 1',
+ substrs=[
+ '@"4 elements"',
+ '[0] = 0x',
+ '[1] = 0x',
+ '[2] = 0x',
+ '[3] = 0x'])
+ self.expect(
+ 'frame variable arr --ptr-depth 1 -d no-run-target',
+ substrs=[
+ '@"6 elements"',
+ '@"hello"',
+ '@"world"',
+ '@"this"',
+ '@"is"',
+ '@"me"',
+ '@"http://www.apple.com'])
+ self.expect(
+ 'frame variable other_arr --ptr-depth 1 -d no-run-target',
+ substrs=[
+ '@"4 elements"',
+ '(int)5',
+ '@"a string"',
+ '@"6 elements"'])
+ self.expect(
+ 'frame variable other_arr --ptr-depth 2 -d no-run-target',
+ substrs=[
+ '@"4 elements"',
+ '@"6 elements" {',
+ '@"hello"',
+ '@"world"',
+ '@"this"',
+ '@"is"',
+ '@"me"',
+ '@"http://www.apple.com'])
- self.assertTrue(self.frame().FindVariable("arr").MightHaveChildren(), "arr says it does not have children!")
- self.assertTrue(self.frame().FindVariable("other_arr").MightHaveChildren(), "arr says it does not have children!")
+ self.assertTrue(
+ self.frame().FindVariable("arr").MightHaveChildren(),
+ "arr says it does not have children!")
+ self.assertTrue(
+ self.frame().FindVariable("other_arr").MightHaveChildren(),
+ "arr says it does not have children!")
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/nsdictionarysynth/TestNSDictionarySynthetic.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/nsdictionarysynth/TestNSDictionarySynthetic.py
index 5ee54c3a2952..85675d211235 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/nsdictionarysynth/TestNSDictionarySynthetic.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/nsdictionarysynth/TestNSDictionarySynthetic.py
@@ -5,14 +5,15 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
import datetime
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class NSDictionarySyntheticTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -29,14 +30,15 @@ class NSDictionarySyntheticTestCase(TestBase):
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -50,21 +52,73 @@ class NSDictionarySyntheticTestCase(TestBase):
# Now check that we are displaying Cocoa classes correctly
self.expect('frame variable dictionary',
- substrs = ['3 key/value pairs'])
+ substrs=['3 key/value pairs'])
self.expect('frame variable mutabledict',
- substrs = ['4 key/value pairs'])
- self.expect('frame variable dictionary --ptr-depth 1',
- substrs = ['3 key/value pairs','[0] = ','key = 0x','value = 0x','[1] = ','[2] = '])
- self.expect('frame variable mutabledict --ptr-depth 1',
- substrs = ['4 key/value pairs','[0] = ','key = 0x','value = 0x','[1] = ','[2] = ','[3] = '])
- self.expect('frame variable dictionary --ptr-depth 1 --dynamic-type no-run-target',
- substrs = ['3 key/value pairs','@"bar"','@"2 elements"','@"baz"','2 key/value pairs'])
- self.expect('frame variable mutabledict --ptr-depth 1 --dynamic-type no-run-target',
- substrs = ['4 key/value pairs','(int)23','@"123"','@"http://www.apple.com"','@"sourceofstuff"','3 key/value pairs'])
- self.expect('frame variable mutabledict --ptr-depth 2 --dynamic-type no-run-target',
- substrs = ['4 key/value pairs','(int)23','@"123"','@"http://www.apple.com"','@"sourceofstuff"','3 key/value pairs','@"bar"','@"2 elements"'])
- self.expect('frame variable mutabledict --ptr-depth 3 --dynamic-type no-run-target',
- substrs = ['4 key/value pairs','(int)23','@"123"','@"http://www.apple.com"','@"sourceofstuff"','3 key/value pairs','@"bar"','@"2 elements"','(int)1','@"two"'])
+ substrs=['4 key/value pairs'])
+ self.expect(
+ 'frame variable dictionary --ptr-depth 1',
+ substrs=[
+ '3 key/value pairs',
+ '[0] = ',
+ 'key = 0x',
+ 'value = 0x',
+ '[1] = ',
+ '[2] = '])
+ self.expect(
+ 'frame variable mutabledict --ptr-depth 1',
+ substrs=[
+ '4 key/value pairs',
+ '[0] = ',
+ 'key = 0x',
+ 'value = 0x',
+ '[1] = ',
+ '[2] = ',
+ '[3] = '])
+ self.expect(
+ 'frame variable dictionary --ptr-depth 1 --dynamic-type no-run-target',
+ substrs=[
+ '3 key/value pairs',
+ '@"bar"',
+ '@"2 elements"',
+ '@"baz"',
+ '2 key/value pairs'])
+ self.expect(
+ 'frame variable mutabledict --ptr-depth 1 --dynamic-type no-run-target',
+ substrs=[
+ '4 key/value pairs',
+ '(int)23',
+ '@"123"',
+ '@"http://www.apple.com"',
+ '@"sourceofstuff"',
+ '3 key/value pairs'])
+ self.expect(
+ 'frame variable mutabledict --ptr-depth 2 --dynamic-type no-run-target',
+ substrs=[
+ '4 key/value pairs',
+ '(int)23',
+ '@"123"',
+ '@"http://www.apple.com"',
+ '@"sourceofstuff"',
+ '3 key/value pairs',
+ '@"bar"',
+ '@"2 elements"'])
+ self.expect(
+ 'frame variable mutabledict --ptr-depth 3 --dynamic-type no-run-target',
+ substrs=[
+ '4 key/value pairs',
+ '(int)23',
+ '@"123"',
+ '@"http://www.apple.com"',
+ '@"sourceofstuff"',
+ '3 key/value pairs',
+ '@"bar"',
+ '@"2 elements"',
+ '(int)1',
+ '@"two"'])
- self.assertTrue(self.frame().FindVariable("dictionary").MightHaveChildren(), "dictionary says it does not have children!")
- self.assertTrue(self.frame().FindVariable("mutabledict").MightHaveChildren(), "mutable says it does not have children!")
+ self.assertTrue(
+ self.frame().FindVariable("dictionary").MightHaveChildren(),
+ "dictionary says it does not have children!")
+ self.assertTrue(
+ self.frame().FindVariable("mutabledict").MightHaveChildren(),
+ "mutable says it does not have children!")
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/nssetsynth/TestNSSetSynthetic.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/nssetsynth/TestNSSetSynthetic.py
index d1680434d3b9..6affc5a71faf 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/nssetsynth/TestNSSetSynthetic.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/nssetsynth/TestNSSetSynthetic.py
@@ -5,14 +5,15 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
import datetime
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class NSSetSyntheticTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -29,14 +30,15 @@ class NSSetSyntheticTestCase(TestBase):
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -50,26 +52,64 @@ class NSSetSyntheticTestCase(TestBase):
# Now check that we are displaying Cocoa classes correctly
self.expect('frame variable set',
- substrs = ['4 elements'])
+ substrs=['4 elements'])
self.expect('frame variable mutable',
- substrs = ['9 elements'])
- self.expect('frame variable set --ptr-depth 1 -d run -T',
- substrs = ['4 elements','[0]','[1]','[2]','[3]','hello','world','(int)1','(int)2'])
- self.expect('frame variable mutable --ptr-depth 1 -d run -T',
- substrs = ['9 elements','(int)5','@"3 elements"','@"www.apple.com"','(int)3','@"world"','(int)4'])
+ substrs=['9 elements'])
+ self.expect(
+ 'frame variable set --ptr-depth 1 -d run -T',
+ substrs=[
+ '4 elements',
+ '[0]',
+ '[1]',
+ '[2]',
+ '[3]',
+ 'hello',
+ 'world',
+ '(int)1',
+ '(int)2'])
+ self.expect(
+ 'frame variable mutable --ptr-depth 1 -d run -T',
+ substrs=[
+ '9 elements',
+ '(int)5',
+ '@"3 elements"',
+ '@"www.apple.com"',
+ '(int)3',
+ '@"world"',
+ '(int)4'])
self.runCmd("next")
self.expect('frame variable mutable',
- substrs = ['0 elements'])
+ substrs=['0 elements'])
self.runCmd("next")
self.expect('frame variable mutable',
- substrs = ['4 elements'])
- self.expect('frame variable mutable --ptr-depth 1 -d run -T',
- substrs = ['4 elements','[0]','[1]','[2]','[3]','hello','world','(int)1','(int)2'])
+ substrs=['4 elements'])
+ self.expect(
+ 'frame variable mutable --ptr-depth 1 -d run -T',
+ substrs=[
+ '4 elements',
+ '[0]',
+ '[1]',
+ '[2]',
+ '[3]',
+ 'hello',
+ 'world',
+ '(int)1',
+ '(int)2'])
self.runCmd("next")
self.expect('frame variable mutable',
- substrs = ['4 elements'])
- self.expect('frame variable mutable --ptr-depth 1 -d run -T',
- substrs = ['4 elements','[0]','[1]','[2]','[3]','hello','world','(int)1','(int)2'])
+ substrs=['4 elements'])
+ self.expect(
+ 'frame variable mutable --ptr-depth 1 -d run -T',
+ substrs=[
+ '4 elements',
+ '[0]',
+ '[1]',
+ '[2]',
+ '[3]',
+ 'hello',
+ 'world',
+ '(int)1',
+ '(int)2'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/ostypeformatting/TestFormattersOsType.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/ostypeformatting/TestFormattersOsType.py
index 4158ec8a661c..7ffddc5ec673 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/ostypeformatting/TestFormattersOsType.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/ostypeformatting/TestFormattersOsType.py
@@ -5,14 +5,15 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
import datetime
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class DataFormatterOSTypeTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -29,14 +30,15 @@ class DataFormatterOSTypeTestCase(TestBase):
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.mm", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.mm", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -50,4 +52,4 @@ class DataFormatterOSTypeTestCase(TestBase):
# Now check that we use the right summary for OSType
self.expect('frame variable',
- substrs = ["'test'","'best'"])
+ substrs=["'test'", "'best'"])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/parray/TestPrintArray.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/parray/TestPrintArray.py
index 700b7418118a..49cda4ae6cc8 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/parray/TestPrintArray.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/parray/TestPrintArray.py
@@ -5,14 +5,15 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
import datetime
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class PrintArrayTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -32,14 +33,15 @@ class PrintArrayTestCase(TestBase):
"""Test that expr -Z works"""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -50,21 +52,85 @@ class PrintArrayTestCase(TestBase):
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
-
- self.expect('expr --element-count 3 -- data', substrs=['[0] = 1', '[1] = 3', '[2] = 5'])
+
+ self.expect(
+ 'expr --element-count 3 -- data',
+ substrs=[
+ '[0] = 1',
+ '[1] = 3',
+ '[2] = 5'])
self.expect('expr data', substrs=['int *', '$', '0x'])
- self.expect('expr -f binary --element-count 0 -- data', substrs=['int *', '$', '0b'])
- self.expect('expr -f hex --element-count 3 -- data', substrs=['[0] = 0x', '1', '[1] = 0x', '3', '[2] = 0x', '5'])
- self.expect('expr -f binary --element-count 2 -- data', substrs=['int *', '$', '0x', '[0] = 0b', '1', '[1] = 0b', '11'])
+ self.expect(
+ 'expr -f binary --element-count 0 -- data',
+ substrs=[
+ 'int *',
+ '$',
+ '0b'])
+ self.expect(
+ 'expr -f hex --element-count 3 -- data',
+ substrs=[
+ '[0] = 0x',
+ '1',
+ '[1] = 0x',
+ '3',
+ '[2] = 0x',
+ '5'])
+ self.expect(
+ 'expr -f binary --element-count 2 -- data',
+ substrs=[
+ 'int *',
+ '$',
+ '0x',
+ '[0] = 0b',
+ '1',
+ '[1] = 0b',
+ '11'])
self.expect('parray 3 data', substrs=['[0] = 1', '[1] = 3', '[2] = 5'])
- self.expect('parray `1 + 1 + 1` data', substrs=['[0] = 1', '[1] = 3', '[2] = 5'])
- self.expect('parray `data[1]` data', substrs=['[0] = 1', '[1] = 3', '[2] = 5'])
- self.expect('parray/x 3 data', substrs=['[0] = 0x', '1', '[1] = 0x', '3', '[2] = 0x', '5'])
- self.expect('parray/x `data[1]` data', substrs=['[0] = 0x', '1', '[1] = 0x', '3', '[2] = 0x', '5'])
+ self.expect(
+ 'parray `1 + 1 + 1` data',
+ substrs=[
+ '[0] = 1',
+ '[1] = 3',
+ '[2] = 5'])
+ self.expect(
+ 'parray `data[1]` data',
+ substrs=[
+ '[0] = 1',
+ '[1] = 3',
+ '[2] = 5'])
+ self.expect(
+ 'parray/x 3 data',
+ substrs=[
+ '[0] = 0x',
+ '1',
+ '[1] = 0x',
+ '3',
+ '[2] = 0x',
+ '5'])
+ self.expect(
+ 'parray/x `data[1]` data',
+ substrs=[
+ '[0] = 0x',
+ '1',
+ '[1] = 0x',
+ '3',
+ '[2] = 0x',
+ '5'])
# check error conditions
- self.expect('expr --element-count 10 -- 123', error=True, substrs=['expression cannot be used with --element-count as it does not refer to a pointer'])
- self.expect('expr --element-count 10 -- (void*)123', error=True, substrs=['expression cannot be used with --element-count as it refers to a pointer to void'])
- self.expect('parray data', error=True, substrs=["invalid element count 'data'"])
- self.expect('parray data data', error=True, substrs=["invalid element count 'data'"])
- self.expect('parray', error=True, substrs=['Not enough arguments provided'])
+ self.expect(
+ 'expr --element-count 10 -- 123',
+ error=True,
+ substrs=['expression cannot be used with --element-count as it does not refer to a pointer'])
+ self.expect(
+ 'expr --element-count 10 -- (void*)123',
+ error=True,
+ substrs=['expression cannot be used with --element-count as it refers to a pointer to void'])
+ self.expect('parray data', error=True, substrs=[
+ "invalid element count 'data'"])
+ self.expect(
+ 'parray data data',
+ error=True,
+ substrs=["invalid element count 'data'"])
+ self.expect('parray', error=True, substrs=[
+ 'Not enough arguments provided'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/poarray/TestPrintObjectArray.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/poarray/TestPrintObjectArray.py
index 7eb26a569867..83408e7b456e 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/poarray/TestPrintObjectArray.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/poarray/TestPrintObjectArray.py
@@ -5,14 +5,15 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
import datetime
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class PrintObjectArrayTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -33,14 +34,15 @@ class PrintObjectArrayTestCase(TestBase):
"""Test that expr -O -Z works"""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.mm", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.mm", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -52,9 +54,59 @@ class PrintObjectArrayTestCase(TestBase):
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
- self.expect('expr --element-count 3 --object-description -- objects', substrs=['3735928559', '4276993775', '3203398366', 'Hello', 'World', 'Two =', '1 ='])
- self.expect('poarray 3 objects', substrs=['3735928559', '4276993775', '3203398366', 'Hello', 'World', 'Two =', '1 ='])
- self.expect('expr --element-count 3 --object-description --description-verbosity=full -- objects', substrs=['[0] =', '3735928559', '4276993775', '3203398366', '[1] =', 'Hello', 'World', '[2] =', 'Two =', '1 ='])
- self.expect('parray 3 objects', substrs=['[0] = 0x', '[1] = 0x', '[2] = 0x'])
- self.expect('expr --element-count 3 -d run -- objects', substrs=['3 elements', '2 elements', '2 key/value pairs'])
- self.expect('expr --element-count 3 -d run --ptr-depth=1 -- objects', substrs=['3 elements', '2 elements', '2 key/value pairs', '3735928559', '4276993775', '3203398366', '"Hello"', '"World"'])
+ self.expect(
+ 'expr --element-count 3 --object-description -- objects',
+ substrs=[
+ '3735928559',
+ '4276993775',
+ '3203398366',
+ 'Hello',
+ 'World',
+ 'Two =',
+ '1 ='])
+ self.expect(
+ 'poarray 3 objects',
+ substrs=[
+ '3735928559',
+ '4276993775',
+ '3203398366',
+ 'Hello',
+ 'World',
+ 'Two =',
+ '1 ='])
+ self.expect(
+ 'expr --element-count 3 --object-description --description-verbosity=full -- objects',
+ substrs=[
+ '[0] =',
+ '3735928559',
+ '4276993775',
+ '3203398366',
+ '[1] =',
+ 'Hello',
+ 'World',
+ '[2] =',
+ 'Two =',
+ '1 ='])
+ self.expect(
+ 'parray 3 objects',
+ substrs=[
+ '[0] = 0x',
+ '[1] = 0x',
+ '[2] = 0x'])
+ self.expect(
+ 'expr --element-count 3 -d run -- objects',
+ substrs=[
+ '3 elements',
+ '2 elements',
+ '2 key/value pairs'])
+ self.expect(
+ 'expr --element-count 3 -d run --ptr-depth=1 -- objects',
+ substrs=[
+ '3 elements',
+ '2 elements',
+ '2 key/value pairs',
+ '3735928559',
+ '4276993775',
+ '3203398366',
+ '"Hello"',
+ '"World"'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/ptr_ref_typedef/TestPtrRef2Typedef.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/ptr_ref_typedef/TestPtrRef2Typedef.py
index bf98559cd0c1..69b9dd048871 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/ptr_ref_typedef/TestPtrRef2Typedef.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/ptr_ref_typedef/TestPtrRef2Typedef.py
@@ -5,12 +5,13 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class PtrRef2TypedefTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -20,20 +21,21 @@ class PtrRef2TypedefTestCase(TestBase):
TestBase.setUp(self)
# Find the line number to break at.
self.line = line_number('main.cpp', '// Set breakpoint here')
-
+
def test_with_run_command(self):
"""Test that a pointer/reference to a typedef is formatted as we want."""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -48,10 +50,18 @@ class PtrRef2TypedefTestCase(TestBase):
self.runCmd('type summary add --cascade true -s "IntLRef" "int &"')
self.runCmd('type summary add --cascade true -s "IntRRef" "int &&"')
- self.expect("frame variable x", substrs = ['(Foo *) x = 0x','IntPointer'])
+ self.expect(
+ "frame variable x",
+ substrs=[
+ '(Foo *) x = 0x',
+ 'IntPointer'])
# note: Ubuntu 12.04 x86_64 build with gcc 4.8.2 is getting a
# const after the ref that isn't showing up on FreeBSD. This
# tweak changes the behavior so that the const is not part of
# the match.
- self.expect("frame variable y", substrs = ['(Foo &', ') y = 0x','IntLRef'])
- self.expect("frame variable z", substrs = ['(Foo &&', ') z = 0x','IntRRef'])
+ self.expect(
+ "frame variable y", substrs=[
+ '(Foo &', ') y = 0x', 'IntLRef'])
+ self.expect(
+ "frame variable z", substrs=[
+ '(Foo &&', ') z = 0x', 'IntRRef'])
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/pyobjsynthprovider/Makefile
index 469c0809aa24..314f1cb2f077 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/Makefile
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/pyobjsynthprovider/Makefile
@@ -2,6 +2,4 @@ LEVEL = ../../../make
CXX_SOURCES := main.cpp
-ENABLE_THREADS := YES
-
include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/pyobjsynthprovider/TestPyObjSynthProvider.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/pyobjsynthprovider/TestPyObjSynthProvider.py
new file mode 100644
index 000000000000..01271b443d17
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/pyobjsynthprovider/TestPyObjSynthProvider.py
@@ -0,0 +1,73 @@
+"""
+Test lldb data formatter subsystem.
+"""
+
+from __future__ import print_function
+
+
+import datetime
+import os
+import time
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class PyObjectSynthProviderTestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+ NO_DEBUG_INFO_TESTCASE = True
+
+ @expectedFailureAll(oslist=["windows"])
+ def test_print_array(self):
+ """Test that expr -Z works"""
+ self.build()
+ self.provider_data_formatter_commands()
+
+ def setUp(self):
+ # Call super's setUp().
+ TestBase.setUp(self)
+ # Find the line number to break at.
+ self.line = line_number('main.cpp', 'break here')
+
+ def provider_data_formatter_commands(self):
+ """Test that the PythonObjectSyntheticChildProvider helper class works"""
+ self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
+
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ # The stop reason of the thread should be breakpoint.
+ self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
+
+ # This is the function to remove the custom formats in order to have a
+ # clean slate for the next test case.
+ def cleanup():
+ self.runCmd('type format clear', check=False)
+ self.runCmd('type summary clear', check=False)
+ self.runCmd('type synth clear', check=False)
+
+ # Execute the cleanup function during test case tear down.
+ self.addTearDownHook(cleanup)
+
+ self.runCmd('command script import provider.py')
+ self.runCmd(
+ 'type synthetic add Foo --python-class provider.SyntheticChildrenProvider')
+ self.expect('frame variable f.Name', substrs=['"Enrico"'])
+ self.expect(
+ 'frame variable f',
+ substrs=[
+ 'ID = 123456',
+ 'Name = "Enrico"',
+ 'Rate = 1.25'])
+ self.expect(
+ 'expression f',
+ substrs=[
+ 'ID = 123456',
+ 'Name = "Enrico"',
+ 'Rate = 1.25'])
diff --git a/packages/Python/lldbsuite/test/functionalities/type_lookup/main.m b/packages/Python/lldbsuite/test/functionalities/data-formatter/pyobjsynthprovider/main.cpp
index 058a0c00e92c..6745366fb121 100644
--- a/packages/Python/lldbsuite/test/functionalities/type_lookup/main.m
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/pyobjsynthprovider/main.cpp
@@ -1,4 +1,4 @@
-//===-- main.m ------------------------------------------------*- ObjC -*-===//
+//===-- main.cpp -------------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,10 +7,14 @@
//
//===----------------------------------------------------------------------===//
-#import <Foundation/Foundation.h>
-
-int main (int argc, const char * argv[])
+struct Foo
{
+ double x;
+ int y;
+ Foo() : x(3.1415), y(1234) {}
+};
+
+int main() {
+ Foo f;
return 0; // break here
}
-
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/pyobjsynthprovider/provider.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/pyobjsynthprovider/provider.py
new file mode 100644
index 000000000000..c263190c1028
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/pyobjsynthprovider/provider.py
@@ -0,0 +1,16 @@
+import lldb
+import lldb.formatters
+import lldb.formatters.synth
+
+
+class SyntheticChildrenProvider(
+ lldb.formatters.synth.PythonObjectSyntheticChildProvider):
+
+ def __init__(self, value, internal_dict):
+ lldb.formatters.synth.PythonObjectSyntheticChildProvider.__init__(
+ self, value, internal_dict)
+
+ def make_children(self):
+ return [("ID", 123456),
+ ("Name", "Enrico"),
+ ("Rate", 1.25)]
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/refpointer-recursion/TestDataFormatterRefPtrRecursion.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/refpointer-recursion/TestDataFormatterRefPtrRecursion.py
index 13b84e9f74c7..0a039107d842 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/refpointer-recursion/TestDataFormatterRefPtrRecursion.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/refpointer-recursion/TestDataFormatterRefPtrRecursion.py
@@ -5,12 +5,13 @@ Test that ValueObjectPrinter does not cause an infinite loop when a reference to
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class DataFormatterRefPtrRecursionTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -26,16 +27,17 @@ class DataFormatterRefPtrRecursionTestCase(TestBase):
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
- self.expect("frame variable foo", substrs = []);
- self.expect("frame variable foo --ptr-depth=1", substrs = ['ID = 1']);
- self.expect("frame variable foo --ptr-depth=2", substrs = ['ID = 1']);
- self.expect("frame variable foo --ptr-depth=3", substrs = ['ID = 1']);
+ self.expect("frame variable foo", substrs=[])
+ self.expect("frame variable foo --ptr-depth=1", substrs=['ID = 1'])
+ self.expect("frame variable foo --ptr-depth=2", substrs=['ID = 1'])
+ self.expect("frame variable foo --ptr-depth=3", substrs=['ID = 1'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/setvaluefromcstring/TestSetValueFromCString.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/setvaluefromcstring/TestSetValueFromCString.py
index 791ce27dad00..804905106dfc 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/setvaluefromcstring/TestSetValueFromCString.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/setvaluefromcstring/TestSetValueFromCString.py
@@ -1,4 +1,6 @@
from lldbsuite.test import lldbinline
from lldbsuite.test import decorators
-lldbinline.MakeInlineTest(__file__, globals(), [decorators.skipIfFreeBSD,decorators.skipIfLinux,decorators.skipIfWindows])
+lldbinline.MakeInlineTest(
+ __file__, globals(), [
+ decorators.skipIfFreeBSD, decorators.skipIfLinux, decorators.skipIfWindows])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/stringprinter/TestStringPrinter.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/stringprinter/TestStringPrinter.py
index e26344f2711a..c76b421a1ea8 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/stringprinter/TestStringPrinter.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/stringprinter/TestStringPrinter.py
@@ -1,4 +1,7 @@
from lldbsuite.test import lldbinline
from lldbsuite.test import decorators
-lldbinline.MakeInlineTest(__file__, globals(), [decorators.expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24772")])
+lldbinline.MakeInlineTest(
+ __file__, globals(), [
+ decorators.expectedFailureAll(
+ oslist=["windows"], bugnumber="llvm.org/pr24772")])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/summary-string-onfail/Test-rdar-9974002.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/summary-string-onfail/Test-rdar-9974002.py
index 2873e35368fb..d7862d2327cf 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/summary-string-onfail/Test-rdar-9974002.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/summary-string-onfail/Test-rdar-9974002.py
@@ -5,12 +5,13 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class Radar9974002DataFormatterTestCase(TestBase):
# test for rdar://problem/9974002 ()
@@ -26,18 +27,20 @@ class Radar9974002DataFormatterTestCase(TestBase):
"""Test that that file and class static variables display correctly."""
self.build()
if "clang" in self.getCompiler() and "3.4" in self.getCompilerVersion():
- self.skipTest("llvm.org/pr16214 -- clang emits partial DWARF for structures referenced via typedef")
+ self.skipTest(
+ "llvm.org/pr16214 -- clang emits partial DWARF for structures referenced via typedef")
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -47,87 +50,98 @@ class Radar9974002DataFormatterTestCase(TestBase):
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
- self.runCmd("type summary add -s \"${var.scalar} and ${var.pointer.first}\" container")
-
+ self.runCmd(
+ "type summary add -s \"${var.scalar} and ${var.pointer.first}\" container")
+
self.expect('frame variable mine',
- substrs = ['mine = ',
- '1', '<parent is NULL>'])
+ substrs=['mine = ',
+ '1', '<parent is NULL>'])
- self.runCmd("type summary add -s \"${var.scalar} and ${var.pointer}\" container")
+ self.runCmd(
+ "type summary add -s \"${var.scalar} and ${var.pointer}\" container")
self.expect('frame variable mine',
- substrs = ['mine = ',
- '1', '0x000000'])
+ substrs=['mine = ',
+ '1', '0x000000'])
- self.runCmd("type summary add -s \"${var.scalar} and ${var.pointer%S}\" container")
+ self.runCmd(
+ "type summary add -s \"${var.scalar} and ${var.pointer%S}\" container")
self.expect('frame variable mine',
- substrs = ['mine = ',
- '1', '0x000000'])
+ substrs=['mine = ',
+ '1', '0x000000'])
self.runCmd("type summary add -s foo contained")
self.expect('frame variable mine',
- substrs = ['mine = ',
- '1', 'foo'])
+ substrs=['mine = ',
+ '1', 'foo'])
- self.runCmd("type summary add -s \"${var.scalar} and ${var.pointer}\" container")
+ self.runCmd(
+ "type summary add -s \"${var.scalar} and ${var.pointer}\" container")
self.expect('frame variable mine',
- substrs = ['mine = ',
- '1', 'foo'])
+ substrs=['mine = ',
+ '1', 'foo'])
- self.runCmd("type summary add -s \"${var.scalar} and ${var.pointer%V}\" container")
+ self.runCmd(
+ "type summary add -s \"${var.scalar} and ${var.pointer%V}\" container")
self.expect('frame variable mine',
- substrs = ['mine = ',
- '1', '0x000000'])
+ substrs=['mine = ',
+ '1', '0x000000'])
- self.runCmd("type summary add -s \"${var.scalar} and ${var.pointer.first}\" container")
+ self.runCmd(
+ "type summary add -s \"${var.scalar} and ${var.pointer.first}\" container")
self.expect('frame variable mine',
- substrs = ['mine = ',
- '1', '<parent is NULL>'])
+ substrs=['mine = ',
+ '1', '<parent is NULL>'])
self.runCmd("type summary delete contained")
self.runCmd("n")
self.expect('frame variable mine',
- substrs = ['mine = ',
- '1', '<parent is NULL>'])
+ substrs=['mine = ',
+ '1', '<parent is NULL>'])
- self.runCmd("type summary add -s \"${var.scalar} and ${var.pointer}\" container")
+ self.runCmd(
+ "type summary add -s \"${var.scalar} and ${var.pointer}\" container")
self.expect('frame variable mine',
- substrs = ['mine = ',
- '1', '0x000000'])
+ substrs=['mine = ',
+ '1', '0x000000'])
- self.runCmd("type summary add -s \"${var.scalar} and ${var.pointer%S}\" container")
+ self.runCmd(
+ "type summary add -s \"${var.scalar} and ${var.pointer%S}\" container")
self.expect('frame variable mine',
- substrs = ['mine = ',
- '1', '0x000000'])
+ substrs=['mine = ',
+ '1', '0x000000'])
self.runCmd("type summary add -s foo contained")
self.expect('frame variable mine',
- substrs = ['mine = ',
- '1', 'foo'])
+ substrs=['mine = ',
+ '1', 'foo'])
- self.runCmd("type summary add -s \"${var.scalar} and ${var.pointer}\" container")
+ self.runCmd(
+ "type summary add -s \"${var.scalar} and ${var.pointer}\" container")
self.expect('frame variable mine',
- substrs = ['mine = ',
- '1', 'foo'])
+ substrs=['mine = ',
+ '1', 'foo'])
- self.runCmd("type summary add -s \"${var.scalar} and ${var.pointer%V}\" container")
+ self.runCmd(
+ "type summary add -s \"${var.scalar} and ${var.pointer%V}\" container")
self.expect('frame variable mine',
- substrs = ['mine = ',
- '1', '0x000000'])
+ substrs=['mine = ',
+ '1', '0x000000'])
- self.runCmd("type summary add -s \"${var.scalar} and ${var.pointer.first}\" container")
+ self.runCmd(
+ "type summary add -s \"${var.scalar} and ${var.pointer.first}\" container")
self.expect('frame variable mine',
- substrs = ['mine = ',
- '1', '<parent is NULL>'])
+ substrs=['mine = ',
+ '1', '<parent is NULL>'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/TestSyntheticCapping.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/TestSyntheticCapping.py
index e8b6c1ad95f5..6d519761b7bb 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/TestSyntheticCapping.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/TestSyntheticCapping.py
@@ -5,13 +5,14 @@ Check for an issue where capping does not work because the Target pointer appear
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class SyntheticCappingTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -27,7 +28,8 @@ class SyntheticCappingTestCase(TestBase):
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
@@ -35,8 +37,8 @@ class SyntheticCappingTestCase(TestBase):
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -45,7 +47,9 @@ class SyntheticCappingTestCase(TestBase):
self.runCmd('type summary clear', check=False)
self.runCmd('type filter clear', check=False)
self.runCmd('type synth clear', check=False)
- self.runCmd("settings set target.max-children-count 256", check=False)
+ self.runCmd(
+ "settings set target.max-children-count 256",
+ check=False)
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
@@ -60,25 +64,25 @@ class SyntheticCappingTestCase(TestBase):
else:
fake_a_val = 0x00000100
- # check that the synthetic children work, so we know we are doing the right thing
+ # check that the synthetic children work, so we know we are doing the
+ # right thing
self.expect("frame variable f00_1",
- substrs = ['r = 34',
- 'fake_a = %d' % fake_a_val,
- 'a = 1']);
+ substrs=['r = 34',
+ 'fake_a = %d' % fake_a_val,
+ 'a = 1'])
# check that capping works
self.runCmd("settings set target.max-children-count 2", check=False)
-
+
self.expect("frame variable f00_1",
- substrs = ['...',
- 'fake_a = %d' % fake_a_val,
- 'a = 1']);
-
+ substrs=['...',
+ 'fake_a = %d' % fake_a_val,
+ 'a = 1'])
+
self.expect("frame variable f00_1", matching=False,
- substrs = ['r = 34']);
+ substrs=['r = 34'])
-
self.runCmd("settings set target.max-children-count 256", check=False)
self.expect("frame variable f00_1", matching=True,
- substrs = ['r = 34']);
+ substrs=['r = 34'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/fooSynthProvider.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/fooSynthProvider.py
index 1a7e5679c0b8..124eb5d31bac 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/fooSynthProvider.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/fooSynthProvider.py
@@ -1,21 +1,27 @@
import lldb
+
+
class fooSynthProvider:
+
def __init__(self, valobj, dict):
- self.valobj = valobj;
+ self.valobj = valobj
self.int_type = valobj.GetType().GetBasicType(lldb.eBasicTypeInt)
+
def num_children(self):
- return 3;
+ return 3
+
def get_child_at_index(self, index):
if index == 0:
- child = self.valobj.GetChildMemberWithName('a');
+ child = self.valobj.GetChildMemberWithName('a')
if index == 1:
- child = self.valobj.CreateChildAtOffset ('fake_a', 1, self.int_type);
+ child = self.valobj.CreateChildAtOffset('fake_a', 1, self.int_type)
if index == 2:
- child = self.valobj.GetChildMemberWithName('r');
- return child;
+ child = self.valobj.GetChildMemberWithName('r')
+ return child
+
def get_child_index(self, name):
if name == 'a':
- return 0;
+ return 0
if name == 'fake_a':
- return 1;
- return 2;
+ return 1
+ return 2
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/synthupdate/TestSyntheticFilterRecompute.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/synthupdate/TestSyntheticFilterRecompute.py
index 23a31da685de..29c1214564d8 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/synthupdate/TestSyntheticFilterRecompute.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/synthupdate/TestSyntheticFilterRecompute.py
@@ -5,14 +5,15 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
import datetime
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class SyntheticFilterRecomputingTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -29,14 +30,15 @@ class SyntheticFilterRecomputingTestCase(TestBase):
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -49,27 +51,37 @@ class SyntheticFilterRecomputingTestCase(TestBase):
self.addTearDownHook(cleanup)
# Now run the bulk of the test
- id_x = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame().FindVariable("x")
+ id_x = self.dbg.GetSelectedTarget().GetProcess(
+ ).GetSelectedThread().GetSelectedFrame().FindVariable("x")
id_x.SetPreferDynamicValue(lldb.eDynamicCanRunTarget)
id_x.SetPreferSyntheticValue(True)
-
+
if self.TraceOn():
self.runCmd("expr --dynamic-type run-target --ptr-depth 1 -- x")
- self.assertTrue(id_x.GetSummary() == '@"5 elements"', "array does not get correct summary")
+ self.assertTrue(
+ id_x.GetSummary() == '@"5 elements"',
+ "array does not get correct summary")
self.runCmd("next")
self.runCmd("frame select 0")
- id_x = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame().FindVariable("x")
+ id_x = self.dbg.GetSelectedTarget().GetProcess(
+ ).GetSelectedThread().GetSelectedFrame().FindVariable("x")
id_x.SetPreferDynamicValue(lldb.eDynamicCanRunTarget)
id_x.SetPreferSyntheticValue(True)
if self.TraceOn():
self.runCmd("expr --dynamic-type run-target --ptr-depth 1 -- x")
- self.assertTrue(id_x.GetNumChildren() == 7, "dictionary does not have 7 children")
+ self.assertTrue(
+ id_x.GetNumChildren() == 7,
+ "dictionary does not have 7 children")
id_x.SetPreferSyntheticValue(False)
- self.assertFalse(id_x.GetNumChildren() == 7, "dictionary still looks synthetic")
+ self.assertFalse(
+ id_x.GetNumChildren() == 7,
+ "dictionary still looks synthetic")
id_x.SetPreferSyntheticValue(True)
- self.assertTrue(id_x.GetSummary() == "7 key/value pairs", "dictionary does not get correct summary")
+ self.assertTrue(
+ id_x.GetSummary() == "7 key/value pairs",
+ "dictionary does not get correct summary")
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/type_summary_list_arg/TestTypeSummaryListArg.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/type_summary_list_arg/TestTypeSummaryListArg.py
index 6568056f761b..1cc2a0e431ad 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/type_summary_list_arg/TestTypeSummaryListArg.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/type_summary_list_arg/TestTypeSummaryListArg.py
@@ -5,13 +5,14 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TypeSummaryListArgumentTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -23,9 +24,28 @@ class TypeSummaryListArgumentTestCase(TestBase):
@no_debug_info_test
def test_type_summary_list_with_arg(self):
"""Test that the 'type summary list' command handles command line arguments properly"""
- self.expect('type summary list Foo', substrs=['Category: default', 'Category: system'])
- self.expect('type summary list char', substrs=['char *', 'unsigned char'])
-
- self.expect('type summary list -w default', substrs=['system'], matching=False)
- self.expect('type summary list -w system unsigned', substrs=['default', '0-9'], matching=False)
- self.expect('type summary list -w system char', substrs=['unsigned char *'], matching=True)
+ self.expect(
+ 'type summary list Foo',
+ substrs=[
+ 'Category: default',
+ 'Category: system'])
+ self.expect(
+ 'type summary list char',
+ substrs=[
+ 'char *',
+ 'unsigned char'])
+
+ self.expect(
+ 'type summary list -w default',
+ substrs=['system'],
+ matching=False)
+ self.expect(
+ 'type summary list -w system unsigned',
+ substrs=[
+ 'default',
+ '0-9'],
+ matching=False)
+ self.expect(
+ 'type summary list -w system char',
+ substrs=['unsigned char *'],
+ matching=True)
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/type_summary_list_script/TestTypeSummaryListScript.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/type_summary_list_script/TestTypeSummaryListScript.py
index 63a4a3a4ba8c..2e66b800b15e 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/type_summary_list_script/TestTypeSummaryListScript.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/type_summary_list_script/TestTypeSummaryListScript.py
@@ -5,13 +5,14 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TypeSummaryListScriptTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -31,14 +32,15 @@ class TypeSummaryListScriptTestCase(TestBase):
"""Test printing out Python summary formatters."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -53,9 +55,11 @@ class TypeSummaryListScriptTestCase(TestBase):
self.runCmd("command script import tslsformatters.py")
- self.expect("frame variable myStruct", substrs=['A data formatter at work'])
-
- self.expect('type summary list', substrs=['Struct_SummaryFormatter'])
- self.expect('type summary list Struct', substrs=['Struct_SummaryFormatter'])
-
+ self.expect(
+ "frame variable myStruct",
+ substrs=['A data formatter at work'])
+ self.expect('type summary list', substrs=['Struct_SummaryFormatter'])
+ self.expect(
+ 'type summary list Struct',
+ substrs=['Struct_SummaryFormatter'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/type_summary_list_script/tslsformatters.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/type_summary_list_script/tslsformatters.py
index d1ce8b7db17a..03fe17bfe761 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/type_summary_list_script/tslsformatters.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/type_summary_list_script/tslsformatters.py
@@ -1,10 +1,12 @@
import lldb
+
def Struct_SummaryFormatter(valobj, internal_dict):
return 'A data formatter at work'
category = lldb.debugger.CreateCategory("TSLSFormatters")
category.SetEnabled(True)
-summary = lldb.SBTypeSummary.CreateWithFunctionName("tslsformatters.Struct_SummaryFormatter", lldb.eTypeOptionCascade)
+summary = lldb.SBTypeSummary.CreateWithFunctionName(
+ "tslsformatters.Struct_SummaryFormatter", lldb.eTypeOptionCascade)
spec = lldb.SBTypeNameSpecifier("Struct", False)
category.AddTypeSummary(spec, summary)
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/typedef_array/TestTypedefArray.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/typedef_array/TestTypedefArray.py
index 41b8c3499ccd..7e67f73b7092 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/typedef_array/TestTypedefArray.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/typedef_array/TestTypedefArray.py
@@ -1,4 +1,7 @@
from lldbsuite.test import lldbinline
from lldbsuite.test import decorators
-lldbinline.MakeInlineTest(__file__, globals(), [decorators.expectedFailureAll(compiler="gcc")])
+lldbinline.MakeInlineTest(
+ __file__, globals(), [
+ decorators.expectedFailureAll(
+ compiler="gcc")])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/user-format-vs-summary/TestUserFormatVsSummary.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/user-format-vs-summary/TestUserFormatVsSummary.py
index dba2816d2647..d970d11a2bab 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/user-format-vs-summary/TestUserFormatVsSummary.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/user-format-vs-summary/TestUserFormatVsSummary.py
@@ -5,12 +5,13 @@ Test that the user can input a format but it will not prevail over summary forma
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class UserFormatVSSummaryTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -26,16 +27,18 @@ class UserFormatVSSummaryTestCase(TestBase):
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
- self.expect("frame variable p1", substrs = ['(Pair) p1 = (x = 3, y = -3)']);
+ self.expect("frame variable p1", substrs=[
+ '(Pair) p1 = (x = 3, y = -3)'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -48,12 +51,24 @@ class UserFormatVSSummaryTestCase(TestBase):
self.runCmd('type summary add Pair -s "x=${var.x%d},y=${var.y%u}"')
- self.expect("frame variable p1", substrs = ['(Pair) p1 = x=3,y=4294967293']);
- self.expect("frame variable -f x p1", substrs = ['(Pair) p1 = x=0x00000003,y=0xfffffffd'], matching=False);
- self.expect("frame variable -f d p1", substrs = ['(Pair) p1 = x=3,y=-3'], matching=False);
- self.expect("frame variable p1", substrs = ['(Pair) p1 = x=3,y=4294967293']);
+ self.expect("frame variable p1", substrs=[
+ '(Pair) p1 = x=3,y=4294967293'])
+ self.expect(
+ "frame variable -f x p1",
+ substrs=['(Pair) p1 = x=0x00000003,y=0xfffffffd'],
+ matching=False)
+ self.expect(
+ "frame variable -f d p1",
+ substrs=['(Pair) p1 = x=3,y=-3'],
+ matching=False)
+ self.expect("frame variable p1", substrs=[
+ '(Pair) p1 = x=3,y=4294967293'])
self.runCmd('type summary add Pair -s "x=${var.x%x},y=${var.y%u}"')
- self.expect("frame variable p1", substrs = ['(Pair) p1 = x=0x00000003,y=4294967293']);
- self.expect("frame variable -f d p1", substrs = ['(Pair) p1 = x=3,y=-3'],matching=False);
+ self.expect("frame variable p1", substrs=[
+ '(Pair) p1 = x=0x00000003,y=4294967293'])
+ self.expect(
+ "frame variable -f d p1",
+ substrs=['(Pair) p1 = x=3,y=-3'],
+ matching=False)
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/var-in-aggregate-misuse/TestVarInAggregateMisuse.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/var-in-aggregate-misuse/TestVarInAggregateMisuse.py
index 5899469651d3..53073f6d910a 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/var-in-aggregate-misuse/TestVarInAggregateMisuse.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/var-in-aggregate-misuse/TestVarInAggregateMisuse.py
@@ -5,12 +5,13 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class VarInAggregateMisuseTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -26,14 +27,15 @@ class VarInAggregateMisuseTestCase(TestBase):
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -43,32 +45,36 @@ class VarInAggregateMisuseTestCase(TestBase):
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
- self.runCmd("type summary add --summary-string \"SUMMARY SUCCESS ${var}\" Summarize")
-
+ self.runCmd(
+ "type summary add --summary-string \"SUMMARY SUCCESS ${var}\" Summarize")
+
self.expect('frame variable mine_ptr',
- substrs = ['SUMMARY SUCCESS summarize_ptr_t @ '])
+ substrs=['SUMMARY SUCCESS summarize_ptr_t @ '])
self.expect('frame variable *mine_ptr',
- substrs = ['SUMMARY SUCCESS summarize_t @'])
+ substrs=['SUMMARY SUCCESS summarize_t @'])
- self.runCmd("type summary add --summary-string \"SUMMARY SUCCESS ${var.first}\" Summarize")
+ self.runCmd(
+ "type summary add --summary-string \"SUMMARY SUCCESS ${var.first}\" Summarize")
self.expect('frame variable mine_ptr',
- substrs = ['SUMMARY SUCCESS 10'])
+ substrs=['SUMMARY SUCCESS 10'])
self.expect('frame variable *mine_ptr',
- substrs = ['SUMMARY SUCCESS 10'])
+ substrs=['SUMMARY SUCCESS 10'])
self.runCmd("type summary add --summary-string \"${var}\" Summarize")
- self.runCmd("type summary add --summary-string \"${var}\" -e TwoSummarizes")
-
+ self.runCmd(
+ "type summary add --summary-string \"${var}\" -e TwoSummarizes")
+
self.expect('frame variable',
- substrs = ['(TwoSummarizes) twos = TwoSummarizes @ ',
- 'first = summarize_t @ ',
- 'second = summarize_t @ '])
-
- self.runCmd("type summary add --summary-string \"SUMMARY SUCCESS ${var.first}\" Summarize")
+ substrs=['(TwoSummarizes) twos = TwoSummarizes @ ',
+ 'first = summarize_t @ ',
+ 'second = summarize_t @ '])
+
+ self.runCmd(
+ "type summary add --summary-string \"SUMMARY SUCCESS ${var.first}\" Summarize")
self.expect('frame variable',
- substrs = ['(TwoSummarizes) twos = TwoSummarizes @ ',
- 'first = SUMMARY SUCCESS 1',
- 'second = SUMMARY SUCCESS 3'])
+ substrs=['(TwoSummarizes) twos = TwoSummarizes @ ',
+ 'first = SUMMARY SUCCESS 1',
+ 'second = SUMMARY SUCCESS 3'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/varscript_formatting/TestDataFormatterVarScriptFormatting.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/varscript_formatting/TestDataFormatterVarScriptFormatting.py
index f3eced625898..cde0ef409621 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/varscript_formatting/TestDataFormatterVarScriptFormatting.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/varscript_formatting/TestDataFormatterVarScriptFormatting.py
@@ -5,14 +5,15 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import os.path
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class PythonSynthDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -23,20 +24,21 @@ class PythonSynthDataFormatterTestCase(TestBase):
# Find the line number to break at.
self.line = line_number('main.cpp', ' // Set breakpoint here.')
- @skipIfFreeBSD # llvm.org/pr20545 bogus output confuses buildbot parser
+ @skipIfFreeBSD # llvm.org/pr20545 bogus output confuses buildbot parser
def test_with_run_command(self):
"""Test using Python synthetic children provider."""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -48,10 +50,11 @@ class PythonSynthDataFormatterTestCase(TestBase):
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
-
+
self.runCmd("command script import helperfunc.py")
- self.runCmd('type summary add -x "^something<.*>$" -s "T is a ${script.var:helperfunc.f}"')
+ self.runCmd(
+ 'type summary add -x "^something<.*>$" -s "T is a ${script.var:helperfunc.f}"')
+
+ self.expect("frame variable x", substrs=['T is a non-pointer type'])
- self.expect("frame variable x", substrs = ['T is a non-pointer type']);
-
- self.expect("frame variable y", substrs = ['T is a pointer type']);
+ self.expect("frame variable y", substrs=['T is a pointer type'])
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/varscript_formatting/helperfunc.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/varscript_formatting/helperfunc.py
index 01562c5baa8d..75654e4b4ed7 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/varscript_formatting/helperfunc.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/varscript_formatting/helperfunc.py
@@ -1,5 +1,6 @@
import lldb
-def f(value,d):
- return "pointer type" if value.GetType().GetTemplateArgumentType(0).IsPointerType() else "non-pointer type"
+def f(value, d):
+ return "pointer type" if value.GetType().GetTemplateArgumentType(
+ 0).IsPointerType() else "non-pointer type"
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/vector-types/TestVectorTypesFormatting.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/vector-types/TestVectorTypesFormatting.py
index 365ddff3c7e8..2d4cd5782fdd 100644
--- a/packages/Python/lldbsuite/test/functionalities/data-formatter/vector-types/TestVectorTypesFormatting.py
+++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/vector-types/TestVectorTypesFormatting.py
@@ -5,13 +5,14 @@ Check that vector types format properly
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class VectorTypesFormattingTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -23,20 +24,21 @@ class VectorTypesFormattingTestCase(TestBase):
self.line = line_number('main.cpp', '// break here')
# rdar://problem/14035604
- @skipIf(compiler='gcc') # gcc don't have ext_vector_type extension
+ @skipIf(compiler='gcc') # gcc don't have ext_vector_type extension
def test_with_run_command(self):
"""Check that vector types format properly"""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -46,29 +48,43 @@ class VectorTypesFormattingTestCase(TestBase):
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
- pass # my code never fails
-
+ pass # my code never fails
+
v = self.frame().FindVariable("v")
v.SetPreferSyntheticValue(True)
v.SetFormat(lldb.eFormatVectorOfFloat32)
-
- if self.TraceOn(): print(v)
-
- self.assertTrue(v.GetNumChildren() == 4, "v as float32[] has 4 children")
- self.assertTrue(v.GetChildAtIndex(0).GetData().float[0] == 1.25, "child 0 == 1.25")
- self.assertTrue(v.GetChildAtIndex(1).GetData().float[0] == 1.25, "child 1 == 1.25")
- self.assertTrue(v.GetChildAtIndex(2).GetData().float[0] == 2.50, "child 2 == 2.50")
- self.assertTrue(v.GetChildAtIndex(3).GetData().float[0] == 2.50, "child 3 == 2.50")
-
- self.expect("expr -f int16_t[] -- v", substrs=['(0, 16288, 0, 16288, 0, 16416, 0, 16416)'])
- self.expect("expr -f uint128_t[] -- v", substrs=['(85236745249553456609335044694184296448)'])
- self.expect("expr -f float32[] -- v", substrs=['(1.25, 1.25, 2.5, 2.5)'])
-
+
+ if self.TraceOn():
+ print(v)
+
+ self.assertTrue(
+ v.GetNumChildren() == 4,
+ "v as float32[] has 4 children")
+ self.assertTrue(v.GetChildAtIndex(0).GetData().float[
+ 0] == 1.25, "child 0 == 1.25")
+ self.assertTrue(v.GetChildAtIndex(1).GetData().float[
+ 0] == 1.25, "child 1 == 1.25")
+ self.assertTrue(v.GetChildAtIndex(2).GetData().float[
+ 0] == 2.50, "child 2 == 2.50")
+ self.assertTrue(v.GetChildAtIndex(3).GetData().float[
+ 0] == 2.50, "child 3 == 2.50")
+
+ self.expect("expr -f int16_t[] -- v",
+ substrs=['(0, 16288, 0, 16288, 0, 16416, 0, 16416)'])
+ self.expect("expr -f uint128_t[] -- v",
+ substrs=['(85236745249553456609335044694184296448)'])
+ self.expect(
+ "expr -f float32[] -- v",
+ substrs=['(1.25, 1.25, 2.5, 2.5)'])
+
oldValue = v.GetChildAtIndex(0).GetValue()
v.SetFormat(lldb.eFormatHex)
newValue = v.GetChildAtIndex(0).GetValue()
- self.assertFalse(oldValue == newValue, "values did not change along with format")
-
+ self.assertFalse(oldValue == newValue,
+ "values did not change along with format")
+
v.SetFormat(lldb.eFormatVectorOfFloat32)
oldValueAgain = v.GetChildAtIndex(0).GetValue()
- self.assertTrue(oldValue == oldValueAgain, "same format but different values")
+ self.assertTrue(
+ oldValue == oldValueAgain,
+ "same format but different values")
diff --git a/packages/Python/lldbsuite/test/functionalities/dead-strip/TestDeadStrip.py b/packages/Python/lldbsuite/test/functionalities/dead-strip/TestDeadStrip.py
index efbaa69eef57..355d60ade90f 100644
--- a/packages/Python/lldbsuite/test/functionalities/dead-strip/TestDeadStrip.py
+++ b/packages/Python/lldbsuite/test/functionalities/dead-strip/TestDeadStrip.py
@@ -5,21 +5,26 @@ Test that breakpoint works correctly in the presence of dead-code stripping.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class DeadStripTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")
@expectedFailureAll(debug_info="dwo", bugnumber="llvm.org/pr25087")
- @expectedFailureAll(oslist=["linux"], debug_info="gmodules", bugnumber="llvm.org/pr27865")
- @skipIfFreeBSD # The -dead_strip linker option isn't supported on FreeBSD versions of ld.
+ @expectedFailureAll(
+ oslist=["linux"],
+ debug_info="gmodules",
+ bugnumber="llvm.org/pr27865")
+ # The -dead_strip linker option isn't supported on FreeBSD versions of ld.
+ @skipIfFreeBSD
def test(self):
"""Test breakpoint works correctly with dead-code stripping."""
self.build()
@@ -27,34 +32,37 @@ class DeadStripTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break by function name f1 (live code).
- lldbutil.run_break_set_by_symbol (self, "f1", num_expected_locations=1, module_name="a.out")
+ lldbutil.run_break_set_by_symbol(
+ self, "f1", num_expected_locations=1, module_name="a.out")
# Break by function name f2 (dead code).
- lldbutil.run_break_set_by_symbol (self, "f2", num_expected_locations=0, module_name="a.out")
+ lldbutil.run_break_set_by_symbol(
+ self, "f2", num_expected_locations=0, module_name="a.out")
# Break by function name f3 (live code).
- lldbutil.run_break_set_by_symbol (self, "f3", num_expected_locations=1, module_name="a.out")
+ lldbutil.run_break_set_by_symbol(
+ self, "f3", num_expected_locations=1, module_name="a.out")
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint (breakpoint #1).
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'a.out`f1',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'a.out`f1',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f 1", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
self.runCmd("continue")
# The stop reason of the thread should be breakpoint (breakpoint #3).
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'a.out`f3',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'a.out`f3',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f 3", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
diff --git a/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py b/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py
index be0ea1441333..e5d81d8cefc0 100644
--- a/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py
+++ b/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py
@@ -5,29 +5,37 @@ Test some lldb command abbreviations.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class DisassemblyTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @expectedFailureAll(oslist=["windows"], bugnumber="function names print fully demangled instead of name-only")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="function names print fully demangled instead of name-only")
def test(self):
self.build()
- exe = os.path.join (os.getcwd(), "a.out")
+ exe = os.path.join(os.getcwd(), "a.out")
self.expect("file " + exe,
- patterns = [ "Current executable set to .*a.out.*" ])
+ patterns=["Current executable set to .*a.out.*"])
- match_object = lldbutil.run_break_set_command (self, "br s -n sum")
- lldbutil.check_breakpoint_result (self, match_object, symbol_name='sum', symbol_match_exact=False, num_locations=1)
+ match_object = lldbutil.run_break_set_command(self, "br s -n sum")
+ lldbutil.check_breakpoint_result(
+ self,
+ match_object,
+ symbol_name='sum',
+ symbol_match_exact=False,
+ num_locations=1)
self.expect("run",
- patterns = [ "Process .* launched: "])
+ patterns=["Process .* launched: "])
self.runCmd("dis -f")
disassembly = self.res.GetOutput()
@@ -40,7 +48,7 @@ class DisassemblyTestCase(TestBase):
elif arch in ["arm", "aarch64"]:
breakpoint_opcodes = ["brk", "udf"]
instructions = [' add ', ' ldr ', ' str ']
- elif re.match("mips" , arch):
+ elif re.match("mips", arch):
breakpoint_opcodes = ["break"]
instructions = ['lw', 'sw']
elif arch in ["s390x"]:
@@ -48,11 +56,17 @@ class DisassemblyTestCase(TestBase):
instructions = [' l ', ' a ', ' st ']
else:
# TODO please add your arch here
- self.fail('unimplemented for arch = "{arch}"'.format(arch=self.getArchitecture()))
+ self.fail(
+ 'unimplemented for arch = "{arch}"'.format(
+ arch=self.getArchitecture()))
# make sure that the software breakpoint has been removed
for op in breakpoint_opcodes:
self.assertFalse(op in disassembly)
# make sure a few reasonable assembly instructions are here
- self.expect(disassembly, exe=False, startstr = "a.out`sum", substrs = instructions)
+ self.expect(
+ disassembly,
+ exe=False,
+ startstr="a.out`sum",
+ substrs=instructions)
diff --git a/packages/Python/lldbsuite/test/functionalities/dynamic_value_child_count/TestDynamicValueChildCount.py b/packages/Python/lldbsuite/test/functionalities/dynamic_value_child_count/TestDynamicValueChildCount.py
index 37593768f4a8..79e4e627592c 100644
--- a/packages/Python/lldbsuite/test/functionalities/dynamic_value_child_count/TestDynamicValueChildCount.py
+++ b/packages/Python/lldbsuite/test/functionalities/dynamic_value_child_count/TestDynamicValueChildCount.py
@@ -5,32 +5,33 @@ Test that dynamic values update their child count correctly
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class DynamicValueChildCountTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
def setUp(self):
- # Call super's setUp().
+ # Call super's setUp().
TestBase.setUp(self)
- # Find the line number to break for main.c.
+ # Find the line number to break for main.c.
- self.main_third_call_line = line_number('pass-to-base.cpp',
- '// Break here and check b has 0 children')
- self.main_fourth_call_line = line_number('pass-to-base.cpp',
- '// Break here and check b still has 0 children')
- self.main_fifth_call_line = line_number('pass-to-base.cpp',
- '// Break here and check b has one child now')
- self.main_sixth_call_line = line_number('pass-to-base.cpp',
- '// Break here and check b has 0 children again')
+ self.main_third_call_line = line_number(
+ 'pass-to-base.cpp', '// Break here and check b has 0 children')
+ self.main_fourth_call_line = line_number(
+ 'pass-to-base.cpp', '// Break here and check b still has 0 children')
+ self.main_fifth_call_line = line_number(
+ 'pass-to-base.cpp', '// Break here and check b has one child now')
+ self.main_sixth_call_line = line_number(
+ 'pass-to-base.cpp', '// Break here and check b has 0 children again')
@add_test_categories(['pyapi'])
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24663")
@@ -42,26 +43,31 @@ class DynamicValueChildCountTestCase(TestBase):
# Create a target from the debugger.
- target = self.dbg.CreateTarget (exe)
+ target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
# Set up our breakpoints:
- third_call_bpt = target.BreakpointCreateByLocation('pass-to-base.cpp', self.main_third_call_line)
+ third_call_bpt = target.BreakpointCreateByLocation(
+ 'pass-to-base.cpp', self.main_third_call_line)
self.assertTrue(third_call_bpt,
VALID_BREAKPOINT)
- fourth_call_bpt = target.BreakpointCreateByLocation('pass-to-base.cpp', self.main_fourth_call_line)
+ fourth_call_bpt = target.BreakpointCreateByLocation(
+ 'pass-to-base.cpp', self.main_fourth_call_line)
self.assertTrue(fourth_call_bpt,
VALID_BREAKPOINT)
- fifth_call_bpt = target.BreakpointCreateByLocation('pass-to-base.cpp', self.main_fifth_call_line)
+ fifth_call_bpt = target.BreakpointCreateByLocation(
+ 'pass-to-base.cpp', self.main_fifth_call_line)
self.assertTrue(fifth_call_bpt,
VALID_BREAKPOINT)
- sixth_call_bpt = target.BreakpointCreateByLocation('pass-to-base.cpp', self.main_sixth_call_line)
+ sixth_call_bpt = target.BreakpointCreateByLocation(
+ 'pass-to-base.cpp', self.main_sixth_call_line)
self.assertTrue(sixth_call_bpt,
VALID_BREAKPOINT)
# Now launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process.GetState() == lldb.eStateStopped,
PROCESS_STOPPED)
@@ -73,4 +79,6 @@ class DynamicValueChildCountTestCase(TestBase):
self.runCmd("continue")
self.assertTrue(b.GetNumChildren() != 0, "b now has 1 child")
self.runCmd("continue")
- self.assertTrue(b.GetNumChildren() == 0, "b didn't go back to 0 children")
+ self.assertTrue(
+ b.GetNumChildren() == 0,
+ "b didn't go back to 0 children")
diff --git a/packages/Python/lldbsuite/test/functionalities/embedded_interpreter/TestConvenienceVariables.py b/packages/Python/lldbsuite/test/functionalities/embedded_interpreter/TestConvenienceVariables.py
index 4b1880dee96f..937ac9270019 100644
--- a/packages/Python/lldbsuite/test/functionalities/embedded_interpreter/TestConvenienceVariables.py
+++ b/packages/Python/lldbsuite/test/functionalities/embedded_interpreter/TestConvenienceVariables.py
@@ -3,13 +3,13 @@
from __future__ import print_function
-
import os
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ConvenienceVariablesCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -20,9 +20,11 @@ class ConvenienceVariablesCase(TestBase):
# Find the line number to break on inside main.cpp.
self.line = line_number('main.c', 'Hello world.')
- @skipIfFreeBSD # llvm.org/pr17228
+ @skipIfFreeBSD # llvm.org/pr17228
@skipIfRemote
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
def test_with_run_commands(self):
"""Test convenience variables lldb.debugger, lldb.target, lldb.process, lldb.thread, and lldb.frame."""
self.build()
@@ -32,7 +34,9 @@ class ConvenienceVariablesCase(TestBase):
python_prompt = ">>> "
# So that the child gets torn down after the test.
- self.child = pexpect.spawn('%s %s %s' % (lldbtest_config.lldbExec, self.lldbOption, exe))
+ self.child = pexpect.spawn(
+ '%s %s %s' %
+ (lldbtest_config.lldbExec, self.lldbOption, exe))
child = self.child
# Turn on logging for what the child sends back.
if self.TraceOn():
@@ -56,25 +60,49 @@ class ConvenienceVariablesCase(TestBase):
child.sendline('print(lldb.debugger)')
child.expect_exact(python_prompt)
self.expect(child.before, exe=False,
- patterns = ['Debugger \(instance: .*, id: \d\)'])
+ patterns=['Debugger \(instance: .*, id: \d\)'])
child.sendline('print(lldb.target)')
child.expect_exact(python_prompt)
self.expect(child.before, exe=False,
- substrs = ['a.out'])
+ substrs=['a.out'])
child.sendline('print(lldb.process)')
child.expect_exact(python_prompt)
- self.expect(child.before, exe=False,
- patterns = ['SBProcess: pid = \d+, state = stopped, threads = \d, executable = a.out'])
+ self.expect(child.before, exe=False, patterns=[
+ 'SBProcess: pid = \d+, state = stopped, threads = \d, executable = a.out'])
- child.sendline('print(lldb.thread)')
+ child.sendline('print(lldb.thread.GetStopDescription(100))')
child.expect_exact(python_prompt)
- # Linux outputs decimal tid and 'name' instead of 'queue'
- self.expect(child.before, exe=False,
- patterns = ['thread #1: tid = (0x[0-9a-f]+|[0-9]+), 0x[0-9a-f]+ a\.out`main\(argc=1, argv=0x[0-9a-f]+\) \+ \d+ at main\.c:%d, (name|queue) = \'.+\', stop reason = breakpoint 1\.1' % self.line])
+ self.expect(
+ child.before,
+ exe=False,
+ patterns=[
+ 'breakpoint 1\.1'])
- child.sendline('print(lldb.frame)')
+ child.sendline('lldb.frame.GetLineEntry().GetLine()')
child.expect_exact(python_prompt)
- self.expect(child.before, exe=False,
- patterns = ['frame #0: 0x[0-9a-f]+ a\.out`main\(argc=1, argv=0x[0-9a-f]+\) \+ \d+ at main\.c:%d' % self.line])
+ line_number = "%d"%(self.line)
+ self.expect(
+ child.before,
+ exe=False,
+ substrs=[
+ line_number])
+
+ child.sendline('lldb.frame.GetLineEntry().GetFileSpec().GetFilename()')
+ child.expect_exact(python_prompt)
+ line_number = "%d"%(self.line)
+ self.expect(
+ child.before,
+ exe=False,
+ substrs=[
+ "main.c"])
+
+ child.sendline('lldb.frame.GetFunctionName()')
+ child.expect_exact(python_prompt)
+ line_number = "%d"%(self.line)
+ self.expect(
+ child.before,
+ exe=False,
+ substrs=[
+ "main"])
diff --git a/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py b/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py
index 912d51fb6b02..65271c3894b8 100644
--- a/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py
+++ b/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py
@@ -4,7 +4,6 @@ Test some lldb command abbreviations.
from __future__ import print_function
-
import lldb
import os
import time
@@ -13,50 +12,60 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
-def execute_command (command):
+
+def execute_command(command):
#print('%% %s' % (command))
(exit_status, output) = seven.get_command_status_output(command)
- #if output:
+ # if output:
# print(output)
#print('status = %u' % (exit_status))
return exit_status
+
class ExecTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipUnlessDarwin
+ @expectedFailureAll(archs=['i386'], bugnumber="rdar://28656532")
def test(self):
if self.getArchitecture() == 'x86_64':
- source = os.path.join (os.getcwd(), "main.cpp")
- o_file = os.path.join (os.getcwd(), "main.o")
- execute_command ("'%s' -g -O0 -arch i386 -arch x86_64 '%s' -c -o '%s'" % (os.environ["CC"], source, o_file))
- execute_command ("'%s' -g -O0 -arch i386 -arch x86_64 '%s'" % (os.environ["CC"], o_file))
+ source = os.path.join(os.getcwd(), "main.cpp")
+ o_file = os.path.join(os.getcwd(), "main.o")
+ execute_command(
+ "'%s' -g -O0 -arch i386 -arch x86_64 '%s' -c -o '%s'" %
+ (os.environ["CC"], source, o_file))
+ execute_command(
+ "'%s' -g -O0 -arch i386 -arch x86_64 '%s'" %
+ (os.environ["CC"], o_file))
if self.debug_info != "dsym":
- dsym_path = os.path.join (os.getcwd(), "a.out.dSYM")
- execute_command ("rm -rf '%s'" % (dsym_path))
+ dsym_path = os.path.join(os.getcwd(), "a.out.dSYM")
+ execute_command("rm -rf '%s'" % (dsym_path))
else:
self.build()
- exe = os.path.join (os.getcwd(), "a.out")
-
+ exe = os.path.join(os.getcwd(), "a.out")
+
# Create the target
target = self.dbg.CreateTarget(exe)
-
+
# Create any breakpoints we need
- breakpoint = target.BreakpointCreateBySourceRegex ('Set breakpoint 1 here', lldb.SBFileSpec ("main.cpp", False))
+ breakpoint = target.BreakpointCreateBySourceRegex(
+ 'Set breakpoint 1 here', lldb.SBFileSpec("main.cpp", False))
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Launch the process
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
-
+
for i in range(6):
# The stop reason of the thread should be breakpoint.
self.assertTrue(process.GetState() == lldb.eStateStopped,
STOPPED_DUE_TO_BREAKPOINT)
- threads = lldbutil.get_threads_stopped_at_breakpoint(process, breakpoint)
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ process, breakpoint)
self.assertTrue(len(threads) == 1)
# We had a deadlock tearing down the TypeSystemMap on exec, but only if some
@@ -65,21 +74,28 @@ class ExecTestCase(TestBase):
thread = threads[0]
value = thread.frames[0].EvaluateExpression("1 + 2")
- self.assertTrue(value.IsValid(), "Expression evaluated successfully")
+ self.assertTrue(
+ value.IsValid(),
+ "Expression evaluated successfully")
int_value = value.GetValueAsSigned()
self.assertTrue(int_value == 3, "Expression got the right result.")
# Run and we should stop due to exec
process.Continue()
-
+
self.assertTrue(process.GetState() == lldb.eStateStopped,
"Process should be stopped at __dyld_start")
-
- threads = lldbutil.get_stopped_threads(process, lldb.eStopReasonExec)
- self.assertTrue(len(threads) == 1, "We got a thread stopped for exec.")
- # Run and we should stop at breakpoint in main after exec
- process.Continue()
+ threads = lldbutil.get_stopped_threads(
+ process, lldb.eStopReasonExec)
+ self.assertTrue(
+ len(threads) == 1,
+ "We got a thread stopped for exec.")
+
+ # Run and we should stop at breakpoint in main after exec
+ process.Continue()
- threads = lldbutil.get_threads_stopped_at_breakpoint(process, breakpoint)
- self.assertTrue(len(threads) == 1, "Stopped at breakpoint in exec'ed process.")
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ process, breakpoint)
+ self.assertTrue(len(threads) == 1,
+ "Stopped at breakpoint in exec'ed process.")
diff --git a/packages/Python/lldbsuite/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py b/packages/Python/lldbsuite/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py
index 1492fe069220..21d4357a6ff1 100644
--- a/packages/Python/lldbsuite/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py
+++ b/packages/Python/lldbsuite/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py
@@ -5,14 +5,15 @@ Test that expr will time out and allow other threads to run if it blocks.
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ExprDoesntDeadlockTestCase(TestBase):
def getCategories(self):
@@ -21,7 +22,9 @@ class ExprDoesntDeadlockTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr17946')
- @expectedFailureAll(oslist=["windows"], bugnumber="Windows doesn't have pthreads, test needs to be ported")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="Windows doesn't have pthreads, test needs to be ported")
def test_with_run_command(self):
"""Test that expr will time out and allow other threads to run if it blocks."""
self.build()
@@ -31,10 +34,12 @@ class ExprDoesntDeadlockTestCase(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- # Now create a breakpoint at source line before call_me_to_get_lock gets called.
+ # Now create a breakpoint at source line before call_me_to_get_lock
+ # gets called.
- main_file_spec = lldb.SBFileSpec ("locking.c")
- breakpoint = target.BreakpointCreateBySourceRegex('Break here', main_file_spec)
+ main_file_spec = lldb.SBFileSpec("locking.c")
+ breakpoint = target.BreakpointCreateBySourceRegex(
+ 'Break here', main_file_spec)
if self.TraceOn():
print("breakpoint:", breakpoint)
self.assertTrue(breakpoint and
@@ -42,16 +47,19 @@ class ExprDoesntDeadlockTestCase(TestBase):
VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# Frame #0 should be on self.line1 and the break condition should hold.
from lldbsuite.test.lldbutil import get_stopped_thread
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint condition")
frame0 = thread.GetFrameAtIndex(0)
- var = frame0.EvaluateExpression ("call_me_to_get_lock()")
- self.assertTrue (var.IsValid())
- self.assertTrue (var.GetValueAsSigned (0) == 567)
+ var = frame0.EvaluateExpression("call_me_to_get_lock()")
+ self.assertTrue(var.IsValid())
+ self.assertTrue(var.GetValueAsSigned(0) == 567)
diff --git a/packages/Python/lldbsuite/test/functionalities/fat_archives/TestFatArchives.py b/packages/Python/lldbsuite/test/functionalities/fat_archives/TestFatArchives.py
index 6d2763c1ead1..d62ccbff87fa 100644
--- a/packages/Python/lldbsuite/test/functionalities/fat_archives/TestFatArchives.py
+++ b/packages/Python/lldbsuite/test/functionalities/fat_archives/TestFatArchives.py
@@ -4,7 +4,6 @@ Test some lldb command abbreviations.
from __future__ import print_function
-
import lldb
import os
import time
@@ -13,47 +12,50 @@ 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 FatArchiveTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
+ NO_DEBUG_INFO_TESTCASE = True
+
@skipUnlessDarwin
- def test (self):
+ def test_breakpoint_resolution_dwarf(self):
if self.getArchitecture() == 'x86_64':
- execute_command ("make CC='%s'" % (os.environ["CC"]))
- self.main ()
+ self.build()
+ self.main()
else:
- self.skipTest("This test requires x86_64 as the architecture for the inferior")
+ self.skipTest(
+ "This test requires x86_64 as the architecture for the inferior")
- def main (self):
+ def main(self):
'''This test compiles a quick example by making a fat file (universal) full of
skinny .o files and makes sure we can use them to resolve breakpoints when doing
DWARF in .o file debugging. The only thing this test needs to do is to compile and
set a breakpoint in the target and verify any breakpoint locations have valid debug
info for the function, and source file and line.'''
- exe = os.path.join (os.getcwd(), "a.out")
-
+ exe = os.path.join(os.getcwd(), "a.out")
+
# Create the target
target = self.dbg.CreateTarget(exe)
-
+
# Create a breakpoint by name
- breakpoint = target.BreakpointCreateByName ('foo', exe)
+ breakpoint = target.BreakpointCreateByName('foo', exe)
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Make sure the breakpoint resolves to a function, file and line
for bp_loc in breakpoint:
- # Get a section offset address (lldb.SBAddress) from the breakpoint location
+ # Get a section offset address (lldb.SBAddress) from the breakpoint
+ # location
bp_loc_addr = bp_loc.GetAddress()
line_entry = bp_loc_addr.GetLineEntry()
function = bp_loc_addr.GetFunction()
- self.assertTrue(function.IsValid(), "Verify breakpoint in fat BSD archive has valid function debug info")
- self.assertTrue(line_entry.GetFileSpec(), "Verify breakpoint in fat BSD archive has source file information")
- self.assertTrue(line_entry.GetLine() != 0, "Verify breakpoint in fat BSD archive has source line information")
+ self.assertTrue(
+ function.IsValid(),
+ "Verify breakpoint in fat BSD archive has valid function debug info")
+ self.assertTrue(
+ line_entry.GetFileSpec(),
+ "Verify breakpoint in fat BSD archive has source file information")
+ self.assertTrue(
+ line_entry.GetLine() != 0,
+ "Verify breakpoint in fat BSD archive has source line information")
diff --git a/packages/Python/lldbsuite/test/functionalities/format/TestFormats.py b/packages/Python/lldbsuite/test/functionalities/format/TestFormats.py
index 0ba036124b03..b7592c93704d 100644
--- a/packages/Python/lldbsuite/test/functionalities/format/TestFormats.py
+++ b/packages/Python/lldbsuite/test/functionalities/format/TestFormats.py
@@ -5,24 +5,28 @@ Test the command history mechanism
from __future__ import print_function
-
import os
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestFormats(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
+ @expectedFailureAll(
+ hostoslist=["windows"],
+ bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
def test_formats(self):
"""Test format string functionality."""
self.build()
import pexpect
prompt = "(lldb) "
- child = pexpect.spawn('%s %s -x -o "b main" -o r a.out' % (lldbtest_config.lldbExec, self.lldbOption))
+ child = pexpect.spawn(
+ '%s %s -x -o "b main" -o r a.out' %
+ (lldbtest_config.lldbExec, self.lldbOption))
# Turn on logging for what the child sends back.
if self.TraceOn():
child.logfile_read = sys.stdout
@@ -30,13 +34,13 @@ class TestFormats(TestBase):
self.child = child
# Substitute 'Help!' for 'help' using the 'commands regex' mechanism.
- child.expect_exact(prompt + 'target create "a.out"')
- child.expect_exact(prompt + 'b main')
- child.expect_exact(prompt + 'r')
+ child.expect_exact(prompt + 'target create "a.out"')
+ child.expect_exact(prompt + 'b main')
+ child.expect_exact(prompt + 'r')
child.expect_exact(prompt)
child.sendline()
- # child.expect_exact(prompt + "target create")
- #
+ # child.expect_exact(prompt + "target create")
+ #
# child.sendline("command regex 'Help__'")
# child.expect_exact(regex_prompt)
# child.sendline('s/^$/help/')
@@ -51,7 +55,7 @@ class TestFormats(TestBase):
# child.sendline('command unalias Help__')
# child.expect_exact("error: 'Help__' is not an alias, it is a debugger command which can be removed using the 'command delete' command")
# child.expect_exact(prompt)
- #
+ #
# # Delete the regex command using "command delete"
# child.sendline('command delete Help__')
# child.expect_exact(prompt)
diff --git a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/Makefile b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/Makefile
new file mode 100644
index 000000000000..b09a579159d4
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+C_SOURCES := main.c
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/TestArray.py b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/TestArray.py
new file mode 100644
index 000000000000..46264f3dfe8d
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/TestArray.py
@@ -0,0 +1,29 @@
+"""
+Test the output of `frame diagnose` for an array access
+"""
+
+from __future__ import print_function
+
+import os
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestArray(TestBase):
+ mydir = TestBase.compute_mydir(__file__)
+
+ @skipUnlessDarwin
+ def test_array(self):
+ TestBase.setUp(self)
+ self.build()
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+ self.runCmd("run", RUN_SUCCEEDED)
+ self.expect("thread list", "Thread should be stopped",
+ substrs=['stopped'])
+ self.expect(
+ "frame diagnose",
+ "Crash diagnosis was accurate",
+ substrs=["a[10]"])
diff --git a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/main.c b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/main.c
new file mode 100644
index 000000000000..95c6515e5f54
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/main.c
@@ -0,0 +1,9 @@
+struct Foo {
+ int b;
+ int c;
+};
+
+int main() {
+ struct Foo *a = 0;
+ return a[10].c;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/bad-reference/Makefile b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/bad-reference/Makefile
new file mode 100644
index 000000000000..314f1cb2f077
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/bad-reference/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/bad-reference/TestBadReference.py b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/bad-reference/TestBadReference.py
new file mode 100644
index 000000000000..dd8ff949fa98
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/bad-reference/TestBadReference.py
@@ -0,0 +1,26 @@
+"""
+Test the output of `frame diagnose` for dereferencing a bad reference
+"""
+
+from __future__ import print_function
+
+import os
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestBadReference(TestBase):
+ mydir = TestBase.compute_mydir(__file__)
+
+ @skipUnlessDarwin
+ def test_bad_reference(self):
+ TestBase.setUp(self)
+ self.build()
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+ self.runCmd("run", RUN_SUCCEEDED)
+ self.expect("thread list", "Thread should be stopped",
+ substrs=['stopped'])
+ self.expect("frame diagnose", "Crash diagnosis was accurate", "f->b")
diff --git a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/bad-reference/main.cpp b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/bad-reference/main.cpp
new file mode 100644
index 000000000000..2f61152e3985
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/bad-reference/main.cpp
@@ -0,0 +1,22 @@
+struct Bar {
+ int c;
+ int d;
+};
+
+struct Foo {
+ int a;
+ struct Bar &b;
+};
+
+struct Foo *GetAFoo() {
+ static struct Foo f = { 0, *((Bar*)0) };
+ return &f;
+}
+
+int GetSum(struct Foo *f) {
+ return f->a + f->b.d;
+}
+
+int main() {
+ return GetSum(GetAFoo());
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/complicated-expression/Makefile b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/complicated-expression/Makefile
new file mode 100644
index 000000000000..b09a579159d4
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/complicated-expression/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+C_SOURCES := main.c
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/complicated-expression/TestComplicatedExpression.py b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/complicated-expression/TestComplicatedExpression.py
new file mode 100644
index 000000000000..a8708169bb3b
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/complicated-expression/TestComplicatedExpression.py
@@ -0,0 +1,29 @@
+"""
+Test the output of `frame diagnose` for a subexpression of a complicated expression
+"""
+
+from __future__ import print_function
+
+import os
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestDiagnoseDereferenceArgument(TestBase):
+ mydir = TestBase.compute_mydir(__file__)
+
+ @skipUnlessDarwin
+ def test_diagnose_dereference_argument(self):
+ TestBase.setUp(self)
+ self.build()
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+ self.runCmd("run", RUN_SUCCEEDED)
+ self.expect("thread list", "Thread should be stopped",
+ substrs=['stopped'])
+ self.expect(
+ "frame diagnose",
+ "Crash diagnosis was accurate",
+ "f->b->d")
diff --git a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/complicated-expression/main.c b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/complicated-expression/main.c
new file mode 100644
index 000000000000..147aae946140
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/complicated-expression/main.c
@@ -0,0 +1,26 @@
+struct Bar {
+ int c;
+ int d;
+};
+
+struct Foo {
+ int a;
+ struct Bar *b;
+};
+
+struct Foo *GetAFoo() {
+ static struct Foo f = { 0, 0 };
+ return &f;
+}
+
+int SumTwoIntegers(int x, int y) {
+ return x + y;
+}
+
+int GetSum(struct Foo *f) {
+ return SumTwoIntegers(f->a, f->b->d ? 0 : 1);
+}
+
+int main() {
+ return GetSum(GetAFoo());
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-argument/Makefile b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-argument/Makefile
new file mode 100644
index 000000000000..b09a579159d4
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-argument/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+C_SOURCES := main.c
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-argument/TestDiagnoseDereferenceArgument.py b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-argument/TestDiagnoseDereferenceArgument.py
new file mode 100644
index 000000000000..80128eec1f7e
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-argument/TestDiagnoseDereferenceArgument.py
@@ -0,0 +1,29 @@
+"""
+Test the output of `frame diagnose` for dereferencing a function argument
+"""
+
+from __future__ import print_function
+
+import os
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestDiagnoseDereferenceArgument(TestBase):
+ mydir = TestBase.compute_mydir(__file__)
+
+ @skipUnlessDarwin
+ def test_diagnose_dereference_argument(self):
+ TestBase.setUp(self)
+ self.build()
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+ self.runCmd("run", RUN_SUCCEEDED)
+ self.expect("thread list", "Thread should be stopped",
+ substrs=['stopped'])
+ self.expect(
+ "frame diagnose",
+ "Crash diagnosis was accurate",
+ "f->b->d")
diff --git a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-argument/main.c b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-argument/main.c
new file mode 100644
index 000000000000..0ec23b13be16
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-argument/main.c
@@ -0,0 +1,22 @@
+struct Bar {
+ int c;
+ int d;
+};
+
+struct Foo {
+ int a;
+ struct Bar *b;
+};
+
+struct Foo *GetAFoo() {
+ static struct Foo f = { 0, 0 };
+ return &f;
+}
+
+int GetSum(struct Foo *f) {
+ return f->a + f->b->d;
+}
+
+int main() {
+ return GetSum(GetAFoo());
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-function-return/Makefile b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-function-return/Makefile
new file mode 100644
index 000000000000..314f1cb2f077
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-function-return/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-function-return/TestDiagnoseDereferenceFunctionReturn.py b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-function-return/TestDiagnoseDereferenceFunctionReturn.py
new file mode 100644
index 000000000000..5e097afdc9b6
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-function-return/TestDiagnoseDereferenceFunctionReturn.py
@@ -0,0 +1,32 @@
+"""
+Test the output of `frame diagnose` for dereferencing a function's return value
+"""
+
+from __future__ import print_function
+
+import os
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestDiagnoseDereferenceFunctionReturn(TestBase):
+ mydir = TestBase.compute_mydir(__file__)
+
+ @skipUnlessDarwin
+ @expectedFailureAll(oslist=['macosx'], archs=['i386'], bugnumber="rdar://28656408")
+ def test_diagnose_dereference_function_return(self):
+ TestBase.setUp(self)
+ self.build()
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+ self.runCmd("run", RUN_SUCCEEDED)
+ self.expect("thread list", "Thread should be stopped",
+ substrs=['stopped'])
+ self.expect(
+ "frame diagnose",
+ "Crash diagnosis was accurate",
+ substrs=[
+ "GetAFoo",
+ "->b"])
diff --git a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-function-return/main.c b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-function-return/main.c
new file mode 100644
index 000000000000..420e6f21de6b
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-function-return/main.c
@@ -0,0 +1,12 @@
+struct Foo {
+ int a;
+ int b;
+};
+
+struct Foo *GetAFoo() {
+ return 0;
+}
+
+int main() {
+ return GetAFoo()->b;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-this/Makefile b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-this/Makefile
new file mode 100644
index 000000000000..314f1cb2f077
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-this/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-this/TestDiagnoseDereferenceThis.py b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-this/TestDiagnoseDereferenceThis.py
new file mode 100644
index 000000000000..233c9e403bd2
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-this/TestDiagnoseDereferenceThis.py
@@ -0,0 +1,29 @@
+"""
+Test the output of `frame diagnose` for dereferencing `this`
+"""
+
+from __future__ import print_function
+
+import os
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestDiagnoseDereferenceThis(TestBase):
+ mydir = TestBase.compute_mydir(__file__)
+
+ @skipUnlessDarwin
+ def test_diagnose_dereference_this(self):
+ TestBase.setUp(self)
+ self.build()
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+ self.runCmd("run", RUN_SUCCEEDED)
+ self.expect("thread list", "Thread should be stopped",
+ substrs=['stopped'])
+ self.expect(
+ "frame diagnose",
+ "Crash diagnosis was accurate",
+ "this->a")
diff --git a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-this/main.cpp b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-this/main.cpp
new file mode 100644
index 000000000000..1f177230ed90
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/dereference-this/main.cpp
@@ -0,0 +1,15 @@
+struct Foo {
+ int a;
+ int b;
+ int Sum() { return a + b; }
+};
+
+struct Foo *GetAFoo() {
+ return (struct Foo*)0;
+}
+
+int main() {
+ struct Foo *foo = GetAFoo();
+ return foo->Sum();
+}
+
diff --git a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/inheritance/Makefile b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/inheritance/Makefile
new file mode 100644
index 000000000000..314f1cb2f077
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/inheritance/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/inheritance/TestDiagnoseInheritance.py b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/inheritance/TestDiagnoseInheritance.py
new file mode 100644
index 000000000000..267223ad0854
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/inheritance/TestDiagnoseInheritance.py
@@ -0,0 +1,26 @@
+"""
+Test the output of `frame diagnose` for calling virtual methods
+"""
+
+from __future__ import print_function
+
+import os
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestDiagnoseInheritance(TestBase):
+ mydir = TestBase.compute_mydir(__file__)
+
+ @skipUnlessDarwin
+ def test_diagnose_inheritance(self):
+ TestBase.setUp(self)
+ self.build()
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+ self.runCmd("run", RUN_SUCCEEDED)
+ self.expect("thread list", "Thread should be stopped",
+ substrs=['stopped'])
+ self.expect("frame diagnose", "Crash diagnosis was accurate", "d")
diff --git a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/inheritance/main.cpp b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/inheritance/main.cpp
new file mode 100644
index 000000000000..78cac2c89653
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/inheritance/main.cpp
@@ -0,0 +1,69 @@
+#include <stdio.h>
+#include <stdint.h>
+
+class A
+{
+public:
+ A(int a) :
+ m_a(a)
+ {
+ }
+ virtual ~A(){}
+ virtual int get2() const { return m_a; }
+ virtual int get() const { return m_a; }
+protected:
+ int m_a;
+};
+
+class B : public A
+{
+public:
+ B(int a, int b) :
+ A(a),
+ m_b(b)
+ {
+ }
+
+ ~B() override
+ {
+ }
+
+ int get2() const override
+ {
+ return m_b;
+ }
+ int get() const override
+ {
+ return m_b;
+ }
+
+protected:
+ int m_b;
+};
+
+struct C
+{
+ C(int c) : m_c(c){}
+ virtual ~C(){}
+ int m_c;
+};
+
+class D : public C, public B
+{
+public:
+ D(int a, int b, int c, int d) :
+ C(c),
+ B(a, b),
+ m_d(d)
+ {
+ }
+protected:
+ int m_d;
+};
+int main (int argc, char const *argv[], char const *envp[])
+{
+ D *good_d = new D(1, 2, 3, 4);
+ D *d = nullptr;
+ return d->get();
+}
+
diff --git a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/local-variable/Makefile b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/local-variable/Makefile
new file mode 100644
index 000000000000..b09a579159d4
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/local-variable/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+C_SOURCES := main.c
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/local-variable/TestLocalVariable.py b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/local-variable/TestLocalVariable.py
new file mode 100644
index 000000000000..a1a17c941760
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/local-variable/TestLocalVariable.py
@@ -0,0 +1,26 @@
+"""
+Test the output of `frame diagnose` for dereferencing a local variable
+"""
+
+from __future__ import print_function
+
+import os
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestLocalVariable(TestBase):
+ mydir = TestBase.compute_mydir(__file__)
+
+ @skipUnlessDarwin
+ def test_local_variable(self):
+ TestBase.setUp(self)
+ self.build()
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+ self.runCmd("run", RUN_SUCCEEDED)
+ self.expect("thread list", "Thread should be stopped",
+ substrs=['stopped'])
+ self.expect("frame diagnose", "Crash diagnosis was accurate", "myInt")
diff --git a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/local-variable/main.c b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/local-variable/main.c
new file mode 100644
index 000000000000..33307beb0703
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/local-variable/main.c
@@ -0,0 +1,4 @@
+int main() {
+ int *myInt = 0;
+ return *myInt;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/virtual-method-call/Makefile b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/virtual-method-call/Makefile
new file mode 100644
index 000000000000..314f1cb2f077
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/virtual-method-call/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/virtual-method-call/TestDiagnoseDereferenceVirtualMethodCall.py b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/virtual-method-call/TestDiagnoseDereferenceVirtualMethodCall.py
new file mode 100644
index 000000000000..adf092d86157
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/virtual-method-call/TestDiagnoseDereferenceVirtualMethodCall.py
@@ -0,0 +1,26 @@
+"""
+Test the output of `frame diagnose` for calling virtual methods
+"""
+
+from __future__ import print_function
+
+import os
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestDiagnoseVirtualMethodCall(TestBase):
+ mydir = TestBase.compute_mydir(__file__)
+
+ @skipUnlessDarwin
+ def test_diagnose_virtual_method_call(self):
+ TestBase.setUp(self)
+ self.build()
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+ self.runCmd("run", RUN_SUCCEEDED)
+ self.expect("thread list", "Thread should be stopped",
+ substrs=['stopped'])
+ self.expect("frame diagnose", "Crash diagnosis was accurate", "foo")
diff --git a/packages/Python/lldbsuite/test/functionalities/frame-diagnose/virtual-method-call/main.cpp b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/virtual-method-call/main.cpp
new file mode 100644
index 000000000000..2a03dc11bf29
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/frame-diagnose/virtual-method-call/main.cpp
@@ -0,0 +1,16 @@
+class Foo {
+public:
+ int a;
+ int b;
+ virtual int Sum() { return a + b; }
+};
+
+struct Foo *GetAFoo() {
+ return (struct Foo*)0;
+}
+
+int main() {
+ struct Foo *foo = GetAFoo();
+ return foo->Sum();
+}
+
diff --git a/packages/Python/lldbsuite/test/functionalities/frame_var_scope/Makefile b/packages/Python/lldbsuite/test/functionalities/frame_var_scope/Makefile
new file mode 100644
index 000000000000..f5a47fcc46cc
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/frame_var_scope/Makefile
@@ -0,0 +1,3 @@
+LEVEL = ../../make
+C_SOURCES := main.c
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/frame_var_scope/TestFrameVariableScope.py b/packages/Python/lldbsuite/test/functionalities/frame_var_scope/TestFrameVariableScope.py
new file mode 100644
index 000000000000..48e49ed009ba
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/frame_var_scope/TestFrameVariableScope.py
@@ -0,0 +1,5 @@
+from lldbsuite.test import lldbinline
+from lldbsuite.test import decorators
+
+lldbinline.MakeInlineTest(
+ __file__, globals(), [])
diff --git a/packages/Python/lldbsuite/test/functionalities/frame_var_scope/main.c b/packages/Python/lldbsuite/test/functionalities/frame_var_scope/main.c
new file mode 100644
index 000000000000..80beb29cf34f
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/frame_var_scope/main.c
@@ -0,0 +1,21 @@
+//===-- main.c --------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int foo(int x, int y) {
+ int z = 3 + x;
+ return z + y; //% self.expect("frame variable -s", substrs=['ARG: (int) x = -3','ARG: (int) y = 0'])
+ //% self.expect("frame variable -s x", substrs=['ARG: (int) x = -3'])
+ //% self.expect("frame variable -s y", substrs=['ARG: (int) y = 0'])
+ //% self.expect("frame variable -s z", substrs=['LOCAL: (int) z = 0'])
+}
+
+int main (int argc, char const *argv[])
+{
+ return foo(-3,0); //% self.expect("frame variable -s argc argv", substrs=['ARG: (int) argc ='])
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/inferior-assert/TestInferiorAssert.py b/packages/Python/lldbsuite/test/functionalities/inferior-assert/TestInferiorAssert.py
index ceeb2eadaf4f..7b048fedebba 100644
--- a/packages/Python/lldbsuite/test/functionalities/inferior-assert/TestInferiorAssert.py
+++ b/packages/Python/lldbsuite/test/functionalities/inferior-assert/TestInferiorAssert.py
@@ -3,79 +3,117 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test import lldbutil
from lldbsuite.test import lldbplatformutil
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
+
class AssertingInferiorTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21793: need to implement support for detecting assertion / abort on Windows")
- @expectedFailureAll(oslist=["linux"], archs=["arm"], bugnumber="llvm.org/pr25338")
- @expectedFailureAll(bugnumber="llvm.org/pr26592", triple = '^mips')
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr21793: need to implement support for detecting assertion / abort on Windows")
+ @expectedFailureAll(
+ oslist=["linux"],
+ archs=["arm"],
+ bugnumber="llvm.org/pr25338")
+ @expectedFailureAll(bugnumber="llvm.org/pr26592", triple='^mips')
def test_inferior_asserting(self):
"""Test that lldb reliably catches the inferior asserting (command)."""
self.build()
self.inferior_asserting()
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21793: need to implement support for detecting assertion / abort on Windows")
- @expectedFailureAndroid(api_levels=list(range(16 + 1))) # b.android.com/179836
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr21793: need to implement support for detecting assertion / abort on Windows")
+ @expectedFailureAndroid(
+ api_levels=list(
+ range(
+ 16 +
+ 1))) # b.android.com/179836
def test_inferior_asserting_register(self):
"""Test that lldb reliably reads registers from the inferior after asserting (command)."""
self.build()
self.inferior_asserting_registers()
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21793: need to implement support for detecting assertion / abort on Windows")
- @expectedFailureAll(oslist=["linux"], archs=["aarch64", "arm"], bugnumber="llvm.org/pr25338")
- @expectedFailureAll(bugnumber="llvm.org/pr26592", triple = '^mips')
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr21793: need to implement support for detecting assertion / abort on Windows")
+ @expectedFailureAll(
+ oslist=["linux"],
+ archs=[
+ "aarch64",
+ "arm"],
+ bugnumber="llvm.org/pr25338")
+ @expectedFailureAll(bugnumber="llvm.org/pr26592", triple='^mips')
def test_inferior_asserting_disassemble(self):
"""Test that lldb reliably disassembles frames after asserting (command)."""
self.build()
self.inferior_asserting_disassemble()
@add_test_categories(['pyapi'])
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21793: need to implement support for detecting assertion / abort on Windows")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr21793: need to implement support for detecting assertion / abort on Windows")
def test_inferior_asserting_python(self):
"""Test that lldb reliably catches the inferior asserting (Python API)."""
self.build()
self.inferior_asserting_python()
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21793: need to implement support for detecting assertion / abort on Windows")
- @expectedFailureAll(oslist=["linux"], archs=["aarch64", "arm"], bugnumber="llvm.org/pr25338")
- @expectedFailureAll(bugnumber="llvm.org/pr26592", triple = '^mips')
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr21793: need to implement support for detecting assertion / abort on Windows")
+ @expectedFailureAll(
+ oslist=["linux"],
+ archs=[
+ "aarch64",
+ "arm"],
+ bugnumber="llvm.org/pr25338")
+ @expectedFailureAll(bugnumber="llvm.org/pr26592", triple='^mips')
def test_inferior_asserting_expr(self):
"""Test that the lldb expression interpreter can read from the inferior after asserting (command)."""
self.build()
self.inferior_asserting_expr()
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21793: need to implement support for detecting assertion / abort on Windows")
- @expectedFailureAll(oslist=["linux"], archs=["aarch64", "arm"], bugnumber="llvm.org/pr25338")
- @expectedFailureAll(bugnumber="llvm.org/pr26592", triple = '^mips')
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr21793: need to implement support for detecting assertion / abort on Windows")
+ @expectedFailureAll(
+ oslist=["linux"],
+ archs=[
+ "aarch64",
+ "arm"],
+ bugnumber="llvm.org/pr25338")
+ @expectedFailureAll(bugnumber="llvm.org/pr26592", triple='^mips')
def test_inferior_asserting_step(self):
"""Test that lldb functions correctly after stepping through a call to assert()."""
self.build()
self.inferior_asserting_step()
def set_breakpoint(self, line):
- lldbutil.run_break_set_by_file_and_line (self, "main.c", line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", line, num_expected_locations=1, loc_exact=True)
def check_stop_reason(self):
- matched = lldbplatformutil.match_android_device(self.getArchitecture(), valid_api_levels=list(range(1, 16+1)))
+ matched = lldbplatformutil.match_android_device(
+ self.getArchitecture(), valid_api_levels=list(range(1, 16 + 1)))
if matched:
- # On android until API-16 the abort() call ended in a sigsegv instead of in a sigabrt
+ # On android until API-16 the abort() call ended in a sigsegv
+ # instead of in a sigabrt
stop_reason = 'stop reason = signal SIGSEGV'
else:
stop_reason = 'stop reason = signal SIGABRT'
# The stop reason of the thread should be an abort signal or exception.
self.expect("thread list", STOPPED_DUE_TO_ASSERT,
- substrs = ['stopped',
- stop_reason])
+ substrs=['stopped',
+ stop_reason])
return stop_reason
@@ -95,12 +133,12 @@ class AssertingInferiorTestCase(TestBase):
# And it should report a backtrace that includes the assert site.
self.expect("thread backtrace all",
- substrs = [stop_reason, 'main', 'argc', 'argv'])
+ substrs=[stop_reason, 'main', 'argc', 'argv'])
# And it should report the correct line number.
self.expect("thread backtrace all",
- substrs = [stop_reason,
- 'main.c:%d' % self.line])
+ substrs=[stop_reason,
+ 'main.c:%d' % self.line])
def inferior_asserting_python(self):
"""Inferior asserts upon launching; lldb should catch the event and stop."""
@@ -111,7 +149,8 @@ class AssertingInferiorTestCase(TestBase):
# Now launch the process, and do not stop at entry point.
# Both argv and envp are null.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
if process.GetState() != lldb.eStateStopped:
self.fail("Process should be in the 'stopped' state, "
@@ -133,7 +172,8 @@ class AssertingInferiorTestCase(TestBase):
self.runCmd("run", RUN_SUCCEEDED)
self.check_stop_reason()
- # lldb should be able to read from registers from the inferior after asserting.
+ # lldb should be able to read from registers from the inferior after
+ # asserting.
lldbplatformutil.check_first_register_readable(self)
def inferior_asserting_disassemble(self):
@@ -145,7 +185,7 @@ class AssertingInferiorTestCase(TestBase):
self.assertTrue(target, VALID_TARGET)
# Launch the process, and do not stop at the entry point.
- target.LaunchSimple (None, None, self.get_process_working_directory())
+ target.LaunchSimple(None, None, self.get_process_working_directory())
self.check_stop_reason()
process = target.GetProcess()
@@ -154,17 +194,20 @@ class AssertingInferiorTestCase(TestBase):
thread = process.GetThreadAtIndex(0)
self.assertTrue(thread.IsValid(), "current thread is valid")
- lastframeID = thread.GetFrameAtIndex(thread.GetNumFrames() - 1).GetFrameID()
+ lastframeID = thread.GetFrameAtIndex(
+ thread.GetNumFrames() - 1).GetFrameID()
isi386Arch = False
if "i386" in self.getArchitecture():
isi386Arch = True
- # lldb should be able to disassemble frames from the inferior after asserting.
+ # lldb should be able to disassemble frames from the inferior after
+ # asserting.
for frame in thread:
self.assertTrue(frame.IsValid(), "current frame is valid")
- self.runCmd("frame select " + str(frame.GetFrameID()), RUN_SUCCEEDED)
+ self.runCmd("frame select " +
+ str(frame.GetFrameID()), RUN_SUCCEEDED)
# Don't expect the function name to be in the disassembly as the assert
# function might be a no-return function where the PC is past the end
@@ -174,11 +217,14 @@ class AssertingInferiorTestCase(TestBase):
pc_backup_offset = 1
if frame.GetFrameID() == 0:
pc_backup_offset = 0
- if isi386Arch == True:
+ if isi386Arch:
if lastframeID == frame.GetFrameID():
pc_backup_offset = 0
- self.expect("disassemble -a %s" % (frame.GetPC() - pc_backup_offset),
- substrs = ['<+0>: '])
+ self.expect(
+ "disassemble -a %s" %
+ (frame.GetPC() -
+ pc_backup_offset),
+ substrs=['<+0>: '])
def check_expr_in_main(self, thread):
depth = thread.GetNumFrames()
@@ -186,17 +232,19 @@ class AssertingInferiorTestCase(TestBase):
frame = thread.GetFrameAtIndex(i)
self.assertTrue(frame.IsValid(), "current frame is valid")
if self.TraceOn():
- print("Checking if function %s is main" % frame.GetFunctionName())
+ print(
+ "Checking if function %s is main" %
+ frame.GetFunctionName())
if 'main' == frame.GetFunctionName():
frame_id = frame.GetFrameID()
self.runCmd("frame select " + str(frame_id), RUN_SUCCEEDED)
- self.expect("p argc", substrs = ['(int)', ' = 1'])
- self.expect("p hello_world", substrs = ['Hello'])
- self.expect("p argv[0]", substrs = ['a.out'])
- self.expect("p null_ptr", substrs = ['= 0x0'])
- return True
- return False
+ self.expect("p argc", substrs=['(int)', ' = 1'])
+ self.expect("p hello_world", substrs=['Hello'])
+ self.expect("p argv[0]", substrs=['a.out'])
+ self.expect("p null_ptr", substrs=['= 0x0'])
+ return True
+ return False
def inferior_asserting_expr(self):
"""Test that the lldb expression interpreter can read symbols after asserting."""
@@ -207,7 +255,7 @@ class AssertingInferiorTestCase(TestBase):
self.assertTrue(target, VALID_TARGET)
# Launch the process, and do not stop at the entry point.
- target.LaunchSimple (None, None, self.get_process_working_directory())
+ target.LaunchSimple(None, None, self.get_process_working_directory())
self.check_stop_reason()
process = target.GetProcess()
@@ -216,8 +264,11 @@ class AssertingInferiorTestCase(TestBase):
thread = process.GetThreadAtIndex(0)
self.assertTrue(thread.IsValid(), "current thread is valid")
- # The lldb expression interpreter should be able to read from addresses of the inferior after a call to assert().
- self.assertTrue(self.check_expr_in_main(thread), "cannot find 'main' in the backtrace")
+ # The lldb expression interpreter should be able to read from addresses
+ # of the inferior after a call to assert().
+ self.assertTrue(
+ self.check_expr_in_main(thread),
+ "cannot find 'main' in the backtrace")
def inferior_asserting_step(self):
"""Test that lldb functions correctly after stepping through a call to assert()."""
@@ -229,20 +280,21 @@ class AssertingInferiorTestCase(TestBase):
# Launch the process, and do not stop at the entry point.
self.set_breakpoint(self.line)
- target.LaunchSimple (None, None, self.get_process_working_directory())
+ target.LaunchSimple(None, None, self.get_process_working_directory())
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['main.c:%d' % self.line,
- 'stop reason = breakpoint'])
+ substrs=['main.c:%d' % self.line,
+ 'stop reason = breakpoint'])
self.runCmd("next")
stop_reason = self.check_stop_reason()
- # lldb should be able to read from registers from the inferior after asserting.
+ # lldb should be able to read from registers from the inferior after
+ # asserting.
if "x86_64" in self.getArchitecture():
- self.expect("register read rbp", substrs = ['rbp = 0x'])
+ self.expect("register read rbp", substrs=['rbp = 0x'])
if "i386" in self.getArchitecture():
- self.expect("register read ebp", substrs = ['ebp = 0x'])
+ self.expect("register read ebp", substrs=['ebp = 0x'])
process = target.GetProcess()
self.assertTrue(process.IsValid(), "current process is valid")
@@ -250,10 +302,13 @@ class AssertingInferiorTestCase(TestBase):
thread = process.GetThreadAtIndex(0)
self.assertTrue(thread.IsValid(), "current thread is valid")
- # The lldb expression interpreter should be able to read from addresses of the inferior after a call to assert().
- self.assertTrue(self.check_expr_in_main(thread), "cannot find 'main' in the backtrace")
+ # The lldb expression interpreter should be able to read from addresses
+ # of the inferior after a call to assert().
+ self.assertTrue(
+ self.check_expr_in_main(thread),
+ "cannot find 'main' in the backtrace")
# And it should report the correct line number.
self.expect("thread backtrace all",
- substrs = [stop_reason,
- 'main.c:%d' % self.line])
+ substrs=[stop_reason,
+ 'main.c:%d' % self.line])
diff --git a/packages/Python/lldbsuite/test/functionalities/inferior-changed/TestInferiorChanged.py b/packages/Python/lldbsuite/test/functionalities/inferior-changed/TestInferiorChanged.py
index 359846c314f6..3620de61a2e3 100644
--- a/packages/Python/lldbsuite/test/functionalities/inferior-changed/TestInferiorChanged.py
+++ b/packages/Python/lldbsuite/test/functionalities/inferior-changed/TestInferiorChanged.py
@@ -3,14 +3,15 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import configuration
from lldbsuite.test import lldbutil
+
class ChangedInferiorTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -47,12 +48,12 @@ class ChangedInferiorTestCase(TestBase):
# We should have one crashing thread
self.assertEqual(
- len(lldbutil.get_crashed_threads(self, self.dbg.GetSelectedTarget().GetProcess())),
- 1,
- STOPPED_DUE_TO_EXC_BAD_ACCESS)
+ len(lldbutil.get_crashed_threads(self, self.dbg.GetSelectedTarget().GetProcess())),
+ 1,
+ STOPPED_DUE_TO_EXC_BAD_ACCESS)
# And it should report the correct line number.
- self.expect("thread backtrace all", substrs = ['main.c:%d' % self.line1])
+ self.expect("thread backtrace all", substrs=['main.c:%d' % self.line1])
def inferior_not_crashing(self):
"""Test lldb reloads the inferior after it was changed during the session."""
@@ -61,22 +62,23 @@ class ChangedInferiorTestCase(TestBase):
self.runCmd("process status")
self.assertNotEqual(
- len(lldbutil.get_crashed_threads(self, self.dbg.GetSelectedTarget().GetProcess())),
- 1,
- "Inferior changed, but lldb did not perform a reload")
+ len(lldbutil.get_crashed_threads(self, self.dbg.GetSelectedTarget().GetProcess())),
+ 1,
+ "Inferior changed, but lldb did not perform a reload")
# Break inside the main.
- lldbutil.run_break_set_by_file_and_line (self, "main2.c", self.line2, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main2.c", self.line2, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
self.runCmd("frame variable int_ptr")
self.expect("frame variable *int_ptr",
- substrs = ['= 7'])
+ substrs=['= 7'])
self.expect("expression *int_ptr",
- substrs = ['= 7'])
+ substrs=['= 7'])
diff --git a/packages/Python/lldbsuite/test/functionalities/inferior-crashing/TestInferiorCrashing.py b/packages/Python/lldbsuite/test/functionalities/inferior-crashing/TestInferiorCrashing.py
index fd6a9abce36e..d058b1cac560 100644
--- a/packages/Python/lldbsuite/test/functionalities/inferior-crashing/TestInferiorCrashing.py
+++ b/packages/Python/lldbsuite/test/functionalities/inferior-crashing/TestInferiorCrashing.py
@@ -3,74 +3,94 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test import lldbutil
from lldbsuite.test import lldbplatformutil
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
+
class CrashingInferiorTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @expectedFailureAll(oslist=['freebsd'], bugnumber="llvm.org/pr23699 SIGSEGV is reported as exception, not signal")
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778, This actually works, but the test relies on the output format instead of the API")
+ @expectedFailureAll(
+ oslist=['freebsd'],
+ bugnumber="llvm.org/pr23699 SIGSEGV is reported as exception, not signal")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24778, This actually works, but the test relies on the output format instead of the API")
def test_inferior_crashing(self):
"""Test that lldb reliably catches the inferior crashing (command)."""
self.build()
self.inferior_crashing()
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778, This actually works, but the test relies on the output format instead of the API")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24778, This actually works, but the test relies on the output format instead of the API")
def test_inferior_crashing_register(self):
"""Test that lldb reliably reads registers from the inferior after crashing (command)."""
self.build()
self.inferior_crashing_registers()
@add_test_categories(['pyapi'])
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778, This actually works, but the test relies on the output format instead of the API")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24778, This actually works, but the test relies on the output format instead of the API")
def test_inferior_crashing_python(self):
"""Test that lldb reliably catches the inferior crashing (Python API)."""
self.build()
self.inferior_crashing_python()
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778, This actually works, but the test relies on the output format instead of the API")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24778, This actually works, but the test relies on the output format instead of the API")
def test_inferior_crashing_expr(self):
"""Test that the lldb expression interpreter can read from the inferior after crashing (command)."""
self.build()
self.inferior_crashing_expr()
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778, This actually works, but the test relies on the output format instead of the API")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24778, This actually works, but the test relies on the output format instead of the API")
def test_inferior_crashing_step(self):
"""Test that stepping after a crash behaves correctly."""
self.build()
self.inferior_crashing_step()
@expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr24939')
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778, This actually works, but the test relies on the output format instead of the API")
- @expectedFailureAndroid(archs=['aarch64'], api_levels=list(range(21 + 1))) # No eh_frame for sa_restorer
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24778, This actually works, but the test relies on the output format instead of the API")
+ @skipIfTargetAndroid() # debuggerd interferes with this test on Android
def test_inferior_crashing_step_after_break(self):
"""Test that lldb functions correctly after stepping through a crash."""
self.build()
self.inferior_crashing_step_after_break()
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778, This actually works, but the test relies on the output format instead of the API")
- @skipIfLinux # Inferior exits after stepping after a segfault. This is working as intended IMHO.
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24778, This actually works, but the test relies on the output format instead of the API")
+ # Inferior exits after stepping after a segfault. This is working as
+ # intended IMHO.
+ @skipIfLinux
def test_inferior_crashing_expr_step_and_expr(self):
"""Test that lldb expressions work before and after stepping after a crash."""
self.build()
self.inferior_crashing_expr_step_expr()
def set_breakpoint(self, line):
- lldbutil.run_break_set_by_file_and_line (self, "main.c", line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", line, num_expected_locations=1, loc_exact=True)
def check_stop_reason(self):
# We should have one crashing thread
self.assertEqual(
- len(lldbutil.get_crashed_threads(self, self.dbg.GetSelectedTarget().GetProcess())),
- 1,
- STOPPED_DUE_TO_EXC_BAD_ACCESS)
+ len(lldbutil.get_crashed_threads(self, self.dbg.GetSelectedTarget().GetProcess())),
+ 1,
+ STOPPED_DUE_TO_EXC_BAD_ACCESS)
def get_api_stop_reason(self):
return lldb.eStopReasonException
@@ -95,13 +115,13 @@ class CrashingInferiorTestCase(TestBase):
else:
stop_reason = 'stop reason = invalid address'
self.expect("thread list", STOPPED_DUE_TO_EXC_BAD_ACCESS,
- substrs = ['stopped',
- stop_reason])
+ substrs=['stopped',
+ stop_reason])
# And it should report the correct line number.
self.expect("thread backtrace all",
- substrs = [stop_reason,
- 'main.c:%d' % self.line])
+ substrs=[stop_reason,
+ 'main.c:%d' % self.line])
def inferior_crashing_python(self):
"""Inferior crashes upon launching; lldb should catch the event and stop."""
@@ -112,7 +132,8 @@ class CrashingInferiorTestCase(TestBase):
# Now launch the process, and do not stop at entry point.
# Both argv and envp are null.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
if process.GetState() != lldb.eStateStopped:
self.fail("Process should be in the 'stopped' state, "
@@ -120,7 +141,10 @@ class CrashingInferiorTestCase(TestBase):
lldbutil.state_type_to_str(process.GetState()))
threads = lldbutil.get_crashed_threads(self, process)
- self.assertEqual(len(threads), 1, "Failed to stop the thread upon bad access exception")
+ self.assertEqual(
+ len(threads),
+ 1,
+ "Failed to stop the thread upon bad access exception")
if self.TraceOn():
lldbutil.print_stacktrace(threads[0])
@@ -133,7 +157,8 @@ class CrashingInferiorTestCase(TestBase):
self.runCmd("run", RUN_SUCCEEDED)
self.check_stop_reason()
- # lldb should be able to read from registers from the inferior after crashing.
+ # lldb should be able to read from registers from the inferior after
+ # crashing.
lldbplatformutil.check_first_register_readable(self)
def inferior_crashing_expr(self):
@@ -144,12 +169,13 @@ class CrashingInferiorTestCase(TestBase):
self.runCmd("run", RUN_SUCCEEDED)
self.check_stop_reason()
- # The lldb expression interpreter should be able to read from addresses of the inferior after a crash.
+ # The lldb expression interpreter should be able to read from addresses
+ # of the inferior after a crash.
self.expect("p argc",
- startstr = '(int) $0 = 1')
+ startstr='(int) $0 = 1')
self.expect("p hello_world",
- substrs = ['Hello'])
+ substrs=['Hello'])
def inferior_crashing_step(self):
"""Test that lldb functions correctly after stepping through a crash."""
@@ -160,24 +186,26 @@ class CrashingInferiorTestCase(TestBase):
self.runCmd("run", RUN_SUCCEEDED)
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['main.c:%d' % self.line,
- 'stop reason = breakpoint'])
+ substrs=['main.c:%d' % self.line,
+ 'stop reason = breakpoint'])
self.runCmd("next")
self.check_stop_reason()
- # The lldb expression interpreter should be able to read from addresses of the inferior after a crash.
+ # The lldb expression interpreter should be able to read from addresses
+ # of the inferior after a crash.
self.expect("p argv[0]",
- substrs = ['a.out'])
+ substrs=['a.out'])
self.expect("p null_ptr",
- substrs = ['= 0x0'])
+ substrs=['= 0x0'])
- # lldb should be able to read from registers from the inferior after crashing.
+ # lldb should be able to read from registers from the inferior after
+ # crashing.
lldbplatformutil.check_first_register_readable(self)
# And it should report the correct line number.
self.expect("thread backtrace all",
- substrs = ['main.c:%d' % self.line])
+ substrs=['main.c:%d' % self.line])
def inferior_crashing_step_after_break(self):
"""Test that lldb behaves correctly when stepping after a crash."""
@@ -187,17 +215,20 @@ class CrashingInferiorTestCase(TestBase):
self.runCmd("run", RUN_SUCCEEDED)
self.check_stop_reason()
- expected_state = 'exited' # Provide the exit code.
+ expected_state = 'exited' # Provide the exit code.
if self.platformIsDarwin():
- expected_state = 'stopped' # TODO: Determine why 'next' and 'continue' have no effect after a crash.
- elif re.match(".*-.*-.*-android", self.dbg.GetSelectedPlatform().GetTriple()):
- expected_state = 'stopped' # android has a default SEGV handler, which will re-raise the signal, so we come up stopped again
+ # TODO: Determine why 'next' and 'continue' have no effect after a
+ # crash.
+ expected_state = 'stopped'
self.expect("next",
- substrs = ['Process', expected_state])
+ substrs=['Process', expected_state])
if expected_state == 'exited':
- self.expect("thread list", error=True,substrs = ['Process must be launched'])
+ self.expect(
+ "thread list",
+ error=True,
+ substrs=['Process must be launched'])
else:
self.check_stop_reason()
@@ -209,13 +240,15 @@ class CrashingInferiorTestCase(TestBase):
self.runCmd("run", RUN_SUCCEEDED)
self.check_stop_reason()
- # The lldb expression interpreter should be able to read from addresses of the inferior after a crash.
+ # The lldb expression interpreter should be able to read from addresses
+ # of the inferior after a crash.
self.expect("p argv[0]",
- substrs = ['a.out'])
+ substrs=['a.out'])
self.runCmd("next")
self.check_stop_reason()
- # The lldb expression interpreter should be able to read from addresses of the inferior after a crash.
+ # The lldb expression interpreter should be able to read from addresses
+ # of the inferior after a crash.
self.expect("p argv[0]",
- substrs = ['a.out'])
+ substrs=['a.out'])
diff --git a/packages/Python/lldbsuite/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py b/packages/Python/lldbsuite/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py
index 0d1992d7b4b1..f04173a3e8d2 100644
--- a/packages/Python/lldbsuite/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py
+++ b/packages/Python/lldbsuite/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py
@@ -3,19 +3,22 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbplatformutil
from lldbsuite.test import lldbutil
+
class CrashingRecursiveInferiorTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @expectedFailureAll(oslist=['freebsd'], bugnumber="llvm.org/pr23699 SIGSEGV is reported as exception, not signal")
+ @expectedFailureAll(
+ oslist=['freebsd'],
+ bugnumber="llvm.org/pr23699 SIGSEGV is reported as exception, not signal")
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")
def test_recursive_inferior_crashing(self):
"""Test that lldb reliably catches the inferior crashing (command)."""
@@ -49,13 +52,15 @@ class CrashingRecursiveInferiorTestCase(TestBase):
@expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr24939')
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")
- @expectedFailureAndroid(archs=['aarch64'], api_levels=list(range(21 + 1))) # No eh_frame for sa_restorer
+ @skipIfTargetAndroid() # debuggerd interferes with this test on Android
def test_recursive_inferior_crashing_step_after_break(self):
"""Test that lldb functions correctly after stepping through a crash."""
self.build()
self.recursive_inferior_crashing_step_after_break()
- @skipIfLinux # Inferior exits after stepping after a segfault. This is working as intended IMHO.
+ # Inferior exits after stepping after a segfault. This is working as
+ # intended IMHO.
+ @skipIfLinux
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")
def test_recursive_inferior_crashing_expr_step_and_expr(self):
"""Test that lldb expressions work before and after stepping after a crash."""
@@ -63,14 +68,15 @@ class CrashingRecursiveInferiorTestCase(TestBase):
self.recursive_inferior_crashing_expr_step_expr()
def set_breakpoint(self, line):
- lldbutil.run_break_set_by_file_and_line (self, "main.c", line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", line, num_expected_locations=1, loc_exact=True)
def check_stop_reason(self):
# We should have one crashing thread
self.assertEqual(
- len(lldbutil.get_crashed_threads(self, self.dbg.GetSelectedTarget().GetProcess())),
- 1,
- STOPPED_DUE_TO_EXC_BAD_ACCESS)
+ len(lldbutil.get_crashed_threads(self, self.dbg.GetSelectedTarget().GetProcess())),
+ 1,
+ STOPPED_DUE_TO_EXC_BAD_ACCESS)
def setUp(self):
# Call super's setUp().
@@ -93,17 +99,24 @@ class CrashingRecursiveInferiorTestCase(TestBase):
else:
stop_reason = 'stop reason = invalid address'
self.expect("thread list", STOPPED_DUE_TO_EXC_BAD_ACCESS,
- substrs = ['stopped',
- stop_reason])
-
- # And it should report a backtrace that includes main and the crash site.
- self.expect("thread backtrace all",
- substrs = [stop_reason, 'main', 'argc', 'argv', 'recursive_function'])
+ substrs=['stopped',
+ stop_reason])
+
+ # And it should report a backtrace that includes main and the crash
+ # site.
+ self.expect(
+ "thread backtrace all",
+ substrs=[
+ stop_reason,
+ 'main',
+ 'argc',
+ 'argv',
+ 'recursive_function'])
# And it should report the correct line number.
self.expect("thread backtrace all",
- substrs = [stop_reason,
- 'main.c:%d' % self.line])
+ substrs=[stop_reason,
+ 'main.c:%d' % self.line])
def recursive_inferior_crashing_python(self):
"""Inferior crashes upon launching; lldb should catch the event and stop."""
@@ -114,7 +127,8 @@ class CrashingRecursiveInferiorTestCase(TestBase):
# Now launch the process, and do not stop at entry point.
# Both argv and envp are null.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
if process.GetState() != lldb.eStateStopped:
self.fail("Process should be in the 'stopped' state, "
@@ -122,7 +136,10 @@ class CrashingRecursiveInferiorTestCase(TestBase):
lldbutil.state_type_to_str(process.GetState()))
threads = lldbutil.get_crashed_threads(self, process)
- self.assertEqual(len(threads), 1, "Failed to stop the thread upon bad access exception")
+ self.assertEqual(
+ len(threads),
+ 1,
+ "Failed to stop the thread upon bad access exception")
if self.TraceOn():
lldbutil.print_stacktrace(threads[0])
@@ -135,7 +152,8 @@ class CrashingRecursiveInferiorTestCase(TestBase):
self.runCmd("run", RUN_SUCCEEDED)
self.check_stop_reason()
- # lldb should be able to read from registers from the inferior after crashing.
+ # lldb should be able to read from registers from the inferior after
+ # crashing.
lldbplatformutil.check_first_register_readable(self)
def recursive_inferior_crashing_expr(self):
@@ -146,9 +164,10 @@ class CrashingRecursiveInferiorTestCase(TestBase):
self.runCmd("run", RUN_SUCCEEDED)
self.check_stop_reason()
- # The lldb expression interpreter should be able to read from addresses of the inferior after a crash.
+ # The lldb expression interpreter should be able to read from addresses
+ # of the inferior after a crash.
self.expect("p i",
- startstr = '(int) $0 =')
+ startstr='(int) $0 =')
def recursive_inferior_crashing_step(self):
"""Test that lldb functions correctly after stepping through a crash."""
@@ -159,22 +178,24 @@ class CrashingRecursiveInferiorTestCase(TestBase):
self.runCmd("run", RUN_SUCCEEDED)
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['main.c:%d' % self.line,
- 'stop reason = breakpoint'])
+ substrs=['main.c:%d' % self.line,
+ 'stop reason = breakpoint'])
self.runCmd("next")
self.check_stop_reason()
- # The lldb expression interpreter should be able to read from addresses of the inferior after a crash.
+ # The lldb expression interpreter should be able to read from addresses
+ # of the inferior after a crash.
self.expect("p i",
- substrs = ['(int) $0 ='])
+ substrs=['(int) $0 ='])
- # lldb should be able to read from registers from the inferior after crashing.
+ # lldb should be able to read from registers from the inferior after
+ # crashing.
lldbplatformutil.check_first_register_readable(self)
# And it should report the correct line number.
self.expect("thread backtrace all",
- substrs = ['main.c:%d' % self.line])
+ substrs=['main.c:%d' % self.line])
def recursive_inferior_crashing_step_after_break(self):
"""Test that lldb behaves correctly when stepping after a crash."""
@@ -184,18 +205,20 @@ class CrashingRecursiveInferiorTestCase(TestBase):
self.runCmd("run", RUN_SUCCEEDED)
self.check_stop_reason()
- expected_state = 'exited' # Provide the exit code.
+ expected_state = 'exited' # Provide the exit code.
if self.platformIsDarwin():
- expected_state = 'stopped' # TODO: Determine why 'next' and 'continue' have no effect after a crash.
- elif re.match(".*-.*-.*-android", self.dbg.GetSelectedPlatform().GetTriple()):
- expected_state = 'stopped' # android has a default SEGV handler, which will re-raise the signal, so we come up stopped again
-
+ # TODO: Determine why 'next' and 'continue' have no effect after a
+ # crash.
+ expected_state = 'stopped'
self.expect("next",
- substrs = ['Process', expected_state])
+ substrs=['Process', expected_state])
if expected_state == 'exited':
- self.expect("thread list", error=True,substrs = ['Process must be launched'])
+ self.expect(
+ "thread list",
+ error=True,
+ substrs=['Process must be launched'])
else:
self.check_stop_reason()
@@ -207,14 +230,16 @@ class CrashingRecursiveInferiorTestCase(TestBase):
self.runCmd("run", RUN_SUCCEEDED)
self.check_stop_reason()
- # The lldb expression interpreter should be able to read from addresses of the inferior after a crash.
+ # The lldb expression interpreter should be able to read from addresses
+ # of the inferior after a crash.
self.expect("p null",
- startstr = '(char *) $0 = 0x0')
+ startstr='(char *) $0 = 0x0')
self.runCmd("next")
- # The lldb expression interpreter should be able to read from addresses of the inferior after a step.
+ # The lldb expression interpreter should be able to read from addresses
+ # of the inferior after a step.
self.expect("p null",
- startstr = '(char *) $1 = 0x0')
+ startstr='(char *) $1 = 0x0')
self.check_stop_reason()
diff --git a/packages/Python/lldbsuite/test/functionalities/inline-stepping/TestInlineStepping.py b/packages/Python/lldbsuite/test/functionalities/inline-stepping/TestInlineStepping.py
index 8257106888d6..cb801242aa58 100644
--- a/packages/Python/lldbsuite/test/functionalities/inline-stepping/TestInlineStepping.py
+++ b/packages/Python/lldbsuite/test/functionalities/inline-stepping/TestInlineStepping.py
@@ -3,19 +3,23 @@
from __future__ import print_function
-
-import os, time, sys
+import os
+import time
+import sys
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestInlineStepping(TestBase):
mydir = TestBase.compute_mydir(__file__)
@add_test_categories(['pyapi'])
- @expectedFailureAll(compiler="icc", bugnumber="# Not really a bug. ICC combines two inlined functions.")
+ @expectedFailureAll(
+ compiler="icc",
+ bugnumber="# Not really a bug. ICC combines two inlined functions.")
def test_with_python_api(self):
"""Test stepping over and into inlined functions."""
self.build()
@@ -26,7 +30,7 @@ class TestInlineStepping(TestBase):
"""Test stepping over and into inlined functions."""
self.build()
self.inline_stepping_step_over()
-
+
@add_test_categories(['pyapi'])
def test_step_in_template_with_python_api(self):
"""Test stepping in to templated functions."""
@@ -39,10 +43,21 @@ class TestInlineStepping(TestBase):
# Find the line numbers that we will step to in main:
self.main_source = "calling.cpp"
self.source_lines = {}
- functions = ['caller_ref_1', 'caller_ref_2', 'inline_ref_1', 'inline_ref_2', 'called_by_inline_ref', 'caller_trivial_1', 'caller_trivial_2', 'inline_trivial_1', 'inline_trivial_2', 'called_by_inline_trivial' ]
+ functions = [
+ 'caller_ref_1',
+ 'caller_ref_2',
+ 'inline_ref_1',
+ 'inline_ref_2',
+ 'called_by_inline_ref',
+ 'caller_trivial_1',
+ 'caller_trivial_2',
+ 'inline_trivial_1',
+ 'inline_trivial_2',
+ 'called_by_inline_trivial']
for name in functions:
- self.source_lines[name] = line_number(self.main_source, "// In " + name + ".")
- self.main_source_spec = lldb.SBFileSpec (self.main_source)
+ self.source_lines[name] = line_number(
+ self.main_source, "// In " + name + ".")
+ self.main_source_spec = lldb.SBFileSpec(self.main_source)
def do_step(self, step_type, destination_line_entry, test_stack_depth):
expected_stack_depth = self.thread.GetNumFrames()
@@ -55,58 +70,79 @@ class TestInlineStepping(TestBase):
elif step_type == "over":
self.thread.StepOver()
else:
- self.fail ("Unrecognized step type: " + step_type)
+ self.fail("Unrecognized step type: " + step_type)
- threads = lldbutil.get_stopped_threads (self.process, lldb.eStopReasonPlanComplete)
+ threads = lldbutil.get_stopped_threads(
+ self.process, lldb.eStopReasonPlanComplete)
if len(threads) != 1:
destination_description = lldb.SBStream()
destination_line_entry.GetDescription(destination_description)
- self.fail ("Failed to stop due to step " + step_type + " operation stepping to: " + destination_description.GetData())
+ self.fail(
+ "Failed to stop due to step " +
+ step_type +
+ " operation stepping to: " +
+ destination_description.GetData())
self.thread = threads[0]
stop_line_entry = self.thread.GetFrameAtIndex(0).GetLineEntry()
- self.assertTrue (stop_line_entry.IsValid(), "Stop line entry was not valid.")
-
- # Don't use the line entry equal operator because we don't care about the column number.
- stop_at_right_place = (stop_line_entry.GetFileSpec() == destination_line_entry.GetFileSpec() and stop_line_entry.GetLine() == destination_line_entry.GetLine())
- if stop_at_right_place == False:
+ self.assertTrue(
+ stop_line_entry.IsValid(),
+ "Stop line entry was not valid.")
+
+ # Don't use the line entry equal operator because we don't care about
+ # the column number.
+ stop_at_right_place = (stop_line_entry.GetFileSpec() == destination_line_entry.GetFileSpec(
+ ) and stop_line_entry.GetLine() == destination_line_entry.GetLine())
+ if not stop_at_right_place:
destination_description = lldb.SBStream()
destination_line_entry.GetDescription(destination_description)
actual_description = lldb.SBStream()
stop_line_entry.GetDescription(actual_description)
- self.fail ("Step " + step_type + " stopped at wrong place: expected: " + destination_description.GetData() + " got: " + actual_description.GetData() + ".")
+ self.fail(
+ "Step " +
+ step_type +
+ " stopped at wrong place: expected: " +
+ destination_description.GetData() +
+ " got: " +
+ actual_description.GetData() +
+ ".")
real_stack_depth = self.thread.GetNumFrames()
if test_stack_depth and real_stack_depth != expected_stack_depth:
destination_description = lldb.SBStream()
destination_line_entry.GetDescription(destination_description)
- self.fail ("Step %s to %s got wrong number of frames, should be: %d was: %d."%(step_type, destination_description.GetData(), expected_stack_depth, real_stack_depth))
-
+ self.fail(
+ "Step %s to %s got wrong number of frames, should be: %d was: %d." %
+ (step_type,
+ destination_description.GetData(),
+ expected_stack_depth,
+ real_stack_depth))
+
def run_step_sequence(self, step_sequence):
"""This function takes a list of duples instructing how to run the program. The first element in each duple is
a source pattern for the target location, and the second is the operation that will take you from the current
source location to the target location. It will then run all the steps in the sequence.
- It will check that you arrived at the expected source location at each step, and that the stack depth changed
+ It will check that you arrived at the expected source location at each step, and that the stack depth changed
correctly for the operation in the sequence."""
target_line_entry = lldb.SBLineEntry()
target_line_entry.SetFileSpec(self.main_source_spec)
test_stack_depth = True
- # Work around for <rdar://problem/16363195>, the darwin unwinder seems flakey about whether it duplicates the first frame
+ # Work around for <rdar://problem/16363195>, the darwin unwinder seems flakey about whether it duplicates the first frame
# or not, which makes counting stack depth unreliable.
if self.platformIsDarwin():
test_stack_depth = False
for step_pattern in step_sequence:
- step_stop_line = line_number (self.main_source, step_pattern[0])
+ step_stop_line = line_number(self.main_source, step_pattern[0])
target_line_entry.SetLine(step_stop_line)
- self.do_step (step_pattern[1], target_line_entry, test_stack_depth)
-
+ self.do_step(step_pattern[1], target_line_entry, test_stack_depth)
+
def inline_stepping(self):
"""Use Python APIs to test stepping over and hitting breakpoints."""
exe = os.path.join(os.getcwd(), "a.out")
@@ -114,19 +150,22 @@ class TestInlineStepping(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- break_1_in_main = target.BreakpointCreateBySourceRegex ('// Stop here and step over to set up stepping over.', self.main_source_spec)
+ break_1_in_main = target.BreakpointCreateBySourceRegex(
+ '// Stop here and step over to set up stepping over.', self.main_source_spec)
self.assertTrue(break_1_in_main, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- self.process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ self.process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(self.process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
- threads = lldbutil.get_threads_stopped_at_breakpoint (self.process, break_1_in_main)
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ self.process, break_1_in_main)
if len(threads) != 1:
- self.fail ("Failed to stop at first breakpoint in main.")
+ self.fail("Failed to stop at first breakpoint in main.")
self.thread = threads[0]
@@ -135,60 +174,73 @@ class TestInlineStepping(TestBase):
# gets set past the insertion line in the function.
# Then test stepping over a simple inlined function. Note, to test all the parts of the inlined stepping
# the calls inline_stepping_1 and inline_stepping_2 should line up at the same address, that way we will test
- # the "virtual" stepping.
+ # the "virtual" stepping.
# FIXME: Put in a check to see if that is true and warn if it is not.
- step_sequence = [["// At inline_trivial_1 called from main.", "over"],
+ step_sequence = [["// At inline_trivial_1 called from main.", "over"],
["// At first call of caller_trivial_1 in main.", "over"]]
self.run_step_sequence(step_sequence)
-
+
# Now step from caller_ref_1 all the way into called_by_inline_trivial
- step_sequence = [["// In caller_trivial_1.", "into"],
- ["// In caller_trivial_2.", "into"],
+ step_sequence = [["// In caller_trivial_1.", "into"],
+ ["// In caller_trivial_2.", "into"],
["// In inline_trivial_1.", "into"],
["// In inline_trivial_2.", "into"],
["// At caller_by_inline_trivial in inline_trivial_2.", "over"],
["// In called_by_inline_trivial.", "into"]]
self.run_step_sequence(step_sequence)
- # Now run to the inline_trivial_1 just before the immediate step into inline_trivial_2:
+ # Now run to the inline_trivial_1 just before the immediate step into
+ # inline_trivial_2:
- break_2_in_main = target.BreakpointCreateBySourceRegex ('// At second call of caller_trivial_1 in main.', self.main_source_spec)
+ break_2_in_main = target.BreakpointCreateBySourceRegex(
+ '// At second call of caller_trivial_1 in main.', self.main_source_spec)
self.assertTrue(break_2_in_main, VALID_BREAKPOINT)
- threads = lldbutil.continue_to_breakpoint (self.process, break_2_in_main)
- self.assertTrue (len(threads) == 1, "Successfully ran to call site of second caller_trivial_1 call.")
+ threads = lldbutil.continue_to_breakpoint(
+ self.process, break_2_in_main)
+ self.assertTrue(
+ len(threads) == 1,
+ "Successfully ran to call site of second caller_trivial_1 call.")
self.thread = threads[0]
-
- step_sequence = [["// In caller_trivial_1.", "into"],
- ["// In caller_trivial_2.", "into"],
+
+ step_sequence = [["// In caller_trivial_1.", "into"],
+ ["// In caller_trivial_2.", "into"],
["// In inline_trivial_1.", "into"]]
self.run_step_sequence(step_sequence)
- # Then call some trivial function, and make sure we end up back where we were in the inlined call stack:
-
+ # Then call some trivial function, and make sure we end up back where
+ # we were in the inlined call stack:
+
frame = self.thread.GetFrameAtIndex(0)
before_line_entry = frame.GetLineEntry()
- value = frame.EvaluateExpression ("function_to_call()")
+ value = frame.EvaluateExpression("function_to_call()")
after_line_entry = frame.GetLineEntry()
- self.assertTrue (before_line_entry.GetLine() == after_line_entry.GetLine(), "Line entry before and after function calls are the same.")
+ self.assertTrue(
+ before_line_entry.GetLine() == after_line_entry.GetLine(),
+ "Line entry before and after function calls are the same.")
- # Now make sure stepping OVER in the middle of the stack works, and then check finish from the inlined frame:
+ # Now make sure stepping OVER in the middle of the stack works, and
+ # then check finish from the inlined frame:
step_sequence = [["// At increment in inline_trivial_1.", "over"],
["// At increment in caller_trivial_2.", "out"]]
self.run_step_sequence(step_sequence)
+ # Now run to the place in main just before the first call to
+ # caller_ref_1:
- # Now run to the place in main just before the first call to caller_ref_1:
-
- break_3_in_main = target.BreakpointCreateBySourceRegex ('// At first call of caller_ref_1 in main.', self.main_source_spec)
+ break_3_in_main = target.BreakpointCreateBySourceRegex(
+ '// At first call of caller_ref_1 in main.', self.main_source_spec)
self.assertTrue(break_3_in_main, VALID_BREAKPOINT)
- threads = lldbutil.continue_to_breakpoint (self.process, break_3_in_main)
- self.assertTrue (len(threads) == 1, "Successfully ran to call site of first caller_ref_1 call.")
+ threads = lldbutil.continue_to_breakpoint(
+ self.process, break_3_in_main)
+ self.assertTrue(
+ len(threads) == 1,
+ "Successfully ran to call site of first caller_ref_1 call.")
self.thread = threads[0]
step_sequence = [["// In caller_ref_1.", "into"],
@@ -201,7 +253,7 @@ class TestInlineStepping(TestBase):
["// At increment in inline_ref_1.", "over"],
["// In caller_ref_2.", "out"],
["// At increment in caller_ref_2.", "over"]]
- self.run_step_sequence (step_sequence)
+ self.run_step_sequence(step_sequence)
def inline_stepping_step_over(self):
"""Use Python APIs to test stepping over and hitting breakpoints."""
@@ -210,26 +262,29 @@ class TestInlineStepping(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- break_1_in_main = target.BreakpointCreateBySourceRegex ('// At second call of caller_ref_1 in main.', self.main_source_spec)
+ break_1_in_main = target.BreakpointCreateBySourceRegex(
+ '// At second call of caller_ref_1 in main.', self.main_source_spec)
self.assertTrue(break_1_in_main, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- self.process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ self.process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(self.process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
- threads = lldbutil.get_threads_stopped_at_breakpoint (self.process, break_1_in_main)
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ self.process, break_1_in_main)
if len(threads) != 1:
- self.fail ("Failed to stop at first breakpoint in main.")
+ self.fail("Failed to stop at first breakpoint in main.")
self.thread = threads[0]
step_sequence = [["// In caller_ref_1.", "into"],
["// In caller_ref_2.", "into"],
["// At increment in caller_ref_2.", "over"]]
- self.run_step_sequence (step_sequence)
+ self.run_step_sequence(step_sequence)
def step_in_template(self):
"""Use Python APIs to test stepping in to templated functions."""
@@ -238,30 +293,38 @@ class TestInlineStepping(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- break_1_in_main = target.BreakpointCreateBySourceRegex ('// Call max_value template', self.main_source_spec)
+ break_1_in_main = target.BreakpointCreateBySourceRegex(
+ '// Call max_value template', self.main_source_spec)
self.assertTrue(break_1_in_main, VALID_BREAKPOINT)
-
- break_2_in_main = target.BreakpointCreateBySourceRegex ('// Call max_value specialized', self.main_source_spec)
+
+ break_2_in_main = target.BreakpointCreateBySourceRegex(
+ '// Call max_value specialized', self.main_source_spec)
self.assertTrue(break_2_in_main, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- self.process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ self.process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(self.process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
- threads = lldbutil.get_threads_stopped_at_breakpoint (self.process, break_1_in_main)
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ self.process, break_1_in_main)
if len(threads) != 1:
- self.fail ("Failed to stop at first breakpoint in main.")
+ self.fail("Failed to stop at first breakpoint in main.")
self.thread = threads[0]
step_sequence = [["// In max_value template", "into"]]
self.run_step_sequence(step_sequence)
-
- threads = lldbutil.continue_to_breakpoint (self.process, break_2_in_main)
- self.assertEqual(len(threads), 1, "Successfully ran to call site of second caller_trivial_1 call.")
+
+ threads = lldbutil.continue_to_breakpoint(
+ self.process, break_2_in_main)
+ self.assertEqual(
+ len(threads),
+ 1,
+ "Successfully ran to call site of second caller_trivial_1 call.")
self.thread = threads[0]
-
+
step_sequence = [["// In max_value specialized", "into"]]
self.run_step_sequence(step_sequence)
diff --git a/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/TestJITLoaderGDB.py b/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/TestJITLoaderGDB.py
index 336260a8e4a3..7ccfaa688b88 100644
--- a/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/TestJITLoaderGDB.py
+++ b/packages/Python/lldbsuite/test/functionalities/jitloader_gdb/TestJITLoaderGDB.py
@@ -15,7 +15,9 @@ class JITLoaderGDBTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @skipTestIfFn(lambda : "Skipped because the test crashes the test runner", bugnumber="llvm.org/pr24702")
+ @skipTestIfFn(
+ lambda: "Skipped because the test crashes the test runner",
+ bugnumber="llvm.org/pr24702")
@unittest2.expectedFailure("llvm.org/pr24702")
def test_bogus_values(self):
"""Test that we handle inferior misusing the GDB JIT interface"""
@@ -27,10 +29,12 @@ class JITLoaderGDBTestCase(TestBase):
self.assertTrue(target, VALID_TARGET)
# launch the process, do not stop at entry point.
- process = target.LaunchSimple(None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
- # The inferior will now pass bogus values over the interface. Make sure we don't crash.
+ # The inferior will now pass bogus values over the interface. Make sure
+ # we don't crash.
self.assertEqual(process.GetState(), lldb.eStateExited)
self.assertEqual(process.GetExitStatus(), 0)
diff --git a/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py b/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py
index 28d8cccacfcf..0ebb99d3fd43 100644
--- a/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py
+++ b/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py
@@ -4,7 +4,6 @@ Test that argdumper is a viable launching strategy.
from __future__ import print_function
-
import lldb
import os
import time
@@ -12,40 +11,50 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class LaunchWithShellExpandTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @expectedFailureAll(oslist=["windows", "linux", "freebsd"], bugnumber="llvm.org/pr24778 llvm.org/pr22627")
+ @expectedFailureAll(
+ oslist=[
+ "windows",
+ "linux",
+ "freebsd"],
+ bugnumber="llvm.org/pr24778 llvm.org/pr22627")
def test(self):
self.build()
- exe = os.path.join (os.getcwd(), "a.out")
-
+ exe = os.path.join(os.getcwd(), "a.out")
+
self.runCmd("target create %s" % exe)
-
+
# Create the target
target = self.dbg.CreateTarget(exe)
-
+
# Create any breakpoints we need
- breakpoint = target.BreakpointCreateBySourceRegex ('break here', lldb.SBFileSpec ("main.cpp", False))
+ breakpoint = target.BreakpointCreateBySourceRegex(
+ 'break here', lldb.SBFileSpec("main.cpp", False))
self.assertTrue(breakpoint, VALID_BREAKPOINT)
- self.runCmd("process launch -X true -w %s -- fi*.tx? () > <" % (os.getcwd()))
+ self.runCmd(
+ "process launch -X true -w %s -- fi*.tx? () > <" %
+ (os.getcwd()))
process = self.process()
self.assertTrue(process.GetState() == lldb.eStateStopped,
STOPPED_DUE_TO_BREAKPOINT)
- thread = process.GetThreadAtIndex (0)
+ thread = process.GetThreadAtIndex(0)
- self.assertTrue (thread.IsValid(),
- "Process stopped at 'main' should have a valid thread");
+ self.assertTrue(thread.IsValid(),
+ "Process stopped at 'main' should have a valid thread")
stop_reason = thread.GetStopReason()
-
- self.assertTrue (stop_reason == lldb.eStopReasonBreakpoint,
- "Thread in process stopped in 'main' should have a stop reason of eStopReasonBreakpoint");
+
+ self.assertTrue(
+ stop_reason == lldb.eStopReasonBreakpoint,
+ "Thread in process stopped in 'main' should have a stop reason of eStopReasonBreakpoint")
self.expect("frame variable argv[1]", substrs=['file1.txt'])
self.expect("frame variable argv[2]", substrs=['file2.txt'])
@@ -54,47 +63,57 @@ class LaunchWithShellExpandTestCase(TestBase):
self.expect("frame variable argv[5]", substrs=['()'])
self.expect("frame variable argv[6]", substrs=['>'])
self.expect("frame variable argv[7]", substrs=['<'])
- self.expect("frame variable argv[5]", substrs=['file5.tyx'], matching=False)
- self.expect("frame variable argv[8]", substrs=['file5.tyx'], matching=False)
+ self.expect(
+ "frame variable argv[5]",
+ substrs=['file5.tyx'],
+ matching=False)
+ self.expect(
+ "frame variable argv[8]",
+ substrs=['file5.tyx'],
+ matching=False)
self.runCmd("process kill")
- self.runCmd('process launch -X true -w %s -- "foo bar"' % (os.getcwd()))
-
+ self.runCmd(
+ 'process launch -X true -w %s -- "foo bar"' %
+ (os.getcwd()))
+
process = self.process()
self.assertTrue(process.GetState() == lldb.eStateStopped,
STOPPED_DUE_TO_BREAKPOINT)
- thread = process.GetThreadAtIndex (0)
+ thread = process.GetThreadAtIndex(0)
- self.assertTrue (thread.IsValid(),
- "Process stopped at 'main' should have a valid thread");
+ self.assertTrue(thread.IsValid(),
+ "Process stopped at 'main' should have a valid thread")
stop_reason = thread.GetStopReason()
-
- self.assertTrue (stop_reason == lldb.eStopReasonBreakpoint,
- "Thread in process stopped in 'main' should have a stop reason of eStopReasonBreakpoint");
-
+
+ self.assertTrue(
+ stop_reason == lldb.eStopReasonBreakpoint,
+ "Thread in process stopped in 'main' should have a stop reason of eStopReasonBreakpoint")
+
self.expect("frame variable argv[1]", substrs=['foo bar'])
self.runCmd("process kill")
self.runCmd('process launch -X true -w %s -- foo\ bar' % (os.getcwd()))
-
+
process = self.process()
self.assertTrue(process.GetState() == lldb.eStateStopped,
STOPPED_DUE_TO_BREAKPOINT)
- thread = process.GetThreadAtIndex (0)
+ thread = process.GetThreadAtIndex(0)
- self.assertTrue (thread.IsValid(),
- "Process stopped at 'main' should have a valid thread");
+ self.assertTrue(thread.IsValid(),
+ "Process stopped at 'main' should have a valid thread")
stop_reason = thread.GetStopReason()
-
- self.assertTrue (stop_reason == lldb.eStopReasonBreakpoint,
- "Thread in process stopped in 'main' should have a stop reason of eStopReasonBreakpoint");
-
+
+ self.assertTrue(
+ stop_reason == lldb.eStopReasonBreakpoint,
+ "Thread in process stopped in 'main' should have a stop reason of eStopReasonBreakpoint")
+
self.expect("frame variable argv[1]", substrs=['foo bar'])
diff --git a/packages/Python/lldbsuite/test/functionalities/llvm/TestLLVM.py b/packages/Python/lldbsuite/test/functionalities/llvm/TestLLVM.py
index a2a43bf2fabd..85741f548f33 100644
--- a/packages/Python/lldbsuite/test/functionalities/llvm/TestLLVM.py
+++ b/packages/Python/lldbsuite/test/functionalities/llvm/TestLLVM.py
@@ -5,24 +5,26 @@ Test lldb 'commands regex' command which allows the user to create a regular exp
from __future__ import print_function
-
import os
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestHomeDirectory(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
+ @expectedFailureAll(
+ hostoslist=["windows"],
+ bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
@no_debug_info_test
def test_tilde_home_directory(self):
- """Test that we can resolve "~/" in paths correctly.
+ """Test that we can resolve "~/" in paths correctly.
When a path starts with "~/", we use llvm::sys::path::home_directory() to
resolve the home directory. This currently relies on "HOME" being set in the
- environment. While this is usually set, we can't rely upon that. We might
+ environment. While this is usually set, we can't rely upon that. We might
eventually get a fix into llvm::sys::path::home_directory() so it doesn't rely
on having to have an environment variable set, but until then we have work around
code in FileSpec::ResolveUsername (llvm::SmallVectorImpl<char> &path) to ensure
@@ -31,7 +33,9 @@ class TestHomeDirectory(TestBase):
import pexpect
prompt = "(lldb) "
- child = pexpect.spawn('%s --no-use-colors %s' % (lldbtest_config.lldbExec, self.lldbOption))
+ child = pexpect.spawn(
+ '%s --no-use-colors %s' %
+ (lldbtest_config.lldbExec, self.lldbOption))
# Turn on logging for what the child sends back.
if self.TraceOn():
child.logfile_read = sys.stdout
@@ -39,7 +43,7 @@ class TestHomeDirectory(TestBase):
self.child = child
# Resolve "~/." to the full path of our home directory + "/."
- if 'HOME' in os.environ:
+ if 'HOME' in os.environ:
home_dir = os.environ['HOME']
if self.TraceOn():
print("home directory is: '%s'" % (home_dir))
@@ -49,11 +53,14 @@ class TestHomeDirectory(TestBase):
child.sendline('''script str(lldb.SBFileSpec("~/.", True))''')
child.expect_exact(home_dir)
child.expect_exact(prompt)
- child.sendline('''script import os; os.unsetenv('HOME'); str(lldb.SBFileSpec("~/", True))''');
+ child.sendline(
+ '''script import os; os.unsetenv('HOME'); str(lldb.SBFileSpec("~/", True))''')
child.expect_exact(home_dir)
child.expect_exact(prompt)
elif self.TraceOn():
- print('''home directory "%s" doesn't exist, skipping home directory test''' % (home_dir))
+ print(
+ '''home directory "%s" doesn't exist, skipping home directory test''' %
+ (home_dir))
elif self.TraceOn():
print('"HOME" not in environment, skipping home directory test')
diff --git a/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py b/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py
index 3a703b2ee04e..027968a727f1 100644
--- a/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py
+++ b/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py
@@ -5,18 +5,19 @@ Test that breakpoint by symbol name works correctly with dynamic libs.
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
-@skipIfWindows # Windows doesn't have dlopen and friends, dynamic libraries work differently
+
+@skipIfWindows # Windows doesn't have dlopen and friends, dynamic libraries work differently
class LoadUnloadTestCase(TestBase):
- def getCategories (self):
+ def getCategories(self):
return ['basic_process']
mydir = TestBase.compute_mydir(__file__)
@@ -25,19 +26,30 @@ class LoadUnloadTestCase(TestBase):
# Call super's setUp().
TestBase.setUp(self)
# Find the line number to break for main.cpp.
- self.line = line_number('main.cpp',
- '// Set break point at this line for test_lldb_process_load_and_unload_commands().')
- self.line_d_function = line_number('d.cpp',
- '// Find this line number within d_dunction().')
+ self.line = line_number(
+ 'main.cpp',
+ '// Set break point at this line for test_lldb_process_load_and_unload_commands().')
+ self.line_d_function = line_number(
+ 'd.cpp', '// Find this line number within d_dunction().')
if not self.platformIsDarwin():
if not lldb.remote_platform and "LD_LIBRARY_PATH" in os.environ:
- self.runCmd("settings set target.env-vars " + self.dylibPath + "=" + os.environ["LD_LIBRARY_PATH"] + ":" + os.getcwd())
+ self.runCmd(
+ "settings set target.env-vars " +
+ self.dylibPath +
+ "=" +
+ os.environ["LD_LIBRARY_PATH"] +
+ ":" +
+ os.getcwd())
else:
if lldb.remote_platform:
wd = lldb.remote_platform.GetWorkingDirectory()
else:
wd = os.getcwd()
- self.runCmd("settings set target.env-vars " + self.dylibPath + "=" + wd)
+ self.runCmd(
+ "settings set target.env-vars " +
+ self.dylibPath +
+ "=" +
+ wd)
def copy_shlibs_to_remote(self, hidden_dir=False):
""" Copies the shared libs required by this test suite to remote.
@@ -72,9 +84,9 @@ class LoadUnloadTestCase(TestBase):
"Unable copy 'libloadunload_d.so' to '%s'.\n>>> %s" %
(wd, err.GetCString()))
- @skipIfFreeBSD # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support
+ @skipIfFreeBSD # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support
@not_remote_testsuite_ready
- @skipIfWindows # Windows doesn't have dlopen and friends, dynamic libraries work differently
+ @skipIfWindows # Windows doesn't have dlopen and friends, dynamic libraries work differently
def test_modules_search_paths(self):
"""Test target modules list after loading a different copy of the library libd.dylib, and verifies that it works with 'target modules search-paths add'."""
@@ -96,17 +108,22 @@ class LoadUnloadTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
self.expect("target modules list",
- substrs = [old_dylib])
- #self.expect("target modules list -t 3",
+ substrs=[old_dylib])
+ # self.expect("target modules list -t 3",
# patterns = ["%s-[^-]*-[^-]*" % self.getArchitecture()])
# Add an image search path substitution pair.
- self.runCmd("target modules search-paths add %s %s" % (os.getcwd(), new_dir))
+ self.runCmd(
+ "target modules search-paths add %s %s" %
+ (os.getcwd(), new_dir))
self.expect("target modules search-paths list",
- substrs = [os.getcwd(), new_dir])
+ substrs=[os.getcwd(), new_dir])
- self.expect("target modules search-paths query %s" % os.getcwd(), "Image search path successfully transformed",
- substrs = [new_dir])
+ self.expect(
+ "target modules search-paths query %s" %
+ os.getcwd(),
+ "Image search path successfully transformed",
+ substrs=[new_dir])
# Obliterate traces of libd from the old location.
os.remove(old_dylib)
@@ -118,16 +135,19 @@ class LoadUnloadTestCase(TestBase):
self.runCmd("settings show target.env-vars")
remove_dyld_path_cmd = "settings remove target.env-vars " + self.dylibPath
- self.addTearDownHook(lambda: self.dbg.HandleCommand(remove_dyld_path_cmd))
+ self.addTearDownHook(
+ lambda: self.dbg.HandleCommand(remove_dyld_path_cmd))
self.runCmd("run")
- self.expect("target modules list", "LLDB successfully locates the relocated dynamic library",
- substrs = [new_dylib])
+ self.expect(
+ "target modules list",
+ "LLDB successfully locates the relocated dynamic library",
+ substrs=[new_dylib])
- @skipIfFreeBSD # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support
- @expectedFailureAndroid # wrong source file shows up for hidden library
- @skipIfWindows # Windows doesn't have dlopen and friends, dynamic libraries work differently
+ @skipIfFreeBSD # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support
+ @expectedFailureAndroid # wrong source file shows up for hidden library
+ @skipIfWindows # Windows doesn't have dlopen and friends, dynamic libraries work differently
def test_dyld_library_path(self):
"""Test (DY)LD_LIBRARY_PATH after moving libd.dylib, which defines d_function, somewhere else."""
@@ -138,6 +158,10 @@ class LoadUnloadTestCase(TestBase):
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+ # Shut off ANSI color usage so we don't get ANSI escape sequences
+ # mixed in with stop locations.
+ self.dbg.SetUseColor(False)
+
if self.platformIsDarwin():
dylibName = 'libloadunload_d.dylib'
dsymName = 'libloadunload_d.dylib.dSYM'
@@ -156,15 +180,17 @@ class LoadUnloadTestCase(TestBase):
old_dylib = os.path.join(old_dir, dylibName)
remove_dyld_path_cmd = "settings remove target.env-vars " + self.dylibPath
- self.addTearDownHook(lambda: self.dbg.HandleCommand(remove_dyld_path_cmd))
+ self.addTearDownHook(
+ lambda: self.dbg.HandleCommand(remove_dyld_path_cmd))
# For now we don't track (DY)LD_LIBRARY_PATH, so the old library will be in
# the modules list.
self.expect("target modules list",
- substrs = [os.path.basename(old_dylib)],
+ substrs=[os.path.basename(old_dylib)],
matching=True)
- lldbutil.run_break_set_by_file_and_line (self, "d.cpp", self.line_d_function, num_expected_locations=1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "d.cpp", self.line_d_function, num_expected_locations=1)
# After run, make sure the non-hidden library is picked up.
self.expect("run", substrs=["return", "700"])
@@ -180,9 +206,14 @@ class LoadUnloadTestCase(TestBase):
# This time, the hidden library should be picked up.
self.expect("run", substrs=["return", "12345"])
- @expectedFailureAll(bugnumber="llvm.org/pr25805", hostoslist=["windows"], compiler="gcc", archs=["i386"], triple='.*-android')
- @skipIfFreeBSD # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support
- @skipIfWindows # Windows doesn't have dlopen and friends, dynamic libraries work differently
+ @expectedFailureAll(
+ bugnumber="llvm.org/pr25805",
+ hostoslist=["windows"],
+ compiler="gcc",
+ archs=["i386"],
+ triple='.*-android')
+ @skipIfFreeBSD # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support
+ @skipIfWindows # Windows doesn't have dlopen and friends, dynamic libraries work differently
def test_lldb_process_load_and_unload_commands(self):
"""Test that lldb process load/unload command work correctly."""
@@ -196,7 +227,8 @@ class LoadUnloadTestCase(TestBase):
# Break at main.cpp before the call to dlopen().
# Use lldb's process load command to load the dylib, instead.
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
@@ -211,13 +243,23 @@ class LoadUnloadTestCase(TestBase):
dylibName = 'libloadunload_a.so'
# Make sure that a_function does not exist at this point.
- self.expect("image lookup -n a_function", "a_function should not exist yet",
- error=True, matching=False, patterns = ["1 match found"])
+ self.expect(
+ "image lookup -n a_function",
+ "a_function should not exist yet",
+ error=True,
+ matching=False,
+ patterns=["1 match found"])
# Use lldb 'process load' to load the dylib.
- self.expect("process load %s --install" % dylibName, "%s loaded correctly" % dylibName,
- patterns = ['Loading "%s".*ok' % dylibName,
- 'Image [0-9]+ loaded'])
+ self.expect(
+ "process load %s --install" %
+ dylibName,
+ "%s loaded correctly" %
+ dylibName,
+ patterns=[
+ 'Loading "%s".*ok' %
+ dylibName,
+ 'Image [0-9]+ loaded'])
# Search for and match the "Image ([0-9]+) loaded" pattern.
output = self.res.GetOutput()
@@ -230,16 +272,26 @@ class LoadUnloadTestCase(TestBase):
index = match.group(1)
# Now we should have an entry for a_function.
- self.expect("image lookup -n a_function", "a_function should now exist",
- patterns = ["1 match found .*%s" % dylibName])
+ self.expect(
+ "image lookup -n a_function",
+ "a_function should now exist",
+ patterns=[
+ "1 match found .*%s" %
+ dylibName])
# Use lldb 'process unload' to unload the dylib.
- self.expect("process unload %s" % index, "%s unloaded correctly" % dylibName,
- patterns = ["Unloading .* with index %s.*ok" % index])
+ self.expect(
+ "process unload %s" %
+ index,
+ "%s unloaded correctly" %
+ dylibName,
+ patterns=[
+ "Unloading .* with index %s.*ok" %
+ index])
self.runCmd("process continue")
- @skipIfFreeBSD # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support
+ @skipIfFreeBSD # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support
def test_load_unload(self):
"""Test breakpoint by name works correctly with dlopen'ing."""
@@ -251,19 +303,20 @@ class LoadUnloadTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break by function name a_function (not yet loaded).
- lldbutil.run_break_set_by_symbol (self, "a_function", num_expected_locations=0)
+ lldbutil.run_break_set_by_symbol(
+ self, "a_function", num_expected_locations=0)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint and at a_function.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'a_function',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'a_function',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
# Issue the 'contnue' command. We should stop agaian at a_function.
# The stop reason of the thread should be breakpoint and at a_function.
@@ -272,17 +325,17 @@ class LoadUnloadTestCase(TestBase):
# rdar://problem/8508987
# The a_function breakpoint should be encountered twice.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'a_function',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'a_function',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 2.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 2'])
+ substrs=[' resolved, hit count = 2'])
- @skipIfFreeBSD # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support
- @skipIfWindows # Windows doesn't have dlopen and friends, dynamic libraries work differently
- def test_step_over_load (self):
+ @skipIfFreeBSD # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support
+ @skipIfWindows # Windows doesn't have dlopen and friends, dynamic libraries work differently
+ def test_step_over_load(self):
"""Test stepping over code that loads a shared library works correctly."""
# Invoke the default build rule.
@@ -293,26 +346,29 @@ class LoadUnloadTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break by function name a_function (not yet loaded).
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint and at a_function.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
+
+ self.runCmd(
+ "thread step-over",
+ "Stepping over function that loads library")
- self.runCmd("thread step-over", "Stepping over function that loads library")
-
# The stop reason should be step end.
- self.expect("thread list", "step over succeeded.",
- substrs = ['stopped',
- 'stop reason = step over'])
+ self.expect("thread list", "step over succeeded.",
+ substrs=['stopped',
+ 'stop reason = step over'])
- @skipIfFreeBSD # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support
- @skipIfWindows # Windows doesn't have dlopen and friends, dynamic libraries work differently
+ @skipIfFreeBSD # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support
+ @skipIfWindows # Windows doesn't have dlopen and friends, dynamic libraries work differently
@unittest2.expectedFailure("llvm.org/pr25806")
- def test_static_init_during_load (self):
+ def test_static_init_during_load(self):
"""Test that we can set breakpoints correctly in static initializers"""
self.build()
@@ -321,33 +377,36 @@ class LoadUnloadTestCase(TestBase):
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- a_init_bp_num = lldbutil.run_break_set_by_symbol(self, "a_init", num_expected_locations=0)
- b_init_bp_num = lldbutil.run_break_set_by_symbol(self, "b_init", num_expected_locations=0)
- d_init_bp_num = lldbutil.run_break_set_by_symbol(self, "d_init", num_expected_locations=1)
+ a_init_bp_num = lldbutil.run_break_set_by_symbol(
+ self, "a_init", num_expected_locations=0)
+ b_init_bp_num = lldbutil.run_break_set_by_symbol(
+ self, "b_init", num_expected_locations=0)
+ d_init_bp_num = lldbutil.run_break_set_by_symbol(
+ self, "d_init", num_expected_locations=1)
self.runCmd("run", RUN_SUCCEEDED)
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'd_init',
- 'stop reason = breakpoint %d' % d_init_bp_num])
+ substrs=['stopped',
+ 'd_init',
+ 'stop reason = breakpoint %d' % d_init_bp_num])
self.runCmd("continue")
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'a_init',
- 'stop reason = breakpoint %d' % a_init_bp_num])
+ substrs=['stopped',
+ 'a_init',
+ 'stop reason = breakpoint %d' % a_init_bp_num])
self.expect("thread backtrace",
- substrs = ['a_init',
- 'dlopen',
- 'main'])
+ substrs=['a_init',
+ 'dlopen',
+ 'main'])
self.runCmd("continue")
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'b_init',
- 'stop reason = breakpoint %d' % b_init_bp_num])
+ substrs=['stopped',
+ 'b_init',
+ 'stop reason = breakpoint %d' % b_init_bp_num])
self.expect("thread backtrace",
- substrs = ['b_init',
- 'dlopen',
- 'main'])
+ substrs=['b_init',
+ 'dlopen',
+ 'main'])
diff --git a/packages/Python/lldbsuite/test/functionalities/longjmp/TestLongjmp.py b/packages/Python/lldbsuite/test/functionalities/longjmp/TestLongjmp.py
index d9f2b2231895..dd4ab4cab2a9 100644
--- a/packages/Python/lldbsuite/test/functionalities/longjmp/TestLongjmp.py
+++ b/packages/Python/lldbsuite/test/functionalities/longjmp/TestLongjmp.py
@@ -5,13 +5,13 @@ Test the use of setjmp/longjmp for non-local goto operations in a single-threade
from __future__ import print_function
-
import os
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class LongjmpTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -19,8 +19,8 @@ class LongjmpTestCase(TestBase):
def setUp(self):
TestBase.setUp(self)
- @skipIfDarwin # llvm.org/pr16769: LLDB on Mac OS X dies in function ReadRegisterBytes in GDBRemoteRegisterContext.cpp
- @skipIfFreeBSD # llvm.org/pr17214
+ @skipIfDarwin # llvm.org/pr16769: LLDB on Mac OS X dies in function ReadRegisterBytes in GDBRemoteRegisterContext.cpp
+ @skipIfFreeBSD # llvm.org/pr17214
@expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr20231")
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")
def test_step_out(self):
@@ -28,8 +28,8 @@ class LongjmpTestCase(TestBase):
self.build()
self.step_out()
- @skipIfDarwin # llvm.org/pr16769: LLDB on Mac OS X dies in function ReadRegisterBytes in GDBRemoteRegisterContext.cpp
- @skipIfFreeBSD # llvm.org/pr17214
+ @skipIfDarwin # llvm.org/pr16769: LLDB on Mac OS X dies in function ReadRegisterBytes in GDBRemoteRegisterContext.cpp
+ @skipIfFreeBSD # llvm.org/pr17214
@expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr20231")
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")
def test_step_over(self):
@@ -37,8 +37,8 @@ class LongjmpTestCase(TestBase):
self.build()
self.step_over()
- @skipIfDarwin # llvm.org/pr16769: LLDB on Mac OS X dies in function ReadRegisterBytes in GDBRemoteRegisterContext.cpp
- @skipIfFreeBSD # llvm.org/pr17214
+ @skipIfDarwin # llvm.org/pr16769: LLDB on Mac OS X dies in function ReadRegisterBytes in GDBRemoteRegisterContext.cpp
+ @skipIfFreeBSD # llvm.org/pr17214
@expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr20231")
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")
def test_step_back_out(self):
@@ -52,19 +52,20 @@ class LongjmpTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break in main().
- lldbutil.run_break_set_by_symbol (self, symbol, num_expected_locations=-1)
+ lldbutil.run_break_set_by_symbol(
+ self, symbol, num_expected_locations=-1)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped', 'stop reason = breakpoint'])
+ substrs=['stopped', 'stop reason = breakpoint'])
def check_status(self):
# Note: Depending on the generated mapping of DWARF to assembly,
# the process may have stopped or exited.
self.expect("process status", PROCESS_STOPPED,
- patterns = ['Process .* exited with status = 0'])
+ patterns=['Process .* exited with status = 0'])
def step_out(self):
self.start_test("do_jump")
@@ -79,7 +80,7 @@ class LongjmpTestCase(TestBase):
def step_back_out(self):
self.start_test("main")
-
+
self.runCmd("thread step-over", RUN_SUCCEEDED)
self.runCmd("thread step-in", RUN_SUCCEEDED)
self.runCmd("thread step-out", RUN_SUCCEEDED)
diff --git a/packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py b/packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py
index a65882d3fa43..f2126e9ffd5f 100644
--- a/packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py
+++ b/packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py
@@ -5,14 +5,15 @@ Test the MemoryCache L1 flush.
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class MemoryCacheTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -31,17 +32,18 @@ class MemoryCacheTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break in main() after the variables are assigned values.
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped', 'stop reason = breakpoint'])
+ substrs=['stopped', 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
# Read a chunk of memory containing &my_ints[0]. The number of bytes read
# must be greater than m_L2_cache_line_byte_size to make sure the L1
diff --git a/packages/Python/lldbsuite/test/functionalities/memory/find/Makefile b/packages/Python/lldbsuite/test/functionalities/memory/find/Makefile
new file mode 100644
index 000000000000..314f1cb2f077
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/memory/find/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/memory/find/TestMemoryFind.py b/packages/Python/lldbsuite/test/functionalities/memory/find/TestMemoryFind.py
new file mode 100644
index 000000000000..f8f10a8d4f56
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/memory/find/TestMemoryFind.py
@@ -0,0 +1,71 @@
+"""
+Test the 'memory find' command.
+"""
+
+from __future__ import print_function
+
+
+import os
+import time
+import re
+import lldb
+from lldbsuite.test.lldbtest import *
+import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test.decorators import *
+
+
+class MemoryFindTestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ # Call super's setUp().
+ TestBase.setUp(self)
+ # Find the line number to break inside main().
+ self.line = line_number('main.cpp', '// break here')
+
+ @expectedFailureAll(oslist=["windows"])
+ def test_memory_find(self):
+ """Test the 'memory find' command."""
+ self.build()
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+ # Break in main() aftre the variables are assigned values.
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ # The stop reason of the thread should be breakpoint.
+ self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+ substrs=['stopped', 'stop reason = breakpoint'])
+
+ # The breakpoint should have a hit count of 1.
+ self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
+ substrs=[' resolved, hit count = 1'])
+
+ # Test the memory find commands.
+
+ self.expect(
+ 'memory find -s "in const" `stringdata` `stringdata+(int)strlen(stringdata)`',
+ substrs=[
+ 'data found at location: 0x',
+ '69 6e 20 63',
+ 'in const'])
+
+ self.expect(
+ 'memory find -e "(uint8_t)0x22" `&bytedata[0]` `&bytedata[15]`',
+ substrs=[
+ 'data found at location: 0x',
+ '22 33 44 55 66'])
+
+ self.expect(
+ 'memory find -e "(uint8_t)0x22" `&bytedata[0]` `&bytedata[2]`',
+ substrs=['data not found within the range.'])
+
+ self.expect('memory find -s "nothere" `stringdata` `stringdata+5`',
+ substrs=['data not found within the range.'])
+
+ self.expect('memory find -s "nothere" `stringdata` `stringdata+10`',
+ substrs=['data not found within the range.'])
diff --git a/packages/Python/lldbsuite/test/functionalities/memory/find/main.cpp b/packages/Python/lldbsuite/test/functionalities/memory/find/main.cpp
new file mode 100644
index 000000000000..250f359c76e0
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/memory/find/main.cpp
@@ -0,0 +1,17 @@
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+#include <stdio.h>
+#include <stdint.h>
+
+int main (int argc, char const *argv[])
+{
+ const char* stringdata = "hello world; I like to write text in const char pointers";
+ uint8_t bytedata[] = {0xAA,0xBB,0xCC,0xDD,0xEE,0xFF,0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88,0x99};
+ return 0; // break here
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/memory/read/TestMemoryRead.py b/packages/Python/lldbsuite/test/functionalities/memory/read/TestMemoryRead.py
index 7410650ad652..9d4e44c96bbc 100644
--- a/packages/Python/lldbsuite/test/functionalities/memory/read/TestMemoryRead.py
+++ b/packages/Python/lldbsuite/test/functionalities/memory/read/TestMemoryRead.py
@@ -5,13 +5,14 @@ Test the 'memory read' command.
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class MemoryReadTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -29,17 +30,18 @@ class MemoryReadTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break in main() aftre the variables are assigned values.
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped', 'stop reason = breakpoint'])
+ substrs=['stopped', 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
# Test the memory read commands.
@@ -61,39 +63,58 @@ class MemoryReadTestCase(TestBase):
# 0x7fff5fbff9a4: {0x00000000}
# 0x7fff5fbff9a8: {0x0ec0bf27}
# 0x7fff5fbff9ac: {0x215db505}
- self.runCmd("memory read --format uint32_t[] --size 4 --count 4 `&argc`")
+ self.runCmd(
+ "memory read --format uint32_t[] --size 4 --count 4 `&argc`")
lines = self.res.GetOutput().splitlines()
for i in range(4):
if i == 0:
# Verify that the printout for argc is correct.
- self.assertTrue(argc == int(lines[i].split(':')[1].strip(' {}'), 0))
+ self.assertTrue(
+ argc == int(
+ lines[i].split(':')[1].strip(' {}'), 0))
addr = int(lines[i].split(':')[0], 0)
# Verify that the printout for addr is incremented correctly.
- self.assertTrue(addr == (address + i*4))
+ self.assertTrue(addr == (address + i * 4))
# (lldb) memory read --format char[] --size 7 --count 1 `&my_string`
# 0x7fff5fbff990: {abcdefg}
- self.expect("memory read --format char[] --size 7 --count 1 `&my_string`",
- substrs = ['abcdefg'])
+ self.expect(
+ "memory read --format char[] --size 7 --count 1 `&my_string`",
+ substrs=['abcdefg'])
# (lldb) memory read --format 'hex float' --size 16 `&argc`
- # 0x7fff5fbff5b0: error: unsupported byte size (16) for hex float format
- self.expect("memory read --format 'hex float' --size 16 `&argc`",
- substrs = ['unsupported byte size (16) for hex float format'])
+ # 0x7fff5fbff5b0: error: unsupported byte size (16) for hex float
+ # format
+ self.expect(
+ "memory read --format 'hex float' --size 16 `&argc`",
+ substrs=['unsupported byte size (16) for hex float format'])
- self.expect("memory read --format 'float' --count 1 --size 8 `&my_double`",
- substrs = ['1234.'])
+ self.expect(
+ "memory read --format 'float' --count 1 --size 8 `&my_double`",
+ substrs=['1234.'])
# (lldb) memory read --format 'float' --count 1 --size 20 `&my_double`
# 0x7fff5fbff598: error: unsupported byte size (20) for float format
- self.expect("memory read --format 'float' --count 1 --size 20 `&my_double`",
- substrs = ['unsupported byte size (20) for float format'])
+ self.expect(
+ "memory read --format 'float' --count 1 --size 20 `&my_double`",
+ substrs=['unsupported byte size (20) for float format'])
self.expect('memory read --type int --count 5 `&my_ints[0]`',
- substrs=['(int) 0x', '2','4','6','8','10'])
-
- self.expect('memory read --type int --count 5 --format hex `&my_ints[0]`',
- substrs=['(int) 0x', '0x','0a'])
-
- self.expect('memory read --type int --count 5 --offset 5 `&my_ints[0]`',
- substrs=['(int) 0x', '12', '14','16','18', '20'])
+ substrs=['(int) 0x', '2', '4', '6', '8', '10'])
+
+ self.expect(
+ 'memory read --type int --count 5 --format hex `&my_ints[0]`',
+ substrs=[
+ '(int) 0x',
+ '0x',
+ '0a'])
+
+ self.expect(
+ 'memory read --type int --count 5 --offset 5 `&my_ints[0]`',
+ substrs=[
+ '(int) 0x',
+ '12',
+ '14',
+ '16',
+ '18',
+ '20'])
diff --git a/packages/Python/lldbsuite/test/functionalities/multidebugger_commands/TestMultipleDebuggersCommands.py b/packages/Python/lldbsuite/test/functionalities/multidebugger_commands/TestMultipleDebuggersCommands.py
index 7d959ec504c8..9cdd7158516d 100644
--- a/packages/Python/lldbsuite/test/functionalities/multidebugger_commands/TestMultipleDebuggersCommands.py
+++ b/packages/Python/lldbsuite/test/functionalities/multidebugger_commands/TestMultipleDebuggersCommands.py
@@ -5,13 +5,14 @@ Test that commands do not try and hold on to stale CommandInterpreters in a mult
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class MultipleDebuggersCommandsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -21,28 +22,33 @@ class MultipleDebuggersCommandsTestCase(TestBase):
"""Test that commands do not try and hold on to stale CommandInterpreters in a multiple debuggers scenario"""
source_init_files = False
magic_text = "The following commands may relate to 'env'"
-
+
debugger_1 = lldb.SBDebugger.Create(source_init_files)
interpreter_1 = debugger_1.GetCommandInterpreter()
-
+
retobj = lldb.SBCommandReturnObject()
interpreter_1.HandleCommand("apropos env", retobj)
- self.assertTrue(magic_text in str(retobj), "[interpreter_1]: the output does not contain the correct words")
-
- if self.TraceOn(): print(str(retobj))
-
+ self.assertTrue(
+ magic_text in str(retobj),
+ "[interpreter_1]: the output does not contain the correct words")
+
+ if self.TraceOn():
+ print(str(retobj))
+
lldb.SBDebugger.Destroy(debugger_1)
-
+
# now do this again with a different debugger - we shouldn't crash
-
+
debugger_2 = lldb.SBDebugger.Create(source_init_files)
interpreter_2 = debugger_2.GetCommandInterpreter()
-
+
retobj = lldb.SBCommandReturnObject()
interpreter_2.HandleCommand("apropos env", retobj)
- self.assertTrue(magic_text in str(retobj), "[interpreter_2]: the output does not contain the correct words")
-
- if self.TraceOn(): print(str(retobj))
-
+ self.assertTrue(
+ magic_text in str(retobj),
+ "[interpreter_2]: the output does not contain the correct words")
+
+ if self.TraceOn():
+ print(str(retobj))
+
lldb.SBDebugger.Destroy(debugger_2)
-
diff --git a/packages/Python/lldbsuite/test/functionalities/nested_alias/TestNestedAlias.py b/packages/Python/lldbsuite/test/functionalities/nested_alias/TestNestedAlias.py
index 6a74ddb727df..86c5e41b0931 100644
--- a/packages/Python/lldbsuite/test/functionalities/nested_alias/TestNestedAlias.py
+++ b/packages/Python/lldbsuite/test/functionalities/nested_alias/TestNestedAlias.py
@@ -5,13 +5,14 @@ Test that an alias can reference other aliases without crashing.
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class NestedAliasTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -29,17 +30,18 @@ class NestedAliasTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break in main() aftre the variables are assigned values.
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped', 'stop reason = breakpoint'])
+ substrs=['stopped', 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
# This is the function to remove the custom aliases in order to have a
# clean slate for the next test case.
@@ -54,15 +56,38 @@ class NestedAliasTestCase(TestBase):
self.runCmd('command alias read memory read -f A')
self.runCmd('command alias rd read -c 3')
-
- self.expect('memory read -f A -c 3 `&my_ptr[0]`', substrs=['deadbeef', 'main.cpp:', 'feedbeef'])
- self.expect('rd `&my_ptr[0]`', substrs=['deadbeef', 'main.cpp:', 'feedbeef'])
- self.expect('memory read -f A -c 3 `&my_ptr[0]`', substrs=['deadfeed'], matching=False)
+ self.expect(
+ 'memory read -f A -c 3 `&my_ptr[0]`',
+ substrs=[
+ 'deadbeef',
+ 'main.cpp:',
+ 'feedbeef'])
+ self.expect(
+ 'rd `&my_ptr[0]`',
+ substrs=[
+ 'deadbeef',
+ 'main.cpp:',
+ 'feedbeef'])
+
+ self.expect(
+ 'memory read -f A -c 3 `&my_ptr[0]`',
+ substrs=['deadfeed'],
+ matching=False)
self.expect('rd `&my_ptr[0]`', substrs=['deadfeed'], matching=False)
self.runCmd('command alias fo frame variable -O --')
self.runCmd('command alias foself fo self')
-
- self.expect('help foself', substrs=['--show-all-children', '--raw-output'], matching=False)
- self.expect('help foself', substrs=['Show variables for the current', 'stack frame.'], matching=True)
+
+ self.expect(
+ 'help foself',
+ substrs=[
+ '--show-all-children',
+ '--raw-output'],
+ matching=False)
+ self.expect(
+ 'help foself',
+ substrs=[
+ 'Show variables for the current',
+ 'stack frame.'],
+ matching=True)
diff --git a/packages/Python/lldbsuite/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py b/packages/Python/lldbsuite/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py
index 5c53cfaf9120..bbaba956acfd 100644
--- a/packages/Python/lldbsuite/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py
+++ b/packages/Python/lldbsuite/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py
@@ -4,11 +4,11 @@ from out of scope to in scope when stopped at the breakpoint."""
from __future__ import print_function
-
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class NonOverlappingIndexVariableCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -16,7 +16,8 @@ class NonOverlappingIndexVariableCase(TestBase):
def setUp(self):
TestBase.setUp(self)
self.source = 'main.cpp'
- self.line_to_break = line_number(self.source, '// Set breakpoint here.')
+ self.line_to_break = line_number(
+ self.source, '// Set breakpoint here.')
# rdar://problem/9890530
def test_eval_index_variable(self):
@@ -26,14 +27,19 @@ class NonOverlappingIndexVariableCase(TestBase):
exe = os.path.join(os.getcwd(), self.exe_name)
self.runCmd("file %s" % exe, CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, self.source, self.line_to_break, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self,
+ self.source,
+ self.line_to_break,
+ num_expected_locations=1,
+ loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
self.runCmd('frame variable i')
self.runCmd('expr i')
diff --git a/packages/Python/lldbsuite/test/functionalities/nosucharch/TestNoSuchArch.py b/packages/Python/lldbsuite/test/functionalities/nosucharch/TestNoSuchArch.py
index 7a6c98d92c3e..be89e36b5ce0 100644
--- a/packages/Python/lldbsuite/test/functionalities/nosucharch/TestNoSuchArch.py
+++ b/packages/Python/lldbsuite/test/functionalities/nosucharch/TestNoSuchArch.py
@@ -4,24 +4,28 @@ Test that using a non-existent architecture name does not crash LLDB.
from __future__ import print_function
-
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class NoSuchArchTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- def test (self):
+ def test(self):
self.build()
- exe = os.path.join (os.getcwd(), "a.out")
+ exe = os.path.join(os.getcwd(), "a.out")
- # Check that passing an invalid arch via the command-line fails but doesn't crash
- self.expect("target crete --arch nothingtoseehere %s" % (exe), error=True)
+ # Check that passing an invalid arch via the command-line fails but
+ # doesn't crash
+ self.expect(
+ "target crete --arch nothingtoseehere %s" %
+ (exe), error=True)
- # Check that passing an invalid arch via the SB API fails but doesn't crash
- target = self.dbg.CreateTargetWithFileAndArch(exe,"nothingtoseehere")
+ # Check that passing an invalid arch via the SB API fails but doesn't
+ # crash
+ target = self.dbg.CreateTargetWithFileAndArch(exe, "nothingtoseehere")
self.assertFalse(target.IsValid(), "This target should not be valid")
# Now just create the target with the default arch and check it's fine
diff --git a/packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py b/packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
index 0fdc43bb9feb..93eac1ecd105 100644
--- a/packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
+++ b/packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
@@ -7,7 +7,6 @@ foreign-architecture object files.
from __future__ import print_function
-
import os.path
import re
@@ -16,6 +15,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestImageListMultiArchitecture(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -35,7 +35,11 @@ class TestImageListMultiArchitecture(TestBase):
}
for image_name in images:
- file_name = os.path.abspath(os.path.join(os.path.dirname(__file__), "bin", image_name))
+ file_name = os.path.abspath(
+ os.path.join(
+ os.path.dirname(__file__),
+ "bin",
+ image_name))
expected_triple_and_arch_regex = images[image_name]
self.runCmd("file {}".format(file_name))
diff --git a/packages/Python/lldbsuite/test/functionalities/paths/TestPaths.py b/packages/Python/lldbsuite/test/functionalities/paths/TestPaths.py
index db577dc5bacd..7fc9a743d321 100644
--- a/packages/Python/lldbsuite/test/functionalities/paths/TestPaths.py
+++ b/packages/Python/lldbsuite/test/functionalities/paths/TestPaths.py
@@ -4,7 +4,6 @@ Test some lldb command abbreviations.
from __future__ import print_function
-
import lldb
import os
import time
@@ -12,25 +11,26 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestPaths(TestBase):
mydir = TestBase.compute_mydir(__file__)
@no_debug_info_test
- def test_paths (self):
+ def test_paths(self):
'''Test to make sure no file names are set in the lldb.SBFileSpec objects returned by lldb.SBHostOS.GetLLDBPath() for paths that are directories'''
- dir_path_types = [lldb.ePathTypeLLDBShlibDir,
- lldb.ePathTypeSupportExecutableDir,
- lldb.ePathTypeHeaderDir,
- lldb.ePathTypePythonDir,
- lldb.ePathTypeLLDBSystemPlugins,
- lldb.ePathTypeLLDBUserPlugins,
- lldb.ePathTypeLLDBTempSystemDir]
-
+ dir_path_types = [lldb.ePathTypeLLDBShlibDir,
+ lldb.ePathTypeSupportExecutableDir,
+ lldb.ePathTypeHeaderDir,
+ lldb.ePathTypePythonDir,
+ lldb.ePathTypeLLDBSystemPlugins,
+ lldb.ePathTypeLLDBUserPlugins,
+ lldb.ePathTypeLLDBTempSystemDir]
+
for path_type in dir_path_types:
- f = lldb.SBHostOS.GetLLDBPath(path_type);
+ f = lldb.SBHostOS.GetLLDBPath(path_type)
# No directory path types should have the filename set
- self.assertTrue (f.GetFilename() == None);
+ self.assertTrue(f.GetFilename() is None)
@no_debug_info_test
def test_directory_doesnt_end_with_slash(self):
@@ -41,9 +41,12 @@ class TestPaths(TestBase):
@skipUnlessPlatform(["windows"])
@no_debug_info_test
- def test_windows_double_slash (self):
+ def test_windows_double_slash(self):
'''Test to check the path with double slash is handled correctly '''
# Create a path and see if lldb gets the directory and file right
- fspec = lldb.SBFileSpec("C:\\dummy1\\dummy2//unknown_file", True);
- self.assertEqual(os.path.normpath(fspec.GetDirectory()), os.path.normpath("C:/dummy1/dummy2"));
- self.assertEqual(fspec.GetFilename(), "unknown_file");
+ fspec = lldb.SBFileSpec("C:\\dummy1\\dummy2//unknown_file", True)
+ self.assertEqual(
+ os.path.normpath(
+ fspec.GetDirectory()),
+ os.path.normpath("C:/dummy1/dummy2"))
+ self.assertEqual(fspec.GetFilename(), "unknown_file")
diff --git a/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformCommand.py b/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformCommand.py
index 9599f83d6a53..302201a9256a 100644
--- a/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformCommand.py
+++ b/packages/Python/lldbsuite/test/functionalities/platform/TestPlatformCommand.py
@@ -5,13 +5,14 @@ Test some lldb platform commands.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class PlatformCommandTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -23,45 +24,58 @@ class PlatformCommandTestCase(TestBase):
@no_debug_info_test
def test_list(self):
self.expect("platform list",
- patterns = ['^Available platforms:'])
+ patterns=['^Available platforms:'])
@no_debug_info_test
def test_process_list(self):
self.expect("platform process list",
- substrs = ['PID', 'TRIPLE', 'NAME'])
+ substrs=['PID', 'TRIPLE', 'NAME'])
@no_debug_info_test
def test_process_info_with_no_arg(self):
"""This is expected to fail and to return a proper error message."""
self.expect("platform process info", error=True,
- substrs = ['one or more process id(s) must be specified'])
+ substrs=['one or more process id(s) must be specified'])
@no_debug_info_test
def test_status(self):
- self.expect("platform status",
- substrs = ['Platform', 'Triple', 'OS Version', 'Kernel', 'Hostname'])
+ self.expect(
+ "platform status",
+ substrs=[
+ 'Platform',
+ 'Triple',
+ 'OS Version',
+ 'Kernel',
+ 'Hostname'])
@no_debug_info_test
def test_shell(self):
""" Test that the platform shell command can invoke ls. """
triple = self.dbg.GetSelectedPlatform().GetTriple()
if re.match(".*-.*-windows", triple):
- self.expect("platform shell dir c:\\", substrs = ["Windows", "Program Files"])
+ self.expect(
+ "platform shell dir c:\\", substrs=[
+ "Windows", "Program Files"])
elif re.match(".*-.*-.*-android", triple):
- self.expect("platform shell ls /", substrs = ["cache", "dev", "system"])
+ self.expect(
+ "platform shell ls /",
+ substrs=[
+ "cache",
+ "dev",
+ "system"])
else:
- self.expect("platform shell ls /", substrs = ["dev", "tmp", "usr"])
+ self.expect("platform shell ls /", substrs=["dev", "tmp", "usr"])
@no_debug_info_test
def test_shell_builtin(self):
""" Test a shell built-in command (echo) """
self.expect("platform shell echo hello lldb",
- substrs = ["hello lldb"])
+ substrs=["hello lldb"])
- #FIXME: re-enable once platform shell -t can specify the desired timeout
+ # FIXME: re-enable once platform shell -t can specify the desired timeout
@no_debug_info_test
def test_shell_timeout(self):
""" Test a shell built-in command (sleep) that times out """
self.skipTest("due to taking too long to complete.")
- self.expect("platform shell sleep 15", error=True,
- substrs = ["error: timed out waiting for shell command to complete"])
+ self.expect("platform shell sleep 15", error=True, substrs=[
+ "error: timed out waiting for shell command to complete"])
diff --git a/packages/Python/lldbsuite/test/functionalities/plugins/commands/TestPluginCommands.py b/packages/Python/lldbsuite/test/functionalities/plugins/commands/TestPluginCommands.py
index 619ed7afe328..18fcc41fa9f6 100644
--- a/packages/Python/lldbsuite/test/functionalities/plugins/commands/TestPluginCommands.py
+++ b/packages/Python/lldbsuite/test/functionalities/plugins/commands/TestPluginCommands.py
@@ -5,20 +5,27 @@ Test that plugins that load commands work correctly.
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class PluginCommandTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
+ def setUp(self):
+ TestBase.setUp(self)
+ self.generateSource('plugin.cpp')
+
@skipIfNoSBHeaders
- @skipIfHostIncompatibleWithRemote # Requires a compatible arch and platform to link against the host's built lldb lib.
+ # Requires a compatible arch and platform to link against the host's built
+ # lldb lib.
+ @skipIfHostIncompatibleWithRemote
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")
@no_debug_info_test
def test_load_plugin(self):
@@ -37,23 +44,26 @@ class PluginCommandTestCase(TestBase):
retobj = lldb.SBCommandReturnObject()
- retval = debugger.GetCommandInterpreter().HandleCommand("plugin load %s" % plugin_lib_name, retobj)
+ retval = debugger.GetCommandInterpreter().HandleCommand(
+ "plugin load %s" % plugin_lib_name, retobj)
retobj.Clear()
- retval = debugger.GetCommandInterpreter().HandleCommand("plugin_loaded_command child abc def ghi",retobj)
+ retval = debugger.GetCommandInterpreter().HandleCommand(
+ "plugin_loaded_command child abc def ghi", retobj)
if self.TraceOn():
print(retobj.GetOutput())
- self.expect(retobj,substrs = ['abc def ghi'], exe=False)
+ self.expect(retobj, substrs=['abc def ghi'], exe=False)
retobj.Clear()
# check that abbreviations work correctly in plugin commands.
- retval = debugger.GetCommandInterpreter().HandleCommand("plugin_loaded_ ch abc def ghi",retobj)
+ retval = debugger.GetCommandInterpreter().HandleCommand(
+ "plugin_loaded_ ch abc def ghi", retobj)
if self.TraceOn():
print(retobj.GetOutput())
- self.expect(retobj,substrs = ['abc def ghi'], exe=False)
+ self.expect(retobj, substrs=['abc def ghi'], exe=False)
diff --git a/packages/Python/lldbsuite/test/functionalities/plugins/commands/plugin.cpp b/packages/Python/lldbsuite/test/functionalities/plugins/commands/plugin.cpp.template
index be3d29325de1..393e9feec796 100644
--- a/packages/Python/lldbsuite/test/functionalities/plugins/commands/plugin.cpp
+++ b/packages/Python/lldbsuite/test/functionalities/plugins/commands/plugin.cpp.template
@@ -13,15 +13,7 @@ Compile this into a dylib foo.dylib and load by placing in appropriate locations
by typing plugin load foo.dylib at the LLDB command line
*/
-#if defined (__APPLE__)
-#include <LLDB/SBCommandInterpreter.h>
-#include <LLDB/SBCommandReturnObject.h>
-#include <LLDB/SBDebugger.h>
-#else
-#include <lldb/API/SBCommandInterpreter.h>
-#include <lldb/API/SBCommandReturnObject.h>
-#include <lldb/API/SBDebugger.h>
-#endif
+%include_SB_APIs%
namespace lldb {
bool
diff --git a/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py b/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py
index ebd96d9d4c02..9a5d320dce55 100644
--- a/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py
+++ b/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py
@@ -5,13 +5,14 @@ Test that the Python operating system plugin works correctly
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class PluginPythonOSPlugin(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -31,9 +32,11 @@ class PluginPythonOSPlugin(TestBase):
registers = frame.GetRegisters().GetValueAtIndex(0)
reg_value = thread.GetThreadID() + 1
for reg in registers:
- self.assertTrue(reg.GetValueAsUnsigned() == reg_value, "Verify the registers contains the correct value")
+ self.assertTrue(
+ reg.GetValueAsUnsigned() == reg_value,
+ "Verify the registers contains the correct value")
reg_value = reg_value + 1
-
+
def run_python_os_funcionality(self):
"""Test that the Python operating system plugin works correctly"""
@@ -47,52 +50,76 @@ class PluginPythonOSPlugin(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- # Set breakpoints inside and outside methods that take pointers to the containing struct.
- lldbutil.run_break_set_by_source_regexp (self, "// Set breakpoint here")
+ # Set breakpoints inside and outside methods that take pointers to the
+ # containing struct.
+ lldbutil.run_break_set_by_source_regexp(self, "// Set breakpoint here")
- # Register our shared libraries for remote targets so they get automatically uploaded
+ # Register our shared libraries for remote targets so they get
+ # automatically uploaded
arguments = None
- environment = None
+ environment = None
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (arguments, environment, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ arguments, environment, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
- # Make sure there are no OS plug-in created thread when we first stop at our breakpoint in main
- thread = process.GetThreadByID(0x111111111);
- self.assertFalse (thread.IsValid(), "Make sure there is no thread 0x111111111 before we load the python OS plug-in");
- thread = process.GetThreadByID(0x222222222);
- self.assertFalse (thread.IsValid(), "Make sure there is no thread 0x222222222 before we load the python OS plug-in");
- thread = process.GetThreadByID(0x333333333);
- self.assertFalse (thread.IsValid(), "Make sure there is no thread 0x333333333 before we load the python OS plug-in");
-
+ # Make sure there are no OS plug-in created thread when we first stop
+ # at our breakpoint in main
+ thread = process.GetThreadByID(0x111111111)
+ self.assertFalse(
+ thread.IsValid(),
+ "Make sure there is no thread 0x111111111 before we load the python OS plug-in")
+ thread = process.GetThreadByID(0x222222222)
+ self.assertFalse(
+ thread.IsValid(),
+ "Make sure there is no thread 0x222222222 before we load the python OS plug-in")
+ thread = process.GetThreadByID(0x333333333)
+ self.assertFalse(
+ thread.IsValid(),
+ "Make sure there is no thread 0x333333333 before we load the python OS plug-in")
# Now load the python OS plug-in which should update the thread list and we should have
- # OS plug-in created threads with the IDs: 0x111111111, 0x222222222, 0x333333333
+ # OS plug-in created threads with the IDs: 0x111111111, 0x222222222,
+ # 0x333333333
command = "settings set target.process.python-os-plugin-path '%s'" % python_os_plugin_path
self.dbg.HandleCommand(command)
# Verify our OS plug-in threads showed up
- thread = process.GetThreadByID(0x111111111);
- self.assertTrue (thread.IsValid(), "Make sure there is a thread 0x111111111 after we load the python OS plug-in");
+ thread = process.GetThreadByID(0x111111111)
+ self.assertTrue(
+ thread.IsValid(),
+ "Make sure there is a thread 0x111111111 after we load the python OS plug-in")
self.verify_os_thread_registers(thread)
- thread = process.GetThreadByID(0x222222222);
- self.assertTrue (thread.IsValid(), "Make sure there is a thread 0x222222222 after we load the python OS plug-in");
+ thread = process.GetThreadByID(0x222222222)
+ self.assertTrue(
+ thread.IsValid(),
+ "Make sure there is a thread 0x222222222 after we load the python OS plug-in")
self.verify_os_thread_registers(thread)
- thread = process.GetThreadByID(0x333333333);
- self.assertTrue (thread.IsValid(), "Make sure there is a thread 0x333333333 after we load the python OS plug-in");
+ thread = process.GetThreadByID(0x333333333)
+ self.assertTrue(
+ thread.IsValid(),
+ "Make sure there is a thread 0x333333333 after we load the python OS plug-in")
self.verify_os_thread_registers(thread)
-
- # Now clear the OS plug-in path to make the OS plug-in created threads dissappear
- self.dbg.HandleCommand("settings clear target.process.python-os-plugin-path")
-
+
+ # Now clear the OS plug-in path to make the OS plug-in created threads
+ # dissappear
+ self.dbg.HandleCommand(
+ "settings clear target.process.python-os-plugin-path")
+
# Verify the threads are gone after unloading the python OS plug-in
- thread = process.GetThreadByID(0x111111111);
- self.assertFalse (thread.IsValid(), "Make sure there is no thread 0x111111111 after we unload the python OS plug-in");
- thread = process.GetThreadByID(0x222222222);
- self.assertFalse (thread.IsValid(), "Make sure there is no thread 0x222222222 after we unload the python OS plug-in");
- thread = process.GetThreadByID(0x333333333);
- self.assertFalse (thread.IsValid(), "Make sure there is no thread 0x333333333 after we unload the python OS plug-in");
+ thread = process.GetThreadByID(0x111111111)
+ self.assertFalse(
+ thread.IsValid(),
+ "Make sure there is no thread 0x111111111 after we unload the python OS plug-in")
+ thread = process.GetThreadByID(0x222222222)
+ self.assertFalse(
+ thread.IsValid(),
+ "Make sure there is no thread 0x222222222 after we unload the python OS plug-in")
+ thread = process.GetThreadByID(0x333333333)
+ self.assertFalse(
+ thread.IsValid(),
+ "Make sure there is no thread 0x333333333 after we unload the python OS plug-in")
def run_python_os_step(self):
"""Test that the Python operating system plugin works correctly and allows single stepping of a virtual thread that is backed by a real thread"""
@@ -107,44 +134,64 @@ class PluginPythonOSPlugin(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- # Set breakpoints inside and outside methods that take pointers to the containing struct.
- lldbutil.run_break_set_by_source_regexp (self, "// Set breakpoint here")
+ # Set breakpoints inside and outside methods that take pointers to the
+ # containing struct.
+ lldbutil.run_break_set_by_source_regexp(self, "// Set breakpoint here")
- # Register our shared libraries for remote targets so they get automatically uploaded
+ # Register our shared libraries for remote targets so they get
+ # automatically uploaded
arguments = None
- environment = None
+ environment = None
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (arguments, environment, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ arguments, environment, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
- # Make sure there are no OS plug-in created thread when we first stop at our breakpoint in main
- thread = process.GetThreadByID(0x111111111);
- self.assertFalse (thread.IsValid(), "Make sure there is no thread 0x111111111 before we load the python OS plug-in");
-
+ # Make sure there are no OS plug-in created thread when we first stop
+ # at our breakpoint in main
+ thread = process.GetThreadByID(0x111111111)
+ self.assertFalse(
+ thread.IsValid(),
+ "Make sure there is no thread 0x111111111 before we load the python OS plug-in")
# Now load the python OS plug-in which should update the thread list and we should have
- # OS plug-in created threads with the IDs: 0x111111111, 0x222222222, 0x333333333
+ # OS plug-in created threads with the IDs: 0x111111111, 0x222222222,
+ # 0x333333333
command = "settings set target.process.python-os-plugin-path '%s'" % python_os_plugin_path
self.dbg.HandleCommand(command)
# Verify our OS plug-in threads showed up
- thread = process.GetThreadByID(0x111111111);
- self.assertTrue (thread.IsValid(), "Make sure there is a thread 0x111111111 after we load the python OS plug-in");
+ thread = process.GetThreadByID(0x111111111)
+ self.assertTrue(
+ thread.IsValid(),
+ "Make sure there is a thread 0x111111111 after we load the python OS plug-in")
frame = thread.GetFrameAtIndex(0)
- self.assertTrue(frame.IsValid(), "Make sure we get a frame from thread 0x111111111")
+ self.assertTrue(
+ frame.IsValid(),
+ "Make sure we get a frame from thread 0x111111111")
line_entry = frame.GetLineEntry()
- self.assertTrue(line_entry.GetFileSpec().GetFilename() == 'main.c', "Make sure we stopped on line 5 in main.c")
- self.assertTrue(line_entry.GetLine() == 5, "Make sure we stopped on line 5 in main.c")
+ self.assertTrue(
+ line_entry.GetFileSpec().GetFilename() == 'main.c',
+ "Make sure we stopped on line 5 in main.c")
+ self.assertTrue(
+ line_entry.GetLine() == 5,
+ "Make sure we stopped on line 5 in main.c")
- # Now single step thread 0x111111111 and make sure it does what we need it to
+ # Now single step thread 0x111111111 and make sure it does what we need
+ # it to
thread.StepOver()
-
+
frame = thread.GetFrameAtIndex(0)
- self.assertTrue(frame.IsValid(), "Make sure we get a frame from thread 0x111111111")
+ self.assertTrue(
+ frame.IsValid(),
+ "Make sure we get a frame from thread 0x111111111")
line_entry = frame.GetLineEntry()
-
- self.assertTrue(line_entry.GetFileSpec().GetFilename() == 'main.c', "Make sure we stepped from line 5 to line 6 in main.c")
- self.assertTrue(line_entry.GetLine() == 6, "Make sure we stepped from line 5 to line 6 in main.c")
+
+ self.assertTrue(
+ line_entry.GetFileSpec().GetFilename() == 'main.c',
+ "Make sure we stepped from line 5 to line 6 in main.c")
+ self.assertTrue(line_entry.GetLine() == 6,
+ "Make sure we stepped from line 5 to line 6 in main.c")
diff --git a/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/operating_system.py b/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/operating_system.py
index 536092e40b38..394c24b4a880 100644
--- a/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/operating_system.py
+++ b/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/operating_system.py
@@ -3,21 +3,22 @@
import lldb
import struct
+
class OperatingSystemPlugIn(object):
"""Class that provides data for an instance of a LLDB 'OperatingSystemPython' plug-in class"""
-
+
def __init__(self, process):
'''Initialization needs a valid.SBProcess object.
-
+
This plug-in will get created after a live process is valid and has stopped for the
first time.'''
self.process = None
self.registers = None
self.threads = None
- if type(process) is lldb.SBProcess and process.IsValid():
+ if isinstance(process, lldb.SBProcess) and process.IsValid():
self.process = process
- self.threads = None # Will be an dictionary containing info for each thread
-
+ self.threads = None # Will be an dictionary containing info for each thread
+
def get_target(self):
# NOTE: Don't use "lldb.target" when trying to get your target as the "lldb.target"
# tracks the current target in the LLDB command interpreter which isn't the
@@ -26,11 +27,16 @@ class OperatingSystemPlugIn(object):
def create_thread(self, tid, context):
if tid == 0x444444444:
- thread_info = { 'tid' : tid, 'name' : 'four' , 'queue' : 'queue4', 'state' : 'stopped', 'stop_reason' : 'none' }
+ thread_info = {
+ 'tid': tid,
+ 'name': 'four',
+ 'queue': 'queue4',
+ 'state': 'stopped',
+ 'stop_reason': 'none'}
self.threads.append(thread_info)
return thread_info
return None
-
+
def get_thread_info(self):
if not self.threads:
# The sample dictionary below shows the values that can be returned for a thread
@@ -48,43 +54,75 @@ class OperatingSystemPlugIn(object):
# Specifying this key/value pair for a thread will avoid a call to get_register_data()
# and can be used when your registers are in a thread context structure that is contiguous
# in memory. Don't specify this if your register layout in memory doesn't match the layout
- # described by the dictionary returned from a call to the get_register_info() method.
- self.threads = [
- { 'tid' : 0x111111111, 'name' : 'one' , 'queue' : 'queue1', 'state' : 'stopped', 'stop_reason' : 'breakpoint'},
- { 'tid' : 0x222222222, 'name' : 'two' , 'queue' : 'queue2', 'state' : 'stopped', 'stop_reason' : 'none' },
- { 'tid' : 0x333333333, 'name' : 'three', 'queue' : 'queue3', 'state' : 'stopped', 'stop_reason' : 'trace' }
- ]
+ # described by the dictionary returned from a call to the
+ # get_register_info() method.
+ self.threads = [{'tid': 0x111111111,
+ 'name': 'one',
+ 'queue': 'queue1',
+ 'state': 'stopped',
+ 'stop_reason': 'breakpoint'},
+ {'tid': 0x222222222,
+ 'name': 'two',
+ 'queue': 'queue2',
+ 'state': 'stopped',
+ 'stop_reason': 'none'},
+ {'tid': 0x333333333,
+ 'name': 'three',
+ 'queue': 'queue3',
+ 'state': 'stopped',
+ 'stop_reason': 'trace'}]
return self.threads
-
+
def get_register_info(self):
- if self.registers == None:
- self.registers = dict()
+ if self.registers is None:
+ self.registers = dict()
self.registers['sets'] = ['GPR']
self.registers['registers'] = [
- { 'name':'rax' , 'bitsize' : 64, 'offset' : 0, 'encoding':'uint' , 'format':'hex' , 'set': 0, 'gcc' : 0, 'dwarf' : 0},
- { 'name':'rbx' , 'bitsize' : 64, 'offset' : 8, 'encoding':'uint' , 'format':'hex' , 'set': 0, 'gcc' : 3, 'dwarf' : 3},
- { 'name':'rcx' , 'bitsize' : 64, 'offset' : 16, 'encoding':'uint' , 'format':'hex' , 'set': 0, 'gcc' : 2, 'dwarf' : 2, 'generic':'arg4', 'alt-name':'arg4', },
- { 'name':'rdx' , 'bitsize' : 64, 'offset' : 24, 'encoding':'uint' , 'format':'hex' , 'set': 0, 'gcc' : 1, 'dwarf' : 1, 'generic':'arg3', 'alt-name':'arg3', },
- { 'name':'rdi' , 'bitsize' : 64, 'offset' : 32, 'encoding':'uint' , 'format':'hex' , 'set': 0, 'gcc' : 5, 'dwarf' : 5, 'generic':'arg1', 'alt-name':'arg1', },
- { 'name':'rsi' , 'bitsize' : 64, 'offset' : 40, 'encoding':'uint' , 'format':'hex' , 'set': 0, 'gcc' : 4, 'dwarf' : 4, 'generic':'arg2', 'alt-name':'arg2', },
- { 'name':'rbp' , 'bitsize' : 64, 'offset' : 48, 'encoding':'uint' , 'format':'hex' , 'set': 0, 'gcc' : 6, 'dwarf' : 6, 'generic':'fp' , 'alt-name':'fp', },
- { 'name':'rsp' , 'bitsize' : 64, 'offset' : 56, 'encoding':'uint' , 'format':'hex' , 'set': 0, 'gcc' : 7, 'dwarf' : 7, 'generic':'sp' , 'alt-name':'sp', },
- { 'name':'r8' , 'bitsize' : 64, 'offset' : 64, 'encoding':'uint' , 'format':'hex' , 'set': 0, 'gcc' : 8, 'dwarf' : 8, 'generic':'arg5', 'alt-name':'arg5', },
- { 'name':'r9' , 'bitsize' : 64, 'offset' : 72, 'encoding':'uint' , 'format':'hex' , 'set': 0, 'gcc' : 9, 'dwarf' : 9, 'generic':'arg6', 'alt-name':'arg6', },
- { 'name':'r10' , 'bitsize' : 64, 'offset' : 80, 'encoding':'uint' , 'format':'hex' , 'set': 0, 'gcc' : 10, 'dwarf' : 10},
- { 'name':'r11' , 'bitsize' : 64, 'offset' : 88, 'encoding':'uint' , 'format':'hex' , 'set': 0, 'gcc' : 11, 'dwarf' : 11},
- { 'name':'r12' , 'bitsize' : 64, 'offset' : 96, 'encoding':'uint' , 'format':'hex' , 'set': 0, 'gcc' : 12, 'dwarf' : 12},
- { 'name':'r13' , 'bitsize' : 64, 'offset' : 104, 'encoding':'uint' , 'format':'hex' , 'set': 0, 'gcc' : 13, 'dwarf' : 13},
- { 'name':'r14' , 'bitsize' : 64, 'offset' : 112, 'encoding':'uint' , 'format':'hex' , 'set': 0, 'gcc' : 14, 'dwarf' : 14},
- { 'name':'r15' , 'bitsize' : 64, 'offset' : 120, 'encoding':'uint' , 'format':'hex' , 'set': 0, 'gcc' : 15, 'dwarf' : 15},
- { 'name':'rip' , 'bitsize' : 64, 'offset' : 128, 'encoding':'uint' , 'format':'hex' , 'set': 0, 'gcc' : 16, 'dwarf' : 16, 'generic':'pc', 'alt-name':'pc' },
- { 'name':'rflags' , 'bitsize' : 64, 'offset' : 136, 'encoding':'uint' , 'format':'hex' , 'set': 0, 'generic':'flags', 'alt-name':'flags' },
- { 'name':'cs' , 'bitsize' : 64, 'offset' : 144, 'encoding':'uint' , 'format':'hex' , 'set': 0 },
- { 'name':'fs' , 'bitsize' : 64, 'offset' : 152, 'encoding':'uint' , 'format':'hex' , 'set': 0 },
- { 'name':'gs' , 'bitsize' : 64, 'offset' : 160, 'encoding':'uint' , 'format':'hex' , 'set': 0 },
- ]
+ {'name': 'rax', 'bitsize': 64, 'offset': 0, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 0, 'dwarf': 0},
+ {'name': 'rbx', 'bitsize': 64, 'offset': 8, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 3, 'dwarf': 3},
+ {'name': 'rcx', 'bitsize': 64, 'offset': 16, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 2, 'dwarf': 2, 'generic': 'arg4', 'alt-name': 'arg4', },
+ {'name': 'rdx', 'bitsize': 64, 'offset': 24, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 1, 'dwarf': 1, 'generic': 'arg3', 'alt-name': 'arg3', },
+ {'name': 'rdi', 'bitsize': 64, 'offset': 32, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 5, 'dwarf': 5, 'generic': 'arg1', 'alt-name': 'arg1', },
+ {'name': 'rsi', 'bitsize': 64, 'offset': 40, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 4, 'dwarf': 4, 'generic': 'arg2', 'alt-name': 'arg2', },
+ {'name': 'rbp', 'bitsize': 64, 'offset': 48, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 6, 'dwarf': 6, 'generic': 'fp', 'alt-name': 'fp', },
+ {'name': 'rsp', 'bitsize': 64, 'offset': 56, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 7, 'dwarf': 7, 'generic': 'sp', 'alt-name': 'sp', },
+ {'name': 'r8', 'bitsize': 64, 'offset': 64, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 8, 'dwarf': 8, 'generic': 'arg5', 'alt-name': 'arg5', },
+ {'name': 'r9', 'bitsize': 64, 'offset': 72, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 9, 'dwarf': 9, 'generic': 'arg6', 'alt-name': 'arg6', },
+ {'name': 'r10', 'bitsize': 64, 'offset': 80, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 10, 'dwarf': 10},
+ {'name': 'r11', 'bitsize': 64, 'offset': 88, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 11, 'dwarf': 11},
+ {'name': 'r12', 'bitsize': 64, 'offset': 96, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 12, 'dwarf': 12},
+ {'name': 'r13', 'bitsize': 64, 'offset': 104, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 13, 'dwarf': 13},
+ {'name': 'r14', 'bitsize': 64, 'offset': 112, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 14, 'dwarf': 14},
+ {'name': 'r15', 'bitsize': 64, 'offset': 120, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 15, 'dwarf': 15},
+ {'name': 'rip', 'bitsize': 64, 'offset': 128, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 16, 'dwarf': 16, 'generic': 'pc', 'alt-name': 'pc'},
+ {'name': 'rflags', 'bitsize': 64, 'offset': 136, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'generic': 'flags', 'alt-name': 'flags'},
+ {'name': 'cs', 'bitsize': 64, 'offset': 144, 'encoding': 'uint', 'format': 'hex', 'set': 0},
+ {'name': 'fs', 'bitsize': 64, 'offset': 152, 'encoding': 'uint', 'format': 'hex', 'set': 0},
+ {'name': 'gs', 'bitsize': 64, 'offset': 160, 'encoding': 'uint', 'format': 'hex', 'set': 0},
+ ]
return self.registers
-
+
def get_register_data(self, tid):
- return struct.pack('21Q',tid + 1,tid + 2,tid + 3,tid + 4,tid + 5,tid + 6,tid + 7,tid + 8,tid + 9,tid + 10,tid + 11,tid + 12,tid + 13,tid + 14,tid + 15,tid + 16,tid + 17,tid + 18,tid + 19,tid + 20,tid + 21);
-
+ return struct.pack(
+ '21Q',
+ tid + 1,
+ tid + 2,
+ tid + 3,
+ tid + 4,
+ tid + 5,
+ tid + 6,
+ tid + 7,
+ tid + 8,
+ tid + 9,
+ tid + 10,
+ tid + 11,
+ tid + 12,
+ tid + 13,
+ tid + 14,
+ tid + 15,
+ tid + 16,
+ tid + 17,
+ tid + 18,
+ tid + 19,
+ tid + 20,
+ tid + 21)
diff --git a/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/operating_system2.py b/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/operating_system2.py
index 7a9435d44ed4..438538ca922e 100644
--- a/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/operating_system2.py
+++ b/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/operating_system2.py
@@ -3,21 +3,22 @@
import lldb
import struct
+
class OperatingSystemPlugIn(object):
"""Class that provides data for an instance of a LLDB 'OperatingSystemPython' plug-in class"""
-
+
def __init__(self, process):
'''Initialization needs a valid.SBProcess object.
-
+
This plug-in will get created after a live process is valid and has stopped for the
first time.'''
self.process = None
self.registers = None
self.threads = None
- if type(process) is lldb.SBProcess and process.IsValid():
+ if isinstance(process, lldb.SBProcess) and process.IsValid():
self.process = process
- self.threads = None # Will be an dictionary containing info for each thread
-
+ self.threads = None # Will be an dictionary containing info for each thread
+
def get_target(self):
# NOTE: Don't use "lldb.target" when trying to get your target as the "lldb.target"
# tracks the current target in the LLDB command interpreter which isn't the
@@ -26,11 +27,16 @@ class OperatingSystemPlugIn(object):
def create_thread(self, tid, context):
if tid == 0x444444444:
- thread_info = { 'tid' : tid, 'name' : 'four' , 'queue' : 'queue4', 'state' : 'stopped', 'stop_reason' : 'none' }
+ thread_info = {
+ 'tid': tid,
+ 'name': 'four',
+ 'queue': 'queue4',
+ 'state': 'stopped',
+ 'stop_reason': 'none'}
self.threads.append(thread_info)
return thread_info
return None
-
+
def get_thread_info(self):
if not self.threads:
# The sample dictionary below shows the values that can be returned for a thread
@@ -48,41 +54,63 @@ class OperatingSystemPlugIn(object):
# Specifying this key/value pair for a thread will avoid a call to get_register_data()
# and can be used when your registers are in a thread context structure that is contiguous
# in memory. Don't specify this if your register layout in memory doesn't match the layout
- # described by the dictionary returned from a call to the get_register_info() method.
+ # described by the dictionary returned from a call to the
+ # get_register_info() method.
self.threads = [
- { 'tid' : 0x111111111, 'core' : 0 }
- ]
+ {'tid': 0x111111111, 'core': 0}
+ ]
return self.threads
-
+
def get_register_info(self):
- if self.registers == None:
- self.registers = dict()
+ if self.registers is None:
+ self.registers = dict()
self.registers['sets'] = ['GPR']
self.registers['registers'] = [
- { 'name':'rax' , 'bitsize' : 64, 'offset' : 0, 'encoding':'uint' , 'format':'hex' , 'set': 0, 'gcc' : 0, 'dwarf' : 0},
- { 'name':'rbx' , 'bitsize' : 64, 'offset' : 8, 'encoding':'uint' , 'format':'hex' , 'set': 0, 'gcc' : 3, 'dwarf' : 3},
- { 'name':'rcx' , 'bitsize' : 64, 'offset' : 16, 'encoding':'uint' , 'format':'hex' , 'set': 0, 'gcc' : 2, 'dwarf' : 2, 'generic':'arg4', 'alt-name':'arg4', },
- { 'name':'rdx' , 'bitsize' : 64, 'offset' : 24, 'encoding':'uint' , 'format':'hex' , 'set': 0, 'gcc' : 1, 'dwarf' : 1, 'generic':'arg3', 'alt-name':'arg3', },
- { 'name':'rdi' , 'bitsize' : 64, 'offset' : 32, 'encoding':'uint' , 'format':'hex' , 'set': 0, 'gcc' : 5, 'dwarf' : 5, 'generic':'arg1', 'alt-name':'arg1', },
- { 'name':'rsi' , 'bitsize' : 64, 'offset' : 40, 'encoding':'uint' , 'format':'hex' , 'set': 0, 'gcc' : 4, 'dwarf' : 4, 'generic':'arg2', 'alt-name':'arg2', },
- { 'name':'rbp' , 'bitsize' : 64, 'offset' : 48, 'encoding':'uint' , 'format':'hex' , 'set': 0, 'gcc' : 6, 'dwarf' : 6, 'generic':'fp' , 'alt-name':'fp', },
- { 'name':'rsp' , 'bitsize' : 64, 'offset' : 56, 'encoding':'uint' , 'format':'hex' , 'set': 0, 'gcc' : 7, 'dwarf' : 7, 'generic':'sp' , 'alt-name':'sp', },
- { 'name':'r8' , 'bitsize' : 64, 'offset' : 64, 'encoding':'uint' , 'format':'hex' , 'set': 0, 'gcc' : 8, 'dwarf' : 8, 'generic':'arg5', 'alt-name':'arg5', },
- { 'name':'r9' , 'bitsize' : 64, 'offset' : 72, 'encoding':'uint' , 'format':'hex' , 'set': 0, 'gcc' : 9, 'dwarf' : 9, 'generic':'arg6', 'alt-name':'arg6', },
- { 'name':'r10' , 'bitsize' : 64, 'offset' : 80, 'encoding':'uint' , 'format':'hex' , 'set': 0, 'gcc' : 10, 'dwarf' : 10},
- { 'name':'r11' , 'bitsize' : 64, 'offset' : 88, 'encoding':'uint' , 'format':'hex' , 'set': 0, 'gcc' : 11, 'dwarf' : 11},
- { 'name':'r12' , 'bitsize' : 64, 'offset' : 96, 'encoding':'uint' , 'format':'hex' , 'set': 0, 'gcc' : 12, 'dwarf' : 12},
- { 'name':'r13' , 'bitsize' : 64, 'offset' : 104, 'encoding':'uint' , 'format':'hex' , 'set': 0, 'gcc' : 13, 'dwarf' : 13},
- { 'name':'r14' , 'bitsize' : 64, 'offset' : 112, 'encoding':'uint' , 'format':'hex' , 'set': 0, 'gcc' : 14, 'dwarf' : 14},
- { 'name':'r15' , 'bitsize' : 64, 'offset' : 120, 'encoding':'uint' , 'format':'hex' , 'set': 0, 'gcc' : 15, 'dwarf' : 15},
- { 'name':'rip' , 'bitsize' : 64, 'offset' : 128, 'encoding':'uint' , 'format':'hex' , 'set': 0, 'gcc' : 16, 'dwarf' : 16, 'generic':'pc', 'alt-name':'pc' },
- { 'name':'rflags' , 'bitsize' : 64, 'offset' : 136, 'encoding':'uint' , 'format':'hex' , 'set': 0, 'generic':'flags', 'alt-name':'flags' },
- { 'name':'cs' , 'bitsize' : 64, 'offset' : 144, 'encoding':'uint' , 'format':'hex' , 'set': 0 },
- { 'name':'fs' , 'bitsize' : 64, 'offset' : 152, 'encoding':'uint' , 'format':'hex' , 'set': 0 },
- { 'name':'gs' , 'bitsize' : 64, 'offset' : 160, 'encoding':'uint' , 'format':'hex' , 'set': 0 },
- ]
+ {'name': 'rax', 'bitsize': 64, 'offset': 0, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 0, 'dwarf': 0},
+ {'name': 'rbx', 'bitsize': 64, 'offset': 8, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 3, 'dwarf': 3},
+ {'name': 'rcx', 'bitsize': 64, 'offset': 16, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 2, 'dwarf': 2, 'generic': 'arg4', 'alt-name': 'arg4', },
+ {'name': 'rdx', 'bitsize': 64, 'offset': 24, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 1, 'dwarf': 1, 'generic': 'arg3', 'alt-name': 'arg3', },
+ {'name': 'rdi', 'bitsize': 64, 'offset': 32, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 5, 'dwarf': 5, 'generic': 'arg1', 'alt-name': 'arg1', },
+ {'name': 'rsi', 'bitsize': 64, 'offset': 40, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 4, 'dwarf': 4, 'generic': 'arg2', 'alt-name': 'arg2', },
+ {'name': 'rbp', 'bitsize': 64, 'offset': 48, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 6, 'dwarf': 6, 'generic': 'fp', 'alt-name': 'fp', },
+ {'name': 'rsp', 'bitsize': 64, 'offset': 56, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 7, 'dwarf': 7, 'generic': 'sp', 'alt-name': 'sp', },
+ {'name': 'r8', 'bitsize': 64, 'offset': 64, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 8, 'dwarf': 8, 'generic': 'arg5', 'alt-name': 'arg5', },
+ {'name': 'r9', 'bitsize': 64, 'offset': 72, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 9, 'dwarf': 9, 'generic': 'arg6', 'alt-name': 'arg6', },
+ {'name': 'r10', 'bitsize': 64, 'offset': 80, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 10, 'dwarf': 10},
+ {'name': 'r11', 'bitsize': 64, 'offset': 88, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 11, 'dwarf': 11},
+ {'name': 'r12', 'bitsize': 64, 'offset': 96, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 12, 'dwarf': 12},
+ {'name': 'r13', 'bitsize': 64, 'offset': 104, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 13, 'dwarf': 13},
+ {'name': 'r14', 'bitsize': 64, 'offset': 112, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 14, 'dwarf': 14},
+ {'name': 'r15', 'bitsize': 64, 'offset': 120, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 15, 'dwarf': 15},
+ {'name': 'rip', 'bitsize': 64, 'offset': 128, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'gcc': 16, 'dwarf': 16, 'generic': 'pc', 'alt-name': 'pc'},
+ {'name': 'rflags', 'bitsize': 64, 'offset': 136, 'encoding': 'uint', 'format': 'hex', 'set': 0, 'generic': 'flags', 'alt-name': 'flags'},
+ {'name': 'cs', 'bitsize': 64, 'offset': 144, 'encoding': 'uint', 'format': 'hex', 'set': 0},
+ {'name': 'fs', 'bitsize': 64, 'offset': 152, 'encoding': 'uint', 'format': 'hex', 'set': 0},
+ {'name': 'gs', 'bitsize': 64, 'offset': 160, 'encoding': 'uint', 'format': 'hex', 'set': 0},
+ ]
return self.registers
-
+
def get_register_data(self, tid):
- return struct.pack('21Q',tid + 1,tid + 2,tid + 3,tid + 4,tid + 5,tid + 6,tid + 7,tid + 8,tid + 9,tid + 10,tid + 11,tid + 12,tid + 13,tid + 14,tid + 15,tid + 16,tid + 17,tid + 18,tid + 19,tid + 20,tid + 21);
-
+ return struct.pack(
+ '21Q',
+ tid + 1,
+ tid + 2,
+ tid + 3,
+ tid + 4,
+ tid + 5,
+ tid + 6,
+ tid + 7,
+ tid + 8,
+ tid + 9,
+ tid + 10,
+ tid + 11,
+ tid + 12,
+ tid + 13,
+ tid + 14,
+ tid + 15,
+ tid + 16,
+ tid + 17,
+ tid + 18,
+ tid + 19,
+ tid + 20,
+ tid + 21)
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
new file mode 100644
index 000000000000..ed46ef1c847e
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
@@ -0,0 +1,249 @@
+"""
+Test basics of linux core file debugging.
+"""
+
+from __future__ import print_function
+
+import shutil
+import struct
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class LinuxCoreTestCase(TestBase):
+ NO_DEBUG_INFO_TESTCASE = True
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ _i386_pid = 32306
+ _x86_64_pid = 32259
+ _s390x_pid = 1045
+
+ _i386_regions = 4
+ _x86_64_regions = 5
+ _s390x_regions = 2
+
+ @skipIf(oslist=['windows'])
+ @skipIf(triple='^mips')
+ def test_i386(self):
+ """Test that lldb can read the process information from an i386 linux core file."""
+ self.do_test("linux-i386", self._i386_pid, self._i386_regions)
+
+ @skipIf(oslist=['windows'])
+ @skipIf(triple='^mips')
+ def test_x86_64(self):
+ """Test that lldb can read the process information from an x86_64 linux core file."""
+ self.do_test("linux-x86_64", self._x86_64_pid, self._x86_64_regions)
+
+ # This seems to hang on non-s390x platforms for some reason. Disabling
+ # for now.
+ @skipIf(archs=no_match(['s390x']))
+ @skipIf(triple='^mips')
+ def test_s390x(self):
+ """Test that lldb can read the process information from an s390x linux core file."""
+ self.do_test("linux-s390x", self._s390x_pid, self._s390x_regions)
+
+ @skipIf(oslist=['windows'])
+ @skipIf(triple='^mips')
+ def test_same_pid_running(self):
+ """Test that we read the information from the core correctly even if we have a running
+ process with the same PID around"""
+ try:
+ shutil.copyfile("linux-x86_64.out", "linux-x86_64-pid.out")
+ shutil.copyfile("linux-x86_64.core", "linux-x86_64-pid.core")
+ with open("linux-x86_64-pid.core", "r+b") as f:
+ # These are offsets into the NT_PRSTATUS and NT_PRPSINFO structures in the note
+ # segment of the core file. If you update the file, these offsets may need updating
+ # as well. (Notes can be viewed with readelf --notes.)
+ for pid_offset in [0x1c4, 0x320]:
+ f.seek(pid_offset)
+ self.assertEqual(
+ struct.unpack(
+ "<I",
+ f.read(4))[0],
+ self._x86_64_pid)
+
+ # We insert our own pid, and make sure the test still
+ # works.
+ f.seek(pid_offset)
+ f.write(struct.pack("<I", os.getpid()))
+ self.do_test("linux-x86_64-pid", os.getpid(), self._x86_64_regions)
+ finally:
+ self.RemoveTempFile("linux-x86_64-pid.out")
+ self.RemoveTempFile("linux-x86_64-pid.core")
+
+ @skipIf(oslist=['windows'])
+ @skipIf(triple='^mips')
+ def test_two_cores_same_pid(self):
+ """Test that we handle the situation if we have two core files with the same PID
+ around"""
+ alttarget = self.dbg.CreateTarget("altmain.out")
+ altprocess = alttarget.LoadCore("altmain.core")
+ self.assertTrue(altprocess, PROCESS_IS_VALID)
+ self.assertEqual(altprocess.GetNumThreads(), 1)
+ self.assertEqual(altprocess.GetProcessID(), self._x86_64_pid)
+
+ altframe = altprocess.GetSelectedThread().GetFrameAtIndex(0)
+ self.assertEqual(altframe.GetFunctionName(), "_start")
+ self.assertEqual(
+ altframe.GetLineEntry().GetLine(),
+ line_number(
+ "altmain.c",
+ "Frame _start"))
+
+ error = lldb.SBError()
+ F = altprocess.ReadCStringFromMemory(
+ altframe.FindVariable("F").GetValueAsUnsigned(), 256, error)
+ self.assertTrue(error.Success())
+ self.assertEqual(F, "_start")
+
+ # without destroying this process, run the test which opens another core file with the
+ # same pid
+ self.do_test("linux-x86_64", self._x86_64_pid, self._x86_64_regions)
+
+ @skipIf(oslist=['windows'])
+ @skipIf(triple='^mips')
+ def test_FPR_SSE(self):
+ # check x86_64 core file
+ target = self.dbg.CreateTarget(None)
+ self.assertTrue(target, VALID_TARGET)
+ process = target.LoadCore("linux-fpr_sse_x86_64.core")
+
+ values = {}
+ values["fctrl"] = "0x037f"
+ values["fstat"] = "0x0000"
+ values["ftag"] = "0xff"
+ values["fop"] = "0x0000"
+ values["fiseg"] = "0x00000000"
+ values["fioff"] = "0x0040011e"
+ values["foseg"] = "0x00000000"
+ values["fooff"] = "0x00000000"
+ values["mxcsr"] = "0x00001f80"
+ values["mxcsrmask"] = "0x0000ffff"
+ values["st0"] = "{0x99 0xf7 0xcf 0xfb 0x84 0x9a 0x20 0x9a 0xfd 0x3f}"
+ values["st1"] = "{0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x80 0xff 0x3f}"
+ values["st2"] = "{0xfe 0x8a 0x1b 0xcd 0x4b 0x78 0x9a 0xd4 0x00 0x40}"
+ values["st3"] = "{0xac 0x79 0xcf 0xd1 0xf7 0x17 0x72 0xb1 0xfe 0x3f}"
+ values["st4"] = "{0xbc 0xf0 0x17 0x5c 0x29 0x3b 0xaa 0xb8 0xff 0x3f}"
+ values["st5"] = "{0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x80 0xff 0x3f}"
+ values["st6"] = "{0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}"
+ values["st7"] = "{0x35 0xc2 0x68 0x21 0xa2 0xda 0x0f 0xc9 0x00 0x40}"
+ values["xmm0"] = "{0x29 0x31 0x64 0x46 0x29 0x31 0x64 0x46 0x29 0x31 0x64 0x46 0x29 0x31 0x64 0x46}"
+ values["xmm1"] = "{0x9c 0xed 0x86 0x64 0x9c 0xed 0x86 0x64 0x9c 0xed 0x86 0x64 0x9c 0xed 0x86 0x64}"
+ values["xmm2"] = "{0x07 0xc2 0x1f 0xd7 0x07 0xc2 0x1f 0xd7 0x07 0xc2 0x1f 0xd7 0x07 0xc2 0x1f 0xd7}"
+ values["xmm3"] = "{0xa2 0x20 0x48 0x25 0xa2 0x20 0x48 0x25 0xa2 0x20 0x48 0x25 0xa2 0x20 0x48 0x25}"
+ values["xmm4"] = "{0xeb 0x5a 0xa8 0xc4 0xeb 0x5a 0xa8 0xc4 0xeb 0x5a 0xa8 0xc4 0xeb 0x5a 0xa8 0xc4}"
+ values["xmm5"] = "{0x49 0x41 0x20 0x0b 0x49 0x41 0x20 0x0b 0x49 0x41 0x20 0x0b 0x49 0x41 0x20 0x0b}"
+ values["xmm6"] = "{0xf8 0xf1 0x8b 0x4f 0xf8 0xf1 0x8b 0x4f 0xf8 0xf1 0x8b 0x4f 0xf8 0xf1 0x8b 0x4f}"
+ values["xmm7"] = "{0x13 0xf1 0x30 0xcd 0x13 0xf1 0x30 0xcd 0x13 0xf1 0x30 0xcd 0x13 0xf1 0x30 0xcd}"
+
+ for regname, value in values.iteritems():
+ self.expect("register read {}".format(regname), substrs=["{} = {}".format(regname, value)])
+
+
+ # now check i386 core file
+ target = self.dbg.CreateTarget(None)
+ self.assertTrue(target, VALID_TARGET)
+ process = target.LoadCore("linux-fpr_sse_i386.core")
+
+ values["fioff"] = "0x080480cc"
+
+ for regname, value in values.iteritems():
+ self.expect("register read {}".format(regname), substrs=["{} = {}".format(regname, value)])
+
+ def check_memory_regions(self, process, region_count):
+ region_list = process.GetMemoryRegions()
+ self.assertEqual(region_list.GetSize(), region_count)
+
+ region = lldb.SBMemoryRegionInfo()
+
+ # Check we have the right number of regions.
+ self.assertEqual(region_list.GetSize(), region_count)
+
+ # Check that getting a region beyond the last in the list fails.
+ self.assertFalse(
+ region_list.GetMemoryRegionAtIndex(
+ region_count, region))
+
+ # Check each region is valid.
+ for i in range(region_list.GetSize()):
+ # Check we can actually get this region.
+ self.assertTrue(region_list.GetMemoryRegionAtIndex(i, region))
+
+ # Every region in the list should be mapped.
+ self.assertTrue(region.IsMapped())
+
+ # Test the address at the start of a region returns it's enclosing
+ # region.
+ begin_address = region.GetRegionBase()
+ region_at_begin = lldb.SBMemoryRegionInfo()
+ error = process.GetMemoryRegionInfo(begin_address, region_at_begin)
+ self.assertEqual(region, region_at_begin)
+
+ # Test an address in the middle of a region returns it's enclosing
+ # region.
+ middle_address = (region.GetRegionBase() +
+ region.GetRegionEnd()) / 2
+ region_at_middle = lldb.SBMemoryRegionInfo()
+ error = process.GetMemoryRegionInfo(
+ middle_address, region_at_middle)
+ self.assertEqual(region, region_at_middle)
+
+ # Test the address at the end of a region returns it's enclosing
+ # region.
+ end_address = region.GetRegionEnd() - 1
+ region_at_end = lldb.SBMemoryRegionInfo()
+ error = process.GetMemoryRegionInfo(end_address, region_at_end)
+ self.assertEqual(region, region_at_end)
+
+ # Check that quering the end address does not return this region but
+ # the next one.
+ next_region = lldb.SBMemoryRegionInfo()
+ error = process.GetMemoryRegionInfo(
+ region.GetRegionEnd(), next_region)
+ self.assertNotEqual(region, next_region)
+ self.assertEqual(
+ region.GetRegionEnd(),
+ next_region.GetRegionBase())
+
+ # Check that query beyond the last region returns an unmapped region
+ # that ends at LLDB_INVALID_ADDRESS
+ last_region = lldb.SBMemoryRegionInfo()
+ region_list.GetMemoryRegionAtIndex(region_count - 1, last_region)
+ end_region = lldb.SBMemoryRegionInfo()
+ error = process.GetMemoryRegionInfo(
+ last_region.GetRegionEnd(), end_region)
+ self.assertFalse(end_region.IsMapped())
+ self.assertEqual(
+ last_region.GetRegionEnd(),
+ end_region.GetRegionBase())
+ self.assertEqual(end_region.GetRegionEnd(), lldb.LLDB_INVALID_ADDRESS)
+
+ def do_test(self, filename, pid, region_count):
+ target = self.dbg.CreateTarget(filename + ".out")
+ process = target.LoadCore(filename + ".core")
+ self.assertTrue(process, PROCESS_IS_VALID)
+ self.assertEqual(process.GetNumThreads(), 1)
+ self.assertEqual(process.GetProcessID(), pid)
+
+ thread = process.GetSelectedThread()
+ self.assertTrue(thread)
+ self.assertEqual(thread.GetThreadID(), pid)
+ backtrace = ["bar", "foo", "_start"]
+ self.assertEqual(thread.GetNumFrames(), len(backtrace))
+ for i in range(len(backtrace)):
+ frame = thread.GetFrameAtIndex(i)
+ self.assertTrue(frame)
+ self.assertEqual(frame.GetFunctionName(), backtrace[i])
+ self.assertEqual(frame.GetLineEntry().GetLine(),
+ line_number("main.c", "Frame " + backtrace[i]))
+ self.assertEqual(
+ frame.FindVariable("F").GetValueAsUnsigned(), ord(
+ backtrace[i][0]))
+
+ self.check_memory_regions(process, region_count)
+
+ self.dbg.DeleteTarget(target)
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/altmain.c b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/altmain.c
index da49a00996e1..da49a00996e1 100644
--- a/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/altmain.c
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/altmain.c
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/altmain.core b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/altmain.core
index 423413070c7a..423413070c7a 100644
--- a/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/altmain.core
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/altmain.core
Binary files differ
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/altmain.out b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/altmain.out
index 2fddf3e8f803..2fddf3e8f803 100755
--- a/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/altmain.out
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/altmain.out
Binary files differ
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/fpr_sse.cpp b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/fpr_sse.cpp
new file mode 100644
index 000000000000..e6826fc7a097
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/fpr_sse.cpp
@@ -0,0 +1,38 @@
+// fpr_sse_x86_64.core was generated with:
+// ./make-core.sh fpr_sse.cpp
+//
+// fpr_sse_i386.core was generated with:
+// export CFLAGS=-m32
+// ./make-core.sh fpr_sse.cpp
+
+void _start(void) {
+ __asm__("fldpi;"
+ "fldz;"
+ "fld1;"
+ "fldl2e;"
+ "fldln2;"
+ "fldl2t;"
+ "fld1;"
+ "fldlg2;");
+
+ unsigned int values[8] = {
+ 0x46643129, 0x6486ed9c, 0xd71fc207, 0x254820a2,
+ 0xc4a85aeb, 0x0b204149, 0x4f8bf1f8, 0xcd30f113,
+ };
+
+ __asm__("vbroadcastss %0, %%xmm0;"
+ "vbroadcastss %1, %%xmm1;"
+ "vbroadcastss %2, %%xmm2;"
+ "vbroadcastss %3, %%xmm3;"
+ "vbroadcastss %4, %%xmm4;"
+ "vbroadcastss %5, %%xmm5;"
+ "vbroadcastss %6, %%xmm6;"
+ "vbroadcastss %7, %%xmm7;"
+
+ ::"m"(values[0]),
+ "m"(values[1]), "m"(values[2]), "m"(values[3]), "m"(values[4]),
+ "m"(values[5]), "m"(values[6]), "m"(values[7]));
+
+ volatile int *a = 0;
+ *a = 0;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/TestGCore.py b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/TestGCore.py
new file mode 100644
index 000000000000..5a11a52e93a6
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/TestGCore.py
@@ -0,0 +1,52 @@
+"""
+Test signal reporting when debugging with linux core files.
+"""
+
+from __future__ import print_function
+
+import shutil
+import struct
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class GCoreTestCase(TestBase):
+ NO_DEBUG_INFO_TESTCASE = True
+
+ mydir = TestBase.compute_mydir(__file__)
+ _initial_platform = lldb.DBG.GetSelectedPlatform()
+
+ _i386_pid = 5586
+ _x86_64_pid = 5669
+
+ @skipIf(oslist=['windows'])
+ @skipIf(triple='^mips')
+ def test_i386(self):
+ """Test that lldb can read the process information from an i386 linux core file."""
+ self.do_test("linux-i386", self._i386_pid)
+
+ @skipIf(oslist=['windows'])
+ @skipIf(triple='^mips')
+ def test_x86_64(self):
+ """Test that lldb can read the process information from an x86_64 linux core file."""
+ self.do_test("linux-x86_64", self._x86_64_pid)
+
+ def do_test(self, filename, pid):
+ target = self.dbg.CreateTarget("")
+ process = target.LoadCore(filename + ".core")
+ self.assertTrue(process, PROCESS_IS_VALID)
+ self.assertEqual(process.GetNumThreads(), 3)
+ self.assertEqual(process.GetProcessID(), pid)
+
+ for thread in process:
+ reason = thread.GetStopReason()
+ self.assertEqual(reason, lldb.eStopReasonSignal)
+ signal = thread.GetStopReasonDataAtIndex(1)
+ # Check we got signal 19 (SIGSTOP)
+ self.assertEqual(signal, 19)
+
+ self.dbg.DeleteTarget(target)
+ lldb.DBG.SetSelectedPlatform(self._initial_platform)
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/linux-i386.core b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/linux-i386.core
new file mode 100644
index 000000000000..8f9ac87c19f2
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/linux-i386.core
Binary files differ
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/linux-x86_64.core b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/linux-x86_64.core
new file mode 100644
index 000000000000..ef673e45b219
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/linux-x86_64.core
Binary files differ
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/main.cpp b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/main.cpp
new file mode 100644
index 000000000000..9908faffb6eb
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/main.cpp
@@ -0,0 +1,63 @@
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// This test verifies the correct handling of child thread exits.
+
+#include <atomic>
+#include <thread>
+#include <csignal>
+
+pseudo_barrier_t g_barrier1;
+pseudo_barrier_t g_barrier2;
+
+void *
+thread1 ()
+{
+ // Synchronize with the main thread.
+ pseudo_barrier_wait(g_barrier1);
+
+ // Synchronize with the main thread and thread2.
+ pseudo_barrier_wait(g_barrier2);
+
+ // Return
+ return NULL;
+}
+
+void *
+thread2 ()
+{
+
+ // Synchronize with thread1 and the main thread.
+ pseudo_barrier_wait(g_barrier2); // Should not reach here.
+
+ // Return
+ return NULL;
+}
+
+int main ()
+{
+
+ pseudo_barrier_init(g_barrier1, 2);
+ pseudo_barrier_init(g_barrier2, 3);
+
+ // Create a thread.
+ std::thread thread_1(thread1);
+
+ // Wait for thread1 to start.
+ pseudo_barrier_wait(g_barrier1);
+
+ // Wait for thread1 to start.
+ std::thread thread_2(thread2);
+
+ // Thread 2 is waiting for another thread to reach the barrier.
+ // This should have for ever. (So we can run gcore against this process.)
+ thread_2.join();
+
+ return 0;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/main.mk b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/main.mk
new file mode 100755
index 000000000000..ff874a21f760
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/main.mk
@@ -0,0 +1,5 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+ENABLE_THREADS := YES
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/make-core.sh b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/make-core.sh
new file mode 100755
index 000000000000..b6979c7790de
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/make-core.sh
@@ -0,0 +1,56 @@
+#! /bin/sh
+
+linux_check_ptrace_scope()
+{
+ if grep -q '1' </proc/sys/kernel/yama/ptrace_scope; then
+ cat <<EOF
+Your system prevents the use of PTRACE to attach to non-child processes. The core file
+cannot be generated. Please reset /proc/sys/kernel/yama/ptrace_scope to 0 (requires root
+privileges) to enable core generation via gcore.
+EOF
+ exit 1
+ fi
+}
+
+set -e -x
+
+OS=$(uname -s)
+if [ "$OS" = Linux ]; then
+ linux_check_ptrace_scope
+fi
+
+rm -f a.out
+make -f main.mk
+
+cat <<EOF
+Executable file is in a.out.
+Core file will be saved as core.<pid>.
+EOF
+
+stack_size=`ulimit -s`
+
+# Decrease stack size to 16k => smaller core files.
+# gcore won't run with the smaller stack
+ulimit -Ss 16
+
+core_dump_filter=`cat /proc/self/coredump_filter`
+echo 0 > /proc/self/coredump_filter
+
+./a.out &
+
+pid=$!
+
+echo $core_dump_filter > /proc/self/coredump_filter
+
+# Reset stack size as so there's enough space to run gcore.
+ulimit -s $stack_size
+
+echo "Sleeping for 5 seconds to wait for $pid"
+
+sleep 5
+echo "Taking core from process $pid"
+
+gcore -o core $pid
+
+echo "Killing process $pid"
+kill -9 $pid
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-fpr_sse_i386.core b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-fpr_sse_i386.core
new file mode 100644
index 000000000000..b0fdaf67ca4f
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-fpr_sse_i386.core
Binary files differ
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-fpr_sse_x86_64.core b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-fpr_sse_x86_64.core
new file mode 100644
index 000000000000..5fb39ee115b2
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-fpr_sse_x86_64.core
Binary files differ
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/i386.core b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-i386.core
index f8deff474d1f..f8deff474d1f 100644
--- a/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/i386.core
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-i386.core
Binary files differ
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/i386.out b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-i386.out
index 3cdd4eeca103..3cdd4eeca103 100755
--- a/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/i386.out
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-i386.out
Binary files differ
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/s390x.core b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-s390x.core
index b97fc43e967d..b97fc43e967d 100644
--- a/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/s390x.core
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-s390x.core
Binary files differ
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/s390x.out b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-s390x.out
index 640fbdc257d9..640fbdc257d9 100755
--- a/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/s390x.out
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-s390x.out
Binary files differ
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/x86_64.core b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-x86_64.core
index e2fa69e4558e..e2fa69e4558e 100644
--- a/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/x86_64.core
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-x86_64.core
Binary files differ
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/x86_64.out b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-x86_64.out
index 842402fd519d..842402fd519d 100755
--- a/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/x86_64.out
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-x86_64.out
Binary files differ
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/main.c b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/main.c
index f5bde4171ca5..f5bde4171ca5 100644
--- a/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/main.c
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/main.c
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/make-core.sh b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/make-core.sh
index efe1b801df34..9dd83f19c76e 100755
--- a/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/make-core.sh
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/make-core.sh
@@ -1,4 +1,30 @@
-#! /bin/bash
+#! /bin/sh
+
+linux_check_core_pattern()
+{
+ if grep -q '^|' </proc/sys/kernel/core_pattern; then
+ cat <<EOF
+Your system uses a crash report tool ($(cat /proc/sys/kernel/core_pattern)). Core files
+will not be generated. Please reset /proc/sys/kernel/core_pattern (requires root
+privileges) to enable core generation.
+EOF
+ exit 1
+ fi
+}
+
+OS=$(uname -s)
+case "$OS" in
+FreeBSD)
+ core_pattern=$(sysctl -n kern.corefile)
+ ;;
+Linux)
+ core_pattern=$(cat /proc/sys/kernel/core_pattern)
+ ;;
+*)
+ echo "OS $OS not supported" >&2
+ exit 1
+ ;;
+esac
set -e -x
@@ -10,13 +36,8 @@ EOF
exit 1
fi
-if grep -q '^|' </proc/sys/kernel/core_pattern; then
- cat <<EOF
-Your system uses a crash report tool ($(cat /proc/sys/kernel/core_pattern)). Core files
-will not be generated. Please reset /proc/sys/kernel/core_pattern (requires root
-privileges) to enable core generation.
-EOF
- exit 1
+if [ "$OS" = Linux ]; then
+ linux_check_core_pattern
fi
ulimit -c 1000
@@ -33,7 +54,7 @@ ${CC:-cc} -nostdlib -static -g $CFLAGS "$file" -o a.out
cat <<EOF
Executable file is in a.out.
-Core file will be saved according to pattern $(cat /proc/sys/kernel/core_pattern).
+Core file will be saved according to pattern $core_pattern.
EOF
ulimit -s 8 # Decrease stack size to 8k => smaller core files.
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/TestLinuxCoreThreads.py b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/TestLinuxCoreThreads.py
new file mode 100644
index 000000000000..7cc3c0775ced
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/TestLinuxCoreThreads.py
@@ -0,0 +1,61 @@
+"""
+Test signal reporting when debugging with linux core files.
+"""
+
+from __future__ import print_function
+
+import shutil
+import struct
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class LinuxCoreThreadsTestCase(TestBase):
+ NO_DEBUG_INFO_TESTCASE = True
+
+ mydir = TestBase.compute_mydir(__file__)
+ _initial_platform = lldb.DBG.GetSelectedPlatform()
+
+ _i386_pid = 5193
+ _x86_64_pid = 5222
+
+ # Thread id for the failing thread.
+ _i386_tid = 5195
+ _x86_64_tid = 5250
+
+ @skipIf(oslist=['windows'])
+ @skipIf(triple='^mips')
+ def test_i386(self):
+ """Test that lldb can read the process information from an i386 linux core file."""
+ self.do_test("linux-i386", self._i386_pid, self._i386_tid)
+
+ @skipIf(oslist=['windows'])
+ @skipIf(triple='^mips')
+ def test_x86_64(self):
+ """Test that lldb can read the process information from an x86_64 linux core file."""
+ self.do_test("linux-x86_64", self._x86_64_pid, self._x86_64_tid)
+
+ def do_test(self, filename, pid, tid):
+ target = self.dbg.CreateTarget("")
+ process = target.LoadCore(filename + ".core")
+ self.assertTrue(process, PROCESS_IS_VALID)
+ self.assertEqual(process.GetNumThreads(), 3)
+ self.assertEqual(process.GetProcessID(), pid)
+
+ for thread in process:
+ reason = thread.GetStopReason()
+ if( thread.GetThreadID() == tid ):
+ self.assertEqual(reason, lldb.eStopReasonSignal)
+ signal = thread.GetStopReasonDataAtIndex(1)
+ # Check we got signal 4 (SIGILL)
+ self.assertEqual(signal, 4)
+ else:
+ signal = thread.GetStopReasonDataAtIndex(1)
+ # Check we got no signal on the other threads
+ self.assertEqual(signal, 0)
+
+ self.dbg.DeleteTarget(target)
+ lldb.DBG.SetSelectedPlatform(self._initial_platform)
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/linux-i386.core b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/linux-i386.core
new file mode 100644
index 000000000000..86c6fb8c5ac3
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/linux-i386.core
Binary files differ
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/linux-x86_64.core b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/linux-x86_64.core
new file mode 100644
index 000000000000..fc27e5810ee5
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/linux-x86_64.core
Binary files differ
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/main.cpp b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/main.cpp
new file mode 100644
index 000000000000..826d9d3fa972
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/main.cpp
@@ -0,0 +1,63 @@
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// This test verifies the correct handling of child thread exits.
+
+#include <atomic>
+#include <thread>
+#include <csignal>
+
+pseudo_barrier_t g_barrier1;
+pseudo_barrier_t g_barrier2;
+
+void *
+thread1 ()
+{
+ // Synchronize with the main thread.
+ pseudo_barrier_wait(g_barrier1);
+
+ // Synchronize with the main thread and thread2.
+ pseudo_barrier_wait(g_barrier2);
+
+ // Return
+ return NULL; // Should not reach here. (thread2 should raise SIGILL)
+}
+
+void *
+thread2 ()
+{
+ raise(SIGILL); // Raise SIGILL
+
+ // Synchronize with thread1 and the main thread.
+ pseudo_barrier_wait(g_barrier2); // Should not reach here.
+
+ // Return
+ return NULL;
+}
+
+int main ()
+{
+ pseudo_barrier_init(g_barrier1, 2);
+ pseudo_barrier_init(g_barrier2, 3);
+
+ // Create a thread.
+ std::thread thread_1(thread1);
+
+ // Wait for thread1 to start.
+ pseudo_barrier_wait(g_barrier1);
+
+ // Create another thread.
+ std::thread thread_2(thread2);
+
+ // Wait for thread2 to start.
+ // Second thread should crash but first thread and main thread may reach here.
+ pseudo_barrier_wait(g_barrier2);
+
+ return 0;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/main.mk b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/main.mk
new file mode 100755
index 000000000000..ff874a21f760
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/main.mk
@@ -0,0 +1,5 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+ENABLE_THREADS := YES
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/make-core.sh b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/make-core.sh
new file mode 100755
index 000000000000..ea263c86ea46
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/make-core.sh
@@ -0,0 +1,64 @@
+#! /bin/sh
+
+linux_check_core_pattern()
+{
+ if grep -q '^|' </proc/sys/kernel/core_pattern; then
+ cat <<EOF
+Your system uses a crash report tool ($(cat /proc/sys/kernel/core_pattern)). Core files
+will not be generated. Please reset /proc/sys/kernel/core_pattern (requires root
+privileges) to enable core generation.
+EOF
+ exit 1
+ fi
+}
+
+OS=$(uname -s)
+case "$OS" in
+FreeBSD)
+ core_pattern=$(sysctl -n kern.corefile)
+ ;;
+Linux)
+ core_pattern=$(cat /proc/sys/kernel/core_pattern)
+ ;;
+*)
+ echo "OS $OS not supported" >&2
+ exit 1
+ ;;
+esac
+
+set -e -x
+
+if [ "$OS" = Linux ]; then
+ linux_check_core_pattern
+fi
+
+ulimit -c 1000
+real_limit=$(ulimit -c)
+if [ $real_limit -lt 100 ]; then
+ cat <<EOF
+Unable to increase the core file limit. Core file may be truncated!
+To fix this, increase HARD core file limit (ulimit -H -c 1000). This may require root
+privileges.
+EOF
+fi
+
+rm -f a.out
+make -f main.mk
+
+cat <<EOF
+Executable file is in a.out.
+Core file will be saved according to pattern $core_pattern.
+EOF
+
+# Save stack size and core_dump_filter
+stack_size=`ulimit -s`
+ulimit -Ss 32 # Decrease stack size to 32k => smaller core files.
+
+core_dump_filter=`cat /proc/self/coredump_filter`
+echo 0 > /proc/self/coredump_filter
+
+exec ./a.out
+
+# Reset stack size and core_dump_filter
+echo core_dump_filter > /proc/self/coredump_filter
+ulimit -s $stack_size
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/TestLinuxCore.py b/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/TestLinuxCore.py
deleted file mode 100644
index fd5bb00d0565..000000000000
--- a/packages/Python/lldbsuite/test/functionalities/postmortem/linux-core/TestLinuxCore.py
+++ /dev/null
@@ -1,164 +0,0 @@
-"""
-Test basics of linux core file debugging.
-"""
-
-from __future__ import print_function
-
-import shutil
-import struct
-
-import lldb
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-
-class LinuxCoreTestCase(TestBase):
- NO_DEBUG_INFO_TESTCASE = True
-
- mydir = TestBase.compute_mydir(__file__)
-
- _i386_pid = 32306
- _x86_64_pid = 32259
- _s390x_pid = 1045
-
- _i386_regions = 4
- _x86_64_regions = 5
- _s390x_regions = 2
-
- @skipIf(bugnumber="llvm.org/pr26947")
- def test_i386(self):
- """Test that lldb can read the process information from an i386 linux core file."""
- self.do_test("i386", self._i386_pid, self._i386_regions)
-
- def test_x86_64(self):
- """Test that lldb can read the process information from an x86_64 linux core file."""
- self.do_test("x86_64", self._x86_64_pid, self._x86_64_regions)
-
- # This seems to hang on non-s390x platforms for some reason. Disabling for now.
- @skipIf(archs=no_match(['s390x']))
- def test_s390x(self):
- """Test that lldb can read the process information from an s390x linux core file."""
- self.do_test("s390x", self._s390x_pid, self._s390x_regions)
-
- def test_same_pid_running(self):
- """Test that we read the information from the core correctly even if we have a running
- process with the same PID around"""
- try:
- shutil.copyfile("x86_64.out", "x86_64-pid.out")
- shutil.copyfile("x86_64.core", "x86_64-pid.core")
- with open("x86_64-pid.core", "r+b") as f:
- # These are offsets into the NT_PRSTATUS and NT_PRPSINFO structures in the note
- # segment of the core file. If you update the file, these offsets may need updating
- # as well. (Notes can be viewed with readelf --notes.)
- for pid_offset in [0x1c4, 0x320]:
- f.seek(pid_offset)
- self.assertEqual(struct.unpack("<I", f.read(4))[0], self._x86_64_pid)
-
- # We insert our own pid, and make sure the test still works.
- f.seek(pid_offset)
- f.write(struct.pack("<I", os.getpid()))
- self.do_test("x86_64-pid", os.getpid(), self._x86_64_regions)
- finally:
- self.RemoveTempFile("x86_64-pid.out")
- self.RemoveTempFile("x86_64-pid.core")
-
- def test_two_cores_same_pid(self):
- """Test that we handle the situation if we have two core files with the same PID
- around"""
- alttarget = self.dbg.CreateTarget("altmain.out")
- altprocess = alttarget.LoadCore("altmain.core")
- self.assertTrue(altprocess, PROCESS_IS_VALID)
- self.assertEqual(altprocess.GetNumThreads(), 1)
- self.assertEqual(altprocess.GetProcessID(), self._x86_64_pid)
-
- altframe = altprocess.GetSelectedThread().GetFrameAtIndex(0)
- self.assertEqual(altframe.GetFunctionName(), "_start")
- self.assertEqual(altframe.GetLineEntry().GetLine(), line_number("altmain.c", "Frame _start"))
-
- error = lldb.SBError()
- F = altprocess.ReadCStringFromMemory(altframe.FindVariable("F").GetValueAsUnsigned(), 256, error)
- self.assertTrue(error.Success())
- self.assertEqual(F, "_start")
-
- # without destroying this process, run the test which opens another core file with the
- # same pid
- self.do_test("x86_64", self._x86_64_pid, self._x86_64_regions)
-
- def check_memory_regions(self, process, region_count):
- region_list = process.GetMemoryRegions()
- self.assertEqual(region_list.GetSize(), region_count)
-
- region = lldb.SBMemoryRegionInfo()
-
- # Check we have the right number of regions.
- self.assertEqual(region_list.GetSize(), region_count);
-
- # Check that getting a region beyond the last in the list fails.
- self.assertFalse(region_list.GetMemoryRegionAtIndex(region_count, region));
-
- # Check each region is valid.
- for i in range(region_list.GetSize()):
- # Check we can actually get this region.
- self.assertTrue(region_list.GetMemoryRegionAtIndex(i, region))
-
- #Every region in the list should be mapped.
- self.assertTrue(region.IsMapped())
-
- # Test the address at the start of a region returns it's enclosing region.
- begin_address = region.GetRegionBase()
- region_at_begin = lldb.SBMemoryRegionInfo()
- error = process.GetMemoryRegionInfo(begin_address, region_at_begin)
- self.assertEqual(region, region_at_begin)
-
- # Test an address in the middle of a region returns it's enclosing region.
- middle_address = (region.GetRegionBase() + region.GetRegionEnd()) / 2l
- region_at_middle = lldb.SBMemoryRegionInfo()
- error = process.GetMemoryRegionInfo(middle_address, region_at_middle)
- self.assertEqual(region, region_at_middle)
-
- # Test the address at the end of a region returns it's enclosing region.
- end_address = region.GetRegionEnd() - 1l
- region_at_end = lldb.SBMemoryRegionInfo()
- error = process.GetMemoryRegionInfo(end_address, region_at_end)
- self.assertEqual(region, region_at_end)
-
- # Check that quering the end address does not return this region but
- # the next one.
- next_region = lldb.SBMemoryRegionInfo()
- error = process.GetMemoryRegionInfo(region.GetRegionEnd(), next_region)
- self.assertNotEqual(region, next_region)
- self.assertEqual(region.GetRegionEnd(), next_region.GetRegionBase())
-
- # Check that query beyond the last region returns an unmapped region
- # that ends at LLDB_INVALID_ADDRESS
- last_region = lldb.SBMemoryRegionInfo()
- region_list.GetMemoryRegionAtIndex(region_count - 1, last_region)
- end_region = lldb.SBMemoryRegionInfo()
- error = process.GetMemoryRegionInfo(last_region.GetRegionEnd(), end_region)
- self.assertFalse(end_region.IsMapped())
- self.assertEqual(last_region.GetRegionEnd(), end_region.GetRegionBase())
- self.assertEqual(end_region.GetRegionEnd(), lldb.LLDB_INVALID_ADDRESS)
-
- def do_test(self, filename, pid, region_count):
- target = self.dbg.CreateTarget(filename + ".out")
- process = target.LoadCore(filename + ".core")
- self.assertTrue(process, PROCESS_IS_VALID)
- self.assertEqual(process.GetNumThreads(), 1)
- self.assertEqual(process.GetProcessID(), pid)
-
- thread = process.GetSelectedThread()
- self.assertTrue(thread)
- self.assertEqual(thread.GetThreadID(), pid)
- backtrace = ["bar", "foo", "_start"]
- self.assertEqual(thread.GetNumFrames(), len(backtrace))
- for i in range(len(backtrace)):
- frame = thread.GetFrameAtIndex(i)
- self.assertTrue(frame)
- self.assertEqual(frame.GetFunctionName(), backtrace[i])
- self.assertEqual(frame.GetLineEntry().GetLine(),
- line_number("main.c", "Frame " + backtrace[i]))
- self.assertEqual(frame.FindVariable("F").GetValueAsUnsigned(), ord(backtrace[i][0]))
-
- self.check_memory_regions(process, region_count)
-
- self.dbg.DeleteTarget(target)
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
new file mode 100644
index 000000000000..44a42fdfe9d1
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
@@ -0,0 +1,161 @@
+"""
+Test basics of Minidump debugging.
+"""
+
+from __future__ import print_function
+from six import iteritems
+
+import shutil
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class MiniDumpNewTestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ NO_DEBUG_INFO_TESTCASE = True
+
+ _linux_x86_64_pid = 29917
+ _linux_x86_64_not_crashed_pid = 29939
+ _linux_x86_64_not_crashed_pid_offset = 0xD967
+
+ def test_process_info_in_minidump(self):
+ """Test that lldb can read the process information from the Minidump."""
+ # target create -c linux-x86_64.dmp
+ self.dbg.CreateTarget(None)
+ self.target = self.dbg.GetSelectedTarget()
+ self.process = self.target.LoadCore("linux-x86_64.dmp")
+ self.assertTrue(self.process, PROCESS_IS_VALID)
+ self.assertEqual(self.process.GetNumThreads(), 1)
+ self.assertEqual(self.process.GetProcessID(), self._linux_x86_64_pid)
+
+ def test_thread_info_in_minidump(self):
+ """Test that lldb can read the thread information from the Minidump."""
+ # target create -c linux-x86_64.dmp
+ self.dbg.CreateTarget(None)
+ self.target = self.dbg.GetSelectedTarget()
+ self.process = self.target.LoadCore("linux-x86_64.dmp")
+ # This process crashed due to a segmentation fault in its
+ # one and only thread.
+ self.assertEqual(self.process.GetNumThreads(), 1)
+ thread = self.process.GetThreadAtIndex(0)
+ self.assertEqual(thread.GetStopReason(), lldb.eStopReasonSignal)
+ stop_description = thread.GetStopDescription(256)
+ self.assertTrue("SIGSEGV" in stop_description)
+
+ def test_stack_info_in_minidump(self):
+ """Test that we can see a trivial stack in a breakpad-generated Minidump."""
+ # target create linux-x86_64 -c linux-x86_64.dmp
+ self.dbg.CreateTarget("linux-x86_64")
+ self.target = self.dbg.GetSelectedTarget()
+ self.process = self.target.LoadCore("linux-x86_64.dmp")
+ self.assertEqual(self.process.GetNumThreads(), 1)
+ self.assertEqual(self.process.GetProcessID(), self._linux_x86_64_pid)
+ thread = self.process.GetThreadAtIndex(0)
+ # frame #0: linux-x86_64`crash()
+ # frame #1: linux-x86_64`_start
+ self.assertEqual(thread.GetNumFrames(), 2)
+ frame = thread.GetFrameAtIndex(0)
+ self.assertTrue(frame.IsValid())
+ pc = frame.GetPC()
+ eip = frame.FindRegister("pc")
+ self.assertTrue(eip.IsValid())
+ self.assertEqual(pc, eip.GetValueAsUnsigned())
+
+ def test_snapshot_minidump(self):
+ """Test that if we load a snapshot minidump file (meaning the process
+ did not crash) there is no stop reason."""
+ # target create -c linux-x86_64_not_crashed.dmp
+ self.dbg.CreateTarget(None)
+ self.target = self.dbg.GetSelectedTarget()
+ self.process = self.target.LoadCore("linux-x86_64_not_crashed.dmp")
+ self.assertEqual(self.process.GetNumThreads(), 1)
+ thread = self.process.GetThreadAtIndex(0)
+ self.assertEqual(thread.GetStopReason(), lldb.eStopReasonNone)
+ stop_description = thread.GetStopDescription(256)
+ self.assertEqual(stop_description, None)
+
+ def do_test_deeper_stack(self, binary, core, pid):
+ target = self.dbg.CreateTarget(binary)
+ process = target.LoadCore(core)
+ thread = process.GetThreadAtIndex(0)
+
+ self.assertEqual(process.GetProcessID(), pid)
+
+ expected_stack = {1: 'bar', 2: 'foo', 3: '_start'}
+ self.assertGreaterEqual(thread.GetNumFrames(), len(expected_stack))
+ for index, name in iteritems(expected_stack):
+ frame = thread.GetFrameAtIndex(index)
+ self.assertTrue(frame.IsValid())
+ function_name = frame.GetFunctionName()
+ self.assertTrue(name in function_name)
+
+ def test_deeper_stack_in_minidump(self):
+ """Test that we can examine a more interesting stack in a Minidump."""
+ # Launch with the Minidump, and inspect the stack.
+ # target create linux-x86_64_not_crashed -c linux-x86_64_not_crashed.dmp
+ self.do_test_deeper_stack("linux-x86_64_not_crashed",
+ "linux-x86_64_not_crashed.dmp",
+ self._linux_x86_64_not_crashed_pid)
+
+ def do_change_pid_in_minidump(self, core, newcore, offset, oldpid, newpid):
+ """ This assumes that the minidump is breakpad generated on Linux -
+ meaning that the PID in the file will be an ascii string part of
+ /proc/PID/status which is written in the file
+ """
+ shutil.copyfile(core, newcore)
+ with open(newcore, "rb+") as f:
+ f.seek(offset)
+ currentpid = f.read(5).decode('utf-8')
+ self.assertEqual(currentpid, oldpid)
+
+ f.seek(offset)
+ if len(newpid) < len(oldpid):
+ newpid += " " * (len(oldpid) - len(newpid))
+ newpid += "\n"
+ f.write(newpid.encode('utf-8'))
+
+ def test_deeper_stack_in_minidump_with_same_pid_running(self):
+ """Test that we read the information from the core correctly even if we
+ have a running process with the same PID"""
+ try:
+ self.do_change_pid_in_minidump("linux-x86_64_not_crashed.dmp",
+ "linux-x86_64_not_crashed-pid.dmp",
+ self._linux_x86_64_not_crashed_pid_offset,
+ str(self._linux_x86_64_not_crashed_pid),
+ str(os.getpid()))
+ self.do_test_deeper_stack("linux-x86_64_not_crashed",
+ "linux-x86_64_not_crashed-pid.dmp",
+ os.getpid())
+ finally:
+ self.RemoveTempFile("linux-x86_64_not_crashed-pid.dmp")
+
+ def test_two_cores_same_pid(self):
+ """Test that we handle the situation if we have two core files with the same PID """
+ try:
+ self.do_change_pid_in_minidump("linux-x86_64_not_crashed.dmp",
+ "linux-x86_64_not_crashed-pid.dmp",
+ self._linux_x86_64_not_crashed_pid_offset,
+ str(self._linux_x86_64_not_crashed_pid),
+ str(self._linux_x86_64_pid))
+ self.do_test_deeper_stack("linux-x86_64_not_crashed",
+ "linux-x86_64_not_crashed-pid.dmp",
+ self._linux_x86_64_pid)
+ self.test_stack_info_in_minidump()
+ finally:
+ self.RemoveTempFile("linux-x86_64_not_crashed-pid.dmp")
+
+ def test_local_variables_in_minidump(self):
+ """Test that we can examine local variables in a Minidump."""
+ # Launch with the Minidump, and inspect a local variable.
+ # target create linux-x86_64_not_crashed -c linux-x86_64_not_crashed.dmp
+ target = self.dbg.CreateTarget("linux-x86_64_not_crashed")
+ process = target.LoadCore("linux-x86_64_not_crashed.dmp")
+ thread = process.GetThreadAtIndex(0)
+ frame = thread.GetFrameAtIndex(1)
+ value = frame.EvaluateExpression('x')
+ self.assertEqual(value.GetValueAsSigned(), 3)
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/install_breakpad.cpp b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/install_breakpad.cpp
new file mode 100644
index 000000000000..c34ac17128fa
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/install_breakpad.cpp
@@ -0,0 +1,16 @@
+#include "client/linux/handler/exception_handler.h"
+
+static bool dumpCallback(const google_breakpad::MinidumpDescriptor &descriptor,
+ void *context, bool succeeded) {
+ return succeeded;
+}
+
+google_breakpad::ExceptionHandler *eh;
+
+void InstallBreakpad() {
+ google_breakpad::MinidumpDescriptor descriptor("/tmp");
+ eh = new google_breakpad::ExceptionHandler(descriptor, NULL, dumpCallback,
+ NULL, true, -1);
+}
+
+void WriteMinidump() { eh->WriteMinidump(); }
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64 b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64
new file mode 100755
index 000000000000..078d9c8fa90a
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64
Binary files differ
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64.cpp b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64.cpp
new file mode 100644
index 000000000000..61d31492940d
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64.cpp
@@ -0,0 +1,12 @@
+void crash() {
+ volatile int *a = (int *)(nullptr);
+ *a = 1;
+}
+
+extern "C" void _start();
+void InstallBreakpad();
+
+void _start() {
+ InstallBreakpad();
+ crash();
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64.dmp b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64.dmp
new file mode 100644
index 000000000000..e2ae724abe99
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64.dmp
Binary files differ
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64_not_crashed b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64_not_crashed
new file mode 100755
index 000000000000..8b38cdb48bdd
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64_not_crashed
Binary files differ
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64_not_crashed.cpp b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64_not_crashed.cpp
new file mode 100644
index 000000000000..070c565e72bd
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64_not_crashed.cpp
@@ -0,0 +1,22 @@
+void InstallBreakpad();
+void WriteMinidump();
+
+int global = 42;
+
+int bar(int x) {
+ WriteMinidump();
+ int y = 4 * x + global;
+ return y;
+}
+
+int foo(int x) {
+ int y = 2 * bar(3 * x);
+ return y;
+}
+
+extern "C" void _start();
+
+void _start() {
+ InstallBreakpad();
+ foo(1);
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64_not_crashed.dmp b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64_not_crashed.dmp
new file mode 100644
index 000000000000..ad4b61a7bbb4
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64_not_crashed.dmp
Binary files differ
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/makefile.txt b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/makefile.txt
new file mode 100644
index 000000000000..79a95d61d85e
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/makefile.txt
@@ -0,0 +1,29 @@
+# This makefile aims to make the binaries as small as possible, for us not to
+# upload huge binary blobs in the repo.
+# The binary should have debug symbols because stack unwinding doesn't work
+# correctly using the information in the Minidump only. Also we want to evaluate
+# local variables, etc.
+# Breakpad compiles as a static library, so statically linking againts it
+# makes the binary huge.
+# Dynamically linking to it does improve things, but we are still #include-ing
+# breakpad headers (which is a lot of source code for which we generate debug
+# symbols)
+# So, install_breakpad.cpp does the #include-ing and defines a global function
+# "InstallBreakpad" that does all the exception handler registration.
+# We compile install_breakpad to object file and then link it, alongside the
+# static libbreakpad, into a shared library.
+# Then the binaries dynamically link to that lib.
+# The other optimisation is not using the standard library (hence the _start
+# instead of main). We only link dynamically to some standard libraries.
+# This way we have a tiny binary (~8K) that has debug symbols and uses breakpad
+# to generate a Minidump when the binary crashes/requests such.
+#
+CC=g++
+FLAGS=-g --std=c++11
+INCLUDE=-I$HOME/breakpad/src/src/
+LINK=-L. -lbreakpad -lpthread -nostdlib -lc -lstdc++ -lgcc_s -fno-exceptions
+all:
+ $(CC) $(FLAGS) -fPIC -c install_breakpad.cpp $(INCLUDE) -o install_breakpad.o
+ ld -shared install_breakpad.o libbreakpad_client.a -o libbreakpad.so
+ $(CC) $(FLAGS) -o linux-x86_64 linux-x86_64.cpp $(LINK)
+ $(CC) $(FLAGS) -o linux-x86_64_not_crashed linux-x86_64_not_crashed.cpp $(LINK)
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py
index 89d1974b6703..b89a305d0e88 100644
--- a/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py
@@ -11,12 +11,12 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class MiniDumpTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
+ NO_DEBUG_INFO_TESTCASE = True
- @skipUnlessWindows # for now mini-dump debugging is limited to Windows hosts
- @no_debug_info_test
def test_process_info_in_mini_dump(self):
"""Test that lldb can read the process information from the minidump."""
# target create -c fizzbuzz_no_heap.dmp
@@ -27,23 +27,20 @@ class MiniDumpTestCase(TestBase):
self.assertEqual(self.process.GetNumThreads(), 1)
self.assertEqual(self.process.GetProcessID(), 4440)
- @skipUnlessWindows # for now mini-dump debugging is limited to Windows hosts
- @no_debug_info_test
def test_thread_info_in_mini_dump(self):
"""Test that lldb can read the thread information from the minidump."""
# target create -c fizzbuzz_no_heap.dmp
self.dbg.CreateTarget("")
self.target = self.dbg.GetSelectedTarget()
self.process = self.target.LoadCore("fizzbuzz_no_heap.dmp")
- # This process crashed due to an access violation (0xc0000005) in its one and only thread.
+ # This process crashed due to an access violation (0xc0000005) in its
+ # one and only thread.
self.assertEqual(self.process.GetNumThreads(), 1)
thread = self.process.GetThreadAtIndex(0)
self.assertEqual(thread.GetStopReason(), lldb.eStopReasonException)
- stop_description = thread.GetStopDescription(256);
- self.assertTrue("0xc0000005" in stop_description);
+ stop_description = thread.GetStopDescription(256)
+ self.assertTrue("0xc0000005" in stop_description)
- @skipUnlessWindows # for now mini-dump debugging is limited to Windows hosts
- @no_debug_info_test
def test_stack_info_in_mini_dump(self):
"""Test that we can see a trivial stack in a VS-generate mini dump."""
# target create -c fizzbuzz_no_heap.dmp
@@ -61,8 +58,7 @@ class MiniDumpTestCase(TestBase):
self.assertTrue(eip.IsValid())
self.assertEqual(pc, eip.GetValueAsUnsigned())
- @skipUnlessWindows
- @not_remote_testsuite_ready
+ @skipUnlessWindows # Minidump saving works only on windows
def test_deeper_stack_in_mini_dump(self):
"""Test that we can examine a more interesting stack in a mini dump."""
self.build()
@@ -72,7 +68,8 @@ class MiniDumpTestCase(TestBase):
# Set a breakpoint and capture a mini dump.
target = self.dbg.CreateTarget(exe)
breakpoint = target.BreakpointCreateByName("bar")
- process = target.LaunchSimple(None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertEqual(process.GetState(), lldb.eStateStopped)
self.assertTrue(process.SaveCore(core))
self.assertTrue(os.path.isfile(core))
@@ -83,7 +80,7 @@ class MiniDumpTestCase(TestBase):
process = target.LoadCore(core)
thread = process.GetThreadAtIndex(0)
- expected_stack = { 0: 'bar', 1: 'foo', 2: 'main' }
+ expected_stack = {0: 'bar', 1: 'foo', 2: 'main'}
self.assertGreaterEqual(thread.GetNumFrames(), len(expected_stack))
for index, name in iteritems(expected_stack):
frame = thread.GetFrameAtIndex(index)
@@ -97,8 +94,7 @@ class MiniDumpTestCase(TestBase):
if (os.path.isfile(core)):
os.unlink(core)
- @skipUnlessWindows
- @not_remote_testsuite_ready
+ @skipUnlessWindows # Minidump saving works only on windows
def test_local_variables_in_mini_dump(self):
"""Test that we can examine local variables in a mini dump."""
self.build()
@@ -108,7 +104,8 @@ class MiniDumpTestCase(TestBase):
# Set a breakpoint and capture a mini dump.
target = self.dbg.CreateTarget(exe)
breakpoint = target.BreakpointCreateByName("bar")
- process = target.LaunchSimple(None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertEqual(process.GetState(), lldb.eStateStopped)
self.assertTrue(process.SaveCore(core))
self.assertTrue(os.path.isfile(core))
diff --git a/packages/Python/lldbsuite/test/functionalities/postmortem/wow64_minidump/TestWow64MiniDump.py b/packages/Python/lldbsuite/test/functionalities/postmortem/wow64_minidump/TestWow64MiniDump.py
index 08debab538f5..73ad3940aca2 100644
--- a/packages/Python/lldbsuite/test/functionalities/postmortem/wow64_minidump/TestWow64MiniDump.py
+++ b/packages/Python/lldbsuite/test/functionalities/postmortem/wow64_minidump/TestWow64MiniDump.py
@@ -16,12 +16,12 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class Wow64MiniDumpTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
+ NO_DEBUG_INFO_TESTCASE = True
- @skipUnlessWindows # for now mini-dump debugging is limited to Windows hosts
- @no_debug_info_test
def test_wow64_mini_dump(self):
"""Test that lldb can read the process information from the minidump."""
# target create -c fizzbuzz_wow64.dmp
@@ -31,8 +31,6 @@ class Wow64MiniDumpTestCase(TestBase):
self.assertEqual(process.GetNumThreads(), 1)
self.assertEqual(process.GetProcessID(), 0x1E9C)
- @skipUnlessWindows # for now mini-dump debugging is limited to Windows hosts
- @no_debug_info_test
def test_thread_info_in_wow64_mini_dump(self):
"""Test that lldb can read the thread information from the minidump."""
# target create -c fizzbuzz_wow64.dmp
@@ -49,8 +47,6 @@ class Wow64MiniDumpTestCase(TestBase):
thread = process.GetThreadAtIndex(0)
self.assertEqual(thread.GetStopReason(), lldb.eStopReasonNone)
- @skipUnlessWindows # for now mini-dump debugging is limited to Windows hosts
- @no_debug_info_test
def test_stack_info_in_wow64_mini_dump(self):
"""Test that we can see a trivial stack in a VS-generate mini dump."""
# target create -c fizzbuzz_no_heap.dmp
@@ -66,7 +62,8 @@ class Wow64MiniDumpTestCase(TestBase):
# In the dump, none of the threads are stopped, so we cannot use
# lldbutil.get_stopped_thread.
thread = process.GetThreadAtIndex(0)
- # The crash is in main, so there should be at least one frame on the stack.
+ # The crash is in main, so there should be at least one frame on the
+ # stack.
self.assertGreaterEqual(thread.GetNumFrames(), 1)
frame = thread.GetFrameAtIndex(0)
self.assertTrue(frame.IsValid())
diff --git a/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py b/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py
index e4eb302d83d1..716d0d4f5bc7 100644
--- a/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py
+++ b/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py
@@ -5,8 +5,8 @@ Test process attach.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
@@ -14,10 +14,13 @@ from lldbsuite.test import lldbutil
exe_name = "ProcessAttach" # Must match Makefile
+
class ProcessAttachTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
+ NO_DEBUG_INFO_TESTCASE = True
+
@skipIfiOSSimulator
def test_attach_to_process_by_id(self):
"""Test attach by process id"""
diff --git a/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py b/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py
index 3d1d7fdc7907..071f5d57c78f 100644
--- a/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py
+++ b/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py
@@ -5,7 +5,6 @@ Test denied process attach.
from __future__ import print_function
-
import os
import time
import lldb
@@ -15,6 +14,7 @@ from lldbsuite.test import lldbutil
exe_name = 'AttachDenied' # Must match Makefile
+
class AttachDeniedTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -28,8 +28,11 @@ class AttachDeniedTestCase(TestBase):
# Use a file as a synchronization point between test and inferior.
pid_file_path = lldbutil.append_to_process_working_directory(
- "pid_file_%d" % (int(time.time())))
- self.addTearDownHook(lambda: self.run_platform_command("rm %s" % (pid_file_path)))
+ "pid_file_%d" % (int(time.time())))
+ self.addTearDownHook(
+ lambda: self.run_platform_command(
+ "rm %s" %
+ (pid_file_path)))
# Spawn a new process
popen = self.spawnSubprocess(exe, [pid_file_path])
@@ -38,5 +41,5 @@ class AttachDeniedTestCase(TestBase):
pid = lldbutil.wait_for_file_on_target(self, pid_file_path)
self.expect('process attach -p ' + pid,
- startstr = 'error: attach failed:',
- error = True)
+ startstr='error: attach failed:',
+ error=True)
diff --git a/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py b/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py
index c20d66aa3ab0..00b4d4153403 100644
--- a/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py
+++ b/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py
@@ -3,7 +3,6 @@
from __future__ import print_function
-
import os
import lldb
from lldbsuite.test.decorators import *
@@ -21,8 +20,8 @@ class ChangeProcessGroupTestCase(TestBase):
# Find the line number to break for main.c.
self.line = line_number('main.c', '// Set breakpoint here')
- @skipIfFreeBSD # Times out on FreeBSD llvm.org/pr23731
- @skipIfWindows # setpgid call does not exist on Windows
+ @skipIfFreeBSD # Times out on FreeBSD llvm.org/pr23731
+ @skipIfWindows # setpgid call does not exist on Windows
@expectedFailureAndroid("http://llvm.org/pr23762", api_levels=[16])
def test_setpgid(self):
self.build()
@@ -30,8 +29,11 @@ class ChangeProcessGroupTestCase(TestBase):
# Use a file as a synchronization point between test and inferior.
pid_file_path = lldbutil.append_to_process_working_directory(
- "pid_file_%d" % (int(time.time())))
- self.addTearDownHook(lambda: self.run_platform_command("rm %s" % (pid_file_path)))
+ "pid_file_%d" % (int(time.time())))
+ self.addTearDownHook(
+ lambda: self.run_platform_command(
+ "rm %s" %
+ (pid_file_path)))
popen = self.spawnSubprocess(exe, [pid_file_path])
self.addTearDownHook(self.cleanupSubprocesses)
@@ -57,19 +59,20 @@ class ChangeProcessGroupTestCase(TestBase):
self.assertTrue(error.Success() and process, PROCESS_IS_VALID)
# set a breakpoint just before the setpgid() call
- lldbutil.run_break_set_by_file_and_line(self, 'main.c', self.line, num_expected_locations=-1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, 'main.c', self.line, num_expected_locations=-1)
thread = process.GetSelectedThread()
# release the child from its loop
value = thread.GetSelectedFrame().EvaluateExpression("release_child_flag = 1")
- self.assertTrue(value.IsValid() and value.GetValueAsUnsigned(0) == 1);
+ self.assertTrue(value.IsValid() and value.GetValueAsUnsigned(0) == 1)
process.Continue()
# make sure the child's process group id is different from its pid
value = thread.GetSelectedFrame().EvaluateExpression("(int)getpgid(0)")
self.assertTrue(value.IsValid())
- self.assertNotEqual(value.GetValueAsUnsigned(0), int(pid));
+ self.assertNotEqual(value.GetValueAsUnsigned(0), int(pid))
# step over the setpgid() call
thread.StepOver()
@@ -79,7 +82,7 @@ class ChangeProcessGroupTestCase(TestBase):
# this also checks that we are still in full control of the child
value = thread.GetSelectedFrame().EvaluateExpression("(int)getpgid(0)")
self.assertTrue(value.IsValid())
- self.assertEqual(value.GetValueAsUnsigned(0), int(pid));
+ self.assertEqual(value.GetValueAsUnsigned(0), int(pid))
# run to completion
process.Continue()
diff --git a/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py b/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py
index 5998edb3c7e0..5929a352b615 100644
--- a/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py
+++ b/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py
@@ -15,6 +15,7 @@ from lldbsuite.test import lldbutil
import six
+
class ProcessLaunchTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -29,12 +30,12 @@ class ProcessLaunchTestCase(TestBase):
TestBase.tearDown(self)
@not_remote_testsuite_ready
- def test_io (self):
+ def test_io(self):
"""Test that process launch I/O redirection flags work properly."""
- self.build ()
- exe = os.path.join (os.getcwd(), "a.out")
+ self.build()
+ exe = os.path.join(os.getcwd(), "a.out")
self.expect("file " + exe,
- patterns = [ "Current executable set to .*a.out" ])
+ patterns=["Current executable set to .*a.out"])
in_file = "input-file.txt"
out_file = "output-test.out"
@@ -42,23 +43,24 @@ class ProcessLaunchTestCase(TestBase):
# Make sure the output files do not exist before launching the process
try:
- os.remove (out_file)
+ os.remove(out_file)
except OSError:
pass
try:
- os.remove (err_file)
+ os.remove(err_file)
except OSError:
pass
- launch_command = "process launch -i " + in_file + " -o " + out_file + " -e " + err_file
+ launch_command = "process launch -i " + \
+ in_file + " -o " + out_file + " -e " + err_file
if lldb.remote_platform:
self.runCmd('platform put-file "{local}" "{remote}"'.format(
local=in_file, remote=in_file))
- self.expect (launch_command,
- patterns = [ "Process .* launched: .*a.out" ])
+ self.expect(launch_command,
+ patterns=["Process .* launched: .*a.out"])
if lldb.remote_platform:
self.runCmd('platform get-file "{remote}" "{local}"'.format(
@@ -71,33 +73,33 @@ class ProcessLaunchTestCase(TestBase):
# Check to see if the 'stdout' file was created
try:
- out_f = open (out_file)
+ out_f = open(out_file)
except IOError:
success = False
err_msg = err_msg + " ERROR: stdout file was not created.\n"
else:
# Check to see if the 'stdout' file contains the right output
- line = out_f.readline ();
+ line = out_f.readline()
if line != "This should go to stdout.\n":
success = False
err_msg = err_msg + " ERROR: stdout file does not contain correct output.\n"
- out_f.close();
+ out_f.close()
# Try to delete the 'stdout' file
try:
- os.remove (out_file)
+ os.remove(out_file)
except OSError:
pass
# Check to see if the 'stderr' file was created
try:
- err_f = open (err_file)
+ err_f = open(err_file)
except IOError:
success = False
err_msg = err_msg + " ERROR: stderr file was not created.\n"
else:
# Check to see if the 'stderr' file contains the right output
- line = err_f.readline ()
+ line = err_f.readline()
if line != "This should go to stderr.\n":
success = False
err_msg = err_msg + " ERROR: stderr file does not contain correct output.\n\
@@ -106,23 +108,24 @@ class ProcessLaunchTestCase(TestBase):
# Try to delete the 'stderr' file
try:
- os.remove (err_file)
+ os.remove(err_file)
except OSError:
pass
if not success:
- self.fail (err_msg)
+ self.fail(err_msg)
# rdar://problem/9056462
- # The process launch flag '-w' for setting the current working directory not working?
+ # The process launch flag '-w' for setting the current working directory
+ # not working?
@not_remote_testsuite_ready
@expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr20265")
- def test_set_working_dir (self):
+ def test_set_working_dir(self):
"""Test that '-w dir' sets the working dir when running the inferior."""
- d = {'CXX_SOURCES' : 'print_cwd.cpp'}
+ d = {'CXX_SOURCES': 'print_cwd.cpp'}
self.build(dictionary=d)
self.setTearDownCleanup(d)
- exe = os.path.join (os.getcwd(), "a.out")
+ exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe)
mywd = 'my_working_dir'
@@ -135,26 +138,26 @@ class ProcessLaunchTestCase(TestBase):
# Make sure the output files do not exist before launching the process
try:
- os.remove (out_file_path)
- os.remove (err_file_path)
+ os.remove(out_file_path)
+ os.remove(err_file_path)
except OSError:
pass
# Check that we get an error when we have a nonexisting path
- launch_command = "process launch -w %s -o %s -e %s" % (my_working_dir_path + 'z',
- out_file_path,
- err_file_path)
+ launch_command = "process launch -w %s -o %s -e %s" % (
+ my_working_dir_path + 'z', out_file_path, err_file_path)
- self.expect(launch_command, error=True,
- patterns = ["error:.* No such file or directory: %sz" % my_working_dir_path])
+ self.expect(
+ launch_command, error=True, patterns=[
+ "error:.* No such file or directory: %sz" %
+ my_working_dir_path])
# Really launch the process
- launch_command = "process launch -w %s -o %s -e %s" % (my_working_dir_path,
- out_file_path,
- err_file_path)
+ launch_command = "process launch -w %s -o %s -e %s" % (
+ my_working_dir_path, out_file_path, err_file_path)
self.expect(launch_command,
- patterns = [ "Process .* launched: .*a.out" ])
+ patterns=["Process .* launched: .*a.out"])
success = True
err_msg = ""
@@ -167,13 +170,13 @@ class ProcessLaunchTestCase(TestBase):
err_msg = err_msg + "ERROR: stdout file was not created.\n"
else:
# Check to see if the 'stdout' file contains the right output
- line = out_f.readline();
+ line = out_f.readline()
if self.TraceOn():
print("line:", line)
if not re.search(mywd, line):
success = False
err_msg = err_msg + "The current working directory was not set correctly.\n"
- out_f.close();
+ out_f.close()
# Try to delete the 'stdout' and 'stderr' files
try:
@@ -186,24 +189,31 @@ class ProcessLaunchTestCase(TestBase):
if not success:
self.fail(err_msg)
- def test_environment_with_special_char (self):
+ def test_environment_with_special_char(self):
"""Test that environment variables containing '*' and '}' are handled correctly by the inferior."""
source = 'print_env.cpp'
- d = {'CXX_SOURCES' : source}
+ d = {'CXX_SOURCES': source}
self.build(dictionary=d)
self.setTearDownCleanup(d)
- exe = os.path.join (os.getcwd(), "a.out")
+ exe = os.path.join(os.getcwd(), "a.out")
evil_var = 'INIT*MIDDLE}TAIL'
target = self.dbg.CreateTarget(exe)
main_source_spec = lldb.SBFileSpec(source)
- breakpoint = target.BreakpointCreateBySourceRegex('// Set breakpoint here.', main_source_spec)
-
- process = target.LaunchSimple(None, ['EVIL=' + evil_var], self.get_process_working_directory())
- self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED)
-
- threads = lldbutil.get_threads_stopped_at_breakpoint(process, breakpoint)
+ breakpoint = target.BreakpointCreateBySourceRegex(
+ '// Set breakpoint here.', main_source_spec)
+
+ process = target.LaunchSimple(None,
+ ['EVIL=' + evil_var],
+ self.get_process_working_directory())
+ self.assertEqual(
+ process.GetState(),
+ lldb.eStateStopped,
+ PROCESS_STOPPED)
+
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ process, breakpoint)
self.assertEqual(len(threads), 1)
frame = threads[0].GetFrameAtIndex(0)
sbvalue = frame.EvaluateExpression("evil")
diff --git a/packages/Python/lldbsuite/test/functionalities/process_save_core/TestProcessSaveCore.py b/packages/Python/lldbsuite/test/functionalities/process_save_core/TestProcessSaveCore.py
index 1c01e2138c2e..ee1f82b14f7b 100644
--- a/packages/Python/lldbsuite/test/functionalities/process_save_core/TestProcessSaveCore.py
+++ b/packages/Python/lldbsuite/test/functionalities/process_save_core/TestProcessSaveCore.py
@@ -4,12 +4,14 @@ Test saving a core file (or mini dump).
from __future__ import print_function
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ProcessSaveCoreTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -22,7 +24,8 @@ class ProcessSaveCoreTestCase(TestBase):
exe = os.path.join(os.getcwd(), "a.out")
core = os.path.join(os.getcwd(), "core.dmp")
target = self.dbg.CreateTarget(exe)
- process = target.LaunchSimple(None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertNotEqual(process.GetState(), lldb.eStateStopped)
error = process.SaveCore(core)
self.assertTrue(error.Fail())
@@ -37,7 +40,8 @@ class ProcessSaveCoreTestCase(TestBase):
try:
target = self.dbg.CreateTarget(exe)
breakpoint = target.BreakpointCreateByName("bar")
- process = target.LaunchSimple(None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertEqual(process.GetState(), lldb.eStateStopped)
self.assertTrue(process.SaveCore(core))
self.assertTrue(os.path.isfile(core))
@@ -47,8 +51,13 @@ class ProcessSaveCoreTestCase(TestBase):
# the executable in the module list.
target = self.dbg.CreateTarget(None)
process = target.LoadCore(core)
- files = [target.GetModuleAtIndex(i).GetFileSpec() for i in range(0, target.GetNumModules())]
- paths = [os.path.join(f.GetDirectory(), f.GetFilename()) for f in files]
+ files = [
+ target.GetModuleAtIndex(i).GetFileSpec() for i in range(
+ 0, target.GetNumModules())]
+ paths = [
+ os.path.join(
+ f.GetDirectory(),
+ f.GetFilename()) for f in files]
self.assertTrue(exe in paths)
finally:
@@ -56,5 +65,3 @@ class ProcessSaveCoreTestCase(TestBase):
self.assertTrue(self.dbg.DeleteTarget(target))
if (os.path.isfile(core)):
os.unlink(core)
-
-
diff --git a/packages/Python/lldbsuite/test/functionalities/ptr_refs/TestPtrRefs.py b/packages/Python/lldbsuite/test/functionalities/ptr_refs/TestPtrRefs.py
index 81db42d8e3c6..5085b8cce99a 100644
--- a/packages/Python/lldbsuite/test/functionalities/ptr_refs/TestPtrRefs.py
+++ b/packages/Python/lldbsuite/test/functionalities/ptr_refs/TestPtrRefs.py
@@ -10,6 +10,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestPtrRefs(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -20,24 +21,29 @@ class TestPtrRefs(TestBase):
self.build()
exe_name = 'a.out'
exe = os.path.join(os.getcwd(), exe_name)
-
+
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- main_file_spec = lldb.SBFileSpec ('main.c')
- breakpoint = target.BreakpointCreateBySourceRegex('break', main_file_spec)
+ main_file_spec = lldb.SBFileSpec('main.c')
+ breakpoint = target.BreakpointCreateBySourceRegex(
+ 'break', main_file_spec)
self.assertTrue(breakpoint and
breakpoint.GetNumLocations() == 1,
VALID_BREAKPOINT)
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# Frame #0 should be on self.line1 and the break condition should hold.
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint condition")
- frame = thread.GetFrameAtIndex(0)
+ frame = thread.GetFrameAtIndex(0)
self.dbg.HandleCommand("script import lldb.macosx.heap")
- self.expect("ptr_refs my_ptr", substrs=["malloc", "stack"]);
+ self.expect("ptr_refs my_ptr", substrs=["malloc", "stack"])
diff --git a/packages/Python/lldbsuite/test/functionalities/recursion/TestValueObjectRecursion.py b/packages/Python/lldbsuite/test/functionalities/recursion/TestValueObjectRecursion.py
index fcb493bc9d95..5b72d383f141 100644
--- a/packages/Python/lldbsuite/test/functionalities/recursion/TestValueObjectRecursion.py
+++ b/packages/Python/lldbsuite/test/functionalities/recursion/TestValueObjectRecursion.py
@@ -5,12 +5,13 @@ Test lldb data formatter subsystem.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class ValueObjectRecursionTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -26,14 +27,15 @@ class ValueObjectRecursionTestCase(TestBase):
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -47,13 +49,21 @@ class ValueObjectRecursionTestCase(TestBase):
root = self.frame().FindVariable("root")
child = root.GetChildAtIndex(1)
if self.TraceOn():
- print(root)
- print(child)
- for i in range(0,15000):
- child = child.GetChildAtIndex(1)
+ print(root)
+ print(child)
+ for i in range(0, 15000):
+ child = child.GetChildAtIndex(1)
if self.TraceOn():
- print(child)
- self.assertTrue(child.IsValid(),"could not retrieve the deep ValueObject")
- self.assertTrue(child.GetChildAtIndex(0).IsValid(),"the deep ValueObject has no value")
- self.assertTrue(child.GetChildAtIndex(0).GetValueAsUnsigned() != 0,"the deep ValueObject has a zero value")
- self.assertTrue(child.GetChildAtIndex(1).GetValueAsUnsigned() != 0, "the deep ValueObject has no next")
+ print(child)
+ self.assertTrue(
+ child.IsValid(),
+ "could not retrieve the deep ValueObject")
+ self.assertTrue(
+ child.GetChildAtIndex(0).IsValid(),
+ "the deep ValueObject has no value")
+ self.assertTrue(
+ child.GetChildAtIndex(0).GetValueAsUnsigned() != 0,
+ "the deep ValueObject has a zero value")
+ self.assertTrue(
+ child.GetChildAtIndex(1).GetValueAsUnsigned() != 0,
+ "the deep ValueObject has no next")
diff --git a/packages/Python/lldbsuite/test/functionalities/register/intel_avx/Makefile b/packages/Python/lldbsuite/test/functionalities/register/intel_avx/Makefile
new file mode 100644
index 000000000000..7aadba93b7fe
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/register/intel_avx/Makefile
@@ -0,0 +1,7 @@
+LEVEL = ../../../make
+
+C_SOURCES := main.c
+
+CFLAGS_EXTRAS ?= -g -O1
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestYMMRegister.py b/packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestYMMRegister.py
new file mode 100644
index 000000000000..6fcf29a2f58f
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestYMMRegister.py
@@ -0,0 +1,75 @@
+"""
+Test that we correctly read the YMM registers.
+"""
+
+from __future__ import print_function
+
+
+import os
+import time
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestYMMRegister(TestBase):
+ mydir = TestBase.compute_mydir(__file__)
+
+ @skipIfFreeBSD
+ @skipIfiOSSimulator
+ @skipIfTargetAndroid()
+ @skipIf(archs=no_match(['i386', 'x86_64']))
+ def test(self):
+ self.build()
+ self.setTearDownCleanup()
+
+ exe = os.path.join(os.getcwd(), "a.out")
+ target = self.dbg.CreateTarget(exe)
+
+ self.assertTrue(target, VALID_TARGET)
+
+ byte_pattern1 = 0x80
+ byte_pattern2 = 0xFF
+
+ # Launch the process and stop.
+ self.expect("run", PROCESS_STOPPED, substrs=['stopped'])
+
+ # Check stop reason; Should be either signal SIGTRAP or EXC_BREAKPOINT
+ output = self.res.GetOutput()
+ matched = False
+ substrs = [
+ 'stop reason = EXC_BREAKPOINT',
+ 'stop reason = signal SIGTRAP']
+ for str1 in substrs:
+ matched = output.find(str1) != -1
+ with recording(self, False) as sbuf:
+ print("%s sub string: %s" % ('Expecting', str1), file=sbuf)
+ print("Matched" if matched else "Not Matched", file=sbuf)
+ if matched:
+ break
+ self.assertTrue(matched, STOPPED_DUE_TO_SIGNAL)
+
+ if self.getArchitecture() == 'x86_64':
+ register_range = 16
+ else:
+ register_range = 8
+ for i in range(register_range):
+ self.runCmd("thread step-inst")
+
+ register_byte = (byte_pattern1 | i)
+ pattern = "ymm" + str(i) + " = " + str('{') + (
+ str(hex(register_byte)) + ' ') * 31 + str(hex(register_byte)) + str('}')
+
+ self.expect(
+ "register read ymm" + str(i),
+ substrs=[pattern])
+
+ register_byte = (byte_pattern2 | i)
+ pattern = "ymm" + str(i) + " = " + str('{') + (
+ str(hex(register_byte)) + ' ') * 31 + str(hex(register_byte)) + str('}')
+
+ self.runCmd("thread step-inst")
+ self.expect(
+ "register read ymm" + str(i),
+ substrs=[pattern])
diff --git a/packages/Python/lldbsuite/test/functionalities/register/intel_avx/main.c b/packages/Python/lldbsuite/test/functionalities/register/intel_avx/main.c
new file mode 100644
index 000000000000..4cfb2239c06f
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/register/intel_avx/main.c
@@ -0,0 +1,67 @@
+//===-- main.c ------------------------------------------------*- C -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+void func() {
+ unsigned int ymmvalues[16];
+ unsigned char val;
+ unsigned char i;
+ for (i = 0 ; i < 16 ; i++)
+ {
+ val = (0x80 | i);
+ ymmvalues[i] = (val << 24) | (val << 16) | (val << 8) | val;
+ }
+
+ unsigned int ymmallones = 0xFFFFFFFF;
+ __asm__("int3;"
+ "vbroadcastss %1, %%ymm0;"
+ "vbroadcastss %0, %%ymm0;"
+ "vbroadcastss %2, %%ymm1;"
+ "vbroadcastss %0, %%ymm1;"
+ "vbroadcastss %3, %%ymm2;"
+ "vbroadcastss %0, %%ymm2;"
+ "vbroadcastss %4, %%ymm3;"
+ "vbroadcastss %0, %%ymm3;"
+ "vbroadcastss %5, %%ymm4;"
+ "vbroadcastss %0, %%ymm4;"
+ "vbroadcastss %6, %%ymm5;"
+ "vbroadcastss %0, %%ymm5;"
+ "vbroadcastss %7, %%ymm6;"
+ "vbroadcastss %0, %%ymm6;"
+ "vbroadcastss %8, %%ymm7;"
+ "vbroadcastss %0, %%ymm7;"
+#if defined(__x86_64__)
+ "vbroadcastss %9, %%ymm8;"
+ "vbroadcastss %0, %%ymm8;"
+ "vbroadcastss %10, %%ymm9;"
+ "vbroadcastss %0, %%ymm9;"
+ "vbroadcastss %11, %%ymm10;"
+ "vbroadcastss %0, %%ymm10;"
+ "vbroadcastss %12, %%ymm11;"
+ "vbroadcastss %0, %%ymm11;"
+ "vbroadcastss %13, %%ymm12;"
+ "vbroadcastss %0, %%ymm12;"
+ "vbroadcastss %14, %%ymm13;"
+ "vbroadcastss %0, %%ymm13;"
+ "vbroadcastss %15, %%ymm14;"
+ "vbroadcastss %0, %%ymm14;"
+ "vbroadcastss %16, %%ymm15;"
+ "vbroadcastss %0, %%ymm15;"
+#endif
+ ::"m"(ymmallones),
+ "m"(ymmvalues[0]), "m"(ymmvalues[1]), "m"(ymmvalues[2]), "m"(ymmvalues[3]),
+ "m"(ymmvalues[4]), "m"(ymmvalues[5]), "m"(ymmvalues[6]), "m"(ymmvalues[7])
+#if defined(__x86_64__)
+ ,
+ "m"(ymmvalues[8]), "m"(ymmvalues[9]), "m"(ymmvalues[10]), "m"(ymmvalues[11]),
+ "m"(ymmvalues[12]), "m"(ymmvalues[13]), "m"(ymmvalues[14]), "m"(ymmvalues[15])
+#endif
+ );
+}
+
+int main(int argc, char const *argv[]) { func(); }
diff --git a/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/Makefile b/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/Makefile
new file mode 100644
index 000000000000..1c1be94b3d00
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/Makefile
@@ -0,0 +1,7 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+CFLAGS_EXTRAS += -mmpx -fcheck-pointer-bounds -fuse-ld=bfd
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/TestMPXRegisters.py b/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/TestMPXRegisters.py
new file mode 100644
index 000000000000..96f3655542c8
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/TestMPXRegisters.py
@@ -0,0 +1,69 @@
+"""
+Test the Intel(R) MPX registers.
+"""
+
+from __future__ import print_function
+
+
+import os
+import sys
+import time
+import re
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class RegisterCommandsTestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ TestBase.setUp(self)
+
+ @skipIf(compiler="clang")
+ @skipIf(oslist=no_match(['linux']))
+ @skipIf(archs=no_match(['i386', 'x86_64']))
+ @skipIf(oslist=["linux"], compiler="gcc", compiler_version=["<", "5"]) #GCC version >= 5 supports Intel(R) MPX.
+ def test_mpx_registers_with_example_code(self):
+ """Test Intel(R) MPX registers with example code."""
+ self.build()
+ self.mpx_registers_with_example_code()
+
+ def mpx_registers_with_example_code(self):
+ """Test Intel(R) MPX registers after running example code."""
+ self.line = line_number('main.cpp', '// Set a break point here.')
+
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+ lldbutil.run_break_set_by_file_and_line(self, "main.cpp", self.line, num_expected_locations=1)
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ target = self.dbg.GetSelectedTarget()
+ process = target.GetProcess()
+
+ if (process.GetState() == lldb.eStateExited):
+ self.skipTest("Intel(R) MPX is not supported.")
+ else:
+ self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
+ substrs = ["stop reason = breakpoint 1."])
+
+ if self.getArchitecture() == 'x86_64':
+ self.expect("register read -s 3",
+ substrs = ['bnd0 = {0x0000000000000010 0xffffffffffffffe6}',
+ 'bnd1 = {0x0000000000000020 0xffffffffffffffd6}',
+ 'bnd2 = {0x0000000000000030 0xffffffffffffffc6}',
+ 'bnd3 = {0x0000000000000040 0xffffffffffffffb6}',
+ 'bndcfgu = {0x01 0x80 0xb5 0x76 0xff 0x7f 0x00 0x00}',
+ 'bndstatus = {0x02 0x80 0xb5 0x76 0xff 0x7f 0x00 0x00}'])
+ if self.getArchitecture() == 'i386':
+ self.expect("register read -s 3",
+ substrs = ['bnd0 = {0x0000000000000010 0x00000000ffffffe6}',
+ 'bnd1 = {0x0000000000000020 0x00000000ffffffd6}',
+ 'bnd2 = {0x0000000000000030 0x00000000ffffffc6}',
+ 'bnd3 = {0x0000000000000040 0x00000000ffffffb6}',
+ 'bndcfgu = {0x01 0xd0 0x7d 0xf7 0x00 0x00 0x00 0x00}',
+ 'bndstatus = {0x02 0xd0 0x7d 0xf7 0x00 0x00 0x00 0x00}'])
+
diff --git a/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/main.cpp b/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/main.cpp
new file mode 100644
index 000000000000..d9adb550023c
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/main.cpp
@@ -0,0 +1,57 @@
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+////
+//// The LLVM Compiler Infrastructure
+////
+//// This file is distributed under the University of Illinois Open Source
+//// License. See LICENSE.TXT for details.
+////
+////===----------------------------------------------------------------------===//
+//
+
+#include <cpuid.h>
+#include <cstddef>
+
+int
+main(int argc, char const *argv[])
+{
+ // This call returns 0 only if the CPU and the kernel support Intel(R) MPX.
+ if (prctl(PR_MPX_ENABLE_MANAGEMENT, 0, 0, 0, 0) != 0)
+ return -1;
+
+// Run Intel(R) MPX test code.
+#if defined(__x86_64__)
+ asm("mov $16, %rax\n\t"
+ "mov $9, %rdx\n\t"
+ "bndmk (%rax,%rdx), %bnd0\n\t"
+ "mov $32, %rax\n\t"
+ "mov $9, %rdx\n\t"
+ "bndmk (%rax,%rdx), %bnd1\n\t"
+ "mov $48, %rax\n\t"
+ "mov $9, %rdx\n\t"
+ "bndmk (%rax,%rdx), %bnd2\n\t"
+ "mov $64, %rax\n\t"
+ "mov $9, %rdx\n\t"
+ "bndmk (%rax,%rdx), %bnd3\n\t"
+ "bndstx %bnd3, (%rax) \n\t"
+ "nop\n\t");
+#endif
+#if defined(__i386__)
+ asm("mov $16, %eax\n\t"
+ "mov $9, %edx\n\t"
+ "bndmk (%eax,%edx), %bnd0\n\t"
+ "mov $32, %eax\n\t"
+ "mov $9, %edx\n\t"
+ "bndmk (%eax,%edx), %bnd1\n\t"
+ "mov $48, %eax\n\t"
+ "mov $9, %edx\n\t"
+ "bndmk (%eax,%edx), %bnd2\n\t"
+ "mov $64, %eax\n\t"
+ "mov $9, %edx\n\t"
+ "bndmk (%eax,%edx), %bnd3\n\t"
+ "bndstx %bnd3, (%eax)\n\t"
+ "nop\n\t");
+#endif
+ asm("nop\n\t"); // Set a break point here.
+
+ return 0;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/Makefile b/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/Makefile
new file mode 100644
index 000000000000..aa88c47ff3f6
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/Makefile
@@ -0,0 +1,7 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+
+CFLAGS_EXTRAS += -mmpx -fcheck-pointer-bounds -fuse-ld=bfd
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/TestBoundViolation.py b/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/TestBoundViolation.py
new file mode 100644
index 000000000000..45721dd260d9
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/TestBoundViolation.py
@@ -0,0 +1,57 @@
+"""
+Test the Intel(R) MPX bound violation signal.
+"""
+
+from __future__ import print_function
+
+
+import os
+import sys
+import time
+import re
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class RegisterCommandsTestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ @skipIf(compiler="clang")
+ @skipIf(oslist=no_match(['linux']))
+ @skipIf(archs=no_match(['i386', 'x86_64']))
+ @skipIf(oslist=["linux"], compiler="gcc", compiler_version=["<", "5"]) #GCC version >= 5 supports Intel(R) MPX.
+ def test_mpx_boundary_violation(self):
+ """Test Intel(R) MPX bound violation signal."""
+ self.build()
+ self.mpx_boundary_violation()
+
+ def mpx_boundary_violation(self):
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ target = self.dbg.GetSelectedTarget()
+ process = target.GetProcess()
+
+ if (process.GetState() == lldb.eStateExited):
+ self.skipTest("Intel(R) MPX is not supported.")
+
+ if (process.GetState() == lldb.eStateStopped):
+ self.expect("thread backtrace", STOPPED_DUE_TO_SIGNAL,
+ substrs = ['stop reason = signal SIGSEGV: upper bound violation',
+ 'fault address:', 'lower bound:', 'upper bound:'])
+
+ self.runCmd("continue")
+
+ if (process.GetState() == lldb.eStateStopped):
+ self.expect("thread backtrace", STOPPED_DUE_TO_SIGNAL,
+ substrs = ['stop reason = signal SIGSEGV: lower bound violation',
+ 'fault address:', 'lower bound:', 'upper bound:'])
+
+ self.runCmd("continue")
+ self.assertTrue(process.GetState() == lldb.eStateExited,
+ PROCESS_EXITED)
diff --git a/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/main.cpp b/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/main.cpp
new file mode 100644
index 000000000000..9c445aa8a275
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/main.cpp
@@ -0,0 +1,40 @@
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+////
+//// The LLVM Compiler Infrastructure
+////
+//// This file is distributed under the University of Illinois Open Source
+//// License. See LICENSE.TXT for details.
+////
+////===----------------------------------------------------------------------===//
+//
+
+#include <cstddef>
+#include <sys/prctl.h>
+
+static void violate_upper_bound(int *ptr, int size)
+{
+ int i;
+ i = *(ptr + size);
+}
+
+static void violate_lower_bound (int *ptr, int size)
+{
+ int i;
+ i = *(ptr - size);
+}
+
+int
+main(int argc, char const *argv[])
+{
+ unsigned int rax, rbx, rcx, rdx;
+ int array[5];
+
+ // This call returns 0 only if the CPU and the kernel support Intel(R) MPX.
+ if (prctl(PR_MPX_ENABLE_MANAGEMENT, 0, 0, 0, 0) != 0)
+ return -1;
+
+ violate_upper_bound(array, 5);
+ violate_lower_bound(array, 5);
+
+ return 0;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/register/Makefile b/packages/Python/lldbsuite/test/functionalities/register/register_command/Makefile
index 7144b25c58c9..3c6deff2d972 100644
--- a/packages/Python/lldbsuite/test/functionalities/register/Makefile
+++ b/packages/Python/lldbsuite/test/functionalities/register/register_command/Makefile
@@ -1,4 +1,4 @@
-LEVEL = ../../make
+LEVEL = ../../../make
CXX_SOURCES := main.cpp a.cpp
diff --git a/packages/Python/lldbsuite/test/functionalities/register/TestRegisters.py b/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py
index 21de3ab7cc37..157a0a8bd982 100644
--- a/packages/Python/lldbsuite/test/functionalities/register/TestRegisters.py
+++ b/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py
@@ -5,14 +5,16 @@ Test the 'register' command.
from __future__ import print_function
-
-import os, sys, time
+import os
+import sys
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class RegisterCommandsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -36,19 +38,25 @@ class RegisterCommandsTestCase(TestBase):
self.log_enable("registers")
self.expect("register read -a", MISSING_EXPECTED_REGISTERS,
- substrs = ['registers were unavailable'], matching = False)
+ substrs=['registers were unavailable'], matching=False)
if self.getArchitecture() in ['amd64', 'i386', 'x86_64']:
self.runCmd("register read xmm0")
- self.runCmd("register read ymm15") # may be available
+ self.runCmd("register read ymm15") # may be available
+ self.runCmd("register read bnd0") # may be available
elif self.getArchitecture() in ['arm']:
self.runCmd("register read s0")
- self.runCmd("register read q15") # may be available
+ self.runCmd("register read q15") # may be available
- self.expect("register read -s 3", substrs = ['invalid register set index: 3'], error = True)
+ self.expect(
+ "register read -s 4",
+ substrs=['invalid register set index: 4'],
+ error=True)
@skipIfiOSSimulator
- @skipIfTargetAndroid(archs=["i386"]) # Writing of mxcsr register fails, presumably due to a kernel/hardware problem
+ # Writing of mxcsr register fails, presumably due to a kernel/hardware
+ # problem
+ @skipIfTargetAndroid(archs=["i386"])
@skipIf(archs=no_match(['amd64', 'arm', 'i386', 'x86_64']))
def test_fp_register_write(self):
"""Test commands that write to registers, in particular floating-point registers."""
@@ -56,8 +64,9 @@ class RegisterCommandsTestCase(TestBase):
self.fp_register_write()
@skipIfiOSSimulator
- @expectedFailureAndroid(archs=["i386"]) # "register read fstat" always return 0xffff
- @skipIfFreeBSD #llvm.org/pr25057
+ # "register read fstat" always return 0xffff
+ @expectedFailureAndroid(archs=["i386"])
+ @skipIfFreeBSD # llvm.org/pr25057
@skipIf(archs=no_match(['amd64', 'i386', 'x86_64']))
def test_fp_special_purpose_register_read(self):
"""Test commands that read fpu special purpose registers."""
@@ -78,12 +87,16 @@ class RegisterCommandsTestCase(TestBase):
gpr = "r0"
vector = "q0"
- self.expect("expr/x $%s" % gpr, substrs = ['unsigned int', ' = 0x'])
- self.expect("expr $%s" % vector, substrs = ['vector_type'])
- self.expect("expr (unsigned int)$%s[0]" % vector, substrs = ['unsigned int'])
+ self.expect("expr/x $%s" % gpr, substrs=['unsigned int', ' = 0x'])
+ self.expect("expr $%s" % vector, substrs=['vector_type'])
+ self.expect(
+ "expr (unsigned int)$%s[0]" %
+ vector, substrs=['unsigned int'])
if self.getArchitecture() in ['amd64', 'x86_64']:
- self.expect("expr -- ($rax & 0xffffffff) == $eax", substrs = ['true'])
+ self.expect(
+ "expr -- ($rax & 0xffffffff) == $eax",
+ substrs=['true'])
@skipIfiOSSimulator
@skipIf(archs=no_match(['amd64', 'x86_64']))
@@ -112,13 +125,14 @@ class RegisterCommandsTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break in main().
- lldbutil.run_break_set_by_symbol (self, "main", num_expected_locations=-1)
+ lldbutil.run_break_set_by_symbol(
+ self, "main", num_expected_locations=-1)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped', 'stop reason = breakpoint'])
+ substrs=['stopped', 'stop reason = breakpoint'])
# platform specific logging of the specified category
def log_enable(self, category):
@@ -126,7 +140,7 @@ class RegisterCommandsTestCase(TestBase):
# platform as logging is host side.
self.platform = ""
if sys.platform.startswith("darwin"):
- self.platform = "" # TODO: add support for "log enable darwin registers"
+ self.platform = "" # TODO: add support for "log enable darwin registers"
if sys.platform.startswith("freebsd"):
self.platform = "freebsd"
@@ -139,7 +153,14 @@ class RegisterCommandsTestCase(TestBase):
if self.platform != "":
self.log_file = os.path.join(os.getcwd(), 'TestRegisters.log')
- self.runCmd("log enable " + self.platform + " " + str(category) + " registers -v -f " + self.log_file, RUN_SUCCEEDED)
+ self.runCmd(
+ "log enable " +
+ self.platform +
+ " " +
+ str(category) +
+ " registers -v -f " +
+ self.log_file,
+ RUN_SUCCEEDED)
if not self.has_teardown:
def remove_log(self):
if os.path.exists(self.log_file):
@@ -147,15 +168,24 @@ class RegisterCommandsTestCase(TestBase):
self.has_teardown = True
self.addTearDownHook(remove_log)
- def write_and_read(self, frame, register, new_value, must_exist = True):
+ def write_and_read(self, frame, register, new_value, must_exist=True):
value = frame.FindValue(register, lldb.eValueTypeRegister)
if must_exist:
- self.assertTrue(value.IsValid(), "finding a value for register " + register)
+ self.assertTrue(
+ value.IsValid(),
+ "finding a value for register " +
+ register)
elif not value.IsValid():
- return # If register doesn't exist, skip this test
+ return # If register doesn't exist, skip this test
self.runCmd("register write " + register + " \'" + new_value + "\'")
- self.expect("register read " + register, substrs = [register + ' = ', new_value])
+ self.expect(
+ "register read " +
+ register,
+ substrs=[
+ register +
+ ' = ',
+ new_value])
def fp_special_purpose_register_read(self):
exe = os.path.join(os.getcwd(), "a.out")
@@ -165,12 +195,14 @@ class RegisterCommandsTestCase(TestBase):
self.assertTrue(target, VALID_TARGET)
# Launch the process and stop.
- self.expect ("run", PROCESS_STOPPED, substrs = ['stopped'])
+ self.expect("run", PROCESS_STOPPED, substrs=['stopped'])
# Check stop reason; Should be either signal SIGTRAP or EXC_BREAKPOINT
output = self.res.GetOutput()
matched = False
- substrs = ['stop reason = EXC_BREAKPOINT', 'stop reason = signal SIGTRAP']
+ substrs = [
+ 'stop reason = EXC_BREAKPOINT',
+ 'stop reason = signal SIGTRAP']
for str1 in substrs:
matched = output.find(str1) != -1
with recording(self, False) as sbuf:
@@ -202,30 +234,39 @@ class RegisterCommandsTestCase(TestBase):
reg_value_ftag_initial = value.GetValueAsUnsigned(error, 0)
self.assertTrue(error.Success(), "reading a value for ftag")
- fstat_top_pointer_initial = (reg_value_fstat_initial & 0x3800)>>11
+ fstat_top_pointer_initial = (reg_value_fstat_initial & 0x3800) >> 11
# Execute 'si' aka 'thread step-inst' instruction 5 times and with
# every execution verify the value of fstat and ftag registers
- for x in range(0,5):
- # step into the next instruction to push a value on 'st' register stack
- self.runCmd ("si", RUN_SUCCEEDED)
+ for x in range(0, 5):
+ # step into the next instruction to push a value on 'st' register
+ # stack
+ self.runCmd("si", RUN_SUCCEEDED)
- # Verify fstat and save it to be used for verification in next execution of 'si' command
+ # Verify fstat and save it to be used for verification in next
+ # execution of 'si' command
if not (reg_value_fstat_initial & 0x3800):
- self.expect("register read fstat",
- substrs = ['fstat' + ' = ', str("0x%0.4x" %((reg_value_fstat_initial & ~(0x3800))| 0x3800))])
- reg_value_fstat_initial = ((reg_value_fstat_initial & ~(0x3800))| 0x3800)
+ self.expect("register read fstat", substrs=[
+ 'fstat' + ' = ', str("0x%0.4x" % ((reg_value_fstat_initial & ~(0x3800)) | 0x3800))])
+ reg_value_fstat_initial = (
+ (reg_value_fstat_initial & ~(0x3800)) | 0x3800)
fstat_top_pointer_initial = 7
- else :
- self.expect("register read fstat",
- substrs = ['fstat' + ' = ', str("0x%0.4x" % (reg_value_fstat_initial - 0x0800))])
+ else:
+ self.expect("register read fstat", substrs=[
+ 'fstat' + ' = ', str("0x%0.4x" % (reg_value_fstat_initial - 0x0800))])
reg_value_fstat_initial = (reg_value_fstat_initial - 0x0800)
fstat_top_pointer_initial -= 1
- # Verify ftag and save it to be used for verification in next execution of 'si' command
- self.expect("register read ftag",
- substrs = ['ftag' + ' = ', str("0x%0.2x" % (reg_value_ftag_initial | (1<< fstat_top_pointer_initial)))])
- reg_value_ftag_initial = reg_value_ftag_initial | (1<< fstat_top_pointer_initial)
+ # Verify ftag and save it to be used for verification in next
+ # execution of 'si' command
+ self.expect(
+ "register read ftag", substrs=[
+ 'ftag' + ' = ', str(
+ "0x%0.2x" %
+ (reg_value_ftag_initial | (
+ 1 << fstat_top_pointer_initial)))])
+ reg_value_ftag_initial = reg_value_ftag_initial | (
+ 1 << fstat_top_pointer_initial)
def fp_register_write(self):
exe = os.path.join(os.getcwd(), "a.out")
@@ -234,13 +275,17 @@ class RegisterCommandsTestCase(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- lldbutil.run_break_set_by_symbol (self, "main", num_expected_locations=-1)
+ lldbutil.run_break_set_by_symbol(
+ self, "main", num_expected_locations=-1)
# Launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
process = target.GetProcess()
- self.assertTrue(process.GetState() == lldb.eStateStopped, PROCESS_STOPPED)
+ self.assertTrue(
+ process.GetState() == lldb.eStateStopped,
+ PROCESS_STOPPED)
thread = process.GetThreadAtIndex(0)
self.assertTrue(thread.IsValid(), "current thread is valid")
@@ -251,12 +296,12 @@ class RegisterCommandsTestCase(TestBase):
if self.getArchitecture() in ['amd64', 'i386', 'x86_64']:
reg_list = [
# reg value must-have
- ("fcw", "0x0000ff0e", False),
- ("fsw", "0x0000ff0e", False),
- ("ftw", "0x0000ff0e", False),
- ("ip", "0x0000ff0e", False),
- ("dp", "0x0000ff0e", False),
- ("mxcsr", "0x0000ff0e", False),
+ ("fcw", "0x0000ff0e", False),
+ ("fsw", "0x0000ff0e", False),
+ ("ftw", "0x0000ff0e", False),
+ ("ip", "0x0000ff0e", False),
+ ("dp", "0x0000ff0e", False),
+ ("mxcsr", "0x0000ff0e", False),
("mxcsrmask", "0x0000ff0e", False),
]
@@ -266,64 +311,104 @@ class RegisterCommandsTestCase(TestBase):
elif currentFrame.FindRegister("stmm0").IsValid():
st0regname = "stmm0"
if st0regname is not None:
- # reg value must-have
- reg_list.append((st0regname, "{0x01 0x02 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00}", True))
- reg_list.append(("xmm0", "{0x01 0x02 0x03 0x00 0x00 0x00 0x00 0x00 0x09 0x0a 0x2f 0x2f 0x2f 0x2f 0x2f 0x2f}", True))
- reg_list.append(("xmm15", "{0x01 0x02 0x03 0x00 0x00 0x00 0x00 0x00 0x09 0x0a 0x2f 0x2f 0x2f 0x2f 0x0e 0x0f}", False))
+ # reg value
+ # must-have
+ reg_list.append(
+ (st0regname, "{0x01 0x02 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00}", True))
+ reg_list.append(
+ ("xmm0",
+ "{0x01 0x02 0x03 0x00 0x00 0x00 0x00 0x00 0x09 0x0a 0x2f 0x2f 0x2f 0x2f 0x2f 0x2f}",
+ True))
+ reg_list.append(
+ ("xmm15",
+ "{0x01 0x02 0x03 0x00 0x00 0x00 0x00 0x00 0x09 0x0a 0x2f 0x2f 0x2f 0x2f 0x0e 0x0f}",
+ False))
elif self.getArchitecture() in ['arm']:
reg_list = [
- # reg value must-have
- ("fpscr", "0xfbf79f9f", True),
- ("s0", "1.25", True),
- ("s31", "0.75", True),
- ("d1", "123", True),
- ("d17", "987", False),
- ("q1", "{0x01 0x02 0x03 0x00 0x00 0x00 0x00 0x00 0x09 0x0a 0x2f 0x2f 0x2f 0x2f 0x2f 0x2f}", True),
- ("q14", "{0x01 0x02 0x03 0x00 0x00 0x00 0x00 0x00 0x09 0x0a 0x2f 0x2f 0x2f 0x2f 0x0e 0x0f}", False),
+ # reg value
+ # must-have
+ ("fpscr", "0xfbf79f9f", True),
+ ("s0", "1.25", True),
+ ("s31", "0.75", True),
+ ("d1", "123", True),
+ ("d17", "987", False),
+ ("q1", "{0x01 0x02 0x03 0x00 0x00 0x00 0x00 0x00 0x09 0x0a 0x2f 0x2f 0x2f 0x2f 0x2f 0x2f}", True),
+ ("q14",
+ "{0x01 0x02 0x03 0x00 0x00 0x00 0x00 0x00 0x09 0x0a 0x2f 0x2f 0x2f 0x2f 0x0e 0x0f}",
+ False),
]
for (reg, val, must) in reg_list:
self.write_and_read(currentFrame, reg, val, must)
if self.getArchitecture() in ['amd64', 'i386', 'x86_64']:
- self.runCmd("register write " + st0regname + " \"{0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}\"")
- self.expect("register read " + st0regname + " --format f", substrs = [st0regname + ' = 0'])
-
- has_avx = False
- registerSets = currentFrame.GetRegisters() # Returns an SBValueList.
+ self.runCmd(
+ "register write " +
+ st0regname +
+ " \"{0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}\"")
+ self.expect(
+ "register read " +
+ st0regname +
+ " --format f",
+ substrs=[
+ st0regname +
+ ' = 0'])
+
+ has_avx = False
+ has_mpx = False
+ # Returns an SBValueList.
+ registerSets = currentFrame.GetRegisters()
for registerSet in registerSets:
if 'advanced vector extensions' in registerSet.GetName().lower():
has_avx = True
- break
+ if 'memory protection extension' in registerSet.GetName().lower():
+ has_mpx = True
if has_avx:
new_value = "{0x01 0x02 0x03 0x00 0x00 0x00 0x00 0x00 0x09 0x0a 0x2f 0x2f 0x2f 0x2f 0x0e 0x0f 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0c 0x0d 0x0e 0x0f}"
self.write_and_read(currentFrame, "ymm0", new_value)
self.write_and_read(currentFrame, "ymm7", new_value)
- self.expect("expr $ymm0", substrs = ['vector_type'])
+ self.expect("expr $ymm0", substrs=['vector_type'])
else:
self.runCmd("register read ymm0")
+ if has_mpx:
+ # Test write and read for bnd0.
+ new_value_w = "{0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10}"
+ self.runCmd("register write bnd0 \'" + new_value_w + "\'")
+ new_value_r = "{0x0807060504030201 0x100f0e0d0c0b0a09}"
+ self.expect("register read bnd0", substrs = ['bnd0 = ', new_value_r])
+ self.expect("expr $bnd0", substrs = ['vector_type'])
+
+ # Test write and for bndstatus.
+ new_value = "{0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08}"
+ self.write_and_read(currentFrame, "bndstatus", new_value)
+ self.expect("expr $bndstatus", substrs = ['vector_type'])
+ else:
+ self.runCmd("register read bnd0")
+
def convenience_registers(self):
"""Test convenience registers."""
self.common_setup()
- # The command "register read -a" does output a derived register like eax...
+ # The command "register read -a" does output a derived register like
+ # eax...
self.expect("register read -a", matching=True,
- substrs = ['eax'])
+ substrs=['eax'])
# ...however, the vanilla "register read" command should not output derived registers like eax.
self.expect("register read", matching=False,
- substrs = ['eax'])
-
+ substrs=['eax'])
+
# Test reading of rax and eax.
self.expect("register read rax eax",
- substrs = ['rax = 0x', 'eax = 0x'])
+ substrs=['rax = 0x', 'eax = 0x'])
- # Now write rax with a unique bit pattern and test that eax indeed represents the lower half of rax.
+ # Now write rax with a unique bit pattern and test that eax indeed
+ # represents the lower half of rax.
self.runCmd("register write rax 0x1234567887654321")
self.expect("register read rax 0x1234567887654321",
- substrs = ['0x1234567887654321'])
+ substrs=['0x1234567887654321'])
def convenience_registers_with_process_attach(self, test_16bit_regs):
"""Test convenience registers after a 'process attach'."""
@@ -343,8 +428,8 @@ class RegisterCommandsTestCase(TestBase):
if self.getArchitecture() in ['amd64', 'x86_64']:
self.expect("expr -- ($rax & 0xffffffff) == $eax",
- substrs = ['true'])
+ substrs=['true'])
if test_16bit_regs:
self.expect("expr -- $ax == (($ah << 8) | $al)",
- substrs = ['true'])
+ substrs=['true'])
diff --git a/packages/Python/lldbsuite/test/functionalities/register/a.cpp b/packages/Python/lldbsuite/test/functionalities/register/register_command/a.cpp
index fbacec1918e8..fbacec1918e8 100644
--- a/packages/Python/lldbsuite/test/functionalities/register/a.cpp
+++ b/packages/Python/lldbsuite/test/functionalities/register/register_command/a.cpp
diff --git a/packages/Python/lldbsuite/test/functionalities/register/main.cpp b/packages/Python/lldbsuite/test/functionalities/register/register_command/main.cpp
index 156515768ddb..156515768ddb 100644
--- a/packages/Python/lldbsuite/test/functionalities/register/main.cpp
+++ b/packages/Python/lldbsuite/test/functionalities/register/register_command/main.cpp
diff --git a/packages/Python/lldbsuite/test/functionalities/rerun/TestRerun.py b/packages/Python/lldbsuite/test/functionalities/rerun/TestRerun.py
index 8636abadd104..20d64b38f0ca 100644
--- a/packages/Python/lldbsuite/test/functionalities/rerun/TestRerun.py
+++ b/packages/Python/lldbsuite/test/functionalities/rerun/TestRerun.py
@@ -4,7 +4,6 @@ Test that argdumper is a viable launching strategy.
from __future__ import print_function
-
import lldb
import os
import time
@@ -12,45 +11,51 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestRerun(TestBase):
mydir = TestBase.compute_mydir(__file__)
- def test (self):
+ def test(self):
self.build()
- exe = os.path.join (os.getcwd(), "a.out")
-
+ exe = os.path.join(os.getcwd(), "a.out")
+
self.runCmd("target create %s" % exe)
-
+
# Create the target
target = self.dbg.CreateTarget(exe)
-
+
# Create any breakpoints we need
- breakpoint = target.BreakpointCreateBySourceRegex ('break here', lldb.SBFileSpec ("main.cpp", False))
+ breakpoint = target.BreakpointCreateBySourceRegex(
+ 'break here', lldb.SBFileSpec("main.cpp", False))
self.assertTrue(breakpoint, VALID_BREAKPOINT)
self.runCmd("process launch 1 2 3")
process = self.process()
- thread = lldbutil.get_one_thread_stopped_at_breakpoint(process, breakpoint)
- self.assertIsNotNone(thread, "Process should be stopped at a breakpoint in main")
+ thread = lldbutil.get_one_thread_stopped_at_breakpoint(
+ process, breakpoint)
+ self.assertIsNotNone(
+ thread, "Process should be stopped at a breakpoint in main")
self.assertTrue(thread.IsValid(), "Stopped thread is not valid")
self.expect("frame variable argv[1]", substrs=['1'])
self.expect("frame variable argv[2]", substrs=['2'])
self.expect("frame variable argv[3]", substrs=['3'])
-
+
# Let program exit
self.runCmd("continue")
-
+
# Re-run with no args and make sure we still run with 1 2 3 as arguments as
# they should have been stored in "target.run-args"
self.runCmd("process launch")
process = self.process()
- thread = lldbutil.get_one_thread_stopped_at_breakpoint(process, breakpoint)
+ thread = lldbutil.get_one_thread_stopped_at_breakpoint(
+ process, breakpoint)
- self.assertIsNotNone(thread, "Process should be stopped at a breakpoint in main");
+ self.assertIsNotNone(
+ thread, "Process should be stopped at a breakpoint in main")
self.assertTrue(thread.IsValid(), "Stopped thread is not valid")
self.expect("frame variable argv[1]", substrs=['1'])
diff --git a/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py b/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py
index 81d93294b5a5..778c098a38ee 100644
--- a/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py
+++ b/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py
@@ -5,21 +5,34 @@ Test getting return-values correctly when stepping out
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ReturnValueTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @expectedFailureAll(oslist=["macosx","freebsd"], archs=["i386"])
- @expectedFailureAll(oslist=["linux"], compiler="clang", compiler_version=["<=", "3.6"], archs=["i386"])
- @expectedFailureAll(bugnumber="llvm.org/pr25785", hostoslist=["windows"], compiler="gcc", archs=["i386"], triple='.*-android')
+ @expectedFailureAll(oslist=["freebsd"], archs=["i386"])
+ @expectedFailureAll(oslist=["macosx"], archs=["i386"], bugnumber="<rdar://problem/28719652>")
+ @expectedFailureAll(
+ oslist=["linux"],
+ compiler="clang",
+ compiler_version=[
+ "<=",
+ "3.6"],
+ archs=["i386"])
+ @expectedFailureAll(
+ bugnumber="llvm.org/pr25785",
+ hostoslist=["windows"],
+ compiler="gcc",
+ archs=["i386"],
+ triple='.*-android')
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")
@add_test_categories(['pyapi'])
def test_with_python(self):
@@ -35,7 +48,8 @@ class ReturnValueTestCase(TestBase):
self.assertTrue(inner_sint_bkpt, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- self.process = self.target.LaunchSimple (None, None, self.get_process_working_directory())
+ self.process = self.target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(self.process, PROCESS_IS_VALID)
@@ -44,168 +58,178 @@ class ReturnValueTestCase(TestBase):
STOPPED_DUE_TO_BREAKPOINT)
# Now finish, and make sure the return value is correct.
- thread = lldbutil.get_stopped_thread (self.process, lldb.eStopReasonBreakpoint)
+ thread = lldbutil.get_stopped_thread(
+ self.process, lldb.eStopReasonBreakpoint)
# inner_sint returns the variable value, so capture that here:
- in_int = thread.GetFrameAtIndex(0).FindVariable ("value").GetValueAsSigned(error)
- self.assertTrue (error.Success())
+ in_int = thread.GetFrameAtIndex(0).FindVariable(
+ "value").GetValueAsSigned(error)
+ self.assertTrue(error.Success())
- thread.StepOut();
+ thread.StepOut()
- self.assertTrue (self.process.GetState() == lldb.eStateStopped)
- self.assertTrue (thread.GetStopReason() == lldb.eStopReasonPlanComplete)
+ self.assertTrue(self.process.GetState() == lldb.eStateStopped)
+ self.assertTrue(thread.GetStopReason() == lldb.eStopReasonPlanComplete)
frame = thread.GetFrameAtIndex(0)
fun_name = frame.GetFunctionName()
- self.assertTrue (fun_name == "outer_sint")
+ self.assertTrue(fun_name == "outer_sint")
return_value = thread.GetStopReturnValue()
- self.assertTrue (return_value.IsValid())
+ self.assertTrue(return_value.IsValid())
ret_int = return_value.GetValueAsSigned(error)
- self.assertTrue (error.Success())
- self.assertTrue (in_int == ret_int)
+ self.assertTrue(error.Success())
+ self.assertTrue(in_int == ret_int)
- # Run again and we will stop in inner_sint the second time outer_sint is called.
- #Then test stepping out two frames at once:
+ # Run again and we will stop in inner_sint the second time outer_sint is called.
+ # Then test stepping out two frames at once:
self.process.Continue()
- thread_list = lldbutil.get_threads_stopped_at_breakpoint (self.process, inner_sint_bkpt)
+ thread_list = lldbutil.get_threads_stopped_at_breakpoint(
+ self.process, inner_sint_bkpt)
self.assertTrue(len(thread_list) == 1)
thread = thread_list[0]
# We are done with the inner_sint breakpoint:
- self.target.BreakpointDelete (inner_sint_bkpt.GetID())
+ self.target.BreakpointDelete(inner_sint_bkpt.GetID())
frame = thread.GetFrameAtIndex(1)
- fun_name = frame.GetFunctionName ()
- self.assertTrue (fun_name == "outer_sint")
- in_int = frame.FindVariable ("value").GetValueAsSigned(error)
- self.assertTrue (error.Success())
+ fun_name = frame.GetFunctionName()
+ self.assertTrue(fun_name == "outer_sint")
+ in_int = frame.FindVariable("value").GetValueAsSigned(error)
+ self.assertTrue(error.Success())
- thread.StepOutOfFrame (frame)
+ thread.StepOutOfFrame(frame)
- self.assertTrue (self.process.GetState() == lldb.eStateStopped)
- self.assertTrue (thread.GetStopReason() == lldb.eStopReasonPlanComplete)
+ self.assertTrue(self.process.GetState() == lldb.eStateStopped)
+ self.assertTrue(thread.GetStopReason() == lldb.eStopReasonPlanComplete)
frame = thread.GetFrameAtIndex(0)
fun_name = frame.GetFunctionName()
- self.assertTrue (fun_name == "main")
+ self.assertTrue(fun_name == "main")
ret_value = thread.GetStopReturnValue()
- self.assertTrue (return_value.IsValid())
- ret_int = ret_value.GetValueAsSigned (error)
- self.assertTrue (error.Success())
- self.assertTrue (2 * in_int == ret_int)
-
+ self.assertTrue(return_value.IsValid())
+ ret_int = ret_value.GetValueAsSigned(error)
+ self.assertTrue(error.Success())
+ self.assertTrue(2 * in_int == ret_int)
+
# Now try some simple returns that have different types:
- inner_float_bkpt = self.target.BreakpointCreateByName("inner_float", exe)
+ inner_float_bkpt = self.target.BreakpointCreateByName(
+ "inner_float", exe)
self.assertTrue(inner_float_bkpt, VALID_BREAKPOINT)
self.process.Continue()
- thread_list = lldbutil.get_threads_stopped_at_breakpoint (self.process, inner_float_bkpt)
- self.assertTrue (len(thread_list) == 1)
+ thread_list = lldbutil.get_threads_stopped_at_breakpoint(
+ self.process, inner_float_bkpt)
+ self.assertTrue(len(thread_list) == 1)
thread = thread_list[0]
- self.target.BreakpointDelete (inner_float_bkpt.GetID())
+ self.target.BreakpointDelete(inner_float_bkpt.GetID())
frame = thread.GetFrameAtIndex(0)
- in_value = frame.FindVariable ("value")
- in_float = float (in_value.GetValue())
+ in_value = frame.FindVariable("value")
+ in_float = float(in_value.GetValue())
thread.StepOut()
- self.assertTrue (self.process.GetState() == lldb.eStateStopped)
- self.assertTrue (thread.GetStopReason() == lldb.eStopReasonPlanComplete)
+ self.assertTrue(self.process.GetState() == lldb.eStateStopped)
+ self.assertTrue(thread.GetStopReason() == lldb.eStopReasonPlanComplete)
frame = thread.GetFrameAtIndex(0)
fun_name = frame.GetFunctionName()
- self.assertTrue (fun_name == "outer_float")
-
- return_value = thread.GetStopReturnValue()
- self.assertTrue (return_value.IsValid())
- return_float = float (return_value.GetValue())
-
- self.assertTrue(in_float == return_float)
-
- self.return_and_test_struct_value ("return_one_int")
- self.return_and_test_struct_value ("return_two_int")
- self.return_and_test_struct_value ("return_three_int")
- self.return_and_test_struct_value ("return_four_int")
- self.return_and_test_struct_value ("return_five_int")
-
- self.return_and_test_struct_value ("return_two_double")
- self.return_and_test_struct_value ("return_one_double_two_float")
- self.return_and_test_struct_value ("return_one_int_one_float_one_int")
-
- self.return_and_test_struct_value ("return_one_pointer")
- self.return_and_test_struct_value ("return_two_pointer")
- self.return_and_test_struct_value ("return_one_float_one_pointer")
- self.return_and_test_struct_value ("return_one_int_one_pointer")
- self.return_and_test_struct_value ("return_three_short_one_float")
-
- self.return_and_test_struct_value ("return_one_int_one_double")
- self.return_and_test_struct_value ("return_one_int_one_double_one_int")
- self.return_and_test_struct_value ("return_one_short_one_double_one_short")
- self.return_and_test_struct_value ("return_one_float_one_int_one_float")
- self.return_and_test_struct_value ("return_two_float")
- # I am leaving out the packed test until we have a way to tell CLANG
+ self.assertTrue(fun_name == "outer_float")
+
+ #return_value = thread.GetStopReturnValue()
+ #self.assertTrue(return_value.IsValid())
+ #return_float = float(return_value.GetValue())
+
+ #self.assertTrue(in_float == return_float)
+
+ self.return_and_test_struct_value("return_one_int")
+ self.return_and_test_struct_value("return_two_int")
+ self.return_and_test_struct_value("return_three_int")
+ self.return_and_test_struct_value("return_four_int")
+ self.return_and_test_struct_value("return_five_int")
+
+ self.return_and_test_struct_value("return_two_double")
+ self.return_and_test_struct_value("return_one_double_two_float")
+ self.return_and_test_struct_value("return_one_int_one_float_one_int")
+
+ self.return_and_test_struct_value("return_one_pointer")
+ self.return_and_test_struct_value("return_two_pointer")
+ self.return_and_test_struct_value("return_one_float_one_pointer")
+ self.return_and_test_struct_value("return_one_int_one_pointer")
+ self.return_and_test_struct_value("return_three_short_one_float")
+
+ self.return_and_test_struct_value("return_one_int_one_double")
+ self.return_and_test_struct_value("return_one_int_one_double_one_int")
+ self.return_and_test_struct_value(
+ "return_one_short_one_double_one_short")
+ self.return_and_test_struct_value("return_one_float_one_int_one_float")
+ self.return_and_test_struct_value("return_two_float")
+ # I am leaving out the packed test until we have a way to tell CLANG
# about alignment when reading DWARF for packed types.
#self.return_and_test_struct_value ("return_one_int_one_double_packed")
- self.return_and_test_struct_value ("return_one_int_one_long")
+ self.return_and_test_struct_value("return_one_int_one_long")
# icc and gcc don't support this extension.
if self.getCompiler().endswith('clang'):
- self.return_and_test_struct_value ("return_vector_size_float32_8")
- self.return_and_test_struct_value ("return_vector_size_float32_16")
- self.return_and_test_struct_value ("return_vector_size_float32_32")
- self.return_and_test_struct_value ("return_ext_vector_size_float32_2")
- self.return_and_test_struct_value ("return_ext_vector_size_float32_4")
- self.return_and_test_struct_value ("return_ext_vector_size_float32_8")
-
- def return_and_test_struct_value (self, func_name):
+ self.return_and_test_struct_value("return_vector_size_float32_8")
+ self.return_and_test_struct_value("return_vector_size_float32_16")
+ self.return_and_test_struct_value("return_vector_size_float32_32")
+ self.return_and_test_struct_value(
+ "return_ext_vector_size_float32_2")
+ self.return_and_test_struct_value(
+ "return_ext_vector_size_float32_4")
+ self.return_and_test_struct_value(
+ "return_ext_vector_size_float32_8")
+
+ def return_and_test_struct_value(self, func_name):
"""Pass in the name of the function to return from - takes in value, returns value."""
-
+
# Set the breakpoint, run to it, finish out.
- bkpt = self.target.BreakpointCreateByName (func_name)
- self.assertTrue (bkpt.GetNumResolvedLocations() > 0)
+ bkpt = self.target.BreakpointCreateByName(func_name)
+ self.assertTrue(bkpt.GetNumResolvedLocations() > 0)
- self.process.Continue ()
+ self.process.Continue()
- thread_list = lldbutil.get_threads_stopped_at_breakpoint (self.process, bkpt)
+ thread_list = lldbutil.get_threads_stopped_at_breakpoint(
+ self.process, bkpt)
- self.assertTrue (len(thread_list) == 1)
+ self.assertTrue(len(thread_list) == 1)
thread = thread_list[0]
- self.target.BreakpointDelete (bkpt.GetID())
+ self.target.BreakpointDelete(bkpt.GetID())
+
+ in_value = thread.GetFrameAtIndex(0).FindVariable("value")
- in_value = thread.GetFrameAtIndex(0).FindVariable ("value")
-
- self.assertTrue (in_value.IsValid())
+ self.assertTrue(in_value.IsValid())
num_in_children = in_value.GetNumChildren()
# This is a little hokey, but if we don't get all the children now, then
# once we've stepped we won't be able to get them?
-
+
for idx in range(0, num_in_children):
- in_child = in_value.GetChildAtIndex (idx)
+ in_child = in_value.GetChildAtIndex(idx)
in_child_str = in_child.GetValue()
thread.StepOut()
-
- self.assertTrue (self.process.GetState() == lldb.eStateStopped)
- self.assertTrue (thread.GetStopReason() == lldb.eStopReasonPlanComplete)
+
+ self.assertTrue(self.process.GetState() == lldb.eStateStopped)
+ self.assertTrue(thread.GetStopReason() == lldb.eStopReasonPlanComplete)
# Assuming all these functions step out to main. Could figure out the caller dynamically
# if that would add something to the test.
frame = thread.GetFrameAtIndex(0)
fun_name = frame.GetFunctionName()
- self.assertTrue (fun_name == "main")
+ self.assertTrue(fun_name == "main")
frame = thread.GetFrameAtIndex(0)
ret_value = thread.GetStopReturnValue()
- self.assertTrue (ret_value.IsValid())
+ self.assertTrue(ret_value.IsValid())
num_ret_children = ret_value.GetNumChildren()
- self.assertTrue (num_in_children == num_ret_children)
+ self.assertTrue(num_in_children == num_ret_children)
for idx in range(0, num_ret_children):
in_child = in_value.GetChildAtIndex(idx)
ret_child = ret_value.GetChildAtIndex(idx)
diff --git a/packages/Python/lldbsuite/test/functionalities/set-data/TestSetData.py b/packages/Python/lldbsuite/test/functionalities/set-data/TestSetData.py
index 294aa6725155..2fc31a4e78ae 100644
--- a/packages/Python/lldbsuite/test/functionalities/set-data/TestSetData.py
+++ b/packages/Python/lldbsuite/test/functionalities/set-data/TestSetData.py
@@ -5,13 +5,14 @@ Set the contents of variables and registers using raw data
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class SetDataTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -23,41 +24,48 @@ class SetDataTestCase(TestBase):
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- self.runCmd("br s -p First");
- self.runCmd("br s -p Second");
+ self.runCmd("br s -p First")
+ self.runCmd("br s -p Second")
self.runCmd("run", RUN_SUCCEEDED)
self.expect("p myFoo.x", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['2'])
+ substrs=['2'])
process = self.dbg.GetSelectedTarget().GetProcess()
frame = process.GetSelectedThread().GetFrameAtIndex(0)
x = frame.FindVariable("myFoo").GetChildMemberWithName("x")
- my_data = lldb.SBData.CreateDataFromSInt32Array(lldb.eByteOrderLittle, 8, [4])
+ my_data = lldb.SBData.CreateDataFromSInt32Array(
+ lldb.eByteOrderLittle, 8, [4])
err = lldb.SBError()
- self.assertTrue (x.SetData(my_data, err))
+ self.assertTrue(x.SetData(my_data, err))
self.runCmd("continue")
self.expect("p myFoo.x", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['4'])
+ substrs=['4'])
frame = process.GetSelectedThread().GetFrameAtIndex(0)
x = frame.FindVariable("string")
if process.GetAddressByteSize() == 8:
- my_data = lldb.SBData.CreateDataFromUInt64Array(process.GetByteOrder(), 8, [0])
+ my_data = lldb.SBData.CreateDataFromUInt64Array(
+ process.GetByteOrder(), 8, [0])
else:
- my_data = lldb.SBData.CreateDataFromUInt32Array(process.GetByteOrder(), 4, [0])
-
+ my_data = lldb.SBData.CreateDataFromUInt32Array(
+ process.GetByteOrder(), 4, [0])
+
err = lldb.SBError()
- self.assertTrue (x.SetData(my_data, err))
+ self.assertTrue(x.SetData(my_data, err))
- self.expect("fr var -d run-target string", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['NSString *', 'nil'])
+ self.expect(
+ "fr var -d run-target string",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ 'NSString *',
+ 'nil'])
diff --git a/packages/Python/lldbsuite/test/functionalities/signal/TestSendSignal.py b/packages/Python/lldbsuite/test/functionalities/signal/TestSendSignal.py
index 1da4d701a590..0a2756d87fbe 100644
--- a/packages/Python/lldbsuite/test/functionalities/signal/TestSendSignal.py
+++ b/packages/Python/lldbsuite/test/functionalities/signal/TestSendSignal.py
@@ -3,8 +3,9 @@
from __future__ import print_function
-
-import os, time, signal
+import os
+import time
+import signal
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
@@ -21,8 +22,10 @@ class SendSignalTestCase(TestBase):
# Find the line number to break inside main().
self.line = line_number('main.c', 'Put breakpoint here')
- @expectedFailureAll(oslist=['freebsd'], bugnumber="llvm.org/pr23318: does not report running state")
- @skipIfWindows # Windows does not support signals
+ @expectedFailureAll(
+ oslist=['freebsd'],
+ bugnumber="llvm.org/pr23318: does not report running state")
+ @skipIfWindows # Windows does not support signals
def test_with_run_command(self):
"""Test that lldb command 'process signal SIGUSR1' sends a signal to the inferior process."""
self.build()
@@ -57,14 +60,17 @@ class SendSignalTestCase(TestBase):
self.runCmd("process handle -n False -p True -s True SIGUSR1")
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
self.assertTrue(thread.IsValid(), "We hit the first breakpoint.")
# After resuming the process, send it a SIGUSR1 signal.
self.setAsync(True)
- self.assertTrue(process_listener.IsValid(), "Got a good process listener")
+ self.assertTrue(
+ process_listener.IsValid(),
+ "Got a good process listener")
# Disable our breakpoint, we don't want to hit it anymore...
breakpoint.SetEnabled(False)
@@ -88,9 +94,12 @@ class SendSignalTestCase(TestBase):
self.assertTrue(len(threads) == 1, "One thread stopped for a signal.")
thread = threads[0]
- self.assertTrue(thread.GetStopReasonDataCount() >= 1, "There was data in the event.")
- self.assertTrue(thread.GetStopReasonDataAtIndex(0) == lldbutil.get_signal_number('SIGUSR1'),
- "The stop signal was SIGUSR1")
+ self.assertTrue(
+ thread.GetStopReasonDataCount() >= 1,
+ "There was data in the event.")
+ self.assertTrue(
+ thread.GetStopReasonDataAtIndex(0) == lldbutil.get_signal_number('SIGUSR1'),
+ "The stop signal was SIGUSR1")
def match_state(self, process_listener, expected_state):
num_seconds = 5
diff --git a/packages/Python/lldbsuite/test/functionalities/signal/handle-segv/TestHandleSegv.py b/packages/Python/lldbsuite/test/functionalities/signal/handle-segv/TestHandleSegv.py
index d8dbb7f68936..16681fdbcdef 100644
--- a/packages/Python/lldbsuite/test/functionalities/signal/handle-segv/TestHandleSegv.py
+++ b/packages/Python/lldbsuite/test/functionalities/signal/handle-segv/TestHandleSegv.py
@@ -3,7 +3,6 @@
from __future__ import print_function
-
import os
import re
@@ -17,9 +16,11 @@ class HandleSegvTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @skipIfWindows # signals do not exist on Windows
+ @skipIfWindows # signals do not exist on Windows
@skipIfDarwin
- @expectedFailureAll(oslist=['freebsd'], bugnumber="llvm.org/pr23699 SIGSEGV is reported as exception, not signal")
+ @expectedFailureAll(
+ oslist=['freebsd'],
+ bugnumber="llvm.org/pr23699 SIGSEGV is reported as exception, not signal")
def test_inferior_handle_sigsegv(self):
self.build()
exe = os.path.join(os.getcwd(), "a.out")
@@ -29,15 +30,21 @@ class HandleSegvTestCase(TestBase):
self.assertTrue(target, VALID_TARGET)
# launch
- process = target.LaunchSimple(None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
self.assertEqual(process.GetState(), lldb.eStateStopped)
signo = process.GetUnixSignals().GetSignalNumberFromName("SIGSEGV")
thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonSignal)
- self.assertTrue(thread and thread.IsValid(), "Thread should be stopped due to a signal")
- self.assertTrue(thread.GetStopReasonDataCount() >= 1, "There was data in the event.")
- self.assertEqual(thread.GetStopReasonDataAtIndex(0), signo, "The stop signal was SIGSEGV")
+ self.assertTrue(
+ thread and thread.IsValid(),
+ "Thread should be stopped due to a signal")
+ self.assertTrue(
+ thread.GetStopReasonDataCount() >= 1,
+ "There was data in the event.")
+ self.assertEqual(thread.GetStopReasonDataAtIndex(0),
+ signo, "The stop signal was SIGSEGV")
# Continue until we exit.
process.Continue()
diff --git a/packages/Python/lldbsuite/test/functionalities/signal/raise/TestRaise.py b/packages/Python/lldbsuite/test/functionalities/signal/raise/TestRaise.py
index 2c30f69d7b20..efadea51f669 100644
--- a/packages/Python/lldbsuite/test/functionalities/signal/raise/TestRaise.py
+++ b/packages/Python/lldbsuite/test/functionalities/signal/raise/TestRaise.py
@@ -3,7 +3,6 @@
from __future__ import print_function
-
import os
import lldb
import re
@@ -13,7 +12,7 @@ from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
-@skipIfWindows # signals do not exist on Windows
+@skipIfWindows # signals do not exist on Windows
class RaiseTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -21,9 +20,10 @@ class RaiseTestCase(TestBase):
def test_sigstop(self):
self.build()
self.signal_test('SIGSTOP', False)
- # passing of SIGSTOP is not correctly handled, so not testing that scenario: https://llvm.org/bugs/show_bug.cgi?id=23574
+ # passing of SIGSTOP is not correctly handled, so not testing that
+ # scenario: https://llvm.org/bugs/show_bug.cgi?id=23574
- @skipIfDarwin # darwin does not support real time signals
+ @skipIfDarwin # darwin does not support real time signals
@skipIfTargetAndroid()
def test_sigsigrtmin(self):
self.build()
@@ -31,20 +31,25 @@ class RaiseTestCase(TestBase):
def launch(self, target, signal):
# launch the process, do not stop at entry point.
- process = target.LaunchSimple([signal], None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ [signal], None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
self.assertEqual(process.GetState(), lldb.eStateStopped)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "Thread should be stopped due to a breakpoint")
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ thread.IsValid(),
+ "Thread should be stopped due to a breakpoint")
return process
def set_handle(self, signal, pass_signal, stop_at_signal, notify_signal):
return_obj = lldb.SBCommandReturnObject()
self.dbg.GetCommandInterpreter().HandleCommand(
- "process handle %s -p %s -s %s -n %s" % (signal, pass_signal, stop_at_signal, notify_signal),
- return_obj)
- self.assertTrue (return_obj.Succeeded() == True, "Setting signal handling failed")
-
+ "process handle %s -p %s -s %s -n %s" %
+ (signal, pass_signal, stop_at_signal, notify_signal), return_obj)
+ self.assertTrue(
+ return_obj.Succeeded(),
+ "Setting signal handling failed")
def signal_test(self, signal, test_passing):
"""Test that we handle inferior raising signals"""
@@ -61,9 +66,12 @@ class RaiseTestCase(TestBase):
# retrieve default signal disposition
return_obj = lldb.SBCommandReturnObject()
- self.dbg.GetCommandInterpreter().HandleCommand("process handle %s " % signal, return_obj)
- match = re.match('NAME *PASS *STOP *NOTIFY.*(false|true) *(false|true) *(false|true)',
- return_obj.GetOutput(), re.IGNORECASE | re.DOTALL)
+ self.dbg.GetCommandInterpreter().HandleCommand(
+ "process handle %s " % signal, return_obj)
+ match = re.match(
+ 'NAME *PASS *STOP *NOTIFY.*(false|true) *(false|true) *(false|true)',
+ return_obj.GetOutput(),
+ re.IGNORECASE | re.DOTALL)
if not match:
self.fail('Unable to retrieve default signal disposition.')
default_pass = match.group(1)
@@ -75,10 +83,14 @@ class RaiseTestCase(TestBase):
process.Continue()
self.assertEqual(process.GetState(), lldb.eStateStopped)
thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonSignal)
- self.assertTrue(thread.IsValid(), "Thread should be stopped due to a signal")
- self.assertTrue(thread.GetStopReasonDataCount() >= 1, "There was data in the event.")
+ self.assertTrue(
+ thread.IsValid(),
+ "Thread should be stopped due to a signal")
+ self.assertTrue(
+ thread.GetStopReasonDataCount() >= 1,
+ "There was data in the event.")
self.assertEqual(thread.GetStopReasonDataAtIndex(0), signo,
- "The stop signal was %s" % signal)
+ "The stop signal was %s" % signal)
# Continue until we exit.
process.Continue()
@@ -88,18 +100,27 @@ class RaiseTestCase(TestBase):
# launch again
process = self.launch(target, signal)
- # Make sure we do not stop at the signal. We should still get the notification.
+ # Make sure we do not stop at the signal. We should still get the
+ # notification.
self.set_handle(signal, "false", "false", "true")
- self.expect("process continue", substrs=["stopped and restarted", signal])
+ self.expect(
+ "process continue",
+ substrs=[
+ "stopped and restarted",
+ signal])
self.assertEqual(process.GetState(), lldb.eStateExited)
self.assertEqual(process.GetExitStatus(), 0)
# launch again
process = self.launch(target, signal)
- # Make sure we do not stop at the signal, and we do not get the notification.
+ # Make sure we do not stop at the signal, and we do not get the
+ # notification.
self.set_handle(signal, "false", "false", "false")
- self.expect("process continue", substrs=["stopped and restarted"], matching=False)
+ self.expect(
+ "process continue",
+ substrs=["stopped and restarted"],
+ matching=False)
self.assertEqual(process.GetState(), lldb.eStateExited)
self.assertEqual(process.GetExitStatus(), 0)
@@ -116,11 +137,17 @@ class RaiseTestCase(TestBase):
process.Continue()
self.assertEqual(process.GetState(), lldb.eStateStopped)
thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonSignal)
- self.assertTrue(thread.IsValid(), "Thread should be stopped due to a signal")
- self.assertTrue(thread.GetStopReasonDataCount() >= 1, "There was data in the event.")
- self.assertEqual(thread.GetStopReasonDataAtIndex(0),
- process.GetUnixSignals().GetSignalNumberFromName(signal),
- "The stop signal was %s" % signal)
+ self.assertTrue(
+ thread.IsValid(),
+ "Thread should be stopped due to a signal")
+ self.assertTrue(
+ thread.GetStopReasonDataCount() >= 1,
+ "There was data in the event.")
+ self.assertEqual(
+ thread.GetStopReasonDataAtIndex(0),
+ process.GetUnixSignals().GetSignalNumberFromName(signal),
+ "The stop signal was %s" %
+ signal)
# Continue until we exit. The process should receive the signal.
process.Continue()
@@ -133,7 +160,11 @@ class RaiseTestCase(TestBase):
# Make sure we do not stop at the signal. We should still get the notification. Process
# should receive the signal.
self.set_handle(signal, "true", "false", "true")
- self.expect("process continue", substrs=["stopped and restarted", signal])
+ self.expect(
+ "process continue",
+ substrs=[
+ "stopped and restarted",
+ signal])
self.assertEqual(process.GetState(), lldb.eStateExited)
self.assertEqual(process.GetExitStatus(), signo)
@@ -143,14 +174,20 @@ class RaiseTestCase(TestBase):
# Make sure we do not stop at the signal, and we do not get the notification. Process
# should receive the signal.
self.set_handle(signal, "true", "false", "false")
- self.expect("process continue", substrs=["stopped and restarted"], matching=False)
+ self.expect(
+ "process continue",
+ substrs=["stopped and restarted"],
+ matching=False)
self.assertEqual(process.GetState(), lldb.eStateExited)
self.assertEqual(process.GetExitStatus(), signo)
# reset signal handling to default
self.set_handle(signal, default_pass, default_stop, default_notify)
- @expectedFailureAll(oslist=["linux"]+getDarwinOSTriples(), bugnumber="llvm.org/pr20231")
+ @expectedFailureAll(
+ oslist=["linux"] +
+ getDarwinOSTriples(),
+ bugnumber="llvm.org/pr20231")
def test_restart_bug(self):
"""Test that we catch a signal in the edge case where the process receives it while we are
about to interrupt it"""
@@ -167,16 +204,16 @@ class RaiseTestCase(TestBase):
self.dbg.SetAsync(True)
error = lldb.SBError()
listener = lldb.SBListener("my listener")
- process = target.Launch (listener,
- ["SIGSTOP"], # argv
- None, # envp
- None, # stdin_path
- None, # stdout_path
- None, # stderr_path
- None, # working directory
- 0, # launch flags
- False, # Stop at entry
- error) # error
+ process = target.Launch(listener,
+ ["SIGSTOP"], # argv
+ None, # envp
+ None, # stdin_path
+ None, # stdout_path
+ None, # stderr_path
+ None, # working directory
+ 0, # launch flags
+ False, # Stop at entry
+ error) # error
self.assertTrue(process and process.IsValid(), PROCESS_IS_VALID)
@@ -187,12 +224,18 @@ class RaiseTestCase(TestBase):
# The last WaitForEvent call will time out after 2 seconds.
while listener.WaitForEvent(2, event):
if self.TraceOn():
- print("Process changing state to:", self.dbg.StateAsCString(process.GetStateFromEvent(event)))
+ print(
+ "Process changing state to:",
+ self.dbg.StateAsCString(
+ process.GetStateFromEvent(event)))
# now the process should be stopped
- self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED)
- self.assertEqual(len(lldbutil.get_threads_stopped_at_breakpoint(process, bkpt)), 1,
- "A thread should be stopped at breakpoint")
+ self.assertEqual(
+ process.GetState(),
+ lldb.eStateStopped,
+ PROCESS_STOPPED)
+ self.assertEqual(len(lldbutil.get_threads_stopped_at_breakpoint(
+ process, bkpt)), 1, "A thread should be stopped at breakpoint")
# Remove all breakpoints. This makes sure we don't have to single-step over them when we
# resume the process below
@@ -200,23 +243,32 @@ class RaiseTestCase(TestBase):
# resume the process and immediately try to set another breakpoint. When using the remote
# stub, this will trigger a request to stop the process just as it is about to stop
- # naturally due to a SIGSTOP signal it raises. Make sure we do not lose this signal.
+ # naturally due to a SIGSTOP signal it raises. Make sure we do not lose
+ # this signal.
process.Continue()
- self.assertTrue(target.BreakpointCreateByName("handler").IsValid(), VALID_BREAKPOINT)
+ self.assertTrue(target.BreakpointCreateByName(
+ "handler").IsValid(), VALID_BREAKPOINT)
# Clear the events again
while listener.WaitForEvent(2, event):
if self.TraceOn():
- print("Process changing state to:", self.dbg.StateAsCString(process.GetStateFromEvent(event)))
+ print(
+ "Process changing state to:",
+ self.dbg.StateAsCString(
+ process.GetStateFromEvent(event)))
# The process should be stopped due to a signal
self.assertEqual(process.GetState(), lldb.eStateStopped)
thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonSignal)
- self.assertTrue(thread.IsValid(), "Thread should be stopped due to a signal")
- self.assertTrue(thread.GetStopReasonDataCount() >= 1, "There was data in the event.")
+ self.assertTrue(
+ thread.IsValid(),
+ "Thread should be stopped due to a signal")
+ self.assertTrue(
+ thread.GetStopReasonDataCount() >= 1,
+ "There was data in the event.")
signo = process.GetUnixSignals().GetSignalNumberFromName("SIGSTOP")
self.assertEqual(thread.GetStopReasonDataAtIndex(0), signo,
- "The stop signal was %s" % signal)
+ "The stop signal was %s" % signal)
# We are done
process.Kill()
diff --git a/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py b/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py
index 6f5882636cb6..ad08c6a9e952 100644
--- a/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py
+++ b/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py
@@ -5,13 +5,13 @@ Test the lldb command line takes a filename with single quote chars.
from __future__ import print_function
-
import os
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class SingleQuoteInCommandLineTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -27,7 +27,9 @@ class SingleQuoteInCommandLineTestCase(TestBase):
except:
pass
- @expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
+ @expectedFailureAll(
+ hostoslist=["windows"],
+ bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
@no_debug_info_test
def test_lldb_invocation_with_single_quote_in_filename(self):
"""Test that 'lldb my_file_name' works where my_file_name is a string with a single quote char in it."""
@@ -39,7 +41,9 @@ class SingleQuoteInCommandLineTestCase(TestBase):
prompt = "(lldb) "
# So that the child gets torn down after the test.
- self.child = pexpect.spawn('%s %s "%s"' % (lldbtest_config.lldbExec, self.lldbOption, self.myexe))
+ self.child = pexpect.spawn(
+ '%s %s "%s"' %
+ (lldbtest_config.lldbExec, self.lldbOption, self.myexe))
child = self.child
child.setecho(True)
# Turn on logging for input/output to/from the child.
@@ -58,7 +62,7 @@ class SingleQuoteInCommandLineTestCase(TestBase):
# stop further logging.
child.logfile_send = None
child.logfile_read = None
-
+
with open('child_send.txt', 'r') as fs:
if self.TraceOn():
print("\n\nContents of child_send.txt:")
@@ -70,4 +74,4 @@ class SingleQuoteInCommandLineTestCase(TestBase):
print(from_child)
self.expect(from_child, exe=False,
- substrs = ["Current executable set to"])
+ substrs=["Current executable set to"])
diff --git a/packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/TestStepNoDebug.py b/packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/TestStepNoDebug.py
index 8b9c91217de4..b0b2e609ba6b 100644
--- a/packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/TestStepNoDebug.py
+++ b/packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/TestStepNoDebug.py
@@ -5,7 +5,6 @@ Test thread step-in, step-over and step-out work with the "Avoid no debug" optio
from __future__ import print_function
-
import os
import re
import sys
@@ -15,6 +14,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ReturnValueTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -27,8 +27,15 @@ class ReturnValueTestCase(TestBase):
self.do_step_out_past_nodebug()
@add_test_categories(['pyapi'])
- @decorators.expectedFailureAll(compiler="gcc", bugnumber="llvm.org/pr28549")
- @decorators.expectedFailureAll(compiler="clang", compiler_version=[">=", "3.9"], archs=["i386"], bugnumber="llvm.org/pr28549")
+ @decorators.expectedFailureAll(
+ compiler="gcc", bugnumber="llvm.org/pr28549")
+ @decorators.expectedFailureAll(
+ compiler="clang",
+ compiler_version=[
+ ">=",
+ "3.9"],
+ archs=["i386"],
+ bugnumber="llvm.org/pr28549")
def test_step_over_with_python(self):
"""Test stepping over using avoid-no-debug with dwarf."""
self.build()
@@ -36,82 +43,111 @@ class ReturnValueTestCase(TestBase):
self.do_step_over_past_nodebug()
@add_test_categories(['pyapi'])
- @decorators.expectedFailureAll(compiler="gcc", bugnumber="llvm.org/pr28549")
- @decorators.expectedFailureAll(compiler="clang", compiler_version=[">=", "3.9"], archs=["i386"], bugnumber="llvm.org/pr28549")
+ @decorators.expectedFailureAll(
+ compiler="gcc", bugnumber="llvm.org/pr28549")
+ @decorators.expectedFailureAll(
+ compiler="clang",
+ compiler_version=[
+ ">=",
+ "3.9"],
+ archs=["i386"],
+ bugnumber="llvm.org/pr28549")
def test_step_in_with_python(self):
"""Test stepping in using avoid-no-debug with dwarf."""
self.build()
self.get_to_starting_point()
self.do_step_in_past_nodebug()
- def setUp (self):
+ def setUp(self):
TestBase.setUp(self)
self.main_source = "with-debug.c"
self.main_source_spec = lldb.SBFileSpec("with-debug.c")
- self.dbg.HandleCommand ("settings set target.process.thread.step-out-avoid-nodebug true")
+ self.dbg.HandleCommand(
+ "settings set target.process.thread.step-out-avoid-nodebug true")
- def tearDown (self):
- self.dbg.HandleCommand ("settings set target.process.thread.step-out-avoid-nodebug false")
+ def tearDown(self):
+ self.dbg.HandleCommand(
+ "settings set target.process.thread.step-out-avoid-nodebug false")
TestBase.tearDown(self)
- def hit_correct_line (self, pattern):
- target_line = line_number (self.main_source, pattern)
- self.assertTrue (target_line != 0, "Could not find source pattern " + pattern)
+ def hit_correct_line(self, pattern):
+ target_line = line_number(self.main_source, pattern)
+ self.assertTrue(
+ target_line != 0,
+ "Could not find source pattern " +
+ pattern)
cur_line = self.thread.frames[0].GetLineEntry().GetLine()
- self.assertTrue (cur_line == target_line, "Stepped to line %d instead of expected %d with pattern '%s'."%(cur_line, target_line, pattern))
-
- def hit_correct_function (self, pattern):
+ self.assertTrue(
+ cur_line == target_line,
+ "Stepped to line %d instead of expected %d with pattern '%s'." %
+ (cur_line,
+ target_line,
+ pattern))
+
+ def hit_correct_function(self, pattern):
name = self.thread.frames[0].GetFunctionName()
- self.assertTrue (pattern in name, "Got to '%s' not the expected function '%s'."%(name, pattern))
+ self.assertTrue(
+ pattern in name, "Got to '%s' not the expected function '%s'." %
+ (name, pattern))
- def get_to_starting_point (self):
+ def get_to_starting_point(self):
exe = os.path.join(os.getcwd(), "a.out")
error = lldb.SBError()
self.target = self.dbg.CreateTarget(exe)
self.assertTrue(self.target, VALID_TARGET)
- inner_bkpt = self.target.BreakpointCreateBySourceRegex("Stop here and step out of me", self.main_source_spec)
+ inner_bkpt = self.target.BreakpointCreateBySourceRegex(
+ "Stop here and step out of me", self.main_source_spec)
self.assertTrue(inner_bkpt, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- self.process = self.target.LaunchSimple (None, None, self.get_process_working_directory())
+ self.process = self.target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(self.process, PROCESS_IS_VALID)
# Now finish, and make sure the return value is correct.
- threads = lldbutil.get_threads_stopped_at_breakpoint (self.process, inner_bkpt)
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ self.process, inner_bkpt)
self.assertTrue(len(threads) == 1, "Stopped at inner breakpoint.")
self.thread = threads[0]
def do_step_out_past_nodebug(self):
# The first step out takes us to the called_from_nodebug frame, just to make sure setting
- # step-out-avoid-nodebug doesn't change the behavior in frames with debug info.
+ # step-out-avoid-nodebug doesn't change the behavior in frames with
+ # debug info.
self.thread.StepOut()
- self.hit_correct_line ("intermediate_return_value = called_from_nodebug_actual(some_value)")
+ self.hit_correct_line(
+ "intermediate_return_value = called_from_nodebug_actual(some_value)")
self.thread.StepOut()
- self.hit_correct_line ("int return_value = no_debug_caller(5, called_from_nodebug)")
+ self.hit_correct_line(
+ "int return_value = no_debug_caller(5, called_from_nodebug)")
- def do_step_over_past_nodebug (self):
+ def do_step_over_past_nodebug(self):
self.thread.StepOver()
- self.hit_correct_line ("intermediate_return_value = called_from_nodebug_actual(some_value)")
+ self.hit_correct_line(
+ "intermediate_return_value = called_from_nodebug_actual(some_value)")
self.thread.StepOver()
- self.hit_correct_line ("return intermediate_return_value")
+ self.hit_correct_line("return intermediate_return_value")
self.thread.StepOver()
# Note, lldb doesn't follow gdb's distinction between "step-out" and "step-over/step-in"
# when exiting a frame. In all cases we leave the pc at the point where we exited the
# frame. In gdb, step-over/step-in move to the end of the line they stepped out to.
# If we ever change this we will need to fix this test.
- self.hit_correct_line ("int return_value = no_debug_caller(5, called_from_nodebug)")
+ self.hit_correct_line(
+ "int return_value = no_debug_caller(5, called_from_nodebug)")
- def do_step_in_past_nodebug (self):
+ def do_step_in_past_nodebug(self):
self.thread.StepInto()
- self.hit_correct_line ("intermediate_return_value = called_from_nodebug_actual(some_value)")
+ self.hit_correct_line(
+ "intermediate_return_value = called_from_nodebug_actual(some_value)")
self.thread.StepInto()
- self.hit_correct_line ("return intermediate_return_value")
+ self.hit_correct_line("return intermediate_return_value")
self.thread.StepInto()
# Note, lldb doesn't follow gdb's distinction between "step-out" and "step-over/step-in"
# when exiting a frame. In all cases we leave the pc at the point where we exited the
# frame. In gdb, step-over/step-in move to the end of the line they stepped out to.
# If we ever change this we will need to fix this test.
- self.hit_correct_line ("int return_value = no_debug_caller(5, called_from_nodebug)")
+ self.hit_correct_line(
+ "int return_value = no_debug_caller(5, called_from_nodebug)")
diff --git a/packages/Python/lldbsuite/test/functionalities/stop-hook/TestStopHookCmd.py b/packages/Python/lldbsuite/test/functionalities/stop-hook/TestStopHookCmd.py
index 93f846a06870..3d23f644554b 100644
--- a/packages/Python/lldbsuite/test/functionalities/stop-hook/TestStopHookCmd.py
+++ b/packages/Python/lldbsuite/test/functionalities/stop-hook/TestStopHookCmd.py
@@ -5,13 +5,13 @@ Test lldb target stop-hook command.
from __future__ import print_function
-
import os
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class StopHookCmdTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -20,9 +20,15 @@ class StopHookCmdTestCase(TestBase):
# Call super's setUp().
TestBase.setUp(self)
# Find the line numbers inside main.cpp.
- self.begl = line_number('main.cpp', '// Set breakpoint here to test target stop-hook.')
- self.endl = line_number('main.cpp', '// End of the line range for which stop-hook is to be run.')
- self.line = line_number('main.cpp', '// Another breakpoint which is outside of the stop-hook range.')
+ self.begl = line_number(
+ 'main.cpp',
+ '// Set breakpoint here to test target stop-hook.')
+ self.endl = line_number(
+ 'main.cpp',
+ '// End of the line range for which stop-hook is to be run.')
+ self.line = line_number(
+ 'main.cpp',
+ '// Another breakpoint which is outside of the stop-hook range.')
@no_debug_info_test
def test_not_crashing_if_no_target(self):
@@ -35,32 +41,37 @@ class StopHookCmdTestCase(TestBase):
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.begl, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.begl, num_expected_locations=1, loc_exact=True)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
- self.runCmd("target stop-hook add -f main.cpp -l %d -e %d -o 'expr ptr'" % (self.begl, self.endl))
+ self.runCmd(
+ "target stop-hook add -f main.cpp -l %d -e %d -o 'expr ptr'" %
+ (self.begl, self.endl))
self.expect('target stop-hook list', 'Stop Hook added successfully',
- substrs = ['State: enabled',
- 'expr ptr'])
+ substrs=['State: enabled',
+ 'expr ptr'])
self.runCmd('target stop-hook disable')
self.expect('target stop-hook list', 'Stop Hook disabled successfully',
- substrs = ['State: disabled',
- 'expr ptr'])
+ substrs=['State: disabled',
+ 'expr ptr'])
self.runCmd('target stop-hook enable')
self.expect('target stop-hook list', 'Stop Hook enabled successfully',
- substrs = ['State: enabled',
- 'expr ptr'])
+ substrs=['State: enabled',
+ 'expr ptr'])
self.runCmd("settings set auto-confirm true")
- self.addTearDownHook(lambda: self.runCmd("settings clear auto-confirm"))
+ self.addTearDownHook(
+ lambda: self.runCmd("settings clear auto-confirm"))
self.runCmd('target stop-hook delete')
self.expect('target stop-hook list', 'Stop Hook deleted successfully',
- substrs = ['No stop hooks.'])
+ substrs=['No stop hooks.'])
diff --git a/packages/Python/lldbsuite/test/functionalities/stop-hook/TestStopHookMechanism.py b/packages/Python/lldbsuite/test/functionalities/stop-hook/TestStopHookMechanism.py
index c42c1e563881..fa5c6de05650 100644
--- a/packages/Python/lldbsuite/test/functionalities/stop-hook/TestStopHookMechanism.py
+++ b/packages/Python/lldbsuite/test/functionalities/stop-hook/TestStopHookMechanism.py
@@ -5,7 +5,6 @@ Test lldb target stop-hook mechanism to see whether it fires off correctly .
from __future__ import print_function
-
import os
import lldb
from lldbsuite.test.decorators import *
@@ -13,6 +12,7 @@ from lldbsuite.test.lldbtest import *
from lldbsuite.test import configuration
from lldbsuite.test import lldbutil
+
class StopHookMechanismTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -21,14 +21,24 @@ class StopHookMechanismTestCase(TestBase):
# Call super's setUp().
TestBase.setUp(self)
# Find the line numbers inside main.cpp.
- self.begl = line_number('main.cpp', '// Set breakpoint here to test target stop-hook.')
- self.endl = line_number('main.cpp', '// End of the line range for which stop-hook is to be run.')
- self.correct_step_line = line_number ('main.cpp', '// We should stop here after stepping.')
- self.line = line_number('main.cpp', '// Another breakpoint which is outside of the stop-hook range.')
+ self.begl = line_number(
+ 'main.cpp',
+ '// Set breakpoint here to test target stop-hook.')
+ self.endl = line_number(
+ 'main.cpp',
+ '// End of the line range for which stop-hook is to be run.')
+ self.correct_step_line = line_number(
+ 'main.cpp', '// We should stop here after stepping.')
+ self.line = line_number(
+ 'main.cpp',
+ '// Another breakpoint which is outside of the stop-hook range.')
- @skipIfFreeBSD # llvm.org/pr15037
- @expectedFlakeyLinux('llvm.org/pr15037') # stop-hooks sometimes fail to fire on Linux
- @expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
+ @skipIfFreeBSD # llvm.org/pr15037
+ # stop-hooks sometimes fail to fire on Linux
+ @expectedFlakeyLinux('llvm.org/pr15037')
+ @expectedFailureAll(
+ hostoslist=["windows"],
+ bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
def test(self):
"""Test the stop-hook mechanism."""
self.build()
@@ -40,7 +50,8 @@ class StopHookMechanismTestCase(TestBase):
add_prompt1 = "> "
# So that the child gets torn down after the test.
- self.child = pexpect.spawn('%s %s' % (lldbtest_config.lldbExec, self.lldbOption))
+ self.child = pexpect.spawn('%s %s' %
+ (lldbtest_config.lldbExec, self.lldbOption))
child = self.child
# Turn on logging for what the child sends back.
if self.TraceOn():
@@ -48,11 +59,17 @@ class StopHookMechanismTestCase(TestBase):
if lldb.remote_platform:
child.expect_exact(prompt)
- child.sendline('platform select %s' % lldb.remote_platform.GetName())
+ child.sendline(
+ 'platform select %s' %
+ lldb.remote_platform.GetName())
child.expect_exact(prompt)
- child.sendline('platform connect %s' % configuration.lldb_platform_url)
+ child.sendline(
+ 'platform connect %s' %
+ configuration.lldb_platform_url)
child.expect_exact(prompt)
- child.sendline('platform settings -w %s' % configuration.lldb_platform_working_dir)
+ child.sendline(
+ 'platform settings -w %s' %
+ configuration.lldb_platform_working_dir)
child.expect_exact(prompt)
child.sendline('target create %s' % exe)
@@ -63,7 +80,9 @@ class StopHookMechanismTestCase(TestBase):
child.expect_exact(prompt)
child.sendline('breakpoint set -f main.cpp -l %d' % self.line)
child.expect_exact(prompt)
- child.sendline('target stop-hook add -f main.cpp -l %d -e %d' % (self.begl, self.endl))
+ child.sendline(
+ 'target stop-hook add -f main.cpp -l %d -e %d' %
+ (self.begl, self.endl))
child.expect_exact(add_prompt)
child.expect_exact(add_prompt1)
child.sendline('expr ptr')
@@ -72,10 +91,12 @@ class StopHookMechanismTestCase(TestBase):
child.expect_exact(prompt)
child.sendline('target stop-hook list')
- # Now run the program, expect to stop at the first breakpoint which is within the stop-hook range.
+ # Now run the program, expect to stop at the first breakpoint which is
+ # within the stop-hook range.
child.expect_exact(prompt)
child.sendline('run')
- # Make sure we see the stop hook text from the stop of the process from the run hitting the first breakpoint
+ # Make sure we see the stop hook text from the stop of the process from
+ # the run hitting the first breakpoint
child.expect_exact('(void *) $')
child.expect_exact(prompt)
child.sendline('thread step-over')
@@ -91,13 +112,16 @@ class StopHookMechanismTestCase(TestBase):
print('expecting "%s"' % at_line)
child.expect_exact(at_line)
- # Now continue the inferior, we'll stop at another breakpoint which is outside the stop-hook range.
+ # Now continue the inferior, we'll stop at another breakpoint which is
+ # outside the stop-hook range.
child.sendline('process continue')
- child.expect_exact('// Another breakpoint which is outside of the stop-hook range.')
- #self.DebugPExpect(child)
+ child.expect_exact(
+ '// Another breakpoint which is outside of the stop-hook range.')
+ # self.DebugPExpect(child)
child.sendline('thread step-over')
- child.expect_exact('// Another breakpoint which is outside of the stop-hook range.')
- #self.DebugPExpect(child)
+ child.expect_exact(
+ '// Another breakpoint which is outside of the stop-hook range.')
+ # self.DebugPExpect(child)
# Verify that the 'Stop Hooks' mechanism is NOT BEING fired off.
self.expect(child.before, exe=False, matching=False,
- substrs = ['(void *) $'])
+ substrs=['(void *) $'])
diff --git a/packages/Python/lldbsuite/test/functionalities/stop-hook/multiple_threads/TestStopHookMultipleThreads.py b/packages/Python/lldbsuite/test/functionalities/stop-hook/multiple_threads/TestStopHookMultipleThreads.py
index 57395832dc21..3a18877ef2d0 100644
--- a/packages/Python/lldbsuite/test/functionalities/stop-hook/multiple_threads/TestStopHookMultipleThreads.py
+++ b/packages/Python/lldbsuite/test/functionalities/stop-hook/multiple_threads/TestStopHookMultipleThreads.py
@@ -5,14 +5,15 @@ Test that lldb stop-hook works for multiple threads.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import configuration
from lldbsuite.test import lldbutil
+
class StopHookForMultipleThreadsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -23,15 +24,22 @@ class StopHookForMultipleThreadsTestCase(TestBase):
# Our simple source filename.
self.source = 'main.cpp'
# Find the line number to break inside main().
- self.first_stop = line_number(self.source, '// Set break point at this line, and add a stop-hook.')
- self.thread_function = line_number(self.source, '// Break here to test that the stop-hook mechanism works for multiple threads.')
- # Build dictionary to have unique executable names for each test method.
+ self.first_stop = line_number(
+ self.source, '// Set break point at this line, and add a stop-hook.')
+ self.thread_function = line_number(
+ self.source,
+ '// Break here to test that the stop-hook mechanism works for multiple threads.')
+ # Build dictionary to have unique executable names for each test
+ # method.
self.exe_name = self.testMethodName
self.d = {'CXX_SOURCES': self.source, 'EXE': self.exe_name}
@expectedFlakeyFreeBSD("llvm.org/pr15037")
- @expectedFlakeyLinux("llvm.org/pr15037") # stop hooks sometimes fail to fire on Linux
- @expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
+ # stop hooks sometimes fail to fire on Linux
+ @expectedFlakeyLinux("llvm.org/pr15037")
+ @expectedFailureAll(
+ hostoslist=["windows"],
+ bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
def test_stop_hook_multiple_threads(self):
"""Test that lldb stop-hook works for multiple threads."""
self.build(dictionary=self.d)
@@ -42,7 +50,8 @@ class StopHookForMultipleThreadsTestCase(TestBase):
prompt = "(lldb) "
# So that the child gets torn down after the test.
- self.child = pexpect.spawn('%s %s' % (lldbtest_config.lldbExec, self.lldbOption))
+ self.child = pexpect.spawn('%s %s' %
+ (lldbtest_config.lldbExec, self.lldbOption))
child = self.child
# Turn on logging for what the child sends back.
if self.TraceOn():
@@ -50,11 +59,17 @@ class StopHookForMultipleThreadsTestCase(TestBase):
if lldb.remote_platform:
child.expect_exact(prompt)
- child.sendline('platform select %s' % lldb.remote_platform.GetName())
+ child.sendline(
+ 'platform select %s' %
+ lldb.remote_platform.GetName())
child.expect_exact(prompt)
- child.sendline('platform connect %s' % configuration.lldb_platform_url)
+ child.sendline(
+ 'platform connect %s' %
+ configuration.lldb_platform_url)
child.expect_exact(prompt)
- child.sendline('platform settings -w %s' % configuration.lldb_platform_working_dir)
+ child.sendline(
+ 'platform settings -w %s' %
+ configuration.lldb_platform_working_dir)
child.expect_exact(prompt)
child.sendline('target create %s' % exe)
@@ -63,17 +78,23 @@ class StopHookForMultipleThreadsTestCase(TestBase):
child.expect_exact(prompt)
child.sendline('breakpoint set -f main.cpp -l %d' % self.first_stop)
child.expect_exact(prompt)
- child.sendline('breakpoint set -f main.cpp -l %d' % self.thread_function)
+ child.sendline(
+ 'breakpoint set -f main.cpp -l %d' %
+ self.thread_function)
child.expect_exact(prompt)
- # Now run the program, expect to stop at the first breakpoint which is within the stop-hook range.
+ # Now run the program, expect to stop at the first breakpoint which is
+ # within the stop-hook range.
child.sendline('run')
- child.expect_exact("Process") # 'Process 2415 launched', 'Process 2415 stopped'
+ # 'Process 2415 launched', 'Process 2415 stopped'
+ child.expect_exact("Process")
child.expect_exact(prompt)
- child.sendline('target stop-hook add -o "frame variable --show-globals g_val"')
- child.expect_exact("Stop hook") # 'Stop hook #1 added.'
+ child.sendline(
+ 'target stop-hook add -o "frame variable --show-globals g_val"')
+ child.expect_exact("Stop hook") # 'Stop hook #1 added.'
child.expect_exact(prompt)
- # Continue and expect to find the output emitted by the firing of our stop hook.
+ # Continue and expect to find the output emitted by the firing of our
+ # stop hook.
child.sendline('continue')
child.expect_exact('(uint32_t) ::g_val = ')
diff --git a/packages/Python/lldbsuite/test/functionalities/target_command/TestTargetCommand.py b/packages/Python/lldbsuite/test/functionalities/target_command/TestTargetCommand.py
index 126f6e4dab80..7d2900d61718 100644
--- a/packages/Python/lldbsuite/test/functionalities/target_command/TestTargetCommand.py
+++ b/packages/Python/lldbsuite/test/functionalities/target_command/TestTargetCommand.py
@@ -5,13 +5,13 @@ Test some target commands: create, list, select, variable.
from __future__ import print_function
-
import lldb
import sys
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class targetCommandTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -80,17 +80,19 @@ class targetCommandTestCase(TestBase):
# We will start from (index + 1) ....
base = int(match.group(1), 10) + 1
#print("base is:", base)
- break;
+ break
self.runCmd("target create " + exe_a, CURRENT_EXECUTABLE_SET)
self.runCmd("run", RUN_SUCCEEDED)
self.runCmd("target create " + exe_b, CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, 'b.c', self.line_b, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, 'b.c', self.line_b, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
self.runCmd("target create " + exe_c, CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, 'c.c', self.line_c, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, 'c.c', self.line_c, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
self.runCmd("target list")
@@ -100,13 +102,13 @@ class targetCommandTestCase(TestBase):
self.runCmd("target select %d" % (base + 2))
self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['c.c:%d' % self.line_c,
- 'stop reason = breakpoint'])
+ substrs=['c.c:%d' % self.line_c,
+ 'stop reason = breakpoint'])
self.runCmd("target select %d" % (base + 1))
self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['b.c:%d' % self.line_b,
- 'stop reason = breakpoint'])
+ substrs=['b.c:%d' % self.line_b,
+ 'stop reason = breakpoint'])
self.runCmd("target list")
@@ -114,89 +116,160 @@ class targetCommandTestCase(TestBase):
"""Exercise 'target variable' command before and after starting the inferior."""
self.runCmd("file " + exe_name, CURRENT_EXECUTABLE_SET)
- self.expect("target variable my_global_char", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["my_global_char", "'X'"])
- self.expect("target variable my_global_str", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['my_global_str', '"abc"'])
- self.expect("target variable my_static_int", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['my_static_int', '228'])
+ self.expect(
+ "target variable my_global_char",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "my_global_char",
+ "'X'"])
+ self.expect(
+ "target variable my_global_str",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ 'my_global_str',
+ '"abc"'])
+ self.expect(
+ "target variable my_static_int",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ 'my_static_int',
+ '228'])
self.expect("target variable my_global_str_ptr", matching=False,
- substrs = ['"abc"'])
+ substrs=['"abc"'])
self.expect("target variable *my_global_str_ptr", matching=True,
- substrs = ['"abc"'])
- self.expect("target variable *my_global_str", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['a'])
+ substrs=['"abc"'])
+ self.expect(
+ "target variable *my_global_str",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=['a'])
self.runCmd("b main")
self.runCmd("run")
-
- self.expect("target variable my_global_str", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['my_global_str', '"abc"'])
- self.expect("target variable my_static_int", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['my_static_int', '228'])
+
+ self.expect(
+ "target variable my_global_str",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ 'my_global_str',
+ '"abc"'])
+ self.expect(
+ "target variable my_static_int",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ 'my_static_int',
+ '228'])
self.expect("target variable my_global_str_ptr", matching=False,
- substrs = ['"abc"'])
+ substrs=['"abc"'])
self.expect("target variable *my_global_str_ptr", matching=True,
- substrs = ['"abc"'])
- self.expect("target variable *my_global_str", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['a'])
- self.expect("target variable my_global_char", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["my_global_char", "'X'"])
+ substrs=['"abc"'])
+ self.expect(
+ "target variable *my_global_str",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=['a'])
+ self.expect(
+ "target variable my_global_char",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "my_global_char",
+ "'X'"])
self.runCmd("c")
# rdar://problem/9763907
# 'target variable' command fails if the target program has been run
- self.expect("target variable my_global_str", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['my_global_str', '"abc"'])
- self.expect("target variable my_static_int", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['my_static_int', '228'])
+ self.expect(
+ "target variable my_global_str",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ 'my_global_str',
+ '"abc"'])
+ self.expect(
+ "target variable my_static_int",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ 'my_static_int',
+ '228'])
self.expect("target variable my_global_str_ptr", matching=False,
- substrs = ['"abc"'])
+ substrs=['"abc"'])
self.expect("target variable *my_global_str_ptr", matching=True,
- substrs = ['"abc"'])
- self.expect("target variable *my_global_str", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['a'])
- self.expect("target variable my_global_char", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["my_global_char", "'X'"])
+ substrs=['"abc"'])
+ self.expect(
+ "target variable *my_global_str",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=['a'])
+ self.expect(
+ "target variable my_global_char",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "my_global_char",
+ "'X'"])
def do_target_variable_command_no_fail(self, exe_name):
"""Exercise 'target variable' command before and after starting the inferior."""
self.runCmd("file " + exe_name, CURRENT_EXECUTABLE_SET)
- self.expect("target variable my_global_char", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["my_global_char", "'X'"])
- self.expect("target variable my_global_str", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['my_global_str', '"abc"'])
- self.expect("target variable my_static_int", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['my_static_int', '228'])
+ self.expect(
+ "target variable my_global_char",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "my_global_char",
+ "'X'"])
+ self.expect(
+ "target variable my_global_str",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ 'my_global_str',
+ '"abc"'])
+ self.expect(
+ "target variable my_static_int",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ 'my_static_int',
+ '228'])
self.expect("target variable my_global_str_ptr", matching=False,
- substrs = ['"abc"'])
+ substrs=['"abc"'])
self.expect("target variable *my_global_str_ptr", matching=True,
- substrs = ['"abc"'])
- self.expect("target variable *my_global_str", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['a'])
+ substrs=['"abc"'])
+ self.expect(
+ "target variable *my_global_str",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=['a'])
self.runCmd("b main")
self.runCmd("run")
-
+
# New feature: you don't need to specify the variable(s) to 'target vaiable'.
- # It will find all the global and static variables in the current compile unit.
+ # It will find all the global and static variables in the current
+ # compile unit.
self.expect("target variable",
- substrs = ['my_global_char',
- 'my_global_str',
- 'my_global_str_ptr',
- 'my_static_int'])
-
- self.expect("target variable my_global_str", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['my_global_str', '"abc"'])
- self.expect("target variable my_static_int", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['my_static_int', '228'])
+ substrs=['my_global_char',
+ 'my_global_str',
+ 'my_global_str_ptr',
+ 'my_static_int'])
+
+ self.expect(
+ "target variable my_global_str",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ 'my_global_str',
+ '"abc"'])
+ self.expect(
+ "target variable my_static_int",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ 'my_static_int',
+ '228'])
self.expect("target variable my_global_str_ptr", matching=False,
- substrs = ['"abc"'])
+ substrs=['"abc"'])
self.expect("target variable *my_global_str_ptr", matching=True,
- substrs = ['"abc"'])
- self.expect("target variable *my_global_str", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['a'])
- self.expect("target variable my_global_char", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["my_global_char", "'X'"])
+ substrs=['"abc"'])
+ self.expect(
+ "target variable *my_global_str",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=['a'])
+ self.expect(
+ "target variable my_global_char",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "my_global_char",
+ "'X'"])
diff --git a/packages/Python/lldbsuite/test/functionalities/testid/TestTestId.py b/packages/Python/lldbsuite/test/functionalities/testid/TestTestId.py
new file mode 100644
index 000000000000..a594ad2c9e44
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/testid/TestTestId.py
@@ -0,0 +1,17 @@
+"""
+Add a test to verify our test instance returns something non-None for
+an id(). Other parts of the test running infrastructure are counting on this.
+"""
+
+from __future__ import print_function
+from lldbsuite.test.lldbtest import TestBase
+
+class TestIdTestCase(TestBase):
+
+ NO_DEBUG_INFO_TESTCASE = True
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def test_id_exists(self):
+ self.assertIsNotNone(self.id(), "Test instance should have an id()")
+
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/TestNumThreads.py b/packages/Python/lldbsuite/test/functionalities/thread/TestNumThreads.py
index 8184ddcfbf48..094c86705969 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/TestNumThreads.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/TestNumThreads.py
@@ -5,12 +5,13 @@ Test number of threads.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class NumberOfThreadsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -28,18 +29,23 @@ class NumberOfThreadsTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# This should create a breakpoint with 1 location.
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1)
# The breakpoint list should show 3 locations.
- self.expect("breakpoint list -f", "Breakpoint location shown correctly",
- substrs = ["1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % self.line])
+ self.expect(
+ "breakpoint list -f",
+ "Breakpoint location shown correctly",
+ substrs=[
+ "1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" %
+ self.line])
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
# Stopped once.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ["stop reason = breakpoint 1."])
+ substrs=["stop reason = breakpoint 1."])
# Get the target process
target = self.dbg.GetSelectedTarget()
@@ -50,4 +56,6 @@ class NumberOfThreadsTestCase(TestBase):
# Using std::thread may involve extra threads, so we assert that there are
# at least 4 rather than exactly 4.
- self.assertTrue(num_threads >= 4, 'Number of expected threads and actual threads do not match.')
+ self.assertTrue(
+ num_threads >= 4,
+ 'Number of expected threads and actual threads do not match.')
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/backtrace_all/TestBacktraceAll.py b/packages/Python/lldbsuite/test/functionalities/thread/backtrace_all/TestBacktraceAll.py
index 902adacb2abd..ba5094f6de3e 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/backtrace_all/TestBacktraceAll.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/backtrace_all/TestBacktraceAll.py
@@ -2,13 +2,15 @@
Test regression for Bug 25251.
"""
-import os, time
+import os
+import time
import unittest2
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class BreakpointAfterJoinTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -17,11 +19,13 @@ class BreakpointAfterJoinTestCase(TestBase):
# Call super's setUp().
TestBase.setUp(self)
# Find the line number for our breakpoint.
- self.breakpoint = line_number('ParallelTask.cpp', '// Set breakpoint here')
-
- @skipIfTargetAndroid(archs=["arm"]) # The android-arm compiler can't compile the inferior
- # because of an issue around std::future.
- # TODO: Change the test to don't depend on std::future<T>
+ self.breakpoint = line_number(
+ 'ParallelTask.cpp', '// Set breakpoint here')
+
+ # The android-arm compiler can't compile the inferior
+ @skipIfTargetAndroid(archs=["arm"])
+ # because of an issue around std::future.
+ # TODO: Change the test to don't depend on std::future<T>
def test(self):
"""Test breakpoint handling after a thread join."""
self.build(dictionary=self.getBuildFlags())
@@ -30,23 +34,28 @@ class BreakpointAfterJoinTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# This should create a breakpoint
- lldbutil.run_break_set_by_file_and_line (self, "ParallelTask.cpp", self.breakpoint, num_expected_locations=-1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "ParallelTask.cpp", self.breakpoint, num_expected_locations=-1)
# The breakpoint list should show 1 location.
- self.expect("breakpoint list -f", "Breakpoint location shown correctly",
- substrs = ["1: file = 'ParallelTask.cpp', line = %d, exact_match = 0" % self.breakpoint])
+ self.expect(
+ "breakpoint list -f",
+ "Breakpoint location shown correctly",
+ substrs=[
+ "1: file = 'ParallelTask.cpp', line = %d, exact_match = 0" %
+ self.breakpoint])
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This should not result in a segmentation fault
self.expect("thread backtrace all", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ["stop reason = breakpoint 1."])
+ substrs=["stop reason = breakpoint 1."])
# Run to completion
self.runCmd("continue")
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/break_after_join/TestBreakAfterJoin.py b/packages/Python/lldbsuite/test/functionalities/thread/break_after_join/TestBreakAfterJoin.py
index 8ef0fb0a000d..d1d70c58c4c7 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/break_after_join/TestBreakAfterJoin.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/break_after_join/TestBreakAfterJoin.py
@@ -5,13 +5,14 @@ Test number of threads.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class BreakpointAfterJoinTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -22,9 +23,15 @@ class BreakpointAfterJoinTestCase(TestBase):
# Find the line number for our breakpoint.
self.breakpoint = line_number('main.cpp', '// Set breakpoint here')
- @expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr15824 thread states not properly maintained")
- @expectedFailureAll(oslist=lldbplatformutil.getDarwinOSTriples(), bugnumber="llvm.org/pr15824 thread states not properly maintained")
- @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr18190 thread states not properly maintained")
+ @expectedFailureAll(
+ oslist=["linux"],
+ bugnumber="llvm.org/pr15824 thread states not properly maintained")
+ @expectedFailureAll(
+ oslist=lldbplatformutil.getDarwinOSTriples(),
+ bugnumber="llvm.org/pr15824 thread states not properly maintained and <rdar://problem/28557237>")
+ @expectedFailureAll(
+ oslist=["freebsd"],
+ bugnumber="llvm.org/pr18190 thread states not properly maintained")
def test(self):
"""Test breakpoint handling after a thread join."""
self.build(dictionary=self.getBuildFlags())
@@ -33,19 +40,24 @@ class BreakpointAfterJoinTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# This should create a breakpoint in the main thread.
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.breakpoint, num_expected_locations=1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.breakpoint, num_expected_locations=1)
# The breakpoint list should show 1 location.
- self.expect("breakpoint list -f", "Breakpoint location shown correctly",
- substrs = ["1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % self.breakpoint])
+ self.expect(
+ "breakpoint list -f",
+ "Breakpoint location shown correctly",
+ substrs=[
+ "1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" %
+ self.breakpoint])
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# Get the target process
target = self.dbg.GetSelectedTarget()
@@ -59,12 +71,15 @@ class BreakpointAfterJoinTestCase(TestBase):
num_threads = process.GetNumThreads()
# Make sure we see at least six threads
- self.assertTrue(num_threads >= 6, 'Number of expected threads and actual threads do not match.')
+ self.assertTrue(
+ num_threads >= 6,
+ 'Number of expected threads and actual threads do not match.')
# Make sure all threads are stopped
for i in range(0, num_threads):
- self.assertTrue(process.GetThreadAtIndex(i).IsStopped(),
- "Thread {0} didn't stop during breakpoint.".format(i))
+ self.assertTrue(
+ process.GetThreadAtIndex(i).IsStopped(),
+ "Thread {0} didn't stop during breakpoint.".format(i))
# Run to completion
self.runCmd("continue")
@@ -75,4 +90,6 @@ class BreakpointAfterJoinTestCase(TestBase):
self.runCmd("process status")
# At this point, the inferior process should have exited.
- self.assertTrue(process.GetState() == lldb.eStateExited, PROCESS_EXITED)
+ self.assertTrue(
+ process.GetState() == lldb.eStateExited,
+ PROCESS_EXITED)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentEvents.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentEvents.py
deleted file mode 100644
index 30adcccd203f..000000000000
--- a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentEvents.py
+++ /dev/null
@@ -1,525 +0,0 @@
-"""
-A stress-test of sorts for LLDB's handling of threads in the inferior.
-
-This test sets a breakpoint in the main thread where test parameters (numbers of
-threads) can be adjusted, runs the inferior to that point, and modifies the
-locals that control the event thread counts. This test also sets a breakpoint in
-breakpoint_func (the function executed by each 'breakpoint' thread) and a
-watchpoint on a global modified in watchpoint_func. The inferior is continued
-until exit or a crash takes place, and the number of events seen by LLDB is
-verified to match the expected number of events.
-"""
-
-from __future__ import print_function
-
-
-
-import unittest2
-import os, time
-import lldb
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-
-@skipIfWindows
-class ConcurrentEventsTestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- #
- ## Tests for multiple threads that generate a single event.
- #
- @unittest2.skipIf(TestBase.skipLongRunningTest(), "Skip this long running test")
- @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB.
- def test_many_breakpoints(self):
- """Test 100 breakpoints from 100 threads."""
- self.build(dictionary=self.getBuildFlags())
- self.do_thread_actions(num_breakpoint_threads=100)
-
- @unittest2.skipIf(TestBase.skipLongRunningTest(), "Skip this long running test")
- @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB.
- def test_many_watchpoints(self):
- """Test 100 watchpoints from 100 threads."""
- self.build(dictionary=self.getBuildFlags())
- self.do_thread_actions(num_watchpoint_threads=100)
-
- @unittest2.skipIf(TestBase.skipLongRunningTest(), "Skip this long running test")
- @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB.
- def test_many_signals(self):
- """Test 100 signals from 100 threads."""
- self.build(dictionary=self.getBuildFlags())
- self.do_thread_actions(num_signal_threads=100)
-
- @unittest2.skipIf(TestBase.skipLongRunningTest(), "Skip this long running test")
- @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB.
- def test_many_crash(self):
- """Test 100 threads that cause a segfault."""
- self.build(dictionary=self.getBuildFlags())
- self.do_thread_actions(num_crash_threads=100)
-
-
- #
- ## Tests for concurrent signal and breakpoint
- #
- @skipIfFreeBSD # timing out on buildbot
- @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB.
- def test_signal_break(self):
- """Test signal and a breakpoint in multiple threads."""
- self.build(dictionary=self.getBuildFlags())
- self.do_thread_actions(num_breakpoint_threads=1, num_signal_threads=1)
-
- @skipIfFreeBSD # timing out on buildbot
- @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB.
- def test_delay_signal_break(self):
- """Test (1-second delay) signal and a breakpoint in multiple threads."""
- self.build(dictionary=self.getBuildFlags())
- self.do_thread_actions(num_breakpoint_threads=1, num_delay_signal_threads=1)
-
- @skipIfFreeBSD # timing out on buildbot
- @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB.
- def test_signal_delay_break(self):
- """Test signal and a (1 second delay) breakpoint in multiple threads."""
- self.build(dictionary=self.getBuildFlags())
- self.do_thread_actions(num_delay_breakpoint_threads=1, num_signal_threads=1)
-
-
- #
- ## Tests for concurrent watchpoint and breakpoint
- #
- @skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
- @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB.
- def test_watch_break(self):
- """Test watchpoint and a breakpoint in multiple threads."""
- self.build(dictionary=self.getBuildFlags())
- self.do_thread_actions(num_breakpoint_threads=1, num_watchpoint_threads=1)
-
- @skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
- @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB.
- def test_delay_watch_break(self):
- """Test (1-second delay) watchpoint and a breakpoint in multiple threads."""
- self.build(dictionary=self.getBuildFlags())
- self.do_thread_actions(num_breakpoint_threads=1, num_delay_watchpoint_threads=1)
-
- @skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
- @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB.
- def test_watch_break_delay(self):
- """Test watchpoint and a (1 second delay) breakpoint in multiple threads."""
- self.build(dictionary=self.getBuildFlags())
- self.do_thread_actions(num_delay_breakpoint_threads=1, num_watchpoint_threads=1)
-
- #
- ## Tests for concurrent signal and watchpoint
- #
- @skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
- @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB.
- def test_signal_watch(self):
- """Test a watchpoint and a signal in multiple threads."""
- self.build(dictionary=self.getBuildFlags())
- self.do_thread_actions(num_signal_threads=1, num_watchpoint_threads=1)
-
- @skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
- @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB.
- def test_delay_signal_watch(self):
- """Test a watchpoint and a (1 second delay) signal in multiple threads."""
- self.build(dictionary=self.getBuildFlags())
- self.do_thread_actions(num_delay_signal_threads=1, num_watchpoint_threads=1)
-
- @skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
- @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB.
- def test_signal_delay_watch(self):
- """Test a (1 second delay) watchpoint and a signal in multiple threads."""
- self.build(dictionary=self.getBuildFlags())
- self.do_thread_actions(num_signal_threads=1, num_delay_watchpoint_threads=1)
-
-
- #
- ## Tests for multiple breakpoint threads
- #
- @skipIfFreeBSD # timing out on buildbot
- @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB.
- def test_two_breakpoint_threads(self):
- """Test two threads that trigger a breakpoint. """
- self.build(dictionary=self.getBuildFlags())
- self.do_thread_actions(num_breakpoint_threads=2)
-
- @skipIfFreeBSD # timing out on buildbot
- @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB.
- def test_breakpoint_one_delay_breakpoint_threads(self):
- """Test threads that trigger a breakpoint where one thread has a 1 second delay. """
- self.build(dictionary=self.getBuildFlags())
- self.do_thread_actions(num_breakpoint_threads=1,
- num_delay_breakpoint_threads=1)
-
- @skipIfFreeBSD # timing out on buildbot
- @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB.
- def test_two_breakpoints_one_signal(self):
- """Test two threads that trigger a breakpoint and one signal thread. """
- self.build(dictionary=self.getBuildFlags())
- self.do_thread_actions(num_breakpoint_threads=2, num_signal_threads=1)
-
- @skipIfFreeBSD # timing out on buildbot
- @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB.
- def test_breakpoint_delay_breakpoint_one_signal(self):
- """Test two threads that trigger a breakpoint (one with a 1 second delay) and one signal thread. """
- self.build(dictionary=self.getBuildFlags())
- self.do_thread_actions(num_breakpoint_threads=1,
- num_delay_breakpoint_threads=1,
- num_signal_threads=1)
-
- @skipIfFreeBSD # timing out on buildbot
- @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB.
- def test_two_breakpoints_one_delay_signal(self):
- """Test two threads that trigger a breakpoint and one (1 second delay) signal thread. """
- self.build(dictionary=self.getBuildFlags())
- self.do_thread_actions(num_breakpoint_threads=2, num_delay_signal_threads=1)
-
- @skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
- @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB.
- def test_two_breakpoints_one_watchpoint(self):
- """Test two threads that trigger a breakpoint and one watchpoint thread. """
- self.build(dictionary=self.getBuildFlags())
- self.do_thread_actions(num_breakpoint_threads=2, num_watchpoint_threads=1)
-
- @skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
- @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB.
- def test_breakpoints_delayed_breakpoint_one_watchpoint(self):
- """Test a breakpoint, a delayed breakpoint, and one watchpoint thread. """
- self.build(dictionary=self.getBuildFlags())
- self.do_thread_actions(num_breakpoint_threads=1,
- num_delay_breakpoint_threads=1,
- num_watchpoint_threads=1)
-
- #
- ## Tests for multiple watchpoint threads
- #
- @skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
- @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB.
- def test_two_watchpoint_threads(self):
- """Test two threads that trigger a watchpoint. """
- self.build(dictionary=self.getBuildFlags())
- self.do_thread_actions(num_watchpoint_threads=2)
-
- @skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
- @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB.
- def test_watchpoint_with_delay_watchpoint_threads(self):
- """Test two threads that trigger a watchpoint where one thread has a 1 second delay. """
- self.build(dictionary=self.getBuildFlags())
- self.do_thread_actions(num_watchpoint_threads=1,
- num_delay_watchpoint_threads=1)
-
- @skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
- @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB.
- def test_two_watchpoints_one_breakpoint(self):
- """Test two threads that trigger a watchpoint and one breakpoint thread. """
- self.build(dictionary=self.getBuildFlags())
- self.do_thread_actions(num_watchpoint_threads=2, num_breakpoint_threads=1)
-
- @skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
- @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB.
- def test_two_watchpoints_one_delay_breakpoint(self):
- """Test two threads that trigger a watchpoint and one (1 second delay) breakpoint thread. """
- self.build(dictionary=self.getBuildFlags())
- self.do_thread_actions(num_watchpoint_threads=2, num_delay_breakpoint_threads=1)
-
- @skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
- @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB.
- def test_watchpoint_delay_watchpoint_one_breakpoint(self):
- """Test two threads that trigger a watchpoint (one with a 1 second delay) and one breakpoint thread. """
- self.build(dictionary=self.getBuildFlags())
- self.do_thread_actions(num_watchpoint_threads=1,
- num_delay_watchpoint_threads=1,
- num_breakpoint_threads=1)
-
- @skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
- @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB.
- def test_two_watchpoints_one_signal(self):
- """Test two threads that trigger a watchpoint and one signal thread. """
- self.build(dictionary=self.getBuildFlags())
- self.do_thread_actions(num_watchpoint_threads=2, num_signal_threads=1)
-
- #
- ## Test for watchpoint, signal and breakpoint happening concurrently
- #
- @skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
- @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB.
- def test_signal_watch_break(self):
- """Test a signal/watchpoint/breakpoint in multiple threads."""
- self.build(dictionary=self.getBuildFlags())
- self.do_thread_actions(num_signal_threads=1,
- num_watchpoint_threads=1,
- num_breakpoint_threads=1)
-
- @skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
- @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB.
- def test_signal_watch_break(self):
- """Test one signal thread with 5 watchpoint and breakpoint threads."""
- self.build(dictionary=self.getBuildFlags())
- self.do_thread_actions(num_signal_threads=1,
- num_watchpoint_threads=5,
- num_breakpoint_threads=5)
-
- @skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
- @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB.
- def test_signal_watch_break(self):
- """Test with 5 watchpoint and breakpoint threads."""
- self.build(dictionary=self.getBuildFlags())
- self.do_thread_actions(num_watchpoint_threads=5,
- num_breakpoint_threads=5)
-
-
- #
- ## Test for crashing threads happening concurrently with other events
- #
- @skipIfFreeBSD # timing out on buildbot
- @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB.
- def test_crash_with_break(self):
- """ Test a thread that crashes while another thread hits a breakpoint."""
- self.build(dictionary=self.getBuildFlags())
- self.do_thread_actions(num_crash_threads=1, num_breakpoint_threads=1)
-
- @skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
- @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB.
- def test_crash_with_watchpoint(self):
- """ Test a thread that crashes while another thread hits a watchpoint."""
- self.build(dictionary=self.getBuildFlags())
- self.do_thread_actions(num_crash_threads=1, num_watchpoint_threads=1)
-
- @skipIfFreeBSD # timing out on buildbot
- @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB.
- def test_crash_with_signal(self):
- """ Test a thread that crashes while another thread generates a signal."""
- self.build(dictionary=self.getBuildFlags())
- self.do_thread_actions(num_crash_threads=1, num_signal_threads=1)
-
- @skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
- @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB.
- def test_crash_with_watchpoint_breakpoint_signal(self):
- """ Test a thread that crashes while other threads generate a signal and hit a watchpoint and breakpoint. """
- self.build(dictionary=self.getBuildFlags())
- self.do_thread_actions(num_crash_threads=1,
- num_breakpoint_threads=1,
- num_signal_threads=1,
- num_watchpoint_threads=1)
-
- @skipIfFreeBSD # timing out on buildbot
- @skipIfRemoteDueToDeadlock
- @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB.
- def test_delayed_crash_with_breakpoint_watchpoint(self):
- """ Test a thread with a delayed crash while other threads hit a watchpoint and a breakpoint. """
- self.build(dictionary=self.getBuildFlags())
- self.do_thread_actions(num_delay_crash_threads=1,
- num_breakpoint_threads=1,
- num_watchpoint_threads=1)
-
- @skipIfFreeBSD # timing out on buildbot
- @expectedFailureAll(triple = '^mips') # Atomic sequences are not supported yet for MIPS in LLDB.
- def test_delayed_crash_with_breakpoint_signal(self):
- """ Test a thread with a delayed crash while other threads generate a signal and hit a breakpoint. """
- self.build(dictionary=self.getBuildFlags())
- self.do_thread_actions(num_delay_crash_threads=1,
- num_breakpoint_threads=1,
- num_signal_threads=1)
-
- def setUp(self):
- # Call super's setUp().
- TestBase.setUp(self)
- # Find the line number for our breakpoint.
- self.filename = 'main.cpp'
- self.thread_breakpoint_line = line_number(self.filename, '// Set breakpoint here')
- self.setup_breakpoint_line = line_number(self.filename, '// Break here and adjust num')
- self.finish_breakpoint_line = line_number(self.filename, '// Break here and verify one thread is active')
-
- def describe_threads(self):
- ret = []
- for x in self.inferior_process:
- id = x.GetIndexID()
- reason = x.GetStopReason()
- status = "stopped" if x.IsStopped() else "running"
- reason_str = lldbutil.stop_reason_to_str(reason)
- if reason == lldb.eStopReasonBreakpoint:
- bpid = x.GetStopReasonDataAtIndex(0)
- bp = self.inferior_target.FindBreakpointByID(bpid)
- reason_str = "%s hit %d times" % (lldbutil.get_description(bp), bp.GetHitCount())
- elif reason == lldb.eStopReasonWatchpoint:
- watchid = x.GetStopReasonDataAtIndex(0)
- watch = self.inferior_target.FindWatchpointByID(watchid)
- reason_str = "%s hit %d times" % (lldbutil.get_description(watch), watch.GetHitCount())
- elif reason == lldb.eStopReasonSignal:
- signals = self.inferior_process.GetUnixSignals()
- signal_name = signals.GetSignalAsCString(x.GetStopReasonDataAtIndex(0))
- reason_str = "signal %s" % signal_name
-
- location = "\t".join([lldbutil.get_description(x.GetFrameAtIndex(i)) for i in range(x.GetNumFrames())])
- ret.append("thread %d %s due to %s at\n\t%s" % (id, status, reason_str, location))
- return ret
-
- def add_breakpoint(self, line, descriptions):
- """ Adds a breakpoint at self.filename:line and appends its description to descriptions, and
- returns the LLDB SBBreakpoint object.
- """
-
- bpno = lldbutil.run_break_set_by_file_and_line(self, self.filename, line, num_expected_locations=-1)
- bp = self.inferior_target.FindBreakpointByID(bpno)
- descriptions.append(": file = 'main.cpp', line = %d" % self.finish_breakpoint_line)
- return bp
-
- def inferior_done(self):
- """ Returns true if the inferior is done executing all the event threads (and is stopped at self.finish_breakpoint,
- or has terminated execution.
- """
- return self.finish_breakpoint.GetHitCount() > 0 or \
- self.crash_count > 0 or \
- self.inferior_process.GetState() == lldb.eStateExited
-
- def count_signaled_threads(self):
- count = 0
- for thread in self.inferior_process:
- if thread.GetStopReason() == lldb.eStopReasonSignal and thread.GetStopReasonDataAtIndex(0) == self.inferior_process.GetUnixSignals().GetSignalNumberFromName('SIGUSR1'):
- count += 1
- return count
-
- def do_thread_actions(self,
- num_breakpoint_threads = 0,
- num_signal_threads = 0,
- num_watchpoint_threads = 0,
- num_crash_threads = 0,
- num_delay_breakpoint_threads = 0,
- num_delay_signal_threads = 0,
- num_delay_watchpoint_threads = 0,
- num_delay_crash_threads = 0):
- """ Sets a breakpoint in the main thread where test parameters (numbers of threads) can be adjusted, runs the inferior
- to that point, and modifies the locals that control the event thread counts. Also sets a breakpoint in
- breakpoint_func (the function executed by each 'breakpoint' thread) and a watchpoint on a global modified in
- watchpoint_func. The inferior is continued until exit or a crash takes place, and the number of events seen by LLDB
- is verified to match the expected number of events.
- """
- exe = os.path.join(os.getcwd(), "a.out")
- self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
-
- # Get the target
- self.inferior_target = self.dbg.GetSelectedTarget()
-
- expected_bps = []
-
- # Initialize all the breakpoints (main thread/aux thread)
- self.setup_breakpoint = self.add_breakpoint(self.setup_breakpoint_line, expected_bps)
- self.finish_breakpoint = self.add_breakpoint(self.finish_breakpoint_line, expected_bps)
-
- # Set the thread breakpoint
- if num_breakpoint_threads + num_delay_breakpoint_threads > 0:
- self.thread_breakpoint = self.add_breakpoint(self.thread_breakpoint_line, expected_bps)
-
- # Verify breakpoints
- self.expect("breakpoint list -f", "Breakpoint locations shown correctly", substrs = expected_bps)
-
- # Run the program.
- self.runCmd("run", RUN_SUCCEEDED)
-
- # Check we are at line self.setup_breakpoint
- self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ["stop reason = breakpoint 1."])
-
- # Initialize the (single) watchpoint on the global variable (g_watchme)
- if num_watchpoint_threads + num_delay_watchpoint_threads > 0:
- self.runCmd("watchpoint set variable g_watchme")
- for w in self.inferior_target.watchpoint_iter():
- self.thread_watchpoint = w
- self.assertTrue("g_watchme" in str(self.thread_watchpoint), "Watchpoint location not shown correctly")
-
- # Get the process
- self.inferior_process = self.inferior_target.GetProcess()
-
- # We should be stopped at the setup site where we can set the number of
- # threads doing each action (break/crash/signal/watch)
- self.assertEqual(self.inferior_process.GetNumThreads(), 1, 'Expected to stop before any additional threads are spawned.')
-
- self.runCmd("expr num_breakpoint_threads=%d" % num_breakpoint_threads)
- self.runCmd("expr num_crash_threads=%d" % num_crash_threads)
- self.runCmd("expr num_signal_threads=%d" % num_signal_threads)
- self.runCmd("expr num_watchpoint_threads=%d" % num_watchpoint_threads)
-
- self.runCmd("expr num_delay_breakpoint_threads=%d" % num_delay_breakpoint_threads)
- self.runCmd("expr num_delay_crash_threads=%d" % num_delay_crash_threads)
- self.runCmd("expr num_delay_signal_threads=%d" % num_delay_signal_threads)
- self.runCmd("expr num_delay_watchpoint_threads=%d" % num_delay_watchpoint_threads)
-
- # Continue the inferior so threads are spawned
- self.runCmd("continue")
-
- # Make sure we see all the threads. The inferior program's threads all synchronize with a pseudo-barrier; that is,
- # the inferior program ensures all threads are started and running before any thread triggers its 'event'.
- num_threads = self.inferior_process.GetNumThreads()
- expected_num_threads = num_breakpoint_threads + num_delay_breakpoint_threads \
- + num_signal_threads + num_delay_signal_threads \
- + num_watchpoint_threads + num_delay_watchpoint_threads \
- + num_crash_threads + num_delay_crash_threads + 1
- self.assertEqual(num_threads, expected_num_threads,
- 'Expected to see %d threads, but seeing %d. Details:\n%s' % (expected_num_threads,
- num_threads,
- "\n\t".join(self.describe_threads())))
-
- self.signal_count = self.count_signaled_threads()
- self.crash_count = len(lldbutil.get_crashed_threads(self, self.inferior_process))
-
- # Run to completion (or crash)
- while not self.inferior_done():
- if self.TraceOn():
- self.runCmd("thread backtrace all")
- self.runCmd("continue")
- self.signal_count += self.count_signaled_threads()
- self.crash_count += len(lldbutil.get_crashed_threads(self, self.inferior_process))
-
- if num_crash_threads > 0 or num_delay_crash_threads > 0:
- # Expecting a crash
- self.assertTrue(self.crash_count > 0,
- "Expecting at least one thread to crash. Details: %s" % "\t\n".join(self.describe_threads()))
-
- # Ensure the zombie process is reaped
- self.runCmd("process kill")
-
- elif num_crash_threads == 0 and num_delay_crash_threads == 0:
- # There should be a single active thread (the main one) which hit the breakpoint after joining
- self.assertEqual(1, self.finish_breakpoint.GetHitCount(), "Expected main thread (finish) breakpoint to be hit once")
-
- num_threads = self.inferior_process.GetNumThreads()
- self.assertEqual(1, num_threads, "Expecting 1 thread but seeing %d. Details:%s" % (num_threads,
- "\n\t".join(self.describe_threads())))
- self.runCmd("continue")
-
- # The inferior process should have exited without crashing
- self.assertEqual(0, self.crash_count, "Unexpected thread(s) in crashed state")
- self.assertEqual(self.inferior_process.GetState(), lldb.eStateExited, PROCESS_EXITED)
-
- # Verify the number of actions took place matches expected numbers
- expected_breakpoint_threads = num_delay_breakpoint_threads + num_breakpoint_threads
- breakpoint_hit_count = self.thread_breakpoint.GetHitCount() if expected_breakpoint_threads > 0 else 0
- self.assertEqual(expected_breakpoint_threads, breakpoint_hit_count,
- "Expected %d breakpoint hits, but got %d" % (expected_breakpoint_threads, breakpoint_hit_count))
-
- expected_signal_threads = num_delay_signal_threads + num_signal_threads
- self.assertEqual(expected_signal_threads, self.signal_count,
- "Expected %d stops due to signal delivery, but got %d" % (expected_signal_threads, self.signal_count))
-
- expected_watchpoint_threads = num_delay_watchpoint_threads + num_watchpoint_threads
- watchpoint_hit_count = self.thread_watchpoint.GetHitCount() if expected_watchpoint_threads > 0 else 0
- self.assertEqual(expected_watchpoint_threads, watchpoint_hit_count,
- "Expected %d watchpoint hits, got %d" % (expected_watchpoint_threads, watchpoint_hit_count))
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_delay_breakpoint_one_signal/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_delay_breakpoint_one_signal/Makefile
new file mode 100644
index 000000000000..4b5e0ee94222
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_delay_breakpoint_one_signal/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+
+ENABLE_THREADS := YES
+
+VPATH = ..
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_delay_breakpoint_one_signal/TestConcurrentBreakpointDelayBreakpointOneSignal.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_delay_breakpoint_one_signal/TestConcurrentBreakpointDelayBreakpointOneSignal.py
new file mode 100644
index 000000000000..2506a8231883
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_delay_breakpoint_one_signal/TestConcurrentBreakpointDelayBreakpointOneSignal.py
@@ -0,0 +1,23 @@
+from __future__ import print_function
+
+import unittest2
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.concurrent_base import ConcurrentEventsBase
+from lldbsuite.test.lldbtest import TestBase
+
+
+@skipIfWindows
+class ConcurrentBreakpointDelayBreakpointOneSignal(ConcurrentEventsBase):
+
+ mydir = ConcurrentEventsBase.compute_mydir(__file__)
+
+ @skipIfFreeBSD # timing out on buildbot
+ # Atomic sequences are not supported yet for MIPS in LLDB.
+ @skipIf(triple='^mips')
+ def test(self):
+ """Test two threads that trigger a breakpoint (one with a 1 second delay) and one signal thread. """
+ self.build(dictionary=self.getBuildFlags())
+ self.do_thread_actions(num_breakpoint_threads=1,
+ num_delay_breakpoint_threads=1,
+ num_signal_threads=1)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_one_delay_breakpoint_threads/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_one_delay_breakpoint_threads/Makefile
new file mode 100644
index 000000000000..4b5e0ee94222
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_one_delay_breakpoint_threads/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+
+ENABLE_THREADS := YES
+
+VPATH = ..
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_one_delay_breakpoint_threads/TestConcurrentBreakpointOneDelayBreakpointThreads.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_one_delay_breakpoint_threads/TestConcurrentBreakpointOneDelayBreakpointThreads.py
new file mode 100644
index 000000000000..8712342e5811
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_one_delay_breakpoint_threads/TestConcurrentBreakpointOneDelayBreakpointThreads.py
@@ -0,0 +1,22 @@
+from __future__ import print_function
+
+import unittest2
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.concurrent_base import ConcurrentEventsBase
+from lldbsuite.test.lldbtest import TestBase
+
+
+@skipIfWindows
+class ConcurrentBreakpointOneDelayBreakpointThreads(ConcurrentEventsBase):
+
+ mydir = ConcurrentEventsBase.compute_mydir(__file__)
+
+ @skipIfFreeBSD # timing out on buildbot
+ # Atomic sequences are not supported yet for MIPS in LLDB.
+ @skipIf(triple='^mips')
+ def test(self):
+ """Test threads that trigger a breakpoint where one thread has a 1 second delay. """
+ self.build(dictionary=self.getBuildFlags())
+ self.do_thread_actions(num_breakpoint_threads=1,
+ num_delay_breakpoint_threads=1)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoints_delayed_breakpoint_one_watchpoint/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoints_delayed_breakpoint_one_watchpoint/Makefile
new file mode 100644
index 000000000000..4b5e0ee94222
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoints_delayed_breakpoint_one_watchpoint/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+
+ENABLE_THREADS := YES
+
+VPATH = ..
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoints_delayed_breakpoint_one_watchpoint/TestConcurrentBreakpointsDelayedBreakpointOneWatchpoint.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoints_delayed_breakpoint_one_watchpoint/TestConcurrentBreakpointsDelayedBreakpointOneWatchpoint.py
new file mode 100644
index 000000000000..c600d8ed21be
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoints_delayed_breakpoint_one_watchpoint/TestConcurrentBreakpointsDelayedBreakpointOneWatchpoint.py
@@ -0,0 +1,25 @@
+from __future__ import print_function
+
+import unittest2
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.concurrent_base import ConcurrentEventsBase
+from lldbsuite.test.lldbtest import TestBase
+
+
+@skipIfWindows
+class ConcurrentBreakpointsDelayedBreakpointOneWatchpoint(
+ ConcurrentEventsBase):
+
+ mydir = ConcurrentEventsBase.compute_mydir(__file__)
+
+ @skipIfFreeBSD # timing out on buildbot
+ @skipIfRemoteDueToDeadlock
+ # Atomic sequences are not supported yet for MIPS in LLDB.
+ @skipIf(triple='^mips')
+ def test(self):
+ """Test a breakpoint, a delayed breakpoint, and one watchpoint thread. """
+ self.build(dictionary=self.getBuildFlags())
+ self.do_thread_actions(num_breakpoint_threads=1,
+ num_delay_breakpoint_threads=1,
+ num_watchpoint_threads=1)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_break/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_break/Makefile
new file mode 100644
index 000000000000..4b5e0ee94222
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_break/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+
+ENABLE_THREADS := YES
+
+VPATH = ..
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_break/TestConcurrentCrashWithBreak.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_break/TestConcurrentCrashWithBreak.py
new file mode 100644
index 000000000000..33d1074211ee
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_break/TestConcurrentCrashWithBreak.py
@@ -0,0 +1,21 @@
+from __future__ import print_function
+
+import unittest2
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.concurrent_base import ConcurrentEventsBase
+from lldbsuite.test.lldbtest import TestBase
+
+
+@skipIfWindows
+class ConcurrentCrashWithBreak(ConcurrentEventsBase):
+
+ mydir = ConcurrentEventsBase.compute_mydir(__file__)
+
+ @skipIfFreeBSD # timing out on buildbot
+ # Atomic sequences are not supported yet for MIPS in LLDB.
+ @skipIf(triple='^mips')
+ def test(self):
+ """ Test a thread that crashes while another thread hits a breakpoint."""
+ self.build(dictionary=self.getBuildFlags())
+ self.do_thread_actions(num_crash_threads=1, num_breakpoint_threads=1)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_signal/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_signal/Makefile
new file mode 100644
index 000000000000..4b5e0ee94222
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_signal/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+
+ENABLE_THREADS := YES
+
+VPATH = ..
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_signal/TestConcurrentCrashWithSignal.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_signal/TestConcurrentCrashWithSignal.py
new file mode 100644
index 000000000000..560c79ed8a8f
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_signal/TestConcurrentCrashWithSignal.py
@@ -0,0 +1,21 @@
+from __future__ import print_function
+
+import unittest2
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.concurrent_base import ConcurrentEventsBase
+from lldbsuite.test.lldbtest import TestBase
+
+
+@skipIfWindows
+class ConcurrentCrashWithSignal(ConcurrentEventsBase):
+
+ mydir = ConcurrentEventsBase.compute_mydir(__file__)
+
+ @skipIfFreeBSD # timing out on buildbot
+ # Atomic sequences are not supported yet for MIPS in LLDB.
+ @skipIf(triple='^mips')
+ def test(self):
+ """ Test a thread that crashes while another thread generates a signal."""
+ self.build(dictionary=self.getBuildFlags())
+ self.do_thread_actions(num_crash_threads=1, num_signal_threads=1)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint/Makefile
new file mode 100644
index 000000000000..4b5e0ee94222
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+
+ENABLE_THREADS := YES
+
+VPATH = ..
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint/TestConcurrentCrashWithWatchpoint.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint/TestConcurrentCrashWithWatchpoint.py
new file mode 100644
index 000000000000..169903816fa9
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint/TestConcurrentCrashWithWatchpoint.py
@@ -0,0 +1,22 @@
+from __future__ import print_function
+
+import unittest2
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.concurrent_base import ConcurrentEventsBase
+from lldbsuite.test.lldbtest import TestBase
+
+
+@skipIfWindows
+class ConcurrentCrashWithWatchpoint(ConcurrentEventsBase):
+
+ mydir = ConcurrentEventsBase.compute_mydir(__file__)
+
+ @skipIfFreeBSD # timing out on buildbot
+ @skipIfRemoteDueToDeadlock
+ # Atomic sequences are not supported yet for MIPS in LLDB.
+ @skipIf(triple='^mips')
+ def test(self):
+ """ Test a thread that crashes while another thread hits a watchpoint."""
+ self.build(dictionary=self.getBuildFlags())
+ self.do_thread_actions(num_crash_threads=1, num_watchpoint_threads=1)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint_breakpoint_signal/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint_breakpoint_signal/Makefile
new file mode 100644
index 000000000000..4b5e0ee94222
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint_breakpoint_signal/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+
+ENABLE_THREADS := YES
+
+VPATH = ..
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint_breakpoint_signal/TestConcurrentCrashWithWatchpointBreakpointSignal.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint_breakpoint_signal/TestConcurrentCrashWithWatchpointBreakpointSignal.py
new file mode 100644
index 000000000000..4a58e7cf6d71
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint_breakpoint_signal/TestConcurrentCrashWithWatchpointBreakpointSignal.py
@@ -0,0 +1,25 @@
+from __future__ import print_function
+
+import unittest2
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.concurrent_base import ConcurrentEventsBase
+from lldbsuite.test.lldbtest import TestBase
+
+
+@skipIfWindows
+class ConcurrentCrashWithWatchpointBreakpointSignal(ConcurrentEventsBase):
+
+ mydir = ConcurrentEventsBase.compute_mydir(__file__)
+
+ @skipIfFreeBSD # timing out on buildbot
+ @skipIfRemoteDueToDeadlock
+ # Atomic sequences are not supported yet for MIPS in LLDB.
+ @skipIf(triple='^mips')
+ def test(self):
+ """ Test a thread that crashes while other threads generate a signal and hit a watchpoint and breakpoint. """
+ self.build(dictionary=self.getBuildFlags())
+ self.do_thread_actions(num_crash_threads=1,
+ num_breakpoint_threads=1,
+ num_signal_threads=1,
+ num_watchpoint_threads=1)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_break/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_break/Makefile
new file mode 100644
index 000000000000..4b5e0ee94222
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_break/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+
+ENABLE_THREADS := YES
+
+VPATH = ..
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_break/TestConcurrentDelaySignalBreak.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_break/TestConcurrentDelaySignalBreak.py
new file mode 100644
index 000000000000..442134f4a0c7
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_break/TestConcurrentDelaySignalBreak.py
@@ -0,0 +1,23 @@
+from __future__ import print_function
+
+import unittest2
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.concurrent_base import ConcurrentEventsBase
+from lldbsuite.test.lldbtest import TestBase
+
+
+@skipIfWindows
+class ConcurrentDelaySignalBreak(ConcurrentEventsBase):
+
+ mydir = ConcurrentEventsBase.compute_mydir(__file__)
+
+ @skipIfFreeBSD # timing out on buildbot
+ # Atomic sequences are not supported yet for MIPS in LLDB.
+ @skipIf(triple='^mips')
+ def test(self):
+ """Test (1-second delay) signal and a breakpoint in multiple threads."""
+ self.build(dictionary=self.getBuildFlags())
+ self.do_thread_actions(
+ num_breakpoint_threads=1,
+ num_delay_signal_threads=1)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_watch/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_watch/Makefile
new file mode 100644
index 000000000000..4b5e0ee94222
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_watch/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+
+ENABLE_THREADS := YES
+
+VPATH = ..
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_watch/TestConcurrentDelaySignalWatch.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_watch/TestConcurrentDelaySignalWatch.py
new file mode 100644
index 000000000000..d5d4641bc164
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_watch/TestConcurrentDelaySignalWatch.py
@@ -0,0 +1,24 @@
+from __future__ import print_function
+
+import unittest2
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.concurrent_base import ConcurrentEventsBase
+from lldbsuite.test.lldbtest import TestBase
+
+
+@skipIfWindows
+class ConcurrentDelaySignalWatch(ConcurrentEventsBase):
+
+ mydir = ConcurrentEventsBase.compute_mydir(__file__)
+
+ @skipIfFreeBSD # timing out on buildbot
+ @skipIfRemoteDueToDeadlock
+ # Atomic sequences are not supported yet for MIPS in LLDB.
+ @skipIf(triple='^mips')
+ def test(self):
+ """Test a watchpoint and a (1 second delay) signal in multiple threads."""
+ self.build(dictionary=self.getBuildFlags())
+ self.do_thread_actions(
+ num_delay_signal_threads=1,
+ num_watchpoint_threads=1)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_watch_break/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_watch_break/Makefile
new file mode 100644
index 000000000000..4b5e0ee94222
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_watch_break/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+
+ENABLE_THREADS := YES
+
+VPATH = ..
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_watch_break/TestConcurrentDelayWatchBreak.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_watch_break/TestConcurrentDelayWatchBreak.py
new file mode 100644
index 000000000000..9cbb40cb6019
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_watch_break/TestConcurrentDelayWatchBreak.py
@@ -0,0 +1,24 @@
+from __future__ import print_function
+
+import unittest2
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.concurrent_base import ConcurrentEventsBase
+from lldbsuite.test.lldbtest import TestBase
+
+
+@skipIfWindows
+class ConcurrentDelayWatchBreak(ConcurrentEventsBase):
+
+ mydir = ConcurrentEventsBase.compute_mydir(__file__)
+
+ @skipIfFreeBSD # timing out on buildbot
+ @skipIfRemoteDueToDeadlock
+ # Atomic sequences are not supported yet for MIPS in LLDB.
+ @skipIf(triple='^mips')
+ def test(self):
+ """Test (1-second delay) watchpoint and a breakpoint in multiple threads."""
+ self.build(dictionary=self.getBuildFlags())
+ self.do_thread_actions(
+ num_breakpoint_threads=1,
+ num_delay_watchpoint_threads=1)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_signal/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_signal/Makefile
new file mode 100644
index 000000000000..4b5e0ee94222
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_signal/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+
+ENABLE_THREADS := YES
+
+VPATH = ..
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_signal/TestConcurrentDelayedCrashWithBreakpointSignal.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_signal/TestConcurrentDelayedCrashWithBreakpointSignal.py
new file mode 100644
index 000000000000..2b7e1b457268
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_signal/TestConcurrentDelayedCrashWithBreakpointSignal.py
@@ -0,0 +1,23 @@
+from __future__ import print_function
+
+import unittest2
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.concurrent_base import ConcurrentEventsBase
+from lldbsuite.test.lldbtest import TestBase
+
+
+@skipIfWindows
+class ConcurrentDelayedCrashWithBreakpointSignal(ConcurrentEventsBase):
+
+ mydir = ConcurrentEventsBase.compute_mydir(__file__)
+
+ @skipIfFreeBSD # timing out on buildbot
+ # Atomic sequences are not supported yet for MIPS in LLDB.
+ @skipIf(triple='^mips')
+ def test(self):
+ """ Test a thread with a delayed crash while other threads generate a signal and hit a breakpoint. """
+ self.build(dictionary=self.getBuildFlags())
+ self.do_thread_actions(num_delay_crash_threads=1,
+ num_breakpoint_threads=1,
+ num_signal_threads=1)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_watchpoint/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_watchpoint/Makefile
new file mode 100644
index 000000000000..4b5e0ee94222
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_watchpoint/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+
+ENABLE_THREADS := YES
+
+VPATH = ..
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_watchpoint/TestConcurrentDelayedCrashWithBreakpointWatchpoint.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_watchpoint/TestConcurrentDelayedCrashWithBreakpointWatchpoint.py
new file mode 100644
index 000000000000..ccbeeb07d3a8
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_watchpoint/TestConcurrentDelayedCrashWithBreakpointWatchpoint.py
@@ -0,0 +1,24 @@
+from __future__ import print_function
+
+import unittest2
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.concurrent_base import ConcurrentEventsBase
+from lldbsuite.test.lldbtest import TestBase
+
+
+@skipIfWindows
+class ConcurrentDelayedCrashWithBreakpointWatchpoint(ConcurrentEventsBase):
+
+ mydir = ConcurrentEventsBase.compute_mydir(__file__)
+
+ @skipIfFreeBSD # timing out on buildbot
+ @skipIfRemoteDueToDeadlock
+ # Atomic sequences are not supported yet for MIPS in LLDB.
+ @skipIf(triple='^mips')
+ def test(self):
+ """ Test a thread with a delayed crash while other threads hit a watchpoint and a breakpoint. """
+ self.build(dictionary=self.getBuildFlags())
+ self.do_thread_actions(num_delay_crash_threads=1,
+ num_breakpoint_threads=1,
+ num_watchpoint_threads=1)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_breakpoints/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_breakpoints/Makefile
new file mode 100644
index 000000000000..4b5e0ee94222
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_breakpoints/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+
+ENABLE_THREADS := YES
+
+VPATH = ..
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_breakpoints/TestConcurrentManyBreakpoints.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_breakpoints/TestConcurrentManyBreakpoints.py
new file mode 100644
index 000000000000..a9f3fbb799f1
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_breakpoints/TestConcurrentManyBreakpoints.py
@@ -0,0 +1,23 @@
+from __future__ import print_function
+
+import unittest2
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.concurrent_base import ConcurrentEventsBase
+from lldbsuite.test.lldbtest import TestBase
+
+
+@skipIfWindows
+class ConcurrentManyBreakpoints(ConcurrentEventsBase):
+
+ mydir = ConcurrentEventsBase.compute_mydir(__file__)
+
+ @unittest2.skipIf(
+ TestBase.skipLongRunningTest(),
+ "Skip this long running test")
+ # Atomic sequences are not supported yet for MIPS in LLDB.
+ @skipIf(triple='^mips')
+ def test(self):
+ """Test 100 breakpoints from 100 threads."""
+ self.build(dictionary=self.getBuildFlags())
+ self.do_thread_actions(num_breakpoint_threads=100)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_crash/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_crash/Makefile
new file mode 100644
index 000000000000..4b5e0ee94222
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_crash/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+
+ENABLE_THREADS := YES
+
+VPATH = ..
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_crash/TestConcurrentManyCrash.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_crash/TestConcurrentManyCrash.py
new file mode 100644
index 000000000000..88ab1d5e204c
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_crash/TestConcurrentManyCrash.py
@@ -0,0 +1,23 @@
+from __future__ import print_function
+
+import unittest2
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.concurrent_base import ConcurrentEventsBase
+from lldbsuite.test.lldbtest import TestBase
+
+
+@skipIfWindows
+class ConcurrentManyCrash(ConcurrentEventsBase):
+
+ mydir = ConcurrentEventsBase.compute_mydir(__file__)
+
+ @unittest2.skipIf(
+ TestBase.skipLongRunningTest(),
+ "Skip this long running test")
+ # Atomic sequences are not supported yet for MIPS in LLDB.
+ @skipIf(triple='^mips')
+ def test(self):
+ """Test 100 threads that cause a segfault."""
+ self.build(dictionary=self.getBuildFlags())
+ self.do_thread_actions(num_crash_threads=100)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_signals/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_signals/Makefile
new file mode 100644
index 000000000000..4b5e0ee94222
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_signals/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+
+ENABLE_THREADS := YES
+
+VPATH = ..
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_signals/TestConcurrentManySignals.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_signals/TestConcurrentManySignals.py
new file mode 100644
index 000000000000..232b694c80f4
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_signals/TestConcurrentManySignals.py
@@ -0,0 +1,23 @@
+from __future__ import print_function
+
+import unittest2
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.concurrent_base import ConcurrentEventsBase
+from lldbsuite.test.lldbtest import TestBase
+
+
+@skipIfWindows
+class ConcurrentManySignals(ConcurrentEventsBase):
+
+ mydir = ConcurrentEventsBase.compute_mydir(__file__)
+
+ @unittest2.skipIf(
+ TestBase.skipLongRunningTest(),
+ "Skip this long running test")
+ # Atomic sequences are not supported yet for MIPS in LLDB.
+ @skipIf(triple='^mips')
+ def test(self):
+ """Test 100 signals from 100 threads."""
+ self.build(dictionary=self.getBuildFlags())
+ self.do_thread_actions(num_signal_threads=100)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_watchpoints/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_watchpoints/Makefile
new file mode 100644
index 000000000000..4b5e0ee94222
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_watchpoints/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+
+ENABLE_THREADS := YES
+
+VPATH = ..
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_watchpoints/TestConcurrentManyWatchpoints.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_watchpoints/TestConcurrentManyWatchpoints.py
new file mode 100644
index 000000000000..73c1704e7e54
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_watchpoints/TestConcurrentManyWatchpoints.py
@@ -0,0 +1,23 @@
+from __future__ import print_function
+
+import unittest2
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.concurrent_base import ConcurrentEventsBase
+from lldbsuite.test.lldbtest import TestBase
+
+
+@skipIfWindows
+class ConcurrentManyWatchpoints(ConcurrentEventsBase):
+
+ mydir = ConcurrentEventsBase.compute_mydir(__file__)
+
+ @unittest2.skipIf(
+ TestBase.skipLongRunningTest(),
+ "Skip this long running test")
+ # Atomic sequences are not supported yet for MIPS in LLDB.
+ @skipIf(triple='^mips')
+ def test(self):
+ """Test 100 watchpoints from 100 threads."""
+ self.build(dictionary=self.getBuildFlags())
+ self.do_thread_actions(num_watchpoint_threads=100)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/n_watch_n_break/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/n_watch_n_break/Makefile
new file mode 100644
index 000000000000..4b5e0ee94222
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/n_watch_n_break/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+
+ENABLE_THREADS := YES
+
+VPATH = ..
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/n_watch_n_break/TestConcurrentNWatchNBreak.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/n_watch_n_break/TestConcurrentNWatchNBreak.py
new file mode 100644
index 000000000000..b9a7c5f568cb
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/n_watch_n_break/TestConcurrentNWatchNBreak.py
@@ -0,0 +1,23 @@
+from __future__ import print_function
+
+import unittest2
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.concurrent_base import ConcurrentEventsBase
+from lldbsuite.test.lldbtest import TestBase
+
+
+@skipIfWindows
+class ConcurrentNWatchNBreak(ConcurrentEventsBase):
+
+ mydir = ConcurrentEventsBase.compute_mydir(__file__)
+
+ @skipIfFreeBSD # timing out on buildbot
+ @skipIfRemoteDueToDeadlock
+ # Atomic sequences are not supported yet for MIPS in LLDB.
+ @skipIf(triple='^mips')
+ def test(self):
+ """Test with 5 watchpoint and breakpoint threads."""
+ self.build(dictionary=self.getBuildFlags())
+ self.do_thread_actions(num_watchpoint_threads=5,
+ num_breakpoint_threads=5)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_break/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_break/Makefile
new file mode 100644
index 000000000000..4b5e0ee94222
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_break/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+
+ENABLE_THREADS := YES
+
+VPATH = ..
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_break/TestConcurrentSignalBreak.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_break/TestConcurrentSignalBreak.py
new file mode 100644
index 000000000000..b8819f286984
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_break/TestConcurrentSignalBreak.py
@@ -0,0 +1,21 @@
+from __future__ import print_function
+
+import unittest2
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.concurrent_base import ConcurrentEventsBase
+from lldbsuite.test.lldbtest import TestBase
+
+
+@skipIfWindows
+class ConcurrentSignalBreak(ConcurrentEventsBase):
+
+ mydir = ConcurrentEventsBase.compute_mydir(__file__)
+
+ @skipIfFreeBSD # timing out on buildbot
+ # Atomic sequences are not supported yet for MIPS in LLDB.
+ @skipIf(triple='^mips')
+ def test(self):
+ """Test signal and a breakpoint in multiple threads."""
+ self.build(dictionary=self.getBuildFlags())
+ self.do_thread_actions(num_breakpoint_threads=1, num_signal_threads=1)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_break/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_break/Makefile
new file mode 100644
index 000000000000..4b5e0ee94222
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_break/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+
+ENABLE_THREADS := YES
+
+VPATH = ..
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_break/TestConcurrentSignalDelayBreak.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_break/TestConcurrentSignalDelayBreak.py
new file mode 100644
index 000000000000..b7d8cb174d24
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_break/TestConcurrentSignalDelayBreak.py
@@ -0,0 +1,23 @@
+from __future__ import print_function
+
+import unittest2
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.concurrent_base import ConcurrentEventsBase
+from lldbsuite.test.lldbtest import TestBase
+
+
+@skipIfWindows
+class ConcurrentSignalDelayBreak(ConcurrentEventsBase):
+
+ mydir = ConcurrentEventsBase.compute_mydir(__file__)
+
+ @skipIfFreeBSD # timing out on buildbot
+ # Atomic sequences are not supported yet for MIPS in LLDB.
+ @skipIf(triple='^mips')
+ def test(self):
+ """Test signal and a (1 second delay) breakpoint in multiple threads."""
+ self.build(dictionary=self.getBuildFlags())
+ self.do_thread_actions(
+ num_delay_breakpoint_threads=1,
+ num_signal_threads=1)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_watch/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_watch/Makefile
new file mode 100644
index 000000000000..4b5e0ee94222
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_watch/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+
+ENABLE_THREADS := YES
+
+VPATH = ..
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_watch/TestConcurrentSignalDelayWatch.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_watch/TestConcurrentSignalDelayWatch.py
new file mode 100644
index 000000000000..128245343803
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_watch/TestConcurrentSignalDelayWatch.py
@@ -0,0 +1,24 @@
+from __future__ import print_function
+
+import unittest2
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.concurrent_base import ConcurrentEventsBase
+from lldbsuite.test.lldbtest import TestBase
+
+
+@skipIfWindows
+class ConcurrentSignalDelayWatch(ConcurrentEventsBase):
+
+ mydir = ConcurrentEventsBase.compute_mydir(__file__)
+
+ @skipIfFreeBSD # timing out on buildbot
+ @skipIfRemoteDueToDeadlock
+ # Atomic sequences are not supported yet for MIPS in LLDB.
+ @skipIf(triple='^mips')
+ def test(self):
+ """Test a (1 second delay) watchpoint and a signal in multiple threads."""
+ self.build(dictionary=self.getBuildFlags())
+ self.do_thread_actions(
+ num_signal_threads=1,
+ num_delay_watchpoint_threads=1)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_n_watch_n_break/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_n_watch_n_break/Makefile
new file mode 100644
index 000000000000..4b5e0ee94222
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_n_watch_n_break/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+
+ENABLE_THREADS := YES
+
+VPATH = ..
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_n_watch_n_break/TestConcurrentSignalNWatchNBreak.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_n_watch_n_break/TestConcurrentSignalNWatchNBreak.py
new file mode 100644
index 000000000000..56217e1e8c3f
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_n_watch_n_break/TestConcurrentSignalNWatchNBreak.py
@@ -0,0 +1,24 @@
+from __future__ import print_function
+
+import unittest2
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.concurrent_base import ConcurrentEventsBase
+from lldbsuite.test.lldbtest import TestBase
+
+
+@skipIfWindows
+class ConcurrentSignalNWatchNBreak(ConcurrentEventsBase):
+
+ mydir = ConcurrentEventsBase.compute_mydir(__file__)
+
+ @skipIfFreeBSD # timing out on buildbot
+ @skipIfRemoteDueToDeadlock
+ # Atomic sequences are not supported yet for MIPS in LLDB.
+ @skipIf(triple='^mips')
+ def test(self):
+ """Test one signal thread with 5 watchpoint and breakpoint threads."""
+ self.build(dictionary=self.getBuildFlags())
+ self.do_thread_actions(num_signal_threads=1,
+ num_watchpoint_threads=5,
+ num_breakpoint_threads=5)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch/Makefile
new file mode 100644
index 000000000000..4b5e0ee94222
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+
+ENABLE_THREADS := YES
+
+VPATH = ..
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch/TestConcurrentSignalWatch.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch/TestConcurrentSignalWatch.py
new file mode 100644
index 000000000000..001062896265
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch/TestConcurrentSignalWatch.py
@@ -0,0 +1,22 @@
+from __future__ import print_function
+
+import unittest2
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.concurrent_base import ConcurrentEventsBase
+from lldbsuite.test.lldbtest import TestBase
+
+
+@skipIfWindows
+class ConcurrentSignalWatch(ConcurrentEventsBase):
+
+ mydir = ConcurrentEventsBase.compute_mydir(__file__)
+
+ @skipIfFreeBSD # timing out on buildbot
+ @skipIfRemoteDueToDeadlock
+ # Atomic sequences are not supported yet for MIPS in LLDB.
+ @skipIf(triple='^mips')
+ def test(self):
+ """Test a watchpoint and a signal in multiple threads."""
+ self.build(dictionary=self.getBuildFlags())
+ self.do_thread_actions(num_signal_threads=1, num_watchpoint_threads=1)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch_break/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch_break/Makefile
new file mode 100644
index 000000000000..4b5e0ee94222
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch_break/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+
+ENABLE_THREADS := YES
+
+VPATH = ..
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch_break/TestConcurrentSignalWatchBreak.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch_break/TestConcurrentSignalWatchBreak.py
new file mode 100644
index 000000000000..d7725002f2bd
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch_break/TestConcurrentSignalWatchBreak.py
@@ -0,0 +1,24 @@
+from __future__ import print_function
+
+import unittest2
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.concurrent_base import ConcurrentEventsBase
+from lldbsuite.test.lldbtest import TestBase
+
+
+@skipIfWindows
+class ConcurrentSignalWatchBreak(ConcurrentEventsBase):
+
+ mydir = ConcurrentEventsBase.compute_mydir(__file__)
+
+ @skipIfFreeBSD # timing out on buildbot
+ @skipIfRemoteDueToDeadlock
+ # Atomic sequences are not supported yet for MIPS in LLDB.
+ @skipIf(triple='^mips')
+ def test(self):
+ """Test a signal/watchpoint/breakpoint in multiple threads."""
+ self.build(dictionary=self.getBuildFlags())
+ self.do_thread_actions(num_signal_threads=1,
+ num_watchpoint_threads=1,
+ num_breakpoint_threads=1)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoint_threads/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoint_threads/Makefile
new file mode 100644
index 000000000000..4b5e0ee94222
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoint_threads/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+
+ENABLE_THREADS := YES
+
+VPATH = ..
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoint_threads/TestConcurrentTwoBreakpointThreads.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoint_threads/TestConcurrentTwoBreakpointThreads.py
new file mode 100644
index 000000000000..4e6bed2d5cbc
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoint_threads/TestConcurrentTwoBreakpointThreads.py
@@ -0,0 +1,21 @@
+from __future__ import print_function
+
+import unittest2
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.concurrent_base import ConcurrentEventsBase
+from lldbsuite.test.lldbtest import TestBase
+
+
+@skipIfWindows
+class ConcurrentTwoBreakpointThreads(ConcurrentEventsBase):
+
+ mydir = ConcurrentEventsBase.compute_mydir(__file__)
+
+ @skipIfFreeBSD # timing out on buildbot
+ # Atomic sequences are not supported yet for MIPS in LLDB.
+ @skipIf(triple='^mips')
+ def test(self):
+ """Test two threads that trigger a breakpoint. """
+ self.build(dictionary=self.getBuildFlags())
+ self.do_thread_actions(num_breakpoint_threads=2)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_delay_signal/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_delay_signal/Makefile
new file mode 100644
index 000000000000..4b5e0ee94222
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_delay_signal/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+
+ENABLE_THREADS := YES
+
+VPATH = ..
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_delay_signal/TestConcurrentTwoBreakpointsOneDelaySignal.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_delay_signal/TestConcurrentTwoBreakpointsOneDelaySignal.py
new file mode 100644
index 000000000000..d7630575cb34
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_delay_signal/TestConcurrentTwoBreakpointsOneDelaySignal.py
@@ -0,0 +1,23 @@
+from __future__ import print_function
+
+import unittest2
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.concurrent_base import ConcurrentEventsBase
+from lldbsuite.test.lldbtest import TestBase
+
+
+@skipIfWindows
+class ConcurrentTwoBreakpointsOneDelaySignal(ConcurrentEventsBase):
+
+ mydir = ConcurrentEventsBase.compute_mydir(__file__)
+
+ @skipIfFreeBSD # timing out on buildbot
+ # Atomic sequences are not supported yet for MIPS in LLDB.
+ @skipIf(triple='^mips')
+ def test(self):
+ """Test two threads that trigger a breakpoint and one (1 second delay) signal thread. """
+ self.build(dictionary=self.getBuildFlags())
+ self.do_thread_actions(
+ num_breakpoint_threads=2,
+ num_delay_signal_threads=1)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_signal/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_signal/Makefile
new file mode 100644
index 000000000000..4b5e0ee94222
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_signal/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+
+ENABLE_THREADS := YES
+
+VPATH = ..
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_signal/TestConcurrentTwoBreakpointsOneSignal.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_signal/TestConcurrentTwoBreakpointsOneSignal.py
new file mode 100644
index 000000000000..4c4caa533734
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_signal/TestConcurrentTwoBreakpointsOneSignal.py
@@ -0,0 +1,21 @@
+from __future__ import print_function
+
+import unittest2
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.concurrent_base import ConcurrentEventsBase
+from lldbsuite.test.lldbtest import TestBase
+
+
+@skipIfWindows
+class ConcurrentTwoBreakpointsOneSignal(ConcurrentEventsBase):
+
+ mydir = ConcurrentEventsBase.compute_mydir(__file__)
+
+ @skipIfFreeBSD # timing out on buildbot
+ # Atomic sequences are not supported yet for MIPS in LLDB.
+ @skipIf(triple='^mips')
+ def test(self):
+ """Test two threads that trigger a breakpoint and one signal thread. """
+ self.build(dictionary=self.getBuildFlags())
+ self.do_thread_actions(num_breakpoint_threads=2, num_signal_threads=1)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_watchpoint/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_watchpoint/Makefile
new file mode 100644
index 000000000000..4b5e0ee94222
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_watchpoint/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+
+ENABLE_THREADS := YES
+
+VPATH = ..
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_watchpoint/TestConcurrentTwoBreakpointsOneWatchpoint.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_watchpoint/TestConcurrentTwoBreakpointsOneWatchpoint.py
new file mode 100644
index 000000000000..f26a5dc6f848
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_watchpoint/TestConcurrentTwoBreakpointsOneWatchpoint.py
@@ -0,0 +1,24 @@
+from __future__ import print_function
+
+import unittest2
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.concurrent_base import ConcurrentEventsBase
+from lldbsuite.test.lldbtest import TestBase
+
+
+@skipIfWindows
+class ConcurrentTwoBreakpointsOneWatchpoint(ConcurrentEventsBase):
+
+ mydir = ConcurrentEventsBase.compute_mydir(__file__)
+
+ @skipIfFreeBSD # timing out on buildbot
+ @skipIfRemoteDueToDeadlock
+ # Atomic sequences are not supported yet for MIPS in LLDB.
+ @skipIf(triple='^mips')
+ def test(self):
+ """Test two threads that trigger a breakpoint and one watchpoint thread. """
+ self.build(dictionary=self.getBuildFlags())
+ self.do_thread_actions(
+ num_breakpoint_threads=2,
+ num_watchpoint_threads=1)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoint_threads/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoint_threads/Makefile
new file mode 100644
index 000000000000..4b5e0ee94222
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoint_threads/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+
+ENABLE_THREADS := YES
+
+VPATH = ..
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoint_threads/TestConcurrentTwoWatchpointThreads.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoint_threads/TestConcurrentTwoWatchpointThreads.py
new file mode 100644
index 000000000000..059e077be98c
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoint_threads/TestConcurrentTwoWatchpointThreads.py
@@ -0,0 +1,22 @@
+from __future__ import print_function
+
+import unittest2
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.concurrent_base import ConcurrentEventsBase
+from lldbsuite.test.lldbtest import TestBase
+
+
+@skipIfWindows
+class ConcurrentTwoWatchpointThreads(ConcurrentEventsBase):
+
+ mydir = ConcurrentEventsBase.compute_mydir(__file__)
+
+ @skipIfFreeBSD # timing out on buildbot
+ @skipIfRemoteDueToDeadlock
+ # Atomic sequences are not supported yet for MIPS in LLDB.
+ @skipIf(triple='^mips')
+ def test(self):
+ """Test two threads that trigger a watchpoint. """
+ self.build(dictionary=self.getBuildFlags())
+ self.do_thread_actions(num_watchpoint_threads=2)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_breakpoint/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_breakpoint/Makefile
new file mode 100644
index 000000000000..4b5e0ee94222
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_breakpoint/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+
+ENABLE_THREADS := YES
+
+VPATH = ..
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_breakpoint/TestConcurrentTwoWatchpointsOneBreakpoint.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_breakpoint/TestConcurrentTwoWatchpointsOneBreakpoint.py
new file mode 100644
index 000000000000..4b3c35ea8e68
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_breakpoint/TestConcurrentTwoWatchpointsOneBreakpoint.py
@@ -0,0 +1,24 @@
+from __future__ import print_function
+
+import unittest2
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.concurrent_base import ConcurrentEventsBase
+from lldbsuite.test.lldbtest import TestBase
+
+
+@skipIfWindows
+class ConcurrentTwoWatchpointsOneBreakpoint(ConcurrentEventsBase):
+
+ mydir = ConcurrentEventsBase.compute_mydir(__file__)
+
+ @skipIfFreeBSD # timing out on buildbot
+ @skipIfRemoteDueToDeadlock
+ # Atomic sequences are not supported yet for MIPS in LLDB.
+ @skipIf(triple='^mips')
+ def test(self):
+ """Test two threads that trigger a watchpoint and one breakpoint thread. """
+ self.build(dictionary=self.getBuildFlags())
+ self.do_thread_actions(
+ num_watchpoint_threads=2,
+ num_breakpoint_threads=1)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_delay_breakpoint/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_delay_breakpoint/Makefile
new file mode 100644
index 000000000000..4b5e0ee94222
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_delay_breakpoint/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+
+ENABLE_THREADS := YES
+
+VPATH = ..
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_delay_breakpoint/TestConcurrentTwoWatchpointsOneDelayBreakpoint.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_delay_breakpoint/TestConcurrentTwoWatchpointsOneDelayBreakpoint.py
new file mode 100644
index 000000000000..ae6f64451abf
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_delay_breakpoint/TestConcurrentTwoWatchpointsOneDelayBreakpoint.py
@@ -0,0 +1,24 @@
+from __future__ import print_function
+
+import unittest2
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.concurrent_base import ConcurrentEventsBase
+from lldbsuite.test.lldbtest import TestBase
+
+
+@skipIfWindows
+class ConcurrentTwoWatchpointsOneDelayBreakpoint(ConcurrentEventsBase):
+
+ mydir = ConcurrentEventsBase.compute_mydir(__file__)
+
+ @skipIfFreeBSD # timing out on buildbot
+ @skipIfRemoteDueToDeadlock
+ # Atomic sequences are not supported yet for MIPS in LLDB.
+ @skipIf(triple='^mips')
+ def test(self):
+ """Test two threads that trigger a watchpoint and one (1 second delay) breakpoint thread. """
+ self.build(dictionary=self.getBuildFlags())
+ self.do_thread_actions(
+ num_watchpoint_threads=2,
+ num_delay_breakpoint_threads=1)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_signal/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_signal/Makefile
new file mode 100644
index 000000000000..4b5e0ee94222
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_signal/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+
+ENABLE_THREADS := YES
+
+VPATH = ..
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_signal/TestConcurrentTwoWatchpointsOneSignal.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_signal/TestConcurrentTwoWatchpointsOneSignal.py
new file mode 100644
index 000000000000..78f2dbbc8325
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_signal/TestConcurrentTwoWatchpointsOneSignal.py
@@ -0,0 +1,22 @@
+from __future__ import print_function
+
+import unittest2
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.concurrent_base import ConcurrentEventsBase
+from lldbsuite.test.lldbtest import TestBase
+
+
+@skipIfWindows
+class ConcurrentTwoWatchpointsOneSignal(ConcurrentEventsBase):
+
+ mydir = ConcurrentEventsBase.compute_mydir(__file__)
+
+ @skipIfFreeBSD # timing out on buildbot
+ @skipIfRemoteDueToDeadlock
+ # Atomic sequences are not supported yet for MIPS in LLDB.
+ @skipIf(triple='^mips')
+ def test(self):
+ """Test two threads that trigger a watchpoint and one signal thread. """
+ self.build(dictionary=self.getBuildFlags())
+ self.do_thread_actions(num_watchpoint_threads=2, num_signal_threads=1)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break/Makefile
new file mode 100644
index 000000000000..4b5e0ee94222
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+
+ENABLE_THREADS := YES
+
+VPATH = ..
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break/TestConcurrentWatchBreak.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break/TestConcurrentWatchBreak.py
new file mode 100644
index 000000000000..ffa6909129ad
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break/TestConcurrentWatchBreak.py
@@ -0,0 +1,24 @@
+from __future__ import print_function
+
+import unittest2
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.concurrent_base import ConcurrentEventsBase
+from lldbsuite.test.lldbtest import TestBase
+
+
+@skipIfWindows
+class ConcurrentWatchBreak(ConcurrentEventsBase):
+
+ mydir = ConcurrentEventsBase.compute_mydir(__file__)
+
+ @skipIfFreeBSD # timing out on buildbot
+ @skipIfRemoteDueToDeadlock
+ # Atomic sequences are not supported yet for MIPS in LLDB.
+ @skipIf(triple='^mips')
+ def test(self):
+ """Test watchpoint and a breakpoint in multiple threads."""
+ self.build(dictionary=self.getBuildFlags())
+ self.do_thread_actions(
+ num_breakpoint_threads=1,
+ num_watchpoint_threads=1)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break_delay/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break_delay/Makefile
new file mode 100644
index 000000000000..4b5e0ee94222
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break_delay/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+
+ENABLE_THREADS := YES
+
+VPATH = ..
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break_delay/TestConcurrentWatchBreakDelay.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break_delay/TestConcurrentWatchBreakDelay.py
new file mode 100644
index 000000000000..4c8b5b319ae4
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break_delay/TestConcurrentWatchBreakDelay.py
@@ -0,0 +1,24 @@
+from __future__ import print_function
+
+import unittest2
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.concurrent_base import ConcurrentEventsBase
+from lldbsuite.test.lldbtest import TestBase
+
+
+@skipIfWindows
+class ConcurrentWatchBreakDelay(ConcurrentEventsBase):
+
+ mydir = ConcurrentEventsBase.compute_mydir(__file__)
+
+ @skipIfFreeBSD # timing out on buildbot
+ @skipIfRemoteDueToDeadlock
+ # Atomic sequences are not supported yet for MIPS in LLDB.
+ @skipIf(triple='^mips')
+ def test(self):
+ """Test watchpoint and a (1 second delay) breakpoint in multiple threads."""
+ self.build(dictionary=self.getBuildFlags())
+ self.do_thread_actions(
+ num_delay_breakpoint_threads=1,
+ num_watchpoint_threads=1)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_delay_watchpoint_one_breakpoint/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_delay_watchpoint_one_breakpoint/Makefile
new file mode 100644
index 000000000000..4b5e0ee94222
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_delay_watchpoint_one_breakpoint/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+
+ENABLE_THREADS := YES
+
+VPATH = ..
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_delay_watchpoint_one_breakpoint/TestConcurrentWatchpointDelayWatchpointOneBreakpoint.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_delay_watchpoint_one_breakpoint/TestConcurrentWatchpointDelayWatchpointOneBreakpoint.py
new file mode 100644
index 000000000000..0d545b31230f
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_delay_watchpoint_one_breakpoint/TestConcurrentWatchpointDelayWatchpointOneBreakpoint.py
@@ -0,0 +1,24 @@
+from __future__ import print_function
+
+import unittest2
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.concurrent_base import ConcurrentEventsBase
+from lldbsuite.test.lldbtest import TestBase
+
+
+@skipIfWindows
+class ConcurrentWatchpointDelayWatchpointOneBreakpoint(ConcurrentEventsBase):
+
+ mydir = ConcurrentEventsBase.compute_mydir(__file__)
+
+ @skipIfFreeBSD # timing out on buildbot
+ @skipIfRemoteDueToDeadlock
+ # Atomic sequences are not supported yet for MIPS in LLDB.
+ @skipIf(triple='^mips')
+ def test(self):
+ """Test two threads that trigger a watchpoint (one with a 1 second delay) and one breakpoint thread. """
+ self.build(dictionary=self.getBuildFlags())
+ self.do_thread_actions(num_watchpoint_threads=1,
+ num_delay_watchpoint_threads=1,
+ num_breakpoint_threads=1)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_with_delay_watchpoint_threads/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_with_delay_watchpoint_threads/Makefile
new file mode 100644
index 000000000000..4b5e0ee94222
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_with_delay_watchpoint_threads/Makefile
@@ -0,0 +1,9 @@
+LEVEL = ../../../../make
+
+CXX_SOURCES := main.cpp
+
+ENABLE_THREADS := YES
+
+VPATH = ..
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_with_delay_watchpoint_threads/TestConcurrentWatchpointWithDelayWatchpointThreads.py b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_with_delay_watchpoint_threads/TestConcurrentWatchpointWithDelayWatchpointThreads.py
new file mode 100644
index 000000000000..56cd85da88d3
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_with_delay_watchpoint_threads/TestConcurrentWatchpointWithDelayWatchpointThreads.py
@@ -0,0 +1,23 @@
+from __future__ import print_function
+
+import unittest2
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.concurrent_base import ConcurrentEventsBase
+from lldbsuite.test.lldbtest import TestBase
+
+
+@skipIfWindows
+class ConcurrentWatchpointWithDelayWatchpointThreads(ConcurrentEventsBase):
+
+ mydir = ConcurrentEventsBase.compute_mydir(__file__)
+
+ @skipIfFreeBSD # timing out on buildbot
+ @skipIfRemoteDueToDeadlock
+ # Atomic sequences are not supported yet for MIPS in LLDB.
+ @skipIf(triple='^mips')
+ def test(self):
+ """Test two threads that trigger a watchpoint where one thread has a 1 second delay. """
+ self.build(dictionary=self.getBuildFlags())
+ self.do_thread_actions(num_watchpoint_threads=1,
+ num_delay_watchpoint_threads=1)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py b/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py
index edd1e885ca9e..5343e19ee203 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py
@@ -5,13 +5,13 @@ Test that step-inst over a crash behaves correctly.
from __future__ import print_function
-
import os
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class CreateDuringStepTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -21,9 +21,8 @@ class CreateDuringStepTestCase(TestBase):
self.breakpoint = line_number('main.cpp', '// Set breakpoint here')
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")
- @expectedFailureAndroid("llvm.org/pr24497", archs=['arm', 'aarch64'])
- @expectedFailureAll(oslist=["linux"], archs=["arm"], bugnumber="llvm.org/pr24497")
- @expectedFailureAll(triple = re.compile('^mips')) # IO error due to breakpoint at invalid address
+ # IO error due to breakpoint at invalid address
+ @expectedFailureAll(triple=re.compile('^mips'))
def test_step_inst_with(self):
"""Test thread creation during step-inst handling."""
self.build(dictionary=self.getBuildFlags())
@@ -32,21 +31,34 @@ class CreateDuringStepTestCase(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target and target.IsValid(), "Target is valid")
- self.bp_num = lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.breakpoint, num_expected_locations=1)
+ self.bp_num = lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.breakpoint, num_expected_locations=1)
# Run the program.
- process = target.LaunchSimple(None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process and process.IsValid(), PROCESS_IS_VALID)
# The stop reason should be breakpoint.
- self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ self.assertEqual(
+ process.GetState(),
+ lldb.eStateStopped,
+ PROCESS_STOPPED)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
self.assertTrue(thread.IsValid(), STOPPED_DUE_TO_BREAKPOINT)
# Keep stepping until the inferior crashes
while process.GetState() == lldb.eStateStopped and not lldbutil.is_thread_crashed(self, thread):
thread.StepInstruction(False)
- self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED)
- self.assertTrue(lldbutil.is_thread_crashed(self, thread), "Thread has crashed")
+ self.assertEqual(
+ process.GetState(),
+ lldb.eStateStopped,
+ PROCESS_STOPPED)
+ self.assertTrue(
+ lldbutil.is_thread_crashed(
+ self,
+ thread),
+ "Thread has crashed")
process.Kill()
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py b/packages/Python/lldbsuite/test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py
index 1cb97355395f..fb6208a0d3e5 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/create_after_attach/TestCreateAfterAttach.py
@@ -5,31 +5,33 @@ Test thread creation after process attach.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class CreateAfterAttachTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @skipIfFreeBSD # Hangs. May be the same as Linux issue llvm.org/pr16229 but
- # not yet investigated. Revisit once required functionality
- # is implemented for FreeBSD.
- @skipIfWindows # Occasionally hangs on Windows, may be same as other issues.
+ @skipIfFreeBSD # Hangs. May be the same as Linux issue llvm.org/pr16229 but
+ # not yet investigated. Revisit once required functionality
+ # is implemented for FreeBSD.
+ # Occasionally hangs on Windows, may be same as other issues.
+ @skipIfWindows
@skipIfiOSSimulator
def test_create_after_attach_with_popen(self):
"""Test thread creation after process attach."""
self.build(dictionary=self.getBuildFlags(use_cpp11=False))
self.create_after_attach(use_fork=False)
- @skipIfFreeBSD # Hangs. Revisit once required functionality is implemented
- # for FreeBSD.
+ @skipIfFreeBSD # Hangs. Revisit once required functionality is implemented
+ # for FreeBSD.
@skipIfRemote
- @skipIfWindows # Windows doesn't have fork.
+ @skipIfWindows # Windows doesn't have fork.
@skipIfiOSSimulator
def test_create_after_attach_with_fork(self):
"""Test thread creation after process attach."""
@@ -66,13 +68,16 @@ class CreateAfterAttachTestCase(TestBase):
self.assertTrue(process, PROCESS_IS_VALID)
# This should create a breakpoint in the main thread.
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_1, num_expected_locations=1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.break_1, num_expected_locations=1)
# This should create a breakpoint in the second child thread.
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_2, num_expected_locations=1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.break_2, num_expected_locations=1)
# This should create a breakpoint in the first child thread.
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_3, num_expected_locations=1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.break_3, num_expected_locations=1)
# Note: With std::thread, we cannot rely on particular thread numbers. Using
# std::thread may cause the program to spin up a thread pool (and it does on
@@ -83,10 +88,10 @@ class CreateAfterAttachTestCase(TestBase):
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- '* thread #',
- 'main',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ '* thread #',
+ 'main',
+ 'stop reason = breakpoint'])
# Change a variable to escape the loop
self.runCmd("expression main_thread_continue = 1")
@@ -96,10 +101,10 @@ class CreateAfterAttachTestCase(TestBase):
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- '* thread #',
- 'thread_2_func',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ '* thread #',
+ 'thread_2_func',
+ 'stop reason = breakpoint'])
# Change a variable to escape the loop
self.runCmd("expression child_thread_continue = 1")
@@ -110,13 +115,15 @@ class CreateAfterAttachTestCase(TestBase):
# The stop reason of the thread should be breakpoint.
# Thread 3 may or may not have already exited.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- '* thread #',
- 'thread_1_func',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ '* thread #',
+ 'thread_1_func',
+ 'stop reason = breakpoint'])
# Run to completion
self.runCmd("continue")
# At this point, the inferior process should have exited.
- self.assertTrue(process.GetState() == lldb.eStateExited, PROCESS_EXITED)
+ self.assertTrue(
+ process.GetState() == lldb.eStateExited,
+ PROCESS_EXITED)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/create_during_step/TestCreateDuringStep.py b/packages/Python/lldbsuite/test/functionalities/thread/create_during_step/TestCreateDuringStep.py
index 9401826e304e..f6d6197e1f11 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/create_during_step/TestCreateDuringStep.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/create_during_step/TestCreateDuringStep.py
@@ -5,43 +5,74 @@ Test number of threads.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class CreateDuringStepTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr15824 thread states not properly maintained")
- @expectedFailureAll(oslist=lldbplatformutil.getDarwinOSTriples(), bugnumber="llvm.org/pr15824 thread states not properly maintained")
- @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr18190 thread states not properly maintained")
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24668: Breakpoints not resolved correctly")
+ @expectedFailureAll(
+ oslist=["linux"],
+ bugnumber="llvm.org/pr15824 thread states not properly maintained")
+ @expectedFailureAll(
+ oslist=lldbplatformutil.getDarwinOSTriples(),
+ bugnumber="llvm.org/pr15824 thread states not properly maintained, <rdar://problem/28557237>")
+ @expectedFailureAll(
+ oslist=["freebsd"],
+ bugnumber="llvm.org/pr18190 thread states not properly maintained")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24668: Breakpoints not resolved correctly")
def test_step_inst(self):
"""Test thread creation during step-inst handling."""
self.build(dictionary=self.getBuildFlags())
- self.create_during_step_base("thread step-inst -m all-threads", 'stop reason = instruction step')
-
- @expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr15824 thread states not properly maintained")
- @expectedFailureAll(oslist=lldbplatformutil.getDarwinOSTriples(), bugnumber="llvm.org/pr15824 thread states not properly maintained")
- @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr18190 thread states not properly maintained")
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24668: Breakpoints not resolved correctly")
+ self.create_during_step_base(
+ "thread step-inst -m all-threads",
+ 'stop reason = instruction step')
+
+ @expectedFailureAll(
+ oslist=["linux"],
+ bugnumber="llvm.org/pr15824 thread states not properly maintained")
+ @expectedFailureAll(
+ oslist=lldbplatformutil.getDarwinOSTriples(),
+ bugnumber="llvm.org/pr15824 thread states not properly maintained, <rdar://problem/28557237>")
+ @expectedFailureAll(
+ oslist=["freebsd"],
+ bugnumber="llvm.org/pr18190 thread states not properly maintained")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24668: Breakpoints not resolved correctly")
def test_step_over(self):
"""Test thread creation during step-over handling."""
self.build(dictionary=self.getBuildFlags())
- self.create_during_step_base("thread step-over -m all-threads", 'stop reason = step over')
-
- @expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr15824 thread states not properly maintained")
- @expectedFailureAll(oslist=lldbplatformutil.getDarwinOSTriples(), bugnumber="llvm.org/pr15824 thread states not properly maintained")
- @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr18190 thread states not properly maintained")
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24668: Breakpoints not resolved correctly")
+ self.create_during_step_base(
+ "thread step-over -m all-threads",
+ 'stop reason = step over')
+
+ @expectedFailureAll(
+ oslist=["linux"],
+ bugnumber="llvm.org/pr15824 thread states not properly maintained")
+ @expectedFailureAll(
+ oslist=lldbplatformutil.getDarwinOSTriples(),
+ bugnumber="<rdar://problem/28574077>")
+ @expectedFailureAll(
+ oslist=["freebsd"],
+ bugnumber="llvm.org/pr18190 thread states not properly maintained")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24668: Breakpoints not resolved correctly")
def test_step_in(self):
"""Test thread creation during step-in handling."""
self.build(dictionary=self.getBuildFlags())
- self.create_during_step_base("thread step-in -m all-threads", 'stop reason = step in')
+ self.create_during_step_base(
+ "thread step-in -m all-threads",
+ 'stop reason = step in')
def setUp(self):
# Call super's setUp().
@@ -55,47 +86,33 @@ class CreateDuringStepTestCase(TestBase):
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- # This should create a breakpoint in the stepping thread.
- self.bp_num = lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.breakpoint, num_expected_locations=1)
+ # Get the target process
+ target = self.dbg.GetSelectedTarget()
- # The breakpoint list should show 1 location.
- self.expect("breakpoint list -f", "Breakpoint location shown correctly",
- substrs = ["1: file = 'main.cpp', line = %d, locations = 1" % self.breakpoint])
+ # This should create a breakpoint in the stepping thread.
+ self.bkpt = target.BreakpointCreateByLocation("main.cpp", self.breakpoint)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
- # The stop reason of the thread should be breakpoint.
- self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
-
- # Get the target process
- target = self.dbg.GetSelectedTarget()
process = target.GetProcess()
+ # The stop reason of the thread should be breakpoint.
+ stepping_thread = lldbutil.get_one_thread_stopped_at_breakpoint(process, self.bkpt)
+ self.assertTrue(stepping_thread.IsValid(), "We stopped at the right breakpoint")
+
# Get the number of threads
num_threads = process.GetNumThreads()
# Make sure we see only two threads
- self.assertTrue(num_threads == 2, 'Number of expected threads and actual threads do not match.')
+ self.assertTrue(
+ num_threads == 2,
+ 'Number of expected threads and actual threads do not match.')
# Get the thread objects
thread1 = process.GetThreadAtIndex(0)
thread2 = process.GetThreadAtIndex(1)
- # Make sure both threads are stopped
- self.assertTrue(thread1.IsStopped(), "Thread 1 didn't stop during breakpoint")
- self.assertTrue(thread2.IsStopped(), "Thread 2 didn't stop during breakpoint")
-
- # Find the thread that is stopped at the breakpoint
- stepping_thread = None
- for thread in process:
- expected_bp_desc = "breakpoint %s." % self.bp_num
- if expected_bp_desc in thread.GetStopDescription(100):
- stepping_thread = thread
- break
- self.assertTrue(stepping_thread != None, "unable to find thread stopped at %s" % expected_bp_desc)
current_line = self.breakpoint
# Keep stepping until we've reached our designated continue point
while current_line != self.continuepoint:
@@ -108,21 +125,30 @@ class CreateDuringStepTestCase(TestBase):
current_line = frame.GetLineEntry().GetLine()
# Make sure we're still where we thought we were
- self.assertTrue(current_line >= self.breakpoint, "Stepped to unexpected line, " + str(current_line))
- self.assertTrue(current_line <= self.continuepoint, "Stepped to unexpected line, " + str(current_line))
+ self.assertTrue(
+ current_line >= self.breakpoint,
+ "Stepped to unexpected line, " +
+ str(current_line))
+ self.assertTrue(
+ current_line <= self.continuepoint,
+ "Stepped to unexpected line, " +
+ str(current_line))
# Update the number of threads
num_threads = process.GetNumThreads()
# Check to see that we increased the number of threads as expected
- self.assertTrue(num_threads == 3, 'Number of expected threads and actual threads do not match after thread exit.')
+ self.assertTrue(
+ num_threads == 3,
+ 'Number of expected threads and actual threads do not match after thread exit.')
- self.expect("thread list", 'Process state is stopped due to step',
- substrs = ['stopped',
- step_stop_reason])
+ stop_reason = stepping_thread.GetStopReason()
+ self.assertEqual(stop_reason, lldb.eStopReasonPlanComplete, "Stopped for plan completion")
# Run to completion
self.runCmd("process continue")
# At this point, the inferior process should have exited.
- self.assertTrue(process.GetState() == lldb.eStateExited, PROCESS_EXITED)
+ self.assertTrue(
+ process.GetState() == lldb.eStateExited,
+ PROCESS_EXITED)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/exit_during_break/TestExitDuringBreak.py b/packages/Python/lldbsuite/test/functionalities/thread/exit_during_break/TestExitDuringBreak.py
index 2c394263d36e..5c0544f0ccab 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/exit_during_break/TestExitDuringBreak.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/exit_during_break/TestExitDuringBreak.py
@@ -5,13 +5,14 @@ Test number of threads.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ExitDuringBreakpointTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -22,10 +23,12 @@ class ExitDuringBreakpointTestCase(TestBase):
# Find the line number for our breakpoint.
self.breakpoint = line_number('main.cpp', '// Set breakpoint here')
- @expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr15824 thread states not properly maintained")
- @expectedFailureAll(oslist=lldbplatformutil.getDarwinOSTriples(), bugnumber="llvm.org/pr15824 thread states not properly maintained")
- @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr18190 thread states not properly maintained")
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24668: Breakpoints not resolved correctly")
+ @expectedFailureAll(
+ oslist=["linux"],
+ bugnumber="llvm.org/pr15824 thread states not properly maintained")
+ @expectedFailureAll(
+ oslist=["freebsd"],
+ bugnumber="llvm.org/pr18190 thread states not properly maintained")
def test(self):
"""Test thread exit during breakpoint handling."""
self.build(dictionary=self.getBuildFlags())
@@ -33,19 +36,16 @@ class ExitDuringBreakpointTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# This should create a breakpoint in the main thread.
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.breakpoint, num_expected_locations=1)
-
- # The breakpoint list should show 1 location.
- self.expect("breakpoint list -f", "Breakpoint location shown correctly",
- substrs = ["1: file = 'main.cpp', line = %d, locations = 1" % self.breakpoint])
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.breakpoint, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# Get the target process
target = self.dbg.GetSelectedTarget()
@@ -59,24 +59,14 @@ class ExitDuringBreakpointTestCase(TestBase):
num_threads = process.GetNumThreads()
# Make sure we see at least five threads
- self.assertTrue(num_threads >= 5, 'Number of expected threads and actual threads do not match.')
-
- # Get the thread objects
- thread1 = process.GetThreadAtIndex(0)
- thread2 = process.GetThreadAtIndex(1)
- thread3 = process.GetThreadAtIndex(2)
- thread4 = process.GetThreadAtIndex(3)
- thread5 = process.GetThreadAtIndex(4)
-
- # Make sure all threads are stopped
- self.assertTrue(thread1.IsStopped(), "Thread 1 didn't stop during breakpoint")
- self.assertTrue(thread2.IsStopped(), "Thread 2 didn't stop during breakpoint")
- self.assertTrue(thread3.IsStopped(), "Thread 3 didn't stop during breakpoint")
- self.assertTrue(thread4.IsStopped(), "Thread 4 didn't stop during breakpoint")
- self.assertTrue(thread5.IsStopped(), "Thread 5 didn't stop during breakpoint")
+ self.assertTrue(
+ num_threads >= 5,
+ 'Number of expected threads and actual threads do not match.')
# Run to completion
self.runCmd("continue")
# At this point, the inferior process should have exited.
- self.assertTrue(process.GetState() == lldb.eStateExited, PROCESS_EXITED)
+ self.assertTrue(
+ process.GetState() == lldb.eStateExited,
+ PROCESS_EXITED)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/exit_during_step/TestExitDuringStep.py b/packages/Python/lldbsuite/test/functionalities/thread/exit_during_step/TestExitDuringStep.py
index af4a022ed0c1..4ba04953d6f1 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/exit_during_step/TestExitDuringStep.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/exit_during_step/TestExitDuringStep.py
@@ -5,34 +5,44 @@ Test number of threads.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ExitDuringStepTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @skipIfFreeBSD # llvm.org/pr21411: test is hanging
+ @skipIfFreeBSD # llvm.org/pr21411: test is hanging
def test(self):
"""Test thread exit during step handling."""
self.build(dictionary=self.getBuildFlags())
- self.exit_during_step_base("thread step-inst -m all-threads", 'stop reason = instruction step')
+ self.exit_during_step_base(
+ "thread step-inst -m all-threads",
+ 'stop reason = instruction step',
+ True)
- @skipIfFreeBSD # llvm.org/pr21411: test is hanging
+ @skipIfFreeBSD # llvm.org/pr21411: test is hanging
def test_step_over(self):
"""Test thread exit during step-over handling."""
self.build(dictionary=self.getBuildFlags())
- self.exit_during_step_base("thread step-over -m all-threads", 'stop reason = step over')
+ self.exit_during_step_base(
+ "thread step-over -m all-threads",
+ 'stop reason = step over',
+ False)
- @skipIfFreeBSD # llvm.org/pr21411: test is hanging
+ @skipIfFreeBSD # llvm.org/pr21411: test is hanging
def test_step_in(self):
"""Test thread exit during step-in handling."""
self.build(dictionary=self.getBuildFlags())
- self.exit_during_step_base("thread step-in -m all-threads", 'stop reason = step in')
+ self.exit_during_step_base(
+ "thread step-in -m all-threads",
+ 'stop reason = step in',
+ False)
def setUp(self):
# Call super's setUp().
@@ -41,25 +51,30 @@ class ExitDuringStepTestCase(TestBase):
self.breakpoint = line_number('main.cpp', '// Set breakpoint here')
self.continuepoint = line_number('main.cpp', '// Continue from here')
- def exit_during_step_base(self, step_cmd, step_stop_reason):
+ def exit_during_step_base(self, step_cmd, step_stop_reason, by_instruction):
"""Test thread exit during step handling."""
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# This should create a breakpoint in the main thread.
- self.bp_num = lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.breakpoint, num_expected_locations=1)
+ self.bp_num = lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.breakpoint, num_expected_locations=1)
# The breakpoint list should show 1 location.
- self.expect("breakpoint list -f", "Breakpoint location shown correctly",
- substrs = ["1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % self.breakpoint])
+ self.expect(
+ "breakpoint list -f",
+ "Breakpoint location shown correctly",
+ substrs=[
+ "1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" %
+ self.breakpoint])
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# Get the target process
target = self.dbg.GetSelectedTarget()
@@ -67,14 +82,23 @@ class ExitDuringStepTestCase(TestBase):
num_threads = process.GetNumThreads()
# Make sure we see all three threads
- self.assertGreaterEqual(num_threads, 3, 'Number of expected threads and actual threads do not match.')
+ self.assertGreaterEqual(
+ num_threads,
+ 3,
+ 'Number of expected threads and actual threads do not match.')
- stepping_thread = lldbutil.get_one_thread_stopped_at_breakpoint_id(process, self.bp_num)
- self.assertIsNotNone(stepping_thread, "Could not find a thread stopped at the breakpoint")
+ stepping_thread = lldbutil.get_one_thread_stopped_at_breakpoint_id(
+ process, self.bp_num)
+ self.assertIsNotNone(
+ stepping_thread,
+ "Could not find a thread stopped at the breakpoint")
current_line = self.breakpoint
stepping_frame = stepping_thread.GetFrameAtIndex(0)
- self.assertEqual(current_line, stepping_frame.GetLineEntry().GetLine(), "Starting line for stepping doesn't match breakpoint line.")
+ self.assertEqual(
+ current_line,
+ stepping_frame.GetLineEntry().GetLine(),
+ "Starting line for stepping doesn't match breakpoint line.")
# Keep stepping until we've reached our designated continue point
while current_line != self.continuepoint:
@@ -90,8 +114,19 @@ class ExitDuringStepTestCase(TestBase):
current_line = frame.GetLineEntry().GetLine()
- self.assertGreaterEqual(current_line, self.breakpoint, "Stepped to unexpected line, " + str(current_line))
- self.assertLessEqual(current_line, self.continuepoint, "Stepped to unexpected line, " + str(current_line))
+ if by_instruction and current_line == 0:
+ continue
+
+ self.assertGreaterEqual(
+ current_line,
+ self.breakpoint,
+ "Stepped to unexpected line, " +
+ str(current_line))
+ self.assertLessEqual(
+ current_line,
+ self.continuepoint,
+ "Stepped to unexpected line, " +
+ str(current_line))
self.runCmd("thread list")
@@ -99,11 +134,14 @@ class ExitDuringStepTestCase(TestBase):
new_num_threads = process.GetNumThreads()
# Check to see that we reduced the number of threads as expected
- self.assertEqual(new_num_threads, num_threads-1, 'Number of threads did not reduce by 1 after thread exit.')
+ self.assertEqual(
+ new_num_threads,
+ num_threads - 1,
+ 'Number of threads did not reduce by 1 after thread exit.')
self.expect("thread list", 'Process state is stopped due to step',
- substrs = ['stopped',
- step_stop_reason])
+ substrs=['stopped',
+ step_stop_reason])
# Run to completion
self.runCmd("continue")
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py b/packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py
index 4c55bcd982a7..26ee5d4084eb 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/jump/TestThreadJump.py
@@ -5,13 +5,14 @@ Test jumping to different places.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ThreadJumpTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -29,31 +30,50 @@ class ThreadJumpTestCase(TestBase):
self.mark4 = line_number('main.cpp', '// 4th marker')
self.mark5 = line_number('other.cpp', '// other marker')
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.mark3, num_expected_locations=1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.mark3, num_expected_locations=1)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint 1.
- self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT + " 1",
- substrs=['stopped', 'main.cpp:{}'.format(self.mark3), 'stop reason = breakpoint 1'])
+ self.expect(
+ "thread list",
+ STOPPED_DUE_TO_BREAKPOINT + " 1",
+ substrs=[
+ 'stopped',
+ 'main.cpp:{}'.format(
+ self.mark3),
+ 'stop reason = breakpoint 1'])
- self.do_min_test(self.mark3, self.mark1, "i", "4"); # Try the int path, force it to return 'a'
- self.do_min_test(self.mark3, self.mark2, "i", "5"); # Try the int path, force it to return 'b'
- self.do_min_test(self.mark4, self.mark1, "j", "7"); # Try the double path, force it to return 'a'
- self.do_min_test(self.mark4, self.mark2, "j", "8"); # Try the double path, force it to return 'b'
+ # Try the int path, force it to return 'a'
+ self.do_min_test(self.mark3, self.mark1, "i", "4")
+ # Try the int path, force it to return 'b'
+ self.do_min_test(self.mark3, self.mark2, "i", "5")
+ # Try the double path, force it to return 'a'
+ self.do_min_test(self.mark4, self.mark1, "j", "7")
+ # Try the double path, force it to return 'b'
+ self.do_min_test(self.mark4, self.mark2, "j", "8")
# Try jumping to another function in a different file.
- self.runCmd("thread jump --file other.cpp --line %i --force" % self.mark5)
+ self.runCmd(
+ "thread jump --file other.cpp --line %i --force" %
+ self.mark5)
self.expect("process status",
- substrs = ["at other.cpp:%i" % self.mark5])
+ substrs=["at other.cpp:%i" % self.mark5])
# Try jumping to another function (without forcing)
- self.expect("j main.cpp:%i" % self.mark1, COMMAND_FAILED_AS_EXPECTED, error = True,
- substrs = ["error"])
-
+ self.expect(
+ "j main.cpp:%i" %
+ self.mark1,
+ COMMAND_FAILED_AS_EXPECTED,
+ error=True,
+ substrs=["error"])
+
def do_min_test(self, start, jump, var, value):
- self.runCmd("j %i" % start) # jump to the start marker
+ # jump to the start marker
+ self.runCmd("j %i" % start)
self.runCmd("thread step-in") # step into the min fn
- self.runCmd("j %i" % jump) # jump to the branch we're interested in
+ # jump to the branch we're interested in
+ self.runCmd("j %i" % jump)
self.runCmd("thread step-out") # return out
self.runCmd("thread step-over") # assign to the global
- self.expect("expr %s" % var, substrs = [value]) # check it
+ self.expect("expr %s" % var, substrs=[value]) # check it
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/multi_break/TestMultipleBreakpoints.py b/packages/Python/lldbsuite/test/functionalities/thread/multi_break/TestMultipleBreakpoints.py
index d4b1eb32a9ae..18d88cb52113 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/multi_break/TestMultipleBreakpoints.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/multi_break/TestMultipleBreakpoints.py
@@ -5,13 +5,14 @@ Test number of threads.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class MultipleBreakpointTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -22,10 +23,18 @@ class MultipleBreakpointTestCase(TestBase):
# Find the line number for our breakpoint.
self.breakpoint = line_number('main.cpp', '// Set breakpoint here')
- @expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr15824 thread states not properly maintained")
- @expectedFailureAll(oslist=lldbplatformutil.getDarwinOSTriples(), bugnumber="llvm.org/pr15824 thread states not properly maintained")
- @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr18190 thread states not properly maintained")
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24668: Breakpoints not resolved correctly")
+ @expectedFailureAll(
+ oslist=["linux"],
+ bugnumber="llvm.org/pr15824 thread states not properly maintained")
+ @expectedFailureAll(
+ oslist=lldbplatformutil.getDarwinOSTriples(),
+ bugnumber="llvm.org/pr15824 thread states not properly maintained and <rdar://problem/28557237>")
+ @expectedFailureAll(
+ oslist=["freebsd"],
+ bugnumber="llvm.org/pr18190 thread states not properly maintained")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24668: Breakpoints not resolved correctly")
def test(self):
"""Test simultaneous breakpoints in multiple threads."""
self.build(dictionary=self.getBuildFlags())
@@ -33,11 +42,8 @@ class MultipleBreakpointTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# This should create a breakpoint in the main thread.
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.breakpoint, num_expected_locations=1)
-
- # The breakpoint list should show 1 location.
- self.expect("breakpoint list -f", "Breakpoint location shown correctly",
- substrs = ["1: file = 'main.cpp', line = %d, locations = 1" % self.breakpoint])
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.breakpoint, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -45,8 +51,8 @@ class MultipleBreakpointTestCase(TestBase):
# The stop reason of the thread should be breakpoint.
# The breakpoint may be hit in either thread 2 or thread 3.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# Get the target process
target = self.dbg.GetSelectedTarget()
@@ -56,7 +62,9 @@ class MultipleBreakpointTestCase(TestBase):
num_threads = process.GetNumThreads()
# Make sure we see all three threads
- self.assertTrue(num_threads >= 3, 'Number of expected threads and actual threads do not match.')
+ self.assertTrue(
+ num_threads >= 3,
+ 'Number of expected threads and actual threads do not match.')
# Get the thread objects
thread1 = process.GetThreadAtIndex(0)
@@ -64,9 +72,15 @@ class MultipleBreakpointTestCase(TestBase):
thread3 = process.GetThreadAtIndex(2)
# Make sure both threads are stopped
- self.assertTrue(thread1.IsStopped(), "Primary thread didn't stop during breakpoint")
- self.assertTrue(thread2.IsStopped(), "Secondary thread didn't stop during breakpoint")
- self.assertTrue(thread3.IsStopped(), "Tertiary thread didn't stop during breakpoint")
+ self.assertTrue(
+ thread1.IsStopped(),
+ "Primary thread didn't stop during breakpoint")
+ self.assertTrue(
+ thread2.IsStopped(),
+ "Secondary thread didn't stop during breakpoint")
+ self.assertTrue(
+ thread3.IsStopped(),
+ "Tertiary thread didn't stop during breakpoint")
# Delete the first breakpoint then continue
self.runCmd("breakpoint delete 1")
@@ -75,4 +89,6 @@ class MultipleBreakpointTestCase(TestBase):
self.runCmd("continue")
# At this point, the inferior process should have exited.
- self.assertTrue(process.GetState() == lldb.eStateExited, PROCESS_EXITED)
+ self.assertTrue(
+ process.GetState() == lldb.eStateExited,
+ PROCESS_EXITED)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/state/TestThreadStates.py b/packages/Python/lldbsuite/test/functionalities/thread/state/TestThreadStates.py
index 5afb57bf4ba8..1fb52155c266 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/state/TestThreadStates.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/state/TestThreadStates.py
@@ -5,28 +5,37 @@ Test thread states.
from __future__ import print_function
-
import unittest2
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ThreadStateTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr15824 thread states not properly maintained")
- @expectedFailureAll(oslist=lldbplatformutil.getDarwinOSTriples(), bugnumber="llvm.org/pr15824 thread states not properly maintained")
- @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr18190 thread states not properly maintained")
+ @expectedFailureAll(
+ oslist=["linux"],
+ bugnumber="llvm.org/pr15824 thread states not properly maintained")
+ @expectedFailureAll(
+ oslist=lldbplatformutil.getDarwinOSTriples(),
+ bugnumber="llvm.org/pr15824 thread states not properly maintained and <rdar://problem/28557237>")
+ @expectedFailureAll(
+ oslist=["freebsd"],
+ bugnumber="llvm.org/pr18190 thread states not properly maintained")
def test_state_after_breakpoint(self):
"""Test thread state after breakpoint."""
self.build(dictionary=self.getBuildFlags(use_cpp11=False))
self.thread_state_after_breakpoint_test()
- @skipIfDarwin # 'llvm.org/pr23669', cause Python crash randomly
- @expectedFailureAll(oslist=lldbplatformutil.getDarwinOSTriples(), bugnumber="llvm.org/pr23669")
+ @skipIfDarwin # 'llvm.org/pr23669', cause Python crash randomly
+ @expectedFailureAll(
+ oslist=lldbplatformutil.getDarwinOSTriples(),
+ bugnumber="llvm.org/pr23669")
@expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr15824")
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24660")
def test_state_after_continue(self):
@@ -34,24 +43,31 @@ class ThreadStateTestCase(TestBase):
self.build(dictionary=self.getBuildFlags(use_cpp11=False))
self.thread_state_after_continue_test()
- @skipIfDarwin # 'llvm.org/pr23669', cause Python crash randomly
+ @skipIfDarwin # 'llvm.org/pr23669', cause Python crash randomly
@expectedFailureDarwin('llvm.org/pr23669')
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24660")
- @unittest2.expectedFailure("llvm.org/pr16712") # thread states not properly maintained
+ # thread states not properly maintained
+ @unittest2.expectedFailure("llvm.org/pr16712")
def test_state_after_expression(self):
"""Test thread state after expression."""
self.build(dictionary=self.getBuildFlags(use_cpp11=False))
self.thread_state_after_expression_test()
- @unittest2.expectedFailure("llvm.org/pr16712") # thread states not properly maintained
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24668: Breakpoints not resolved correctly")
+ # thread states not properly maintained
+ @unittest2.expectedFailure("llvm.org/pr16712")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24668: Breakpoints not resolved correctly")
def test_process_interrupt(self):
"""Test process interrupt."""
self.build(dictionary=self.getBuildFlags(use_cpp11=False))
self.process_interrupt_test()
- @unittest2.expectedFailure("llvm.org/pr15824") # thread states not properly maintained
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24668: Breakpoints not resolved correctly")
+ # thread states not properly maintained
+ @unittest2.expectedFailure("llvm.org/pr15824 and <rdar://problem/28557237>")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24668: Breakpoints not resolved correctly")
def test_process_state(self):
"""Test thread states (comprehensive)."""
self.build(dictionary=self.getBuildFlags(use_cpp11=False))
@@ -70,7 +86,8 @@ class ThreadStateTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# This should create a breakpoint in the main thread.
- bp = lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_1, num_expected_locations=1)
+ bp = lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.break_1, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -79,12 +96,16 @@ class ThreadStateTestCase(TestBase):
target = self.dbg.GetSelectedTarget()
process = target.GetProcess()
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
self.assertIsNotNone(thread)
# Make sure the thread is in the stopped state.
- self.assertTrue(thread.IsStopped(), "Thread state isn't \'stopped\' during breakpoint 1.")
- self.assertFalse(thread.IsSuspended(), "Thread state is \'suspended\' during breakpoint 1.")
+ self.assertTrue(
+ thread.IsStopped(),
+ "Thread state isn't \'stopped\' during breakpoint 1.")
+ self.assertFalse(thread.IsSuspended(),
+ "Thread state is \'suspended\' during breakpoint 1.")
# Kill the process
self.runCmd("process kill")
@@ -92,8 +113,12 @@ class ThreadStateTestCase(TestBase):
def wait_for_running_event(self, process):
listener = self.dbg.GetListener()
if lldb.remote_platform:
- lldbutil.expect_state_changes(self, listener, process, [lldb.eStateConnected])
- lldbutil.expect_state_changes(self, listener, process, [lldb.eStateRunning])
+ lldbutil.expect_state_changes(
+ self, listener, process, [
+ lldb.eStateConnected])
+ lldbutil.expect_state_changes(
+ self, listener, process, [
+ lldb.eStateRunning])
def thread_state_after_continue_test(self):
"""Test thread state after continue."""
@@ -101,8 +126,10 @@ class ThreadStateTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# This should create a breakpoint in the main thread.
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_1, num_expected_locations=1)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_2, num_expected_locations=1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.break_1, num_expected_locations=1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.break_2, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -111,17 +138,23 @@ class ThreadStateTestCase(TestBase):
target = self.dbg.GetSelectedTarget()
process = target.GetProcess()
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
self.assertIsNotNone(thread)
- # Continue, the inferior will go into an infinite loop waiting for 'g_test' to change.
+ # Continue, the inferior will go into an infinite loop waiting for
+ # 'g_test' to change.
self.dbg.SetAsync(True)
self.runCmd("continue")
self.wait_for_running_event(process)
# Check the thread state. It should be running.
- self.assertFalse(thread.IsStopped(), "Thread state is \'stopped\' when it should be running.")
- self.assertFalse(thread.IsSuspended(), "Thread state is \'suspended\' when it should be running.")
+ self.assertFalse(
+ thread.IsStopped(),
+ "Thread state is \'stopped\' when it should be running.")
+ self.assertFalse(
+ thread.IsSuspended(),
+ "Thread state is \'suspended\' when it should be running.")
# Go back to synchronous interactions
self.dbg.SetAsync(False)
@@ -135,8 +168,10 @@ class ThreadStateTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# This should create a breakpoint in the main thread.
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_1, num_expected_locations=1)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_2, num_expected_locations=1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.break_1, num_expected_locations=1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.break_2, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -145,27 +180,32 @@ class ThreadStateTestCase(TestBase):
target = self.dbg.GetSelectedTarget()
process = target.GetProcess()
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
self.assertIsNotNone(thread)
# Get the inferior out of its loop
self.runCmd("expression g_test = 1")
# Check the thread state
- self.assertTrue(thread.IsStopped(), "Thread state isn't \'stopped\' after expression evaluation.")
- self.assertFalse(thread.IsSuspended(), "Thread state is \'suspended\' after expression evaluation.")
+ self.assertTrue(
+ thread.IsStopped(),
+ "Thread state isn't \'stopped\' after expression evaluation.")
+ self.assertFalse(
+ thread.IsSuspended(),
+ "Thread state is \'suspended\' after expression evaluation.")
# Let the process run to completion
self.runCmd("process continue")
-
def process_interrupt_test(self):
"""Test process interrupt and continue."""
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# This should create a breakpoint in the main thread.
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_1, num_expected_locations=1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.break_1, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -174,10 +214,12 @@ class ThreadStateTestCase(TestBase):
target = self.dbg.GetSelectedTarget()
process = target.GetProcess()
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
self.assertIsNotNone(thread)
- # Continue, the inferior will go into an infinite loop waiting for 'g_test' to change.
+ # Continue, the inferior will go into an infinite loop waiting for
+ # 'g_test' to change.
self.dbg.SetAsync(True)
self.runCmd("continue")
self.wait_for_running_event(process)
@@ -202,8 +244,10 @@ class ThreadStateTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# This should create a breakpoint in the main thread.
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_1, num_expected_locations=1)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_2, num_expected_locations=1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.break_1, num_expected_locations=1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.break_2, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -211,21 +255,30 @@ class ThreadStateTestCase(TestBase):
# Get the target process
target = self.dbg.GetSelectedTarget()
process = target.GetProcess()
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
self.assertIsNotNone(thread)
# Make sure the thread is in the stopped state.
- self.assertTrue(thread.IsStopped(), "Thread state isn't \'stopped\' during breakpoint 1.")
- self.assertFalse(thread.IsSuspended(), "Thread state is \'suspended\' during breakpoint 1.")
-
- # Continue, the inferior will go into an infinite loop waiting for 'g_test' to change.
+ self.assertTrue(
+ thread.IsStopped(),
+ "Thread state isn't \'stopped\' during breakpoint 1.")
+ self.assertFalse(thread.IsSuspended(),
+ "Thread state is \'suspended\' during breakpoint 1.")
+
+ # Continue, the inferior will go into an infinite loop waiting for
+ # 'g_test' to change.
self.dbg.SetAsync(True)
self.runCmd("continue")
self.wait_for_running_event(process)
# Check the thread state. It should be running.
- self.assertFalse(thread.IsStopped(), "Thread state is \'stopped\' when it should be running.")
- self.assertFalse(thread.IsSuspended(), "Thread state is \'suspended\' when it should be running.")
+ self.assertFalse(
+ thread.IsStopped(),
+ "Thread state is \'stopped\' when it should be running.")
+ self.assertFalse(
+ thread.IsSuspended(),
+ "Thread state is \'suspended\' when it should be running.")
# Go back to synchronous interactions
self.dbg.SetAsync(False)
@@ -236,15 +289,22 @@ class ThreadStateTestCase(TestBase):
self.assertEqual(thread.GetState(), lldb.eStopReasonSignal)
# Check the thread state
- self.assertTrue(thread.IsStopped(), "Thread state isn't \'stopped\' after process stop.")
- self.assertFalse(thread.IsSuspended(), "Thread state is \'suspended\' after process stop.")
+ self.assertTrue(
+ thread.IsStopped(),
+ "Thread state isn't \'stopped\' after process stop.")
+ self.assertFalse(thread.IsSuspended(),
+ "Thread state is \'suspended\' after process stop.")
# Get the inferior out of its loop
self.runCmd("expression g_test = 1")
# Check the thread state
- self.assertTrue(thread.IsStopped(), "Thread state isn't \'stopped\' after expression evaluation.")
- self.assertFalse(thread.IsSuspended(), "Thread state is \'suspended\' after expression evaluation.")
+ self.assertTrue(
+ thread.IsStopped(),
+ "Thread state isn't \'stopped\' after expression evaluation.")
+ self.assertFalse(
+ thread.IsSuspended(),
+ "Thread state is \'suspended\' after expression evaluation.")
self.assertEqual(thread.GetState(), lldb.eStopReasonSignal)
@@ -254,8 +314,11 @@ class ThreadStateTestCase(TestBase):
self.assertEqual(thread.GetState(), lldb.eStopReasonBreakpoint)
# Make sure both threads are stopped
- self.assertTrue(thread.IsStopped(), "Thread state isn't \'stopped\' during breakpoint 2.")
- self.assertFalse(thread.IsSuspended(), "Thread state is \'suspended\' during breakpoint 2.")
+ self.assertTrue(
+ thread.IsStopped(),
+ "Thread state isn't \'stopped\' during breakpoint 2.")
+ self.assertFalse(thread.IsSuspended(),
+ "Thread state is \'suspended\' during breakpoint 2.")
# Run to completion
self.runCmd("continue")
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/step_out/TestThreadStepOut.py b/packages/Python/lldbsuite/test/functionalities/thread/step_out/TestThreadStepOut.py
index 735ee80d624e..f043013b90ce 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/step_out/TestThreadStepOut.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/step_out/TestThreadStepOut.py
@@ -5,38 +5,54 @@ Test stepping out from a function in a multi-threaded program.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ThreadStepOutTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @skipIfLinux # Test occasionally times out on the Linux build bot
- @expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr23477 Test occasionally times out on the Linux build bot")
- @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr18066 inferior does not exit")
+ # Test occasionally times out on the Linux build bot
+ @skipIfLinux
+ @expectedFailureAll(
+ oslist=["linux"],
+ bugnumber="llvm.org/pr23477 Test occasionally times out on the Linux build bot")
+ @expectedFailureAll(
+ oslist=["freebsd"],
+ bugnumber="llvm.org/pr18066 inferior does not exit")
@expectedFailureAll(oslist=["windows"])
def test_step_single_thread(self):
"""Test thread step out on one thread via command interpreter. """
self.build(dictionary=self.getBuildFlags())
self.step_out_test(self.step_out_single_thread_with_cmd)
- @skipIfLinux # Test occasionally times out on the Linux build bot
- @expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr23477 Test occasionally times out on the Linux build bot")
- @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr19347 2nd thread stops at breakpoint")
+ # Test occasionally times out on the Linux build bot
+ @skipIfLinux
+ @expectedFailureAll(
+ oslist=["linux"],
+ bugnumber="llvm.org/pr23477 Test occasionally times out on the Linux build bot")
+ @expectedFailureAll(
+ oslist=["freebsd"],
+ bugnumber="llvm.org/pr19347 2nd thread stops at breakpoint")
@expectedFailureAll(oslist=["windows"])
def test_step_all_threads(self):
"""Test thread step out on all threads via command interpreter. """
self.build(dictionary=self.getBuildFlags())
self.step_out_test(self.step_out_all_threads_with_cmd)
- @skipIfLinux # Test occasionally times out on the Linux build bot
- @expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr23477 Test occasionally times out on the Linux build bot")
- @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr19347 2nd thread stops at breakpoint")
+ # Test occasionally times out on the Linux build bot
+ @skipIfLinux
+ @expectedFailureAll(
+ oslist=["linux"],
+ bugnumber="llvm.org/pr23477 Test occasionally times out on the Linux build bot")
+ @expectedFailureAll(
+ oslist=["freebsd"],
+ bugnumber="llvm.org/pr19347 2nd thread stops at breakpoint")
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24681")
def test_python(self):
"""Test thread step out on one thread via Python API (dwarf)."""
@@ -48,43 +64,63 @@ class ThreadStepOutTestCase(TestBase):
TestBase.setUp(self)
# Find the line number for our breakpoint.
self.breakpoint = line_number('main.cpp', '// Set breakpoint here')
- if "gcc" in self.getCompiler() or self.isIntelCompiler():
- self.step_out_destination = line_number('main.cpp', '// Expect to stop here after step-out (icc and gcc)')
+ if "gcc" in self.getCompiler() or self.isIntelCompiler():
+ self.step_out_destination = line_number(
+ 'main.cpp', '// Expect to stop here after step-out (icc and gcc)')
else:
- self.step_out_destination = line_number('main.cpp', '// Expect to stop here after step-out (clang)')
+ self.step_out_destination = line_number(
+ 'main.cpp', '// Expect to stop here after step-out (clang)')
def step_out_single_thread_with_cmd(self):
self.step_out_with_cmd("this-thread")
- self.expect("thread backtrace all", "Thread location after step out is correct",
- substrs = ["main.cpp:%d" % self.step_out_destination,
- "main.cpp:%d" % self.breakpoint])
+ self.expect(
+ "thread backtrace all",
+ "Thread location after step out is correct",
+ substrs=[
+ "main.cpp:%d" %
+ self.step_out_destination,
+ "main.cpp:%d" %
+ self.breakpoint])
def step_out_all_threads_with_cmd(self):
self.step_out_with_cmd("all-threads")
- self.expect("thread backtrace all", "Thread location after step out is correct",
- substrs = ["main.cpp:%d" % self.step_out_destination])
+ self.expect(
+ "thread backtrace all",
+ "Thread location after step out is correct",
+ substrs=[
+ "main.cpp:%d" %
+ self.step_out_destination])
def step_out_with_cmd(self, run_mode):
self.runCmd("thread select %d" % self.step_out_thread.GetIndexID())
self.runCmd("thread step-out -m %s" % run_mode)
self.expect("process status", "Expected stop reason to be step-out",
- substrs = ["stop reason = step out"])
+ substrs=["stop reason = step out"])
- self.expect("thread list", "Selected thread did not change during step-out",
- substrs = ["* thread #%d" % self.step_out_thread.GetIndexID()])
+ self.expect(
+ "thread list",
+ "Selected thread did not change during step-out",
+ substrs=[
+ "* thread #%d" %
+ self.step_out_thread.GetIndexID()])
def step_out_with_python(self):
self.step_out_thread.StepOut()
reason = self.step_out_thread.GetStopReason()
- self.assertEqual(lldb.eStopReasonPlanComplete, reason,
- "Expected thread stop reason 'plancomplete', but got '%s'" % lldbutil.stop_reason_to_str(reason))
+ self.assertEqual(
+ lldb.eStopReasonPlanComplete,
+ reason,
+ "Expected thread stop reason 'plancomplete', but got '%s'" %
+ lldbutil.stop_reason_to_str(reason))
# Verify location after stepping out
frame = self.step_out_thread.GetFrameAtIndex(0)
desc = lldbutil.get_description(frame.GetLineEntry())
expect = "main.cpp:%d" % self.step_out_destination
- self.assertTrue(expect in desc, "Expected %s but thread stopped at %s" % (expect, desc))
+ self.assertTrue(
+ expect in desc, "Expected %s but thread stopped at %s" %
+ (expect, desc))
def step_out_test(self, step_out_func):
"""Test single thread step out of a function."""
@@ -92,11 +128,16 @@ class ThreadStepOutTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# This should create a breakpoint in the main thread.
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.breakpoint, num_expected_locations=1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.breakpoint, num_expected_locations=1)
# The breakpoint list should show 1 location.
- self.expect("breakpoint list -f", "Breakpoint location shown correctly",
- substrs = ["1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % self.breakpoint])
+ self.expect(
+ "breakpoint list -f",
+ "Breakpoint location shown correctly",
+ substrs=[
+ "1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" %
+ self.breakpoint])
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -107,7 +148,10 @@ class ThreadStepOutTestCase(TestBase):
# Get the number of threads, ensure we see all three.
num_threads = self.inferior_process.GetNumThreads()
- self.assertEqual(num_threads, 3, 'Number of expected threads and actual threads do not match.')
+ self.assertEqual(
+ num_threads,
+ 3,
+ 'Number of expected threads and actual threads do not match.')
(breakpoint_threads, other_threads) = ([], [])
lldbutil.sort_stopped_threads(self.inferior_process,
@@ -115,10 +159,12 @@ class ThreadStepOutTestCase(TestBase):
other_threads=other_threads)
while len(breakpoint_threads) < 2:
- self.runCmd("thread continue %s" % " ".join([str(x.GetIndexID()) for x in other_threads]))
- lldbutil.sort_stopped_threads(self.inferior_process,
- breakpoint_threads=breakpoint_threads,
- other_threads=other_threads)
+ self.runCmd("thread continue %s" %
+ " ".join([str(x.GetIndexID()) for x in other_threads]))
+ lldbutil.sort_stopped_threads(
+ self.inferior_process,
+ breakpoint_threads=breakpoint_threads,
+ other_threads=other_threads)
self.step_out_thread = breakpoint_threads[0]
@@ -129,4 +175,5 @@ class ThreadStepOutTestCase(TestBase):
self.runCmd("continue")
# At this point, the inferior process should have exited.
- self.assertTrue(self.inferior_process.GetState() == lldb.eStateExited, PROCESS_EXITED)
+ self.assertTrue(self.inferior_process.GetState() ==
+ lldb.eStateExited, PROCESS_EXITED)
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/step_until/Makefile b/packages/Python/lldbsuite/test/functionalities/thread/step_until/Makefile
new file mode 100644
index 000000000000..b09a579159d4
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/step_until/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+C_SOURCES := main.c
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/step_until/TestStepUntil.py b/packages/Python/lldbsuite/test/functionalities/thread/step_until/TestStepUntil.py
new file mode 100644
index 000000000000..ec34c9985d3e
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/step_until/TestStepUntil.py
@@ -0,0 +1,92 @@
+"""Test stepping over vrs. hitting breakpoints & subsequent stepping in various forms."""
+
+from __future__ import print_function
+
+
+import os
+import time
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestCStepping(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def getCategories(self):
+ return ['basic_process']
+
+ def setUp(self):
+ # Call super's setUp().
+ TestBase.setUp(self)
+ # Find the line numbers that we will step to in main:
+ self.main_source = "main.c"
+ self.less_than_two = line_number('main.c', 'Less than 2')
+ self.greater_than_two = line_number('main.c', 'Greater than or equal to 2.')
+ self.back_out_in_main = line_number('main.c', 'Back out in main')
+
+ def do_until (self, args, until_lines, expected_linenum):
+ self.build()
+ exe = os.path.join(os.getcwd(), "a.out")
+
+ target = self.dbg.CreateTarget(exe)
+ self.assertTrue(target, VALID_TARGET)
+
+ main_source_spec = lldb.SBFileSpec(self.main_source)
+ break_before = target.BreakpointCreateBySourceRegex(
+ 'At the start',
+ main_source_spec)
+ self.assertTrue(break_before, VALID_BREAKPOINT)
+
+ # Now launch the process, and do not stop at entry point.
+ process = target.LaunchSimple(
+ args, None, self.get_process_working_directory())
+
+ self.assertTrue(process, PROCESS_IS_VALID)
+
+ # The stop reason of the thread should be breakpoint.
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ process, break_before)
+
+ if len(threads) != 1:
+ self.fail("Failed to stop at first breakpoint in main.")
+
+ thread = threads[0]
+ return thread
+
+ thread = self.common_setup(None)
+
+ cmd_interp = self.dbg.GetCommandInterpreter()
+ ret_obj = lldb.SBCommandReturnObject()
+
+ cmd_line = "thread until"
+ for line_num in until_lines:
+ cmd_line += " %d"%(line_num)
+
+ cmd_interp.HandleCommand(cmd_line, ret_obj)
+ self.assertTrue(ret_obj.Succeeded(), "'%s' failed: %s."%(cmd_line, ret_obj.GetError()))
+
+ frame = thread.frames[0]
+ line = frame.GetLineEntry().GetLine()
+ self.assertEqual(line, expected_linenum, 'Did not get the expected stop line number')
+
+ def test_hitting_one (self):
+ """Test thread step until - targeting one line and hitting it."""
+ self.do_until(None, [self.less_than_two], self.less_than_two)
+
+ def test_targetting_two_hitting_first (self):
+ """Test thread step until - targeting two lines and hitting one."""
+ self.do_until(["foo", "bar", "baz"], [self.less_than_two, self.greater_than_two], self.greater_than_two)
+
+ def test_targetting_two_hitting_second (self):
+ """Test thread step until - targeting two lines and hitting the other one."""
+ self.do_until(None, [self.less_than_two, self.greater_than_two], self.less_than_two)
+
+ def test_missing_one (self):
+ """Test thread step until - targeting one line and missing it."""
+ self.do_until(["foo", "bar", "baz"], [self.less_than_two], self.back_out_in_main)
+
+
+
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/step_until/main.c b/packages/Python/lldbsuite/test/functionalities/thread/step_until/main.c
new file mode 100644
index 000000000000..e0b4d8ab951e
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/thread/step_until/main.c
@@ -0,0 +1,20 @@
+#include <stdio.h>
+
+void call_me(int argc)
+{
+ printf ("At the start, argc: %d.\n", argc);
+
+ if (argc < 2)
+ printf("Less than 2.\n");
+ else
+ printf("Greater than or equal to 2.\n");
+}
+
+int
+main(int argc, char **argv)
+{
+ call_me(argc);
+ printf("Back out in main.\n");
+
+ return 0;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/thread_exit/TestThreadExit.py b/packages/Python/lldbsuite/test/functionalities/thread/thread_exit/TestThreadExit.py
index 2ba6f2e57f2b..deedc4b7507a 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/thread_exit/TestThreadExit.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/thread_exit/TestThreadExit.py
@@ -5,12 +5,13 @@ Test number of threads.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class ThreadExitTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -31,17 +32,28 @@ class ThreadExitTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# This should create a breakpoint with 1 location.
- bp1_id = lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_1, num_expected_locations=1)
- bp2_id = lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_2, num_expected_locations=1)
- bp3_id = lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_3, num_expected_locations=1)
- bp4_id = lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_4, num_expected_locations=1)
+ bp1_id = lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.break_1, num_expected_locations=1)
+ bp2_id = lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.break_2, num_expected_locations=1)
+ bp3_id = lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.break_3, num_expected_locations=1)
+ bp4_id = lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.break_4, num_expected_locations=1)
# The breakpoint list should show 1 locations.
- self.expect("breakpoint list -f", "Breakpoint location shown correctly",
- substrs = ["1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % self.break_1,
- "2: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % self.break_2,
- "3: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % self.break_3,
- "4: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % self.break_4])
+ self.expect(
+ "breakpoint list -f",
+ "Breakpoint location shown correctly",
+ substrs=[
+ "1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" %
+ self.break_1,
+ "2: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" %
+ self.break_2,
+ "3: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" %
+ self.break_3,
+ "4: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" %
+ self.break_4])
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -49,39 +61,59 @@ class ThreadExitTestCase(TestBase):
target = self.dbg.GetSelectedTarget()
process = target.GetProcess()
- stopped_thread = lldbutil.get_one_thread_stopped_at_breakpoint_id(process, bp1_id)
- self.assertIsNotNone(stopped_thread, "Process is not stopped at breakpoint 1")
+ stopped_thread = lldbutil.get_one_thread_stopped_at_breakpoint_id(
+ process, bp1_id)
+ self.assertIsNotNone(stopped_thread,
+ "Process is not stopped at breakpoint 1")
# Get the number of threads
num_threads = process.GetNumThreads()
- self.assertGreaterEqual(num_threads, 2, 'Number of expected threads and actual threads do not match at breakpoint 1.')
+ self.assertGreaterEqual(
+ num_threads,
+ 2,
+ 'Number of expected threads and actual threads do not match at breakpoint 1.')
# Run to the second breakpoint
self.runCmd("continue")
- stopped_thread = lldbutil.get_one_thread_stopped_at_breakpoint_id(process, bp2_id)
- self.assertIsNotNone(stopped_thread, "Process is not stopped at breakpoint 2")
+ stopped_thread = lldbutil.get_one_thread_stopped_at_breakpoint_id(
+ process, bp2_id)
+ self.assertIsNotNone(stopped_thread,
+ "Process is not stopped at breakpoint 2")
# Update the number of threads
new_num_threads = process.GetNumThreads()
- self.assertEqual(new_num_threads, num_threads+1, 'Number of expected threads did not increase by 1 at bp 2.')
+ self.assertEqual(
+ new_num_threads,
+ num_threads + 1,
+ 'Number of expected threads did not increase by 1 at bp 2.')
# Run to the third breakpoint
self.runCmd("continue")
- stopped_thread = lldbutil.get_one_thread_stopped_at_breakpoint_id(process, bp3_id)
- self.assertIsNotNone(stopped_thread, "Process is not stopped at breakpoint 3")
+ stopped_thread = lldbutil.get_one_thread_stopped_at_breakpoint_id(
+ process, bp3_id)
+ self.assertIsNotNone(stopped_thread,
+ "Process is not stopped at breakpoint 3")
# Update the number of threads
new_num_threads = process.GetNumThreads()
- self.assertEqual(new_num_threads, num_threads, 'Number of expected threads is not equal to original number of threads at bp 3.')
+ self.assertEqual(
+ new_num_threads,
+ num_threads,
+ 'Number of expected threads is not equal to original number of threads at bp 3.')
# Run to the fourth breakpoint
self.runCmd("continue")
- stopped_thread = lldbutil.get_one_thread_stopped_at_breakpoint_id(process, bp4_id)
- self.assertIsNotNone(stopped_thread, "Process is not stopped at breakpoint 4")
+ stopped_thread = lldbutil.get_one_thread_stopped_at_breakpoint_id(
+ process, bp4_id)
+ self.assertIsNotNone(stopped_thread,
+ "Process is not stopped at breakpoint 4")
# Update the number of threads
new_num_threads = process.GetNumThreads()
- self.assertEqual(new_num_threads, num_threads-1, 'Number of expected threads did not decrease by 1 at bp 4.')
+ self.assertEqual(
+ new_num_threads,
+ num_threads - 1,
+ 'Number of expected threads did not decrease by 1 at bp 4.')
# Run to completion
self.runCmd("continue")
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py b/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py
index 12bacabd0d78..0377b0c0a80e 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py
@@ -5,14 +5,15 @@ Test that we obey thread conditioned breakpoints.
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ThreadSpecificBreakTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -30,24 +31,42 @@ class ThreadSpecificBreakTestCase(TestBase):
# This test works by setting a breakpoint in a function conditioned to stop only on
# the main thread, and then calling this function on a secondary thread, joining,
# and then calling again on the main thread. If the thread specific breakpoint works
- # then it should not be hit on the secondary thread, only on the main thread.
-
- main_source_spec = lldb.SBFileSpec ("main.cpp")
-
- main_breakpoint = target.BreakpointCreateBySourceRegex("Set main breakpoint here", main_source_spec);
- thread_breakpoint = target.BreakpointCreateBySourceRegex("Set thread-specific breakpoint here", main_source_spec)
-
- self.assertTrue(main_breakpoint.IsValid(), "Failed to set main breakpoint.")
- self.assertGreater(main_breakpoint.GetNumLocations(), 0, "main breakpoint has no locations associated with it.")
- self.assertTrue(thread_breakpoint.IsValid(), "Failed to set thread breakpoint.")
- self.assertGreater(thread_breakpoint.GetNumLocations(), 0, "thread breakpoint has no locations associated with it.")
-
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ # then it should not be hit on the secondary thread, only on the main
+ # thread.
+
+ main_source_spec = lldb.SBFileSpec("main.cpp")
+
+ main_breakpoint = target.BreakpointCreateBySourceRegex(
+ "Set main breakpoint here", main_source_spec)
+ thread_breakpoint = target.BreakpointCreateBySourceRegex(
+ "Set thread-specific breakpoint here", main_source_spec)
+
+ self.assertTrue(
+ main_breakpoint.IsValid(),
+ "Failed to set main breakpoint.")
+ self.assertGreater(
+ main_breakpoint.GetNumLocations(),
+ 0,
+ "main breakpoint has no locations associated with it.")
+ self.assertTrue(
+ thread_breakpoint.IsValid(),
+ "Failed to set thread breakpoint.")
+ self.assertGreater(
+ thread_breakpoint.GetNumLocations(),
+ 0,
+ "thread breakpoint has no locations associated with it.")
+
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
- stopped_threads = lldbutil.get_threads_stopped_at_breakpoint(process, main_breakpoint)
- self.assertEqual(len(stopped_threads), 1, "main breakpoint stopped at unexpected number of threads")
+ stopped_threads = lldbutil.get_threads_stopped_at_breakpoint(
+ process, main_breakpoint)
+ self.assertEqual(
+ len(stopped_threads),
+ 1,
+ "main breakpoint stopped at unexpected number of threads")
main_thread = stopped_threads[0]
main_thread_id = main_thread.GetThreadID()
@@ -58,7 +77,17 @@ class ThreadSpecificBreakTestCase(TestBase):
process.Continue()
next_stop_state = process.GetState()
- self.assertEqual(next_stop_state, lldb.eStateStopped, "We should have stopped at the thread breakpoint.")
- stopped_threads = lldbutil.get_threads_stopped_at_breakpoint(process, thread_breakpoint)
- self.assertEqual(len(stopped_threads), 1, "thread breakpoint stopped at unexpected number of threads")
- self.assertEqual(stopped_threads[0].GetThreadID(), main_thread_id, "thread breakpoint stopped at the wrong thread")
+ self.assertEqual(
+ next_stop_state,
+ lldb.eStateStopped,
+ "We should have stopped at the thread breakpoint.")
+ stopped_threads = lldbutil.get_threads_stopped_at_breakpoint(
+ process, thread_breakpoint)
+ self.assertEqual(
+ len(stopped_threads),
+ 1,
+ "thread breakpoint stopped at unexpected number of threads")
+ self.assertEqual(
+ stopped_threads[0].GetThreadID(),
+ main_thread_id,
+ "thread breakpoint stopped at the wrong thread")
diff --git a/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break_plus_condition/TestThreadSpecificBpPlusCondition.py b/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break_plus_condition/TestThreadSpecificBpPlusCondition.py
index ccb58c965b3f..da9ba59f9924 100644
--- a/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break_plus_condition/TestThreadSpecificBpPlusCondition.py
+++ b/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break_plus_condition/TestThreadSpecificBpPlusCondition.py
@@ -6,20 +6,23 @@ conditioned breakpoints simultaneously
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ThreadSpecificBreakPlusConditionTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @skipIfFreeBSD # test frequently times out or hangs
- @expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr18522') # hits break in another thread in testrun
+ # test frequently times out or hangs
+ @skipIf(oslist=['windows', 'freebsd'])
+ # hits break in another thread in testrun
+ @expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr18522')
@add_test_categories(['pyapi'])
def test_python(self):
"""Test that we obey thread conditioned breakpoints."""
@@ -29,18 +32,24 @@ class ThreadSpecificBreakPlusConditionTestCase(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- main_source_spec = lldb.SBFileSpec ("main.cpp")
+ main_source_spec = lldb.SBFileSpec("main.cpp")
- # Set a breakpoint in the thread body, and make it active for only the first thread.
- break_thread_body = target.BreakpointCreateBySourceRegex ("Break here in thread body.", main_source_spec)
- self.assertTrue (break_thread_body.IsValid() and break_thread_body.GetNumLocations() > 0, "Failed to set thread body breakpoint.")
+ # Set a breakpoint in the thread body, and make it active for only the
+ # first thread.
+ break_thread_body = target.BreakpointCreateBySourceRegex(
+ "Break here in thread body.", main_source_spec)
+ self.assertTrue(
+ break_thread_body.IsValid() and break_thread_body.GetNumLocations() > 0,
+ "Failed to set thread body breakpoint.")
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
- threads = lldbutil.get_threads_stopped_at_breakpoint (process, break_thread_body)
-
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ process, break_thread_body)
+
victim_thread = threads[0]
# Pick one of the threads, and change the breakpoint so it ONLY stops for this thread,
@@ -51,14 +60,18 @@ class ThreadSpecificBreakPlusConditionTestCase(TestBase):
frame = victim_thread.GetFrameAtIndex(0)
value = frame.FindVariable("my_value").GetValueAsSigned(0)
- self.assertTrue (value > 0 and value < 11, "Got a reasonable value for my_value.")
+ self.assertTrue(
+ value > 0 and value < 11,
+ "Got a reasonable value for my_value.")
- cond_string = "my_value != %d"%(value)
+ cond_string = "my_value != %d" % (value)
break_thread_body.SetThreadID(victim_thread.GetThreadID())
- break_thread_body.SetCondition (cond_string)
+ break_thread_body.SetCondition(cond_string)
process.Continue()
next_stop_state = process.GetState()
- self.assertTrue (next_stop_state == lldb.eStateExited, "We should have not hit the breakpoint again.")
+ self.assertTrue(
+ next_stop_state == lldb.eStateExited,
+ "We should have not hit the breakpoint again.")
diff --git a/packages/Python/lldbsuite/test/functionalities/tsan/basic/TestTsanBasic.py b/packages/Python/lldbsuite/test/functionalities/tsan/basic/TestTsanBasic.py
index 44fa9cedc86c..f1689a8fda00 100644
--- a/packages/Python/lldbsuite/test/functionalities/tsan/basic/TestTsanBasic.py
+++ b/packages/Python/lldbsuite/test/functionalities/tsan/basic/TestTsanBasic.py
@@ -2,25 +2,28 @@
Tests basic ThreadSanitizer support (detecting a data race).
"""
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
import lldbsuite.test.lldbutil as lldbutil
import json
+
class TsanBasicTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @expectedFailureAll(oslist=["linux"], bugnumber="non-core functionality, need to reenable and fix later (DES 2014.11.07)")
- @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default
+ @expectedFailureAll(
+ oslist=["linux"],
+ bugnumber="non-core functionality, need to reenable and fix later (DES 2014.11.07)")
+ @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default
@skipIfRemote
- @skipUnlessCompilerRt
@skipUnlessThreadSanitizer
- def test (self):
- self.build ()
- self.tsan_tests ()
+ def test(self):
+ self.build()
+ self.tsan_tests()
def setUp(self):
# Call super's setUp().
@@ -29,26 +32,33 @@ class TsanBasicTestCase(TestBase):
self.line_thread1 = line_number('main.c', '// thread1 line')
self.line_thread2 = line_number('main.c', '// thread2 line')
- def tsan_tests (self):
- exe = os.path.join (os.getcwd(), "a.out")
- self.expect("file " + exe, patterns = [ "Current executable set to .*a.out" ])
+ def tsan_tests(self):
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.expect(
+ "file " + exe,
+ patterns=["Current executable set to .*a.out"])
self.runCmd("run")
stop_reason = self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason()
if stop_reason == lldb.eStopReasonExec:
- # On OS X 10.10 and older, we need to re-exec to enable interceptors.
+ # On OS X 10.10 and older, we need to re-exec to enable
+ # interceptors.
self.runCmd("continue")
# the stop reason of the thread should be breakpoint.
self.expect("thread list", "A data race should be detected",
- substrs = ['stopped', 'stop reason = Data race detected'])
+ substrs=['stopped', 'stop reason = Data race detected'])
- self.assertEqual(self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason(), lldb.eStopReasonInstrumentation)
+ self.assertEqual(
+ self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason(),
+ lldb.eStopReasonInstrumentation)
# test that the TSan dylib is present
- self.expect("image lookup -n __tsan_get_current_report", "__tsan_get_current_report should be present",
- substrs = ['1 match found'])
+ self.expect(
+ "image lookup -n __tsan_get_current_report",
+ "__tsan_get_current_report should be present",
+ substrs=['1 match found'])
# We should be stopped in __tsan_on_report
process = self.dbg.GetSelectedTarget().process
@@ -56,7 +66,8 @@ class TsanBasicTestCase(TestBase):
frame = thread.GetSelectedFrame()
self.assertTrue("__tsan_on_report" in frame.GetFunctionName())
- # The stopped thread backtrace should contain either line1 or line2 from main.c.
+ # The stopped thread backtrace should contain either line1 or line2
+ # from main.c.
found = False
for i in range(0, thread.GetNumFrames()):
frame = thread.GetFrameAtIndex(i)
@@ -67,8 +78,13 @@ class TsanBasicTestCase(TestBase):
found = True
self.assertTrue(found)
- self.expect("thread info -s", "The extended stop info should contain the TSan provided fields",
- substrs = ["instrumentation_class", "description", "mops"])
+ self.expect(
+ "thread info -s",
+ "The extended stop info should contain the TSan provided fields",
+ substrs=[
+ "instrumentation_class",
+ "description",
+ "mops"])
output_lines = self.res.GetOutput().split('\n')
json_line = '\n'.join(output_lines[2:])
@@ -77,10 +93,12 @@ class TsanBasicTestCase(TestBase):
self.assertEqual(data["issue_type"], "data-race")
self.assertEqual(len(data["mops"]), 2)
- backtraces = thread.GetStopReasonExtendedBacktraces(lldb.eInstrumentationRuntimeTypeAddressSanitizer)
+ backtraces = thread.GetStopReasonExtendedBacktraces(
+ lldb.eInstrumentationRuntimeTypeAddressSanitizer)
self.assertEqual(backtraces.GetSize(), 0)
- backtraces = thread.GetStopReasonExtendedBacktraces(lldb.eInstrumentationRuntimeTypeThreadSanitizer)
+ backtraces = thread.GetStopReasonExtendedBacktraces(
+ lldb.eInstrumentationRuntimeTypeThreadSanitizer)
self.assertTrue(backtraces.GetSize() >= 2)
# First backtrace is a memory operation
@@ -111,8 +129,8 @@ class TsanBasicTestCase(TestBase):
# the stop reason of the thread should be a SIGABRT.
self.expect("thread list", "We should be stopped due a SIGABRT",
- substrs = ['stopped', 'stop reason = signal SIGABRT'])
+ substrs=['stopped', 'stop reason = signal SIGABRT'])
# test that we're in pthread_kill now (TSan abort the process)
self.expect("thread list", "We should be stopped in pthread_kill",
- substrs = ['pthread_kill'])
+ substrs=['pthread_kill'])
diff --git a/packages/Python/lldbsuite/test/functionalities/tsan/cpp_global_location/TestTsanCPPGlobalLocation.py b/packages/Python/lldbsuite/test/functionalities/tsan/cpp_global_location/TestTsanCPPGlobalLocation.py
index 230ff982da0d..8baba9beed36 100644
--- a/packages/Python/lldbsuite/test/functionalities/tsan/cpp_global_location/TestTsanCPPGlobalLocation.py
+++ b/packages/Python/lldbsuite/test/functionalities/tsan/cpp_global_location/TestTsanCPPGlobalLocation.py
@@ -2,47 +2,58 @@
Tests that TSan correctly reports the filename and line number of a racy global C++ variable.
"""
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
import lldbsuite.test.lldbutil as lldbutil
import json
+
class TsanCPPGlobalLocationTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @expectedFailureAll(oslist=["linux"], bugnumber="non-core functionality, need to reenable and fix later (DES 2014.11.07)")
- @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default
+ @expectedFailureAll(
+ oslist=["linux"],
+ bugnumber="non-core functionality, need to reenable and fix later (DES 2014.11.07)")
+ @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default
@skipIfRemote
- @skipUnlessCompilerRt
@skipUnlessThreadSanitizer
- def test (self):
- self.build ()
- self.tsan_tests ()
+ def test(self):
+ self.build()
+ self.tsan_tests()
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
- def tsan_tests (self):
- exe = os.path.join (os.getcwd(), "a.out")
- self.expect("file " + exe, patterns = [ "Current executable set to .*a.out" ])
+ def tsan_tests(self):
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.expect(
+ "file " + exe,
+ patterns=["Current executable set to .*a.out"])
self.runCmd("run")
stop_reason = self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason()
if stop_reason == lldb.eStopReasonExec:
- # On OS X 10.10 and older, we need to re-exec to enable interceptors.
+ # On OS X 10.10 and older, we need to re-exec to enable
+ # interceptors.
self.runCmd("continue")
# the stop reason of the thread should be breakpoint.
self.expect("thread list", "A data race should be detected",
- substrs = ['stopped', 'stop reason = Data race detected'])
+ substrs=['stopped', 'stop reason = Data race detected'])
- self.expect("thread info -s", "The extended stop info should contain the TSan provided fields",
- substrs = ["instrumentation_class", "description", "mops"])
+ self.expect(
+ "thread info -s",
+ "The extended stop info should contain the TSan provided fields",
+ substrs=[
+ "instrumentation_class",
+ "description",
+ "mops"])
output_lines = self.res.GetOutput().split('\n')
json_line = '\n'.join(output_lines[2:])
@@ -51,4 +62,8 @@ class TsanCPPGlobalLocationTestCase(TestBase):
self.assertEqual(data["issue_type"], "data-race")
self.assertTrue(data["location_filename"].endswith("/main.cpp"))
- self.assertEqual(data["location_line"], line_number('main.cpp', '// global variable'))
+ self.assertEqual(
+ data["location_line"],
+ line_number(
+ 'main.cpp',
+ '// global variable'))
diff --git a/packages/Python/lldbsuite/test/functionalities/tsan/global_location/TestTsanGlobalLocation.py b/packages/Python/lldbsuite/test/functionalities/tsan/global_location/TestTsanGlobalLocation.py
index b268c46fead3..3f0cae6a54c9 100644
--- a/packages/Python/lldbsuite/test/functionalities/tsan/global_location/TestTsanGlobalLocation.py
+++ b/packages/Python/lldbsuite/test/functionalities/tsan/global_location/TestTsanGlobalLocation.py
@@ -2,53 +2,68 @@
Tests that TSan correctly reports the filename and line number of a racy global variable.
"""
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
import lldbsuite.test.lldbutil as lldbutil
import json
+
class TsanGlobalLocationTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @expectedFailureAll(oslist=["linux"], bugnumber="non-core functionality, need to reenable and fix later (DES 2014.11.07)")
- @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default
+ @expectedFailureAll(
+ oslist=["linux"],
+ bugnumber="non-core functionality, need to reenable and fix later (DES 2014.11.07)")
+ @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default
@skipIfRemote
- @skipUnlessCompilerRt
@skipUnlessThreadSanitizer
- def test (self):
- self.build ()
- self.tsan_tests ()
+ def test(self):
+ self.build()
+ self.tsan_tests()
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
- def tsan_tests (self):
- exe = os.path.join (os.getcwd(), "a.out")
- self.expect("file " + exe, patterns = [ "Current executable set to .*a.out" ])
+ def tsan_tests(self):
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.expect(
+ "file " + exe,
+ patterns=["Current executable set to .*a.out"])
self.runCmd("run")
stop_reason = self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason()
if stop_reason == lldb.eStopReasonExec:
- # On OS X 10.10 and older, we need to re-exec to enable interceptors.
+ # On OS X 10.10 and older, we need to re-exec to enable
+ # interceptors.
self.runCmd("continue")
# the stop reason of the thread should be breakpoint.
self.expect("thread list", "A data race should be detected",
- substrs = ['stopped', 'stop reason = Data race detected'])
+ substrs=['stopped', 'stop reason = Data race detected'])
- self.expect("thread info -s", "The extended stop info should contain the TSan provided fields",
- substrs = ["instrumentation_class", "description", "mops"])
+ self.expect(
+ "thread info -s",
+ "The extended stop info should contain the TSan provided fields",
+ substrs=[
+ "instrumentation_class",
+ "description",
+ "mops"])
output_lines = self.res.GetOutput().split('\n')
json_line = '\n'.join(output_lines[2:])
data = json.loads(json_line)
self.assertEqual(data["instrumentation_class"], "ThreadSanitizer")
self.assertEqual(data["issue_type"], "data-race")
-
+
self.assertTrue(data["location_filename"].endswith("/main.c"))
- self.assertEqual(data["location_line"], line_number('main.c', '// global variable'))
+ self.assertEqual(
+ data["location_line"],
+ line_number(
+ 'main.c',
+ '// global variable'))
diff --git a/packages/Python/lldbsuite/test/functionalities/tsan/multiple/TestTsanMultiple.py b/packages/Python/lldbsuite/test/functionalities/tsan/multiple/TestTsanMultiple.py
index c22501141cca..436fcf63d07d 100644
--- a/packages/Python/lldbsuite/test/functionalities/tsan/multiple/TestTsanMultiple.py
+++ b/packages/Python/lldbsuite/test/functionalities/tsan/multiple/TestTsanMultiple.py
@@ -2,33 +2,38 @@
Test ThreadSanitizer when multiple different issues are found.
"""
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
import lldbsuite.test.lldbutil as lldbutil
import json
+
class TsanMultipleTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @expectedFailureAll(oslist=["linux"], bugnumber="non-core functionality, need to reenable and fix later (DES 2014.11.07)")
- @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default
+ @expectedFailureAll(
+ oslist=["linux"],
+ bugnumber="non-core functionality, need to reenable and fix later (DES 2014.11.07)")
+ @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default
@skipIfRemote
- @skipUnlessCompilerRt
@skipUnlessThreadSanitizer
- def test (self):
- self.build ()
- self.tsan_tests ()
+ def test(self):
+ self.build()
+ self.tsan_tests()
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
- def tsan_tests (self):
- exe = os.path.join (os.getcwd(), "a.out")
- self.expect("file " + exe, patterns = [ "Current executable set to .*a.out" ])
+ def tsan_tests(self):
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.expect(
+ "file " + exe,
+ patterns=["Current executable set to .*a.out"])
self.runCmd("env TSAN_OPTIONS=abort_on_error=0")
@@ -36,34 +41,46 @@ class TsanMultipleTestCase(TestBase):
stop_reason = self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason()
if stop_reason == lldb.eStopReasonExec:
- # On OS X 10.10 and older, we need to re-exec to enable interceptors.
+ # On OS X 10.10 and older, we need to re-exec to enable
+ # interceptors.
self.runCmd("continue")
report_count = 0
- while self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason() == lldb.eStopReasonInstrumentation:
+ while self.dbg.GetSelectedTarget().process.GetSelectedThread(
+ ).GetStopReason() == lldb.eStopReasonInstrumentation:
report_count += 1
- stop_description = self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopDescription(100)
+ stop_description = self.dbg.GetSelectedTarget(
+ ).process.GetSelectedThread().GetStopDescription(100)
self.assertTrue(
- (stop_description == "Data race detected") or
- (stop_description == "Use of deallocated memory detected") or
- (stop_description == "Thread leak detected") or
- (stop_description == "Use of an uninitialized or destroyed mutex detected") or
- (stop_description == "Unlock of an unlocked mutex (or by a wrong thread) detected")
+ (stop_description == "Data race detected") or
+ (stop_description == "Use of deallocated memory detected") or
+ (stop_description == "Thread leak detected") or
+ (stop_description == "Use of an uninitialized or destroyed mutex detected") or
+ (stop_description == "Unlock of an unlocked mutex (or by a wrong thread) detected")
)
- self.expect("thread info -s", "The extended stop info should contain the TSan provided fields",
- substrs = ["instrumentation_class", "description", "mops"])
+ self.expect(
+ "thread info -s",
+ "The extended stop info should contain the TSan provided fields",
+ substrs=[
+ "instrumentation_class",
+ "description",
+ "mops"])
output_lines = self.res.GetOutput().split('\n')
json_line = '\n'.join(output_lines[2:])
data = json.loads(json_line)
self.assertEqual(data["instrumentation_class"], "ThreadSanitizer")
- backtraces = self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReasonExtendedBacktraces(lldb.eInstrumentationRuntimeTypeThreadSanitizer)
+ backtraces = self.dbg.GetSelectedTarget().process.GetSelectedThread(
+ ).GetStopReasonExtendedBacktraces(lldb.eInstrumentationRuntimeTypeThreadSanitizer)
self.assertTrue(backtraces.GetSize() >= 1)
self.runCmd("continue")
- self.assertEqual(self.dbg.GetSelectedTarget().process.GetState(), lldb.eStateExited, PROCESS_EXITED)
+ self.assertEqual(
+ self.dbg.GetSelectedTarget().process.GetState(),
+ lldb.eStateExited,
+ PROCESS_EXITED)
diff --git a/packages/Python/lldbsuite/test/functionalities/tsan/thread_leak/TestTsanThreadLeak.py b/packages/Python/lldbsuite/test/functionalities/tsan/thread_leak/TestTsanThreadLeak.py
index ed620093c1f3..f4380cf7749a 100644
--- a/packages/Python/lldbsuite/test/functionalities/tsan/thread_leak/TestTsanThreadLeak.py
+++ b/packages/Python/lldbsuite/test/functionalities/tsan/thread_leak/TestTsanThreadLeak.py
@@ -2,39 +2,47 @@
Tests ThreadSanitizer's support to detect a leaked thread.
"""
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
import lldbsuite.test.lldbutil as lldbutil
import json
+
class TsanThreadLeakTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @expectedFailureAll(oslist=["linux"], bugnumber="non-core functionality, need to reenable and fix later (DES 2014.11.07)")
- @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default
+ @expectedFailureAll(
+ oslist=["linux"],
+ bugnumber="non-core functionality, need to reenable and fix later (DES 2014.11.07)")
+ @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default
@skipIfRemote
- @skipUnlessCompilerRt
@skipUnlessThreadSanitizer
- def test (self):
- self.build ()
- self.tsan_tests ()
+ def test(self):
+ self.build()
+ self.tsan_tests()
- def tsan_tests (self):
- exe = os.path.join (os.getcwd(), "a.out")
- self.expect("file " + exe, patterns = [ "Current executable set to .*a.out" ])
+ def tsan_tests(self):
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.expect(
+ "file " + exe,
+ patterns=["Current executable set to .*a.out"])
self.runCmd("run")
stop_reason = self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason()
if stop_reason == lldb.eStopReasonExec:
- # On OS X 10.10 and older, we need to re-exec to enable interceptors.
+ # On OS X 10.10 and older, we need to re-exec to enable
+ # interceptors.
self.runCmd("continue")
# the stop reason of the thread should be breakpoint.
self.expect("thread list", "A thread leak should be detected",
- substrs = ['stopped', 'stop reason = Thread leak detected'])
+ substrs=['stopped', 'stop reason = Thread leak detected'])
- self.assertEqual(self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason(), lldb.eStopReasonInstrumentation)
+ self.assertEqual(
+ self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason(),
+ lldb.eStopReasonInstrumentation)
diff --git a/packages/Python/lldbsuite/test/functionalities/tsan/thread_numbers/TestTsanThreadNumbers.py b/packages/Python/lldbsuite/test/functionalities/tsan/thread_numbers/TestTsanThreadNumbers.py
index c7905bcb1c1d..684e6f71d931 100644
--- a/packages/Python/lldbsuite/test/functionalities/tsan/thread_numbers/TestTsanThreadNumbers.py
+++ b/packages/Python/lldbsuite/test/functionalities/tsan/thread_numbers/TestTsanThreadNumbers.py
@@ -2,51 +2,65 @@
Tests that TSan and LLDB have correct thread numbers.
"""
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
import lldbsuite.test.lldbutil as lldbutil
import json
+
class TsanThreadNumbersTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @expectedFailureAll(oslist=["linux"], bugnumber="non-core functionality, need to reenable and fix later (DES 2014.11.07)")
- @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default
+ @expectedFailureAll(
+ oslist=["linux"],
+ bugnumber="non-core functionality, need to reenable and fix later (DES 2014.11.07)")
+ @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default
@skipIfRemote
- @skipUnlessCompilerRt
@skipUnlessThreadSanitizer
- def test (self):
- self.build ()
- self.tsan_tests ()
+ def test(self):
+ self.build()
+ self.tsan_tests()
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
- def tsan_tests (self):
- exe = os.path.join (os.getcwd(), "a.out")
- self.expect("file " + exe, patterns = [ "Current executable set to .*a.out" ])
+ def tsan_tests(self):
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.expect(
+ "file " + exe,
+ patterns=["Current executable set to .*a.out"])
self.runCmd("run")
stop_reason = self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason()
if stop_reason == lldb.eStopReasonExec:
- # On OS X 10.10 and older, we need to re-exec to enable interceptors.
+ # On OS X 10.10 and older, we need to re-exec to enable
+ # interceptors.
self.runCmd("continue")
# the stop reason of the thread should be breakpoint.
self.expect("thread list", "A data race should be detected",
- substrs = ['stopped', 'stop reason = Data race detected'])
+ substrs=['stopped', 'stop reason = Data race detected'])
- self.assertEqual(self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason(), lldb.eStopReasonInstrumentation)
+ self.assertEqual(
+ self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason(),
+ lldb.eStopReasonInstrumentation)
- report_thread_id = self.dbg.GetSelectedTarget().process.GetSelectedThread().GetIndexID()
+ report_thread_id = self.dbg.GetSelectedTarget(
+ ).process.GetSelectedThread().GetIndexID()
- self.expect("thread info -s", "The extended stop info should contain the TSan provided fields",
- substrs = ["instrumentation_class", "description", "mops"])
+ self.expect(
+ "thread info -s",
+ "The extended stop info should contain the TSan provided fields",
+ substrs=[
+ "instrumentation_class",
+ "description",
+ "mops"])
output_lines = self.res.GetOutput().split('\n')
json_line = '\n'.join(output_lines[2:])
@@ -59,10 +73,15 @@ class TsanThreadNumbersTestCase(TestBase):
other_thread_id = data["mops"][1]["thread_id"]
self.assertTrue(other_thread_id != report_thread_id)
- other_thread = self.dbg.GetSelectedTarget().process.GetThreadByIndexID(other_thread_id)
+ other_thread = self.dbg.GetSelectedTarget(
+ ).process.GetThreadByIndexID(other_thread_id)
self.assertTrue(other_thread.IsValid())
self.runCmd("thread select %d" % other_thread_id)
- self.expect("thread backtrace", "The other thread should be stopped in f1 or f2",
- substrs = ["a.out", "main.c"])
+ self.expect(
+ "thread backtrace",
+ "The other thread should be stopped in f1 or f2",
+ substrs=[
+ "a.out",
+ "main.c"])
diff --git a/packages/Python/lldbsuite/test/functionalities/tty/Makefile b/packages/Python/lldbsuite/test/functionalities/tty/Makefile
new file mode 100644
index 000000000000..0d70f2595019
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/tty/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../make
+
+C_SOURCES := main.c
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/tty/TestTerminal.py b/packages/Python/lldbsuite/test/functionalities/tty/TestTerminal.py
index cebba1b4c573..f0ecd464de1d 100644
--- a/packages/Python/lldbsuite/test/functionalities/tty/TestTerminal.py
+++ b/packages/Python/lldbsuite/test/functionalities/tty/TestTerminal.py
@@ -5,14 +5,15 @@ Test lldb command aliases.
from __future__ import print_function
-
import unittest2
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class LaunchInTerminalTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -21,21 +22,31 @@ class LaunchInTerminalTestCase(TestBase):
# a program in a separate terminal window. It would be great if other platforms
# added support for this.
@skipUnlessDarwin
- @expectedFailureDarwin("llvm.org/pr25484")
# If the test is being run under sudo, the spawned terminal won't retain that elevated
# privilege so it can't open the socket to talk back to the test case
- @unittest2.skipIf(hasattr(os, 'geteuid') and os.geteuid() == 0, "test cannot be run as root")
+ @unittest2.skipIf(hasattr(os, 'geteuid') and os.geteuid()
+ == 0, "test cannot be run as root")
# Do we need to disable this test if the testsuite is being run on a remote system?
- # This env var is only defined when the shell is running in a local mac terminal window
- @unittest2.skipUnless('TERM_PROGRAM' in os.environ, "test must be run on local system")
+ # This env var is only defined when the shell is running in a local mac
+ # terminal window
+ @unittest2.skipUnless(
+ 'TERM_PROGRAM' in os.environ,
+ "test must be run on local system")
@no_debug_info_test
- def test_launch_in_terminal (self):
- exe = "/bin/ls"
+ def test_launch_in_terminal(self):
+ self.build()
+ exe = os.path.join(os.getcwd(), "a.out")
+
target = self.dbg.CreateTarget(exe)
launch_info = lldb.SBLaunchInfo(["-lAF", "/tmp/"])
- launch_info.SetLaunchFlags(lldb.eLaunchFlagLaunchInTTY | lldb.eLaunchFlagCloseTTYOnExit)
+ launch_info.SetLaunchFlags(
+ lldb.eLaunchFlagLaunchInTTY | lldb.eLaunchFlagCloseTTYOnExit)
error = lldb.SBError()
- process = target.Launch (launch_info, error)
- self.assertTrue(error.Success(), "Make sure launch happened successfully in a terminal window")
- # Running in synchronous mode our process should have run and already exited by the time target.Launch() returns
+ process = target.Launch(launch_info, error)
+ print("Error was: %s."%(error.GetCString()))
+ self.assertTrue(
+ error.Success(),
+ "Make sure launch happened successfully in a terminal window")
+ # Running in synchronous mode our process should have run and already
+ # exited by the time target.Launch() returns
self.assertTrue(process.GetState() == lldb.eStateExited)
diff --git a/packages/Python/lldbsuite/test/functionalities/tty/main.c b/packages/Python/lldbsuite/test/functionalities/tty/main.c
new file mode 100644
index 000000000000..71c854b5bf40
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/tty/main.c
@@ -0,0 +1,10 @@
+#include <stdio.h>
+
+int
+main(int argc, char** argv)
+{
+ for (int i = 0; i < argc; i++) {
+ printf("%d: %s.\n", i, argv[i]);
+ }
+ return 0;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/type_completion/TestTypeCompletion.py b/packages/Python/lldbsuite/test/functionalities/type_completion/TestTypeCompletion.py
index 2bf10204ea6b..8d6311e42b93 100644
--- a/packages/Python/lldbsuite/test/functionalities/type_completion/TestTypeCompletion.py
+++ b/packages/Python/lldbsuite/test/functionalities/type_completion/TestTypeCompletion.py
@@ -5,32 +5,37 @@ Check that types only get completed when necessary.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TypeCompletionTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @expectedFailureAll(compiler="icc", bugnumber="often fails with 'NameAndAddress should be valid.")
- # Fails with gcc 4.8.1 with llvm.org/pr15301 LLDB prints incorrect sizes of STL containers
+ @expectedFailureAll(
+ compiler="icc",
+ bugnumber="often fails with 'NameAndAddress should be valid.")
+ # Fails with gcc 4.8.1 with llvm.org/pr15301 LLDB prints incorrect sizes
+ # of STL containers
def test_with_run_command(self):
"""Check that types only get completed when necessary."""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_source_regexp (self, "// Set break point at this line.")
+ lldbutil.run_break_set_by_source_regexp(
+ self, "// Set break point at this line.")
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -42,68 +47,112 @@ class TypeCompletionTestCase(TestBase):
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
- p_vector = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame().FindVariable('p')
+ p_vector = self.dbg.GetSelectedTarget().GetProcess(
+ ).GetSelectedThread().GetSelectedFrame().FindVariable('p')
p_type = p_vector.GetType()
- self.assertFalse(p_type.IsTypeComplete(), 'vector<T> complete but it should not be')
+ self.assertFalse(
+ p_type.IsTypeComplete(),
+ 'vector<T> complete but it should not be')
self.runCmd("continue")
- p_vector = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame().FindVariable('p')
+ p_vector = self.dbg.GetSelectedTarget().GetProcess(
+ ).GetSelectedThread().GetSelectedFrame().FindVariable('p')
p_type = p_vector.GetType()
- self.assertFalse(p_type.IsTypeComplete(), 'vector<T> complete but it should not be')
+ self.assertFalse(
+ p_type.IsTypeComplete(),
+ 'vector<T> complete but it should not be')
self.runCmd("continue")
self.runCmd("frame variable p --show-types")
- p_vector = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame().FindVariable('p')
+ p_vector = self.dbg.GetSelectedTarget().GetProcess(
+ ).GetSelectedThread().GetSelectedFrame().FindVariable('p')
p_type = p_vector.GetType()
- self.assertTrue(p_type.IsTypeComplete(), 'vector<T> should now be complete')
+ self.assertTrue(
+ p_type.IsTypeComplete(),
+ 'vector<T> should now be complete')
name_address_type = p_type.GetTemplateArgumentType(0)
- self.assertTrue(name_address_type.IsValid(), 'NameAndAddress should be valid')
- self.assertFalse(name_address_type.IsTypeComplete(), 'NameAndAddress complete but it should not be')
+ self.assertTrue(
+ name_address_type.IsValid(),
+ 'NameAndAddress should be valid')
+ self.assertFalse(
+ name_address_type.IsTypeComplete(),
+ 'NameAndAddress complete but it should not be')
self.runCmd("continue")
self.runCmd("frame variable guy --show-types")
- p_vector = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame().FindVariable('p')
+ p_vector = self.dbg.GetSelectedTarget().GetProcess(
+ ).GetSelectedThread().GetSelectedFrame().FindVariable('p')
p_type = p_vector.GetType()
- self.assertTrue(p_type.IsTypeComplete(), 'vector<T> should now be complete')
+ self.assertTrue(
+ p_type.IsTypeComplete(),
+ 'vector<T> should now be complete')
name_address_type = p_type.GetTemplateArgumentType(0)
- self.assertTrue(name_address_type.IsValid(), 'NameAndAddress should be valid')
- self.assertTrue(name_address_type.IsTypeComplete(), 'NameAndAddress should now be complete')
+ self.assertTrue(
+ name_address_type.IsValid(),
+ 'NameAndAddress should be valid')
+ self.assertTrue(
+ name_address_type.IsTypeComplete(),
+ 'NameAndAddress should now be complete')
field0 = name_address_type.GetFieldAtIndex(0)
- self.assertTrue(field0.IsValid(), 'NameAndAddress::m_name should be valid')
+ self.assertTrue(
+ field0.IsValid(),
+ 'NameAndAddress::m_name should be valid')
string = field0.GetType().GetPointeeType()
self.assertTrue(string.IsValid(), 'CustomString should be valid')
- self.assertFalse(string.IsTypeComplete(), 'CustomString complete but it should not be')
+ self.assertFalse(string.IsTypeComplete(),
+ 'CustomString complete but it should not be')
self.runCmd("continue")
- p_vector = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame().FindVariable('p')
+ p_vector = self.dbg.GetSelectedTarget().GetProcess(
+ ).GetSelectedThread().GetSelectedFrame().FindVariable('p')
p_type = p_vector.GetType()
- self.assertTrue(p_type.IsTypeComplete(), 'vector<T> should now be complete')
+ self.assertTrue(
+ p_type.IsTypeComplete(),
+ 'vector<T> should now be complete')
name_address_type = p_type.GetTemplateArgumentType(0)
- self.assertTrue(name_address_type.IsValid(), 'NameAndAddress should be valid')
- self.assertTrue(name_address_type.IsTypeComplete(), 'NameAndAddress should now be complete')
+ self.assertTrue(
+ name_address_type.IsValid(),
+ 'NameAndAddress should be valid')
+ self.assertTrue(
+ name_address_type.IsTypeComplete(),
+ 'NameAndAddress should now be complete')
field0 = name_address_type.GetFieldAtIndex(0)
- self.assertTrue(field0.IsValid(), 'NameAndAddress::m_name should be valid')
+ self.assertTrue(
+ field0.IsValid(),
+ 'NameAndAddress::m_name should be valid')
string = field0.GetType().GetPointeeType()
self.assertTrue(string.IsValid(), 'CustomString should be valid')
- self.assertFalse(string.IsTypeComplete(), 'CustomString complete but it should not be')
+ self.assertFalse(string.IsTypeComplete(),
+ 'CustomString complete but it should not be')
self.runCmd('type category enable -l c++', check=False)
self.runCmd('frame variable guy --show-types --ptr-depth=1')
- p_vector = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame().FindVariable('p')
+ p_vector = self.dbg.GetSelectedTarget().GetProcess(
+ ).GetSelectedThread().GetSelectedFrame().FindVariable('p')
p_type = p_vector.GetType()
- self.assertTrue(p_type.IsTypeComplete(), 'vector<T> should now be complete')
+ self.assertTrue(
+ p_type.IsTypeComplete(),
+ 'vector<T> should now be complete')
name_address_type = p_type.GetTemplateArgumentType(0)
- self.assertTrue(name_address_type.IsValid(), 'NameAndAddress should be valid')
- self.assertTrue(name_address_type.IsTypeComplete(), 'NameAndAddress should now be complete')
+ self.assertTrue(
+ name_address_type.IsValid(),
+ 'NameAndAddress should be valid')
+ self.assertTrue(
+ name_address_type.IsTypeComplete(),
+ 'NameAndAddress should now be complete')
field0 = name_address_type.GetFieldAtIndex(0)
- self.assertTrue(field0.IsValid(), 'NameAndAddress::m_name should be valid')
+ self.assertTrue(
+ field0.IsValid(),
+ 'NameAndAddress::m_name should be valid')
string = field0.GetType().GetPointeeType()
self.assertTrue(string.IsValid(), 'CustomString should be valid')
- self.assertTrue(string.IsTypeComplete(), 'CustomString should now be complete')
+ self.assertTrue(
+ string.IsTypeComplete(),
+ 'CustomString should now be complete')
diff --git a/packages/Python/lldbsuite/test/functionalities/type_lookup/Makefile b/packages/Python/lldbsuite/test/functionalities/type_lookup/Makefile
index 31e57fe28a58..7fb4d7a5ab1b 100644
--- a/packages/Python/lldbsuite/test/functionalities/type_lookup/Makefile
+++ b/packages/Python/lldbsuite/test/functionalities/type_lookup/Makefile
@@ -1,6 +1,6 @@
LEVEL = ../../make
-OBJC_SOURCES := main.m
+OBJCXX_SOURCES := main.mm
CFLAGS_EXTRAS += -w
diff --git a/packages/Python/lldbsuite/test/functionalities/type_lookup/TestTypeLookup.py b/packages/Python/lldbsuite/test/functionalities/type_lookup/TestTypeLookup.py
index 774eb437b78e..b0f52923cc1f 100644
--- a/packages/Python/lldbsuite/test/functionalities/type_lookup/TestTypeLookup.py
+++ b/packages/Python/lldbsuite/test/functionalities/type_lookup/TestTypeLookup.py
@@ -5,14 +5,15 @@ Test type lookup command.
from __future__ import print_function
-
import datetime
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TypeLookupTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -21,25 +22,34 @@ class TypeLookupTestCase(TestBase):
# Call super's setUp().
TestBase.setUp(self)
# Find the line number to break at.
- self.line = line_number('main.m', '// break here')
+ self.line = line_number('main.mm', '// break here')
@skipUnlessDarwin
+ @skipIf(archs=['i386'])
def test_type_lookup(self):
"""Test type lookup command."""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.mm", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
-
- self.expect('type lookup NoSuchType', substrs=['@interface'], matching=False)
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
+
+ self.expect(
+ 'type lookup NoSuchType',
+ substrs=['@interface'],
+ matching=False)
self.expect('type lookup NSURL', substrs=['NSURL'])
self.expect('type lookup NSArray', substrs=['NSArray'])
self.expect('type lookup NSObject', substrs=['NSObject', 'isa'])
- self.expect('type lookup PleaseDontBeARealTypeThatExists', substrs=["no type was found matching 'PleaseDontBeARealTypeThatExists'"])
+ self.expect('type lookup PleaseDontBeARealTypeThatExists', substrs=[
+ "no type was found matching 'PleaseDontBeARealTypeThatExists'"])
+ self.expect('type lookup MyCPPClass', substrs=['setF', 'float getF'])
+ self.expect('type lookup MyClass', substrs=['setF', 'float getF'])
+ self.expect('type lookup MyObjCClass', substrs=['@interface MyObjCClass', 'int x', 'int y'])
diff --git a/packages/Python/lldbsuite/test/functionalities/type_lookup/main.mm b/packages/Python/lldbsuite/test/functionalities/type_lookup/main.mm
new file mode 100644
index 000000000000..f62e5cb5b8c9
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/type_lookup/main.mm
@@ -0,0 +1,58 @@
+//===-- main.mm -----------------------------------------------*- ObjC -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#import <Foundation/Foundation.h>
+
+class MyCPPClass {
+public:
+ MyCPPClass(float f) : f(f) {}
+
+ float setF(float f) {
+ float oldf = this->f;
+ this->f = f;
+ return oldf;
+ }
+
+ float getF() {
+ return f;
+ }
+private:
+ float f;
+};
+
+typedef MyCPPClass MyClass;
+
+@interface MyObjCClass : NSObject {
+ int x;
+}
+- (id)init;
+- (int)read;
+@end
+
+@implementation MyObjCClass {
+ int y;
+}
+- (id)init {
+ if (self = [super init]) {
+ self->x = 12;
+ self->y = 24;
+ }
+ return self;
+}
+- (int)read {
+ return self->x + self->y;
+}
+@end
+
+int main (int argc, const char * argv[])
+{
+ MyClass my_cpp(3.1415);
+ return 0; // break here
+}
+
diff --git a/packages/Python/lldbsuite/test/functionalities/unwind/ehframe/TestEhFrameUnwind.py b/packages/Python/lldbsuite/test/functionalities/unwind/ehframe/TestEhFrameUnwind.py
index e17d5d36d394..a855be7536ca 100644
--- a/packages/Python/lldbsuite/test/functionalities/unwind/ehframe/TestEhFrameUnwind.py
+++ b/packages/Python/lldbsuite/test/functionalities/unwind/ehframe/TestEhFrameUnwind.py
@@ -5,20 +5,20 @@ Test that we can backtrace correctly from Non ABI functions on the stack
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class EHFrameBasedUnwind(TestBase):
mydir = TestBase.compute_mydir(__file__)
-
@skipUnlessPlatform(['linux'])
@skipIf(archs=["aarch64", "arm", "i386", "i686"])
- def test (self):
+ def test(self):
"""Test that we can backtrace correctly from Non ABI functions on the stack"""
self.build()
self.setTearDownCleanup()
@@ -28,9 +28,10 @@ class EHFrameBasedUnwind(TestBase):
self.assertTrue(target, VALID_TARGET)
- lldbutil.run_break_set_by_symbol (self, "func")
+ lldbutil.run_break_set_by_symbol(self, "func")
- process = target.LaunchSimple (["abc", "xyz"], None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ ["abc", "xyz"], None, self.get_process_working_directory())
if not process:
self.fail("SBTarget.Launch() failed")
@@ -42,10 +43,10 @@ class EHFrameBasedUnwind(TestBase):
stacktraces = lldbutil.print_stacktraces(process, string_buffer=True)
self.expect(stacktraces, exe=False,
- substrs = ['(int)argc=3'])
+ substrs=['(int)argc=3'])
self.runCmd("thread step-inst")
stacktraces = lldbutil.print_stacktraces(process, string_buffer=True)
self.expect(stacktraces, exe=False,
- substrs = ['(int)argc=3'])
+ substrs=['(int)argc=3'])
diff --git a/packages/Python/lldbsuite/test/functionalities/unwind/ehframe/main.c b/packages/Python/lldbsuite/test/functionalities/unwind/ehframe/main.c
index f62f7d814f38..ae8060124ab2 100644
--- a/packages/Python/lldbsuite/test/functionalities/unwind/ehframe/main.c
+++ b/packages/Python/lldbsuite/test/functionalities/unwind/ehframe/main.c
@@ -1,4 +1,6 @@
void func() {
+
+#ifndef __mips__
__asm__ (
"pushq $0x10;"
".cfi_def_cfa_offset 16;"
@@ -10,11 +12,35 @@ void func() {
"movq $0x48, %rax;"
"popq %rax;"
);
-
+#elif __mips64
+ __asm__ (
+ "daddiu $sp,$sp,-16;"
+ ".cfi_def_cfa_offset 16;"
+ "sd $ra,8($sp);"
+ ".cfi_offset 31, -8;"
+ "daddiu $ra,$zero,0;"
+ "ld $ra,8($sp);"
+ "daddiu $sp, $sp,16;"
+ ".cfi_restore 31;"
+ ".cfi_def_cfa_offset 0;"
+ );
+#else
+ // For MIPS32
+ __asm__ (
+ "addiu $sp,$sp,-8;"
+ ".cfi_def_cfa_offset 8;"
+ "sw $ra,4($sp);"
+ ".cfi_offset 31, -4;"
+ "addiu $ra,$zero,0;"
+ "lw $ra,4($sp);"
+ "addiu $sp,$sp,8;"
+ ".cfi_restore 31;"
+ ".cfi_def_cfa_offset 0;"
+ );
+#endif
}
-
int main(int argc, char const *argv[])
{
func();
-} \ No newline at end of file
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py b/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py
index 62c6c16080a3..5946f3ffa211 100644
--- a/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py
+++ b/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py
@@ -5,18 +5,20 @@ Test that we can backtrace correctly with 'noreturn' functions on the stack
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class NoreturnUnwind(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @skipIfWindows # clang-cl does not support gcc style attributes.
- def test (self):
+ @skipIfWindows # clang-cl does not support gcc style attributes.
+ @expectedFailureAndroid(bugnumber="llvm.org/pr31192", archs=["x86_64"])
+ def test(self):
"""Test that we can backtrace correctly with 'noreturn' functions on the stack"""
self.build()
self.setTearDownCleanup()
@@ -25,7 +27,8 @@ class NoreturnUnwind(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
if not process:
self.fail("SBTarget.Launch() failed")
@@ -55,22 +58,27 @@ class NoreturnUnwind(TestBase):
self.fail("Unable to find abort() in backtrace.")
func_c_frame_number = abort_frame_number + 1
- if thread.GetFrameAtIndex (func_c_frame_number).GetFunctionName() != "func_c":
+ if thread.GetFrameAtIndex(
+ func_c_frame_number).GetFunctionName() != "func_c":
self.fail("Did not find func_c() above abort().")
# This depends on whether we see the func_b inlined function in the backtrace
# or not. I'm not interested in testing that aspect of the backtrace here
# right now.
- if thread.GetFrameAtIndex (func_c_frame_number + 1).GetFunctionName() == "func_b":
+ if thread.GetFrameAtIndex(
+ func_c_frame_number +
+ 1).GetFunctionName() == "func_b":
func_a_frame_number = func_c_frame_number + 2
else:
func_a_frame_number = func_c_frame_number + 1
- if thread.GetFrameAtIndex (func_a_frame_number).GetFunctionName() != "func_a":
+ if thread.GetFrameAtIndex(
+ func_a_frame_number).GetFunctionName() != "func_a":
self.fail("Did not find func_a() above func_c().")
main_frame_number = func_a_frame_number + 1
- if thread.GetFrameAtIndex (main_frame_number).GetFunctionName() != "main":
+ if thread.GetFrameAtIndex(
+ main_frame_number).GetFunctionName() != "main":
self.fail("Did not find main() above func_a().")
diff --git a/packages/Python/lldbsuite/test/functionalities/unwind/sigtramp/TestSigtrampUnwind.py b/packages/Python/lldbsuite/test/functionalities/unwind/sigtramp/TestSigtrampUnwind.py
index d2b36412f1f0..e35bb966c918 100644
--- a/packages/Python/lldbsuite/test/functionalities/unwind/sigtramp/TestSigtrampUnwind.py
+++ b/packages/Python/lldbsuite/test/functionalities/unwind/sigtramp/TestSigtrampUnwind.py
@@ -5,20 +5,21 @@ Test that we can backtrace correctly with 'sigtramp' functions on the stack
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class SigtrampUnwind(TestBase):
mydir = TestBase.compute_mydir(__file__)
# On different platforms the "_sigtramp" and "__kill" frames are likely to be different.
# This test could probably be adapted to run on linux/*bsd easily enough.
@skipUnlessDarwin
- def test (self):
+ def test(self):
"""Test that we can backtrace correctly with _sigtramp on the stack"""
self.build()
self.setTearDownCleanup()
@@ -27,10 +28,11 @@ class SigtrampUnwind(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
+ lldbutil.run_break_set_by_file_and_line(self, "main.c", line_number(
+ 'main.c', '// Set breakpoint here'), num_expected_locations=1)
- lldbutil.run_break_set_by_file_and_line (self, "main.c", line_number('main.c', '// Set breakpoint here'), num_expected_locations=1)
-
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
if not process:
self.fail("SBTarget.Launch() failed")
@@ -40,10 +42,20 @@ class SigtrampUnwind(TestBase):
"instead the actual state is: '%s'" %
lldbutil.state_type_to_str(process.GetState()))
- self.expect("pro handle -n false -p true -s false SIGUSR1", "Have lldb pass SIGUSR1 signals",
- substrs = ["SIGUSR1", "true", "false", "false"])
-
- lldbutil.run_break_set_by_symbol (self, "handler", num_expected_locations=1, module_name="a.out")
+ self.expect(
+ "pro handle -n false -p true -s false SIGUSR1",
+ "Have lldb pass SIGUSR1 signals",
+ substrs=[
+ "SIGUSR1",
+ "true",
+ "false",
+ "false"])
+
+ lldbutil.run_break_set_by_symbol(
+ self,
+ "handler",
+ num_expected_locations=1,
+ module_name="a.out")
self.runCmd("continue")
@@ -69,14 +81,14 @@ class SigtrampUnwind(TestBase):
for f in thread.frames:
print(" %d %s" % (f.GetFrameID(), f.GetFunctionName()))
- if found_handler == False:
+ if not found_handler:
self.fail("Unable to find handler() in backtrace.")
- if found_sigtramp == False:
+ if not found_sigtramp:
self.fail("Unable to find _sigtramp() in backtrace.")
- if found_kill == False:
+ if not found_kill:
self.fail("Unable to find kill() in backtrace.")
- if found_main == False:
+ if not found_main:
self.fail("Unable to find main() in backtrace.")
diff --git a/packages/Python/lldbsuite/test/functionalities/unwind/standard/TestStandardUnwind.py b/packages/Python/lldbsuite/test/functionalities/unwind/standard/TestStandardUnwind.py
index 20532c6fc675..2416128d2efa 100644
--- a/packages/Python/lldbsuite/test/functionalities/unwind/standard/TestStandardUnwind.py
+++ b/packages/Python/lldbsuite/test/functionalities/unwind/standard/TestStandardUnwind.py
@@ -13,9 +13,9 @@ after escaping some special characters).
from __future__ import print_function
-
import unittest2
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
@@ -23,10 +23,11 @@ from lldbsuite.test import lldbutil
test_source_dirs = ["."]
+
class StandardUnwindTest(TestBase):
mydir = TestBase.compute_mydir(__file__)
- def standard_unwind_tests (self):
+ def standard_unwind_tests(self):
# The following variables have to be defined for each architecture and OS we testing for:
# base_function_names: List of function names where we accept that the stack unwinding is
# correct if they are on the stack. It should include the bottom most
@@ -36,20 +37,27 @@ class StandardUnwindTest(TestBase):
# instruction by instruction for any reason. (A valid reason is if
# it is impossible to step through a function instruction by
# instruction because it is special for some reason.) For these
- # functions we will immediately do a step-out when we hit them.
+ # functions we will immediately do a step-out when we hit them.
triple = self.dbg.GetSelectedPlatform().GetTriple()
if re.match("arm-.*-.*-android", triple):
base_function_names = [
"_start", # Base function on the stack
"__memcpy_base", # Function reached by a fall through from the previous function
- "__memcpy_base_aligned", # Function reached by a fall through from the previous function
+ "__memcpy_base_aligned",
+ # Function reached by a fall through from the previous function
]
no_step_function_names = [
- "__sync_fetch_and_add_4", # Calls into a special SO where we can't set a breakpoint
- "pthread_mutex_lock", # Uses ldrex and strex what interferes with the software single stepping
- "pthread_mutex_unlock", # Uses ldrex and strex what interferes with the software single stepping
- "pthread_once", # Uses ldrex and strex what interferes with the software single stepping
+ "__sync_fetch_and_add_4", # Calls into a special SO where we can't set a breakpoint
+ "pthread_mutex_lock",
+ # Uses ldrex and strex what interferes with the software single
+ # stepping
+ "pthread_mutex_unlock",
+ # Uses ldrex and strex what interferes with the software single
+ # stepping
+ "pthread_once",
+ # Uses ldrex and strex what interferes with the software single
+ # stepping
]
elif re.match("aarch64-.*-.*-android", triple):
base_function_names = [
@@ -57,11 +65,21 @@ class StandardUnwindTest(TestBase):
]
no_step_function_names = [
None,
- "__cxa_guard_acquire", # Uses ldxr and stxr what interferes with the software single stepping
- "__cxa_guard_release", # Uses ldxr and stxr what interferes with the software single stepping
- "pthread_mutex_lock", # Uses ldxr and stxr what interferes with the software single stepping
- "pthread_mutex_unlock", # Uses ldxr and stxr what interferes with the software single stepping
- "pthread_once", # Uses ldxr and stxr what interferes with the software single stepping
+ "__cxa_guard_acquire",
+ # Uses ldxr and stxr what interferes with the software single
+ # stepping
+ "__cxa_guard_release",
+ # Uses ldxr and stxr what interferes with the software single
+ # stepping
+ "pthread_mutex_lock",
+ # Uses ldxr and stxr what interferes with the software single
+ # stepping
+ "pthread_mutex_unlock",
+ # Uses ldxr and stxr what interferes with the software single
+ # stepping
+ "pthread_once",
+ # Uses ldxr and stxr what interferes with the software single
+ # stepping
]
else:
self.skipTest("No expectations for the current architecture")
@@ -72,17 +90,23 @@ class StandardUnwindTest(TestBase):
target.BreakpointCreateByName("main")
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process is not None, "SBTarget.Launch() failed")
- self.assertEqual(process.GetState(), lldb.eStateStopped, "The process didn't hit main")
+ self.assertEqual(
+ process.GetState(),
+ lldb.eStateStopped,
+ "The process didn't hit main")
index = 0
while process.GetState() == lldb.eStateStopped:
index += 1
if process.GetNumThreads() > 1:
# In case of a multi threaded inferior if one of the thread is stopped in a blocking
- # syscall and we try to step it then SBThread::StepInstruction() will block forever
- self.skipTest("Multi threaded inferiors are not supported by this test")
+ # syscall and we try to step it then
+ # SBThread::StepInstruction() will block forever
+ self.skipTest(
+ "Multi threaded inferiors are not supported by this test")
thread = process.GetThreadAtIndex(0)
@@ -97,9 +121,11 @@ class StandardUnwindTest(TestBase):
if f.GetFunctionName() in base_function_names:
found_main = True
break
- self.assertTrue(found_main, "Main function isn't found on the backtrace")
+ self.assertTrue(found_main,
+ "Main function isn't found on the backtrace")
- if thread.GetFrameAtIndex(0).GetFunctionName() in no_step_function_names:
+ if thread.GetFrameAtIndex(
+ 0).GetFunctionName() in no_step_function_names:
thread.StepOut()
else:
thread.StepInstruction(False)
@@ -113,13 +139,16 @@ for d in test_source_dirs:
dirname = os.path.join(os.path.dirname(__file__), d)
for root, _, files in os.walk(dirname):
- test_source_files = test_source_files | set(os.path.abspath(os.path.join(root, f)) for f in files)
+ test_source_files = test_source_files | set(
+ os.path.abspath(os.path.join(root, f)) for f in files)
# Generate test cases based on the collected source files
for f in test_source_files:
if f.endswith(".cpp") or f.endswith(".c"):
@add_test_categories(["dwarf"])
- @unittest2.skipIf(TestBase.skipLongRunningTest(), "Skip this long running test")
+ @unittest2.skipIf(
+ TestBase.skipLongRunningTest(),
+ "Skip this long running test")
def test_function_dwarf(self, f=f):
if f.endswith(".cpp"):
d = {'CXX_SOURCES': f}
@@ -143,4 +172,7 @@ for f in test_source_files:
test_name = test_name.replace(c, '_')
test_function_dwarf.__name__ = test_name
- setattr(StandardUnwindTest, test_function_dwarf.__name__, test_function_dwarf)
+ setattr(
+ StandardUnwindTest,
+ test_function_dwarf.__name__,
+ test_function_dwarf)
diff --git a/packages/Python/lldbsuite/test/functionalities/value_md5_crash/TestValueMD5Crash.py b/packages/Python/lldbsuite/test/functionalities/value_md5_crash/TestValueMD5Crash.py
index cbea7d22cc44..8e3ab853e27d 100644
--- a/packages/Python/lldbsuite/test/functionalities/value_md5_crash/TestValueMD5Crash.py
+++ b/packages/Python/lldbsuite/test/functionalities/value_md5_crash/TestValueMD5Crash.py
@@ -5,13 +5,14 @@ Verify that the hash computing logic for ValueObject's values can't crash us.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ValueMD5CrashTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -28,26 +29,27 @@ class ValueMD5CrashTestCase(TestBase):
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
value = self.frame().FindVariable("a")
value.SetPreferDynamicValue(lldb.eDynamicCanRunTarget)
-
+
v = value.GetValue()
type_name = value.GetTypeName()
self.assertTrue(type_name == "B *", "a is a B*")
-
+
self.runCmd("next")
self.runCmd("process kill")
-
+
# now the process is dead, and value needs updating
v = value.GetValue()
-
+
# if we are here, instead of crashed, the test succeeded
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py
index 933f21a90bbf..6a68730e08ed 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py
@@ -5,14 +5,15 @@ Test lldb watchpoint that uses '-s size' to watch a pointed location with size.
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class HelloWatchLocationTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -23,18 +24,31 @@ class HelloWatchLocationTestCase(TestBase):
# Our simple source filename.
self.source = 'main.cpp'
# Find the line number to break inside main().
- self.line = line_number(self.source, '// Set break point at this line.')
+ self.line = line_number(
+ self.source, '// Set break point at this line.')
# This is for verifying that watch location works.
- self.violating_func = "do_bad_thing_with_location";
- # Build dictionary to have unique executable names for each test method.
+ self.violating_func = "do_bad_thing_with_location"
+ # Build dictionary to have unique executable names for each test
+ # method.
self.exe_name = self.testMethodName
self.d = {'CXX_SOURCES': self.source, 'EXE': self.exe_name}
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
- @expectedFailureAll(triple = re.compile('^mips')) # Most of the MIPS boards provide only one H/W watchpoints, and S/W watchpoints are not supported yet
- @expectedFailureAll(archs=['s390x']) # SystemZ also currently supports only one H/W watchpoint
- @expectedFailureAll(oslist=["linux"], archs=["arm", "aarch64"], bugnumber="llvm.org/pr27795")
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ # Most of the MIPS boards provide only one H/W watchpoints, and S/W
+ # watchpoints are not supported yet
+ @expectedFailureAll(triple=re.compile('^mips'))
+ # SystemZ also currently supports only one H/W watchpoint
+ @expectedFailureAll(archs=['s390x'])
+ @expectedFailureAll(
+ oslist=["linux"],
+ archs=[
+ "arm",
+ "aarch64"],
+ bugnumber="llvm.org/pr27795")
@skipIfDarwin
def test_hello_watchlocation(self):
"""Test watching a location with '-s size' option."""
@@ -44,7 +58,8 @@ class HelloWatchLocationTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Add a breakpoint to set a watchpoint when stopped on the breakpoint.
- lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1, loc_exact=False)
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.line, num_expected_locations=1, loc_exact=False)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -52,48 +67,56 @@ class HelloWatchLocationTestCase(TestBase):
# We should be stopped again due to the breakpoint.
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# Now let's set a write-type watchpoint pointed to by 'g_char_ptr'.
- self.expect("watchpoint set expression -w write -s 1 -- g_char_ptr", WATCHPOINT_CREATED,
- substrs = ['Watchpoint created', 'size = 1', 'type = w'])
+ self.expect(
+ "watchpoint set expression -w write -s 1 -- g_char_ptr",
+ WATCHPOINT_CREATED,
+ substrs=[
+ 'Watchpoint created',
+ 'size = 1',
+ 'type = w'])
# Get a hold of the watchpoint id just created, it is used later on to
# match the watchpoint id which is expected to be fired.
- match = re.match("Watchpoint created: Watchpoint (.*):", self.res.GetOutput().splitlines()[0])
+ match = re.match(
+ "Watchpoint created: Watchpoint (.*):",
+ self.res.GetOutput().splitlines()[0])
if match:
expected_wp_id = int(match.group(1), 0)
else:
- self.fail("Grokking watchpoint id faailed!")
+ self.fail("Grokking watchpoint id faailed!")
self.runCmd("expr unsigned val = *g_char_ptr; val")
self.expect(self.res.GetOutput().splitlines()[0], exe=False,
- endstr = ' = 0')
+ endstr=' = 0')
self.runCmd("watchpoint set expression -w write -s 4 -- &threads[0]")
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should be 0 initially.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 0'])
+ substrs=['hit_count = 0'])
self.runCmd("process continue")
# We should be stopped again due to the watchpoint (write type), but
# only once. The stop reason of the thread should be watchpoint.
self.expect("thread list", STOPPED_DUE_TO_WATCHPOINT,
- substrs = ['stopped',
- 'stop reason = watchpoint %d' % expected_wp_id])
+ substrs=['stopped',
+ 'stop reason = watchpoint %d' % expected_wp_id])
- # Switch to the thread stopped due to watchpoint and issue some commands.
+ # Switch to the thread stopped due to watchpoint and issue some
+ # commands.
self.switch_to_thread_with_stop_reason(lldb.eStopReasonWatchpoint)
self.runCmd("thread backtrace")
self.expect("frame info",
- substrs = [self.violating_func])
+ substrs=[self.violating_func])
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should now be 1.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 1'])
+ substrs=['hit_count = 1'])
self.runCmd("thread backtrace all")
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py
index 5214c7f5e089..c74452fd375e 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py
@@ -5,16 +5,17 @@ Test my first lldb watchpoint.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class HelloWatchpointTestCase(TestBase):
- def getCategories (self):
+ def getCategories(self):
return ['basic_process']
mydir = TestBase.compute_mydir(__file__)
@@ -25,14 +26,19 @@ class HelloWatchpointTestCase(TestBase):
# Our simple source filename.
self.source = 'main.c'
# Find the line number to break inside main().
- self.line = line_number(self.source, '// Set break point at this line.')
+ self.line = line_number(
+ self.source, '// Set break point at this line.')
# And the watchpoint variable declaration line number.
- self.decl = line_number(self.source, '// Watchpoint variable declaration.')
+ self.decl = line_number(self.source,
+ '// Watchpoint variable declaration.')
self.exe_name = 'a.out'
self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
def test_hello_watchpoint_using_watchpoint_set(self):
"""Test a simple sequence of watchpoint creation and watchpoint hit."""
self.build(dictionary=self.d)
@@ -42,7 +48,8 @@ class HelloWatchpointTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Add a breakpoint to set a watchpoint when stopped on the breakpoint.
- lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.line, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -50,36 +57,45 @@ class HelloWatchpointTestCase(TestBase):
# We should be stopped again due to the breakpoint.
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# Now let's set a write-type watchpoint for 'global'.
# There should be only one watchpoint hit (see main.c).
- self.expect("watchpoint set variable -w write global", WATCHPOINT_CREATED,
- substrs = ['Watchpoint created', 'size = 4', 'type = w',
- '%s:%d' % (self.source, self.decl)])
+ self.expect(
+ "watchpoint set variable -w write global",
+ WATCHPOINT_CREATED,
+ substrs=[
+ 'Watchpoint created',
+ 'size = 4',
+ 'type = w',
+ '%s:%d' %
+ (self.source,
+ self.decl)])
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should be 0 initially.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 0'])
+ substrs=['hit_count = 0'])
self.runCmd("process continue")
# We should be stopped again due to the watchpoint (write type), but
# only once. The stop reason of the thread should be watchpoint.
self.expect("thread list", STOPPED_DUE_TO_WATCHPOINT,
- substrs = ['stopped',
- 'stop reason = watchpoint'])
+ substrs=['stopped',
+ 'stop reason = watchpoint'])
self.runCmd("process continue")
# Don't expect the read of 'global' to trigger a stop exception.
process = self.dbg.GetSelectedTarget().GetProcess()
if process.GetState() == lldb.eStateStopped:
- self.assertFalse(lldbutil.get_stopped_thread(process, lldb.eStopReasonWatchpoint))
+ self.assertFalse(
+ lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonWatchpoint))
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should now be 1.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 1'])
+ substrs=['hit_count = 1'])
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/Makefile b/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/Makefile
new file mode 100644
index 000000000000..b09a579159d4
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+C_SOURCES := main.c
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/TestWatchpointMultipleSlots.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/TestWatchpointMultipleSlots.py
new file mode 100644
index 000000000000..2e58cb893b73
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/TestWatchpointMultipleSlots.py
@@ -0,0 +1,97 @@
+"""
+Test watchpoint slots we should not be able to install multiple watchpoints
+within same word boundary. We should be able to install individual watchpoints
+on any of the bytes, half-word, or word. This is only for ARM/AArch64 targets.
+"""
+
+from __future__ import print_function
+
+import os
+import time
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class WatchpointSlotsTestCase(TestBase):
+ NO_DEBUG_INFO_TESTCASE = True
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ # Call super's setUp().
+ TestBase.setUp(self)
+
+ # Source filename.
+ self.source = 'main.c'
+
+ # Output filename.
+ self.exe_name = 'a.out'
+ self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}
+
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ # This is a arm and aarch64 specific test case. No other architectures tested.
+ @skipIf(archs=no_match(['arm', 'aarch64']))
+ def test_multiple_watchpoints_on_same_word(self):
+
+ self.build(dictionary=self.d)
+ self.setTearDownCleanup(dictionary=self.d)
+
+ exe = os.path.join(os.getcwd(), self.exe_name)
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+ # Detect line number after which we are going to increment arrayName.
+ loc_line = line_number('main.c', '// About to write byteArray')
+
+ # Set a breakpoint on the line detected above.
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", loc_line, num_expected_locations=1, loc_exact=True)
+
+ # Run the program.
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ # The stop reason of the thread should be breakpoint.
+ self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+ substrs=['stopped', 'stop reason = breakpoint'])
+
+ # Delete breakpoint we just hit.
+ self.expect("breakpoint delete 1", substrs=['1 breakpoints deleted'])
+
+ # Set a watchpoint at byteArray[0]
+ self.expect("watchpoint set variable byteArray[0]", WATCHPOINT_CREATED,
+ substrs=['Watchpoint created','size = 1'])
+
+ # Use the '-v' option to do verbose listing of the watchpoint.
+ # The hit count should be 0 initially.
+ self.expect("watchpoint list -v 1", substrs=['hit_count = 0'])
+
+ # Try setting a watchpoint at byteArray[1]
+ self.expect("watchpoint set variable byteArray[1]", error=True,
+ substrs=['Watchpoint creation failed'])
+
+ self.runCmd("process continue")
+
+ # We should be stopped due to the watchpoint.
+ # The stop reason of the thread should be watchpoint.
+ self.expect("thread list", STOPPED_DUE_TO_WATCHPOINT,
+ substrs=['stopped', 'stop reason = watchpoint 1'])
+
+ # Delete the watchpoint we hit above successfully.
+ self.expect("watchpoint delete 1", substrs=['1 watchpoints deleted'])
+
+ # Set a watchpoint at byteArray[3]
+ self.expect("watchpoint set variable byteArray[3]", WATCHPOINT_CREATED,
+ substrs=['Watchpoint created','size = 1'])
+
+ # Resume inferior.
+ self.runCmd("process continue")
+
+ # We should be stopped due to the watchpoint.
+ # The stop reason of the thread should be watchpoint.
+ self.expect("thread list -v", STOPPED_DUE_TO_WATCHPOINT,
+ substrs=['stopped', 'stop reason = watchpoint 3'])
+
+ # Resume inferior.
+ self.runCmd("process continue")
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/main.c b/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/main.c
new file mode 100644
index 000000000000..fd14a9b353fc
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/main.c
@@ -0,0 +1,29 @@
+//===-- main.c --------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+#include <stdio.h>
+#include <stdint.h>
+
+uint64_t pad0 = 0;
+uint8_t byteArray[4] = {0};
+uint64_t pad1 = 0;
+
+int main(int argc, char** argv) {
+
+ int i;
+
+ for (i = 0; i < 4; i++)
+ {
+ printf("About to write byteArray[%d] ...\n", i); // About to write byteArray
+ pad0++;
+ byteArray[i] = 7;
+ pad1++;
+ }
+
+ return 0;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/Makefile b/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/Makefile
new file mode 100644
index 000000000000..314f1cb2f077
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/TestMultipleHits.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/TestMultipleHits.py
new file mode 100644
index 000000000000..c21355a2e8f9
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/TestMultipleHits.py
@@ -0,0 +1,58 @@
+"""
+Test handling of cases when a single instruction triggers multiple watchpoints
+"""
+
+from __future__ import print_function
+
+
+import os
+import time
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class MultipleHitsTestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+ NO_DEBUG_INFO_TESTCASE = True
+
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ @skipIf(bugnumber="llvm.org/pr30758", oslist=["linux"], archs=["arm", "aarch64"])
+ def test(self):
+ self.build()
+ exe = os.path.join(os.getcwd(), "a.out")
+ target = self.dbg.CreateTarget(exe)
+ self.assertTrue(target and target.IsValid(), VALID_TARGET)
+
+ bp = target.BreakpointCreateByName("main")
+ self.assertTrue(bp and bp.IsValid(), "Breakpoint is valid")
+
+ process = target.LaunchSimple(None, None,
+ self.get_process_working_directory())
+ self.assertEqual(process.GetState(), lldb.eStateStopped)
+
+ thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ self.assertIsNotNone(thread)
+
+ frame = thread.GetFrameAtIndex(0)
+ self.assertTrue(frame and frame.IsValid(), "Frame is valid")
+
+ buf = frame.FindValue("buf", lldb.eValueTypeVariableGlobal)
+ self.assertTrue(buf and buf.IsValid(), "buf is valid")
+
+ for i in [0, target.GetAddressByteSize()]:
+ member = buf.GetChildAtIndex(i)
+ self.assertTrue(member and member.IsValid(), "member is valid")
+
+ error = lldb.SBError()
+ watch = member.Watch(True, True, True, error)
+ self.assertTrue(error.Success())
+
+ process.Continue();
+ self.assertEqual(process.GetState(), lldb.eStateStopped)
+ self.assertEqual(thread.GetStopReason(), lldb.eStopReasonWatchpoint)
+
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/main.cpp b/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/main.cpp
new file mode 100644
index 000000000000..430c02cc052a
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/main.cpp
@@ -0,0 +1,29 @@
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+#include <stdio.h>
+#include <stdint.h>
+alignas(16) uint8_t buf[32];
+// This uses inline assembly to generate an instruction that writes to a large
+// block of memory. If it fails on your compiler/architecture, please add
+// appropriate code to generate a large write to "buf". If you cannot write at
+// least 2*sizeof(void*) bytes with a single instruction, you will have to skip
+// this test.
+
+int main() {
+#if defined(__i386__) || defined(__x86_64__)
+ asm volatile ("movdqa %%xmm0, %0" : : "m"(buf));
+#elif defined(__arm__)
+ asm volatile ("stm %0, { r0, r1, r2, r3 }" : : "r"(buf));
+#elif defined(__aarch64__)
+ asm volatile ("stp x0, x1, %0" : : "m"(buf));
+#elif defined(__mips__)
+ asm volatile ("lw $2, %0" : : "m"(buf));
+#endif
+ return 0;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py
index af8306c9a20e..78273d6ec69c 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py
@@ -5,28 +5,35 @@ Test that lldb watchpoint works for multiple threads.
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class WatchpointForMultipleThreadsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
def test_watchpoint_multiple_threads(self):
"""Test that lldb watchpoint works for multiple threads."""
self.build()
self.setTearDownCleanup()
self.hello_multiple_threads()
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
def test_watchpoint_multiple_threads_wp_set_and_then_delete(self):
"""Test that lldb watchpoint works for multiple threads, and after the watchpoint is deleted, the watchpoint event should no longer fires."""
self.build()
@@ -39,14 +46,21 @@ class WatchpointForMultipleThreadsTestCase(TestBase):
# Our simple source filename.
self.source = 'main.cpp'
# Find the line number to break inside main().
- self.first_stop = line_number(self.source, '// Set break point at this line')
+ self.first_stop = line_number(
+ self.source, '// Set break point at this line')
def hello_multiple_threads(self):
"""Test that lldb watchpoint works for multiple threads."""
- self.runCmd("file %s" % os.path.join(os.getcwd(), 'a.out'), CURRENT_EXECUTABLE_SET)
+ self.runCmd(
+ "file %s" %
+ os.path.join(
+ os.getcwd(),
+ 'a.out'),
+ CURRENT_EXECUTABLE_SET)
# Add a breakpoint to set a watchpoint when stopped on the breakpoint.
- lldbutil.run_break_set_by_file_and_line (self, None, self.first_stop, num_expected_locations=1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.first_stop, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -54,17 +68,22 @@ class WatchpointForMultipleThreadsTestCase(TestBase):
# We should be stopped again due to the breakpoint.
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# Now let's set a write-type watchpoint for variable 'g_val'.
- self.expect("watchpoint set variable -w write g_val", WATCHPOINT_CREATED,
- substrs = ['Watchpoint created', 'size = 4', 'type = w'])
+ self.expect(
+ "watchpoint set variable -w write g_val",
+ WATCHPOINT_CREATED,
+ substrs=[
+ 'Watchpoint created',
+ 'size = 4',
+ 'type = w'])
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should be 0 initially.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 0'])
+ substrs=['hit_count = 0'])
while True:
self.runCmd("process continue")
@@ -80,14 +99,20 @@ class WatchpointForMultipleThreadsTestCase(TestBase):
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should now be 1.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 1'])
+ substrs=['hit_count = 1'])
def hello_multiple_threads_wp_set_and_then_delete(self):
"""Test that lldb watchpoint works for multiple threads, and after the watchpoint is deleted, the watchpoint event should no longer fires."""
- self.runCmd("file %s" % os.path.join(os.getcwd(), 'a.out'), CURRENT_EXECUTABLE_SET)
+ self.runCmd(
+ "file %s" %
+ os.path.join(
+ os.getcwd(),
+ 'a.out'),
+ CURRENT_EXECUTABLE_SET)
# Add a breakpoint to set a watchpoint when stopped on the breakpoint.
- lldbutil.run_break_set_by_file_and_line (self, None, self.first_stop, num_expected_locations=1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.first_stop, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -95,17 +120,22 @@ class WatchpointForMultipleThreadsTestCase(TestBase):
# We should be stopped again due to the breakpoint.
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# Now let's set a write-type watchpoint for variable 'g_val'.
- self.expect("watchpoint set variable -w write g_val", WATCHPOINT_CREATED,
- substrs = ['Watchpoint created', 'size = 4', 'type = w'])
+ self.expect(
+ "watchpoint set variable -w write g_val",
+ WATCHPOINT_CREATED,
+ substrs=[
+ 'Watchpoint created',
+ 'size = 4',
+ 'type = w'])
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should be 0 initially.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 0'])
+ substrs=['hit_count = 0'])
watchpoint_stops = 0
while True:
@@ -120,13 +150,17 @@ class WatchpointForMultipleThreadsTestCase(TestBase):
self.runCmd("thread backtrace all")
watchpoint_stops += 1
if watchpoint_stops > 1:
- self.fail("Watchpoint hits not supposed to exceed 1 by design!")
- # Good, we verified that the watchpoint works! Now delete the watchpoint.
+ self.fail(
+ "Watchpoint hits not supposed to exceed 1 by design!")
+ # Good, we verified that the watchpoint works! Now delete the
+ # watchpoint.
if self.TraceOn():
- print("watchpoint_stops=%d at the moment we delete the watchpoint" % watchpoint_stops)
+ print(
+ "watchpoint_stops=%d at the moment we delete the watchpoint" %
+ watchpoint_stops)
self.runCmd("watchpoint delete 1")
self.expect("watchpoint list -v",
- substrs = ['No watchpoints currently set.'])
+ substrs=['No watchpoints currently set.'])
continue
else:
self.fail("The stop reason should be either break or watchpoint")
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py
index 22011f11352c..f1d7acfcc5ec 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py
@@ -3,7 +3,6 @@
from __future__ import print_function
-
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
@@ -17,10 +16,19 @@ class TestStepOverWatchpoint(TestBase):
def getCategories(self):
return ['basic_process']
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["linux"], archs=['aarch64', 'arm'], bugnumber="llvm.org/pr26031")
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
- @expectedFailureAll(archs=['s390x']) # Read-write watchpoints not supported on SystemZ
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["linux"],
+ archs=[
+ 'aarch64',
+ 'arm'],
+ bugnumber="llvm.org/pr26031")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ # Read-write watchpoints not supported on SystemZ
+ @expectedFailureAll(archs=['s390x'])
def test(self):
"""Test stepping over watchpoints."""
self.build()
@@ -73,9 +81,10 @@ class TestStepOverWatchpoint(TestBase):
lldb.eValueTypeVariableGlobal)
self.assertTrue(write_value, "Failed to find write value.")
- # Most of the MIPS boards provide only one H/W watchpoints, and S/W watchpoints are not supported yet
+ # Most of the MIPS boards provide only one H/W watchpoints, and S/W
+ # watchpoints are not supported yet
arch = self.getArchitecture()
- if re.match("^mips",arch):
+ if re.match("^mips", arch):
self.runCmd("watchpoint delete 1")
# resolve_location=True, read=False, write=True
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py
index 21f1fb68426b..d30741497635 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py
@@ -5,13 +5,14 @@ Test that a variable watchpoint should only hit when in scope.
from __future__ import print_function
-
import unittest2
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class WatchedVariableHitWhenInScopeTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -20,7 +21,7 @@ class WatchedVariableHitWhenInScopeTestCase(TestBase):
# This test depends on not tracking watchpoint expression hits if we have
# left the watchpoint scope. We will provide such an ability at some point
# but the way this was done was incorrect, and it is unclear that for the
- # most part that's not what folks mostly want, so we have to provide a
+ # most part that's not what folks mostly want, so we have to provide a
# clearer API to express this.
#
@@ -42,7 +43,8 @@ class WatchedVariableHitWhenInScopeTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Add a breakpoint to set a watchpoint when stopped in main.
- lldbutil.run_break_set_by_symbol (self, "main", num_expected_locations=-1)
+ lldbutil.run_break_set_by_symbol(
+ self, "main", num_expected_locations=-1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -50,34 +52,34 @@ class WatchedVariableHitWhenInScopeTestCase(TestBase):
# We should be stopped again due to the breakpoint.
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# Now let's set a watchpoint for 'c.a'.
# There should be only one watchpoint hit (see main.c).
self.expect("watchpoint set variable c.a", WATCHPOINT_CREATED,
- substrs = ['Watchpoint created', 'size = 4', 'type = w'])
+ substrs=['Watchpoint created', 'size = 4', 'type = w'])
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should be 0 initially.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 0'])
+ substrs=['hit_count = 0'])
self.runCmd("process continue")
# We should be stopped again due to the watchpoint (write type), but
# only once. The stop reason of the thread should be watchpoint.
self.expect("thread list", STOPPED_DUE_TO_WATCHPOINT,
- substrs = ['stopped',
- 'stop reason = watchpoint'])
+ substrs=['stopped',
+ 'stop reason = watchpoint'])
self.runCmd("process continue")
# Don't expect the read of 'global' to trigger a stop exception.
# The process status should be 'exited'.
self.expect("process status",
- substrs = ['exited'])
+ substrs=['exited'])
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should now be 1.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 1'])
+ substrs=['hit_count = 1'])
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py
index 4ce05af96e2e..7a9904c53f83 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py
@@ -5,13 +5,14 @@ Test watchpoint list, enable, disable, and delete commands.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class WatchpointCommandsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -22,27 +23,37 @@ class WatchpointCommandsTestCase(TestBase):
# Our simple source filename.
self.source = 'main.c'
# Find the line number to break inside main().
- self.line = line_number(self.source, '// Set break point at this line.')
- self.line2 = line_number(self.source, '// Set 2nd break point for disable_then_enable test case.')
+ self.line = line_number(
+ self.source, '// Set break point at this line.')
+ self.line2 = line_number(
+ self.source,
+ '// Set 2nd break point for disable_then_enable test case.')
# And the watchpoint variable declaration line number.
- self.decl = line_number(self.source, '// Watchpoint variable declaration.')
- # Build dictionary to have unique executable names for each test method.
+ self.decl = line_number(self.source,
+ '// Watchpoint variable declaration.')
+ # Build dictionary to have unique executable names for each test
+ # method.
self.exe_name = self.testMethodName
self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
- @expectedFailureAll(archs=['s390x']) # Read-write watchpoints not supported on SystemZ
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ # Read-write watchpoints not supported on SystemZ
+ @expectedFailureAll(archs=['s390x'])
def test_rw_watchpoint(self):
"""Test read_write watchpoint and expect to stop two times."""
self.build(dictionary=self.d)
self.setTearDownCleanup(dictionary=self.d)
-
+
exe = os.path.join(os.getcwd(), self.exe_name)
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Add a breakpoint to set a watchpoint when stopped on the breakpoint.
- lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.line, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -50,60 +61,72 @@ class WatchpointCommandsTestCase(TestBase):
# We should be stopped again due to the breakpoint.
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# Now let's set a read_write-type watchpoint for 'global'.
# There should be two watchpoint hits (see main.c).
- self.expect("watchpoint set variable -w read_write global", WATCHPOINT_CREATED,
- substrs = ['Watchpoint created', 'size = 4', 'type = rw',
- '%s:%d' % (self.source, self.decl)])
+ self.expect(
+ "watchpoint set variable -w read_write global",
+ WATCHPOINT_CREATED,
+ substrs=[
+ 'Watchpoint created',
+ 'size = 4',
+ 'type = rw',
+ '%s:%d' %
+ (self.source,
+ self.decl)])
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should be 0 initially.
self.expect("watchpoint list -v",
- substrs = ['Number of supported hardware watchpoints:',
- 'hit_count = 0'])
+ substrs=['Number of supported hardware watchpoints:',
+ 'hit_count = 0'])
self.runCmd("process continue")
# We should be stopped again due to the watchpoint (read_write type).
# The stop reason of the thread should be watchpoint.
self.expect("thread backtrace", STOPPED_DUE_TO_WATCHPOINT,
- substrs = ['stop reason = watchpoint'])
+ substrs=['stop reason = watchpoint'])
self.runCmd("process continue")
# We should be stopped again due to the watchpoint (read_write type).
# The stop reason of the thread should be watchpoint.
self.expect("thread backtrace", STOPPED_DUE_TO_WATCHPOINT,
- substrs = ['stop reason = watchpoint'])
+ substrs=['stop reason = watchpoint'])
self.runCmd("process continue")
# There should be no more watchpoint hit and the process status should
# be 'exited'.
self.expect("process status",
- substrs = ['exited'])
+ substrs=['exited'])
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should now be 2.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 2'])
-
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
- @expectedFailureAll(archs=['s390x']) # Read-write watchpoints not supported on SystemZ
+ substrs=['hit_count = 2'])
+
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ # Read-write watchpoints not supported on SystemZ
+ @expectedFailureAll(archs=['s390x'])
def test_rw_watchpoint_delete(self):
"""Test delete watchpoint and expect not to stop for watchpoint."""
self.build(dictionary=self.d)
self.setTearDownCleanup(dictionary=self.d)
-
+
exe = os.path.join(os.getcwd(), self.exe_name)
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Add a breakpoint to set a watchpoint when stopped on the breakpoint.
- lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.line, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -111,19 +134,27 @@ class WatchpointCommandsTestCase(TestBase):
# We should be stopped again due to the breakpoint.
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# Now let's set a read_write-type watchpoint for 'global'.
# There should be two watchpoint hits (see main.c).
- self.expect("watchpoint set variable -w read_write global", WATCHPOINT_CREATED,
- substrs = ['Watchpoint created', 'size = 4', 'type = rw',
- '%s:%d' % (self.source, self.decl)])
-
- # Delete the watchpoint immediately, but set auto-confirm to true first.
+ self.expect(
+ "watchpoint set variable -w read_write global",
+ WATCHPOINT_CREATED,
+ substrs=[
+ 'Watchpoint created',
+ 'size = 4',
+ 'type = rw',
+ '%s:%d' %
+ (self.source,
+ self.decl)])
+
+ # Delete the watchpoint immediately, but set auto-confirm to true
+ # first.
self.runCmd("settings set auto-confirm true")
self.expect("watchpoint delete",
- substrs = ['All watchpoints removed.'])
+ substrs=['All watchpoints removed.'])
# Restore the original setting of auto-confirm.
self.runCmd("settings clear auto-confirm")
@@ -135,21 +166,26 @@ class WatchpointCommandsTestCase(TestBase):
# There should be no more watchpoint hit and the process status should
# be 'exited'.
self.expect("process status",
- substrs = ['exited'])
-
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
- @expectedFailureAll(archs=['s390x']) # Read-write watchpoints not supported on SystemZ
+ substrs=['exited'])
+
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ # Read-write watchpoints not supported on SystemZ
+ @expectedFailureAll(archs=['s390x'])
def test_rw_watchpoint_set_ignore_count(self):
"""Test watchpoint ignore count and expect to not to stop at all."""
self.build(dictionary=self.d)
self.setTearDownCleanup(dictionary=self.d)
-
+
exe = os.path.join(os.getcwd(), self.exe_name)
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Add a breakpoint to set a watchpoint when stopped on the breakpoint.
- lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.line, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -157,49 +193,61 @@ class WatchpointCommandsTestCase(TestBase):
# We should be stopped again due to the breakpoint.
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# Now let's set a read_write-type watchpoint for 'global'.
# There should be two watchpoint hits (see main.c).
- self.expect("watchpoint set variable -w read_write global", WATCHPOINT_CREATED,
- substrs = ['Watchpoint created', 'size = 4', 'type = rw',
- '%s:%d' % (self.source, self.decl)])
+ self.expect(
+ "watchpoint set variable -w read_write global",
+ WATCHPOINT_CREATED,
+ substrs=[
+ 'Watchpoint created',
+ 'size = 4',
+ 'type = rw',
+ '%s:%d' %
+ (self.source,
+ self.decl)])
# Set the ignore count of the watchpoint immediately.
self.expect("watchpoint ignore -i 2",
- substrs = ['All watchpoints ignored.'])
+ substrs=['All watchpoints ignored.'])
# Use the '-v' option to do verbose listing of the watchpoint.
# Expect to find an ignore_count of 2.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 0', 'ignore_count = 2'])
+ substrs=['hit_count = 0', 'ignore_count = 2'])
self.runCmd("process continue")
# There should be no more watchpoint hit and the process status should
# be 'exited'.
self.expect("process status",
- substrs = ['exited'])
+ substrs=['exited'])
# Use the '-v' option to do verbose listing of the watchpoint.
# Expect to find a hit_count of 2 as well.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 2', 'ignore_count = 2'])
-
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
- @expectedFailureAll(archs=['s390x']) # Read-write watchpoints not supported on SystemZ
+ substrs=['hit_count = 2', 'ignore_count = 2'])
+
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ # Read-write watchpoints not supported on SystemZ
+ @expectedFailureAll(archs=['s390x'])
def test_rw_disable_after_first_stop(self):
"""Test read_write watchpoint but disable it after the first stop."""
self.build(dictionary=self.d)
self.setTearDownCleanup(dictionary=self.d)
-
+
exe = os.path.join(os.getcwd(), self.exe_name)
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Add a breakpoint to set a watchpoint when stopped on the breakpoint.
- lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.line, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -207,49 +255,60 @@ class WatchpointCommandsTestCase(TestBase):
# We should be stopped again due to the breakpoint.
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# Now let's set a read_write-type watchpoint for 'global'.
# There should be two watchpoint hits (see main.c).
- self.expect("watchpoint set variable -w read_write global", WATCHPOINT_CREATED,
- substrs = ['Watchpoint created', 'size = 4', 'type = rw',
- '%s:%d' % (self.source, self.decl)])
+ self.expect(
+ "watchpoint set variable -w read_write global",
+ WATCHPOINT_CREATED,
+ substrs=[
+ 'Watchpoint created',
+ 'size = 4',
+ 'type = rw',
+ '%s:%d' %
+ (self.source,
+ self.decl)])
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should be 0 initially.
self.expect("watchpoint list -v",
- substrs = ['state = enabled', 'hit_count = 0'])
+ substrs=['state = enabled', 'hit_count = 0'])
self.runCmd("process continue")
# We should be stopped again due to the watchpoint (read_write type).
# The stop reason of the thread should be watchpoint.
self.expect("thread backtrace", STOPPED_DUE_TO_WATCHPOINT,
- substrs = ['stop reason = watchpoint'])
+ substrs=['stop reason = watchpoint'])
# Before continuing, we'll disable the watchpoint, which means we won't
# stop again after this.
self.runCmd("watchpoint disable")
self.expect("watchpoint list -v",
- substrs = ['state = disabled', 'hit_count = 1'])
+ substrs=['state = disabled', 'hit_count = 1'])
self.runCmd("process continue")
# There should be no more watchpoint hit and the process status should
# be 'exited'.
self.expect("process status",
- substrs = ['exited'])
+ substrs=['exited'])
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should be 1.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 1'])
-
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
- @expectedFailureAll(archs=['s390x']) # Read-write watchpoints not supported on SystemZ
+ substrs=['hit_count = 1'])
+
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ # Read-write watchpoints not supported on SystemZ
+ @expectedFailureAll(archs=['s390x'])
def test_rw_disable_then_enable(self):
"""Test read_write watchpoint, disable initially, then enable it."""
self.build(dictionary=self.d)
@@ -259,8 +318,10 @@ class WatchpointCommandsTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Add a breakpoint to set a watchpoint when stopped on the breakpoint.
- lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
- lldbutil.run_break_set_by_file_and_line (self, None, self.line2, num_expected_locations=1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.line, num_expected_locations=1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.line2, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -268,14 +329,21 @@ class WatchpointCommandsTestCase(TestBase):
# We should be stopped again due to the breakpoint.
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# Now let's set a read_write-type watchpoint for 'global'.
# There should be two watchpoint hits (see main.c).
- self.expect("watchpoint set variable -w read_write global", WATCHPOINT_CREATED,
- substrs = ['Watchpoint created', 'size = 4', 'type = rw',
- '%s:%d' % (self.source, self.decl)])
+ self.expect(
+ "watchpoint set variable -w read_write global",
+ WATCHPOINT_CREATED,
+ substrs=[
+ 'Watchpoint created',
+ 'size = 4',
+ 'type = rw',
+ '%s:%d' %
+ (self.source,
+ self.decl)])
# Immediately, we disable the watchpoint. We won't be stopping due to a
# watchpoint after this.
@@ -284,36 +352,36 @@ class WatchpointCommandsTestCase(TestBase):
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should be 0 initially.
self.expect("watchpoint list -v",
- substrs = ['state = disabled', 'hit_count = 0'])
+ substrs=['state = disabled', 'hit_count = 0'])
self.runCmd("process continue")
# We should be stopped again due to the breakpoint.
self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stop reason = breakpoint'])
+ substrs=['stop reason = breakpoint'])
# Before continuing, we'll enable the watchpoint, which means we will
# stop again after this.
self.runCmd("watchpoint enable")
self.expect("watchpoint list -v",
- substrs = ['state = enabled', 'hit_count = 0'])
+ substrs=['state = enabled', 'hit_count = 0'])
self.runCmd("process continue")
# We should be stopped again due to the watchpoint (read_write type).
# The stop reason of the thread should be watchpoint.
self.expect("thread backtrace", STOPPED_DUE_TO_WATCHPOINT,
- substrs = ['stop reason = watchpoint'])
+ substrs=['stop reason = watchpoint'])
self.runCmd("process continue")
# There should be no more watchpoint hit and the process status should
# be 'exited'.
self.expect("process status",
- substrs = ['exited'])
+ substrs=['exited'])
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should be 1.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 1'])
+ substrs=['hit_count = 1'])
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py
index ee276dd5687f..5b89f14dd853 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py
@@ -5,13 +5,14 @@ Test 'watchpoint command'.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class WatchpointLLDBCommandTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -22,26 +23,36 @@ class WatchpointLLDBCommandTestCase(TestBase):
# Our simple source filename.
self.source = 'main.cpp'
# Find the line number to break inside main().
- self.line = line_number(self.source, '// Set break point at this line.')
+ self.line = line_number(
+ self.source, '// Set break point at this line.')
# And the watchpoint variable declaration line number.
- self.decl = line_number(self.source, '// Watchpoint variable declaration.')
- # Build dictionary to have unique executable names for each test method.
+ self.decl = line_number(self.source,
+ '// Watchpoint variable declaration.')
+ # Build dictionary to have unique executable names for each test
+ # method.
self.exe_name = 'a%d.out' % self.test_number
self.d = {'CXX_SOURCES': self.source, 'EXE': self.exe_name}
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["linux"], archs=["aarch64"], bugnumber="llvm.org/pr27710")
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["linux"],
+ archs=["aarch64"],
+ bugnumber="llvm.org/pr27710")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
def test_watchpoint_command(self):
"""Test 'watchpoint command'."""
self.build(dictionary=self.d)
self.setTearDownCleanup(dictionary=self.d)
-
+
exe = os.path.join(os.getcwd(), self.exe_name)
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Add a breakpoint to set a watchpoint when stopped on the breakpoint.
- lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.line, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -49,44 +60,58 @@ class WatchpointLLDBCommandTestCase(TestBase):
# We should be stopped again due to the breakpoint.
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# Now let's set a write-type watchpoint for 'global'.
- self.expect("watchpoint set variable -w write global", WATCHPOINT_CREATED,
- substrs = ['Watchpoint created', 'size = 4', 'type = w',
- '%s:%d' % (self.source, self.decl)])
+ self.expect(
+ "watchpoint set variable -w write global",
+ WATCHPOINT_CREATED,
+ substrs=[
+ 'Watchpoint created',
+ 'size = 4',
+ 'type = w',
+ '%s:%d' %
+ (self.source,
+ self.decl)])
self.runCmd('watchpoint command add 1 -o "expr -- cookie = 777"')
# List the watchpoint command we just added.
self.expect("watchpoint command list 1",
- substrs = ['expr -- cookie = 777'])
+ substrs=['expr -- cookie = 777'])
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should be 0 initially.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 0'])
+ substrs=['hit_count = 0'])
self.runCmd("process continue")
# We should be stopped again due to the watchpoint (write type).
# The stop reason of the thread should be watchpoint.
self.expect("thread backtrace", STOPPED_DUE_TO_WATCHPOINT,
- substrs = ['stop reason = watchpoint'])
+ substrs=['stop reason = watchpoint'])
# Check that the watchpoint snapshoting mechanism is working.
self.expect("watchpoint list -v",
- substrs = ['old value:', ' = 0',
- 'new value:', ' = 1'])
+ substrs=['old value:', ' = 0',
+ 'new value:', ' = 1'])
- # The watchpoint command "forced" our global variable 'cookie' to become 777.
+ # The watchpoint command "forced" our global variable 'cookie' to
+ # become 777.
self.expect("frame variable --show-globals cookie",
- substrs = ['(int32_t)', 'cookie = 777'])
-
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["linux"], archs=["aarch64"], bugnumber="llvm.org/pr27710")
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ substrs=['(int32_t)', 'cookie = 777'])
+
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["linux"],
+ archs=["aarch64"],
+ bugnumber="llvm.org/pr27710")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
def test_watchpoint_command_can_disable_a_watchpoint(self):
"""Test that 'watchpoint command' action can disable a watchpoint after it is triggered."""
self.build(dictionary=self.d)
@@ -96,7 +121,8 @@ class WatchpointLLDBCommandTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Add a breakpoint to set a watchpoint when stopped on the breakpoint.
- lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.line, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -104,39 +130,46 @@ class WatchpointLLDBCommandTestCase(TestBase):
# We should be stopped again due to the breakpoint.
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# Now let's set a write-type watchpoint for 'global'.
- self.expect("watchpoint set variable -w write global", WATCHPOINT_CREATED,
- substrs = ['Watchpoint created', 'size = 4', 'type = w',
- '%s:%d' % (self.source, self.decl)])
+ self.expect(
+ "watchpoint set variable -w write global",
+ WATCHPOINT_CREATED,
+ substrs=[
+ 'Watchpoint created',
+ 'size = 4',
+ 'type = w',
+ '%s:%d' %
+ (self.source,
+ self.decl)])
self.runCmd('watchpoint command add 1 -o "watchpoint disable 1"')
# List the watchpoint command we just added.
self.expect("watchpoint command list 1",
- substrs = ['watchpoint disable 1'])
+ substrs=['watchpoint disable 1'])
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should be 0 initially.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 0'])
+ substrs=['hit_count = 0'])
self.runCmd("process continue")
# We should be stopped again due to the watchpoint (write type).
# The stop reason of the thread should be watchpoint.
self.expect("thread backtrace", STOPPED_DUE_TO_WATCHPOINT,
- substrs = ['stop reason = watchpoint'])
+ substrs=['stop reason = watchpoint'])
# Check that the watchpoint has been disabled.
self.expect("watchpoint list -v",
- substrs = ['disabled'])
+ substrs=['disabled'])
self.runCmd("process continue")
# There should be no more watchpoint hit and the process status should
# be 'exited'.
self.expect("process status",
- substrs = ['exited'])
+ substrs=['exited'])
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py
index f6ea4fc16861..16a34428ad70 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py
@@ -5,13 +5,14 @@ Test 'watchpoint command'.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class WatchpointPythonCommandTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -22,17 +23,26 @@ class WatchpointPythonCommandTestCase(TestBase):
# Our simple source filename.
self.source = 'main.cpp'
# Find the line number to break inside main().
- self.line = line_number(self.source, '// Set break point at this line.')
+ self.line = line_number(
+ self.source, '// Set break point at this line.')
# And the watchpoint variable declaration line number.
- self.decl = line_number(self.source, '// Watchpoint variable declaration.')
- # Build dictionary to have unique executable names for each test method.
+ self.decl = line_number(self.source,
+ '// Watchpoint variable declaration.')
+ # Build dictionary to have unique executable names for each test
+ # method.
self.exe_name = self.testMethodName
self.d = {'CXX_SOURCES': self.source, 'EXE': self.exe_name}
- @skipIfFreeBSD # timing out on buildbot
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["linux"], archs=["aarch64"], bugnumber="llvm.org/pr27710")
+ @skipIfFreeBSD # timing out on buildbot
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["linux"],
+ archs=["aarch64"],
+ bugnumber="llvm.org/pr27710")
def test_watchpoint_command(self):
"""Test 'watchpoint command'."""
self.build(dictionary=self.d)
@@ -42,10 +52,8 @@ class WatchpointPythonCommandTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Add a breakpoint to set a watchpoint when stopped on the breakpoint.
- lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
-# self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
-# startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
-# (self.source, self.line))#
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.line, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -53,46 +61,60 @@ class WatchpointPythonCommandTestCase(TestBase):
# We should be stopped again due to the breakpoint.
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# Now let's set a write-type watchpoint for 'global'.
- self.expect("watchpoint set variable -w write global", WATCHPOINT_CREATED,
- substrs = ['Watchpoint created', 'size = 4', 'type = w',
- '%s:%d' % (self.source, self.decl)])
-
- self.runCmd('watchpoint command add -s python 1 -o \'frame.EvaluateExpression("cookie = 777")\'')
+ self.expect(
+ "watchpoint set variable -w write global",
+ WATCHPOINT_CREATED,
+ substrs=[
+ 'Watchpoint created',
+ 'size = 4',
+ 'type = w',
+ '%s:%d' %
+ (self.source,
+ self.decl)])
+
+ self.runCmd(
+ 'watchpoint command add -s python 1 -o \'frame.EvaluateExpression("cookie = 777")\'')
# List the watchpoint command we just added.
self.expect("watchpoint command list 1",
- substrs = ['frame.EvaluateExpression', 'cookie = 777'])
+ substrs=['frame.EvaluateExpression', 'cookie = 777'])
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should be 0 initially.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 0'])
+ substrs=['hit_count = 0'])
self.runCmd("process continue")
# We should be stopped again due to the watchpoint (write type).
# The stop reason of the thread should be watchpoint.
self.expect("thread backtrace", STOPPED_DUE_TO_WATCHPOINT,
- substrs = ['stop reason = watchpoint'])
+ substrs=['stop reason = watchpoint'])
# Check that the watchpoint snapshoting mechanism is working.
self.expect("watchpoint list -v",
- substrs = ['old value:', ' = 0',
- 'new value:', ' = 1'])
+ substrs=['old value:', ' = 0',
+ 'new value:', ' = 1'])
- # The watchpoint command "forced" our global variable 'cookie' to become 777.
+ # The watchpoint command "forced" our global variable 'cookie' to
+ # become 777.
self.expect("frame variable --show-globals cookie",
- substrs = ['(int32_t)', 'cookie = 777'])
-
- @skipIfFreeBSD # timing out on buildbot
- @expectedFailureAll(bugnumber="llvm.org/pr28055: continue in watchpoint commands disables the watchpoint")
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["linux"], archs=["aarch64"], bugnumber="llvm.org/pr27710")
+ substrs=['(int32_t)', 'cookie = 777'])
+
+ @skipIfFreeBSD # timing out on buildbot
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["linux"],
+ archs=["aarch64"],
+ bugnumber="llvm.org/pr27710")
def test_continue_in_watchpoint_command(self):
"""Test continue in a watchpoint command."""
self.build(dictionary=self.d)
@@ -102,10 +124,8 @@ class WatchpointPythonCommandTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Add a breakpoint to set a watchpoint when stopped on the breakpoint.
- lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
-# self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
-# startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
-# (self.source, self.line))#
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.line, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -113,31 +133,40 @@ class WatchpointPythonCommandTestCase(TestBase):
# We should be stopped again due to the breakpoint.
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# Now let's set a write-type watchpoint for 'global'.
- self.expect("watchpoint set variable -w write global", WATCHPOINT_CREATED,
- substrs = ['Watchpoint created', 'size = 4', 'type = w',
- '%s:%d' % (self.source, self.decl)])
+ self.expect(
+ "watchpoint set variable -w write global",
+ WATCHPOINT_CREATED,
+ substrs=[
+ 'Watchpoint created',
+ 'size = 4',
+ 'type = w',
+ '%s:%d' %
+ (self.source,
+ self.decl)])
cmd_script_file = os.path.join(os.getcwd(), "watchpoint_command.py")
- self.runCmd("command script import '%s'"%(cmd_script_file))
+ self.runCmd("command script import '%s'" % (cmd_script_file))
- self.runCmd('watchpoint command add -F watchpoint_command.watchpoint_command')
+ self.runCmd(
+ 'watchpoint command add -F watchpoint_command.watchpoint_command')
# List the watchpoint command we just added.
self.expect("watchpoint command list 1",
- substrs = ['watchpoint_command.watchpoint_command'])
+ substrs=['watchpoint_command.watchpoint_command'])
self.runCmd("process continue")
# We should be stopped again due to the watchpoint (write type).
# The stop reason of the thread should be watchpoint.
self.expect("thread backtrace", STOPPED_DUE_TO_WATCHPOINT,
- substrs = ['stop reason = watchpoint'])
+ substrs=['stop reason = watchpoint'])
# We should have hit the watchpoint once, set cookie to 888, then continued to the
# second hit and set it to 999
self.expect("frame variable --show-globals cookie",
- substrs = ['(int32_t)', 'cookie = 999'])
+ substrs=['(int32_t)', 'cookie = 999'])
+
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/watchpoint_command.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/watchpoint_command.py
index 575a5160d219..ae5913a500e0 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/watchpoint_command.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/watchpoint_command.py
@@ -1,7 +1,9 @@
import lldb
num_hits = 0
-def watchpoint_command (frame, wp, dict):
+
+
+def watchpoint_command(frame, wp, dict):
global num_hits
if num_hits == 0:
print ("I stopped the first time")
@@ -9,6 +11,5 @@ def watchpoint_command (frame, wp, dict):
num_hits += 1
frame.thread.process.Continue()
else:
- print ("I stopped the %d time"%(num_hits))
+ print ("I stopped the %d time" % (num_hits))
frame.EvaluateExpression("cookie = 999")
-
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py
index 64e01e5cb937..5a16856149ba 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py
@@ -5,13 +5,14 @@ Test watchpoint modify command to set condition on a watchpoint.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class WatchpointConditionCmdTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -22,16 +23,25 @@ class WatchpointConditionCmdTestCase(TestBase):
# Our simple source filename.
self.source = 'main.cpp'
# Find the line number to break inside main().
- self.line = line_number(self.source, '// Set break point at this line.')
+ self.line = line_number(
+ self.source, '// Set break point at this line.')
# And the watchpoint variable declaration line number.
- self.decl = line_number(self.source, '// Watchpoint variable declaration.')
- # Build dictionary to have unique executable names for each test method.
+ self.decl = line_number(self.source,
+ '// Watchpoint variable declaration.')
+ # Build dictionary to have unique executable names for each test
+ # method.
self.exe_name = self.testMethodName
self.d = {'CXX_SOURCES': self.source, 'EXE': self.exe_name}
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["linux"], archs=["aarch64"], bugnumber="llvm.org/pr27710")
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["linux"],
+ archs=["aarch64"],
+ bugnumber="llvm.org/pr27710")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
def test_watchpoint_cond(self):
"""Test watchpoint condition."""
self.build(dictionary=self.d)
@@ -41,7 +51,8 @@ class WatchpointConditionCmdTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Add a breakpoint to set a watchpoint when stopped on the breakpoint.
- lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.line, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -49,32 +60,39 @@ class WatchpointConditionCmdTestCase(TestBase):
# We should be stopped again due to the breakpoint.
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# Now let's set a write-type watchpoint for 'global'.
# With a condition of 'global==5'.
- self.expect("watchpoint set variable -w write global", WATCHPOINT_CREATED,
- substrs = ['Watchpoint created', 'size = 4', 'type = w',
- '%s:%d' % (self.source, self.decl)])
+ self.expect(
+ "watchpoint set variable -w write global",
+ WATCHPOINT_CREATED,
+ substrs=[
+ 'Watchpoint created',
+ 'size = 4',
+ 'type = w',
+ '%s:%d' %
+ (self.source,
+ self.decl)])
self.runCmd("watchpoint modify -c 'global==5'")
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should be 0 initially.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 0', 'global==5'])
+ substrs=['hit_count = 0', 'global==5'])
self.runCmd("process continue")
# We should be stopped again due to the watchpoint (write type).
# The stop reason of the thread should be watchpoint.
self.expect("thread backtrace", STOPPED_DUE_TO_WATCHPOINT,
- substrs = ['stop reason = watchpoint'])
+ substrs=['stop reason = watchpoint'])
self.expect("frame variable --show-globals global",
- substrs = ['(int32_t)', 'global = 5'])
+ substrs=['(int32_t)', 'global = 5'])
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should now be 2.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 5'])
+ substrs=['hit_count = 5'])
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/Makefile b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/Makefile
new file mode 100644
index 000000000000..b09a579159d4
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+C_SOURCES := main.c
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/TestWatchpointDisable.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/TestWatchpointDisable.py
new file mode 100644
index 000000000000..aac001e9db5a
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/TestWatchpointDisable.py
@@ -0,0 +1,88 @@
+"""
+Test that the SBWatchpoint::SetEnable API works.
+"""
+
+import os
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+from lldbsuite.test import lldbplatform, lldbplatformutil
+
+
+class TestWatchpointSetEnable(TestBase):
+ mydir = TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ # Call super's setUp().
+ TestBase.setUp(self)
+
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ def test_disable_works (self):
+ """Set a watchpoint, disable it, and make sure it doesn't get hit."""
+ self.build()
+ self.do_test(False)
+
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ def test_disable_enable_works (self):
+ """Set a watchpoint, disable it, and make sure it doesn't get hit."""
+ self.build()
+ self.do_test(True)
+
+ def do_test(self, test_enable):
+ """Set a watchpoint, disable it and make sure it doesn't get hit."""
+
+ exe = 'a.out'
+
+ exe = os.path.join(os.getcwd(), exe)
+ main_file_spec = lldb.SBFileSpec("main.c")
+
+ # Create a target by the debugger.
+ self.target = self.dbg.CreateTarget(exe)
+ self.assertTrue(self.target, VALID_TARGET)
+ cwd = os.getcwd()
+
+
+ bkpt_before = self.target.BreakpointCreateBySourceRegex("Set a breakpoint here", main_file_spec)
+ self.assertEqual(bkpt_before.GetNumLocations(), 1, "Failed setting the before breakpoint.")
+
+ bkpt_after = self.target.BreakpointCreateBySourceRegex("We should have stopped", main_file_spec)
+ self.assertEqual(bkpt_after.GetNumLocations(), 1, "Failed setting the after breakpoint.")
+
+ process = self.target.LaunchSimple(
+ None, None, self.get_process_working_directory())
+ self.assertTrue(process, PROCESS_IS_VALID)
+
+ thread = lldbutil.get_one_thread_stopped_at_breakpoint(process, bkpt_before)
+ self.assertTrue(thread.IsValid(), "We didn't stop at the before breakpoint.")
+
+ ret_val = lldb.SBCommandReturnObject()
+ self.dbg.GetCommandInterpreter().HandleCommand("watchpoint set variable -w write global_var", ret_val)
+ self.assertTrue(ret_val.Succeeded(), "Watchpoint set variable did not return success.")
+
+ wp = self.target.FindWatchpointByID(1)
+ self.assertTrue(wp.IsValid(), "Didn't make a valid watchpoint.")
+ self.assertTrue(wp.GetWatchAddress() != lldb.LLDB_INVALID_ADDRESS, "Watch address is invalid")
+
+ wp.SetEnabled(False)
+ self.assertTrue(not wp.IsEnabled(), "The watchpoint thinks it is still enabled")
+
+ process.Continue()
+
+ stop_reason = thread.GetStopReason()
+
+ self.assertEqual(stop_reason, lldb.eStopReasonBreakpoint, "We didn't stop at our breakpoint.")
+
+ if test_enable:
+ wp.SetEnabled(True)
+ self.assertTrue(wp.IsEnabled(), "The watchpoint thinks it is still disabled.")
+ process.Continue()
+ stop_reason = thread.GetStopReason()
+ self.assertEqual(stop_reason, lldb.eStopReasonWatchpoint, "We didn't stop at our watchpoint")
+
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/main.c b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/main.c
new file mode 100644
index 000000000000..dcbc766c5949
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/main.c
@@ -0,0 +1,13 @@
+#include <stdio.h>
+
+int global_var = 10;
+
+int
+main()
+{
+ printf("Set a breakpoint here: %d.\n", global_var);
+ global_var = 20;
+ printf("We should have stopped on the previous line: %d.\n", global_var);
+ global_var = 30;
+ return 0;
+}
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/TestWatchpointEvents.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/TestWatchpointEvents.py
index fdeb4b8fa3b5..02180a127a8e 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/TestWatchpointEvents.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/TestWatchpointEvents.py
@@ -3,13 +3,14 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestWatchpointEvents (TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -21,71 +22,99 @@ class TestWatchpointEvents (TestBase):
self.main_source = "main.c"
@add_test_categories(['pyapi'])
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["linux"], archs=["aarch64"], bugnumber="llvm.org/pr27710")
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["linux"],
+ archs=["aarch64"],
+ bugnumber="llvm.org/pr27710")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
def test_with_python_api(self):
"""Test that adding, deleting and modifying watchpoints sends the appropriate events."""
self.build()
-
+
exe = os.path.join(os.getcwd(), "a.out")
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- self.main_source_spec = lldb.SBFileSpec (self.main_source)
+ self.main_source_spec = lldb.SBFileSpec(self.main_source)
- break_in_main = target.BreakpointCreateBySourceRegex ('// Put a breakpoint here.', self.main_source_spec)
+ break_in_main = target.BreakpointCreateBySourceRegex(
+ '// Put a breakpoint here.', self.main_source_spec)
self.assertTrue(break_in_main, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
- threads = lldbutil.get_threads_stopped_at_breakpoint (process, break_in_main)
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ process, break_in_main)
if len(threads) != 1:
- self.fail ("Failed to stop at first breakpoint in main.")
+ self.fail("Failed to stop at first breakpoint in main.")
thread = threads[0]
frame = thread.GetFrameAtIndex(0)
- local_var = frame.FindVariable ("local_var")
- self.assertTrue (local_var.IsValid())
+ local_var = frame.FindVariable("local_var")
+ self.assertTrue(local_var.IsValid())
self.listener = lldb.SBListener("com.lldb.testsuite_listener")
self.target_bcast = target.GetBroadcaster()
- self.target_bcast.AddListener (self.listener, lldb.SBTarget.eBroadcastBitWatchpointChanged)
- self.listener.StartListeningForEvents (self.target_bcast, lldb.SBTarget.eBroadcastBitWatchpointChanged)
+ self.target_bcast.AddListener(
+ self.listener, lldb.SBTarget.eBroadcastBitWatchpointChanged)
+ self.listener.StartListeningForEvents(
+ self.target_bcast, lldb.SBTarget.eBroadcastBitWatchpointChanged)
error = lldb.SBError()
local_watch = local_var.Watch(True, False, True, error)
if not error.Success():
- self.fail ("Failed to make watchpoint for local_var: %s"%(error.GetCString()))
+ self.fail(
+ "Failed to make watchpoint for local_var: %s" %
+ (error.GetCString()))
- self.GetWatchpointEvent (lldb.eWatchpointEventTypeAdded)
- # Now change some of the features of this watchpoint and make sure we get events:
+ self.GetWatchpointEvent(lldb.eWatchpointEventTypeAdded)
+ # Now change some of the features of this watchpoint and make sure we
+ # get events:
local_watch.SetEnabled(False)
- self.GetWatchpointEvent (lldb.eWatchpointEventTypeDisabled)
+ self.GetWatchpointEvent(lldb.eWatchpointEventTypeDisabled)
+
+ local_watch.SetEnabled(True)
+ self.GetWatchpointEvent(lldb.eWatchpointEventTypeEnabled)
local_watch.SetIgnoreCount(10)
- self.GetWatchpointEvent (lldb.eWatchpointEventTypeIgnoreChanged)
+ self.GetWatchpointEvent(lldb.eWatchpointEventTypeIgnoreChanged)
+
+ condition = "1 == 2"
+ local_watch.SetCondition(condition)
+ self.GetWatchpointEvent(lldb.eWatchpointEventTypeConditionChanged)
- local_watch.SetCondition ("1 == 2")
- self.GetWatchpointEvent (lldb.eWatchpointEventTypeConditionChanged)
+ self.assertTrue(local_watch.GetCondition() == condition,
+ 'make sure watchpoint condition is "' + condition + '"')
- def GetWatchpointEvent (self, event_type):
+ def GetWatchpointEvent(self, event_type):
# We added a watchpoint so we should get a watchpoint added event.
event = lldb.SBEvent()
- success = self.listener.WaitForEvent (1, event)
- self.assertTrue(success == True, "Successfully got watchpoint event")
- self.assertTrue (lldb.SBWatchpoint.EventIsWatchpointEvent(event), "Event is a watchpoint event.")
- found_type = lldb.SBWatchpoint.GetWatchpointEventTypeFromEvent (event)
- self.assertTrue (found_type == event_type, "Event is not correct type, expected: %d, found: %d"%(event_type, found_type))
+ success = self.listener.WaitForEvent(1, event)
+ self.assertTrue(success, "Successfully got watchpoint event")
+ self.assertTrue(
+ lldb.SBWatchpoint.EventIsWatchpointEvent(event),
+ "Event is a watchpoint event.")
+ found_type = lldb.SBWatchpoint.GetWatchpointEventTypeFromEvent(event)
+ self.assertTrue(
+ found_type == event_type,
+ "Event is not correct type, expected: %d, found: %d" %
+ (event_type,
+ found_type))
# There shouldn't be another event waiting around:
- found_event = self.listener.PeekAtNextEventForBroadcasterWithType (self.target_bcast, lldb.SBTarget.eBroadcastBitBreakpointChanged, event)
+ found_event = self.listener.PeekAtNextEventForBroadcasterWithType(
+ self.target_bcast, lldb.SBTarget.eBroadcastBitBreakpointChanged, event)
if found_event:
print("Found an event I didn't expect: ", event)
- self.assertTrue (not found_event, "Only one event per change.")
+ self.assertTrue(not found_event, "Only one event per change.")
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_on_vectors/TestValueOfVectorVariable.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_on_vectors/TestValueOfVectorVariable.py
index c66ddb512884..3f301fd9f1a9 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_on_vectors/TestValueOfVectorVariable.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_on_vectors/TestValueOfVectorVariable.py
@@ -5,25 +5,29 @@ Test displayed value of a vector variable while doing watchpoint operations
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestValueOfVectorVariableTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
def test_value_of_vector_variable_using_watchpoint_set(self):
"""Test verify displayed value of vector variable."""
self.build(dictionary=self.d)
self.setTearDownCleanup(dictionary=self.d)
self.value_of_vector_variable_with_watchpoint_set()
-
+
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
@@ -39,10 +43,12 @@ class TestValueOfVectorVariableTestCase(TestBase):
# Set break to get a frame
self.runCmd("b main")
-
+
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
# Value of a vector variable should be displayed correctly
- self.expect("watchpoint set variable global_vector", WATCHPOINT_CREATED,
- substrs = ['new value: (1, 2, 3, 4)'])
+ self.expect(
+ "watchpoint set variable global_vector",
+ WATCHPOINT_CREATED,
+ substrs=['new value: (1, 2, 3, 4)'])
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py
index 735a5678c4f9..1a94276c58e8 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py
@@ -5,13 +5,14 @@ Test lldb watchpoint that uses 'watchpoint set -w write -s size' to watch a poin
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class WatchLocationUsingWatchpointSetTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -22,14 +23,24 @@ class WatchLocationUsingWatchpointSetTestCase(TestBase):
# Our simple source filename.
self.source = 'main.cpp'
# Find the line number to break inside main().
- self.line = line_number(self.source, '// Set break point at this line.')
+ self.line = line_number(
+ self.source, '// Set break point at this line.')
# This is for verifying that watch location works.
- self.violating_func = "do_bad_thing_with_location";
- # Build dictionary to have unique executable names for each test method.
-
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["linux"], archs=['aarch64', 'arm'], bugnumber="llvm.org/pr26031")
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ self.violating_func = "do_bad_thing_with_location"
+ # Build dictionary to have unique executable names for each test
+ # method.
+
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["linux"],
+ archs=[
+ 'aarch64',
+ 'arm'],
+ bugnumber="llvm.org/pr26031")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
def test_watchlocation_using_watchpoint_set(self):
"""Test watching a location with 'watchpoint set expression -w write -s size' option."""
self.build()
@@ -39,7 +50,8 @@ class WatchLocationUsingWatchpointSetTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Add a breakpoint to set a watchpoint when stopped on the breakpoint.
- lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.line, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -47,45 +59,52 @@ class WatchLocationUsingWatchpointSetTestCase(TestBase):
# We should be stopped again due to the breakpoint.
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# Now let's set a write-type watchpoint pointed to by 'g_char_ptr' and
# with offset as 7.
# The main.cpp, by design, misbehaves by not following the agreed upon
# protocol of only accessing the allowable index range of [0, 6].
- self.expect("watchpoint set expression -w write -s 1 -- g_char_ptr + 7", WATCHPOINT_CREATED,
- substrs = ['Watchpoint created', 'size = 1', 'type = w'])
+ self.expect(
+ "watchpoint set expression -w write -s 1 -- g_char_ptr + 7",
+ WATCHPOINT_CREATED,
+ substrs=[
+ 'Watchpoint created',
+ 'size = 1',
+ 'type = w'])
self.runCmd("expr unsigned val = g_char_ptr[7]; val")
self.expect(self.res.GetOutput().splitlines()[0], exe=False,
- endstr = ' = 0')
+ endstr=' = 0')
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should be 0 initially.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 0'])
+ substrs=['hit_count = 0'])
self.runCmd("process continue")
# We should be stopped again due to the watchpoint (write type), but
# only once. The stop reason of the thread should be watchpoint.
self.expect("thread list", STOPPED_DUE_TO_WATCHPOINT,
- substrs = ['stopped',
- 'stop reason = watchpoint',
- self.violating_func])
+ substrs=['stopped',
+ 'stop reason = watchpoint',
+ self.violating_func])
- # Switch to the thread stopped due to watchpoint and issue some commands.
+ # Switch to the thread stopped due to watchpoint and issue some
+ # commands.
self.switch_to_thread_with_stop_reason(lldb.eStopReasonWatchpoint)
self.runCmd("thread backtrace")
self.runCmd("expr unsigned val = g_char_ptr[7]; val")
self.expect(self.res.GetOutput().splitlines()[0], exe=False,
- endstr = ' = 99')
+ endstr=' = 99')
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should now be the same as the number of threads that
# stopped on a watchpoint.
- threads = lldbutil.get_stopped_threads(self.process(), lldb.eStopReasonWatchpoint)
+ threads = lldbutil.get_stopped_threads(
+ self.process(), lldb.eStopReasonWatchpoint)
self.expect("watchpoint list -v",
- substrs = ['hit_count = %d' % len(threads)])
+ substrs=['hit_count = %d' % len(threads)])
self.runCmd("thread backtrace all")
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py
index 43597ec28f59..7460a1c09476 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py
@@ -5,13 +5,14 @@ Test error cases for the 'watchpoint set' command to make sure it errors out whe
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class WatchpointSetErrorTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -22,10 +23,11 @@ class WatchpointSetErrorTestCase(TestBase):
# Our simple source filename.
self.source = 'main.cpp'
# Find the line number to break inside main().
- self.line = line_number(self.source, '// Set break point at this line.')
- # Build dictionary to have unique executable names for each test method.
+ self.line = line_number(
+ self.source, '// Set break point at this line.')
+ # Build dictionary to have unique executable names for each test
+ # method.
- @expectedFailureAll(oslist=["windows"])
def test_error_cases_with_watchpoint_set(self):
"""Test error cases with the 'watchpoint set' command."""
self.build()
@@ -35,7 +37,8 @@ class WatchpointSetErrorTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Add a breakpoint to set a watchpoint when stopped on the breakpoint.
- lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.line, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -43,27 +46,29 @@ class WatchpointSetErrorTestCase(TestBase):
# We should be stopped again due to the breakpoint.
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# Try some error conditions:
# 'watchpoint set' is now a multiword command.
self.expect("watchpoint set",
- substrs = ['The following subcommands are supported:',
- 'expression',
- 'variable'])
+ substrs=['The following subcommands are supported:',
+ 'expression',
+ 'variable'])
self.runCmd("watchpoint set variable -w read_write", check=False)
# 'watchpoint set expression' with '-w' or '-s' specified now needs
# an option terminator and a raw expression after that.
self.expect("watchpoint set expression -w write --", error=True,
- startstr = 'error: ')
+ startstr='error: ')
# It's an error if the expression did not evaluate to an address.
- self.expect("watchpoint set expression MyAggregateDataType", error=True,
- startstr = 'error: expression did not evaluate to an address')
+ self.expect(
+ "watchpoint set expression MyAggregateDataType",
+ error=True,
+ startstr='error: expression did not evaluate to an address')
# Wrong size parameter is an error.
self.expect("watchpoint set variable -s -128", error=True,
- substrs = ['invalid enumeration value'])
+ substrs=['invalid enumeration value'])
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/TestWatchpointSizes.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/TestWatchpointSizes.py
index 55e36649ce10..e342e34667fe 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/TestWatchpointSizes.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/TestWatchpointSizes.py
@@ -7,12 +7,14 @@ when they are packed in a 8-byte region.
from __future__ import print_function
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class WatchpointSizeTestCase(TestBase):
NO_DEBUG_INFO_TESTCASE = True
@@ -29,23 +31,35 @@ class WatchpointSizeTestCase(TestBase):
self.exe_name = 'a.out'
self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
- @expectedFailureAll(archs=['s390x']) # Read-write watchpoints not supported on SystemZ
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ # Read-write watchpoints not supported on SystemZ
+ @expectedFailureAll(archs=['s390x'])
def test_byte_size_watchpoints_with_byte_selection(self):
"""Test to selectively watch different bytes in a 8-byte array."""
self.run_watchpoint_size_test('byteArray', 8, '1')
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
- @expectedFailureAll(archs=['s390x']) # Read-write watchpoints not supported on SystemZ
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ # Read-write watchpoints not supported on SystemZ
+ @expectedFailureAll(archs=['s390x'])
def test_two_byte_watchpoints_with_word_selection(self):
"""Test to selectively watch different words in an 8-byte word array."""
self.run_watchpoint_size_test('wordArray', 4, '2')
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
- @expectedFailureAll(archs=['s390x']) # Read-write watchpoints not supported on SystemZ
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ # Read-write watchpoints not supported on SystemZ
+ @expectedFailureAll(archs=['s390x'])
def test_four_byte_watchpoints_with_dword_selection(self):
"""Test to selectively watch two double words in an 8-byte dword array."""
self.run_watchpoint_size_test('dwordArray', 2, '4')
@@ -61,8 +75,8 @@ class WatchpointSizeTestCase(TestBase):
loc_line = line_number('main.c', '// About to write ' + arrayName)
# Set a breakpoint on the line detected above.
- lldbutil.run_break_set_by_file_and_line (self, "main.c",loc_line,
- num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", loc_line, num_expected_locations=1, loc_exact=True)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -71,46 +85,55 @@ class WatchpointSizeTestCase(TestBase):
# We should be stopped again due to the breakpoint.
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped', 'stop reason = breakpoint'])
+ substrs=['stopped', 'stop reason = breakpoint'])
# Set a read_write type watchpoint arrayName
- watch_loc=arrayName+"[" + str(i) + "]"
- self.expect("watchpoint set variable -w read_write " + watch_loc,
+ watch_loc = arrayName + "[" + str(i) + "]"
+ self.expect(
+ "watchpoint set variable -w read_write " +
+ watch_loc,
WATCHPOINT_CREATED,
- substrs = ['Watchpoint created', 'size = ' + watchsize, 'type = rw'])
+ substrs=[
+ 'Watchpoint created',
+ 'size = ' +
+ watchsize,
+ 'type = rw'])
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should be 0 initially.
- self.expect("watchpoint list -v", substrs = ['hit_count = 0'])
+ self.expect("watchpoint list -v", substrs=['hit_count = 0'])
self.runCmd("process continue")
# We should be stopped due to the watchpoint.
# The stop reason of the thread should be watchpoint.
self.expect("thread list", STOPPED_DUE_TO_WATCHPOINT,
- substrs = ['stopped', 'stop reason = watchpoint'])
+ substrs=['stopped', 'stop reason = watchpoint'])
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should now be 1.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 1'])
+ substrs=['hit_count = 1'])
self.runCmd("process continue")
# We should be stopped due to the watchpoint.
# The stop reason of the thread should be watchpoint.
self.expect("thread list", STOPPED_DUE_TO_WATCHPOINT,
- substrs = ['stopped', 'stop reason = watchpoint'])
+ substrs=['stopped', 'stop reason = watchpoint'])
# Use the '-v' option to do verbose listing of the watchpoint.
# The hit count should now be 1.
# Verify hit_count has been updated after value has been read.
self.expect("watchpoint list -v",
- substrs = ['hit_count = 2'])
+ substrs=['hit_count = 2'])
- # Delete the watchpoint immediately, but set auto-confirm to true first.
+ # Delete the watchpoint immediately, but set auto-confirm to true
+ # first.
self.runCmd("settings set auto-confirm true")
- self.expect("watchpoint delete", substrs = ['All watchpoints removed.'])
+ self.expect(
+ "watchpoint delete",
+ substrs=['All watchpoints removed.'])
# Restore the original setting of auto-confirm.
self.runCmd("settings clear auto-confirm")