[Lldb-commits] [lldb] r313265 - Remove uses of std::auto_ptr, it's going away in C++17.
Author: d0k Date: Thu Sep 14 08:01:55 2017 New Revision: 313265 URL: http://llvm.org/viewvc/llvm-project?rev=313265&view=rev Log: Remove uses of std::auto_ptr, it's going away in C++17. std::unique_ptr is pretty much a drop-in replacement here. Also remove nullptr checks that are doing nothing. Modified: lldb/trunk/source/Core/IOHandler.cpp lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp lldb/trunk/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp lldb/trunk/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Modified: lldb/trunk/source/Core/IOHandler.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/IOHandler.cpp?rev=313265&r1=313264&r2=313265&view=diff == --- lldb/trunk/source/Core/IOHandler.cpp (original) +++ lldb/trunk/source/Core/IOHandler.cpp Thu Sep 14 08:01:55 2017 @@ -1146,7 +1146,7 @@ public: const char *text = m_delegate_sp->WindowDelegateGetHelpText(); KeyHelp *key_help = m_delegate_sp->WindowDelegateGetKeyHelp(); if ((text && text[0]) || key_help) { -std::auto_ptr help_delegate_ap( +std::unique_ptr help_delegate_ap( new HelpDialogDelegate(text, key_help)); const size_t num_lines = help_delegate_ap->GetNumLines(); const size_t max_length = help_delegate_ap->GetMaxLineLength(); Modified: lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp?rev=313265&r1=313264&r2=313265&view=diff == --- lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp (original) +++ lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp Thu Sep 14 08:01:55 2017 @@ -167,10 +167,7 @@ EmulateInstructionARM64::CreateInstance( if (EmulateInstructionARM64::SupportsEmulatingInstructionsOfTypeStatic( inst_type)) { if (arch.GetTriple().getArch() == llvm::Triple::aarch64) { - std::auto_ptr emulate_insn_ap( - new EmulateInstructionARM64(arch)); - if (emulate_insn_ap.get()) -return emulate_insn_ap.release(); + return new EmulateInstructionARM64(arch); } } Modified: lldb/trunk/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp?rev=313265&r1=313264&r2=313265&view=diff == --- lldb/trunk/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp (original) +++ lldb/trunk/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp Thu Sep 14 08:01:55 2017 @@ -212,10 +212,7 @@ EmulateInstructionMIPS::CreateInstance(c inst_type)) { if (arch.GetTriple().getArch() == llvm::Triple::mips || arch.GetTriple().getArch() == llvm::Triple::mipsel) { - std::auto_ptr emulate_insn_ap( - new EmulateInstructionMIPS(arch)); - if (emulate_insn_ap.get()) -return emulate_insn_ap.release(); + return new EmulateInstructionMIPS(arch); } } Modified: lldb/trunk/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp?rev=313265&r1=313264&r2=313265&view=diff == --- lldb/trunk/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp (original) +++ lldb/trunk/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp Thu Sep 14 08:01:55 2017 @@ -199,10 +199,7 @@ EmulateInstructionMIPS64::CreateInstance inst_type)) { if (arch.GetTriple().getArch() == llvm::Triple::mips64 || arch.GetTriple().getArch() == llvm::Triple::mips64el) { - std::auto_ptr emulate_insn_ap( - new EmulateInstructionMIPS64(arch)); - if (emulate_insn_ap.get()) -return emulate_insn_ap.release(); + return new EmulateInstructionMIPS64(arch); } } Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=313265&r1=313264&r2=313265&view=diff == --- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original) +++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Thu Sep 14 08:01:55 2017 @@ -451,7 +451,7 @@ ObjectFile *ObjectFileELF::CreateMemoryI if (ELFHeader::MagicBytesMatch(magic)) { unsigned address_size = ELFHeader::AddressSizeInBytes(magic); if (address_si
[Lldb-commits] [lldb] r313270 - [lit] Force site configs to be run before source-tree configs
Author: zturner Date: Thu Sep 14 09:47:58 2017 New Revision: 313270 URL: http://llvm.org/viewvc/llvm-project?rev=313270&view=rev Log: [lit] Force site configs to be run before source-tree configs This patch simplifies LLVM's lit infrastructure by enforcing an ordering that a site config is always run before a source-tree config. A significant amount of the complexity from lit config files arises from the fact that inside of a source-tree config file, we don't yet know if the site config has been run. However it is *always* required to run a site config first, because it passes various variables down through CMake that the main config depends on. As a result, every config file has to do a bunch of magic to try to reverse-engineer the location of the site config file if they detect (heuristically) that the site config file has not yet been run. This patch solves the problem by emitting a mapping from source tree config file to binary tree site config file in llvm-lit.py. Then, during discovery when we find a config file, we check to see if we have a target mapping for it, and if so we use that instead. This mechanism is generic enough that it does not affect external users of lit. They will just not have a config mapping defined, and everything will work as normal. On the other hand, for us it allows us to make many simplifications: * We are guaranteed that a site config will be executed first * Inside of a main config, we no longer have to assume that attributes might not be present and use getattr everywhere. * We no longer have to pass parameters such as --param llvm_site_config= on the command line. * It is future-proof, meaning you don't have to edit llvm-lit.in to add support for new projects. * All of the duplicated logic of trying various fallback mechanisms of finding a site config from the main config are now gone. One potentially noteworthy thing that was required to implement this change is that whereas the ninja check targets previously used the first method to spawn lit, they now use the second. In particular, you can no longer run lit.py against the source tree while specifying the various `foo_site_config=` parameters. Instead, you need to run llvm-lit.py. Differential Revision: https://reviews.llvm.org/D37756 Modified: lldb/trunk/lit/Unit/lit.cfg lldb/trunk/lit/lit.cfg Modified: lldb/trunk/lit/Unit/lit.cfg URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Unit/lit.cfg?rev=313270&r1=313269&r2=313270&view=diff == --- lldb/trunk/lit/Unit/lit.cfg (original) +++ lldb/trunk/lit/Unit/lit.cfg Thu Sep 14 09:47:58 2017 @@ -6,19 +6,6 @@ import os import lit.formats -# Check that the object root is known. -if config.test_exec_root is None: -# Otherwise, we haven't loaded the site specific configuration (the user is -# probably trying to run on a test file directly, and either the site -# configuration hasn't been created by the build system, or we are in an -# out-of-tree build situation). - -# Check for 'llvm_unit_site_config' user parameter, and use that if available. -site_cfg = lit_config.params.get('lldb_unit_site_config', None) -if site_cfg and os.path.exists(site_cfg): -lit_config.load_config(config, site_cfg) -raise SystemExit - # name: The name of this test suite. config.name = 'lldb-Unit' @@ -31,6 +18,4 @@ config.test_source_root = os.path.join(c config.test_exec_root = config.test_source_root # testFormat: The test format to use to interpret tests. -if not hasattr(config, 'llvm_build_mode'): -lit_config.fatal("unable to find llvm_build_mode value on config") config.test_format = lit.formats.GoogleTest(config.llvm_build_mode, 'Tests') Modified: lldb/trunk/lit/lit.cfg URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/lit.cfg?rev=313270&r1=313269&r2=313270&view=diff == --- lldb/trunk/lit/lit.cfg (original) +++ lldb/trunk/lit/lit.cfg Thu Sep 14 09:47:58 2017 @@ -29,94 +29,24 @@ config.suffixes = [] config.test_source_root = os.path.dirname(__file__) # test_exec_root: The root path where tests should be run. -lldb_obj_root = getattr(config, 'lldb_obj_root', None) -if lldb_obj_root is not None: -config.test_exec_root = os.path.join(lldb_obj_root, 'lit') - -# Set llvm_{src,obj}_root for use by others. -config.llvm_src_root = getattr(config, 'llvm_src_root', None) -config.llvm_obj_root = getattr(config, 'llvm_obj_root', None) +config.test_exec_root = os.path.join(config.lldb_obj_root, 'lit') # Tweak the PATH to include the tools dir and the scripts dir. -if lldb_obj_root is not None: -lldb_tools_dir = getattr(config, 'lldb_tools_dir', None) -if not lldb_tools_dir: -lit_config.fatal('No LLDB tools dir set!') -llvm_tools_dir = getattr(config, 'llvm_tools_dir', None) -if not llvm_tools_dir: -lit_config.fat
[Lldb-commits] [lldb] r313293 - Add new files to the cmake lists.
Author: jingham Date: Thu Sep 14 13:31:02 2017 New Revision: 313293 URL: http://llvm.org/viewvc/llvm-project?rev=313293&view=rev Log: Add new files to the cmake lists. Modified: lldb/trunk/source/API/CMakeLists.txt lldb/trunk/source/Breakpoint/CMakeLists.txt Modified: lldb/trunk/source/API/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/CMakeLists.txt?rev=313293&r1=313292&r2=313293&view=diff == --- lldb/trunk/source/API/CMakeLists.txt (original) +++ lldb/trunk/source/API/CMakeLists.txt Thu Sep 14 13:31:02 2017 @@ -24,6 +24,8 @@ add_lldb_library(liblldb SHARED SBBlock.cpp SBBreakpoint.cpp SBBreakpointLocation.cpp + SBBreakpointName.cpp + SBBreakpointOptionCommon.cpp SBBroadcaster.cpp SBCommandInterpreter.cpp SBCommandReturnObject.cpp Modified: lldb/trunk/source/Breakpoint/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/CMakeLists.txt?rev=313293&r1=313292&r2=313293&view=diff == --- lldb/trunk/source/Breakpoint/CMakeLists.txt (original) +++ lldb/trunk/source/Breakpoint/CMakeLists.txt Thu Sep 14 13:31:02 2017 @@ -6,6 +6,7 @@ add_lldb_library(lldbBreakpoint BreakpointLocation.cpp BreakpointLocationCollection.cpp BreakpointLocationList.cpp + BreakpointName.cpp BreakpointOptions.cpp BreakpointResolver.cpp BreakpointResolverAddress.cpp ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r313296 - Remove BreakpointName.h from all targets so it doesn't
Author: jingham Date: Thu Sep 14 13:52:35 2017 New Revision: 313296 URL: http://llvm.org/viewvc/llvm-project?rev=313296&view=rev Log: Remove BreakpointName.h from all targets so it doesn't get included in headermaps or put in a CopyFiles phase. Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=313296&r1=313295&r2=313296&view=diff == --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Sep 14 13:52:35 2017 @@ -726,7 +726,6 @@ 4C56543719D22B32002E9C44 /* SBThreadPlan.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C56543619D22B32002E9C44 /* SBThreadPlan.cpp */; }; 4C7D48241F5099A1005314B4 /* SymbolFileDWARFDwp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C7D481C1F509963005314B4 /* SymbolFileDWARFDwp.cpp */; }; 4C7D48251F5099B2005314B4 /* SymbolFileDWARFDwoDwp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C7D481F1F509964005314B4 /* SymbolFileDWARFDwoDwp.cpp */; }; - 4C7D482C1F509CF5005314B4 /* BreakpointName.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4C7D482B1F509CF5005314B4 /* BreakpointName.h */; }; 4C877B391F30EF990068FCFB /* SBProcessInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 4987FB201F30EC9900E5C17D /* SBProcessInfo.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4C88BC2A1BA3722B00AA0964 /* Expression.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C88BC291BA3722B00AA0964 /* Expression.cpp */; }; 4C88BC2D1BA391B000AA0964 /* UserExpression.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C0083331B9A5DE200D5CF24 /* UserExpression.cpp */; }; @@ -1235,7 +1234,6 @@ files = ( 9A20570F1F3B821A00F6C293 /* test-dwarf.cpp in CopyFiles */, 9A2057101F3B821A00F6C293 /* test-dwarf.exe in CopyFiles */, - 4C7D482C1F509CF5005314B4 /* BreakpointName.h in CopyFiles */, AF90106515AB7D3600FF120D /* lldb.1 in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 1; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r313305 - Mention breakpoint names in the tutorial.
Author: jingham Date: Thu Sep 14 15:20:31 2017 New Revision: 313305 URL: http://llvm.org/viewvc/llvm-project?rev=313305&view=rev Log: Mention breakpoint names in the tutorial. Modified: lldb/trunk/www/tutorial.html Modified: lldb/trunk/www/tutorial.html URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/www/tutorial.html?rev=313305&r1=313304&r2=313305&view=diff == --- lldb/trunk/www/tutorial.html (original) +++ lldb/trunk/www/tutorial.html Thu Sep 14 15:20:31 2017 @@ -248,9 +248,9 @@ - - Setting breakpoints - + + Setting breakpoints + We've discussed how to set breakpoints above. You can use help breakpoint set to see all the options for breakpoint setting. For instance, we might do: @@ -350,6 +350,67 @@ Current breakpoints: + + + Breakpoint Names + + +Breakpoints carry two orthognal sets of information: one specifies where to + set the breakpoint, and the other how to react when the breakpoint is hit. + The latter set of information (e.g. commands, conditions, hit-count, auto-continue...) + we call breakpoint options. + It is fairly common to want to apply one set of options to a number of breakpoints. + For instance, you might want to check that self == nil and if it is, + print a backtrace and continue, on a number of methods. + One convenient way to do that would be to make all + the breakpoints, then configure the options with: + + +(lldb) breakpoint modify -c "self == nil" -C bt --auto-continue 1 2 3 + + +That's not too bad, but you have to repeat this for every new breakpoint you + make, and if you wanted to change the options, you have to remember all the ones you + are using this way. + + Breakpoint names provide a convenient solution to this problem. The simple solution would + be to use the name to gather the breakpoints you want to affect this way into a group. So + when you make the breakpoint you would do: + + +(lldb) breakpoint set -N SelfNil + + +Then when you've made all your breakpoints, you can set up or modify the options using + the name to collect all the relevant breakpoints. + + +(lldb) breakpoint modify -c "self == nil" -C bt --auto-continue SelfNil + + + That is better, but suffers from the problem that when new breakpoints get added, they + don't pick up these modifications, and the options only exist in the context of actual + breakpoints, so they are hard to store & reuse. + A even better solution is to make a + fully configured breakpoint name: + +(lldb) breakpoint name configure -c "self == nil" -C bt --auto-continue SelfNil + +Then you can apply the name to your breakpoints, and they will all pick up these +options. The connection from name to breakpoints remains live, so when you change the +options configured on the name, all the breakpoints pick up those changes. This makes +it easy to use configured names to experiment with your options. +You can make breakpoint names in your .lldbinit file, so you can use them to +can behaviors that you have found useful and reapply them in future sessions. + +You can also make a breakpoint name from the options set on a breakpoint: + +(lldb) breakpoint name configure -B 1 SelfNil + +which makes it easy to copy behavior from one breakpoint to a set of others. + + + Setting watchpoints ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinf
[Lldb-commits] [lldb] r313327 - Wire up the breakpoint name help string.
Author: jingham Date: Thu Sep 14 17:52:35 2017 New Revision: 313327 URL: http://llvm.org/viewvc/llvm-project?rev=313327&view=rev Log: Wire up the breakpoint name help string. Modified: lldb/trunk/include/lldb/API/SBBreakpointName.h lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py lldb/trunk/scripts/interface/SBBreakpointName.i lldb/trunk/source/API/SBBreakpointName.cpp lldb/trunk/source/API/SBTarget.cpp lldb/trunk/source/Breakpoint/BreakpointName.cpp lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp Modified: lldb/trunk/include/lldb/API/SBBreakpointName.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBBreakpointName.h?rev=313327&r1=313326&r2=313327&view=diff == --- lldb/trunk/include/lldb/API/SBBreakpointName.h (original) +++ lldb/trunk/include/lldb/API/SBBreakpointName.h Thu Sep 14 17:52:35 2017 @@ -90,6 +90,9 @@ public: SBError SetScriptCallbackBody(const char *script_body_text); + const char *GetHelpString() const; + void SetHelpString(const char *help_string); + bool GetAllowList() const; void SetAllowList(bool value); Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py?rev=313327&r1=313326&r2=313327&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py Thu Sep 14 17:52:35 2017 @@ -92,6 +92,7 @@ class BreakpointNames(TestBase): self.cmd_list = lldb.SBStringList() self.cmd_list.AppendString("frame var") self.cmd_list.AppendString("bt") +self.help_string = "I do something interesting" def do_check_names(self): @@ -256,7 +257,7 @@ class BreakpointNames(TestBase): self.assertEqual(bkpt.GetAutoContinue(), new_auto_continue, "Option didn't propagate to the breakpoint.") # Now make this same breakpoint name - but from the command line -cmd_str = "breakpoint name configure %s -o %d -i %d -c '%s' -G %d -t %d -x %d -T '%s' -q '%s'"%(cl_bp_name_string, +cmd_str = "breakpoint name configure %s -o %d -i %d -c '%s' -G %d -t %d -x %d -T '%s' -q '%s' -H '%s'"%(cl_bp_name_string, self.is_one_shot, self.ignore_count, self.condition, @@ -264,16 +265,21 @@ class BreakpointNames(TestBase): self.tid, self.tidx, self.thread_name, - self.queue_name) + self.queue_name, + self.help_string) for cmd in self.cmd_list: cmd_str += " -C '%s'"%(cmd) -result = lldb.SBCommandReturnObject() -self.dbg.GetCommandInterpreter().HandleCommand(cmd_str, result) -self.assertTrue(result.Succeeded()) +self.runCmd(cmd_str, check=True) # Now look up this name again and check its options: cl_name = lldb.SBBreakpointName(self.target, cl_bp_name_string) self.check_option_values(cl_name) +# Also check the help string: +self.assertEqual(self.help_string, cl_name.GetHelpString(), "Help string didn't match") +# Change the name and make sure that works: +new_help = "I do something even more interesting" +cl_name.SetHelpString(new_help) +self.assertEqual(new_help, cl_name.GetHelpString(), "SetHelpString didn't") # We should have three names now, make sure the target can list them: name_list = lldb.SBStringList() @@ -281,6 +287,15 @@ class BreakpointNames(TestBase): for name_string in [self.bp_name_string, other_bp_name_string, cl_bp_name_string]: self.assertTrue(name_string in name_list, "Didn't find %s in names"%(name_string)) +# Delete the name from the current target. Make sure that works and deletes the +# name from the breakpoint as well: +self.
[Lldb-commits] [lldb] r313332 - Fix syntax in lldb lit.cfg
Author: rnk Date: Thu Sep 14 18:30:52 2017 New Revision: 313332 URL: http://llvm.org/viewvc/llvm-project?rev=313332&view=rev Log: Fix syntax in lldb lit.cfg Modified: lldb/trunk/lit/lit.cfg Modified: lldb/trunk/lit/lit.cfg URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/lit.cfg?rev=313332&r1=313331&r2=313332&view=diff == --- lldb/trunk/lit/lit.cfg (original) +++ lldb/trunk/lit/lit.cfg Thu Sep 14 18:30:52 2017 @@ -46,7 +46,7 @@ config.environment['LD_LIBRARY_PATH'] = config.environment['LLVM_SRC_ROOT'] = getattr(config, 'llvm_src_root', '') # Propagate PYTHON_EXECUTABLE into the environment -config.environment['PYTHON_EXECUTABLE'] = getattr(config, 'python_executable', +config.environment['PYTHON_EXECUTABLE'] = getattr(config, 'python_executable', '') # Register substitutions config.substitutions.append(('%python', config.python_executable)) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r313335 - Revert "[lit] Force site configs to run before source-tree configs"
Author: zturner Date: Thu Sep 14 19:56:40 2017 New Revision: 313335 URL: http://llvm.org/viewvc/llvm-project?rev=313335&view=rev Log: Revert "[lit] Force site configs to run before source-tree configs" This patch is still breaking several multi-stage compiler-rt bots. I already know what the fix is, but I want to get the bots green for now and then try re-applying in the morning. Modified: lldb/trunk/lit/Unit/lit.cfg lldb/trunk/lit/lit.cfg Modified: lldb/trunk/lit/Unit/lit.cfg URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Unit/lit.cfg?rev=313335&r1=313334&r2=313335&view=diff == --- lldb/trunk/lit/Unit/lit.cfg (original) +++ lldb/trunk/lit/Unit/lit.cfg Thu Sep 14 19:56:40 2017 @@ -6,6 +6,19 @@ import os import lit.formats +# Check that the object root is known. +if config.test_exec_root is None: +# Otherwise, we haven't loaded the site specific configuration (the user is +# probably trying to run on a test file directly, and either the site +# configuration hasn't been created by the build system, or we are in an +# out-of-tree build situation). + +# Check for 'llvm_unit_site_config' user parameter, and use that if available. +site_cfg = lit_config.params.get('lldb_unit_site_config', None) +if site_cfg and os.path.exists(site_cfg): +lit_config.load_config(config, site_cfg) +raise SystemExit + # name: The name of this test suite. config.name = 'lldb-Unit' @@ -18,4 +31,6 @@ config.test_source_root = os.path.join(c config.test_exec_root = config.test_source_root # testFormat: The test format to use to interpret tests. +if not hasattr(config, 'llvm_build_mode'): +lit_config.fatal("unable to find llvm_build_mode value on config") config.test_format = lit.formats.GoogleTest(config.llvm_build_mode, 'Tests') Modified: lldb/trunk/lit/lit.cfg URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/lit.cfg?rev=313335&r1=313334&r2=313335&view=diff == --- lldb/trunk/lit/lit.cfg (original) +++ lldb/trunk/lit/lit.cfg Thu Sep 14 19:56:40 2017 @@ -29,24 +29,94 @@ config.suffixes = [] config.test_source_root = os.path.dirname(__file__) # test_exec_root: The root path where tests should be run. -config.test_exec_root = os.path.join(config.lldb_obj_root, 'lit') +lldb_obj_root = getattr(config, 'lldb_obj_root', None) +if lldb_obj_root is not None: +config.test_exec_root = os.path.join(lldb_obj_root, 'lit') + +# Set llvm_{src,obj}_root for use by others. +config.llvm_src_root = getattr(config, 'llvm_src_root', None) +config.llvm_obj_root = getattr(config, 'llvm_obj_root', None) # Tweak the PATH to include the tools dir and the scripts dir. -lldb_tools_dir = config.lldb_tools_dir -llvm_tools_dir = config.llvm_tools_dir -path = os.path.pathsep.join((config.lldb_tools_dir, config.llvm_tools_dir, config.environment['PATH'])) - -config.environment['PATH'] = path - -path = os.path.pathsep.join((config.lldb_libs_dir, config.llvm_libs_dir, - config.environment.get('LD_LIBRARY_PATH',''))) -config.environment['LD_LIBRARY_PATH'] = path - -# Propagate LLVM_SRC_ROOT into the environment. -config.environment['LLVM_SRC_ROOT'] = getattr(config, 'llvm_src_root', '') - -# Propagate PYTHON_EXECUTABLE into the environment -config.environment['PYTHON_EXECUTABLE'] = getattr(config, 'python_executable', '') +if lldb_obj_root is not None: +lldb_tools_dir = getattr(config, 'lldb_tools_dir', None) +if not lldb_tools_dir: +lit_config.fatal('No LLDB tools dir set!') +llvm_tools_dir = getattr(config, 'llvm_tools_dir', None) +if not llvm_tools_dir: +lit_config.fatal('No LLVM tools dir set!') +path = os.path.pathsep.join((lldb_tools_dir, llvm_tools_dir, config.environment['PATH'])) +path = os.path.pathsep.join((os.path.join(getattr(config, 'llvm_src_root', None),'test','Scripts'),path)) + +config.environment['PATH'] = path + +lldb_libs_dir = getattr(config, 'lldb_libs_dir', None) +if not lldb_libs_dir: +lit_config.fatal('No LLDB libs dir set!') +llvm_libs_dir = getattr(config, 'llvm_libs_dir', None) +if not llvm_libs_dir: +lit_config.fatal('No LLVM libs dir set!') +path = os.path.pathsep.join((lldb_libs_dir, llvm_libs_dir, + config.environment.get('LD_LIBRARY_PATH',''))) +config.environment['LD_LIBRARY_PATH'] = path + +# Propagate LLVM_SRC_ROOT into the environment. +config.environment['LLVM_SRC_ROOT'] = getattr(config, 'llvm_src_root', '') + +# Propagate PYTHON_EXECUTABLE into the environment +config.environment['PYTHON_EXECUTABLE'] = getattr(config, 'python_executable', + '') +### + +# Check that the object root is known. +if config.test_exec_root is None: +# Otherwise, we haven't loaded the