[Lldb-commits] [lldb] r343087 - [unittest] Fix NativeProcessProtocolTest.cpp (NFC)
Author: jdevlieghere Date: Wed Sep 26 03:09:44 2018 New Revision: 343087 URL: http://llvm.org/viewvc/llvm-project?rev=343087&view=rev Log: [unittest] Fix NativeProcessProtocolTest.cpp (NFC) Cast std::min's second argument to size_t to prevent conflicting types for parameter deduction. Modified: lldb/trunk/unittests/Host/NativeProcessProtocolTest.cpp Modified: lldb/trunk/unittests/Host/NativeProcessProtocolTest.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/NativeProcessProtocolTest.cpp?rev=343087&r1=343086&r2=343087&view=diff == --- lldb/trunk/unittests/Host/NativeProcessProtocolTest.cpp (original) +++ lldb/trunk/unittests/Host/NativeProcessProtocolTest.cpp Wed Sep 26 03:09:44 2018 @@ -130,7 +130,7 @@ llvm::Expected> Fak if (Addr >= Data.size()) return llvm::createStringError(llvm::inconvertibleErrorCode(), "Address out of range."); - Size = std::min(Size, Data.size() - Addr); + Size = std::min(Size, Data.size() - (size_t)Addr); return std::vector(&Data[Addr], &Data[Addr + Size]); } @@ -139,7 +139,7 @@ llvm::Expected FakeMemory::Write if (Addr >= Data.size()) return llvm::createStringError(llvm::inconvertibleErrorCode(), "Address out of range."); - size_t Size = std::min(Chunk.size(), Data.size() - Addr); + size_t Size = std::min(Chunk.size(), Data.size() - (size_t)Addr); std::copy_n(Chunk.begin(), Size, &Data[Addr]); return Size; } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r343180 - [target] Fix typo and give bool a default value
Author: jdevlieghere Date: Wed Sep 26 23:59:15 2018 New Revision: 343180 URL: http://llvm.org/viewvc/llvm-project?rev=343180&view=rev Log: [target] Fix typo and give bool a default value This addresses Stella's review feedback in D51859. Modified: lldb/trunk/source/Target/Target.cpp Modified: lldb/trunk/source/Target/Target.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=343180&r1=343179&r2=343180&view=diff == --- lldb/trunk/source/Target/Target.cpp (original) +++ lldb/trunk/source/Target/Target.cpp Wed Sep 26 23:59:15 2018 @@ -1446,20 +1446,20 @@ void Target::SetExecutableModule(ModuleS FileSpecList dependent_files; ObjectFile *executable_objfile = executable_sp->GetObjectFile(); -bool load_dependens; +bool load_dependents = true; switch (load_dependent_files) { case eLoadDependentsDefault: - load_dependens = executable_sp->IsExecutable(); + load_dependents = executable_sp->IsExecutable(); break; case eLoadDependentsYes: - load_dependens = true; + load_dependents = true; break; case eLoadDependentsNo: - load_dependens = false; + load_dependents = false; break; } -if (executable_objfile && load_dependens) { +if (executable_objfile && load_dependents) { executable_objfile->GetDependentModules(dependent_files); for (uint32_t i = 0; i < dependent_files.GetSize(); i++) { FileSpec dependent_file_spec( ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r343470 - Escape newlines in default disassembly format.
Author: jdevlieghere Date: Mon Oct 1 06:20:15 2018 New Revision: 343470 URL: http://llvm.org/viewvc/llvm-project?rev=343470&view=rev Log: Escape newlines in default disassembly format. We can safely escape newlines in format strings because they will be ignored by the format entity parser. Modified: lldb/trunk/source/Core/Debugger.cpp Modified: lldb/trunk/source/Core/Debugger.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=343470&r1=343469&r2=343470&view=diff == --- lldb/trunk/source/Core/Debugger.cpp (original) +++ lldb/trunk/source/Core/Debugger.cpp Mon Oct 1 06:20:15 2018 @@ -163,8 +163,8 @@ static constexpr OptionEnumValueElement // address <+offset>: #define DEFAULT_DISASSEMBLY_FORMAT \ "{${function.initial-function}{${module.file.basename}`}{${function.name-" \ - "without-args}}:\n}{${function.changed}\n{${module.file.basename}`}{${" \ - "function.name-without-args}}:\n}{${current-pc-arrow} " \ + "without-args}}:\\n}{${function.changed}\\n{${module.file.basename}`}{${" \ + "function.name-without-args}}:\\n}{${current-pc-arrow} " \ "}${addr-file-or-load}{ " \ "<${function.concrete-only-addr-offset-no-padding}>}: " ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r343471 - [Interpreter] Escape backticks when dumping format entities.
Author: jdevlieghere Date: Mon Oct 1 06:22:24 2018 New Revision: 343471 URL: http://llvm.org/viewvc/llvm-project?rev=343471&view=rev Log: [Interpreter] Escape backticks when dumping format entities. Currently we reject our own default disassembly-format string because it contains two backticks which causes everything in between to be interpreter as an expression by the command interpreter. This patch fixes that by escaping backticks when dumping format strings. Added: lldb/trunk/lit/Settings/TestDisassemblyFormat.test Modified: lldb/trunk/source/Interpreter/OptionValueFormatEntity.cpp Added: lldb/trunk/lit/Settings/TestDisassemblyFormat.test URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Settings/TestDisassemblyFormat.test?rev=343471&view=auto == --- lldb/trunk/lit/Settings/TestDisassemblyFormat.test (added) +++ lldb/trunk/lit/Settings/TestDisassemblyFormat.test Mon Oct 1 06:22:24 2018 @@ -0,0 +1,2 @@ +# RUN: %lldb -x -b -o "settings show disassembly-format" | FileCheck %s +# CHECK: disassembly-format (format-string) = "{${function.initial-function}{${module.file.basename}\`}{${function.name-without-args}}:\n}{${function.changed}\n{${module.file.basename}\`}{${function.name-without-args}}:\n}{${current-pc-arrow} }${addr-file-or-load}{ <${function.concrete-only-addr-offset-no-padding}>}: " Modified: lldb/trunk/source/Interpreter/OptionValueFormatEntity.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueFormatEntity.cpp?rev=343471&r1=343470&r2=343471&view=diff == --- lldb/trunk/source/Interpreter/OptionValueFormatEntity.cpp (original) +++ lldb/trunk/source/Interpreter/OptionValueFormatEntity.cpp Mon Oct 1 06:22:24 2018 @@ -41,6 +41,20 @@ bool OptionValueFormatEntity::Clear() { return true; } +static void EscapeBackticks(llvm::StringRef str, std::string &dst) { + dst.clear(); + dst.reserve(str.size()); + + for (size_t i = 0, e = str.size(); i != e; ++i) { +char c = str[i]; +if (c == '`') { + if (i == 0 || str[i - 1] != '\\') +dst += '\\'; +} +dst += c; + } +} + void OptionValueFormatEntity::DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) { if (dump_mask & eDumpOptionType) @@ -48,7 +62,9 @@ void OptionValueFormatEntity::DumpValue( if (dump_mask & eDumpOptionValue) { if (dump_mask & eDumpOptionType) strm.PutCString(" = \""); -strm << m_current_format.c_str() << '"'; +std::string escaped; +EscapeBackticks(m_current_format, escaped); +strm << escaped << '"'; } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r343502 - Fix tests affected by printing change.
Author: jdevlieghere Date: Mon Oct 1 10:20:57 2018 New Revision: 343502 URL: http://llvm.org/viewvc/llvm-project?rev=343502&view=rev Log: Fix tests affected by printing change. I forgot to update some tests that were affected by the escaping of backticks in the format string, landed in r343471. Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/mixed/TestMixedLanguages.py lldb/trunk/packages/Python/lldbsuite/test/settings/TestSettings.py Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/mixed/TestMixedLanguages.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/mixed/TestMixedLanguages.py?rev=343502&r1=343501&r2=343502&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/lang/mixed/TestMixedLanguages.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/lang/mixed/TestMixedLanguages.py Mon Oct 1 10:20:57 2018 @@ -35,7 +35,7 @@ class MixedLanguagesTestCase(TestBase): self.format_string = m.group(1) # Change the default format to print the language. -format_string = "frame #${frame.index}: ${frame.pc}{ ${module.file.basename}`${function.name}{${function.pc-offset}}}{, lang=${language}}\n" +format_string = "frame #${frame.index}: ${frame.pc}{ ${module.file.basename}\`${function.name}{${function.pc-offset}}}{, lang=${language}}\n" self.runCmd("settings set frame-format %s" % format_string) self.expect("settings show frame-format", SETTING_MSG("frame-format"), substrs=[format_string]) Modified: lldb/trunk/packages/Python/lldbsuite/test/settings/TestSettings.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/settings/TestSettings.py?rev=343502&r1=343501&r2=343502&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/settings/TestSettings.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/settings/TestSettings.py Mon Oct 1 10:20:57 2018 @@ -132,7 +132,7 @@ class SettingsCommandTestCase(TestBase): # Change the default format to print function.name rather than # function.name-with-args -format_string = "frame #${frame.index}: ${frame.pc}{ ${module.file.basename}`${function.name}{${function.pc-offset}}}{ at ${line.file.fullpath}:${line.number}}{, lang=${language}}\n" +format_string = "frame #${frame.index}: ${frame.pc}{ ${module.file.basename}\`${function.name}{${function.pc-offset}}}{ at ${line.file.fullpath}:${line.number}}{, lang=${language}}\n" self.runCmd("settings set frame-format %s" % format_string) # Immediately test the setting. ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r344945 - [SymbolFile] Add the module lock where necessary and assert that we own it.
Author: jdevlieghere Date: Mon Oct 22 13:14:36 2018 New Revision: 344945 URL: http://llvm.org/viewvc/llvm-project?rev=344945&view=rev Log: [SymbolFile] Add the module lock where necessary and assert that we own it. As discussed with Greg at the dev meeting, we need to ensure we have the module lock in the SymbolFile. Usually the symbol file is accessed through the symbol vendor which ensures that the necessary locks are taken. However, there are a few methods that are accessed by the expression parser and were lacking the lock. This patch adds the locking where necessary and everywhere else asserts that we actually already own the lock. Differential revision: https://reviews.llvm.org/D52543 Modified: lldb/trunk/include/lldb/Symbol/SymbolFile.h lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h lldb/trunk/source/Symbol/SymbolFile.cpp Modified: lldb/trunk/include/lldb/Symbol/SymbolFile.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolFile.h?rev=344945&r1=344944&r2=344945&view=diff == --- lldb/trunk/include/lldb/Symbol/SymbolFile.h (original) +++ lldb/trunk/include/lldb/Symbol/SymbolFile.h Mon Oct 22 13:14:36 2018 @@ -20,6 +20,14 @@ #include "llvm/ADT/DenseSet.h" +#include + +#if defined(LLDB_CONFIGURATION_DEBUG) +#define ASSERT_MODULE_LOCK(expr) (expr->AssertModuleLock();) +#else +#define ASSERT_MODULE_LOCK(expr) ((void)0) +#endif + namespace lldb_private { class SymbolFile : public PluginInterface { @@ -94,6 +102,12 @@ public: virtual uint32_t CalculateAbilities() = 0; //-- + /// Symbols file subclasses should override this to return the Module that + /// owns the TypeSystem that this symbol file modifies type information in. + //-- + virtual std::recursive_mutex &GetModuleMutex() const; + + //-- /// Initialize the SymbolFile object. /// /// The SymbolFile object with the best set of abilities (detected @@ -208,6 +222,8 @@ public: virtual void Dump(Stream &s) {} protected: + void AssertModuleLock(); + ObjectFile *m_obj_file; // The object file that symbols can be extracted from. uint32_t m_abilities; bool m_calculated_abilities; Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=344945&r1=344944&r2=344945&view=diff == --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Mon Oct 22 13:14:36 2018 @@ -260,6 +260,9 @@ SymbolFile *SymbolFileDWARF::CreateInsta } TypeList *SymbolFileDWARF::GetTypeList() { + // This method can be called without going through the symbol vendor so we + // need to lock the module. + std::lock_guard guard(GetModuleMutex()); SymbolFileDWARFDebugMap *debug_map_symfile = GetDebugMapSymfile(); if (debug_map_symfile) return debug_map_symfile->GetTypeList(); @@ -341,6 +344,7 @@ size_t SymbolFileDWARF::GetTypes(SymbolC uint32_t type_mask, TypeList &type_list) { + ASSERT_MODULE_LOCK(this); TypeSet type_set; CompileUnit *comp_unit = NULL; @@ -860,6 +864,7 @@ uint32_t SymbolFileDWARF::GetNumCompileU } CompUnitSP SymbolFileDWARF::ParseCompileUnitAtIndex(uint32_t cu_idx) { + ASSERT_MODULE_LOCK(this); CompUnitSP cu_sp; DWARFDebugInfo *info = DebugInfo(); if (info) { @@ -872,6 +877,7 @@ CompUnitSP SymbolFileDWARF::ParseCompile Function *SymbolFileDWARF::ParseCompileUnitFunction(const SymbolContext &sc, const DWARFDIE &die) { + ASSERT_MODULE_LOCK(this); if (die.IsValid()) { TypeSystem *type_system = GetTypeSystemForLanguage(die.GetCU()->GetLanguageType()); @@ -895,6 +901,7 @@ bool SymbolFileDWARF::FixupAddress(Addre } lldb::LanguageType SymbolFileDWARF::ParseCompileUnitLanguage(const SymbolContext &sc) { + ASSERT_MODULE_LOCK(this); assert(sc.comp_unit); DWARFUnit *dwarf_cu = GetDWARFCompileUnit(sc.comp_unit); if (dwarf_cu) @@ -904,6 +911,7 @@ SymbolFileDWARF::ParseCompileUnitLanguag } size_t SymbolFileDWARF::ParseCompileUnitFunctions(const SymbolContext &sc) { + ASSERT_MODULE_LOCK(this); assert(sc.comp_unit); size_t functions_added = 0; DWARFUnit *dwarf_cu = GetDWARFCompileUnit(sc.comp_unit); @@ -926,6 +934,7 @@ size_t SymbolFileDWARF::ParseCompileUnit bool SymbolFileDWARF::ParseCompileUnitSupportFiles( const SymbolContext &sc, FileSpecList &support_files) { + ASSERT_MODULE_LOCK(this);
[Lldb-commits] [lldb] r344979 - Fix typo in ASSERT_MODULE_LOCK macro definition
Author: jdevlieghere Date: Mon Oct 22 17:18:27 2018 New Revision: 344979 URL: http://llvm.org/viewvc/llvm-project?rev=344979&view=rev Log: Fix typo in ASSERT_MODULE_LOCK macro definition Modified: lldb/trunk/include/lldb/Symbol/SymbolFile.h Modified: lldb/trunk/include/lldb/Symbol/SymbolFile.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolFile.h?rev=344979&r1=344978&r2=344979&view=diff == --- lldb/trunk/include/lldb/Symbol/SymbolFile.h (original) +++ lldb/trunk/include/lldb/Symbol/SymbolFile.h Mon Oct 22 17:18:27 2018 @@ -23,7 +23,7 @@ #include #if defined(LLDB_CONFIGURATION_DEBUG) -#define ASSERT_MODULE_LOCK(expr) (expr->AssertModuleLock();) +#define ASSERT_MODULE_LOCK(expr) (expr->AssertModuleLock()) #else #define ASSERT_MODULE_LOCK(expr) ((void)0) #endif ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r345061 - Skip test with older versions of clang
Author: jdevlieghere Date: Tue Oct 23 10:49:51 2018 New Revision: 345061 URL: http://llvm.org/viewvc/llvm-project?rev=345061&view=rev Log: Skip test with older versions of clang This was failing for the bots that build with older clangs: http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake-clang-5.0.2/ http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake-clang-6.0.1/ Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/tail_call_frames/sbapi_support/TestTailCallFrameSBAPI.py Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/tail_call_frames/sbapi_support/TestTailCallFrameSBAPI.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/tail_call_frames/sbapi_support/TestTailCallFrameSBAPI.py?rev=345061&r1=345060&r2=345061&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/tail_call_frames/sbapi_support/TestTailCallFrameSBAPI.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/tail_call_frames/sbapi_support/TestTailCallFrameSBAPI.py Tue Oct 23 10:49:51 2018 @@ -15,6 +15,7 @@ class TestTailCallFrameSBAPI(TestBase): # each debug info format. NO_DEBUG_INFO_TESTCASE = True +@skipIf(compiler="clang", compiler_version=['<', '7.0']) @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr26265") def test_tail_call_frame_sbapi(self): self.build() ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r345207 - [Settings] Add -force flag to "settings set"
Author: jdevlieghere Date: Wed Oct 24 15:04:20 2018 New Revision: 345207 URL: http://llvm.org/viewvc/llvm-project?rev=345207&view=rev Log: [Settings] Add -force flag to "settings set" The -force option allows you to pass an empty value to settings set to reset the value to its default. This means that the following operations are equivalent: settings set -f settings clear The motivation for this change is the ability to export and import settings from LLDB. Because of the way the dumpers work, we don't know whether a value is going to be the default or not. Hence we cannot use settings clear and use settings set -f, potentially providing an empty value. Differential revision: https://reviews.llvm.org/D52772 Added: lldb/trunk/lit/Settings/TestSettingsSet.test Modified: lldb/trunk/source/Commands/CommandObjectSettings.cpp Added: lldb/trunk/lit/Settings/TestSettingsSet.test URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Settings/TestSettingsSet.test?rev=345207&view=auto == --- lldb/trunk/lit/Settings/TestSettingsSet.test (added) +++ lldb/trunk/lit/Settings/TestSettingsSet.test Wed Oct 24 15:04:20 2018 @@ -0,0 +1,15 @@ +# This tests setting setting values. + +# Check that setting an empty value with -f(orce) clears the value. +# RUN: %lldb -b -s %s 2>&1 | FileCheck %s + +settings set tab-size 16 +settings show tab-size +# CHECK: tab-size (unsigned) = 16 + +settings set -f tab-size +settings show tab-size +# CHECK: tab-size (unsigned) = 4 + +settings set tab-size +# CHECK: error: 'settings set' takes more arguments Modified: lldb/trunk/source/Commands/CommandObjectSettings.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSettings.cpp?rev=345207&r1=345206&r2=345207&view=diff == --- lldb/trunk/source/Commands/CommandObjectSettings.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectSettings.cpp Wed Oct 24 15:04:20 2018 @@ -30,7 +30,8 @@ using namespace lldb_private; static constexpr OptionDefinition g_settings_set_options[] = { // clang-format off - { LLDB_OPT_SET_2, false, "global", 'g', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Apply the new value to the global default value." } + { LLDB_OPT_SET_2, false, "global", 'g', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Apply the new value to the global default value." }, + { LLDB_OPT_SET_2, false, "force", 'f', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Force an empty value to be accepted as the default." } // clang-format on }; @@ -108,6 +109,9 @@ insert-before or insert-after."); const int short_option = m_getopt_table[option_idx].val; switch (short_option) { + case 'f': +m_force = true; +break; case 'g': m_global = true; break; @@ -122,6 +126,7 @@ insert-before or insert-after."); void OptionParsingStarting(ExecutionContext *execution_context) override { m_global = false; + m_force = false; } llvm::ArrayRef GetDefinitions() override { @@ -129,8 +134,8 @@ insert-before or insert-after."); } // Instance variables to hold the values for command options. - bool m_global; +bool m_force; }; int HandleArgumentCompletion( @@ -184,8 +189,10 @@ protected: if (!ParseOptions(cmd_args, result)) return false; +const size_t min_argc = m_options.m_force ? 1 : 2; const size_t argc = cmd_args.GetArgumentCount(); -if ((argc < 2) && (!m_options.m_global)) { + +if ((argc < min_argc) && (!m_options.m_global)) { result.AppendError("'settings set' takes more arguments"); result.SetStatus(eReturnStatusFailed); return false; @@ -199,6 +206,19 @@ protected: return false; } +// A missing value corresponds to clearing the setting when "force" is +// specified. +if (argc == 1 && m_options.m_force) { + Status error(m_interpreter.GetDebugger().SetPropertyValue( + &m_exe_ctx, eVarSetOperationClear, var_name, llvm::StringRef())); + if (error.Fail()) { +result.AppendError(error.AsCString()); +result.SetStatus(eReturnStatusFailed); +return false; + } + return result.Succeeded(); +} + // Split the raw command into var_name and value pair. llvm::StringRef raw_str(command); std::string var_value_string = raw_str.split(var_name).second.str(); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D53532: [FileSpec] Add VFS support to FileSpec convenience methods.
Sent from my iPhone > On Oct 24, 2018, at 7:05 PM, Zachary Turner wrote: > > It seems like FileSpec was moved out of Utility and into Host. I’m not a fan > of this change, because it took a lot of effort to get it into Utility, which > helped break a lot of bad dependencies. Can we invert this dependency and > move FileSpec back into Utility? >> On Wed, Oct 24, 2018 at 5:53 PM Jonas Devlieghere via Phabricator >> wrote: >> JDevlieghere added a comment. >> >> Note that there's also a File class which we'll need to patch up separately >> together with all other uses that actually open or read a file. For this >> class we can do the same as we did for FileSpec: deferring relevant >> operations to the FileSystem class. >> >> >> https://reviews.llvm.org/D53532 >> >> >> ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r345346 - Add functionality to export settings
Author: jdevlieghere Date: Thu Oct 25 17:00:17 2018 New Revision: 345346 URL: http://llvm.org/viewvc/llvm-project?rev=345346&view=rev Log: Add functionality to export settings For the reproducer feature I need to be able to export and import the current LLDB configuration. To realize this I've extended the existing functionality to print settings. With the help of a new formatting option, we can now write the settings and their values to a file structured as regular commands. Concretely the functionality works as follows: (lldb) settings export -f /path/to/file This file contains a bunch of settings set commands, followed by the setting's name and value. ... settings set use-external-editor false settings set use-color true settings set auto-one-line-summaries true settings set auto-indent true ... You can import the settings again by either sourcing the file or using the settings read command. (lldb) settings read -f /path/to/file Differential revision: https://reviews.llvm.org/D52651 Added: lldb/trunk/lit/Settings/TestExport.test Modified: lldb/trunk/include/lldb/Interpreter/OptionValue.h lldb/trunk/source/Commands/CommandObjectSettings.cpp lldb/trunk/source/Interpreter/OptionValueArray.cpp lldb/trunk/source/Interpreter/OptionValueDictionary.cpp lldb/trunk/source/Interpreter/OptionValueFileSpecLIst.cpp lldb/trunk/source/Interpreter/OptionValueFormatEntity.cpp lldb/trunk/source/Interpreter/OptionValueLanguage.cpp lldb/trunk/source/Interpreter/Property.cpp Modified: lldb/trunk/include/lldb/Interpreter/OptionValue.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValue.h?rev=345346&r1=345345&r2=345346&view=diff == --- lldb/trunk/include/lldb/Interpreter/OptionValue.h (original) +++ lldb/trunk/include/lldb/Interpreter/OptionValue.h Thu Oct 25 17:00:17 2018 @@ -58,9 +58,11 @@ public: eDumpOptionValue = (1u << 2), eDumpOptionDescription = (1u << 3), eDumpOptionRaw = (1u << 4), +eDumpOptionCommand = (1u << 5), eDumpGroupValue = (eDumpOptionName | eDumpOptionType | eDumpOptionValue), eDumpGroupHelp = -(eDumpOptionName | eDumpOptionType | eDumpOptionDescription) +(eDumpOptionName | eDumpOptionType | eDumpOptionDescription), +eDumpGroupExport = (eDumpOptionCommand | eDumpOptionName | eDumpOptionValue) }; OptionValue() Added: lldb/trunk/lit/Settings/TestExport.test URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Settings/TestExport.test?rev=345346&view=auto == --- lldb/trunk/lit/Settings/TestExport.test (added) +++ lldb/trunk/lit/Settings/TestExport.test Thu Oct 25 17:00:17 2018 @@ -0,0 +1,32 @@ +# This tests writing and reading settings from LLDB. + +# Check that the settings can be written to file and read again without +# altering the values. +# RUN: %lldb -b -o 'settings write -f %t.foo' -o 'settings read -f %t.foo' -o 'settings export %t.bar' -o 'settings read -f %t.bar' 2>&1 | FileCheck %s --check-prefix SUCCESS +# RUN: diff -w %t.foo %t.bar +# SUCCESS-NOT: error: + +# Check that exporting target settings only export target settings and nothing else. +# RUN: %lldb -b -o 'settings write -f %t.target target' 2>&1 | FileCheck %s --check-prefix SUCCESS +# RUN: cat %t.target | FileCheck %s --check-prefix TARGET +# TARGET: settings set target +# TARGET-NOT: settings set platform +# TARGET-NOT: settings set symbols +# TARGET-NOT: settings set interpreter +# TARGET-NOT: settings set plugin + +# Check that settings appear twice when appending. +# RUN: %lldb -b -o 'settings write -a -f %t.append target' -o 'settings write -a -f %t.append target' 2>&1 | FileCheck %s --check-prefix SUCCESS +# RUN: cat %t.append | FileCheck %s --check-prefix APPEND +# APPEND: settings set target.language +# APPEND: settings set target.language + +# Check that an error is printed for non-existing setting. +# RUN: echo "settings set bogus" > %t.bogus_setting +# RUN: %lldb -b -o 'settings read -f %t.bogus_setting' 2>&1 | FileCheck %s --check-prefix BOGUS-SETTING +# BOGUS-SETTING: error: invalid value path + +# Check that an error is printed for invalid value. +# RUN: echo "settings set target.language bogus" > %t.bogus_value +# RUN: %lldb -b -o 'settings read -f %t.bogus_value' 2>&1 | FileCheck %s --check-prefix BOGUS-VALUE +# BOGUS-VALUE: error: invalid language type Modified: lldb/trunk/source/Commands/CommandObjectSettings.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSettings.cpp?rev=345346&r1=345345&r2=345346&view=diff == --- lldb/trunk/source/Commands/CommandObjectSettings.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectSettings.cpp Thu Oct 25 17:00:17 2018 @@ -321,6 +321,207 @@ protected:
[Lldb-commits] [lldb] r345350 - Remove test that checks auto-completion for settings set.
Author: jdevlieghere Date: Thu Oct 25 17:39:27 2018 New Revision: 345350 URL: http://llvm.org/viewvc/llvm-project?rev=345350&view=rev Log: Remove test that checks auto-completion for settings set. With the new `-f` option for `settings set`, `-` (dash) no longer auto-complete to `-g`. Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py?rev=345350&r1=345349&r2=345350&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py Thu Oct 25 17:39:27 2018 @@ -175,11 +175,6 @@ class CommandLineCompletionTestCase(Test self.complete_from_to('settings set thread-f', 'settings set thread-format') @skipIfFreeBSD # timing out on the FreeBSD buildbot -def test_settings_s_dash(self): -"""Test that 'settings set -' completes to 'settings set -g'.""" -self.complete_from_to('settings set -', 'settings set -g') - -@skipIfFreeBSD # timing out on the FreeBSD buildbot def test_settings_clear_th(self): """Test that 'settings clear thread-f' completes to 'settings clear thread-format'.""" self.complete_from_to( ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r345351 - Update test that checks auto-completion for settings set.
Author: jdevlieghere Date: Thu Oct 25 17:50:54 2018 New Revision: 345351 URL: http://llvm.org/viewvc/llvm-project?rev=345351&view=rev Log: Update test that checks auto-completion for settings set. This reverts r345350 and updates the test rather than removing it. Now we check that `--g` auto-completes to `--global`. Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py?rev=345351&r1=345350&r2=345351&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py Thu Oct 25 17:50:54 2018 @@ -175,6 +175,11 @@ class CommandLineCompletionTestCase(Test self.complete_from_to('settings set thread-f', 'settings set thread-format') @skipIfFreeBSD # timing out on the FreeBSD buildbot +def test_settings_s_dash(self): +"""Test that 'settings set --g' completes to 'settings set --global'.""" +self.complete_from_to('settings set --g', 'settings set --global') + +@skipIfFreeBSD # timing out on the FreeBSD buildbot def test_settings_clear_th(self): """Test that 'settings clear thread-f' completes to 'settings clear thread-format'.""" self.complete_from_to( ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r345435 - Fix and rename broken test for `settings write`.
Author: jdevlieghere Date: Fri Oct 26 16:01:25 2018 New Revision: 345435 URL: http://llvm.org/viewvc/llvm-project?rev=345435&view=rev Log: Fix and rename broken test for `settings write`. I committed this test without updating the old `settings export` to settings write. Since the functionality was renamed I also renamed the test case. Added: lldb/trunk/lit/Settings/TestSettingsWrite.test - copied, changed from r345402, lldb/trunk/lit/Settings/TestExport.test Removed: lldb/trunk/lit/Settings/TestExport.test Removed: lldb/trunk/lit/Settings/TestExport.test URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Settings/TestExport.test?rev=345434&view=auto == --- lldb/trunk/lit/Settings/TestExport.test (original) +++ lldb/trunk/lit/Settings/TestExport.test (removed) @@ -1,32 +0,0 @@ -# This tests writing and reading settings from LLDB. - -# Check that the settings can be written to file and read again without -# altering the values. -# RUN: %lldb -b -o 'settings write -f %t.foo' -o 'settings read -f %t.foo' -o 'settings export %t.bar' -o 'settings read -f %t.bar' 2>&1 | FileCheck %s --check-prefix SUCCESS -# RUN: diff -w %t.foo %t.bar -# SUCCESS-NOT: error: - -# Check that exporting target settings only export target settings and nothing else. -# RUN: %lldb -b -o 'settings write -f %t.target target' 2>&1 | FileCheck %s --check-prefix SUCCESS -# RUN: cat %t.target | FileCheck %s --check-prefix TARGET -# TARGET: settings set target -# TARGET-NOT: settings set platform -# TARGET-NOT: settings set symbols -# TARGET-NOT: settings set interpreter -# TARGET-NOT: settings set plugin - -# Check that settings appear twice when appending. -# RUN: %lldb -b -o 'settings write -a -f %t.append target' -o 'settings write -a -f %t.append target' 2>&1 | FileCheck %s --check-prefix SUCCESS -# RUN: cat %t.append | FileCheck %s --check-prefix APPEND -# APPEND: settings set target.language -# APPEND: settings set target.language - -# Check that an error is printed for non-existing setting. -# RUN: echo "settings set bogus" > %t.bogus_setting -# RUN: %lldb -b -o 'settings read -f %t.bogus_setting' 2>&1 | FileCheck %s --check-prefix BOGUS-SETTING -# BOGUS-SETTING: error: invalid value path - -# Check that an error is printed for invalid value. -# RUN: echo "settings set target.language bogus" > %t.bogus_value -# RUN: %lldb -b -o 'settings read -f %t.bogus_value' 2>&1 | FileCheck %s --check-prefix BOGUS-VALUE -# BOGUS-VALUE: error: invalid language type Copied: lldb/trunk/lit/Settings/TestSettingsWrite.test (from r345402, lldb/trunk/lit/Settings/TestExport.test) URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Settings/TestSettingsWrite.test?p2=lldb/trunk/lit/Settings/TestSettingsWrite.test&p1=lldb/trunk/lit/Settings/TestExport.test&r1=345402&r2=345435&rev=345435&view=diff == --- lldb/trunk/lit/Settings/TestExport.test (original) +++ lldb/trunk/lit/Settings/TestSettingsWrite.test Fri Oct 26 16:01:25 2018 @@ -2,31 +2,31 @@ # Check that the settings can be written to file and read again without # altering the values. -# RUN: %lldb -b -o 'settings write -f %t.foo' -o 'settings read -f %t.foo' -o 'settings export %t.bar' -o 'settings read -f %t.bar' 2>&1 | FileCheck %s --check-prefix SUCCESS +# RUN: %lldb -b -o 'settings write -f %t.foo' -o 'settings read -f %t.foo' -o 'settings write -f %t.bar' -o 'settings read -f %t.bar' 2>&1 | FileCheck %s --check-prefix SUCCESS # RUN: diff -w %t.foo %t.bar # SUCCESS-NOT: error: # Check that exporting target settings only export target settings and nothing else. # RUN: %lldb -b -o 'settings write -f %t.target target' 2>&1 | FileCheck %s --check-prefix SUCCESS # RUN: cat %t.target | FileCheck %s --check-prefix TARGET -# TARGET: settings set target -# TARGET-NOT: settings set platform -# TARGET-NOT: settings set symbols -# TARGET-NOT: settings set interpreter -# TARGET-NOT: settings set plugin +# TARGET: settings set -f target +# TARGET-NOT: settings set -f platform +# TARGET-NOT: settings set -f symbols +# TARGET-NOT: settings set -f interpreter +# TARGET-NOT: settings set -f plugin # Check that settings appear twice when appending. # RUN: %lldb -b -o 'settings write -a -f %t.append target' -o 'settings write -a -f %t.append target' 2>&1 | FileCheck %s --check-prefix SUCCESS # RUN: cat %t.append | FileCheck %s --check-prefix APPEND -# APPEND: settings set target.language -# APPEND: settings set target.language +# APPEND: settings set -f target.language +# APPEND: settings set -f target.language # Check that an error is printed for non-existing setting. -# RUN: echo "settings set bogus" > %t.bogus_setting +# RUN: echo "settings set -f bogus" > %t.bogus_setting # RUN: %lldb -b -o 'settings read -f %t.bogus_setting' 2>&1 | FileCheck %s --check-prefix BOGUS-SETTING # BOGUS-SETTING: error: i
[Lldb-commits] [lldb] r345783 - [FileSystem] Extend file system and have it use the VFS.
Author: jdevlieghere Date: Wed Oct 31 14:49:27 2018 New Revision: 345783 URL: http://llvm.org/viewvc/llvm-project?rev=345783&view=rev Log: [FileSystem] Extend file system and have it use the VFS. This patch extends the FileSystem class with a bunch of functions that are currently implemented as methods of the FileSpec class. These methods will be removed in future commits and replaced by calls to the file system. The new functions are operated in terms of the virtual file system which was recently moved from clang into LLVM so it could be reused in lldb. Because the VFS is stateful, we turned the FileSystem class into a singleton. Differential revision: https://reviews.llvm.org/D53532 Modified: lldb/trunk/include/lldb/Host/FileSystem.h lldb/trunk/include/lldb/Utility/FileSpec.h lldb/trunk/source/Core/Disassembler.cpp lldb/trunk/source/Core/Module.cpp lldb/trunk/source/Core/ModuleList.cpp lldb/trunk/source/Core/SourceManager.cpp lldb/trunk/source/Host/common/FileSystem.cpp lldb/trunk/source/Host/common/HostInfoBase.cpp lldb/trunk/source/Host/common/Symbols.cpp lldb/trunk/source/Host/posix/HostProcessPosix.cpp lldb/trunk/source/Initialization/SystemInitializerCommon.cpp lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp lldb/trunk/source/Target/Platform.cpp lldb/trunk/unittests/Core/MangledTest.cpp lldb/trunk/unittests/Expression/ClangParserTest.cpp lldb/trunk/unittests/Host/FileSystemTest.cpp lldb/trunk/unittests/Host/HostInfoTest.cpp lldb/trunk/unittests/Host/SymbolsTest.cpp lldb/trunk/unittests/ObjectFile/ELF/TestObjectFileELF.cpp lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp lldb/trunk/unittests/Symbol/TestClangASTContext.cpp lldb/trunk/unittests/Symbol/TestDWARFCallFrameInfo.cpp lldb/trunk/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp lldb/trunk/unittests/Target/ModuleCacheTest.cpp Modified: lldb/trunk/include/lldb/Host/FileSystem.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=345783&r1=345782&r2=345783&view=diff == --- lldb/trunk/include/lldb/Host/FileSystem.h (original) +++ lldb/trunk/include/lldb/Host/FileSystem.h Wed Oct 31 14:49:27 2018 @@ -12,7 +12,10 @@ #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Status.h" + +#include "llvm/ADT/Optional.h" #include "llvm/Support/Chrono.h" +#include "llvm/Support/VirtualFileSystem.h" #include "lldb/lldb-types.h" @@ -26,17 +29,101 @@ public: static const char *DEV_NULL; static const char *PATH_CONVERSION_ERROR; - static Status Symlink(const FileSpec &src, const FileSpec &dst); - static Status Readlink(const FileSpec &src, FileSpec &dst); + FileSystem() : m_fs(llvm::vfs::getRealFileSystem()) {} + FileSystem(llvm::IntrusiveRefCntPtr fs) : m_fs(fs) {} + + static FileSystem &Instance(); + + static void Initialize(); + static void Initialize(llvm::IntrusiveRefCntPtr fs); + static void Terminate(); + + Status Symlink(const FileSpec &src, const FileSpec &dst); + Status Readlink(const FileSpec &src, FileSpec &dst); - static Status ResolveSymbolicLink(const FileSpec &src, FileSpec &dst); + Status ResolveSymbolicLink(const FileSpec &src, FileSpec &dst); /// Wraps ::fopen in a platform-independent way. Once opened, FILEs can be /// manipulated and closed with the normal ::fread, ::fclose, etc. functions. - static FILE *Fopen(const char *path, const char *mode); + FILE *Fopen(const char *path, const char *mode); - static llvm::sys::TimePoint<> GetModificationTime(const FileSpec &file_spec); + /// Returns the modification time of the given file. + /// @{ + llvm::sys::TimePoint<> GetModificationTime(const FileSpec &file_spec) const; + llvm::sys::TimePoint<> GetModificationTime(const llvm::Twine &path) const; + /// @} + + /// Returns the on-disk size of the given file in bytes. + /// @{ + uint64_t GetByteSize(const FileSpec &file_spec) const; + uint64_t GetByteSize(const llvm::Twine &path) const; + /// @} + + /// Return the current permissions of the given file. + /// + /// Returns a bitmask for the current permissions of the file (zero or more + /// of the permission bits defined in File::Permissions). + /// @{ + uint32_t GetPermissions(const FileSpec &file_spec) const; + uint32_t Ge
[Lldb-commits] [lldb] r345787 - [FileSystem] Remove EnumerateDirectory
Author: jdevlieghere Date: Wed Oct 31 15:09:58 2018 New Revision: 345787 URL: http://llvm.org/viewvc/llvm-project?rev=345787&view=rev Log: [FileSystem] Remove EnumerateDirectory The new implementation of EnumerateDirectory relies on `::no_push()` being implemented for the VFS recursive directory iterators. However this patch (D53465) hasn't been landed yet. Modified: lldb/trunk/include/lldb/Host/FileSystem.h lldb/trunk/source/Host/common/FileSystem.cpp lldb/trunk/unittests/Host/FileSystemTest.cpp Modified: lldb/trunk/include/lldb/Host/FileSystem.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=345787&r1=345786&r2=345787&view=diff == --- lldb/trunk/include/lldb/Host/FileSystem.h (original) +++ lldb/trunk/include/lldb/Host/FileSystem.h Wed Oct 31 15:09:58 2018 @@ -92,28 +92,6 @@ public: void Resolve(FileSpec &file_spec); /// @} - enum EnumerateDirectoryResult { -/// Enumerate next entry in the current directory. -eEnumerateDirectoryResultNext, -/// Recurse into the current entry if it is a directory or symlink, or next -/// if not. -eEnumerateDirectoryResultEnter, -/// Stop directory enumerations at any level. -eEnumerateDirectoryResultQuit - }; - - typedef EnumerateDirectoryResult (*EnumerateDirectoryCallbackType)( - void *baton, llvm::sys::fs::file_type file_type, llvm::StringRef); - - typedef std::function - DirectoryCallback; - - void EnumerateDirectory(llvm::Twine path, bool find_directories, - bool find_files, bool find_other, - EnumerateDirectoryCallbackType callback, - void *callback_baton); - std::error_code GetRealPath(const llvm::Twine &path, llvm::SmallVectorImpl &output) const; Modified: lldb/trunk/source/Host/common/FileSystem.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSystem.cpp?rev=345787&r1=345786&r2=345787&view=diff == --- lldb/trunk/source/Host/common/FileSystem.cpp (original) +++ lldb/trunk/source/Host/common/FileSystem.cpp Wed Oct 31 15:09:58 2018 @@ -96,36 +96,6 @@ bool FileSystem::Readable(const FileSpec return Readable(file_spec.GetPath()); } -void FileSystem::EnumerateDirectory(Twine path, bool find_directories, -bool find_files, bool find_other, -EnumerateDirectoryCallbackType callback, -void *callback_baton) { - std::error_code EC; - vfs::recursive_directory_iterator Iter(*m_fs, path, EC); - vfs::recursive_directory_iterator End; - for (; Iter != End && !EC; Iter.increment(EC)) { -const auto &Item = *Iter; -ErrorOr Status = m_fs->status(Item.path()); -if (!Status) - break; -if (!find_files && Status->isRegularFile()) - continue; -if (!find_directories && Status->isDirectory()) - continue; -if (!find_other && Status->isOther()) - continue; - -auto Result = callback(callback_baton, Status->getType(), Item.path()); -if (Result == eEnumerateDirectoryResultQuit) - return; -if (Result == eEnumerateDirectoryResultNext) { - // Default behavior is to recurse. Opt out if the callback doesn't want - // this behavior. - Iter.no_push(); -} - } -} - std::error_code FileSystem::MakeAbsolute(SmallVectorImpl &path) const { return m_fs->makeAbsolute(path); } Modified: lldb/trunk/unittests/Host/FileSystemTest.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/FileSystemTest.cpp?rev=345787&r1=345786&r2=345787&view=diff == --- lldb/trunk/unittests/Host/FileSystemTest.cpp (original) +++ lldb/trunk/unittests/Host/FileSystemTest.cpp Wed Oct 31 15:09:58 2018 @@ -265,27 +265,3 @@ TEST(FileSystemTest, Resolve) { EXPECT_EQ("bogus", file_spec.GetPath()); } } - -FileSystem::EnumerateDirectoryResult -VFSCallback(void *baton, llvm::sys::fs::file_type file_type, -llvm::StringRef path) { - auto visited = static_cast *>(baton); - visited->push_back(path.str()); - return FileSystem::eEnumerateDirectoryResultNext; -} - -TEST(FileSystemTest, EnumerateDirectory) { - FileSystem fs(GetSimpleDummyFS()); - - std::vector visited; - - constexpr bool find_directories = true; - constexpr bool find_files = true; - constexpr bool find_other = true; - - fs.EnumerateDirectory("/", find_directories, find_files, find_other, -VFSCallback, &visited); - - EXPECT_THAT(visited, - testing::UnorderedElementsAre("/foo", "/bar", "/baz", "/qux")); -} ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-b
[Lldb-commits] [lldb] r345799 - [FileSystem] Re-add EnumerateDirectory
Author: jdevlieghere Date: Wed Oct 31 17:26:09 2018 New Revision: 345799 URL: http://llvm.org/viewvc/llvm-project?rev=345799&view=rev Log: [FileSystem] Re-add EnumerateDirectory Re-enable EnumerateDirectory now that no_push is available in llvm (r345793). Modified: lldb/trunk/include/lldb/Host/FileSystem.h lldb/trunk/source/Host/common/FileSystem.cpp lldb/trunk/unittests/Host/FileSystemTest.cpp Modified: lldb/trunk/include/lldb/Host/FileSystem.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=345799&r1=345798&r2=345799&view=diff == --- lldb/trunk/include/lldb/Host/FileSystem.h (original) +++ lldb/trunk/include/lldb/Host/FileSystem.h Wed Oct 31 17:26:09 2018 @@ -92,6 +92,28 @@ public: void Resolve(FileSpec &file_spec); /// @} + enum EnumerateDirectoryResult { +/// Enumerate next entry in the current directory. +eEnumerateDirectoryResultNext, +/// Recurse into the current entry if it is a directory or symlink, or next +/// if not. +eEnumerateDirectoryResultEnter, +/// Stop directory enumerations at any level. +eEnumerateDirectoryResultQuit + }; + + typedef EnumerateDirectoryResult (*EnumerateDirectoryCallbackType)( + void *baton, llvm::sys::fs::file_type file_type, llvm::StringRef); + + typedef std::function + DirectoryCallback; + + void EnumerateDirectory(llvm::Twine path, bool find_directories, + bool find_files, bool find_other, + EnumerateDirectoryCallbackType callback, + void *callback_baton); + std::error_code GetRealPath(const llvm::Twine &path, llvm::SmallVectorImpl &output) const; Modified: lldb/trunk/source/Host/common/FileSystem.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSystem.cpp?rev=345799&r1=345798&r2=345799&view=diff == --- lldb/trunk/source/Host/common/FileSystem.cpp (original) +++ lldb/trunk/source/Host/common/FileSystem.cpp Wed Oct 31 17:26:09 2018 @@ -96,6 +96,36 @@ bool FileSystem::Readable(const FileSpec return Readable(file_spec.GetPath()); } +void FileSystem::EnumerateDirectory(Twine path, bool find_directories, +bool find_files, bool find_other, +EnumerateDirectoryCallbackType callback, +void *callback_baton) { + std::error_code EC; + vfs::recursive_directory_iterator Iter(*m_fs, path, EC); + vfs::recursive_directory_iterator End; + for (; Iter != End && !EC; Iter.increment(EC)) { +const auto &Item = *Iter; +ErrorOr Status = m_fs->status(Item.path()); +if (!Status) + break; +if (!find_files && Status->isRegularFile()) + continue; +if (!find_directories && Status->isDirectory()) + continue; +if (!find_other && Status->isOther()) + continue; + +auto Result = callback(callback_baton, Status->getType(), Item.path()); +if (Result == eEnumerateDirectoryResultQuit) + return; +if (Result == eEnumerateDirectoryResultNext) { + // Default behavior is to recurse. Opt out if the callback doesn't want + // this behavior. + Iter.no_push(); +} + } +} + std::error_code FileSystem::MakeAbsolute(SmallVectorImpl &path) const { return m_fs->makeAbsolute(path); } Modified: lldb/trunk/unittests/Host/FileSystemTest.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/FileSystemTest.cpp?rev=345799&r1=345798&r2=345799&view=diff == --- lldb/trunk/unittests/Host/FileSystemTest.cpp (original) +++ lldb/trunk/unittests/Host/FileSystemTest.cpp Wed Oct 31 17:26:09 2018 @@ -265,3 +265,27 @@ TEST(FileSystemTest, Resolve) { EXPECT_EQ("bogus", file_spec.GetPath()); } } + +FileSystem::EnumerateDirectoryResult +VFSCallback(void *baton, llvm::sys::fs::file_type file_type, +llvm::StringRef path) { + auto visited = static_cast *>(baton); + visited->push_back(path.str()); + return FileSystem::eEnumerateDirectoryResultNext; +} + +TEST(FileSystemTest, EnumerateDirectory) { + FileSystem fs(GetSimpleDummyFS()); + + std::vector visited; + + constexpr bool find_directories = true; + constexpr bool find_files = true; + constexpr bool find_other = true; + + fs.EnumerateDirectory("/", find_directories, find_files, find_other, +VFSCallback, &visited); + + EXPECT_THAT(visited, + testing::UnorderedElementsAre("/foo", "/bar", "/baz", "/qux")); +} ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r345800 - [FileSystem] Move EnumerateDirectory from FileSpec to FileSystem.
Author: jdevlieghere Date: Wed Oct 31 17:33:27 2018 New Revision: 345800 URL: http://llvm.org/viewvc/llvm-project?rev=345800&view=rev Log: [FileSystem] Move EnumerateDirectory from FileSpec to FileSystem. This patch moves the EnumerateDirectory functionality and related enum and typedef from FileSpec to FileSystem. This is part of a set of patches that extracts file system related convenience methods from FileSpec. The long term goal is to remove this method altogether and use the iterators directly, but for introducing the VFS into LLDB this change is sufficient. Differential revision: https://reviews.llvm.org/D53785 Modified: lldb/trunk/include/lldb/Utility/FileSpec.h lldb/trunk/source/Core/Debugger.cpp lldb/trunk/source/Core/PluginManager.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.h lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.h lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp lldb/trunk/source/Target/Platform.cpp lldb/trunk/source/Utility/FileSpec.cpp Modified: lldb/trunk/include/lldb/Utility/FileSpec.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/FileSpec.h?rev=345800&r1=345799&r2=345800&view=diff == --- lldb/trunk/include/lldb/Utility/FileSpec.h (original) +++ lldb/trunk/include/lldb/Utility/FileSpec.h Wed Oct 31 17:33:27 2018 @@ -545,27 +545,6 @@ public: ConstString GetLastPathComponent() const; - enum EnumerateDirectoryResult { -eEnumerateDirectoryResultNext, // Enumerate next entry in the current -// directory -eEnumerateDirectoryResultEnter, // Recurse into the current entry if it is a -// directory or symlink, or next if not -eEnumerateDirectoryResultQuit // Stop directory enumerations at any level - }; - - typedef EnumerateDirectoryResult (*EnumerateDirectoryCallbackType)( - void *baton, llvm::sys::fs::file_type file_type, const FileSpec &spec); - - static void EnumerateDirectory(llvm::StringRef dir_path, - bool find_directories, bool find_files, - bool find_other, - EnumerateDirectoryCallbackType callback, - void *callback_baton); - - typedef std::function - DirectoryCallback; - protected: //-- // Convenience method for setting the file without changing the style. Modified: lldb/trunk/source/Core/Debugger.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=345800&r1=345799&r2=345800&view=diff == --- lldb/trunk/source/Core/Debugger.cpp (original) +++ lldb/trunk/source/Core/Debugger.cpp Wed Oct 31 17:33:27 2018 @@ -21,6 +21,7 @@ #include "lldb/DataFormatters/DataVisualization.h" #include "lldb/Expression/REPL.h" #include "lldb/Host/File.h" // for File, File::kInv... +#include "lldb/Host/FileSystem.h" #include "lldb/Host/HostInfo.h" #include "lldb/Host/Terminal.h" #include "lldb/Host/ThreadLauncher.h" @@ -604,16 +605,16 @@ bool Debugger::LoadPlugin(const FileSpec return false; } -static FileSpec::EnumerateDirectoryResult +static FileSystem::EnumerateDirectoryResult LoadPluginCallback(void *baton, llvm::sys::fs::file_type ft, - const FileSpec &file_spec) { + llvm::StringRef path) { Status error; static ConstString g_dylibext(".dylib"); static ConstString g_solibext(".so"); if (!baton) -return FileSpec::eEnumerateDirectoryResultQuit; +return FileSystem::eEnumerateDirectoryResultQuit; Debugger *debugger = (Debugger *)baton; @@ -624,18 +625,18 @@ LoadPluginCallback(void *baton, llvm::sy // file type information. if (ft == fs::file_type::regular_file || ft == fs::file_type::symlink_file || ft == fs::file_type::type_unknown) { -FileSpec plugin_file_spec(file_spec); +FileSpec plugin_file_spec(path, false); plugin_file_spec.ResolvePath(); if (plugin_file_spec.GetFileNameExtension() != g_dylibext && plugin_file_spec.GetFileNameExtension() != g_solibext) { - return FileSpec::eEnumerateDirectoryResultNext; + return FileSystem::eEnumerateDirectoryResultNext; } Status plugin_load_error; debugger->LoadPlugin(plugin_file_spec,
[Lldb-commits] [lldb] r345812 - [FileSystem] Remove GetByteSize() from FileSpec
Author: jdevlieghere Date: Wed Oct 31 21:45:28 2018 New Revision: 345812 URL: http://llvm.org/viewvc/llvm-project?rev=345812&view=rev Log: [FileSystem] Remove GetByteSize() from FileSpec This patch removes the GetByteSize method from FileSpec and updates its uses with calls to the FileSystem. Differential revision: https://reviews.llvm.org/D53788 Modified: lldb/trunk/include/lldb/Core/ModuleSpec.h lldb/trunk/include/lldb/Utility/FileSpec.h lldb/trunk/source/Core/Module.cpp lldb/trunk/source/Host/common/Host.cpp lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp lldb/trunk/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp lldb/trunk/source/Symbol/ObjectFile.cpp lldb/trunk/source/Target/ModuleCache.cpp lldb/trunk/source/Utility/FileSpec.cpp lldb/trunk/unittests/Target/ModuleCacheTest.cpp Modified: lldb/trunk/include/lldb/Core/ModuleSpec.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ModuleSpec.h?rev=345812&r1=345811&r2=345812&view=diff == --- lldb/trunk/include/lldb/Core/ModuleSpec.h (original) +++ lldb/trunk/include/lldb/Core/ModuleSpec.h Wed Oct 31 21:45:28 2018 @@ -11,6 +11,7 @@ #define liblldb_ModuleSpec_h_ // Project includes +#include "lldb/Host/FileSystem.h" #include "lldb/Target/PathMappingList.h" #include "lldb/Utility/ArchSpec.h" #include "lldb/Utility/FileSpec.h" @@ -34,15 +35,17 @@ public: m_object_name(), m_object_offset(0), m_object_size(0), m_source_mappings() {} - ModuleSpec(const FileSpec &file_spec, const UUID& uuid = UUID()) + ModuleSpec(const FileSpec &file_spec, const UUID &uuid = UUID()) : m_file(file_spec), m_platform_file(), m_symbol_file(), m_arch(), m_uuid(uuid), m_object_name(), m_object_offset(0), -m_object_size(file_spec.GetByteSize()), m_source_mappings() {} +m_object_size(FileSystem::Instance().GetByteSize(file_spec)), +m_source_mappings() {} ModuleSpec(const FileSpec &file_spec, const ArchSpec &arch) : m_file(file_spec), m_platform_file(), m_symbol_file(), m_arch(arch), m_uuid(), m_object_name(), m_object_offset(0), -m_object_size(file_spec.GetByteSize()), m_source_mappings() {} +m_object_size(FileSystem::Instance().GetByteSize(file_spec)), +m_source_mappings() {} ModuleSpec(const ModuleSpec &rhs) : m_file(rhs.m_file), m_platform_file(rhs.m_platform_file), Modified: lldb/trunk/include/lldb/Utility/FileSpec.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/FileSpec.h?rev=345812&r1=345811&r2=345812&view=diff == --- lldb/trunk/include/lldb/Utility/FileSpec.h (original) +++ lldb/trunk/include/lldb/Utility/FileSpec.h Wed Oct 31 21:45:28 2018 @@ -311,8 +311,6 @@ public: //-- bool ResolvePath(); - uint64_t GetByteSize() const; - Style GetPathStyle() const; //-- Modified: lldb/trunk/source/Core/Module.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=345812&r1=345811&r2=345812&view=diff == --- lldb/trunk/source/Core/Module.cpp (original) +++ lldb/trunk/source/Core/Module.cpp Wed Oct 31 21:45:28 2018 @@ -1252,7 +1252,8 @@ ObjectFile *Module::GetObjectFile() { GetFileSpec().GetFilename().AsCString("")); DataBufferSP data_sp; lldb::offset_t data_offset = 0; - const lldb::offset_t file_size = m_file.GetByteSize(); + const lldb::offset_t file_size = + FileSystem::Instance().GetByteSize(m_file); if (file_size > m_object_offset) { m_did_load_objfile = true; m_objfile_sp = ObjectFile::FindPlugin( Modified: lldb/trunk/source/Host/common/Host.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=345812&r1=345811&r2=345812&view=diff == --- lldb/trunk/source/Host/common/Host.cpp (original) +++ lldb/trunk/source/Host/common/Host.cpp Wed Oct 31 21:45:28 2018 @@ -48,6 +48,7 @@ // C++ Includes #include +#include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" #include "lldb/Host/HostInfo.h" #include "lldb/Host/HostProcess.h" @@ -554,7 +555,8 @@ Status Host::RunShellCommand(const Args if (command_output_ptr) { command_output_ptr->clear(); -uint64_t file_size = output_file_spec.GetByteSize(); +uint64_t file_size = +F
[Lldb-commits] [lldb] r345843 - [FileSystem] Remove GetPermissions() and Readable() from FileSpec
Author: jdevlieghere Date: Thu Nov 1 08:47:33 2018 New Revision: 345843 URL: http://llvm.org/viewvc/llvm-project?rev=345843&view=rev Log: [FileSystem] Remove GetPermissions() and Readable() from FileSpec This patch removes the GetPermissions and GetReadable methods from FileSpec and updates its uses with calls to the FileSystem. Differential revision: https://reviews.llvm.org/D53831 Modified: lldb/trunk/include/lldb/Utility/FileSpec.h lldb/trunk/source/API/SBPlatform.cpp lldb/trunk/source/Commands/CommandObjectTarget.cpp lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp lldb/trunk/source/Target/Platform.cpp lldb/trunk/source/Utility/FileSpec.cpp Modified: lldb/trunk/include/lldb/Utility/FileSpec.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/FileSpec.h?rev=345843&r1=345842&r2=345843&view=diff == --- lldb/trunk/include/lldb/Utility/FileSpec.h (original) +++ lldb/trunk/include/lldb/Utility/FileSpec.h Thu Nov 1 08:47:33 2018 @@ -281,15 +281,6 @@ public: bool Exists() const; //-- - /// Check if a file is readable by the current user - /// - /// @return - /// \b true if the file exists on disk and is readable, \b false - /// otherwise. - //-- - bool Readable() const; - - //-- /// Expanded existence test. /// /// Call into the Host to see if it can help find the file (e.g. by @@ -451,19 +442,6 @@ public: ConstString GetFileNameStrippingExtension() const; //-- - /// Return the current permissions of the path. - /// - /// Returns a bitmask for the current permissions of the file ( zero or more - /// of the permission bits defined in File::Permissions). - /// - /// @return - /// Zero if the file doesn't exist or we are unable to get - /// information for the file, otherwise one or more permission - /// bits from the File::Permissions enumeration. - //-- - uint32_t GetPermissions() const; - - //-- /// Get the memory cost of this object. /// /// Return the size in bytes that this object takes in memory. This returns Modified: lldb/trunk/source/API/SBPlatform.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBPlatform.cpp?rev=345843&r1=345842&r2=345843&view=diff == --- lldb/trunk/source/API/SBPlatform.cpp (original) +++ lldb/trunk/source/API/SBPlatform.cpp Thu Nov 1 08:47:33 2018 @@ -364,7 +364,7 @@ SBError SBPlatform::Get(SBFileSpec &src, SBError SBPlatform::Put(SBFileSpec &src, SBFileSpec &dst) { return ExecuteConnected([&](const lldb::PlatformSP &platform_sp) { if (src.Exists()) { - uint32_t permissions = src.ref().GetPermissions(); + uint32_t permissions = FileSystem::Instance().GetPermissions(src.ref()); if (permissions == 0) { if (llvm::sys::fs::is_directory(src.ref().GetPath())) permissions = eFilePermissionsDirectoryDefault; Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=345843&r1=345842&r2=345843&view=diff == --- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Thu Nov 1 08:47:33 2018 @@ -280,7 +280,7 @@ protected: result.SetStatus(eReturnStatusFailed); return false; } - if (!core_file.Readable()) { + if (!FileSystem::Instance().Readable(core_file)) { result.AppendErrorWithFormat("core file '%s' is not readable", core_file.GetPath().c_str()); result.SetStatus(eReturnStatusFailed); @@ -292,7 +292,7 @@ protected: FileSpec symfile(m_symbol_file.GetOptionValue().GetCurrentValue()); if (symfile) { if (symfile.Exists()) { - if (!symfile.Readable()) { + if (!FileS
[Lldb-commits] [lldb] r345849 - [FileSystem] Improve assert and add Terminate in unit test.
Author: jdevlieghere Date: Thu Nov 1 09:43:34 2018 New Revision: 345849 URL: http://llvm.org/viewvc/llvm-project?rev=345849&view=rev Log: [FileSystem] Improve assert and add Terminate in unit test. Speculative fix for the Xcode bots where we were seeing the assertion being triggered because we would re-initialize the FileSystem without terminating it. Modified: lldb/trunk/source/Host/common/FileSystem.cpp lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp Modified: lldb/trunk/source/Host/common/FileSystem.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSystem.cpp?rev=345849&r1=345848&r2=345849&view=diff == --- lldb/trunk/source/Host/common/FileSystem.cpp (original) +++ lldb/trunk/source/Host/common/FileSystem.cpp Thu Nov 1 09:43:34 2018 @@ -9,6 +9,7 @@ #include "lldb/Host/FileSystem.h" +#include "lldb/Utility/LLDBAssert.h" #include "lldb/Utility/TildeExpressionResolver.h" #include "llvm/Support/FileSystem.h" @@ -25,17 +26,17 @@ using namespace llvm; FileSystem &FileSystem::Instance() { return *InstanceImpl(); } void FileSystem::Initialize() { - assert(!InstanceImpl()); + lldbassert(!InstanceImpl() && "Already initialized."); InstanceImpl().emplace(); } void FileSystem::Initialize(IntrusiveRefCntPtr fs) { - assert(!InstanceImpl()); + lldbassert(!InstanceImpl() && "Already initialized."); InstanceImpl().emplace(fs); } void FileSystem::Terminate() { - assert(InstanceImpl()); + lldbassert(InstanceImpl() && "Already terminated."); InstanceImpl().reset(); } Modified: lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp?rev=345849&r1=345848&r2=345849&view=diff == --- lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp (original) +++ lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp Thu Nov 1 09:43:34 2018 @@ -38,4 +38,6 @@ void PythonTestSuite::TearDown() { PyGILState_Release(m_gil_state); ScriptInterpreterPython::Terminate(); + HostInfoBase::Terminate(); + FileSystem::Terminate(); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r345853 - [FileSystem] Remove ResolveExecutableLocation() from FileSpec
Author: jdevlieghere Date: Thu Nov 1 10:09:22 2018 New Revision: 345853 URL: http://llvm.org/viewvc/llvm-project?rev=345853&view=rev Log: [FileSystem] Remove ResolveExecutableLocation() from FileSpec This patch removes the ResolveExecutableLocation method from FileSpec and updates its uses with calls to the FileSystem. Differential revision: https://reviews.llvm.org/D53834 Modified: lldb/trunk/include/lldb/Host/FileSystem.h lldb/trunk/include/lldb/Utility/FileSpec.h lldb/trunk/source/API/SBFileSpec.cpp lldb/trunk/source/Host/common/FileSystem.cpp lldb/trunk/source/Host/common/MonitoringProcessLauncher.cpp lldb/trunk/source/Host/macosx/objcxx/Host.mm lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp lldb/trunk/source/Target/ProcessLaunchInfo.cpp lldb/trunk/source/Utility/FileSpec.cpp Modified: lldb/trunk/include/lldb/Host/FileSystem.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=345853&r1=345852&r2=345853&view=diff == --- lldb/trunk/include/lldb/Host/FileSystem.h (original) +++ lldb/trunk/include/lldb/Host/FileSystem.h Thu Nov 1 10:09:22 2018 @@ -92,6 +92,9 @@ public: void Resolve(FileSpec &file_spec); /// @} + /// Call into the Host to see if it can help find the file. + bool ResolveExecutableLocation(FileSpec &file_spec); + enum EnumerateDirectoryResult { /// Enumerate next entry in the current directory. eEnumerateDirectoryResultNext, Modified: lldb/trunk/include/lldb/Utility/FileSpec.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/FileSpec.h?rev=345853&r1=345852&r2=345853&view=diff == --- lldb/trunk/include/lldb/Utility/FileSpec.h (original) +++ lldb/trunk/include/lldb/Utility/FileSpec.h Thu Nov 1 10:09:22 2018 @@ -281,21 +281,6 @@ public: bool Exists() const; //-- - /// Expanded existence test. - /// - /// Call into the Host to see if it can help find the file (e.g. by - /// searching paths set in the environment, etc.). - /// - /// If found, sets the value of m_directory to the directory where the file - /// was found. - /// - /// @return - /// \b true if was able to find the file using expanded search - /// methods, \b false otherwise. - //-- - bool ResolveExecutableLocation(); - - //-- /// Canonicalize this file path (basically running the static /// FileSpec::Resolve method on it). Useful if you asked us not to resolve /// the file path when you set the file. Modified: lldb/trunk/source/API/SBFileSpec.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFileSpec.cpp?rev=345853&r1=345852&r2=345853&view=diff == --- lldb/trunk/source/API/SBFileSpec.cpp (original) +++ lldb/trunk/source/API/SBFileSpec.cpp Thu Nov 1 10:09:22 2018 @@ -12,6 +12,7 @@ #include "lldb/API/SBFileSpec.h" #include "lldb/API/SBStream.h" +#include "lldb/Host/FileSystem.h" #include "lldb/Host/PosixApi.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Log.h" @@ -61,7 +62,7 @@ bool SBFileSpec::Exists() const { } bool SBFileSpec::ResolveExecutableLocation() { - return m_opaque_ap->ResolveExecutableLocation(); + return FileSystem::Instance().ResolveExecutableLocation(*m_opaque_ap); } int SBFileSpec::ResolvePath(const char *src_path, char *dst_path, Modified: lldb/trunk/source/Host/common/FileSystem.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSystem.cpp?rev=345853&r1=345852&r2=345853&view=diff == --- lldb/trunk/source/Host/common/FileSystem.cpp (original) +++ lldb/trunk/source/Host/common/FileSystem.cpp Thu Nov 1 10:09:22 2018 @@ -13,6 +13,8 @@ #include "lldb/Utility/TildeExpressionResolver.h" #include "llvm/Support/FileSystem.h" +#include "llvm/Support/Path.h" +#include "llvm/Support/Program.h" #include "llvm/Support/Threading.h" #include @@ -178,3 +180,36 @@ void FileSystem::Resolve(FileSpec &file_ // Update the FileSpec with the resolved path. file_spec.SetPath(path); } + +bool FileSystem::ResolveExecutableLocation(FileSpec &file_spec) { + // If the directory is set there's nothing to do. + const ConstString &directory = file_spec.GetDirectory(); + if (directory) +return false; + + // We cannot look for a file if there's no file name. + const ConstString &filename = file_spec.GetFilename(); + if (!filename) +return false; + + // Search for the file on the host. + const std::string fil
[Lldb-commits] [lldb] r345854 - [FileSystem] Remove Exists() from FileSpec
Author: jdevlieghere Date: Thu Nov 1 10:09:25 2018 New Revision: 345854 URL: http://llvm.org/viewvc/llvm-project?rev=345854&view=rev Log: [FileSystem] Remove Exists() from FileSpec This patch removes the Exists method from FileSpec and updates its uses with calls to the FileSystem. Differential revision: https://reviews.llvm.org/D53845 Modified: lldb/trunk/include/lldb/Utility/FileSpec.h lldb/trunk/source/API/SBDebugger.cpp lldb/trunk/source/API/SBFileSpec.cpp lldb/trunk/source/Commands/CommandObjectMemory.cpp lldb/trunk/source/Commands/CommandObjectPlatform.cpp lldb/trunk/source/Commands/CommandObjectTarget.cpp lldb/trunk/source/Core/Debugger.cpp lldb/trunk/source/Core/DynamicLoader.cpp lldb/trunk/source/Core/Module.cpp lldb/trunk/source/Core/ModuleList.cpp lldb/trunk/source/Core/PluginManager.cpp lldb/trunk/source/Core/SourceManager.cpp lldb/trunk/source/Host/common/HostInfoBase.cpp lldb/trunk/source/Host/common/Symbols.cpp lldb/trunk/source/Host/macosx/Symbols.cpp lldb/trunk/source/Host/macosx/objcxx/Host.mm lldb/trunk/source/Interpreter/CommandInterpreter.cpp lldb/trunk/source/Interpreter/OptionValuePathMappings.cpp lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/trunk/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp lldb/trunk/source/Symbol/ObjectFile.cpp lldb/trunk/source/Target/ModuleCache.cpp lldb/trunk/source/Target/PathMappingList.cpp lldb/trunk/source/Target/Platform.cpp lldb/trunk/source/Target/Process.cpp lldb/trunk/source/Target/TargetList.cpp lldb/trunk/source/Utility/FileSpec.cpp lldb/trunk/source/Utility/StructuredData.cpp lldb/trunk/unittests/Target/ModuleCacheTest.cpp Modified: lldb/trunk/include/lldb/Utility/FileSpec.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/FileSpec.h?rev=345854&r1=345853&r2=345854&view=diff == --- lldb/trunk/include/lldb/Utility/FileSpec.h (original) +++ lldb/trunk/include/lldb/Utility/FileSpec.h Thu Nov 1 10:09:25 2018 @@ -273,14 +273,6 @@ public: void Dump(Stream *s) const; //-- - /// Existence test. - /// - /// @return - /// \b true if the file exists on disk, \b false otherwise. - //-- - bool Exists() const; - - //-- /// Canonicalize this file path (basically running the static /// FileSpec::Resolve method on it). Useful if you asked us not to resolve /// the file path when you set the file. Modified: lldb/trunk/source/API/SBDebugger.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDebugger.cpp?rev=345854&r1=345853&r2=345854&view=diff == --- lldb/trunk/source/API/SBDebugger.cpp (original) +++ lldb/trunk/source/API/SBDebugger.cpp Thu Nov 1 10:09:25 2018 @@ -90,7 +90,7 @@ static llvm::sys::DynamicLibrary LoadPlu "lldb::PluginInitialize(lldb::SBDebugger)"); } } else
[Lldb-commits] [lldb] r345857 - [FileSystem] Fix Exists call sites
Author: jdevlieghere Date: Thu Nov 1 10:35:31 2018 New Revision: 345857 URL: http://llvm.org/viewvc/llvm-project?rev=345857&view=rev Log: [FileSystem] Fix Exists call sites There were some calls left to Exists() on non-darwin platforms (Windows, Linux and FreeBSD) that weren't yet updated to use the FileSystem. Modified: lldb/trunk/source/Host/android/HostInfoAndroid.cpp lldb/trunk/source/Host/linux/HostInfoLinux.cpp lldb/trunk/source/Host/windows/Host.cpp lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp Modified: lldb/trunk/source/Host/android/HostInfoAndroid.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/android/HostInfoAndroid.cpp?rev=345857&r1=345856&r2=345857&view=diff == --- lldb/trunk/source/Host/android/HostInfoAndroid.cpp (original) +++ lldb/trunk/source/Host/android/HostInfoAndroid.cpp Thu Nov 1 10:35:31 2018 @@ -8,6 +8,7 @@ //===--===// #include "lldb/Host/android/HostInfoAndroid.h" +#include "lldb/Host/FileSystem.h" #include "lldb/Host/linux/HostInfoLinux.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" @@ -68,7 +69,7 @@ FileSpec HostInfoAndroid::ResolveLibrary FileSpec file_candidate(path.str().c_str(), true); file_candidate.AppendPathComponent(module_path.c_str()); -if (file_candidate.Exists()) +if (FileSystem::Instance().Exists(file_candidate)) return file_candidate; } @@ -83,8 +84,8 @@ bool HostInfoAndroid::ComputeTempFileBas // algorithm will deduce /tmp, which is plain wrong. In that case we have an // invalid directory, we substitute the path with /data/local/tmp, which is // correct at least in some cases (i.e., when running as shell user). - if (!success || !file_spec.Exists()) + if (!success || !FileSystem::Instance().Exists(file_spec)) file_spec = FileSpec("/data/local/tmp", false); - return file_spec.Exists(); + return FileSystem::Instance().Exists(file_spec); } Modified: lldb/trunk/source/Host/linux/HostInfoLinux.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/linux/HostInfoLinux.cpp?rev=345857&r1=345856&r2=345857&view=diff == --- lldb/trunk/source/Host/linux/HostInfoLinux.cpp (original) +++ lldb/trunk/source/Host/linux/HostInfoLinux.cpp Thu Nov 1 10:35:31 2018 @@ -7,8 +7,9 @@ // //===--===// -#include "lldb/Host/Config.h" #include "lldb/Host/linux/HostInfoLinux.h" +#include "lldb/Host/Config.h" +#include "lldb/Host/FileSystem.h" #include "lldb/Utility/Log.h" #include "llvm/Support/Threading.h" @@ -179,7 +180,7 @@ FileSpec HostInfoLinux::GetProgramFileSp bool HostInfoLinux::ComputeSupportExeDirectory(FileSpec &file_spec) { if (HostInfoPosix::ComputeSupportExeDirectory(file_spec) && - file_spec.IsAbsolute() && file_spec.Exists()) + file_spec.IsAbsolute() && FileSystem::Instance().Exists(file_spec)) return true; file_spec.GetDirectory() = GetProgramFileSpec().GetDirectory(); return !file_spec.GetDirectory().IsEmpty(); Modified: lldb/trunk/source/Host/windows/Host.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/Host.cpp?rev=345857&r1=345856&r2=345857&view=diff == --- lldb/trunk/source/Host/windows/Host.cpp (original) +++ lldb/trunk/source/Host/windows/Host.cpp Thu Nov 1 10:35:31 2018 @@ -15,6 +15,7 @@ // C++ Includes // Other libraries and framework includes // Project includes +#include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" #include "lldb/Host/HostInfo.h" #include "lldb/Target/Process.h" @@ -189,7 +190,7 @@ Status Host::ShellExpandArguments(Proces return error; } expand_tool_spec.AppendPathComponent("lldb-argdumper.exe"); -if (!expand_tool_spec.Exists()) { +if (!FileSystem::Instance().Exists(expand_tool_spec)) { error.SetErrorString("could not find the lldb-argdumper tool"); return error; } Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp?rev=345857&r1=345856&r2=345857&view=diff == --- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp (original) +++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp Thu Nov 1 10:35:31 2018 @@ -24,6 +24,7 @@ // Other libraries and framework includes #include "lldb/Core/PluginManager.h" +#include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Target/Dyna
[Lldb-commits] [lldb] r345860 - [FileSystem] Fix typo in ProcessFreeBSD
Author: jdevlieghere Date: Thu Nov 1 10:46:31 2018 New Revision: 345860 URL: http://llvm.org/viewvc/llvm-project?rev=345860&view=rev Log: [FileSystem] Fix typo in ProcessFreeBSD Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp?rev=345860&r1=345859&r2=345860&view=diff == --- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp (original) +++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp Thu Nov 1 10:46:31 2018 @@ -288,7 +288,7 @@ bool ProcessFreeBSD::CanDebug(lldb::Targ // For now we are just making sure the file exists for a given module ModuleSP exe_module_sp(target_sp->GetExecutableModule()); if (exe_module_sp.get()) -return FileSystem::Instance()::Exists(exe_module_sp->GetFileSpec()); +return FileSystem::Instance().Exists(exe_module_sp->GetFileSpec()); // If there is no executable module, we return true since we might be // preparing to attach. return true; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r345891 - [FileSystem] Change FileSpec constructor signature.
Author: jdevlieghere Date: Thu Nov 1 14:18:25 2018 New Revision: 345891 URL: http://llvm.org/viewvc/llvm-project?rev=345891&view=rev Log: [FileSystem] Change FileSpec constructor signature. Fix breakage due to the recent FileSpec change that extracts the path resultion logic into FileSystem for the Android host. Modified: lldb/trunk/source/Host/android/HostInfoAndroid.cpp Modified: lldb/trunk/source/Host/android/HostInfoAndroid.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/android/HostInfoAndroid.cpp?rev=345891&r1=345890&r2=345891&view=diff == --- lldb/trunk/source/Host/android/HostInfoAndroid.cpp (original) +++ lldb/trunk/source/Host/android/HostInfoAndroid.cpp Thu Nov 1 14:18:25 2018 @@ -29,7 +29,7 @@ void HostInfoAndroid::ComputeHostArchite } FileSpec HostInfoAndroid::GetDefaultShell() { - return FileSpec("/system/bin/sh", false); + return FileSpec("/system/bin/sh"); } FileSpec HostInfoAndroid::ResolveLibraryPath(const std::string &module_path, @@ -66,7 +66,8 @@ FileSpec HostInfoAndroid::ResolveLibrary ld_paths.push_back(StringRef(*it)); for (const StringRef &path : ld_paths) { -FileSpec file_candidate(path.str().c_str(), true); +FileSpec file_candidate(path.str().c_str()); +FileSystem::Instance().Resolve(file_candidate); file_candidate.AppendPathComponent(module_path.c_str()); if (FileSystem::Instance().Exists(file_candidate)) @@ -85,7 +86,7 @@ bool HostInfoAndroid::ComputeTempFileBas // invalid directory, we substitute the path with /data/local/tmp, which is // correct at least in some cases (i.e., when running as shell user). if (!success || !FileSystem::Instance().Exists(file_spec)) -file_spec = FileSpec("/data/local/tmp", false); +file_spec = FileSpec("/data/local/tmp"); return FileSystem::Instance().Exists(file_spec); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r345895 - [FileSystem] Change FileSpec constructor signature (2/2)
Author: jdevlieghere Date: Thu Nov 1 14:26:58 2018 New Revision: 345895 URL: http://llvm.org/viewvc/llvm-project?rev=345895&view=rev Log: [FileSystem] Change FileSpec constructor signature (2/2) Fix breakage due to the recent FileSpec change that extracts the path resultion logic into FileSystem for the FreeBSD host. Modified: lldb/trunk/source/Host/freebsd/Host.cpp Modified: lldb/trunk/source/Host/freebsd/Host.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/freebsd/Host.cpp?rev=345895&r1=345894&r2=345895&view=diff == --- lldb/trunk/source/Host/freebsd/Host.cpp (original) +++ lldb/trunk/source/Host/freebsd/Host.cpp Thu Nov 1 14:26:58 2018 @@ -75,11 +75,9 @@ GetFreeBSDProcessArgs(const ProcessInsta size_t pathname_len = sizeof(pathname); mib[2] = KERN_PROC_PATHNAME; if (::sysctl(mib, 4, pathname, &pathname_len, NULL, 0) == 0) -process_info.GetExecutableFile().SetFile(pathname, false, - FileSpec::Style::native); +process_info.GetExecutableFile().SetFile(pathname, FileSpec::Style::native); else -process_info.GetExecutableFile().SetFile(cstr, false, - FileSpec::Style::native); +process_info.GetExecutableFile().SetFile(cstr, FileSpec::Style::native); if (!(match_info_ptr == NULL || NameMatches(process_info.GetExecutableFile().GetFilename().GetCString(), ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r345898 - [FileSystem] Update SetFile signature.
Author: jdevlieghere Date: Thu Nov 1 15:16:34 2018 New Revision: 345898 URL: http://llvm.org/viewvc/llvm-project?rev=345898&view=rev Log: [FileSystem] Update SetFile signature. Modified: lldb/trunk/source/Host/freebsd/HostInfoFreeBSD.cpp Modified: lldb/trunk/source/Host/freebsd/HostInfoFreeBSD.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/freebsd/HostInfoFreeBSD.cpp?rev=345898&r1=345897&r2=345898&view=diff == --- lldb/trunk/source/Host/freebsd/HostInfoFreeBSD.cpp (original) +++ lldb/trunk/source/Host/freebsd/HostInfoFreeBSD.cpp Thu Nov 1 15:16:34 2018 @@ -69,7 +69,7 @@ FileSpec HostInfoFreeBSD::GetProgramFile if (sysctl(exe_path_mib, 4, NULL, &exe_path_size, NULL, 0) == 0) { char *exe_path = new char[exe_path_size]; if (sysctl(exe_path_mib, 4, exe_path, &exe_path_size, NULL, 0) == 0) -g_program_filespec.SetFile(exe_path, false, FileSpec::Style::native); +g_program_filespec.SetFile(exe_path, FileSpec::Style::native); delete[] exe_path; } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r345901 - [File] Remove static method to get permissions.
Author: jdevlieghere Date: Thu Nov 1 15:46:49 2018 New Revision: 345901 URL: http://llvm.org/viewvc/llvm-project?rev=345901&view=rev Log: [File] Remove static method to get permissions. This patch removes the static accessor in File to get a file's permissions. Permissions should be checked through the FileSystem class. Modified: lldb/trunk/include/lldb/Host/File.h lldb/trunk/include/lldb/Host/FileSystem.h lldb/trunk/source/Host/common/File.cpp lldb/trunk/source/Host/common/FileSystem.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp Modified: lldb/trunk/include/lldb/Host/File.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/File.h?rev=345901&r1=345900&r2=345901&view=diff == --- lldb/trunk/include/lldb/Host/File.h (original) +++ lldb/trunk/include/lldb/Host/File.h Thu Nov 1 15:46:49 2018 @@ -419,8 +419,6 @@ public: //-- uint32_t GetPermissions(Status &error) const; - static uint32_t GetPermissions(const FileSpec &file_spec, Status &error); - //-- /// Return true if this file is interactive. /// Modified: lldb/trunk/include/lldb/Host/FileSystem.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=345901&r1=345900&r2=345901&view=diff == --- lldb/trunk/include/lldb/Host/FileSystem.h (original) +++ lldb/trunk/include/lldb/Host/FileSystem.h Thu Nov 1 15:46:49 2018 @@ -66,6 +66,8 @@ public: /// @{ uint32_t GetPermissions(const FileSpec &file_spec) const; uint32_t GetPermissions(const llvm::Twine &path) const; + uint32_t GetPermissions(const FileSpec &file_spec, std::error_code &ec) const; + uint32_t GetPermissions(const llvm::Twine &path, std::error_code &ec) const; /// @} /// Returns whether the given file exists. Modified: lldb/trunk/source/Host/common/File.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/File.cpp?rev=345901&r1=345900&r2=345901&view=diff == --- lldb/trunk/source/Host/common/File.cpp (original) +++ lldb/trunk/source/Host/common/File.cpp Thu Nov 1 15:46:49 2018 @@ -248,19 +248,6 @@ Status File::Open(const char *path, uint return error; } -uint32_t File::GetPermissions(const FileSpec &file_spec, Status &error) { - if (file_spec) { -error.Clear(); -auto Perms = llvm::sys::fs::getPermissions(file_spec.GetPath()); -if (Perms) - return *Perms; -error = Status(Perms.getError()); -return 0; - } else -error.SetErrorString("empty file spec"); - return 0; -} - uint32_t File::GetPermissions(Status &error) const { int fd = GetDescriptor(); if (fd != kInvalidDescriptor) { Modified: lldb/trunk/source/Host/common/FileSystem.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSystem.cpp?rev=345901&r1=345900&r2=345901&view=diff == --- lldb/trunk/source/Host/common/FileSystem.cpp (original) +++ lldb/trunk/source/Host/common/FileSystem.cpp Thu Nov 1 15:46:49 2018 @@ -78,10 +78,23 @@ uint32_t FileSystem::GetPermissions(cons return GetPermissions(file_spec.GetPath()); } +uint32_t FileSystem::GetPermissions(const FileSpec &file_spec, +std::error_code &ec) const { + return GetPermissions(file_spec.GetPath(), ec); +} + uint32_t FileSystem::GetPermissions(const Twine &path) const { + std::error_code ec; + return GetPermissions(path, ec); +} + +uint32_t FileSystem::GetPermissions(const Twine &path, +std::error_code &ec) const { ErrorOr status = m_fs->status(path); - if (!status) + if (!status) { +ec = status.getError(); return sys::fs::perms::perms_not_known; + } return status->getPermissions(); } Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp?rev=345901&r1=345900&r2=345901&view=diff == --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp Thu Nov 1 15:46:49 2018 @@ -660,14 +660,14 @@ GDBRemoteCommunicationServerCommon::Hand std::string path; packet.GetHexByteString(path); if (!path.empty()) { -Status error; FileSpec file_spec(path); FileSystem::Instance().Resolve(file_spec); -const uint32_t mode = File::GetPermissions(file
[Lldb-commits] [lldb] r346002 - [FileSystme] Move ::open abstraction into FileSystem.
Author: jdevlieghere Date: Fri Nov 2 10:34:16 2018 New Revision: 346002 URL: http://llvm.org/viewvc/llvm-project?rev=346002&view=rev Log: [FileSystme] Move ::open abstraction into FileSystem. This moves the abstraction around ::open into the FileSystem, as is already the case for ::fopen. Modified: lldb/trunk/include/lldb/Host/FileSystem.h lldb/trunk/source/Host/common/File.cpp lldb/trunk/source/Host/posix/FileSystem.cpp lldb/trunk/source/Host/windows/FileSystem.cpp Modified: lldb/trunk/include/lldb/Host/FileSystem.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=346002&r1=346001&r2=346002&view=diff == --- lldb/trunk/include/lldb/Host/FileSystem.h (original) +++ lldb/trunk/include/lldb/Host/FileSystem.h Fri Nov 2 10:34:16 2018 @@ -43,10 +43,12 @@ public: Status ResolveSymbolicLink(const FileSpec &src, FileSpec &dst); - /// Wraps ::fopen in a platform-independent way. Once opened, FILEs can be - /// manipulated and closed with the normal ::fread, ::fclose, etc. functions. + /// Wraps ::fopen in a platform-independent way. FILE *Fopen(const char *path, const char *mode); + /// Wraps ::open in a platform-independent way. + int Open(const char *path, int flags, int mode); + /// Returns the modification time of the given file. /// @{ llvm::sys::TimePoint<> GetModificationTime(const FileSpec &file_spec) const; Modified: lldb/trunk/source/Host/common/File.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/File.cpp?rev=346002&r1=346001&r2=346002&view=diff == --- lldb/trunk/source/Host/common/File.cpp (original) +++ lldb/trunk/source/Host/common/File.cpp Fri Nov 2 10:34:16 2018 @@ -30,6 +30,7 @@ #include "llvm/Support/Process.h" // for llvm::sys::Process::FileDescriptorHasColors() #include "lldb/Host/Config.h" +#include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/FileSpec.h" @@ -160,16 +161,7 @@ void File::SetStream(FILE *fh, bool tran } static int DoOpen(const char *path, int flags, int mode) { -#ifdef _MSC_VER - std::wstring wpath; - if (!llvm::ConvertUTF8toWide(path, wpath)) -return -1; - int result; - ::_wsopen_s(&result, wpath.c_str(), flags, _SH_DENYNO, mode); - return result; -#else - return ::open(path, flags, mode); -#endif + return FileSystem::Instance().Open(path, flags, mode); } Status File::Open(const char *path, uint32_t options, uint32_t permissions) { Modified: lldb/trunk/source/Host/posix/FileSystem.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/FileSystem.cpp?rev=346002&r1=346001&r2=346002&view=diff == --- lldb/trunk/source/Host/posix/FileSystem.cpp (original) +++ lldb/trunk/source/Host/posix/FileSystem.cpp Fri Nov 2 10:34:16 2018 @@ -11,6 +11,7 @@ // C includes #include +#include #include #include #include @@ -73,3 +74,7 @@ Status FileSystem::ResolveSymbolicLink(c FILE *FileSystem::Fopen(const char *path, const char *mode) { return ::fopen(path, mode); } + +int FileSystem::Open(const char *path, int flags, int mode) { + return ::open(path, flags, mode); +} Modified: lldb/trunk/source/Host/windows/FileSystem.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/FileSystem.cpp?rev=346002&r1=346001&r2=346002&view=diff == --- lldb/trunk/source/Host/windows/FileSystem.cpp (original) +++ lldb/trunk/source/Host/windows/FileSystem.cpp Fri Nov 2 10:34:16 2018 @@ -96,3 +96,12 @@ FILE *FileSystem::Fopen(const char *path return nullptr; return file; } + +int FileSystem::Open(const char *path, int flags, int mode) { + std::wstring wpath; + if (!llvm::ConvertUTF8toWide(path, wpath)) +return -1; + int result; + ::_wsopen_s(&result, wpath.c_str(), flags, _SH_DENYNO, mode); + return result; +} ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r346003 - [FileSystem] Remove `SetFileSystem` method.
Author: jdevlieghere Date: Fri Nov 2 10:34:17 2018 New Revision: 346003 URL: http://llvm.org/viewvc/llvm-project?rev=346003&view=rev Log: [FileSystem] Remove `SetFileSystem` method. This is no longer relevant with the new way we initialize the FileSystem. Modified: lldb/trunk/include/lldb/Host/FileSystem.h lldb/trunk/source/Host/common/FileSystem.cpp Modified: lldb/trunk/include/lldb/Host/FileSystem.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=346003&r1=346002&r2=346003&view=diff == --- lldb/trunk/include/lldb/Host/FileSystem.h (original) +++ lldb/trunk/include/lldb/Host/FileSystem.h Fri Nov 2 10:34:17 2018 @@ -124,9 +124,6 @@ public: std::error_code GetRealPath(const llvm::Twine &path, llvm::SmallVectorImpl &output) const; -protected: - void SetFileSystem(llvm::IntrusiveRefCntPtr fs); - private: static llvm::Optional &InstanceImpl(); llvm::IntrusiveRefCntPtr m_fs; Modified: lldb/trunk/source/Host/common/FileSystem.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSystem.cpp?rev=346003&r1=346002&r2=346003&view=diff == --- lldb/trunk/source/Host/common/FileSystem.cpp (original) +++ lldb/trunk/source/Host/common/FileSystem.cpp Fri Nov 2 10:34:17 2018 @@ -47,10 +47,6 @@ Optional &FileSystem::Instan return g_fs; } -void FileSystem::SetFileSystem(IntrusiveRefCntPtr fs) { - m_fs = fs; -} - sys::TimePoint<> FileSystem::GetModificationTime(const FileSpec &file_spec) const { return GetModificationTime(file_spec.GetPath()); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r346049 - [FileSystem] Open File instances through the FileSystem.
Author: jdevlieghere Date: Fri Nov 2 15:34:51 2018 New Revision: 346049 URL: http://llvm.org/viewvc/llvm-project?rev=346049&view=rev Log: [FileSystem] Open File instances through the FileSystem. This patch modifies how we open File instances in LLDB. Rather than passing a path or FileSpec to the constructor, we now go through the virtual file system. This is needed in order to make things work with the VFS in the future. Differential revision: https://reviews.llvm.org/D54020 Modified: lldb/trunk/include/lldb/Host/File.h lldb/trunk/include/lldb/Host/FileSystem.h lldb/trunk/source/API/SBStream.cpp lldb/trunk/source/Commands/CommandObjectBugreport.cpp lldb/trunk/source/Commands/CommandObjectMemory.cpp lldb/trunk/source/Core/StreamFile.cpp lldb/trunk/source/Expression/REPL.cpp lldb/trunk/source/Host/common/File.cpp lldb/trunk/source/Host/common/FileCache.cpp lldb/trunk/source/Host/common/FileSystem.cpp lldb/trunk/source/Interpreter/CommandInterpreter.cpp lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp lldb/trunk/source/Target/ModuleCache.cpp lldb/trunk/source/Target/Platform.cpp lldb/trunk/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp Modified: lldb/trunk/include/lldb/Host/File.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/File.h?rev=346049&r1=346048&r2=346049&view=diff == --- lldb/trunk/include/lldb/Host/File.h (original) +++ lldb/trunk/include/lldb/Host/File.h Fri Nov 2 15:34:51 2018 @@ -64,50 +64,6 @@ public: m_is_real_terminal(eLazyBoolCalculate), m_supports_colors(eLazyBoolCalculate) {} - //-- - /// Constructor with path. - /// - /// Takes a path to a file which can be just a filename, or a full path. If - /// \a path is not nullptr or empty, this function will call File::Open - /// (const char *path, uint32_t options, uint32_t permissions). - /// - /// @param[in] path - /// The full or partial path to a file. - /// - /// @param[in] options - /// Options to use when opening (see File::OpenOptions) - /// - /// @param[in] permissions - /// Options to use when opening (see File::Permissions) - /// - /// @see File::Open (const char *path, uint32_t options, uint32_t - /// permissions) - //-- - File(const char *path, uint32_t options, - uint32_t permissions = lldb::eFilePermissionsFileDefault); - - //-- - /// Constructor with FileSpec. - /// - /// Takes a FileSpec pointing to a file which can be just a filename, or a - /// full path. If \a path is not nullptr or empty, this function will call - /// File::Open (const char *path, uint32_t options, uint32_t permissions). - /// - /// @param[in] filespec - /// The FileSpec for this file. - /// - /// @param[in] options - /// Options to use when opening (see File::OpenOptions) - /// - /// @param[in] permissions - /// Options to use when opening (see File::Permissions) - /// - /// @see File::Open (const char *path, uint32_t options, uint32_t - /// permissions) - //-- - File(const FileSpec &filespec, uint32_t options, - uint32_t permissions = lldb::eFilePermissionsFileDefault); - File(int fd, bool transfer_ownership) : IOObject(eFDTypeFile, transfer_ownership), m_descriptor(fd), m_stream(kInvalidStream), m_options(0), m_own_stream(false), @@ -169,23 +125,6 @@ public: //-- Status GetFileSpec(FileSpec &file_spec) const; - //-- - /// Open a file for read/writing with the specified options. - /// - /// Takes a path to a file which can be just a filename, or a full path. - /// - /// @param[in] path - /// The full or partial path to a file. - /// - /// @param[in] options - /// Options to use when opening (see File::OpenOptions) - /// - /// @param[in] permissions - /// Options to use when opening (see File::Permissions) - //-- - Status Open(const char *path, uint32_t options, - uint32_t permissions = lldb::eFilePermissionsFileDefault); - Status Close() override; void Clear(); @@ -461,8 +400,10 @@ public: void SetOptions(uint32_t options)
[Lldb-commits] [lldb] r346159 - Remove OCaml debugger plugin
Author: jdevlieghere Date: Mon Nov 5 11:34:03 2018 New Revision: 346159 URL: http://llvm.org/viewvc/llvm-project?rev=346159&view=rev Log: Remove OCaml debugger plugin In January Davide sent an e-mail to the mailing list to suggest removing unmaintained language plugins such as Go and Java. The plan was to have some cool down period to allow users to speak up, however after that the plugins were never actually removed. This patch removes the OCaml debugger plugin. The plugin can be added again in the future if it is mature enough both in terms of testing and maintenance commitment. Discussion on the mailing list: http://lists.llvm.org/pipermail/lldb-dev/2018-January/013171.html Differential revision: https://reviews.llvm.org/D54060 Removed: lldb/trunk/include/lldb/Symbol/OCamlASTContext.h lldb/trunk/source/Plugins/Language/OCaml/CMakeLists.txt lldb/trunk/source/Plugins/Language/OCaml/OCamlLanguage.cpp lldb/trunk/source/Plugins/Language/OCaml/OCamlLanguage.h lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserOCaml.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserOCaml.h lldb/trunk/source/Symbol/OCamlASTContext.cpp Modified: lldb/trunk/source/API/SystemInitializerFull.cpp lldb/trunk/source/Plugins/Language/CMakeLists.txt lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h lldb/trunk/source/Symbol/CMakeLists.txt lldb/trunk/tools/lldb-test/SystemInitializerTest.cpp lldb/trunk/unittests/Language/Highlighting/CMakeLists.txt lldb/trunk/unittests/Language/Highlighting/HighlighterTest.cpp Removed: lldb/trunk/include/lldb/Symbol/OCamlASTContext.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/OCamlASTContext.h?rev=346158&view=auto == --- lldb/trunk/include/lldb/Symbol/OCamlASTContext.h (original) +++ lldb/trunk/include/lldb/Symbol/OCamlASTContext.h (removed) @@ -1,314 +0,0 @@ -//===-- OCamlASTContext.h --*- C++ -//-*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===--===// - -#ifndef liblldb_OCamlASTContext_h_ -#define liblldb_OCamlASTContext_h_ - -// C Includes -// C++ Includes -#include -#include -#include -#include -#include - -// Other libraries and framework includes -// Project includes -#include "lldb/Symbol/CompilerType.h" -#include "lldb/Symbol/TypeSystem.h" -#include "lldb/Utility/ConstString.h" - -namespace lldb_private { - -class OCamlASTContext : public TypeSystem { -public: - class OCamlType; - typedef std::map> OCamlTypeMap; - - OCamlASTContext(); - ~OCamlASTContext() override; - - ConstString GetPluginName() override; - - uint32_t GetPluginVersion() override; - - static ConstString GetPluginNameStatic(); - - static lldb::TypeSystemSP CreateInstance(lldb::LanguageType language, - Module *module, Target *target); - - static void EnumerateSupportedLanguages( - std::set &languages_for_types, - std::set &languages_for_expressions); - - static void Initialize(); - - static void Terminate(); - - DWARFASTParser *GetDWARFParser() override; - - void SetAddressByteSize(int byte_size) { m_pointer_byte_size = byte_size; } - - static bool classof(const TypeSystem *ts) { -return ts->getKind() == TypeSystem::eKindOCaml; - } - - ConstString DeclGetName(void *opaque_decl) override { return ConstString(); } - - bool DeclContextIsStructUnionOrClass(void *opaque_decl_ctx) override { -return false; - } - - ConstString DeclContextGetName(void *opaque_decl_ctx) override { -return ConstString(); - } - - ConstString DeclContextGetScopeQualifiedName(void *opaque_decl_ctx) override { -return ConstString(); - } - - bool - DeclContextIsClassMethod(void *opaque_decl_ctx, - lldb::LanguageType *language_ptr, - bool *is_instance_method_ptr, - ConstString *language_object_name_ptr) override { -return false; - } - - bool SupportsLanguage(lldb::LanguageType language) override; - uint32_t GetPointerByteSize() override; - - bool IsArrayType(lldb::opaque_compiler_type_t type, - CompilerType *element_type, uint64_t *size, - bool *is_incomplete) override; - - bool IsAggregateType(lldb::opaque_compiler_type_t type) override; - - bool IsCharType(lldb::opaque_compiler_type_t type) override; - - bool IsCompleteType(lldb::opaque_compiler_type_t type) override; - - bool IsDefined(lldb::opaque_compiler_type_t type) override; - - bool IsFloatingPointType(lldb::opaque_compiler_type_t type, uint32_t &count, -
[Lldb-commits] [lldb] r346375 - [FileSystem] Add convenience method to check for directories.
Author: jdevlieghere Date: Wed Nov 7 16:14:50 2018 New Revision: 346375 URL: http://llvm.org/viewvc/llvm-project?rev=346375&view=rev Log: [FileSystem] Add convenience method to check for directories. Replace calls to LLVM's is_directory with calls to LLDB's FileSytem class. For this I introduced a new convenience method that, like the other methods, takes either a path or filespec. This still uses the LLVM functions under the hood. Differential revision: https://reviews.llvm.org/D54135 Modified: lldb/trunk/include/lldb/Host/FileSystem.h lldb/trunk/source/API/SBPlatform.cpp lldb/trunk/source/Core/Module.cpp lldb/trunk/source/Core/ModuleList.cpp lldb/trunk/source/Host/common/FileSystem.cpp lldb/trunk/source/Host/common/Symbols.cpp lldb/trunk/source/Host/macosx/Symbols.cpp lldb/trunk/source/Host/macosx/objcxx/Host.mm lldb/trunk/source/Host/macosx/objcxx/HostInfoMacOSX.mm lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangHost.cpp lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp lldb/trunk/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp lldb/trunk/source/Target/TargetList.cpp Modified: lldb/trunk/include/lldb/Host/FileSystem.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=346375&r1=346374&r2=346375&view=diff == --- lldb/trunk/include/lldb/Host/FileSystem.h (original) +++ lldb/trunk/include/lldb/Host/FileSystem.h Wed Nov 7 16:14:50 2018 @@ -88,6 +88,12 @@ public: bool Readable(const llvm::Twine &path) const; /// @} + /// Returns whether the given path is a directory. + /// @{ + bool IsDirectory(const FileSpec &file_spec) const; + bool IsDirectory(const llvm::Twine &path) const; + /// @} + /// Make the given file path absolute. /// @{ std::error_code MakeAbsolute(llvm::SmallVectorImpl &path) const; Modified: lldb/trunk/source/API/SBPlatform.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBPlatform.cpp?rev=346375&r1=346374&r2=346375&view=diff == --- lldb/trunk/source/API/SBPlatform.cpp (original) +++ lldb/trunk/source/API/SBPlatform.cpp Wed Nov 7 16:14:50 2018 @@ -366,7 +366,7 @@ SBError SBPlatform::Put(SBFileSpec &src, if (src.Exists()) { uint32_t permissions = FileSystem::Instance().GetPermissions(src.ref()); if (permissions == 0) { -if (llvm::sys::fs::is_directory(src.ref().GetPath())) +if (FileSystem::Instance().IsDirectory(src.ref())) permissions = eFilePermissionsDirectoryDefault; else permissions = eFilePermissionsFileDefault; Modified: lldb/trunk/source/Core/Module.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=346375&r1=346374&r2=346375&view=diff == --- lldb/trunk/source/Core/Module.cpp (original) +++ lldb/trunk/source/Core/Module.cpp Wed Nov 7 16:14:50 2018 @@ -1448,7 +1448,7 @@ void Module::SetSymbolFileFileSpec(const // ("/tmp/a.out.dSYM/Contents/Resources/DWARF/a.out"). So we need to // check this -if (llvm::sys::fs::is_directory(file.GetPath())) { +if (FileSystem::Instance().IsDirectory(file)) { std::string new_path(file.GetPath()); std::string old_path(obj_file->GetFileSpec().GetPath()); if (old_path.find(new_path) == 0) { Modified: lldb/trunk/source/Core/ModuleList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ModuleList.cpp?rev=346375&r1=346374&r2=346375&view=diff == --- lldb/trunk/source/Core/ModuleList.cpp (original) +++ lldb/trunk/source/Core/ModuleList.cpp Wed Nov 7 16:14:50 2018 @@ -859,7 +859,7 @@ Status ModuleList::GetSharedModule(const auto search_path_spec = module_search_paths_ptr->GetFileSpecAtIndex(idx); FileSystem::Instance().Resolve(search_path_spec); namespace fs = llvm::sys::fs; - if (!fs::is_directory(search_path_spec.GetPath())) + if (!FileSystem::Instance().IsDirectory(search_path_spec)) continue; search_path_spec.AppendPathComponent( module_spec.GetFileSpec().GetFilename().AsCString()); Modified: lldb/trunk/source/Host/common/FileSystem.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSystem.cpp?rev=346375&r1=346374&r2=346375&view=diff == --- lldb/trunk/source/Host/common/Fi
[Lldb-commits] [lldb] r346449 - Update FileSpec constructor signature
Author: jdevlieghere Date: Thu Nov 8 15:21:00 2018 New Revision: 346449 URL: http://llvm.org/viewvc/llvm-project?rev=346449&view=rev Log: Update FileSpec constructor signature Modified: lldb/trunk/source/Host/android/HostInfoAndroid.cpp Modified: lldb/trunk/source/Host/android/HostInfoAndroid.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/android/HostInfoAndroid.cpp?rev=346449&r1=346448&r2=346449&view=diff == --- lldb/trunk/source/Host/android/HostInfoAndroid.cpp (original) +++ lldb/trunk/source/Host/android/HostInfoAndroid.cpp Thu Nov 8 15:21:00 2018 @@ -40,8 +40,11 @@ FileSpec HostInfoAndroid::ResolveLibrary static const char *const default_lib64_path[] = {"/vendor/lib64", "/system/lib64", nullptr}; - if (module_path.empty() || module_path[0] == '/') -return FileSpec(module_path.c_str(), true); + if (module_path.empty() || module_path[0] == '/') { +FileSpec file_spec(module_path.c_str()); +FileSystem::Instance().Resolve(file_spec); +return file_spec; + } SmallVector ld_paths; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r346457 - [FileSystem] Make use of FS in TildeExpressionResolver
Author: jdevlieghere Date: Thu Nov 8 16:50:50 2018 New Revision: 346457 URL: http://llvm.org/viewvc/llvm-project?rev=346457&view=rev Log: [FileSystem] Make use of FS in TildeExpressionResolver In order to call real_path from the TildeExpressionResolver we need access to the FileSystem. Since the resolver lives under utility we have to pass in the FS. Modified: lldb/trunk/include/lldb/Host/FileSystem.h lldb/trunk/include/lldb/Utility/TildeExpressionResolver.h lldb/trunk/source/Commands/CommandCompletions.cpp lldb/trunk/source/Host/common/FileSystem.cpp lldb/trunk/source/Target/TargetList.cpp lldb/trunk/source/Utility/TildeExpressionResolver.cpp lldb/trunk/unittests/Host/FileSystemTest.cpp lldb/trunk/unittests/Interpreter/TestCompletion.cpp lldb/trunk/unittests/TestingSupport/MockTildeExpressionResolver.cpp lldb/trunk/unittests/TestingSupport/MockTildeExpressionResolver.h lldb/trunk/unittests/Utility/TildeExpressionResolverTest.cpp Modified: lldb/trunk/include/lldb/Host/FileSystem.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=346457&r1=346456&r2=346457&view=diff == --- lldb/trunk/include/lldb/Host/FileSystem.h (original) +++ lldb/trunk/include/lldb/Host/FileSystem.h Thu Nov 8 16:50:50 2018 @@ -132,7 +132,8 @@ public: void *callback_baton); std::error_code GetRealPath(const llvm::Twine &path, - llvm::SmallVectorImpl &output) const; + llvm::SmallVectorImpl &output, + bool expand_tilde) const; private: static llvm::Optional &InstanceImpl(); Modified: lldb/trunk/include/lldb/Utility/TildeExpressionResolver.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/TildeExpressionResolver.h?rev=346457&r1=346456&r2=346457&view=diff == --- lldb/trunk/include/lldb/Utility/TildeExpressionResolver.h (original) +++ lldb/trunk/include/lldb/Utility/TildeExpressionResolver.h Thu Nov 8 16:50:50 2018 @@ -18,8 +18,10 @@ template class SmallVectorI } namespace lldb_private { +class FileSystem; class TildeExpressionResolver { public: + TildeExpressionResolver(FileSystem &fs) : m_fs(fs) {} virtual ~TildeExpressionResolver(); /// Resolve a Tilde Expression contained according to bash rules. @@ -52,14 +54,20 @@ public: /// the username portion with the matched result. bool ResolveFullPath(llvm::StringRef Expr, llvm::SmallVectorImpl &Output); + +protected: + FileSystem &m_fs; }; class StandardTildeExpressionResolver : public TildeExpressionResolver { public: + StandardTildeExpressionResolver(FileSystem &fs) + : TildeExpressionResolver(fs) {} + bool ResolveExact(llvm::StringRef Expr, llvm::SmallVectorImpl &Output) override; bool ResolvePartial(llvm::StringRef Expr, llvm::StringSet<> &Output) override; }; -} +} // namespace lldb_private #endif // #ifndef LLDB_UTILITY_TILDE_EXPRESSION_RESOLVER_H Modified: lldb/trunk/source/Commands/CommandCompletions.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandCompletions.cpp?rev=346457&r1=346456&r2=346457&view=diff == --- lldb/trunk/source/Commands/CommandCompletions.cpp (original) +++ lldb/trunk/source/Commands/CommandCompletions.cpp Thu Nov 8 16:50:50 2018 @@ -231,7 +231,7 @@ static int DiskFilesOrDirectories(const static int DiskFilesOrDirectories(CompletionRequest &request, bool only_directories) { request.SetWordComplete(false); - StandardTildeExpressionResolver resolver; + StandardTildeExpressionResolver resolver(FileSystem::Instance()); StringList matches; DiskFilesOrDirectories(request.GetCursorArgumentPrefix(), only_directories, matches, resolver); Modified: lldb/trunk/source/Host/common/FileSystem.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSystem.cpp?rev=346457&r1=346456&r2=346457&view=diff == --- lldb/trunk/source/Host/common/FileSystem.cpp (original) +++ lldb/trunk/source/Host/common/FileSystem.cpp Thu Nov 8 16:50:50 2018 @@ -183,8 +183,9 @@ std::error_code FileSystem::MakeAbsolute } std::error_code FileSystem::GetRealPath(const Twine &path, -SmallVectorImpl &output) const { - return m_fs->getRealPath(path, output); +SmallVectorImpl &output, +bool expand_tilde) const { + return m_fs->getRealPath(path, output, expand_tilde); } void FileSystem::Resolve(SmallVectorImpl &path) { @@ -193,8 +194,8
[Lldb-commits] [lldb] r346466 - Revert "[FileSystem] Make use of FS in TildeExpressionResolver"
Author: jdevlieghere Date: Thu Nov 8 17:59:28 2018 New Revision: 346466 URL: http://llvm.org/viewvc/llvm-project?rev=346466&view=rev Log: Revert "[FileSystem] Make use of FS in TildeExpressionResolver" The whole point of this change was making it possible to resolve paths without depending on the FileSystem, which is not what I did here. Not sure what I was thinking... Modified: lldb/trunk/include/lldb/Host/FileSystem.h lldb/trunk/include/lldb/Utility/TildeExpressionResolver.h lldb/trunk/source/Commands/CommandCompletions.cpp lldb/trunk/source/Host/common/FileSystem.cpp lldb/trunk/source/Target/TargetList.cpp lldb/trunk/source/Utility/TildeExpressionResolver.cpp lldb/trunk/unittests/Host/FileSystemTest.cpp lldb/trunk/unittests/Interpreter/TestCompletion.cpp lldb/trunk/unittests/TestingSupport/MockTildeExpressionResolver.cpp lldb/trunk/unittests/TestingSupport/MockTildeExpressionResolver.h lldb/trunk/unittests/Utility/TildeExpressionResolverTest.cpp Modified: lldb/trunk/include/lldb/Host/FileSystem.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=346466&r1=346465&r2=346466&view=diff == --- lldb/trunk/include/lldb/Host/FileSystem.h (original) +++ lldb/trunk/include/lldb/Host/FileSystem.h Thu Nov 8 17:59:28 2018 @@ -132,8 +132,7 @@ public: void *callback_baton); std::error_code GetRealPath(const llvm::Twine &path, - llvm::SmallVectorImpl &output, - bool expand_tilde) const; + llvm::SmallVectorImpl &output) const; private: static llvm::Optional &InstanceImpl(); Modified: lldb/trunk/include/lldb/Utility/TildeExpressionResolver.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/TildeExpressionResolver.h?rev=346466&r1=346465&r2=346466&view=diff == --- lldb/trunk/include/lldb/Utility/TildeExpressionResolver.h (original) +++ lldb/trunk/include/lldb/Utility/TildeExpressionResolver.h Thu Nov 8 17:59:28 2018 @@ -18,10 +18,8 @@ template class SmallVectorI } namespace lldb_private { -class FileSystem; class TildeExpressionResolver { public: - TildeExpressionResolver(FileSystem &fs) : m_fs(fs) {} virtual ~TildeExpressionResolver(); /// Resolve a Tilde Expression contained according to bash rules. @@ -54,20 +52,14 @@ public: /// the username portion with the matched result. bool ResolveFullPath(llvm::StringRef Expr, llvm::SmallVectorImpl &Output); - -protected: - FileSystem &m_fs; }; class StandardTildeExpressionResolver : public TildeExpressionResolver { public: - StandardTildeExpressionResolver(FileSystem &fs) - : TildeExpressionResolver(fs) {} - bool ResolveExact(llvm::StringRef Expr, llvm::SmallVectorImpl &Output) override; bool ResolvePartial(llvm::StringRef Expr, llvm::StringSet<> &Output) override; }; -} // namespace lldb_private +} #endif // #ifndef LLDB_UTILITY_TILDE_EXPRESSION_RESOLVER_H Modified: lldb/trunk/source/Commands/CommandCompletions.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandCompletions.cpp?rev=346466&r1=346465&r2=346466&view=diff == --- lldb/trunk/source/Commands/CommandCompletions.cpp (original) +++ lldb/trunk/source/Commands/CommandCompletions.cpp Thu Nov 8 17:59:28 2018 @@ -231,7 +231,7 @@ static int DiskFilesOrDirectories(const static int DiskFilesOrDirectories(CompletionRequest &request, bool only_directories) { request.SetWordComplete(false); - StandardTildeExpressionResolver resolver(FileSystem::Instance()); + StandardTildeExpressionResolver resolver; StringList matches; DiskFilesOrDirectories(request.GetCursorArgumentPrefix(), only_directories, matches, resolver); Modified: lldb/trunk/source/Host/common/FileSystem.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSystem.cpp?rev=346466&r1=346465&r2=346466&view=diff == --- lldb/trunk/source/Host/common/FileSystem.cpp (original) +++ lldb/trunk/source/Host/common/FileSystem.cpp Thu Nov 8 17:59:28 2018 @@ -183,9 +183,8 @@ std::error_code FileSystem::MakeAbsolute } std::error_code FileSystem::GetRealPath(const Twine &path, -SmallVectorImpl &output, -bool expand_tilde) const { - return m_fs->getRealPath(path, output, expand_tilde); +SmallVectorImpl &output) const { + return m_fs->getRealPath(path, output); } void FileSystem::Resolve(SmallVectorImpl &path)
[Lldb-commits] [lldb] r346598 - Extract construction of DataBufferLLVM into FileSystem
Author: jdevlieghere Date: Sat Nov 10 14:44:06 2018 New Revision: 346598 URL: http://llvm.org/viewvc/llvm-project?rev=346598&view=rev Log: Extract construction of DataBufferLLVM into FileSystem This moves construction of data buffers into the FileSystem class. Like some of the previous refactorings we don't translate the path yet because the functionality hasn't been landed in LLVM yet. Differential revision: https://reviews.llvm.org/D54272 Modified: lldb/trunk/include/lldb/Host/FileSystem.h lldb/trunk/include/lldb/Utility/DataBufferLLVM.h lldb/trunk/source/API/SBSection.cpp lldb/trunk/source/Commands/CommandObjectMemory.cpp lldb/trunk/source/Core/SourceManager.cpp lldb/trunk/source/Host/common/FileSystem.cpp lldb/trunk/source/Host/common/Host.cpp lldb/trunk/source/Host/linux/Host.cpp lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp lldb/trunk/source/Symbol/ObjectFile.cpp lldb/trunk/source/Utility/DataBufferLLVM.cpp lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp Modified: lldb/trunk/include/lldb/Host/FileSystem.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=346598&r1=346597&r2=346598&view=diff == --- lldb/trunk/include/lldb/Host/FileSystem.h (original) +++ lldb/trunk/include/lldb/Host/FileSystem.h Sat Nov 10 14:44:06 2018 @@ -11,6 +11,7 @@ #define liblldb_Host_FileSystem_h #include "lldb/Host/File.h" +#include "lldb/Utility/DataBufferLLVM.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Status.h" @@ -94,6 +95,12 @@ public: bool IsDirectory(const llvm::Twine &path) const; /// @} + /// Returns whether the given path is local to the file system. + /// @{ + bool IsLocal(const FileSpec &file_spec) const; + bool IsLocal(const llvm::Twine &path) const; + /// @} + /// Make the given file path absolute. /// @{ std::error_code MakeAbsolute(llvm::SmallVectorImpl &path) const; @@ -106,6 +113,16 @@ public: void Resolve(FileSpec &file_spec); /// @} + Create memory buffer from path. + /// @{ + std::shared_ptr CreateDataBuffer(const llvm::Twine &path, + uint64_t size = 0, + uint64_t offset = 0); + std::shared_ptr CreateDataBuffer(const FileSpec &file_spec, + uint64_t size = 0, + uint64_t offset = 0); + /// @} + /// Call into the Host to see if it can help find the file. bool ResolveExecutableLocation(FileSpec &file_spec); Modified: lldb/trunk/include/lldb/Utility/DataBufferLLVM.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/DataBufferLLVM.h?rev=346598&r1=346597&r2=346598&view=diff == --- lldb/trunk/include/lldb/Utility/DataBufferLLVM.h (original) +++ lldb/trunk/include/lldb/Utility/DataBufferLLVM.h Sat Nov 10 14:44:06 2018 @@ -23,16 +23,11 @@ class Twine; namespace lldb_private { +class FileSystem; class DataBufferLLVM : public DataBuffer { public: ~DataBufferLLVM(); - static std::shared_ptr - CreateSliceFromPath(const llvm::Twine &Path, uint64_t Size, uint64_t Offset); - - static std::shared_ptr - CreateFromPath(const llvm::Twine &Path); - uint8_t *GetBytes() override; const uint8_t *GetBytes() const override; lldb::offset_t GetByteSize() const override; @@ -40,6 +35,7 @@ public: char *GetChars() { return reinterpret_cast(GetBytes()); } private: + friend FileSystem; /// Construct a DataBufferLLVM from \p Buffer. \p Buffer must be a valid /// pointer. explicit DataBufferLLVM(std::unique_ptr Buffer); Modified: lldb/trunk/source/API/SBSection.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSection.cpp?rev=346598&r1=346597&r2=346598&view=diff == --- lldb/trunk/source/API/SBSection.cpp (original) +++ lldb/trunk/source/API/SBSection.cpp Sat Nov 10 14:44:06 2018 @@ -14,7 +14,6 @@ #include "lldb/Core/Section.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Utility/DataBuffer.h" -#include "lldb/Utility/DataBufferLLVM.h" #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/StreamString.h" @@ -166,7 +165,7 @@ SBData SBSection::GetSectionDa
[Lldb-commits] [lldb] r346599 - Add missing include
Author: jdevlieghere Date: Sat Nov 10 14:54:44 2018 New Revision: 346599 URL: http://llvm.org/viewvc/llvm-project?rev=346599&view=rev Log: Add missing include Modified: lldb/trunk/source/Host/linux/Host.cpp Modified: lldb/trunk/source/Host/linux/Host.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/linux/Host.cpp?rev=346599&r1=346598&r2=346599&view=diff == --- lldb/trunk/source/Host/linux/Host.cpp (original) +++ lldb/trunk/source/Host/linux/Host.cpp Sat Nov 10 14:54:44 2018 @@ -28,6 +28,7 @@ #include "lldb/Utility/Log.h" #include "lldb/Utility/Status.h" +#include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" #include "lldb/Host/HostInfo.h" #include "lldb/Host/linux/Support.h" ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r346707 - Re-land "Extract construction of DataBufferLLVM into FileSystem"
Author: jdevlieghere Date: Mon Nov 12 13:24:50 2018 New Revision: 346707 URL: http://llvm.org/viewvc/llvm-project?rev=346707&view=rev Log: Re-land "Extract construction of DataBufferLLVM into FileSystem" This fixes some UB in isLocal detected by the sanitized bot. Modified: lldb/trunk/include/lldb/Host/FileSystem.h lldb/trunk/include/lldb/Utility/DataBufferLLVM.h lldb/trunk/source/API/SBSection.cpp lldb/trunk/source/Commands/CommandObjectMemory.cpp lldb/trunk/source/Core/SourceManager.cpp lldb/trunk/source/Host/common/FileSystem.cpp lldb/trunk/source/Host/common/Host.cpp lldb/trunk/source/Host/linux/Host.cpp lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp lldb/trunk/source/Symbol/ObjectFile.cpp lldb/trunk/source/Utility/DataBufferLLVM.cpp lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp Modified: lldb/trunk/include/lldb/Host/FileSystem.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=346707&r1=346706&r2=346707&view=diff == --- lldb/trunk/include/lldb/Host/FileSystem.h (original) +++ lldb/trunk/include/lldb/Host/FileSystem.h Mon Nov 12 13:24:50 2018 @@ -11,6 +11,7 @@ #define liblldb_Host_FileSystem_h #include "lldb/Host/File.h" +#include "lldb/Utility/DataBufferLLVM.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Status.h" @@ -94,6 +95,12 @@ public: bool IsDirectory(const llvm::Twine &path) const; /// @} + /// Returns whether the given path is local to the file system. + /// @{ + bool IsLocal(const FileSpec &file_spec) const; + bool IsLocal(const llvm::Twine &path) const; + /// @} + /// Make the given file path absolute. /// @{ std::error_code MakeAbsolute(llvm::SmallVectorImpl &path) const; @@ -106,6 +113,16 @@ public: void Resolve(FileSpec &file_spec); /// @} + Create memory buffer from path. + /// @{ + std::shared_ptr CreateDataBuffer(const llvm::Twine &path, + uint64_t size = 0, + uint64_t offset = 0); + std::shared_ptr CreateDataBuffer(const FileSpec &file_spec, + uint64_t size = 0, + uint64_t offset = 0); + /// @} + /// Call into the Host to see if it can help find the file. bool ResolveExecutableLocation(FileSpec &file_spec); Modified: lldb/trunk/include/lldb/Utility/DataBufferLLVM.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/DataBufferLLVM.h?rev=346707&r1=346706&r2=346707&view=diff == --- lldb/trunk/include/lldb/Utility/DataBufferLLVM.h (original) +++ lldb/trunk/include/lldb/Utility/DataBufferLLVM.h Mon Nov 12 13:24:50 2018 @@ -23,16 +23,11 @@ class Twine; namespace lldb_private { +class FileSystem; class DataBufferLLVM : public DataBuffer { public: ~DataBufferLLVM(); - static std::shared_ptr - CreateSliceFromPath(const llvm::Twine &Path, uint64_t Size, uint64_t Offset); - - static std::shared_ptr - CreateFromPath(const llvm::Twine &Path); - uint8_t *GetBytes() override; const uint8_t *GetBytes() const override; lldb::offset_t GetByteSize() const override; @@ -40,6 +35,7 @@ public: char *GetChars() { return reinterpret_cast(GetBytes()); } private: + friend FileSystem; /// Construct a DataBufferLLVM from \p Buffer. \p Buffer must be a valid /// pointer. explicit DataBufferLLVM(std::unique_ptr Buffer); Modified: lldb/trunk/source/API/SBSection.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSection.cpp?rev=346707&r1=346706&r2=346707&view=diff == --- lldb/trunk/source/API/SBSection.cpp (original) +++ lldb/trunk/source/API/SBSection.cpp Mon Nov 12 13:24:50 2018 @@ -14,7 +14,6 @@ #include "lldb/Core/Section.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Utility/DataBuffer.h" -#include "lldb/Utility/DataBufferLLVM.h" #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/StreamString.h" @@ -166,7 +165,7 @@ SBData SBSection::GetSectionData(uint64_ else file_size = 0; } - auto data_buffer_sp = DataBufferLLVM::CreateSliceFromPath( + auto data_buffer_sp = FileSy
[Lldb-commits] [lldb] r346780 - Add GDB remote packet reproducer.
Author: jdevlieghere Date: Tue Nov 13 11:18:16 2018 New Revision: 346780 URL: http://llvm.org/viewvc/llvm-project?rev=346780&view=rev Log: Add GDB remote packet reproducer. Added: lldb/trunk/include/lldb/Utility/Reproducer.h lldb/trunk/packages/Python/lldbsuite/test/functionalities/reproducer/ lldb/trunk/packages/Python/lldbsuite/test/functionalities/reproducer/gdb-remote/ lldb/trunk/packages/Python/lldbsuite/test/functionalities/reproducer/gdb-remote/Makefile lldb/trunk/packages/Python/lldbsuite/test/functionalities/reproducer/gdb-remote/TestGdbRemoteReproducer.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/reproducer/gdb-remote/main.c lldb/trunk/source/Commands/CommandObjectReproducer.cpp lldb/trunk/source/Commands/CommandObjectReproducer.h lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.h lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.h lldb/trunk/source/Utility/Reproducer.cpp Modified: lldb/trunk/include/lldb/API/SBDebugger.h lldb/trunk/include/lldb/Core/Debugger.h lldb/trunk/include/lldb/Host/HostInfoBase.h lldb/trunk/scripts/interface/SBDebugger.i lldb/trunk/source/API/SBDebugger.cpp lldb/trunk/source/Commands/CMakeLists.txt lldb/trunk/source/Core/Debugger.cpp lldb/trunk/source/Host/common/HostInfoBase.cpp lldb/trunk/source/Interpreter/CommandInterpreter.cpp lldb/trunk/source/Plugins/Process/gdb-remote/CMakeLists.txt lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h lldb/trunk/source/Utility/CMakeLists.txt lldb/trunk/tools/driver/Driver.cpp lldb/trunk/unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationTest.cpp lldb/trunk/unittests/Process/gdb-remote/GDBRemoteTestUtils.cpp lldb/trunk/unittests/Process/gdb-remote/GDBRemoteTestUtils.h Modified: lldb/trunk/include/lldb/API/SBDebugger.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBDebugger.h?rev=346780&r1=346779&r2=346780&view=diff == --- lldb/trunk/include/lldb/API/SBDebugger.h (original) +++ lldb/trunk/include/lldb/API/SBDebugger.h Tue Nov 13 11:18:16 2018 @@ -109,7 +109,7 @@ public: const char *archname); lldb::SBTarget CreateTarget(const char *filename); - + lldb::SBTarget GetDummyTarget(); // Return true if target is deleted from the target list of the debugger. @@ -226,6 +226,10 @@ public: void SetPrompt(const char *prompt); + const char *GetReproducerPath() const; + + void SetReproducerPath(const char *reproducer); + lldb::ScriptLanguage GetScriptLanguage() const; void SetScriptLanguage(lldb::ScriptLanguage script_lang); Modified: lldb/trunk/include/lldb/Core/Debugger.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Debugger.h?rev=346780&r1=346779&r2=346780&view=diff == --- lldb/trunk/include/lldb/Core/Debugger.h (original) +++ lldb/trunk/include/lldb/Core/Debugger.h Tue Nov 13 11:18:16 2018 @@ -261,6 +261,11 @@ public: void SetPrompt(llvm::StringRef p); void SetPrompt(const char *) = delete; + llvm::StringRef GetReproducerPath() const; + + void SetReproducerPath(llvm::StringRef p); + void SetReproducerPath(const char *) = delete; + bool GetUseExternalEditor() const; bool SetUseExternalEditor(bool use_external_editor_p); Modified: lldb/trunk/include/lldb/Host/HostInfoBase.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/HostInfoBase.h?rev=346780&r1=346779&r2=346780&view=diff == --- lldb/trunk/include/lldb/Host/HostInfoBase.h (original) +++ lldb/trunk/include/lldb/Host/HostInfoBase.h Tue Nov 13 11:18:16 2018 @@ -93,6 +93,12 @@ public: /// FileSpec is filled in. static FileSpec GetGlobalTempDir(); + /// Returns the reproducer temporary directory. This directory will **not** + /// be automatically cleaned up when this process exits, but might be removed + /// by the reproducer generator. Only the directory member of the FileSpec is + /// filled in. + static FileSpec GetReproducerTempDir(); + //--- /// If the triple does not specify
[Lldb-commits] [lldb] r346919 - [reproducer] Post-commit cleanup
Author: jdevlieghere Date: Wed Nov 14 17:05:40 2018 New Revision: 346919 URL: http://llvm.org/viewvc/llvm-project?rev=346919&view=rev Log: [reproducer] Post-commit cleanup After committing the initial reproducer feature I noticed a few small issues which warranted addressing here. It fixes incorrect documentation in the command object and extract some duplicated code into the debugger object. Modified: lldb/trunk/include/lldb/Core/Debugger.h lldb/trunk/source/Commands/CommandObjectReproducer.cpp lldb/trunk/source/Core/Debugger.cpp Modified: lldb/trunk/include/lldb/Core/Debugger.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Debugger.h?rev=346919&r1=346918&r2=346919&view=diff == --- lldb/trunk/include/lldb/Core/Debugger.h (original) +++ lldb/trunk/include/lldb/Core/Debugger.h Wed Nov 14 17:05:40 2018 @@ -266,6 +266,8 @@ public: void SetReproducerPath(llvm::StringRef p); void SetReproducerPath(const char *) = delete; + llvm::Error SetReproducerCapture(bool b); + bool GetUseExternalEditor() const; bool SetUseExternalEditor(bool use_external_editor_p); Modified: lldb/trunk/source/Commands/CommandObjectReproducer.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectReproducer.cpp?rev=346919&r1=346918&r2=346919&view=diff == --- lldb/trunk/source/Commands/CommandObjectReproducer.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectReproducer.cpp Wed Nov 14 17:05:40 2018 @@ -11,6 +11,7 @@ #include "lldb/Utility/Reproducer.h" +#include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/OptionArgParser.h" #include "lldb/Interpreter/OptionGroupBoolean.h" @@ -40,8 +41,7 @@ protected: return false; } -auto &r = repro::Reproducer::Instance(); -if (auto e = r.SetGenerateReproducer(true)) { +if (auto e = m_interpreter.GetDebugger().SetReproducerCapture(true)) { AppendErrorToResult(std::move(e), result); return false; } @@ -68,8 +68,7 @@ protected: return false; } -auto &r = repro::Reproducer::Instance(); -if (auto e = r.SetGenerateReproducer(false)) { +if (auto e = m_interpreter.GetDebugger().SetReproducerCapture(false)) { AppendErrorToResult(std::move(e), result); return false; } @@ -114,10 +113,8 @@ protected: class CommandObjectReproducerReplay : public CommandObjectParsed { public: CommandObjectReproducerReplay(CommandInterpreter &interpreter) - : CommandObjectParsed(interpreter, "reproducer capture", -"Enable or disable gathering of information needed " -"to generate a reproducer.", -nullptr) { + : CommandObjectParsed(interpreter, "reproducer replay", +"Replay a reproducer.", nullptr) { CommandArgumentEntry arg1; CommandArgumentData path_arg; Modified: lldb/trunk/source/Core/Debugger.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=346919&r1=346918&r2=346919&view=diff == --- lldb/trunk/source/Core/Debugger.cpp (original) +++ lldb/trunk/source/Core/Debugger.cpp Wed Nov 14 17:05:40 2018 @@ -424,6 +424,13 @@ void Debugger::SetReproducerPath(llvm::S llvm::consumeError(std::move(e)); } +llvm::Error Debugger::SetReproducerCapture(bool b) { + auto &r = repro::Reproducer::Instance(); + if (auto e = r.SetGenerateReproducer(false)) +return e; + return llvm::Error::success(); +} + const FormatEntity::Entry *Debugger::GetThreadFormat() const { const uint32_t idx = ePropertyThreadFormat; return m_collection_sp->GetPropertyAtIndexAsFormatEntity(nullptr, idx); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r346921 - Fix copy/paste mistake for r346919.
Author: jdevlieghere Date: Wed Nov 14 17:18:16 2018 New Revision: 346921 URL: http://llvm.org/viewvc/llvm-project?rev=346921&view=rev Log: Fix copy/paste mistake for r346919. Modified: lldb/trunk/source/Core/Debugger.cpp Modified: lldb/trunk/source/Core/Debugger.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=346921&r1=346920&r2=346921&view=diff == --- lldb/trunk/source/Core/Debugger.cpp (original) +++ lldb/trunk/source/Core/Debugger.cpp Wed Nov 14 17:18:16 2018 @@ -426,7 +426,7 @@ void Debugger::SetReproducerPath(llvm::S llvm::Error Debugger::SetReproducerCapture(bool b) { auto &r = repro::Reproducer::Instance(); - if (auto e = r.SetGenerateReproducer(false)) + if (auto e = r.SetGenerateReproducer(b)) return e; return llvm::Error::success(); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r346920 - Add setting to require hardware breakpoints.
Author: jdevlieghere Date: Wed Nov 14 17:18:15 2018 New Revision: 346920 URL: http://llvm.org/viewvc/llvm-project?rev=346920&view=rev Log: Add setting to require hardware breakpoints. When debugging read-only memory we cannot use software breakpoint. We already have support for hardware breakpoints and users can specify them with `-H`. However, there's no option to force LLDB to use hardware breakpoints internally, for example while stepping. This patch adds a setting target.require-hardware-breakpoint that forces LLDB to always use hardware breakpoints. Because hardware breakpoints are a limited resource and can fail to resolve, this patch also extends error handling in thread plans, where breakpoints are used for stepping. Differential revision: https://reviews.llvm.org/D54221 Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/Makefile lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/TestRequireHWBreakpoints.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/main.c Modified: lldb/trunk/include/lldb/API/SBBreakpoint.h lldb/trunk/include/lldb/API/SBThreadPlan.h lldb/trunk/include/lldb/Breakpoint/Breakpoint.h lldb/trunk/include/lldb/Target/Target.h lldb/trunk/include/lldb/Target/Thread.h lldb/trunk/include/lldb/Target/ThreadPlan.h lldb/trunk/include/lldb/Target/ThreadPlanPython.h lldb/trunk/include/lldb/Target/ThreadPlanShouldStopHere.h lldb/trunk/include/lldb/Target/ThreadPlanStepInRange.h lldb/trunk/include/lldb/Target/ThreadPlanStepInstruction.h lldb/trunk/include/lldb/Target/ThreadPlanStepOut.h lldb/trunk/include/lldb/Target/ThreadPlanStepThrough.h lldb/trunk/include/lldb/Target/ThreadPlanStepUntil.h lldb/trunk/include/lldb/lldb-private-interfaces.h lldb/trunk/packages/Python/lldbsuite/test/functionalities/step_scripted/TestStepScripted.py lldb/trunk/scripts/interface/SBBreakpoint.i lldb/trunk/source/API/SBBreakpoint.cpp lldb/trunk/source/API/SBThread.cpp lldb/trunk/source/API/SBThreadPlan.cpp lldb/trunk/source/Breakpoint/Breakpoint.cpp lldb/trunk/source/Commands/CommandObjectThread.cpp lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp lldb/trunk/source/Target/Process.cpp lldb/trunk/source/Target/StopInfo.cpp lldb/trunk/source/Target/Target.cpp lldb/trunk/source/Target/Thread.cpp lldb/trunk/source/Target/ThreadPlan.cpp lldb/trunk/source/Target/ThreadPlanCallOnFunctionExit.cpp lldb/trunk/source/Target/ThreadPlanPython.cpp lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp lldb/trunk/source/Target/ThreadPlanShouldStopHere.cpp lldb/trunk/source/Target/ThreadPlanStepInRange.cpp lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp lldb/trunk/source/Target/ThreadPlanStepOut.cpp lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp lldb/trunk/source/Target/ThreadPlanStepRange.cpp lldb/trunk/source/Target/ThreadPlanStepThrough.cpp lldb/trunk/source/Target/ThreadPlanStepUntil.cpp Modified: lldb/trunk/include/lldb/API/SBBreakpoint.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBBreakpoint.h?rev=346920&r1=346919&r2=346920&view=diff == --- lldb/trunk/include/lldb/API/SBBreakpoint.h (original) +++ lldb/trunk/include/lldb/API/SBBreakpoint.h Wed Nov 14 17:18:15 2018 @@ -129,6 +129,8 @@ public: static uint32_t GetNumBreakpointLocationsFromEvent(const lldb::SBEvent &event_sp); + bool IsHardware() const; + // Can only be called from a ScriptedBreakpointResolver... SBError AddLocation(SBAddress &address); Modified: lldb/trunk/include/lldb/API/SBThreadPlan.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBThreadPlan.h?rev=346920&r1=346919&r2=346920&view=diff == --- lldb/trunk/include/lldb/API/SBThreadPlan.h (original) +++ lldb/trunk/include/lldb/API/SBThreadPlan.h Wed Nov 14 17:18:15 2018 @@ -79,16 +79,28 @@ public: // plans... SBThreadPlan QueueThreadPlanForStepOverRange(SBAddress &start_address, lldb::addr_t range_size); + SBThreadPlan QueueThreadPlanForStepOverRange(SBAddress &start_address, + lldb::addr_t range_size, + SBError &error); SBThreadPlan QueueThreadPlanForStepInRange(SBAddress &start_address, lldb::addr_t range_size); + SBThreadPlan QueueThreadPlanForStepInRange(SBAddress &start_address, + lld
[Lldb-commits] [lldb] r347283 - Skip TestTargetCreateDeps
Author: jdevlieghere Date: Mon Nov 19 17:18:49 2018 New Revision: 347283 URL: http://llvm.org/viewvc/llvm-project?rev=347283&view=rev Log: Skip TestTargetCreateDeps Skip this test because Windows deals differently with shared libraries. Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_create_deps/TestTargetCreateDeps.py Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_create_deps/TestTargetCreateDeps.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_create_deps/TestTargetCreateDeps.py?rev=347283&r1=347282&r2=347283&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_create_deps/TestTargetCreateDeps.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_create_deps/TestTargetCreateDeps.py Mon Nov 19 17:18:49 2018 @@ -10,7 +10,7 @@ from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil - +@skipIfWindows # Windows deals differently with shared libs. class TargetDependentsTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r347615 - [FileSystem] Ignore nanoseconds when comparing oso_mod_time
Author: jdevlieghere Date: Mon Nov 26 15:40:52 2018 New Revision: 347615 URL: http://llvm.org/viewvc/llvm-project?rev=347615&view=rev Log: [FileSystem] Ignore nanoseconds when comparing oso_mod_time After a recent change in LLVM the TimePoint encoding become more precise, exceeding the precision of the TimePoint obtained from the DebugMap. This patch adds a flag to the GetModificationTime helper in the FileSystem to return the modification time with less precision. Thanks to Davide for bisecting this failure on the LLDB bots. Modified: lldb/trunk/include/lldb/Host/FileSystem.h lldb/trunk/source/Host/common/FileSystem.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Modified: lldb/trunk/include/lldb/Host/FileSystem.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=347615&r1=347614&r2=347615&view=diff == --- lldb/trunk/include/lldb/Host/FileSystem.h (original) +++ lldb/trunk/include/lldb/Host/FileSystem.h Mon Nov 26 15:40:52 2018 @@ -56,8 +56,12 @@ public: /// Returns the modification time of the given file. /// @{ - llvm::sys::TimePoint<> GetModificationTime(const FileSpec &file_spec) const; - llvm::sys::TimePoint<> GetModificationTime(const llvm::Twine &path) const; + llvm::sys::TimePoint<> + GetModificationTime(const FileSpec &file_spec, + bool nanosecond_precision = true) const; + llvm::sys::TimePoint<> + GetModificationTime(const llvm::Twine &path, + bool nanosecond_precision = true) const; /// @} /// Returns the on-disk size of the given file in bytes. Modified: lldb/trunk/source/Host/common/FileSystem.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSystem.cpp?rev=347615&r1=347614&r2=347615&view=diff == --- lldb/trunk/source/Host/common/FileSystem.cpp (original) +++ lldb/trunk/source/Host/common/FileSystem.cpp Mon Nov 26 15:40:52 2018 @@ -64,15 +64,22 @@ Optional &FileSystem::Instan } sys::TimePoint<> -FileSystem::GetModificationTime(const FileSpec &file_spec) const { - return GetModificationTime(file_spec.GetPath()); +FileSystem::GetModificationTime(const FileSpec &file_spec, +bool nanosecond_precision) const { + return GetModificationTime(file_spec.GetPath(), nanosecond_precision); } -sys::TimePoint<> FileSystem::GetModificationTime(const Twine &path) const { +sys::TimePoint<> +FileSystem::GetModificationTime(const Twine &path, +bool nanosecond_precision) const { ErrorOr status = m_fs->status(path); if (!status) return sys::TimePoint<>(); - return status->getLastModificationTime(); + if (nanosecond_precision) +return status->getLastModificationTime(); + else +return std::chrono::time_point_cast( +status->getLastModificationTime()); } uint64_t FileSystem::GetByteSize(const FileSpec &file_spec) const { Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp?rev=347615&r1=347614&r2=347615&view=diff == --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Mon Nov 26 15:40:52 2018 @@ -420,7 +420,8 @@ Module *SymbolFileDWARFDebugMap::GetModu FileSpec oso_file(oso_path); ConstString oso_object; if (FileSystem::Instance().Exists(oso_file)) { -auto oso_mod_time = FileSystem::Instance().GetModificationTime(oso_file); +auto oso_mod_time = FileSystem::Instance().GetModificationTime( +oso_file, /*nanosecond_precision=*/false); if (oso_mod_time != comp_unit_info->oso_mod_time) { obj_file->GetModule()->ReportError( "debug map object file '%s' has changed (actual time is " ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r347660 - Move time cast to SymbolFileDWARFDebugMap
Author: jdevlieghere Date: Tue Nov 27 07:25:58 2018 New Revision: 347660 URL: http://llvm.org/viewvc/llvm-project?rev=347660&view=rev Log: Move time cast to SymbolFileDWARFDebugMap When trying to fix the bots we expected that the cast would be needed in different places. Ultimately it turned out only the SymbolFileDWARFDebugMap was affected so, as Pavel correctly notes, it makes more sense to do the cast just there instead of in teh FS. Modified: lldb/trunk/include/lldb/Host/FileSystem.h lldb/trunk/source/Host/common/FileSystem.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Modified: lldb/trunk/include/lldb/Host/FileSystem.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=347660&r1=347659&r2=347660&view=diff == --- lldb/trunk/include/lldb/Host/FileSystem.h (original) +++ lldb/trunk/include/lldb/Host/FileSystem.h Tue Nov 27 07:25:58 2018 @@ -56,12 +56,8 @@ public: /// Returns the modification time of the given file. /// @{ - llvm::sys::TimePoint<> - GetModificationTime(const FileSpec &file_spec, - bool nanosecond_precision = true) const; - llvm::sys::TimePoint<> - GetModificationTime(const llvm::Twine &path, - bool nanosecond_precision = true) const; + llvm::sys::TimePoint<> GetModificationTime(const FileSpec &file_spec) const; + llvm::sys::TimePoint<> GetModificationTime(const llvm::Twine &path) const; /// @} /// Returns the on-disk size of the given file in bytes. Modified: lldb/trunk/source/Host/common/FileSystem.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSystem.cpp?rev=347660&r1=347659&r2=347660&view=diff == --- lldb/trunk/source/Host/common/FileSystem.cpp (original) +++ lldb/trunk/source/Host/common/FileSystem.cpp Tue Nov 27 07:25:58 2018 @@ -64,22 +64,15 @@ Optional &FileSystem::Instan } sys::TimePoint<> -FileSystem::GetModificationTime(const FileSpec &file_spec, -bool nanosecond_precision) const { - return GetModificationTime(file_spec.GetPath(), nanosecond_precision); +FileSystem::GetModificationTime(const FileSpec &file_spec) const { + return GetModificationTime(file_spec.GetPath()); } -sys::TimePoint<> -FileSystem::GetModificationTime(const Twine &path, -bool nanosecond_precision) const { +sys::TimePoint<> FileSystem::GetModificationTime(const Twine &path) const { ErrorOr status = m_fs->status(path); if (!status) return sys::TimePoint<>(); - if (nanosecond_precision) -return status->getLastModificationTime(); - else -return std::chrono::time_point_cast( -status->getLastModificationTime()); + return status->getLastModificationTime(); } uint64_t FileSystem::GetByteSize(const FileSpec &file_spec) const { Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp?rev=347660&r1=347659&r2=347660&view=diff == --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Tue Nov 27 07:25:58 2018 @@ -86,8 +86,7 @@ SymbolFileDWARFDebugMap::CompileUnitInfo const uint32_t oso_end_idx = comp_unit_info->last_symbol_index + 1; for (uint32_t idx = comp_unit_info->first_symbol_index + 2; // Skip the N_SO and N_OSO - idx < oso_end_idx; - ++idx) { + idx < oso_end_idx; ++idx) { Symbol *exe_symbol = exe_symtab->SymbolAtIndex(idx); if (exe_symbol) { if (exe_symbol->IsDebug() == false) @@ -420,8 +419,10 @@ Module *SymbolFileDWARFDebugMap::GetModu FileSpec oso_file(oso_path); ConstString oso_object; if (FileSystem::Instance().Exists(oso_file)) { -auto oso_mod_time = FileSystem::Instance().GetModificationTime( -oso_file, /*nanosecond_precision=*/false); +// The modification time returned by the FS can have a higher precision +// than the one from the CU. +auto oso_mod_time = std::chrono::time_point_cast( +FileSystem::Instance().GetModificationTime(oso_file)); if (oso_mod_time != comp_unit_info->oso_mod_time) { obj_file->GetModule()->ReportError( "debug map object file '%s' has changed (actual time is " @@ -802,8 +803,7 @@ uint32_t SymbolFileDWARFDebugMap::Privat const ConstString &name, const CompilerDeclContext *parent_decl_ctx, const std::vector &indexes, // Indexes into the symbol table that match "name" -uint32_t max_matches, -VariableList
Re: [Lldb-commits] [lldb] r347615 - [FileSystem] Ignore nanoseconds when comparing oso_mod_time
You're right, fixed in r347660. On Tue, Nov 27, 2018 at 6:24 AM Pavel Labath wrote: > Was it necessary to modify FileSystem to achieve this. It looks like you > could have just as easily made the time_point_cast in > SymbolFileDWARFDebugMap (next to a comment explaining why that was needed). > > The extra nanosecond_precision argument looks fairly odd, and diverges > from how the llvm interfaces for modification times operate. > > On 27/11/2018 00:40, Jonas Devlieghere via lldb-commits wrote: > > Author: jdevlieghere > > Date: Mon Nov 26 15:40:52 2018 > > New Revision: 347615 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=347615&view=rev > > Log: > > [FileSystem] Ignore nanoseconds when comparing oso_mod_time > > > > After a recent change in LLVM the TimePoint encoding become more > > precise, exceeding the precision of the TimePoint obtained from the > > DebugMap. This patch adds a flag to the GetModificationTime helper in > > the FileSystem to return the modification time with less precision. > > > > Thanks to Davide for bisecting this failure on the LLDB bots. > > > > Modified: > > lldb/trunk/include/lldb/Host/FileSystem.h > > lldb/trunk/source/Host/common/FileSystem.cpp > > > lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp > > > > Modified: lldb/trunk/include/lldb/Host/FileSystem.h > > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=347615&r1=347614&r2=347615&view=diff > > > == > > --- lldb/trunk/include/lldb/Host/FileSystem.h (original) > > +++ lldb/trunk/include/lldb/Host/FileSystem.h Mon Nov 26 15:40:52 2018 > > @@ -56,8 +56,12 @@ public: > > > > /// Returns the modification time of the given file. > > /// @{ > > - llvm::sys::TimePoint<> GetModificationTime(const FileSpec &file_spec) > const; > > - llvm::sys::TimePoint<> GetModificationTime(const llvm::Twine &path) > const; > > + llvm::sys::TimePoint<> > > + GetModificationTime(const FileSpec &file_spec, > > + bool nanosecond_precision = true) const; > > + llvm::sys::TimePoint<> > > + GetModificationTime(const llvm::Twine &path, > > + bool nanosecond_precision = true) const; > > /// @} > > > > /// Returns the on-disk size of the given file in bytes. > > > > Modified: lldb/trunk/source/Host/common/FileSystem.cpp > > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSystem.cpp?rev=347615&r1=347614&r2=347615&view=diff > > > == > > --- lldb/trunk/source/Host/common/FileSystem.cpp (original) > > +++ lldb/trunk/source/Host/common/FileSystem.cpp Mon Nov 26 15:40:52 2018 > > @@ -64,15 +64,22 @@ Optional &FileSystem::Instan > > } > > > > sys::TimePoint<> > > -FileSystem::GetModificationTime(const FileSpec &file_spec) const { > > - return GetModificationTime(file_spec.GetPath()); > > +FileSystem::GetModificationTime(const FileSpec &file_spec, > > +bool nanosecond_precision) const { > > + return GetModificationTime(file_spec.GetPath(), nanosecond_precision); > > } > > > > -sys::TimePoint<> FileSystem::GetModificationTime(const Twine &path) > const { > > +sys::TimePoint<> > > +FileSystem::GetModificationTime(const Twine &path, > > +bool nanosecond_precision) const { > > ErrorOr status = m_fs->status(path); > > if (!status) > > return sys::TimePoint<>(); > > - return status->getLastModificationTime(); > > + if (nanosecond_precision) > > +return status->getLastModificationTime(); > > + else > > +return std::chrono::time_point_cast( > > +status->getLastModificationTime()); > > } > > > > uint64_t FileSystem::GetByteSize(const FileSpec &file_spec) const { > > > > Modified: > lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp > > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp?rev=347615&r1=347614&r2=347615&view=diff > > > == > > --- > lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebu
[Lldb-commits] [lldb] r347709 - [Driver] Use libOption with tablegen.
Author: jdevlieghere Date: Tue Nov 27 13:00:32 2018 New Revision: 347709 URL: http://llvm.org/viewvc/llvm-project?rev=347709&view=rev Log: [Driver] Use libOption with tablegen. This patch modifies the lldb driver to use libOption for option parsing. It allows us to decouple option parsing from option processing which is important when arguments affect initialization. This was previously not possible because the debugger need to be initialized as some option interpretation (like the scripting language etc) was handled by the debugger, rather than in the driver. Differential revision: https://reviews.llvm.org/D54692 Added: lldb/trunk/lit/Driver/ lldb/trunk/lit/Driver/Inputs/ lldb/trunk/lit/Driver/Inputs/Print0.in lldb/trunk/lit/Driver/Inputs/Print2.in lldb/trunk/lit/Driver/Inputs/Print4.in lldb/trunk/lit/Driver/Inputs/Print6.in lldb/trunk/lit/Driver/TestCommands.test lldb/trunk/lit/Driver/TestNoUseColor.test lldb/trunk/tools/driver/Options.td Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/tools/driver/CMakeLists.txt lldb/trunk/tools/driver/Driver.cpp lldb/trunk/tools/driver/Driver.h Added: lldb/trunk/lit/Driver/Inputs/Print0.in URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Driver/Inputs/Print0.in?rev=347709&view=auto == --- lldb/trunk/lit/Driver/Inputs/Print0.in (added) +++ lldb/trunk/lit/Driver/Inputs/Print0.in Tue Nov 27 13:00:32 2018 @@ -0,0 +1 @@ +expr 0 Added: lldb/trunk/lit/Driver/Inputs/Print2.in URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Driver/Inputs/Print2.in?rev=347709&view=auto == --- lldb/trunk/lit/Driver/Inputs/Print2.in (added) +++ lldb/trunk/lit/Driver/Inputs/Print2.in Tue Nov 27 13:00:32 2018 @@ -0,0 +1 @@ +expr 2 Added: lldb/trunk/lit/Driver/Inputs/Print4.in URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Driver/Inputs/Print4.in?rev=347709&view=auto == --- lldb/trunk/lit/Driver/Inputs/Print4.in (added) +++ lldb/trunk/lit/Driver/Inputs/Print4.in Tue Nov 27 13:00:32 2018 @@ -0,0 +1 @@ +expr 4 Added: lldb/trunk/lit/Driver/Inputs/Print6.in URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Driver/Inputs/Print6.in?rev=347709&view=auto == --- lldb/trunk/lit/Driver/Inputs/Print6.in (added) +++ lldb/trunk/lit/Driver/Inputs/Print6.in Tue Nov 27 13:00:32 2018 @@ -0,0 +1 @@ +expr 6 Added: lldb/trunk/lit/Driver/TestCommands.test URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Driver/TestCommands.test?rev=347709&view=auto == --- lldb/trunk/lit/Driver/TestCommands.test (added) +++ lldb/trunk/lit/Driver/TestCommands.test Tue Nov 27 13:00:32 2018 @@ -0,0 +1,41 @@ +# RUN: %lldb -x -b \ +# RUN: -S %S/Inputs/Print0.in \ +# RUN: -O 'expr 1' \ +# RUN: -S %S/Inputs/Print2.in \ +# RUN: -O 'expr 3' \ +# RUN: -s %S/Inputs/Print4.in \ +# RUN: -o 'expr 5' \ +# RUN: -s %S/Inputs/Print6.in \ +# RUN: -o 'expr 7' \ +# RUN: | FileCheck %s +# +# RUN: %lldb -x -b \ +# RUN: -s %S/Inputs/Print4.in \ +# RUN: -o 'expr 5' \ +# RUN: -s %S/Inputs/Print6.in \ +# RUN: -o 'expr 7' \ +# RUN: -S %S/Inputs/Print0.in \ +# RUN: -O 'expr 1' \ +# RUN: -S %S/Inputs/Print2.in \ +# RUN: -O 'expr 3' \ +# RUN: | FileCheck %s +# +# RUN: %lldb -x -b \ +# RUN: -s %S/Inputs/Print4.in \ +# RUN: -S %S/Inputs/Print0.in \ +# RUN: -o 'expr 5' \ +# RUN: -O 'expr 1' \ +# RUN: -s %S/Inputs/Print6.in \ +# RUN: -S %S/Inputs/Print2.in \ +# RUN: -o 'expr 7' \ +# RUN: -O 'expr 3' \ +# RUN: | FileCheck %s + +# CHECK: (int) $0 = 0 +# CHECK: (int) $1 = 1 +# CHECK: (int) $2 = 2 +# CHECK: (int) $3 = 3 +# CHECK: (int) $4 = 4 +# CHECK: (int) $5 = 5 +# CHECK: (int) $6 = 6 +# CHECK: (int) $7 = 7 Added: lldb/trunk/lit/Driver/TestNoUseColor.test URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Driver/TestNoUseColor.test?rev=347709&view=auto == --- lldb/trunk/lit/Driver/TestNoUseColor.test (added) +++ lldb/trunk/lit/Driver/TestNoUseColor.test Tue Nov 27 13:00:32 2018 @@ -0,0 +1,4 @@ +# RUN: %lldb --no-use-color -s %s | FileCheck %s +settings show use-color +# CHECK: use-color (boolean) = false +q Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=347709&r1=347708&r2=347709&view=diff == --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Tue Nov 27 13:00:32 2018 @@ -2373,6 +2373,8 @@ 260A248D15D06C4F009981B0 /* OptionValues.h */ = {isa = PBXF
[Lldb-commits] [lldb] r347712 - [unittest] Fix the FileSystem test on Windows.
Author: jdevlieghere Date: Tue Nov 27 13:20:35 2018 New Revision: 347712 URL: http://llvm.org/viewvc/llvm-project?rev=347712&view=rev Log: [unittest] Fix the FileSystem test on Windows. On Windows, when using the VFS without going through FileSpec, the absolute path to `/foo` is `\\foo`. This updates the unittest to expect that. Modified: lldb/trunk/unittests/Host/FileSystemTest.cpp Modified: lldb/trunk/unittests/Host/FileSystemTest.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/FileSystemTest.cpp?rev=347712&r1=347711&r2=347712&view=diff == --- lldb/trunk/unittests/Host/FileSystemTest.cpp (original) +++ lldb/trunk/unittests/Host/FileSystemTest.cpp Tue Nov 27 13:20:35 2018 @@ -225,7 +225,11 @@ TEST(FileSystemTest, MakeAbsolute) { SmallString<16> foo(foo_relative); auto EC = fs.MakeAbsolute(foo); EXPECT_FALSE(EC); +#ifdef _WIN32 +EXPECT_TRUE(foo.equals("foo")); +#else EXPECT_TRUE(foo.equals("/foo")); +#endif } { @@ -243,7 +247,11 @@ TEST(FileSystemTest, Resolve) { StringRef foo_relative = "foo"; SmallString<16> foo(foo_relative); fs.Resolve(foo); +#ifdef _WIN32 +EXPECT_TRUE(foo.equals("foo")); +#else EXPECT_TRUE(foo.equals("/foo")); +#endif } { ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r347716 - [Reproducers] Improve reproducer API and add unit tests.
Author: jdevlieghere Date: Tue Nov 27 14:11:02 2018 New Revision: 347716 URL: http://llvm.org/viewvc/llvm-project?rev=347716&view=rev Log: [Reproducers] Improve reproducer API and add unit tests. When I landed the initial reproducer framework I knew there were some things that needed improvement. Rather than bundling it with a patch that adds more functionality I split it off into this patch. I also think the API is stable enough to add unit testing, which is included in this patch as well. Other improvements include: - Refactor how we initialize the loader and generator. - Improve naming consistency: capture and replay seems the least ambiguous. - Index providers by name and make sure there's only one of each. - Add convenience methods for creating and accessing providers. Differential revision: https://reviews.llvm.org/D54616 Added: lldb/trunk/unittests/Utility/ReproducerTest.cpp Modified: lldb/trunk/include/lldb/API/SBDebugger.h lldb/trunk/include/lldb/Core/Debugger.h lldb/trunk/include/lldb/Utility/Reproducer.h lldb/trunk/scripts/interface/SBDebugger.i lldb/trunk/source/API/SBDebugger.cpp lldb/trunk/source/Commands/CommandObjectReproducer.cpp lldb/trunk/source/Core/Debugger.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Utility/Reproducer.cpp lldb/trunk/tools/driver/Driver.cpp lldb/trunk/unittests/Utility/CMakeLists.txt Modified: lldb/trunk/include/lldb/API/SBDebugger.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBDebugger.h?rev=347716&r1=347715&r2=347716&view=diff == --- lldb/trunk/include/lldb/API/SBDebugger.h (original) +++ lldb/trunk/include/lldb/API/SBDebugger.h Tue Nov 27 14:11:02 2018 @@ -228,7 +228,7 @@ public: const char *GetReproducerPath() const; - void SetReproducerPath(const char *reproducer); + lldb::SBError ReplayReproducer(const char *path); lldb::ScriptLanguage GetScriptLanguage() const; Modified: lldb/trunk/include/lldb/Core/Debugger.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Debugger.h?rev=347716&r1=347715&r2=347716&view=diff == --- lldb/trunk/include/lldb/Core/Debugger.h (original) +++ lldb/trunk/include/lldb/Core/Debugger.h Tue Nov 27 14:11:02 2018 @@ -263,8 +263,8 @@ public: llvm::StringRef GetReproducerPath() const; - void SetReproducerPath(llvm::StringRef p); - void SetReproducerPath(const char *) = delete; + llvm::Error SetReproducerReplay(llvm::StringRef p); + llvm::Error SetReproducerReplay(const char *) = delete; llvm::Error SetReproducerCapture(bool b); Modified: lldb/trunk/include/lldb/Utility/Reproducer.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Reproducer.h?rev=347716&r1=347715&r2=347716&view=diff == --- lldb/trunk/include/lldb/Utility/Reproducer.h (original) +++ lldb/trunk/include/lldb/Utility/Reproducer.h Tue Nov 27 14:11:02 2018 @@ -12,7 +12,7 @@ #include "lldb/Utility/FileSpec.h" -#include "llvm/ADT/StringMap.h" +#include "llvm/ADT/DenseMap.h" #include "llvm/Support/Error.h" #include "llvm/Support/YAMLTraits.h" @@ -38,12 +38,12 @@ struct ProviderInfo { /// i.e. in the constructor. /// /// Different components will implement different providers. -class Provider { +class ProviderBase { public: - virtual ~Provider() = default; + virtual ~ProviderBase() = default; - const ProviderInfo &GetInfo() { return m_info; } - const FileSpec &GetDirectory() { return m_directory; } + const ProviderInfo &GetInfo() const { return m_info; } + const FileSpec &GetRoot() const { return m_root; } /// The Keep method is called when it is decided that we need to keep the /// data in order to provide a reproducer. @@ -53,15 +53,33 @@ public: /// keep any information and will not generate a reproducer. virtual void Discard(){}; + // Returns the class ID for this type. + static const void *ClassID() { return &ID; } + + // Returns the class ID for the dynamic type of this Provider instance. + virtual const void *DynamicClassID() const = 0; + protected: - Provider(const FileSpec &directory) : m_directory(directory) {} + ProviderBase(const FileSpec &root) : m_root(root) {} /// Every provider keeps track of its own files. ProviderInfo m_info; - private: /// Every provider knows where to dump its potential files. - FileSpec m_directory; + FileSpec m_root; + + virtual void anchor(); + static char ID; +}; + +template class Provider : public ProviderBase { +public: + static const void *ClassID() { return &ThisProviderT::ID; } + + const void *DynamicClassID() const override { return &ThisProviderT::ID; } + +protected: + using ProviderBase::ProviderBase; // Inherit constructor. }; /// The gen
[Lldb-commits] [lldb] r347725 - [unittest] Fix the FileSystem test on Windows. (Attempt #2)
Author: jdevlieghere Date: Tue Nov 27 17:18:10 2018 New Revision: 347725 URL: http://llvm.org/viewvc/llvm-project?rev=347725&view=rev Log: [unittest] Fix the FileSystem test on Windows. (Attempt #2) This fixes the double escaping and compares FileSpecs instead of strings. Modified: lldb/trunk/unittests/Host/FileSystemTest.cpp Modified: lldb/trunk/unittests/Host/FileSystemTest.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/FileSystemTest.cpp?rev=347725&r1=347724&r2=347725&view=diff == --- lldb/trunk/unittests/Host/FileSystemTest.cpp (original) +++ lldb/trunk/unittests/Host/FileSystemTest.cpp Tue Nov 27 17:18:10 2018 @@ -226,7 +226,7 @@ TEST(FileSystemTest, MakeAbsolute) { auto EC = fs.MakeAbsolute(foo); EXPECT_FALSE(EC); #ifdef _WIN32 -EXPECT_TRUE(foo.equals("foo")); +EXPECT_TRUE(foo.equals("\\foo")); #else EXPECT_TRUE(foo.equals("/foo")); #endif @@ -236,7 +236,7 @@ TEST(FileSystemTest, MakeAbsolute) { FileSpec file_spec("foo"); auto EC = fs.MakeAbsolute(file_spec); EXPECT_FALSE(EC); -EXPECT_EQ("/foo", file_spec.GetPath()); +EXPECT_EQ(FileSpec("/foo"), file_spec); } } @@ -248,7 +248,7 @@ TEST(FileSystemTest, Resolve) { SmallString<16> foo(foo_relative); fs.Resolve(foo); #ifdef _WIN32 -EXPECT_TRUE(foo.equals("foo")); +EXPECT_TRUE(foo.equals("\\foo")); #else EXPECT_TRUE(foo.equals("/foo")); #endif @@ -257,7 +257,7 @@ TEST(FileSystemTest, Resolve) { { FileSpec file_spec("foo"); fs.Resolve(file_spec); -EXPECT_EQ("/foo", file_spec.GetPath()); +EXPECT_EQ(FileSpec("/foo"), file_spec); } { @@ -270,7 +270,7 @@ TEST(FileSystemTest, Resolve) { { FileSpec file_spec("bogus"); fs.Resolve(file_spec); -EXPECT_EQ("bogus", file_spec.GetPath()); +EXPECT_EQ(FileSpec("bogus"), file_spec); } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r347814 - Make standalone build find tabelgen
Author: jdevlieghere Date: Wed Nov 28 14:10:01 2018 New Revision: 347814 URL: http://llvm.org/viewvc/llvm-project?rev=347814&view=rev Log: Make standalone build find tabelgen The standalone build couldn't find tablegen because we didn't include it. This patch rectifies that. Modified: lldb/trunk/cmake/modules/LLDBStandalone.cmake Modified: lldb/trunk/cmake/modules/LLDBStandalone.cmake URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBStandalone.cmake?rev=347814&r1=347813&r2=347814&view=diff == --- lldb/trunk/cmake/modules/LLDBStandalone.cmake (original) +++ lldb/trunk/cmake/modules/LLDBStandalone.cmake Wed Nov 28 14:10:01 2018 @@ -83,6 +83,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR endif() include(AddLLVM) + include(TableGen) include(HandleLLVMOptions) include(CheckAtomic) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r347817 - [driver] Some NFC cleanup
Author: jdevlieghere Date: Wed Nov 28 14:39:17 2018 New Revision: 347817 URL: http://llvm.org/viewvc/llvm-project?rev=347817&view=rev Log: [driver] Some NFC cleanup This patch includes some small things I noticed while refactoring the driver but didn't want to include in that patch. Modified: lldb/trunk/tools/driver/Driver.cpp lldb/trunk/tools/driver/Driver.h Modified: lldb/trunk/tools/driver/Driver.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=347817&r1=347816&r2=347817&view=diff == --- lldb/trunk/tools/driver/Driver.cpp (original) +++ lldb/trunk/tools/driver/Driver.cpp Wed Nov 28 14:39:17 2018 @@ -26,9 +26,11 @@ #include "llvm/ADT/StringRef.h" #include "llvm/Support/ConvertUTF.h" +#include "llvm/Support/Format.h" #include "llvm/Support/Path.h" #include "llvm/Support/PrettyStackTrace.h" #include "llvm/Support/Signals.h" +#include "llvm/Support/WithColor.h" #include "llvm/Support/raw_ostream.h" #include @@ -280,8 +282,7 @@ bool Driver::GetDebugMode() const { retu // indicating whether or not to start up the full debugger (i.e. the Command // Interpreter) or not. Return FALSE if the arguments were invalid OR if the // user only wanted help or version information. -SBError Driver::ProcessArgs(const opt::InputArgList &args, FILE *out_fh, -bool &exiting) { +SBError Driver::ProcessArgs(const opt::InputArgList &args, bool &exiting) { SBError error; ResetOptionValues(); @@ -497,15 +498,12 @@ SBError Driver::ProcessArgs(const opt::I for (auto value : arg->getValues()) m_option_data.m_args.push_back(value); } - } else { -if (args.getLastArgNoClaim()) { - ::fprintf(out_fh, -"Warning: program arguments are ignored when attaching.\n"); -} + } else if (args.getLastArgNoClaim()) { +WithColor::warning() << "program arguments are ignored when attaching.\n"; } if (m_option_data.m_print_version) { -::fprintf(out_fh, "%s\n", m_debugger.GetVersionString()); +llvm::outs() << m_debugger.GetVersionString() << '\n'; exiting = true; return error; } @@ -516,11 +514,11 @@ SBError Driver::ProcessArgs(const opt::I char python_path[PATH_MAX]; size_t num_chars = python_file_spec.GetPath(python_path, PATH_MAX); if (num_chars < PATH_MAX) { -::fprintf(out_fh, "%s\n", python_path); +llvm::outs() << python_path << '\n'; } else -::fprintf(out_fh, "\n"); +llvm::outs() << "\n"; } else - ::fprintf(out_fh, "\n"); + llvm::outs() << "\n"; exiting = true; return error; } @@ -544,11 +542,13 @@ static ::FILE *PrepareCommandsForSourcin if (err == 0) { ssize_t nrwr = write(fds[WRITE], commands_data, commands_size); if (nrwr < 0) { - fprintf(stderr, - "error: write(%i, %p, %" PRIu64 ") failed (errno = %i) " - "when trying to open LLDB commands pipe\n", - fds[WRITE], static_cast(commands_data), - static_cast(commands_size), errno); + WithColor::error() + << format( + "write(%i, %p, %" PRIu64 + ") failed (errno = %i) when trying to open LLDB commands pipe", + fds[WRITE], static_cast(commands_data), + static_cast(commands_size), errno) + << '\n'; } else if (static_cast(nrwr) == commands_size) { // Close the write end of the pipe so when we give the read end to // the debugger/command interpreter it will exit when it consumes all @@ -568,15 +568,15 @@ static ::FILE *PrepareCommandsForSourcin // descriptor Hand ownership if the FILE * over to the // debugger for "commands_file". } else { -fprintf(stderr, -"error: fdopen(%i, \"r\") failed (errno = %i) when " -"trying to open LLDB commands pipe\n", -fds[READ], errno); +WithColor::error() << format("fdopen(%i, \"r\") failed (errno = %i) " + "when trying to open LLDB commands pipe", + fds[READ], errno) + << '\n'; } } } else { -fprintf(stderr, -"error: can't create pipe file descriptors for LLDB commands\n"); +WithColor::error() +<< "can't create pipe file descriptors for LLDB commands\n"; } return commands_file; @@ -724,9 +724,9 @@ int Driver::MainLoop() { if (error.Fail()) { const char *error_cstr = error.GetCString(); if (error_cstr && error_cstr[0]) -fprintf(stderr, "error: %s\n", error_cstr); +WithColor::error() << error_cstr << '\n'; else -fprintf(stderr, "error: %u\n", error.GetError()); +WithColor::error() << error.GetError() << '\n'; } } else { // Check if we have
[Lldb-commits] [lldb] r347821 - [driver] Fix --core/-c and add test
Author: jdevlieghere Date: Wed Nov 28 16:22:28 2018 New Revision: 347821 URL: http://llvm.org/viewvc/llvm-project?rev=347821&view=rev Log: [driver] Fix --core/-c and add test Because the optarg variable was shadowed we didn't notice we weren't extracting the value from the option. This patch fixes that and renames the variable to prevent this from happening in the future. I also added two tests to check the error output for --core and --file when the given value doesn't exist. Added: lldb/trunk/lit/Driver/TestCore.test lldb/trunk/lit/Driver/TestFile.test Modified: lldb/trunk/tools/driver/Driver.cpp lldb/trunk/tools/driver/Options.td Added: lldb/trunk/lit/Driver/TestCore.test URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Driver/TestCore.test?rev=347821&view=auto == --- lldb/trunk/lit/Driver/TestCore.test (added) +++ lldb/trunk/lit/Driver/TestCore.test Wed Nov 28 16:22:28 2018 @@ -0,0 +1,2 @@ +# RUN: not %lldb -c /bogus/path 2>&1 | FileCheck %s +# CHECK: error: file specified in --core (-c) option doesn't exist Added: lldb/trunk/lit/Driver/TestFile.test URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Driver/TestFile.test?rev=347821&view=auto == --- lldb/trunk/lit/Driver/TestFile.test (added) +++ lldb/trunk/lit/Driver/TestFile.test Wed Nov 28 16:22:28 2018 @@ -0,0 +1,2 @@ +# RUN: not %lldb -f /bogus/path 2>&1 | FileCheck %s +# CHECK: error: file specified in --file (-f) option doesn't exist Modified: lldb/trunk/tools/driver/Driver.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=347821&r1=347820&r2=347821&view=diff == --- lldb/trunk/tools/driver/Driver.cpp (original) +++ lldb/trunk/tools/driver/Driver.cpp Wed Nov 28 16:22:28 2018 @@ -307,15 +307,16 @@ SBError Driver::ProcessArgs(const opt::I m_option_data.m_batch = true; } - if (args.hasArg(OPT_core)) { -SBFileSpec file(optarg); -if (file.Exists()) { - m_option_data.m_core_file = optarg; -} else { + if (auto *arg = args.getLastArg(OPT_core)) { +auto arg_value = arg->getValue(); +SBFileSpec file(arg_value); +if (!file.Exists()) { error.SetErrorStringWithFormat( - "file specified in --core (-c) option doesn't exist: '%s'", optarg); + "file specified in --core (-c) option doesn't exist: '%s'", + arg_value); return error; } +m_option_data.m_core_file = arg_value; } if (args.hasArg(OPT_editor)) { @@ -332,33 +333,34 @@ SBError Driver::ProcessArgs(const opt::I } if (auto *arg = args.getLastArg(OPT_file)) { -auto optarg = arg->getValue(); -SBFileSpec file(optarg); +auto arg_value = arg->getValue(); +SBFileSpec file(arg_value); if (file.Exists()) { - m_option_data.m_args.push_back(optarg); + m_option_data.m_args.push_back(arg_value); } else if (file.ResolveExecutableLocation()) { char path[PATH_MAX]; file.GetPath(path, sizeof(path)); m_option_data.m_args.push_back(path); } else { error.SetErrorStringWithFormat( - "file specified in --file (-f) option doesn't exist: '%s'", optarg); + "file specified in --file (-f) option doesn't exist: '%s'", + arg_value); return error; } } if (auto *arg = args.getLastArg(OPT_arch)) { -auto optarg = arg->getValue(); -if (!m_debugger.SetDefaultArchitecture(optarg)) { +auto arg_value = arg->getValue(); +if (!m_debugger.SetDefaultArchitecture(arg_value)) { error.SetErrorStringWithFormat( - "invalid architecture in the -a or --arch option: '%s'", optarg); + "invalid architecture in the -a or --arch option: '%s'", arg_value); return error; } } if (auto *arg = args.getLastArg(OPT_script_language)) { -auto optarg = arg->getValue(); -m_option_data.m_script_lang = m_debugger.GetScriptingLanguage(optarg); +auto arg_value = arg->getValue(); +m_option_data.m_script_lang = m_debugger.GetScriptingLanguage(arg_value); } if (args.hasArg(OPT_no_use_colors)) { @@ -366,16 +368,16 @@ SBError Driver::ProcessArgs(const opt::I } if (auto *arg = args.getLastArg(OPT_reproducer)) { -auto optarg = arg->getValue(); -SBFileSpec file(optarg); +auto arg_value = arg->getValue(); +SBFileSpec file(arg_value); if (file.Exists()) { - SBError repro_error = m_debugger.ReplayReproducer(optarg); + SBError repro_error = m_debugger.ReplayReproducer(arg_value); if (repro_error.Fail()) return repro_error; } else { error.SetErrorStringWithFormat("file specified in --reproducer " "(-z) option doesn't exist: '%s'", - optarg); +
Re: [Lldb-commits] [PATCH] D54692: [Driver] Use libOption with tablegen.
Thanks, Zachary also pinged me on IRC. This was fixed in r347821. > On Nov 28, 2018, at 4:09 PM, Leonard Mosescu via Phabricator > wrote: > > lemo added a comment. > > I noticed a small problem, this change breaks "lldb -c ". The > inline comment explains the root cause. > > Thanks > > > > > Comment at: lldb/trunk/tools/driver/Driver.cpp:310 > + if (args.hasArg(OPT_core)) { > +SBFileSpec file(optarg); > +if (file.Exists()) { > > there's a small bug in here: optarg is the global definition, I assume the > intention was to use the getValue() instead. as is, it breaks "lldb -c > " > > it would be nice to get rid the global optarg as well since it masks these > kind of mistakes. > > > Repository: > rL LLVM > > CHANGES SINCE LAST ACTION > https://reviews.llvm.org/D54692/new/ > > https://reviews.llvm.org/D54692 > > > ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r347936 - Fix the Xcode project
Author: jdevlieghere Date: Thu Nov 29 16:09:04 2018 New Revision: 347936 URL: http://llvm.org/viewvc/llvm-project?rev=347936&view=rev Log: Fix the Xcode project This fixes the driver with the Xcode project. We need to link the driver against the correct LLVM libraries and make sure we're disabling exceptions/rtti. Thanks to Jim for helping me figure this out. 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=347936&r1=347935&r2=347936&view=diff == --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Nov 29 16:09:04 2018 @@ -9926,6 +9926,7 @@ "$(LLDB_ZLIB_LDFLAGS)", "$(LLDB_COVERAGE_LDFLAGS)", ); + "OTHER_LDFLAGS[sdk=macosx*]" = ""; PYTHON_FRAMEWORK_PATH = /System/Library/Frameworks/Python.framework/; PYTHON_VERSION_MAJOR = 2; PYTHON_VERSION_MINOR = 7; @@ -9951,23 +9952,35 @@ INFOPLIST_FILE = "tools/driver/lldb-Info.plist"; INSTALL_PATH = "$(LLDB_TOOLS_INSTALL_DIR)"; LIBRARY_SEARCH_PATHS = "$(inherited)"; + OTHER_CFLAGS = ( + "-Wparentheses", + "$(LLDB_ZLIB_CFLAGS)", + "$(LLDB_COMPRESSION_CFLAGS)", + "$(LLDB_COVERAGE_CFLAGS)", + "-Wimplicit-fallthrough", + "-fno-rtti", + "-fno-exceptions", + "-DNDEBUG", + ); "OTHER_LDFLAGS[sdk=iphoneos*]" = ( "$(inherited)", "-sectcreate", __TEXT, __info_plist, - "-filelist", - "$(LLVM_BUILD_DIR)/archives.txt", "$(PROJECT_DIR)/tools/driver/lldb-Info.plist", "-Wl,-rpath,@loader_path/../../../System/Library/PrivateFrameworks", + "-L$(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/lib", + "-lLLVMOption", + "-lLLVMSupport", ); "OTHER_LDFLAGS[sdk=macosx*]" = ( "$(inherited)", "-sectcreate", __TEXT, __info_plist, - "-filelist", - "$(LLVM_BUILD_DIR)/archives.txt", + "-L$(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/lib", + "-lLLVMOption", + "-lLLVMSupport", "$(PROJECT_DIR)/tools/driver/lldb-Info.plist", "-Wl,-rpath,@loader_path/../../Library/PrivateFrameworks", "-Wl,-rpath,@loader_path/../../../SharedFrameworks", @@ -10515,6 +10528,15 @@ INFOPLIST_FILE = "tools/driver/lldb-Info.plist"; INSTALL_PATH = "$(LLDB_TOOLS_INSTALL_DIR)"; LIBRARY_SEARCH_PATHS = "$(inherited)"; + OTHER_CFLAGS = ( + "-Wparentheses", + "$(LLDB_ZLIB_CFLAGS)", + "$(LLDB_COMPRESSION_CFLAGS)", + "$(LLDB_COVERAGE_CFLAGS)", + "-Wimplicit-fallthrough", + "-fno-rtti", + "-fno-exceptions", + ); OTHER_LDFLAGS = ( "$(inherited)", "-sectcreate", @@ -10522,8 +10544,10 @@ __info_plist, "$(PROJECT_DIR)/tools/driver/lldb-Info.plist", "-Wl,-rpath,@loader
[Lldb-commits] [lldb] r347952 - Fix the Xcode project (pt. 2)
Author: jdevlieghere Date: Thu Nov 29 18:44:16 2018 New Revision: 347952 URL: http://llvm.org/viewvc/llvm-project?rev=347952&view=rev Log: Fix the Xcode project (pt. 2) Apparently LLVM's libSupport depends on libDemangle to print the stack trace. I'm not sure if this is desired but for now we don't have much choice if we want to turn to bot green again. 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=347952&r1=347951&r2=347952&view=diff == --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Nov 29 18:44:16 2018 @@ -9972,6 +9972,7 @@ "-L$(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/lib", "-lLLVMOption", "-lLLVMSupport", + "-lLLVMDemangle", ); "OTHER_LDFLAGS[sdk=macosx*]" = ( "$(inherited)", @@ -9981,6 +9982,7 @@ "-L$(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/lib", "-lLLVMOption", "-lLLVMSupport", + "-lLLVMDemangle", "$(PROJECT_DIR)/tools/driver/lldb-Info.plist", "-Wl,-rpath,@loader_path/../../Library/PrivateFrameworks", "-Wl,-rpath,@loader_path/../../../SharedFrameworks", @@ -10588,6 +10590,7 @@ "-L$(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/lib", "-lLLVMOption", "-lLLVMSupport", + "-lLLVMDemangle", ); PRODUCT_NAME = lldb; USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/include $(SRCROOT)/source $(LLVM_SOURCE_DIR)/include $(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/include ${LLDB_BUILD_DIR}/include"; @@ -10745,6 +10748,7 @@ "-L$(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/lib", "-lLLVMOption", "-lLLVMSupport", + "-lLLVMDemangle", ); PRODUCT_NAME = lldb; USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/include $(SRCROOT)/source $(LLVM_SOURCE_DIR)/include $(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/include"; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r348010 - Skip TestRequireHWBreakpoints on Windows
Author: jdevlieghere Date: Fri Nov 30 09:31:20 2018 New Revision: 348010 URL: http://llvm.org/viewvc/llvm-project?rev=348010&view=rev Log: Skip TestRequireHWBreakpoints on Windows The test assumes that HW breakpoints are not implemented by the debug server. Windows doesn't use these and might actually support HW breakpoints so these tests are expected fail because they don't raise the expected error. Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/TestRequireHWBreakpoints.py Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/TestRequireHWBreakpoints.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/TestRequireHWBreakpoints.py?rev=348010&r1=348009&r2=348010&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/TestRequireHWBreakpoints.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/TestRequireHWBreakpoints.py Fri Nov 30 09:31:20 2018 @@ -27,6 +27,7 @@ class BreakpointLocationsTestCase(TestBa breakpoint = target.BreakpointCreateByLocation("main.c", 1) self.assertTrue(breakpoint.IsHardware()) +@skipIfWindows def test_step_range(self): """Test stepping when hardware breakpoints are required.""" self.build() @@ -47,6 +48,7 @@ class BreakpointLocationsTestCase(TestBa self.assertTrue("Could not create hardware breakpoint for thread plan" in error.GetCString()) +@skipIfWindows def test_step_out(self): """Test stepping out when hardware breakpoints are required.""" self.build() @@ -66,6 +68,7 @@ class BreakpointLocationsTestCase(TestBa self.assertTrue("Could not create hardware breakpoint for thread plan" in error.GetCString()) +@skipIfWindows def test_step_over(self): """Test stepping over when hardware breakpoints are required.""" self.build() @@ -84,6 +87,7 @@ class BreakpointLocationsTestCase(TestBa 'Could not create hardware breakpoint for thread plan' ]) +@skipIfWindows def test_step_until(self): """Test stepping until when hardware breakpoints are required.""" self.build() ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r348152 - [Reproducers] Change how reproducers are initialized.
Author: jdevlieghere Date: Mon Dec 3 09:28:29 2018 New Revision: 348152 URL: http://llvm.org/viewvc/llvm-project?rev=348152&view=rev Log: [Reproducers] Change how reproducers are initialized. This patch changes the way the reproducer is initialized. Rather than making changes at run time we now do everything at initialization time. To make this happen we had to introduce initializer options and their SB variant. This allows us to tell the initializer that we're running in reproducer capture/replay mode. Because of this change we also had to alter our testing strategy. We cannot reinitialize LLDB when using the dotest infrastructure. Instead we use lit and invoke two instances of the driver. Another consequence is that we can no longer enable capture or replay through commands. This was bound to go away form the beginning, but I had something in mind where you could enable/disable specific providers. However this seems like it adds very little value right now so the corresponding commands were removed. Finally this change also means you now have to control this through the driver, for which I replaced --reproducer with --capture and --replay to differentiate between the two modes. Differential revision: https://reviews.llvm.org/D55038 Added: lldb/trunk/include/lldb/API/SBInitializerOptions.h lldb/trunk/lit/Reproducer/ lldb/trunk/lit/Reproducer/Inputs/ lldb/trunk/lit/Reproducer/Inputs/GDBRemoteCapture.in lldb/trunk/lit/Reproducer/Inputs/GDBRemoteReplay.in lldb/trunk/lit/Reproducer/Inputs/simple.c lldb/trunk/lit/Reproducer/TestDriverOptions.test lldb/trunk/lit/Reproducer/TestGDBRemoteRepro.test lldb/trunk/scripts/interface/SBInitializerOptions.i lldb/trunk/source/API/SBInitializerOptions.cpp Removed: lldb/trunk/packages/Python/lldbsuite/test/functionalities/reproducer/gdb-remote/Makefile lldb/trunk/packages/Python/lldbsuite/test/functionalities/reproducer/gdb-remote/TestGdbRemoteReproducer.py Modified: lldb/trunk/include/lldb/API/SBDebugger.h lldb/trunk/include/lldb/API/SBDefines.h lldb/trunk/include/lldb/API/SBFileSpec.h lldb/trunk/include/lldb/Core/Debugger.h lldb/trunk/include/lldb/Host/HostInfoBase.h lldb/trunk/include/lldb/Initialization/SystemInitializer.h lldb/trunk/include/lldb/Initialization/SystemInitializerCommon.h lldb/trunk/include/lldb/Initialization/SystemLifetimeManager.h lldb/trunk/include/lldb/Utility/Reproducer.h lldb/trunk/scripts/interface/SBDebugger.i lldb/trunk/scripts/lldb.swig lldb/trunk/source/API/CMakeLists.txt lldb/trunk/source/API/SBDebugger.cpp lldb/trunk/source/API/SystemInitializerFull.cpp lldb/trunk/source/API/SystemInitializerFull.h lldb/trunk/source/Commands/CommandObjectReproducer.cpp lldb/trunk/source/Core/Debugger.cpp lldb/trunk/source/Host/common/HostInfoBase.cpp lldb/trunk/source/Initialization/SystemInitializerCommon.cpp lldb/trunk/source/Initialization/SystemLifetimeManager.cpp lldb/trunk/source/Utility/Reproducer.cpp lldb/trunk/tools/driver/Driver.cpp lldb/trunk/tools/driver/Options.td lldb/trunk/tools/lldb-server/SystemInitializerLLGS.cpp lldb/trunk/tools/lldb-server/SystemInitializerLLGS.h lldb/trunk/tools/lldb-server/lldb-server.cpp lldb/trunk/tools/lldb-test/SystemInitializerTest.cpp lldb/trunk/tools/lldb-test/SystemInitializerTest.h lldb/trunk/tools/lldb-test/lldb-test.cpp lldb/trunk/unittests/Utility/ReproducerTest.cpp Modified: lldb/trunk/include/lldb/API/SBDebugger.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBDebugger.h?rev=348152&r1=348151&r2=348152&view=diff == --- lldb/trunk/include/lldb/API/SBDebugger.h (original) +++ lldb/trunk/include/lldb/API/SBDebugger.h Mon Dec 3 09:28:29 2018 @@ -13,6 +13,7 @@ #include #include "lldb/API/SBDefines.h" +#include "lldb/API/SBInitializerOptions.h" #include "lldb/API/SBPlatform.h" namespace lldb { @@ -45,6 +46,7 @@ public: lldb::SBDebugger &operator=(const lldb::SBDebugger &rhs); static void Initialize(); + static lldb::SBError Initialize(SBInitializerOptions &options); static void Terminate(); @@ -228,8 +230,6 @@ public: const char *GetReproducerPath() const; - lldb::SBError ReplayReproducer(const char *path); - lldb::ScriptLanguage GetScriptLanguage() const; void SetScriptLanguage(lldb::ScriptLanguage script_lang); Modified: lldb/trunk/include/lldb/API/SBDefines.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBDefines.h?rev=348152&r1=348151&r2=348152&view=diff == --- lldb/trunk/include/lldb/API/SBDefines.h (original) +++ lldb/trunk/include/lldb/API/SBDefines.h Mon Dec 3 09:28:29 2018 @@ -51,6 +51,7 @@ class LLDB_API SBFileSpecList; class LLDB_API SBFrame; class LLDB_API SBFunction; class LLDB_AP
[Lldb-commits] [lldb] r348186 - Skip TestDriverOptions on Windows
Author: jdevlieghere Date: Mon Dec 3 12:36:21 2018 New Revision: 348186 URL: http://llvm.org/viewvc/llvm-project?rev=348186&view=rev Log: Skip TestDriverOptions on Windows It's not clear to me why this is failing on Windows. Maybe it has something to do with the path? Modified: lldb/trunk/lit/Reproducer/TestDriverOptions.test Modified: lldb/trunk/lit/Reproducer/TestDriverOptions.test URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Reproducer/TestDriverOptions.test?rev=348186&r1=348185&r2=348186&view=diff == --- lldb/trunk/lit/Reproducer/TestDriverOptions.test (original) +++ lldb/trunk/lit/Reproducer/TestDriverOptions.test Mon Dec 3 12:36:21 2018 @@ -1,3 +1,6 @@ +# FIXME: Find out why this fails on Windows. +# UNSUPPORTED: system-windows + # Check that errors are propagated to the driver. # RUN: not %lldb --capture /bogus 2>&1 | FileCheck %s --check-prefix CAPTURE ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [lldb] r348186 - Skip TestDriverOptions on Windows
That wouldn't work because we try to create the directory which would succeeded in the temp dir. I'd have to be something you don't have access to, like the root or some network drive. On Mon, Dec 3, 2018 at 12:53 PM Zachary Turner wrote: > Perhaps use %t.bogus? instead of /bogus? > > On Mon, Dec 3, 2018 at 12:39 PM Jonas Devlieghere via lldb-commits < > lldb-commits@lists.llvm.org> wrote: > >> Author: jdevlieghere >> Date: Mon Dec 3 12:36:21 2018 >> New Revision: 348186 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=348186&view=rev >> Log: >> Skip TestDriverOptions on Windows >> >> It's not clear to me why this is failing on Windows. Maybe it has >> something to do with the path? >> >> Modified: >> lldb/trunk/lit/Reproducer/TestDriverOptions.test >> >> Modified: lldb/trunk/lit/Reproducer/TestDriverOptions.test >> URL: >> http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Reproducer/TestDriverOptions.test?rev=348186&r1=348185&r2=348186&view=diff >> >> == >> --- lldb/trunk/lit/Reproducer/TestDriverOptions.test (original) >> +++ lldb/trunk/lit/Reproducer/TestDriverOptions.test Mon Dec 3 12:36:21 >> 2018 >> @@ -1,3 +1,6 @@ >> +# FIXME: Find out why this fails on Windows. >> +# UNSUPPORTED: system-windows >> + >> # Check that errors are propagated to the driver. >> >> # RUN: not %lldb --capture /bogus 2>&1 | FileCheck %s --check-prefix >> CAPTURE >> >> >> ___ >> lldb-commits mailing list >> lldb-commits@lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits >> > ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r348207 - [FileSystem] Migrate MonitoringProcessLauncher
Author: jdevlieghere Date: Mon Dec 3 14:41:32 2018 New Revision: 348207 URL: http://llvm.org/viewvc/llvm-project?rev=348207&view=rev Log: [FileSystem] Migrate MonitoringProcessLauncher Use the FileSystem helpers instead of using the file system directly. Modified: lldb/trunk/source/Host/common/MonitoringProcessLauncher.cpp Modified: lldb/trunk/source/Host/common/MonitoringProcessLauncher.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/MonitoringProcessLauncher.cpp?rev=348207&r1=348206&r2=348207&view=diff == --- lldb/trunk/source/Host/common/MonitoringProcessLauncher.cpp (original) +++ lldb/trunk/source/Host/common/MonitoringProcessLauncher.cpp Mon Dec 3 14:41:32 2018 @@ -12,7 +12,6 @@ #include "lldb/Host/HostProcess.h" #include "lldb/Target/ProcessLaunchInfo.h" #include "lldb/Utility/Log.h" -#include "lldb/Utility/Status.h" #include "llvm/Support/FileSystem.h" @@ -30,20 +29,16 @@ MonitoringProcessLauncher::LaunchProcess error.Clear(); + FileSystem &fs = FileSystem::Instance(); FileSpec exe_spec(resolved_info.GetExecutableFile()); - llvm::sys::fs::file_status stats; - status(exe_spec.GetPath(), stats); - if (!exists(stats)) { + if (!fs.Exists(exe_spec)) FileSystem::Instance().Resolve(exe_spec); -status(exe_spec.GetPath(), stats); - } - if (!exists(stats)) { + + if (!fs.Exists(exe_spec)) FileSystem::Instance().ResolveExecutableLocation(exe_spec); -status(exe_spec.GetPath(), stats); - } - if (!exists(stats)) { + if (!fs.Exists(exe_spec)) { error.SetErrorStringWithFormatv("executable doesn't exist: '{0}'", exe_spec); return HostProcess(); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r348232 - [PlatformDarwin] Simplify logic and use FileSystem
Author: jdevlieghere Date: Mon Dec 3 18:23:16 2018 New Revision: 348232 URL: http://llvm.org/viewvc/llvm-project?rev=348232&view=rev Log: [PlatformDarwin] Simplify logic and use FileSystem Simplify code path by using the FileSystem. Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp?rev=348232&r1=348231&r2=348232&view=diff == --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp (original) +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp Mon Dec 3 18:23:16 2018 @@ -190,25 +190,12 @@ FileSpecList PlatformDarwin::LocateExecu Status PlatformDarwin::ResolveSymbolFile(Target &target, const ModuleSpec &sym_spec, FileSpec &sym_file) { - Status error; sym_file = sym_spec.GetSymbolFileSpec(); - - llvm::sys::fs::file_status st; - if (status(sym_file.GetPath(), st, false)) { -error.SetErrorString("Could not stat file!"); -return error; - } - - if (exists(st)) { -if (is_directory(st)) { - sym_file = Symbols::FindSymbolFileInBundle( - sym_file, sym_spec.GetUUIDPtr(), sym_spec.GetArchitecturePtr()); -} - } else { -if (sym_spec.GetUUID().IsValid()) { -} + if (FileSystem::Instance().IsDirectory(sym_file)) { +sym_file = Symbols::FindSymbolFileInBundle(sym_file, sym_spec.GetUUIDPtr(), + sym_spec.GetArchitecturePtr()); } - return error; + return {}; } static lldb_private::Status ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r348287 - [FileSystem] Migrate CommandCompletions
Author: jdevlieghere Date: Tue Dec 4 09:58:21 2018 New Revision: 348287 URL: http://llvm.org/viewvc/llvm-project?rev=348287&view=rev Log: [FileSystem] Migrate CommandCompletions Make use of the convenience helpers from FileSystem. Differential revision: https://reviews.llvm.org/D55240 Modified: lldb/trunk/include/lldb/Host/FileSystem.h lldb/trunk/source/Commands/CommandCompletions.cpp lldb/trunk/source/Host/common/FileSystem.cpp lldb/trunk/unittests/Interpreter/TestCompletion.cpp Modified: lldb/trunk/include/lldb/Host/FileSystem.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=348287&r1=348286&r2=348287&view=diff == --- lldb/trunk/include/lldb/Host/FileSystem.h (original) +++ lldb/trunk/include/lldb/Host/FileSystem.h Tue Dec 4 09:58:21 2018 @@ -34,6 +34,9 @@ public: FileSystem() : m_fs(llvm::vfs::getRealFileSystem()) {} FileSystem(llvm::IntrusiveRefCntPtr fs) : m_fs(fs) {} + FileSystem(const FileSystem &fs) = delete; + FileSystem &operator=(const FileSystem &fs) = delete; + static FileSystem &Instance(); static void Initialize(); @@ -54,6 +57,20 @@ public: Status Open(File &File, const FileSpec &file_spec, uint32_t options, uint32_t permissions = lldb::eFilePermissionsFileDefault); + /// Get a directory iterator. + /// @{ + llvm::vfs::directory_iterator DirBegin(const FileSpec &file_spec, + std::error_code &ec); + llvm::vfs::directory_iterator DirBegin(const llvm::Twine &dir, + std::error_code &ec); + /// @} + + /// Returns the Status object for the given file. + /// @{ + llvm::ErrorOr GetStatus(const FileSpec &file_spec) const; + llvm::ErrorOr GetStatus(const llvm::Twine &path) const; + /// @} + /// Returns the modification time of the given file. /// @{ llvm::sys::TimePoint<> GetModificationTime(const FileSpec &file_spec) const; Modified: lldb/trunk/source/Commands/CommandCompletions.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandCompletions.cpp?rev=348287&r1=348286&r2=348287&view=diff == --- lldb/trunk/source/Commands/CommandCompletions.cpp (original) +++ lldb/trunk/source/Commands/CommandCompletions.cpp Tue Dec 4 09:58:21 2018 @@ -101,7 +101,6 @@ static int DiskFilesOrDirectories(const if (CompletionBuffer.size() >= PATH_MAX) return matches.GetSize(); - namespace fs = llvm::sys::fs; namespace path = llvm::sys::path; llvm::StringRef SearchDir; @@ -178,11 +177,16 @@ static int DiskFilesOrDirectories(const // SearchDir now contains the directory to search in, and Prefix contains the // text we want to match against items in that directory. + FileSystem &fs = FileSystem::Instance(); std::error_code EC; - fs::directory_iterator Iter(SearchDir, EC, false); - fs::directory_iterator End; + llvm::vfs::directory_iterator Iter = fs.DirBegin(SearchDir, EC); + llvm::vfs::directory_iterator End; for (; Iter != End && !EC; Iter.increment(EC)) { auto &Entry = *Iter; +llvm::ErrorOr Status = fs.GetStatus(Entry.path()); + +if (!Status) + continue; auto Name = path::filename(Entry.path()); @@ -190,20 +194,18 @@ static int DiskFilesOrDirectories(const if (Name == "." || Name == ".." || !Name.startswith(PartialItem)) continue; -// We have a match. - -llvm::ErrorOr st = Entry.status(); -if (!st) - continue; +bool is_dir = Status->isDirectory(); // If it's a symlink, then we treat it as a directory as long as the target // is a directory. -bool is_dir = fs::is_directory(*st); -if (fs::is_symlink_file(*st)) { - fs::file_status target_st; - if (!fs::status(Entry.path(), target_st)) -is_dir = fs::is_directory(target_st); +if (Status->isSymlink()) { + FileSpec symlink_filespec(Entry.path()); + FileSpec resolved_filespec; + auto error = fs.ResolveSymbolicLink(symlink_filespec, resolved_filespec); + if (error.Success()) +is_dir = fs.IsDirectory(symlink_filespec); } + if (only_directories && !is_dir) continue; Modified: lldb/trunk/source/Host/common/FileSystem.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSystem.cpp?rev=348287&r1=348286&r2=348287&view=diff == --- lldb/trunk/source/Host/common/FileSystem.cpp (original) +++ lldb/trunk/source/Host/common/FileSystem.cpp Tue Dec 4 09:58:21 2018 @@ -63,6 +63,25 @@ Optional &FileSystem::Instan return g_fs; } +vfs::directory_iterator FileSystem::DirBegin(const FileSpec &file_spec, + std::error_code &ec) { + return DirBegin(file_spec.GetPath(), ec); +} + +vfs::direc
[Lldb-commits] [lldb] r348289 - [Reproducers] Only creaate the bottom-most dir
Author: jdevlieghere Date: Tue Dec 4 10:16:49 2018 New Revision: 348289 URL: http://llvm.org/viewvc/llvm-project?rev=348289&view=rev Log: [Reproducers] Only creaate the bottom-most dir As Pavel noted on the mailing list we should only create the bottom-most directory if it doesn't exist. This should also fix the test case on Windows as we can use lit's temp directory. Modified: lldb/trunk/lit/Reproducer/TestDriverOptions.test lldb/trunk/source/Utility/Reproducer.cpp Modified: lldb/trunk/lit/Reproducer/TestDriverOptions.test URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Reproducer/TestDriverOptions.test?rev=348289&r1=348288&r2=348289&view=diff == --- lldb/trunk/lit/Reproducer/TestDriverOptions.test (original) +++ lldb/trunk/lit/Reproducer/TestDriverOptions.test Tue Dec 4 10:16:49 2018 @@ -1,10 +1,7 @@ -# FIXME: Find out why this fails on Windows. -# UNSUPPORTED: system-windows - # Check that errors are propagated to the driver. -# RUN: not %lldb --capture /bogus 2>&1 | FileCheck %s --check-prefix CAPTURE -# RUN: not %lldb --replay /bogus 2>&1 | FileCheck %s --check-prefix REPLAY +# RUN: not %lldb --capture %t/bogus/bogus 2>&1 | FileCheck %s --check-prefix CAPTURE +# RUN: not %lldb --replay %t/bogus/bogus 2>&1 | FileCheck %s --check-prefix REPLAY # CAPTURE: unable to create reproducer directory # REPLAY: unable to load reproducer index Modified: lldb/trunk/source/Utility/Reproducer.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/Reproducer.cpp?rev=348289&r1=348288&r2=348289&view=diff == --- lldb/trunk/source/Utility/Reproducer.cpp (original) +++ lldb/trunk/source/Utility/Reproducer.cpp Tue Dec 4 10:16:49 2018 @@ -36,7 +36,7 @@ llvm::Error Reproducer::Initialize(Repro "unable to create unique reproducer directory", ec); root.emplace(repro_dir); } else { - auto ec = sys::fs::create_directories(root->GetPath()); + auto ec = sys::fs::create_directory(root->GetPath()); if (ec) return make_error("unable to create reproducer directory", ec); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [lldb] r348186 - Skip TestDriverOptions on Windows
Yeah, that's a good idea. Made the change in r348289. On Tue, Dec 4, 2018 at 2:55 AM Pavel Labath wrote: > On 03/12/2018 21:55, Jonas Devlieghere via lldb-commits wrote: > > That wouldn't work because we try to create the directory which would > > succeeded in the temp dir. I'd have to be something you don't have > > access to, like the root or some network drive. > > > > How about we change the behavior to only create the bottommost > directory? E.g. if the user specifies "/X/Y/Z" as the path, then "/X/Y" > has to exist, and "Z" will be created if not present (i.e. use mkdir, > not mkdir -p). I think this is the behavior most users would expect > anyway (I would be upset if a typo causes lldb to create a whole > hierarchy some place I did not intend), and it will allow to test this > via something like "%t/does_not_exist/repro_dir". > > pl > ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r348779 - [Host] Use FileSystem wrapper
Author: jdevlieghere Date: Mon Dec 10 10:17:39 2018 New Revision: 348779 URL: http://llvm.org/viewvc/llvm-project?rev=348779&view=rev Log: [Host] Use FileSystem wrapper Fixes Host.mm to use the FileSystem class instead of making native calls to check if a file exists. Modified: lldb/trunk/source/Host/macosx/objcxx/Host.mm Modified: lldb/trunk/source/Host/macosx/objcxx/Host.mm URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/objcxx/Host.mm?rev=348779&r1=348778&r2=348779&view=diff == --- lldb/trunk/source/Host/macosx/objcxx/Host.mm (original) +++ lldb/trunk/source/Host/macosx/objcxx/Host.mm Mon Dec 10 10:17:39 2018 @@ -1273,21 +1273,19 @@ static bool ShouldLaunchUsingXPC(Process Status Host::LaunchProcess(ProcessLaunchInfo &launch_info) { Status error; + + FileSystem &fs = FileSystem::Instance(); FileSpec exe_spec(launch_info.GetExecutableFile()); - llvm::sys::fs::file_status stats; - status(exe_spec.GetPath(), stats); - if (!exists(stats)) { + if (!fs.Exists(exe_spec)) FileSystem::Instance().Resolve(exe_spec); -status(exe_spec.GetPath(), stats); - } - if (!exists(stats)) { + + if (!fs.Exists(exe_spec)) FileSystem::Instance().ResolveExecutableLocation(exe_spec); -status(exe_spec.GetPath(), stats); - } - if (!exists(stats)) { + + if (!fs.Exists(exe_spec)) { error.SetErrorStringWithFormatv("executable doesn't exist: '{0}'", -launch_info.GetExecutableFile()); +exe_spec); return error; } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r348894 - [Driver] Simplify OptionData. NFC
Author: jdevlieghere Date: Tue Dec 11 12:19:53 2018 New Revision: 348894 URL: http://llvm.org/viewvc/llvm-project?rev=348894&view=rev Log: [Driver] Simplify OptionData. NFC Hopefully this makes the option data easier to understand and maintain. - Group the member variables. - Do the initialization in the header as it's less error prone. - Rename the Clean method. It was called only once and was re-initializing some but not all (?) members. The only useful thing it does is dealing with the local lldbinit file so keep that and make the name reflect that. Modified: lldb/trunk/tools/driver/Driver.cpp lldb/trunk/tools/driver/Driver.h Modified: lldb/trunk/tools/driver/Driver.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=348894&r1=348893&r2=348894&view=diff == --- lldb/trunk/tools/driver/Driver.cpp (original) +++ lldb/trunk/tools/driver/Driver.cpp Tue Dec 11 12:19:53 2018 @@ -120,53 +120,22 @@ Driver::Driver() Driver::~Driver() { g_driver = NULL; } -Driver::OptionData::OptionData() -: m_args(), m_script_lang(lldb::eScriptLanguageDefault), m_core_file(), - m_crash_log(), m_initial_commands(), m_after_file_commands(), - m_after_crash_commands(), m_debug_mode(false), m_source_quietly(false), - m_print_version(false), m_print_python_path(false), m_wait_for(false), - m_repl(false), m_repl_lang(eLanguageTypeUnknown), m_repl_options(), - m_process_name(), m_process_pid(LLDB_INVALID_PROCESS_ID), - m_use_external_editor(false), m_batch(false), m_seen_options() {} - -Driver::OptionData::~OptionData() {} - -void Driver::OptionData::Clear() { - m_args.clear(); - m_script_lang = lldb::eScriptLanguageDefault; - m_initial_commands.clear(); - m_after_file_commands.clear(); - - // If there is a local .lldbinit, add that to the - // list of things to be sourced, if the settings - // permit it. +void Driver::OptionData::AddLocalLLDBInit() { + // If there is a local .lldbinit, add that to the list of things to be + // sourced, if the settings permit it. SBFileSpec local_lldbinit(".lldbinit", true); - SBFileSpec homedir_dot_lldb = SBHostOS::GetUserHomeDirectory(); homedir_dot_lldb.AppendPathComponent(".lldbinit"); - // Only read .lldbinit in the current working directory - // if it's not the same as the .lldbinit in the home - // directory (which is already being read in). + // Only read .lldbinit in the current working directory if it's not the same + // as the .lldbinit in the home directory (which is already being read in). if (local_lldbinit.Exists() && strcmp(local_lldbinit.GetDirectory(), homedir_dot_lldb.GetDirectory()) != 0) { -char path[2048]; -local_lldbinit.GetPath(path, 2047); +char path[PATH_MAX]; +local_lldbinit.GetPath(path, sizeof(path)); InitialCmdEntry entry(path, true, true, true); m_after_file_commands.push_back(entry); } - - m_debug_mode = false; - m_source_quietly = false; - m_print_version = false; - m_print_python_path = false; - m_use_external_editor = false; - m_wait_for = false; - m_process_name.erase(); - m_batch = false; - m_after_crash_commands.clear(); - - m_process_pid = LLDB_INVALID_PROCESS_ID; } void Driver::OptionData::AddInitialCommand(std::string command, @@ -201,8 +170,6 @@ void Driver::OptionData::AddInitialComma command_set->push_back(InitialCmdEntry(command, is_file, false)); } -void Driver::ResetOptionValues() { m_option_data.Clear(); } - const char *Driver::GetFilename() const { if (m_option_data.m_args.empty()) return NULL; @@ -284,7 +251,7 @@ bool Driver::GetDebugMode() const { retu // user only wanted help or version information. SBError Driver::ProcessArgs(const opt::InputArgList &args, bool &exiting) { SBError error; - ResetOptionValues(); + m_option_data.AddLocalLLDBInit(); // This is kind of a pain, but since we make the debugger in the Driver's // constructor, we can't know at that point whether we should read in init Modified: lldb/trunk/tools/driver/Driver.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.h?rev=348894&r1=348893&r2=348894&view=diff == --- lldb/trunk/tools/driver/Driver.h (original) +++ lldb/trunk/tools/driver/Driver.h Tue Dec 11 12:19:53 2018 @@ -57,13 +57,8 @@ public: bool GetDebugMode() const; - class OptionData { - public: -OptionData(); -~OptionData(); - -void Clear(); - + struct OptionData { +void AddLocalLLDBInit(); void AddInitialCommand(std::string command, CommandPlacement placement, bool is_file, lldb::SBError &error); @@ -71,36 +66,44 @@ public: InitialCmdEntry(std::string contents, bool in_is_file, bool is_cwd_lldbinit_file_read, bool in_quiet = f
[Lldb-commits] [lldb] r348901 - Remove unused file
Author: jdevlieghere Date: Tue Dec 11 14:46:56 2018 New Revision: 348901 URL: http://llvm.org/viewvc/llvm-project?rev=348901&view=rev Log: Remove unused file I removed the dotest-style reproducer test but forgot to delete the source file. Thanks Jim for the heads up! Removed: lldb/trunk/packages/Python/lldbsuite/test/functionalities/reproducer/gdb-remote/main.c Removed: lldb/trunk/packages/Python/lldbsuite/test/functionalities/reproducer/gdb-remote/main.c URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/reproducer/gdb-remote/main.c?rev=348900&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/reproducer/gdb-remote/main.c (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/reproducer/gdb-remote/main.c (removed) @@ -1,19 +0,0 @@ -//===-- 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 - -void foo() { -printf("testing\n"); -} - -int main (int argc, char const *argv[]) { -foo(); -return 0; -} ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r348996 - [NFC] Small code cleanups in utility.
Author: jdevlieghere Date: Wed Dec 12 16:15:17 2018 New Revision: 348996 URL: http://llvm.org/viewvc/llvm-project?rev=348996&view=rev Log: [NFC] Small code cleanups in utility. Fix a few small annoyances in Utility I ran into. Modified: lldb/trunk/source/Utility/FileSpec.cpp lldb/trunk/source/Utility/Stream.cpp lldb/trunk/source/Utility/StringList.cpp lldb/trunk/source/Utility/StructuredData.cpp lldb/trunk/source/Utility/TildeExpressionResolver.cpp lldb/trunk/source/Utility/UUID.cpp Modified: lldb/trunk/source/Utility/FileSpec.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/FileSpec.cpp?rev=348996&r1=348995&r2=348996&view=diff == --- lldb/trunk/source/Utility/FileSpec.cpp (original) +++ lldb/trunk/source/Utility/FileSpec.cpp Wed Dec 12 16:15:17 2018 @@ -424,7 +424,7 @@ std::string FileSpec::GetPath(bool denor } const char *FileSpec::GetCString(bool denormalize) const { - return ConstString{GetPath(denormalize)}.AsCString(NULL); + return ConstString{GetPath(denormalize)}.AsCString(nullptr); } void FileSpec::GetPath(llvm::SmallVectorImpl &path, Modified: lldb/trunk/source/Utility/Stream.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/Stream.cpp?rev=348996&r1=348995&r2=348996&view=diff == --- lldb/trunk/source/Utility/Stream.cpp (original) +++ lldb/trunk/source/Utility/Stream.cpp Wed Dec 12 16:15:17 2018 @@ -93,9 +93,9 @@ void Stream::QuotedCString(const char *c //-- void Stream::Address(uint64_t addr, uint32_t addr_size, const char *prefix, const char *suffix) { - if (prefix == NULL) + if (prefix == nullptr) prefix = ""; - if (suffix == NULL) + if (suffix == nullptr) suffix = ""; //int addr_width = m_addr_size << 1; //Printf ("%s0x%0*" PRIx64 "%s", prefix, addr_width, addr, suffix); Modified: lldb/trunk/source/Utility/StringList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/StringList.cpp?rev=348996&r1=348995&r2=348996&view=diff == --- lldb/trunk/source/Utility/StringList.cpp (original) +++ lldb/trunk/source/Utility/StringList.cpp Wed Dec 12 16:15:17 2018 @@ -83,7 +83,7 @@ size_t StringList::GetMaxStringLength() const char *StringList::GetStringAtIndex(size_t idx) const { if (idx < m_strings.size()) return m_strings[idx].c_str(); - return NULL; + return nullptr; } void StringList::Join(const char *separator, Stream &strm) { Modified: lldb/trunk/source/Utility/StructuredData.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/StructuredData.cpp?rev=348996&r1=348995&r2=348996&view=diff == --- lldb/trunk/source/Utility/StructuredData.cpp (original) +++ lldb/trunk/source/Utility/StructuredData.cpp Wed Dec 12 16:15:17 2018 @@ -144,7 +144,7 @@ static StructuredData::ObjectSP ParseJSO } StructuredData::ObjectSP StructuredData::ParseJSON(std::string json_text) { - JSONParser json_parser(json_text.c_str()); + JSONParser json_parser(json_text); StructuredData::ObjectSP object_sp = ParseJSONValue(json_parser); return object_sp; } @@ -169,11 +169,11 @@ StructuredData::Object::GetObjectForDotS if (this->GetType() == lldb::eStructuredDataTypeArray) { std::pair match = path.split('['); -if (match.second.size() == 0) { +if (match.second.empty()) { return this->shared_from_this(); } errno = 0; -uint64_t val = strtoul(match.second.str().c_str(), NULL, 10); +uint64_t val = strtoul(match.second.str().c_str(), nullptr, 10); if (errno == 0) { return this->GetAsArray()->GetItemAtIndex(val); } Modified: lldb/trunk/source/Utility/TildeExpressionResolver.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/TildeExpressionResolver.cpp?rev=348996&r1=348995&r2=348996&view=diff == --- lldb/trunk/source/Utility/TildeExpressionResolver.cpp (original) +++ lldb/trunk/source/Utility/TildeExpressionResolver.cpp Wed Dec 12 16:15:17 2018 @@ -59,7 +59,7 @@ bool StandardTildeExpressionResolver::Re struct passwd *user_entry; Expr = Expr.drop_front(); - while ((user_entry = getpwent()) != NULL) { + while ((user_entry = getpwent()) != nullptr) { StringRef ThisName(user_entry->pw_name); if (!ThisName.startswith(Expr)) continue; Modified: lldb/trunk/source/Utility/UUID.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/UUID.cpp?rev=348996&r1=348995&r2=348996&view=diff == --- lldb/trunk/source/Utility/UUI
[Lldb-commits] [lldb] r349371 - [Driver] Fix --repl argument.
Author: jdevlieghere Date: Mon Dec 17 10:11:48 2018 New Revision: 349371 URL: http://llvm.org/viewvc/llvm-project?rev=349371&view=rev Log: [Driver] Fix --repl argument. The --repl option was incorrectly defined as "Separate" (option and value separated by a space). This resulted in the option not being picked up when no value was specified. This patch fixes the driver so that `--repl` is recognized again. I split the option into two: - A flag: `--repl` and `-r` which take no arguments. - A joined option: `--repl=` and `-r=` that forward its values to the repl. This should match the driver's old behavior. Modified: lldb/trunk/tools/driver/Driver.cpp lldb/trunk/tools/driver/Options.td Modified: lldb/trunk/tools/driver/Driver.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=349371&r1=349370&r2=349371&view=diff == --- lldb/trunk/tools/driver/Driver.cpp (original) +++ lldb/trunk/tools/driver/Driver.cpp Mon Dec 17 10:11:48 2018 @@ -373,13 +373,14 @@ SBError Driver::ProcessArgs(const opt::I } } - if (auto *arg = args.getLastArg(OPT_repl)) { -auto arg_value = arg->getValue(); + if (args.hasArg(OPT_repl)) { m_option_data.m_repl = true; -if (arg_value && arg_value[0]) + } + + if (auto *arg = args.getLastArg(OPT_repl_)) { +m_option_data.m_repl = true; +if (auto arg_value = arg->getValue()) m_option_data.m_repl_options = arg_value; -else - m_option_data.m_repl_options.clear(); } // We need to process the options below together as their relative order Modified: lldb/trunk/tools/driver/Options.td URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Options.td?rev=349371&r1=349370&r2=349371&view=diff == --- lldb/trunk/tools/driver/Options.td (original) +++ lldb/trunk/tools/driver/Options.td Mon Dec 17 10:11:48 2018 @@ -46,7 +46,8 @@ def: Flag<["-"], "P">, HelpText<"Alias for --python-path">, Group; -def script_language: Separate<["--", "-"], "script-language">, MetaVarName<"">, +def script_language: Separate<["--", "-"], "script-language">, + MetaVarName<"">, HelpText<"Tells the debugger to use the specified scripting language for user-defined scripts.">, Group; def: Separate<["-"], "l">, @@ -57,13 +58,22 @@ def: Separate<["-"], "l">, // Repl options. def grp_repl : OptionGroup<"repl">, HelpText<"REPL">; -def repl: Separate<["--", "-"], "repl">, +def repl: Flag<["--", "-"], "repl">, HelpText<"Runs lldb in REPL mode with a stub process.">, Group; -def: Separate<["-"], "r">, +def: Flag<["-"], "r">, Alias, HelpText<"Alias for --repl">, Group; +def repl_: Joined<["--", "-"], "repl=">, + MetaVarName<"">, + HelpText<"Runs lldb in REPL mode with a stub process with the given flags.">, + Group; +def: Joined<["-"], "r=">, + MetaVarName<"">, + Alias, + HelpText<"Alias for --repl=">, + Group; def repl_language: Separate<["--", "-"], "repl-language">, MetaVarName<"">, ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r349401 - [lit] Detect unexpected passes in lldbtest.
Author: jdevlieghere Date: Mon Dec 17 13:40:37 2018 New Revision: 349401 URL: http://llvm.org/viewvc/llvm-project?rev=349401&view=rev Log: [lit] Detect unexpected passes in lldbtest. This patch will have lit report unexpected passes when dotest reports at least one XPASS and no failures. Modified: lldb/trunk/lit/Suite/lldbtest.py Modified: lldb/trunk/lit/Suite/lldbtest.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Suite/lldbtest.py?rev=349401&r1=349400&r2=349401&view=diff == --- lldb/trunk/lit/Suite/lldbtest.py (original) +++ lldb/trunk/lit/Suite/lldbtest.py Mon Dec 17 13:40:37 2018 @@ -96,6 +96,10 @@ class LLDBTest(TestFormat): if exitCode: return lit.Test.FAIL, out + err +unexpected_test_line = 'XPASS' +if unexpected_test_line in out or unexpected_test_line in err: +return lit.Test.XPASS, '' + passing_test_line = 'RESULT: PASSED' if passing_test_line not in out and passing_test_line not in err: msg = ('Unable to find %r in dotest output:\n\n%s%s' % ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [lldb] r349401 - [lit] Detect unexpected passes in lldbtest.
I understand that it's annoying to fix these tests but I strongly believe it will pay off in the long run. The motivation for this change is that we fixed tests that were XFAILED, but forgot to enable them again. Later they started failing and we didn't notice. This was especially a problem with lit where this information was not at all available. I created a patch that changes the dotest behavior to match what lit does. https://reviews.llvm.org/D55835 On Tue, Dec 18, 2018 at 7:54 AM Pavel Labath wrote: > On 17/12/2018 22:40, Jonas Devlieghere via lldb-commits wrote: > > Author: jdevlieghere > > Date: Mon Dec 17 13:40:37 2018 > > New Revision: 349401 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=349401&view=rev > > Log: > > [lit] Detect unexpected passes in lldbtest. > > > > This patch will have lit report unexpected passes when dotest reports at > > least one XPASS and no failures. > > > > Modified: > > lldb/trunk/lit/Suite/lldbtest.py > > > > Modified: lldb/trunk/lit/Suite/lldbtest.py > > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Suite/lldbtest.py?rev=349401&r1=349400&r2=349401&view=diff > > > == > > --- lldb/trunk/lit/Suite/lldbtest.py (original) > > +++ lldb/trunk/lit/Suite/lldbtest.py Mon Dec 17 13:40:37 2018 > > @@ -96,6 +96,10 @@ class LLDBTest(TestFormat): > > if exitCode: > > return lit.Test.FAIL, out + err > > > > +unexpected_test_line = 'XPASS' > > +if unexpected_test_line in out or unexpected_test_line in err: > > +return lit.Test.XPASS, '' > > + > > passing_test_line = 'RESULT: PASSED' > > if passing_test_line not in out and passing_test_line not in > err: > > msg = ('Unable to find %r in dotest output:\n\n%s%s' % > > > > > > ___ > > lldb-commits mailing list > > lldb-commits@lists.llvm.org > > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits > > > > It would be nice to have some notice before changes like this are > implemented. I mean, I know there was some talk of this in the past, but > that was months ago, so it wasn't really clear if/when is that going to > happen. It didn't take me too long to clean up the remaining unexpected > passes on my test configuration (and I found some pretty interesting > things while doing that, for which I am grateful), but I am not sure > this will be so simple for everyone. > > The other issue I have with this patch is that it creates a rift between > how lit evaluates test results and how dotest does it (I don't know how > you guys do this, but I still run dotest manually when I want to zero in > on a single test failure). Now it can happen that someone runs > "check-lldb", it reports a failure (unexpected success), and when the > person runs the single test via dotest, it happily reports that > everything is alright. > > I think it would be better to first teach dotest to treat "unexpected > successes" as a "bad" result (i.e., to exit with non-zero exit code). > Then, we can play around with how to convert that result into lit test > states > > cheers, > pavel > ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r349539 - [cmake] Make libcxx(abi) a dependency when building in-tree clang for macOS
Author: jdevlieghere Date: Tue Dec 18 12:59:23 2018 New Revision: 349539 URL: http://llvm.org/viewvc/llvm-project?rev=349539&view=rev Log: [cmake] Make libcxx(abi) a dependency when building in-tree clang for macOS As discussed on IRC this morning, when building an in-tree clang for testing we have to have libcxx and libcxxabi checked out. This is a common pitfall. Not only are the resulting failures non-obvious, they only manifest when running the test suite, *after* building lldb and clang. By making them a hard dependency (on macOS) we fail earlier with a more useful error message. Differential revision: https://reviews.llvm.org/D55837 Modified: lldb/trunk/CMakeLists.txt Modified: lldb/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=349539&r1=349538&r2=349539&view=diff == --- lldb/trunk/CMakeLists.txt (original) +++ lldb/trunk/CMakeLists.txt Tue Dec 18 12:59:23 2018 @@ -157,6 +157,10 @@ if(LLDB_INCLUDE_TESTS) if(TARGET clang) list(APPEND LLDB_TEST_DEPS clang) +if(APPLE) + list(APPEND LLDB_TEST_DEPS cxx) + list(APPEND LLDB_TEST_DEPS cxxabi) +endif() endif() if(TARGET dsymutil) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r349546 - [CMake] Don't require libcxxabi on darwin
Author: jdevlieghere Date: Tue Dec 18 13:40:05 2018 New Revision: 349546 URL: http://llvm.org/viewvc/llvm-project?rev=349546&view=rev Log: [CMake] Don't require libcxxabi on darwin Just libcxx should suffice. Modified: lldb/trunk/CMakeLists.txt Modified: lldb/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=349546&r1=349545&r2=349546&view=diff == --- lldb/trunk/CMakeLists.txt (original) +++ lldb/trunk/CMakeLists.txt Tue Dec 18 13:40:05 2018 @@ -159,7 +159,6 @@ if(LLDB_INCLUDE_TESTS) list(APPEND LLDB_TEST_DEPS clang) if(APPLE) list(APPEND LLDB_TEST_DEPS cxx) - list(APPEND LLDB_TEST_DEPS cxxabi) endif() endif() ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r349642 - [lit] Make TestConvenienceVariables a cpp file
Author: jdevlieghere Date: Wed Dec 19 09:10:21 2018 New Revision: 349642 URL: http://llvm.org/viewvc/llvm-project?rev=349642&view=rev Log: [lit] Make TestConvenienceVariables a cpp file The build.py script always runs the compiler in C++ mode, regardless of the file extension. This results in mangled names presented to the linker which in turn cannot find the printf symbol. While we figure out how to solve this issue I've turned the source file into a cpp file and added extern c. This should unbreak the bots. Added: lldb/trunk/lit/Driver/Inputs/hello.cpp Removed: lldb/trunk/lit/Driver/Inputs/hello.c Modified: lldb/trunk/lit/Driver/Inputs/convenience.in lldb/trunk/lit/Driver/TestConvenienceVariables.test Modified: lldb/trunk/lit/Driver/Inputs/convenience.in URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Driver/Inputs/convenience.in?rev=349642&r1=349641&r2=349642&view=diff == --- lldb/trunk/lit/Driver/Inputs/convenience.in (original) +++ lldb/trunk/lit/Driver/Inputs/convenience.in Wed Dec 19 09:10:21 2018 @@ -1,4 +1,4 @@ -breakpoint set -f hello.c -p Hello +breakpoint set -f hello.cpp -p Hello run script print(lldb.debugger) script print(lldb.target) Removed: lldb/trunk/lit/Driver/Inputs/hello.c URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Driver/Inputs/hello.c?rev=349641&view=auto == --- lldb/trunk/lit/Driver/Inputs/hello.c (original) +++ lldb/trunk/lit/Driver/Inputs/hello.c (removed) @@ -1,6 +0,0 @@ -int printf(const char *format, ...); - -int main(int argc, char **argv) { - printf("Hello World\n"); - return 0; -} Added: lldb/trunk/lit/Driver/Inputs/hello.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Driver/Inputs/hello.cpp?rev=349642&view=auto == --- lldb/trunk/lit/Driver/Inputs/hello.cpp (added) +++ lldb/trunk/lit/Driver/Inputs/hello.cpp Wed Dec 19 09:10:21 2018 @@ -0,0 +1,11 @@ +// The build.py script always runs the compiler in C++ mode, regardless of the +// file extension. This results in mangled names presented to the linker which +// in turn cannot find the printf symbol. +extern "C" { +int printf(const char *format, ...); + +int main(int argc, char **argv) { + printf("Hello World\n"); + return 0; +} +} Modified: lldb/trunk/lit/Driver/TestConvenienceVariables.test URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Driver/TestConvenienceVariables.test?rev=349642&r1=349641&r2=349642&view=diff == --- lldb/trunk/lit/Driver/TestConvenienceVariables.test (original) +++ lldb/trunk/lit/Driver/TestConvenienceVariables.test Wed Dec 19 09:10:21 2018 @@ -1,4 +1,4 @@ -RUN: %build %p/Inputs/hello.c -o %t +RUN: %build %p/Inputs/hello.cpp -o %t RUN: %lldb %t -s %p/Inputs/convenience.in -o quit | FileCheck %s script print(lldb.debugger) @@ -15,7 +15,7 @@ CHECK-SAME: executable = TestConve CHECK: script print(lldb.thread.GetStopDescription(100)) CHECK: breakpoint 1.1 CHECK: script lldb.frame.GetLineEntry().GetLine() -CHECK: 4 +CHECK: 8 CHECK: script lldb.frame.GetLineEntry().GetFileSpec().GetFilename() CHECK: hello.c CHECK: script lldb.frame.GetFunctionName() ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r349818 - [dotest] Consider unexpected passes as failures.
Author: jdevlieghere Date: Thu Dec 20 12:44:23 2018 New Revision: 349818 URL: http://llvm.org/viewvc/llvm-project?rev=349818&view=rev Log: [dotest] Consider unexpected passes as failures. Unexpected successes should be considered failures because they can hide regressions when not addressed. When a test is fixed and not re-enabled, it can easily regress without us noticing. I couldn't find a good way to make this change other than changing it in the unittest2 framework. I know this is less than optimal but since we have the dependency checked in and the change is pretty fundamental to the framework I think it's not unreasonable. Differential revision: https://reviews.llvm.org/D55835 Modified: lldb/trunk/lit/Suite/lldbtest.py lldb/trunk/third_party/Python/module/unittest2/unittest2/result.py Modified: lldb/trunk/lit/Suite/lldbtest.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Suite/lldbtest.py?rev=349818&r1=349817&r2=349818&view=diff == --- lldb/trunk/lit/Suite/lldbtest.py (original) +++ lldb/trunk/lit/Suite/lldbtest.py Thu Dec 20 12:44:23 2018 @@ -94,11 +94,10 @@ class LLDBTest(TestFormat): litConfig.maxIndividualTestTime)) if exitCode: -return lit.Test.FAIL, out + err - -unexpected_test_line = 'XPASS' -if unexpected_test_line in out or unexpected_test_line in err: -return lit.Test.XPASS, '' +if 'FAIL:' in out or 'FAIL:' in err: +return lit.Test.FAIL, out + err +if 'XPASS:' in out or 'XPASS:' in err: +return lit.Test.XPASS, out + err passing_test_line = 'RESULT: PASSED' if passing_test_line not in out and passing_test_line not in err: Modified: lldb/trunk/third_party/Python/module/unittest2/unittest2/result.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/third_party/Python/module/unittest2/unittest2/result.py?rev=349818&r1=349817&r2=349818&view=diff == --- lldb/trunk/third_party/Python/module/unittest2/unittest2/result.py (original) +++ lldb/trunk/third_party/Python/module/unittest2/unittest2/result.py Thu Dec 20 12:44:23 2018 @@ -148,7 +148,9 @@ class TestResult(unittest.TestResult): def wasSuccessful(self): "Tells whether or not this result was a success" -return (len(self.failures) + len(self.errors) == 0) +return (len(self.failures) + +len(self.errors) + +len(self.unexpectedSuccesses) == 0) def stop(self): "Indicates that the tests should be aborted" ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r349821 - [API] Remove redundants get() from smart pointers. NFC
Author: jdevlieghere Date: Thu Dec 20 13:02:55 2018 New Revision: 349821 URL: http://llvm.org/viewvc/llvm-project?rev=349821&view=rev Log: [API] Remove redundants get() from smart pointers. NFC Removes redundant calls to ::get() from smart pointers in the source/API directory.. Modified: lldb/trunk/source/API/SBAddress.cpp lldb/trunk/source/API/SBBreakpointName.cpp lldb/trunk/source/API/SBCommandInterpreter.cpp lldb/trunk/source/API/SBCommandReturnObject.cpp lldb/trunk/source/API/SBDeclaration.cpp lldb/trunk/source/API/SBError.cpp lldb/trunk/source/API/SBFileSpec.cpp lldb/trunk/source/API/SBFileSpecList.cpp lldb/trunk/source/API/SBLineEntry.cpp lldb/trunk/source/API/SBMemoryRegionInfoList.cpp lldb/trunk/source/API/SBProcessInfo.cpp lldb/trunk/source/API/SBSourceManager.cpp lldb/trunk/source/API/SBStream.cpp lldb/trunk/source/API/SBStringList.cpp lldb/trunk/source/API/SBSymbolContext.cpp lldb/trunk/source/API/SBSymbolContextList.cpp lldb/trunk/source/API/SBType.cpp lldb/trunk/source/API/SBTypeEnumMember.cpp lldb/trunk/source/API/SBTypeSummary.cpp lldb/trunk/source/API/SBValueList.cpp lldb/trunk/source/API/SBVariablesOptions.cpp Modified: lldb/trunk/source/API/SBAddress.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBAddress.cpp?rev=349821&r1=349820&r2=349821&view=diff == --- lldb/trunk/source/API/SBAddress.cpp (original) +++ lldb/trunk/source/API/SBAddress.cpp Thu Dec 20 13:02:55 2018 @@ -62,7 +62,7 @@ bool lldb::operator==(const SBAddress &l } bool SBAddress::IsValid() const { - return m_opaque_ap.get() != NULL && m_opaque_ap->IsValid(); + return m_opaque_ap != NULL && m_opaque_ap->IsValid(); } void SBAddress::Clear() { m_opaque_ap.reset(new Address()); } @@ -156,7 +156,7 @@ Address *SBAddress::operator->() { retur const Address *SBAddress::operator->() const { return m_opaque_ap.get(); } Address &SBAddress::ref() { - if (m_opaque_ap.get() == NULL) + if (m_opaque_ap == NULL) m_opaque_ap.reset(new Address()); return *m_opaque_ap; } Modified: lldb/trunk/source/API/SBBreakpointName.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpointName.cpp?rev=349821&r1=349820&r2=349821&view=diff == --- lldb/trunk/source/API/SBBreakpointName.cpp (original) +++ lldb/trunk/source/API/SBBreakpointName.cpp Thu Dec 20 13:02:55 2018 @@ -164,11 +164,11 @@ const SBBreakpointName &SBBreakpointName } bool SBBreakpointName::operator==(const lldb::SBBreakpointName &rhs) { - return *m_impl_up.get() == *rhs.m_impl_up.get(); + return *m_impl_up == *rhs.m_impl_up; } bool SBBreakpointName::operator!=(const lldb::SBBreakpointName &rhs) { - return *m_impl_up.get() != *rhs.m_impl_up.get(); + return *m_impl_up != *rhs.m_impl_up; } bool SBBreakpointName::IsValid() const { Modified: lldb/trunk/source/API/SBCommandInterpreter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandInterpreter.cpp?rev=349821&r1=349820&r2=349821&view=diff == --- lldb/trunk/source/API/SBCommandInterpreter.cpp (original) +++ lldb/trunk/source/API/SBCommandInterpreter.cpp Thu Dec 20 13:02:55 2018 @@ -98,7 +98,7 @@ SBCommandInterpreterRunOptions::get() co lldb_private::CommandInterpreterRunOptions & SBCommandInterpreterRunOptions::ref() const { - return *m_opaque_up.get(); + return *m_opaque_up; } class CommandPluginInterfaceImplementation : public CommandObjectParsed { Modified: lldb/trunk/source/API/SBCommandReturnObject.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandReturnObject.cpp?rev=349821&r1=349820&r2=349821&view=diff == --- lldb/trunk/source/API/SBCommandReturnObject.cpp (original) +++ lldb/trunk/source/API/SBCommandReturnObject.cpp Thu Dec 20 13:02:55 2018 @@ -48,9 +48,7 @@ operator=(const SBCommandReturnObject &r return *this; } -bool SBCommandReturnObject::IsValid() const { - return m_opaque_ap.get() != nullptr; -} +bool SBCommandReturnObject::IsValid() const { return m_opaque_ap != nullptr; } const char *SBCommandReturnObject::GetOutput() { Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); Modified: lldb/trunk/source/API/SBDeclaration.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDeclaration.cpp?rev=349821&r1=349820&r2=349821&view=diff == --- lldb/trunk/source/API/SBDeclaration.cpp (original) +++ lldb/trunk/source/API/SBDeclaration.cpp Thu Dec 20 13:02:55 2018 @@ -75,7 +75,7 @@ uint32_t SBDeclaration::GetLine() const Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); uint32_t line =
[Lldb-commits] [lldb] r349858 - Fix stack-buffer-overflow in lldb_private::Host::FindProcesses
Author: jdevlieghere Date: Thu Dec 20 15:45:26 2018 New Revision: 349858 URL: http://llvm.org/viewvc/llvm-project?rev=349858&view=rev Log: Fix stack-buffer-overflow in lldb_private::Host::FindProcesses Found by the address sanitizer on GreenDragon: http://green.lab.llvm.org/green/view/LLDB/job/lldb-sanitized/1628/console Modified: lldb/trunk/source/Host/macosx/objcxx/Host.mm Modified: lldb/trunk/source/Host/macosx/objcxx/Host.mm URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/objcxx/Host.mm?rev=349858&r1=349857&r2=349858&view=diff == --- lldb/trunk/source/Host/macosx/objcxx/Host.mm (original) +++ lldb/trunk/source/Host/macosx/objcxx/Host.mm Thu Dec 20 15:45:26 2018 @@ -627,7 +627,7 @@ uint32_t Host::FindProcesses(const Proce int mib[3] = {CTL_KERN, KERN_PROC, KERN_PROC_ALL}; size_t pid_data_size = 0; - if (::sysctl(mib, 4, NULL, &pid_data_size, NULL, 0) != 0) + if (::sysctl(mib, 3, NULL, &pid_data_size, NULL, 0) != 0) return 0; // Add a few extra in case a few more show up ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r349869 - Fix stack-buffer-overflow in lldb_private::Host::FindProcesses (2/2)
Author: jdevlieghere Date: Thu Dec 20 17:22:58 2018 New Revision: 349869 URL: http://llvm.org/viewvc/llvm-project?rev=349869&view=rev Log: Fix stack-buffer-overflow in lldb_private::Host::FindProcesses (2/2) This fixes the second call at line 640 that I missed in r349858. Modified: lldb/trunk/source/Host/macosx/objcxx/Host.mm Modified: lldb/trunk/source/Host/macosx/objcxx/Host.mm URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/objcxx/Host.mm?rev=349869&r1=349868&r2=349869&view=diff == --- lldb/trunk/source/Host/macosx/objcxx/Host.mm (original) +++ lldb/trunk/source/Host/macosx/objcxx/Host.mm Thu Dec 20 17:22:58 2018 @@ -627,7 +627,7 @@ uint32_t Host::FindProcesses(const Proce int mib[3] = {CTL_KERN, KERN_PROC, KERN_PROC_ALL}; size_t pid_data_size = 0; - if (::sysctl(mib, 3, NULL, &pid_data_size, NULL, 0) != 0) + if (::sysctl(mib, 3, nullptr, &pid_data_size, nullptr, 0) != 0) return 0; // Add a few extra in case a few more show up @@ -637,7 +637,7 @@ uint32_t Host::FindProcesses(const Proce kinfos.resize(estimated_pid_count); pid_data_size = kinfos.size() * sizeof(struct kinfo_proc); - if (::sysctl(mib, 4, &kinfos[0], &pid_data_size, NULL, 0) != 0) + if (::sysctl(mib, 3, &kinfos[0], &pid_data_size, nullptr, 0) != 0) return 0; const size_t actual_pid_count = (pid_data_size / sizeof(struct kinfo_proc)); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r349967 - [ExpressionParser] Reserve size before copying over args
Author: jdevlieghere Date: Fri Dec 21 14:16:10 2018 New Revision: 349967 URL: http://llvm.org/viewvc/llvm-project?rev=349967&view=rev Log: [ExpressionParser] Reserve size before copying over args We already know the final size here so we might as well reserve it so we don't have to re-allocate during the loop. Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp?rev=349967&r1=349966&r2=349967&view=diff == --- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp (original) +++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp Fri Dec 21 14:16:10 2018 @@ -608,7 +608,8 @@ ClangModulesDeclVendor::Create(Target &t new StoringDiagnosticConsumer); std::vector compiler_invocation_argument_cstrs; - + compiler_invocation_argument_cstrs.reserve( + compiler_invocation_arguments.size()); for (const std::string &arg : compiler_invocation_arguments) { compiler_invocation_argument_cstrs.push_back(arg.c_str()); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r349972 - [NFC] Replace `compare` with (in)equality operator where applicable.
Author: jdevlieghere Date: Fri Dec 21 14:46:10 2018 New Revision: 349972 URL: http://llvm.org/viewvc/llvm-project?rev=349972&view=rev Log: [NFC] Replace `compare` with (in)equality operator where applicable. Using compare is verbose, bug prone and potentially inefficient (because of early termination). Replace relevant call sites with the (in)equality operator. Modified: lldb/trunk/source/Core/IOHandler.cpp lldb/trunk/source/Core/Module.cpp lldb/trunk/source/Host/common/XML.cpp lldb/trunk/source/Interpreter/CommandAlias.cpp lldb/trunk/source/Interpreter/CommandInterpreter.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Symbol/ClangASTContext.cpp lldb/trunk/source/Symbol/TypeList.cpp lldb/trunk/source/Symbol/TypeMap.cpp lldb/trunk/tools/debugserver/source/RNBRemote.cpp lldb/trunk/tools/lldb-mi/MICmdArgValConsume.cpp lldb/trunk/tools/lldb-mi/MIDriver.cpp lldb/trunk/tools/lldb-mi/MIDriverMgr.cpp Modified: lldb/trunk/source/Core/IOHandler.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/IOHandler.cpp?rev=349972&r1=349971&r2=349972&view=diff == --- lldb/trunk/source/Core/IOHandler.cpp (original) +++ lldb/trunk/source/Core/IOHandler.cpp Fri Dec 21 14:46:10 2018 @@ -1052,7 +1052,7 @@ public: Windows::iterator pos, end = m_subwindows.end(); size_t i = 0; for (pos = m_subwindows.begin(); pos != end; ++pos, ++i) { - if ((*pos)->m_name.compare(name) == 0) + if ((*pos)->m_name == name) return *pos; } return WindowSP(); Modified: lldb/trunk/source/Core/Module.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=349972&r1=349971&r2=349972&view=diff == --- lldb/trunk/source/Core/Module.cpp (original) +++ lldb/trunk/source/Core/Module.cpp Fri Dec 21 14:46:10 2018 @@ -783,7 +783,7 @@ void Module::LookupInfo::Prune(SymbolCon qualified_name = cpp_method.GetBasename().str(); else qualified_name = cpp_method.GetScopeQualifiedName(); -if (qualified_name.compare(m_name.GetCString()) != 0) { +if (qualified_name != m_name.GetCString()) { sc_list.RemoveContextAtIndex(i); continue; } Modified: lldb/trunk/source/Host/common/XML.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/XML.cpp?rev=349972&r1=349971&r2=349972&view=diff == --- lldb/trunk/source/Host/common/XML.cpp (original) +++ lldb/trunk/source/Host/common/XML.cpp Fri Dec 21 14:46:10 2018 @@ -438,7 +438,7 @@ XMLNode ApplePropertyList::GetValueNode( "key", [key, &value_node](const XMLNode &key_node) -> bool { std::string key_name; if (key_node.GetElementText(key_name)) { -if (key_name.compare(key) == 0) { +if (key_name == key) { value_node = key_node.GetSibling(); while (value_node && !value_node.IsElement()) value_node = value_node.GetSibling(); Modified: lldb/trunk/source/Interpreter/CommandAlias.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandAlias.cpp?rev=349972&r1=349971&r2=349972&view=diff == --- lldb/trunk/source/Interpreter/CommandAlias.cpp (original) +++ lldb/trunk/source/Interpreter/CommandAlias.cpp Fri Dec 21 14:46:10 2018 @@ -158,8 +158,7 @@ void CommandAlias::GetAliasExpansion(Str help_string.Printf(" %s", value.c_str()); } else { help_string.Printf(" %s", opt.c_str()); - if ((value.compare("") != 0) && - (value.compare("http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=349972&r1=349971&r2=349972&view=diff == --- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original) +++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Fri Dec 21 14:46:10 2018 @@ -1393,7 +1393,7 @@ CommandObject *CommandInterpreter::Build alias_cmd_obj = desugared.first.get(); std::string alias_name_str = alias_name; if ((cmd_args.GetArgumentCount() == 0) || - (alias_name_str.compare(cmd_args.GetArgumentAtIndex(0)) != 0)) + (alias_name_str != cmd_args.GetArgumentAtIndex(0))) cmd_args.Unshift(alias_name_str); result_str.Printf("%s", alias_cmd_obj->GetCommandName().str().c_str()); @@ -1937,7 +1937,7 @@ void CommandInterpreter::BuildAliasComma // Make sure that the alias name is the 0th element in cmd_args std::s
[Lldb-commits] [lldb] r350160 - [test] Remove flakiness decorator from TestObjCDynamicSBType
Author: jdevlieghere Date: Sat Dec 29 22:10:03 2018 New Revision: 350160 URL: http://llvm.org/viewvc/llvm-project?rev=350160&view=rev Log: [test] Remove flakiness decorator from TestObjCDynamicSBType The quoted bug report (llvm.org/PR20270) was closed in 2014. Modified: lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-function/TestCallStopAndContinue.py Modified: lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-function/TestCallStopAndContinue.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-function/TestCallStopAndContinue.py?rev=350160&r1=350159&r2=350160&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-function/TestCallStopAndContinue.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-function/TestCallStopAndContinue.py Sat Dec 29 22:10:03 2018 @@ -6,7 +6,6 @@ from __future__ import print_function import lldb -from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil @@ -24,7 +23,6 @@ class ExprCommandCallStopContinueTestCas '// Please test these expressions while stopped at this line:') self.func_line = line_number('main.cpp', '{5, "five"}') -@expectedFlakeyDarwin("llvm.org/pr20274") def test(self): """Test gathering result from interrupted function call.""" self.build() ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [lldb] r350160 - [test] Remove flakiness decorator from TestObjCDynamicSBType
On Sun, Dec 30, 2018 at 05:33 Davide Italiano wrote: > Nice, thanks! > There is a typo in the commit message, I assume? > Correct, I made a typo in the PR and then mindlessly copied the name of the test. > > > On Sun, Dec 30, 2018 at 7:13 AM Jonas Devlieghere via lldb-commits > wrote: > > > > Author: jdevlieghere > > Date: Sat Dec 29 22:10:03 2018 > > New Revision: 350160 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=350160&view=rev > > Log: > > [test] Remove flakiness decorator from TestObjCDynamicSBType > > > > The quoted bug report (llvm.org/PR20270) was closed in 2014. > > > > Modified: > > > > lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-function/TestCallStopAndContinue.py > > > > Modified: > lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-function/TestCallStopAndContinue.py > > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-function/TestCallStopAndContinue.py?rev=350160&r1=350159&r2=350160&view=diff > > > == > > --- > lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-function/TestCallStopAndContinue.py > (original) > > +++ > lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-function/TestCallStopAndContinue.py > Sat Dec 29 22:10:03 2018 > > @@ -6,7 +6,6 @@ from __future__ import print_function > > > > > > import lldb > > -from lldbsuite.test.decorators import * > > from lldbsuite.test.lldbtest import * > > from lldbsuite.test import lldbutil > > > > @@ -24,7 +23,6 @@ class ExprCommandCallStopContinueTestCas > > '// Please test these expressions while stopped at this > line:') > > self.func_line = line_number('main.cpp', '{5, "five"}') > > > > -@expectedFlakeyDarwin("llvm.org/pr20274") > > def test(self): > > """Test gathering result from interrupted function call.""" > > self.build() > > > > > > ___ > > lldb-commits mailing list > > lldb-commits@lists.llvm.org > > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits > -- Sent from my iPhone ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r350166 - [CommandInterpreter] Simplify PreprocessCommand. (NFCI)
Author: jdevlieghere Date: Sun Dec 30 09:56:30 2018 New Revision: 350166 URL: http://llvm.org/viewvc/llvm-project?rev=350166&view=rev Log: [CommandInterpreter] Simplify PreprocessCommand. (NFCI) Simplify some code in PreprocessCommand. This change improves consistency, reduces the indentation and makes the code easier to follow overall. Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=350166&r1=350165&r2=350166&view=diff == --- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original) +++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Sun Dec 30 09:56:30 2018 @@ -1455,130 +1455,140 @@ Status CommandInterpreter::PreprocessCom size_t start_backtick; size_t pos = 0; while ((start_backtick = command.find('`', pos)) != std::string::npos) { +// Stop if an error was encountered during the previous iteration. +if (error.Fail()) + break; + if (start_backtick > 0 && command[start_backtick - 1] == '\\') { // The backtick was preceded by a '\' character, remove the slash and - // don't treat the backtick as the start of an expression + // don't treat the backtick as the start of an expression. command.erase(start_backtick - 1, 1); - // No need to add one to start_backtick since we just deleted a char + // No need to add one to start_backtick since we just deleted a char. pos = start_backtick; -} else { - const size_t expr_content_start = start_backtick + 1; - const size_t end_backtick = command.find('`', expr_content_start); - if (end_backtick == std::string::npos) -return error; - else if (end_backtick == expr_content_start) { -// Empty expression (two backticks in a row) -command.erase(start_backtick, 2); - } else { -std::string expr_str(command, expr_content_start, - end_backtick - expr_content_start); + continue; +} + +const size_t expr_content_start = start_backtick + 1; +const size_t end_backtick = command.find('`', expr_content_start); + +if (end_backtick == std::string::npos) { + // Stop if there's no end backtick. + break; +} + +if (end_backtick == expr_content_start) { + // Skip over empty expression. (two backticks in a row) + command.erase(start_backtick, 2); + continue; +} + +std::string expr_str(command, expr_content_start, + end_backtick - expr_content_start); + +ExecutionContext exe_ctx(GetExecutionContext()); +Target *target = exe_ctx.GetTargetPtr(); + +// Get a dummy target to allow for calculator mode while processing +// backticks. This also helps break the infinite loop caused when target is +// null. +if (!target) + target = m_debugger.GetDummyTarget(); + +if (!target) + continue; + +ValueObjectSP expr_result_valobj_sp; + +EvaluateExpressionOptions options; +options.SetCoerceToId(false); +options.SetUnwindOnError(true); +options.SetIgnoreBreakpoints(true); +options.SetKeepInMemory(false); +options.SetTryAllThreads(true); +options.SetTimeout(llvm::None); + +ExpressionResults expr_result = +target->EvaluateExpression(expr_str.c_str(), exe_ctx.GetFramePtr(), + expr_result_valobj_sp, options); -ExecutionContext exe_ctx(GetExecutionContext()); -Target *target = exe_ctx.GetTargetPtr(); -// Get a dummy target to allow for calculator mode while processing -// backticks. This also helps break the infinite loop caused when -// target is null. -if (!target) - target = m_debugger.GetDummyTarget(); -if (target) { - ValueObjectSP expr_result_valobj_sp; - - EvaluateExpressionOptions options; - options.SetCoerceToId(false); - options.SetUnwindOnError(true); - options.SetIgnoreBreakpoints(true); - options.SetKeepInMemory(false); - options.SetTryAllThreads(true); - options.SetTimeout(llvm::None); - - ExpressionResults expr_result = target->EvaluateExpression( - expr_str.c_str(), exe_ctx.GetFramePtr(), expr_result_valobj_sp, - options); - - if (expr_result == eExpressionCompleted) { -Scalar scalar; -if (expr_result_valobj_sp) - expr_result_valobj_sp = - expr_result_valobj_sp->GetQualifiedRepresentationIfAvailable( - expr_result_valobj_sp->GetDynamicValueType(), true); -if (expr_result_valobj_sp->ResolveValue(scalar)) { - command.erase(start_backtick, end_backtick - start_backtick + 1); - StreamString valu
[Lldb-commits] [lldb] r350267 - [Driver] Remove unused imports
Author: jdevlieghere Date: Wed Jan 2 14:38:16 2019 New Revision: 350267 URL: http://llvm.org/viewvc/llvm-project?rev=350267&view=rev Log: [Driver] Remove unused imports Removes some unneeded includes from the driver. Modified: lldb/trunk/tools/driver/Driver.cpp Modified: lldb/trunk/tools/driver/Driver.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=350267&r1=350266&r2=350267&view=diff == --- lldb/trunk/tools/driver/Driver.cpp (original) +++ lldb/trunk/tools/driver/Driver.cpp Wed Jan 2 14:38:16 2019 @@ -9,20 +9,13 @@ #include "Driver.h" -#include "lldb/API/SBBreakpoint.h" #include "lldb/API/SBCommandInterpreter.h" #include "lldb/API/SBCommandReturnObject.h" -#include "lldb/API/SBCommunication.h" #include "lldb/API/SBDebugger.h" -#include "lldb/API/SBEvent.h" #include "lldb/API/SBHostOS.h" #include "lldb/API/SBLanguageRuntime.h" -#include "lldb/API/SBListener.h" -#include "lldb/API/SBProcess.h" #include "lldb/API/SBStream.h" #include "lldb/API/SBStringList.h" -#include "lldb/API/SBTarget.h" -#include "lldb/API/SBThread.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/ConvertUTF.h" ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r350446 - [Driver] Some more cleanup. NFC
Author: jdevlieghere Date: Fri Jan 4 16:01:04 2019 New Revision: 350446 URL: http://llvm.org/viewvc/llvm-project?rev=350446&view=rev Log: [Driver] Some more cleanup. NFC Modified: lldb/trunk/tools/driver/Driver.cpp lldb/trunk/tools/driver/Driver.h Modified: lldb/trunk/tools/driver/Driver.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=350446&r1=350445&r2=350446&view=diff == --- lldb/trunk/tools/driver/Driver.cpp (original) +++ lldb/trunk/tools/driver/Driver.cpp Fri Jan 4 16:01:04 2019 @@ -69,7 +69,7 @@ enum ID { #include "Options.inc" #undef PREFIX -static const opt::OptTable::Info InfoTable[] = { +const opt::OptTable::Info InfoTable[] = { #define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM, \ HELPTEXT, METAVAR, VALUES) \ { \ @@ -91,7 +91,7 @@ static void reset_stdin_termios(); static bool g_old_stdin_termios_is_valid = false; static struct termios g_old_stdin_termios; -static Driver *g_driver = NULL; +static Driver *g_driver = nullptr; // In the Driver::MainLoop, we change the terminal settings. This function is // added as an atexit handler to make sure we clean them up. @@ -103,15 +103,14 @@ static void reset_stdin_termios() { } Driver::Driver() -: SBBroadcaster("Driver"), m_debugger(SBDebugger::Create(false)), - m_option_data() { +: SBBroadcaster("Driver"), m_debugger(SBDebugger::Create(false)) { // We want to be able to handle CTRL+D in the terminal to have it terminate // certain input m_debugger.SetCloseInputOnEOF(false); g_driver = this; } -Driver::~Driver() { g_driver = NULL; } +Driver::~Driver() { g_driver = nullptr; } void Driver::OptionData::AddLocalLLDBInit() { // If there is a local .lldbinit, add that to the list of things to be @@ -165,13 +164,13 @@ void Driver::OptionData::AddInitialComma const char *Driver::GetFilename() const { if (m_option_data.m_args.empty()) -return NULL; +return nullptr; return m_option_data.m_args.front().c_str(); } const char *Driver::GetCrashLogFilename() const { if (m_option_data.m_crash_log.empty()) -return NULL; +return nullptr; return m_option_data.m_crash_log.c_str(); } @@ -202,7 +201,7 @@ void Driver::WriteCommandsForSourcing(Co // file in the current working directory), only read it if // target.load-cwd-lldbinit is 'true'. if (command_entry.is_cwd_lldbinit_file_read) { -SBStringList strlist = m_debugger.GetInternalVariableValue( +SBStringList strlist = lldb::SBDebugger::GetInternalVariableValue( "target.load-cwd-lldbinit", m_debugger.GetInstanceName()); if (strlist.GetSize() == 1 && strcmp(strlist.GetStringAtIndex(0), "warn") == 0) { @@ -229,7 +228,8 @@ void Driver::WriteCommandsForSourcing(Co } bool source_quietly = m_option_data.m_source_quietly || command_entry.source_quietly; - strm.Printf("command source -s %i '%s'\n", source_quietly, command); + strm.Printf("command source -s %i '%s'\n", + static_cast(source_quietly), command); } else strm.Printf("%s\n", command); } @@ -296,11 +296,11 @@ SBError Driver::ProcessArgs(const opt::I auto arg_value = arg->getValue(); SBFileSpec file(arg_value); if (file.Exists()) { - m_option_data.m_args.push_back(arg_value); + m_option_data.m_args.emplace_back(arg_value); } else if (file.ResolveExecutableLocation()) { char path[PATH_MAX]; file.GetPath(path, sizeof(path)); - m_option_data.m_args.push_back(path); + m_option_data.m_args.emplace_back(path); } else { error.SetErrorStringWithFormat( "file specified in --file (-f) option doesn't exist: '%s'", @@ -311,7 +311,7 @@ SBError Driver::ProcessArgs(const opt::I if (auto *arg = args.getLastArg(OPT_arch)) { auto arg_value = arg->getValue(); -if (!m_debugger.SetDefaultArchitecture(arg_value)) { +if (!lldb::SBDebugger::SetDefaultArchitecture(arg_value)) { error.SetErrorStringWithFormat( "invalid architecture in the -a or --arch option: '%s'", arg_value); return error; @@ -439,14 +439,14 @@ SBError Driver::ProcessArgs(const opt::I // Any argument following -- is an argument for the inferior. if (auto *arg = args.getLastArgNoClaim(OPT_REM)) { for (auto value : arg->getValues()) -m_option_data.m_args.push_back(value); +m_option_data.m_args.emplace_back(value); } - } else if (args.getLastArgNoClaim()) { + } else if (args.getLastArgNoClaim() != nullptr) { WithColor::warning() << "program arguments are ignored when attaching.\n"; } if (m_option_data.m_print_version) { -llvm::outs() << m_debugger.GetVer
[Lldb-commits] [lldb] r350599 - [SymbolContext] Remove dead code
Author: jdevlieghere Date: Mon Jan 7 17:35:00 2019 New Revision: 350599 URL: http://llvm.org/viewvc/llvm-project?rev=350599&view=rev Log: [SymbolContext] Remove dead code Removes two methods from SymbolContextList that aren't referenced. Modified: lldb/trunk/include/lldb/Symbol/SymbolContext.h lldb/trunk/source/Symbol/SymbolContext.cpp Modified: lldb/trunk/include/lldb/Symbol/SymbolContext.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolContext.h?rev=350599&r1=350598&r2=350599&view=diff == --- lldb/trunk/include/lldb/Symbol/SymbolContext.h (original) +++ lldb/trunk/include/lldb/Symbol/SymbolContext.h Mon Jan 7 17:35:00 2019 @@ -228,7 +228,7 @@ public: bool GetAddressRangeFromHereToEndLine(uint32_t end_line, AddressRange &range, Status &error); - + //-- /// Find the best global data symbol visible from this context. /// @@ -465,10 +465,6 @@ public: bool AppendIfUnique(const SymbolContext &sc, bool merge_symbol_into_function); - bool MergeSymbolContextIntoFunctionContext(const SymbolContext &symbol_sc, - uint32_t start_idx = 0, - uint32_t stop_idx = UINT32_MAX); - uint32_t AppendIfUnique(const SymbolContextList &sc_list, bool merge_symbol_into_function); @@ -527,18 +523,6 @@ public: return m_symbol_contexts[idx]; } - //-- - /// Get accessor for the last symbol context in the list. - /// - /// @param[out] sc - /// A reference to the symbol context to fill in. - /// - /// @return - /// Returns \b true if \a sc was filled in, \b false if the - /// list is empty. - //-- - bool GetLastContext(SymbolContext &sc) const; - bool RemoveContextAtIndex(size_t idx); //-- Modified: lldb/trunk/source/Symbol/SymbolContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolContext.cpp?rev=350599&r1=350598&r2=350599&view=diff == --- lldb/trunk/source/Symbol/SymbolContext.cpp (original) +++ lldb/trunk/source/Symbol/SymbolContext.cpp Mon Jan 7 17:35:00 2019 @@ -796,14 +796,14 @@ bool SymbolContext::GetAddressRangeFromH const Symbol * SymbolContext::FindBestGlobalDataSymbol(const ConstString &name, Status &error) { error.Clear(); - + if (!target_sp) { return nullptr; } - + Target &target = *target_sp; Module *module = module_sp.get(); - + auto ProcessMatches = [this, &name, &target, module] (SymbolContextList &sc_list, Status &error) -> const Symbol* { llvm::SmallVector external_symbols; @@ -815,7 +815,7 @@ SymbolContext::FindBestGlobalDataSymbol( if (sym_ctx.symbol) { const Symbol *symbol = sym_ctx.symbol; const Address sym_address = symbol->GetAddress(); - + if (sym_address.IsValid()) { switch (symbol->GetType()) { case eSymbolTypeData: @@ -860,12 +860,12 @@ SymbolContext::FindBestGlobalDataSymbol( if (name == symbol->GetReExportedSymbolName() && module == reexport_module_sp.get()) return nullptr; - + return FindBestGlobalDataSymbol( symbol->GetReExportedSymbolName(), error); } } break; - + case eSymbolTypeCode: // We already lookup functions elsewhere case eSymbolTypeVariable: case eSymbolTypeLocal: @@ -893,7 +893,7 @@ SymbolContext::FindBestGlobalDataSymbol( } } } - + if (external_symbols.size() > 1) { StreamString ss; ss.Printf("Multiple external symbols found for '%s'\n", name.AsCString()); @@ -920,32 +920,32 @@ SymbolContext::FindBestGlobalDataSymbol( return nullptr; } }; - + if (module) { SymbolContextList sc_list; module->FindSymbolsWithNameAndType(name, eSymbolTypeAny, sc_list); const Symbol *const module_symbol = ProcessMatches(sc_list, error); - + if (!error.Success()) { return nullptr; } else if (module_symbol) { return module_symbol; } } - + { SymbolContextList sc_list; target.GetImages().FindSymbolsWithNameAndType(name, eSymbolTypeAny, sc_list); const Symbol *const target_symbol = ProcessMatches(sc_list, error); - + if (!error.Success()) { return nullptr; } else if (target_symbol) { return target_symbol; }
[Lldb-commits] [lldb] r350652 - [PdbAstBuilder] Remove unused functions
Author: jdevlieghere Date: Tue Jan 8 12:58:54 2019 New Revision: 350652 URL: http://llvm.org/viewvc/llvm-project?rev=350652&view=rev Log: [PdbAstBuilder] Remove unused functions PdbAstBuilder.cpp:273:20: warning: unused function 'GetParentUniqueName' [-Wunused-function] PdbAstBuilder.cpp:267:13: warning: unused function 'IsUniqueNameEnumTag' [-Wunused-function] Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp?rev=350652&r1=350651&r2=350652&view=diff == --- lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp Tue Jan 8 12:58:54 2019 @@ -264,23 +264,6 @@ PdbAstBuilder::CreateDeclInfoForType(con return {context, uname}; } -static bool IsUniqueNameEnumTag(llvm::StringRef unique_name) { - if (unique_name.size() < 4) -return false; - return unique_name[3] == 'W'; -} - -static std::string GetParentUniqueName(llvm::StringRef unique_name) { - if (unique_name.size() < 4) -return unique_name; - size_t start = IsUniqueNameEnumTag(unique_name) ? 5 : 4; - size_t end = unique_name.find('@'); - if (end == llvm::StringRef::npos) -return unique_name; - std::string result = unique_name.str(); - return result.erase(start, end - start + 1); -} - void PdbAstBuilder::BuildParentMap() { LazyRandomTypeCollection &types = m_index.tpi().typeCollection(); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r350659 - [BreakpointList] Simplify/modernize BreakpointList (NFC)
Author: jdevlieghere Date: Tue Jan 8 14:07:42 2019 New Revision: 350659 URL: http://llvm.org/viewvc/llvm-project?rev=350659&view=rev Log: [BreakpointList] Simplify/modernize BreakpointList (NFC) I was looking at the code in BreakpointList.cpp and found it deserved a quick cleanup. - Use std::vector instead of a std::list. - Extract duplicate code for notifying. - Remove code duplication when returning a const value. - Use range-based for loop. - Use early return in loops. Differential revision: https://reviews.llvm.org/D56425 Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointList.h lldb/trunk/source/Breakpoint/BreakpointList.cpp Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointList.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointList.h?rev=350659&r1=350658&r2=350659&view=diff == --- lldb/trunk/include/lldb/Breakpoint/BreakpointList.h (original) +++ lldb/trunk/include/lldb/Breakpoint/BreakpointList.h Tue Jan 8 14:07:42 2019 @@ -50,18 +50,6 @@ public: void Dump(Stream *s) const; //-- - /// Returns a shared pointer to the breakpoint with id \a breakID. - /// - /// @param[in] breakID - /// The breakpoint ID to seek for. - /// - /// @result - /// A shared pointer to the breakpoint. May contain a NULL pointer if the - /// breakpoint doesn't exist. - //-- - lldb::BreakpointSP FindBreakpointByID(lldb::break_id_t breakID); - - //-- /// Returns a shared pointer to the breakpoint with id \a breakID. Const /// version. /// @@ -72,7 +60,7 @@ public: /// A shared pointer to the breakpoint. May contain a NULL pointer if the /// breakpoint doesn't exist. //-- - const lldb::BreakpointSP FindBreakpointByID(lldb::break_id_t breakID) const; + lldb::BreakpointSP FindBreakpointByID(lldb::break_id_t breakID) const; //-- /// Returns a shared pointer to the breakpoint with index \a i. @@ -84,20 +72,7 @@ public: /// A shared pointer to the breakpoint. May contain a NULL pointer if the /// breakpoint doesn't exist. //-- - lldb::BreakpointSP GetBreakpointAtIndex(size_t i); - - //-- - /// Returns a shared pointer to the breakpoint with index \a i, const - /// version - /// - /// @param[in] i - /// The breakpoint index to seek for. - /// - /// @result - /// A shared pointer to the breakpoint. May contain a NULL pointer if the - /// breakpoint doesn't exist. - //-- - const lldb::BreakpointSP GetBreakpointAtIndex(size_t i) const; + lldb::BreakpointSP GetBreakpointAtIndex(size_t i) const; //-- /// Find all the breakpoints with a given name @@ -197,7 +172,7 @@ public: void GetListMutex(std::unique_lock &lock); protected: - typedef std::list bp_collection; + typedef std::vector bp_collection; bp_collection::iterator GetBreakpointIDIterator(lldb::break_id_t breakID); @@ -207,7 +182,7 @@ protected: std::recursive_mutex &GetMutex() const { return m_mutex; } mutable std::recursive_mutex m_mutex; - bp_collection m_breakpoints; // The breakpoint list, currently a list. + bp_collection m_breakpoints; lldb::break_id_t m_next_break_id; bool m_is_internal; Modified: lldb/trunk/source/Breakpoint/BreakpointList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointList.cpp?rev=350659&r1=350658&r2=350659&view=diff == --- lldb/trunk/source/Breakpoint/BreakpointList.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointList.cpp Tue Jan 8 14:07:42 2019 @@ -14,6 +14,13 @@ using namespace lldb; using namespace lldb_private; +static void NotifyChange(const BreakpointSP &bp, BreakpointEventType event) { + Target &target = bp->GetTarget(); + if (target.EventTypeHasListeners(Target::eBroadcastBitBreakpointChanged)) +target.BroadcastEvent(Target::eBroadcastBitBreakpointChanged, + new Breakpoint::BreakpointEventData(event, bp)); +} + BreakpointList::BreakpointList(bool is_internal) : m_mutex(), m_breakpoints(), m_next_break_id(0), m_is_internal(is_internal) {} @@ -22,37 +29,34 @@ BreakpointList::~BreakpointList() {} break_id_t BreakpointList::Add(BreakpointSP &bp_sp, bool notify) { std::lock_guard guard(m_mutex); + // Internal breakpoint IDs a
[Lldb-commits] [lldb] r350679 - Change std::sort to llvm::sort to detect non-determinism.
Author: jdevlieghere Date: Tue Jan 8 15:25:06 2019 New Revision: 350679 URL: http://llvm.org/viewvc/llvm-project?rev=350679&view=rev Log: Change std::sort to llvm::sort to detect non-determinism. LLVM added wrappers to std::sort (r327219) that randomly shuffle the container before sorting. The goal is to uncover non-determinism due to undefined sorting order of objects having the same key. This can be enabled with -DLLVM_ENABLE_EXPENSIVE_CHECKS=ON. Modified: lldb/trunk/include/lldb/Core/UniqueCStringMap.h lldb/trunk/source/Breakpoint/BreakpointResolver.cpp lldb/trunk/source/Commands/CommandObjectType.cpp lldb/trunk/source/Interpreter/OptionValueArray.cpp lldb/trunk/source/Interpreter/OptionValueFileSpecLIst.cpp lldb/trunk/source/Interpreter/OptionValuePathMappings.cpp lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.cpp lldb/trunk/source/Symbol/ArmUnwindInfo.cpp lldb/trunk/source/Symbol/CompileUnit.cpp lldb/trunk/source/Symbol/Function.cpp lldb/trunk/source/Symbol/Symtab.cpp lldb/trunk/source/Target/Target.cpp lldb/trunk/source/Utility/Timer.cpp Modified: lldb/trunk/include/lldb/Core/UniqueCStringMap.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/UniqueCStringMap.h?rev=350679&r1=350678&r2=350679&view=diff == --- lldb/trunk/include/lldb/Core/UniqueCStringMap.h (original) +++ lldb/trunk/include/lldb/Core/UniqueCStringMap.h Tue Jan 8 15:25:06 2019 @@ -217,7 +217,7 @@ public: // } // my_map.Sort(); //-- - void Sort() { std::sort(m_map.begin(), m_map.end()); } + void Sort() { llvm::sort(m_map.begin(), m_map.end()); } //-- // Since we are using a vector to contain our items it will always double its Modified: lldb/trunk/source/Breakpoint/BreakpointResolver.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolver.cpp?rev=350679&r1=350678&r2=350679&view=diff == --- lldb/trunk/source/Breakpoint/BreakpointResolver.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointResolver.cpp Tue Jan 8 15:25:06 2019 @@ -238,10 +238,10 @@ void BreakpointResolver::SetSCMatchesByL worklist_begin, worklist_end, [&](const SymbolContext &sc) { return SourceLoc(sc) < requested; }); // Sort the remaining entries by (line, column). - std::sort(worklist_begin, worklist_end, -[](const SymbolContext &a, const SymbolContext &b) { - return SourceLoc(a) < SourceLoc(b); -}); + llvm::sort(worklist_begin, worklist_end, + [](const SymbolContext &a, const SymbolContext &b) { + return SourceLoc(a) < SourceLoc(b); + }); // Filter out all locations with a source location after the closest match. if (worklist_begin != worklist_end) @@ -261,11 +261,11 @@ void BreakpointResolver::SetSCMatchesByL } // Sort by file address. -std::sort(worklist_begin, worklist_end, - [](const SymbolContext &a, const SymbolContext &b) { -return a.line_entry.range.GetBaseAddress().GetFileAddress() < - b.line_entry.range.GetBaseAddress().GetFileAddress(); - }); +llvm::sort(worklist_begin, worklist_end, + [](const SymbolContext &a, const SymbolContext &b) { + return a.line_entry.range.GetBaseAddress().GetFileAddress() < +b.line_entry.range.GetBaseAddress().GetFileAddress(); + }); // Go through and see if there are line table entries that are // contiguous, and if so keep only the first of the contiguous range. Modified: lldb/trunk/source/Commands/CommandObjectType.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectType.cpp?rev=350679&r1=350678&r2=350679&view=diff == --- lldb/trunk/source/Commands/CommandObjectType.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectType.cpp Tue Jan 8 15:25:06 2019 @@ -2907,7 +2907,7 @@ public: if (StackFrame *frame = m_exe_ctx.GetFramePtr()) { guessed_language = GuessLanguage(frame); if (guessed_language != eLanguageTypeUnknown) { -std::sort( +llvm::sort( languages.begin(), languages.end(), [guessed_language](Language *l
[Lldb-commits] [lldb] r350682 - [CMakeLists] Sort tools/CMakeLists.txt
Author: jdevlieghere Date: Tue Jan 8 16:31:30 2019 New Revision: 350682 URL: http://llvm.org/viewvc/llvm-project?rev=350682&view=rev Log: [CMakeLists] Sort tools/CMakeLists.txt Modified: lldb/trunk/tools/CMakeLists.txt Modified: lldb/trunk/tools/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/CMakeLists.txt?rev=350682&r1=350681&r2=350682&view=diff == --- lldb/trunk/tools/CMakeLists.txt (original) +++ lldb/trunk/tools/CMakeLists.txt Tue Jan 8 16:31:30 2019 @@ -1,13 +1,15 @@ -if (CMAKE_SYSTEM_NAME MATCHES "Darwin") - add_subdirectory(darwin-debug) - add_subdirectory(debugserver) -endif() add_subdirectory(argdumper) add_subdirectory(driver) +add_subdirectory(intel-features) add_subdirectory(lldb-mi) +add_subdirectory(lldb-test) add_subdirectory(lldb-vscode) + +if (CMAKE_SYSTEM_NAME MATCHES "Darwin") + add_subdirectory(darwin-debug) + add_subdirectory(debugserver) +endif() + if (LLDB_CAN_USE_LLDB_SERVER AND NOT SKIP_LLDB_SERVER_BUILD) add_subdirectory(lldb-server) endif() -add_subdirectory(intel-features) -add_subdirectory(lldb-test) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r332700 - Fix _NSCFBoolean data formatter.
Author: jdevlieghere Date: Fri May 18 02:14:45 2018 New Revision: 332700 URL: http://llvm.org/viewvc/llvm-project?rev=332700&view=rev Log: Fix _NSCFBoolean data formatter. In r265181 the test for the NSCFBoolean data formatter was removed. Later, in r279353 and r279446 a new implementation was provided for the formatter, which I believe never worked (and this wasn't caught because the test was never re-enabled). This commit fixes the bug and re-enables the old test case. Differential revision: https://reviews.llvm.org/D47014 Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py?rev=332700&r1=332699&r2=332700&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py Fri May 18 02:14:45 2018 @@ -186,16 +186,18 @@ class ObjCDataFormatterTestCase(TestBase def nsnumber_data_formatter_commands(self): # Now enable AppKit and check we are displaying Cocoa classes correctly -self.expect('frame variable num1 num2 num3 num5 num6 num7 num9', +self.expect('frame variable num1 num2 num3 num5 num6 num7 num8_Y num8_N num9', substrs=['(NSNumber *) num1 = ', ' (int)5', '(NSNumber *) num2 = ', ' (float)3.1', '(NSNumber *) num3 = ', ' (double)3.14', '(NSNumber *) num5 = ', ' (char)65', '(NSNumber *) num6 = ', ' (long)255', '(NSNumber *) num7 = ', '200', + '(NSNumber *) num8_Y = ', 'YES', + '(NSNumber *) num8_N = ', 'NO', '(NSNumber *) num9 = ', ' (short)-31616']) - + self.runCmd('frame variable num4', check=True) output = self.res.GetOutput() i128_handled_correctly = False Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=332700&r1=332699&r2=332700&view=diff == --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Fri May 18 02:14:45 2018 @@ -2525,14 +2525,14 @@ bool AppleObjCRuntimeV2::GetCFBooleanVal if (m_CFBoolean_values) return true; - static ConstString g_kCFBooleanFalse("kCFBooleanFalse"); - static ConstString g_kCFBooleanTrue("kCFBooleanTrue"); + static ConstString g_kCFBooleanFalse("__kCFBooleanFalse"); + static ConstString g_kCFBooleanTrue("__kCFBooleanTrue"); std::function get_symbol = [this](ConstString sym) -> lldb::addr_t { SymbolContextList sc_list; if (GetProcess()->GetTarget().GetImages().FindSymbolsWithNameAndType( -g_kCFBooleanFalse, lldb::eSymbolTypeData, sc_list) == 1) { +sym, lldb::eSymbolTypeData, sc_list) == 1) { SymbolContext sc; sc_list.GetContextAtIndex(0, sc); if (sc.symbol) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r333412 - [test] Fix --framework argument passed to dotest.
Author: jdevlieghere Date: Tue May 29 05:30:27 2018 New Revision: 333412 URL: http://llvm.org/viewvc/llvm-project?rev=333412&view=rev Log: [test] Fix --framework argument passed to dotest. The framework argument was broken when I removed the generator expressions upstream. I replaced $ with ${LLVM_LIBRARY_OUTPUT_INTDIR}) which is not correct. rdar://40534649 Modified: lldb/trunk/CMakeLists.txt lldb/trunk/test/CMakeLists.txt Modified: lldb/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=333412&r1=333411&r2=333412&view=diff == --- lldb/trunk/CMakeLists.txt (original) +++ lldb/trunk/CMakeLists.txt Tue May 29 05:30:27 2018 @@ -37,6 +37,11 @@ if(APPLE) add_definitions(-DLLDB_USE_OS_LOG) endif() +if(LLDB_BUILD_FRAMEWORK) + set(LLDB_FRAMEWORK_DIR +${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_FRAMEWORK_INSTALL_DIR}) +endif() + # add_subdirectory(include) add_subdirectory(docs) if (NOT LLDB_DISABLE_PYTHON) @@ -47,8 +52,7 @@ if (NOT LLDB_DISABLE_PYTHON) set(LLDB_PYTHON_TARGET_DIR ${LLDB_BINARY_DIR}/scripts) set(LLDB_WRAP_PYTHON ${LLDB_BINARY_DIR}/scripts/LLDBWrapPython.cpp) if(LLDB_BUILD_FRAMEWORK) -set(LLDB_PYTHON_TARGET_DIR - ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_FRAMEWORK_INSTALL_DIR}) +set(LLDB_PYTHON_TARGET_DIR ${LLDB_FRAMEWORK_DIR}) set(LLDB_WRAP_PYTHON ${LLDB_PYTHON_TARGET_DIR}/LLDBWrapPython.cpp) else() # Don't set -m when building the framework. Modified: lldb/trunk/test/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/CMakeLists.txt?rev=333412&r1=333411&r2=333412&view=diff == --- lldb/trunk/test/CMakeLists.txt (original) +++ lldb/trunk/test/CMakeLists.txt Tue May 29 05:30:27 2018 @@ -78,7 +78,7 @@ if(LLDB_CODESIGN_IDENTITY) endif() if(LLDB_BUILD_FRAMEWORK) - list(APPEND LLDB_TEST_COMMON_ARGS --framework ${LLVM_LIBRARY_OUTPUT_INTDIR}) + list(APPEND LLDB_TEST_COMMON_ARGS --framework ${LLDB_FRAMEWORK_DIR}/LLDB.framework) endif() if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows|Darwin") ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r333432 - [lit] Add support for passing arguments to dotest.py via lit.
Author: jdevlieghere Date: Tue May 29 09:49:07 2018 New Revision: 333432 URL: http://llvm.org/viewvc/llvm-project?rev=333432&view=rev Log: [lit] Add support for passing arguments to dotest.py via lit. The lldb test suite is highly configurable. While part of this configuration takes place at configure/build-time, a common scenario involves running the test suite several times with different configuration. For example, we might want to test the current lldb against inferiors built with different compilers. This configuration was already possible for lldb-dotest, but was lacking for the lit counterpart. It is now possible to pass arguments to pass arguments like this: ./bin/llvm-lit ../llvm/tools/lldb/lit/Suite/ -Ddotest-args="-foo;-bar" Modified: lldb/trunk/lit/Suite/lit.site.cfg.in Modified: lldb/trunk/lit/Suite/lit.site.cfg.in URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Suite/lit.site.cfg.in?rev=333432&r1=333431&r2=333432&view=diff == --- lldb/trunk/lit/Suite/lit.site.cfg.in (original) +++ lldb/trunk/lit/Suite/lit.site.cfg.in Tue May 29 09:49:07 2018 @@ -14,6 +14,14 @@ config.python_executable = "@PYTHON_EXEC config.dotest_path = "@LLDB_SOURCE_DIR@/test/dotest.py" config.dotest_args_str = "@LLDB_DOTEST_ARGS@" + +# Additional dotest arguments can be passed to lit by providing a +# semicolon-separates list: --param dotest-args="arg;arg". +dotest_lit_args_str = lit_config.params.get('dotest-args', None) +if dotest_lit_args_str: +config.dotest_args_str += ';' +config.dotest_args_str += dotest_lit_args_str + # Support substitution of the tools and libs dirs with user parameters. This is # used when we can't determine the tool dir at configuration time. try: ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r333540 - [FileSpec] Re-implmenet removeLastPathComponent
Author: jdevlieghere Date: Wed May 30 06:03:16 2018 New Revision: 333540 URL: http://llvm.org/viewvc/llvm-project?rev=333540&view=rev Log: [FileSpec] Re-implmenet removeLastPathComponent When reading DBGSourcePathRemapping from a dSYM, we remove the last two path components to make the source lookup more general. However, when dealing with a relative path that has less than 2 components, we ended up with an invalid (empty) FileSpec. This patch changes the behavior of removeLastPathComponent to remove the last path component, if possible. It does this by checking whether a parent path exists, and if so using that as the new path. We rely entirely on LLVM's path implementation to do the heavy lifting. We now also return a boolean which indicates whether the operator was successful or not. Differential revision: https://reviews.llvm.org/D47495 rdar://37791687 Modified: lldb/trunk/include/lldb/Utility/FileSpec.h lldb/trunk/source/Utility/FileSpec.cpp lldb/trunk/unittests/Utility/FileSpecTest.cpp Modified: lldb/trunk/include/lldb/Utility/FileSpec.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/FileSpec.h?rev=333540&r1=333539&r2=333540&view=diff == --- lldb/trunk/include/lldb/Utility/FileSpec.h (original) +++ lldb/trunk/include/lldb/Utility/FileSpec.h Wed May 30 06:03:16 2018 @@ -532,7 +532,14 @@ public: void AppendPathComponent(llvm::StringRef component); void AppendPathComponent(const FileSpec &new_path); - void RemoveLastPathComponent(); + //-- + /// Removes the last path component by replacing the current path with its + /// parent. When the current path has no parent, this is a no-op. + /// + /// @return + /// A boolean value indicating whether the path was updated. + //-- + bool RemoveLastPathComponent(); ConstString GetLastPathComponent() const; Modified: lldb/trunk/source/Utility/FileSpec.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/FileSpec.cpp?rev=333540&r1=333539&r2=333540&view=diff == --- lldb/trunk/source/Utility/FileSpec.cpp (original) +++ lldb/trunk/source/Utility/FileSpec.cpp Wed May 30 06:03:16 2018 @@ -785,36 +785,15 @@ void FileSpec::AppendPathComponent(const return AppendPathComponent(new_path.GetPath(false)); } -void FileSpec::RemoveLastPathComponent() { - // CLEANUP: Use StringRef for string handling. - - const bool resolve = false; - if (m_filename.IsEmpty() && m_directory.IsEmpty()) { -SetFile("", resolve); -return; - } - if (m_directory.IsEmpty()) { -SetFile("", resolve); -return; +bool FileSpec::RemoveLastPathComponent() { + llvm::SmallString<64> current_path; + GetPath(current_path, false); + if (llvm::sys::path::has_parent_path(current_path, m_style)) { +SetFile(llvm::sys::path::parent_path(current_path, m_style), false, +m_style); +return true; } - if (m_filename.IsEmpty()) { -const char *dir_cstr = m_directory.GetCString(); -const char *last_slash_ptr = ::strrchr(dir_cstr, '/'); - -// check for obvious cases before doing the full thing -if (!last_slash_ptr) { - SetFile("", resolve); - return; -} -if (last_slash_ptr == dir_cstr) { - SetFile("/", resolve); - return; -} -size_t last_slash_pos = last_slash_ptr - dir_cstr + 1; -ConstString new_path(dir_cstr, last_slash_pos); -SetFile(new_path.GetCString(), resolve); - } else -SetFile(m_directory.GetCString(), resolve); + return false; } //-- /// Returns true if the filespec represents an implementation source Modified: lldb/trunk/unittests/Utility/FileSpecTest.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/FileSpecTest.cpp?rev=333540&r1=333539&r2=333540&view=diff == --- lldb/trunk/unittests/Utility/FileSpecTest.cpp (original) +++ lldb/trunk/unittests/Utility/FileSpecTest.cpp Wed May 30 06:03:16 2018 @@ -320,3 +320,44 @@ TEST(FileSpecTest, IsRelative) { } } +TEST(FileSpecTest, RemoveLastPathComponent) { + FileSpec fs_posix("/foo/bar/baz", false, FileSpec::Style::posix); + EXPECT_STREQ("/foo/bar/baz", fs_posix.GetCString()); + EXPECT_TRUE(fs_posix.RemoveLastPathComponent()); + EXPECT_STREQ("/foo/bar", fs_posix.GetCString()); + EXPECT_TRUE(fs_posix.RemoveLastPathComponent()); + EXPECT_STREQ("/foo", fs_posix.GetCString()); + EXPECT_TRUE(fs_posix.RemoveLastPathComponent()); + EXPECT_STREQ("/", fs_posix.GetCString()); + EXPECT_FALSE(fs_posix.RemoveLastPathComponent()); + EXPECT_STREQ("/", fs_posix.GetCString()); + + FileSpec fs_posix_relative("./foo/bar/baz", fals
[Lldb-commits] [lldb] r333666 - Remove infinite recursion due to FileSpec change.
Author: jdevlieghere Date: Thu May 31 09:28:29 2018 New Revision: 333666 URL: http://llvm.org/viewvc/llvm-project?rev=333666&view=rev Log: Remove infinite recursion due to FileSpec change. Fixes infinite recursion due to change in how FileSpec deals with removing the last path component. Fixes timout for TestMiniDumpNew.py Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp?rev=333666&r1=333665&r2=333666&view=diff == --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp (original) +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp Thu May 31 09:28:29 2018 @@ -1763,12 +1763,10 @@ PlatformDarwin::FindBundleBinaryInExecSe FileSpec platform_pull_apart(platform_file); std::vector path_parts; -ConstString unix_root_dir("/"); -while (true) { +path_parts.push_back( +platform_pull_apart.GetLastPathComponent().AsCString()); +while (platform_pull_apart.RemoveLastPathComponent()) { ConstString part = platform_pull_apart.GetLastPathComponent(); - platform_pull_apart.RemoveLastPathComponent(); - if (part.IsEmpty() || part == unix_root_dir) -break; path_parts.push_back(part.AsCString()); } const size_t path_parts_size = path_parts.size(); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r333974 - Fix Expression unittests on Darwin
Author: jdevlieghere Date: Mon Jun 4 17:32:41 2018 New Revision: 333974 URL: http://llvm.org/viewvc/llvm-project?rev=333974&view=rev Log: Fix Expression unittests on Darwin Fixes the Expression unittests on Darwin after r333933 was landed. Modified: lldb/trunk/unittests/Expression/CMakeLists.txt lldb/trunk/unittests/Expression/ClangParserTest.cpp Modified: lldb/trunk/unittests/Expression/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Expression/CMakeLists.txt?rev=333974&r1=333973&r2=333974&view=diff == --- lldb/trunk/unittests/Expression/CMakeLists.txt (original) +++ lldb/trunk/unittests/Expression/CMakeLists.txt Mon Jun 4 17:32:41 2018 @@ -4,6 +4,8 @@ add_lldb_unittest(ExpressionTests LINK_LIBS lldbCore -lldbPluginExpressionParserGo lldbPluginExpressionParserClang +lldbPluginExpressionParserGo +lldbUtility +lldbUtilityHelpers ) Modified: lldb/trunk/unittests/Expression/ClangParserTest.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Expression/ClangParserTest.cpp?rev=333974&r1=333973&r2=333974&view=diff == --- lldb/trunk/unittests/Expression/ClangParserTest.cpp (original) +++ lldb/trunk/unittests/Expression/ClangParserTest.cpp Mon Jun 4 17:32:41 2018 @@ -9,6 +9,7 @@ #include "Plugins/ExpressionParser/Clang/ClangHost.h" #include "TestingSupport/TestUtilities.h" +#include "lldb/Utility/FileSpec.h" #include "lldb/lldb-defines.h" #include "gtest/gtest.h" ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r334205 - [Platform] Accept arbitrary kext variants
Author: jdevlieghere Date: Thu Jun 7 09:10:42 2018 New Revision: 334205 URL: http://llvm.org/viewvc/llvm-project?rev=334205&view=rev Log: [Platform] Accept arbitrary kext variants When loading kexts in PlatformDarwinKernel, we use the BundleID as the filename to to create shared modules. In GetSharedModule we call ExamineKextForMatchingUUID for any BundleID it finds that is a match, to see if the UUID is also a match. Until now we were using Host::ResolveExecutableInBundle which calls a CoreFoundation API to obtain the executable. However, it's possible that the executable has a variant suffix (e.g. foo_development) and these files were ignored. This patch replaces that call with logic that looks for all the binaries in the bundle. Because of the way ExamineKextForMatchingUUID works, it's fine to try to load executables that are not valid and we can just iterate over the list until we found a match. Differential revision: https://reviews.llvm.org/D47539 Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp?rev=334205&r1=334204&r2=334205&view=diff == --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp (original) +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp Thu Jun 7 09:10:42 2018 @@ -779,35 +779,53 @@ Status PlatformDarwinKernel::GetSharedMo return error; } +std::vector +PlatformDarwinKernel::SearchForExecutablesRecursively(const ConstString &dir) { + std::vector executables; + std::error_code EC; + for (llvm::sys::fs::recursive_directory_iterator it(dir.GetStringRef(), EC), + end; + it != end && !EC; it.increment(EC)) { +auto status = it->status(); +if (!status) + break; +if (llvm::sys::fs::is_regular_file(*status) && +llvm::sys::fs::can_execute(it->path())) + executables.emplace_back(it->path(), false); + } + return executables; +} + Status PlatformDarwinKernel::ExamineKextForMatchingUUID( const FileSpec &kext_bundle_path, const lldb_private::UUID &uuid, const ArchSpec &arch, ModuleSP &exe_module_sp) { - Status error; - FileSpec exe_file = kext_bundle_path; - Host::ResolveExecutableInBundle(exe_file); - if (exe_file.Exists()) { -ModuleSpec exe_spec(exe_file); -exe_spec.GetUUID() = uuid; -if (!uuid.IsValid()) { - exe_spec.GetArchitecture() = arch; -} + for (const auto &exe_file : + SearchForExecutablesRecursively(kext_bundle_path.GetDirectory())) { +if (exe_file.Exists()) { + ModuleSpec exe_spec(exe_file); + exe_spec.GetUUID() = uuid; + if (!uuid.IsValid()) { +exe_spec.GetArchitecture() = arch; + } -// First try to create a ModuleSP with the file / arch and see if the UUID -// matches. If that fails (this exec file doesn't have the correct uuid), -// don't call GetSharedModule (which may call in to the DebugSymbols -// framework and therefore can be slow.) -ModuleSP module_sp(new Module(exe_spec)); -if (module_sp && module_sp->GetObjectFile() && -module_sp->MatchesModuleSpec(exe_spec)) { - error = ModuleList::GetSharedModule(exe_spec, exe_module_sp, NULL, NULL, - NULL); - if (exe_module_sp && exe_module_sp->GetObjectFile()) { -return error; + // First try to create a ModuleSP with the file / arch and see if the UUID + // matches. If that fails (this exec file doesn't have the correct uuid), + // don't call GetSharedModule (which may call in to the DebugSymbols + // framework and therefore can be slow.) + ModuleSP module_sp(new Module(exe_spec)); + if (module_sp && module_sp->GetObjectFile() && + module_sp->MatchesModuleSpec(exe_spec)) { +Status error = ModuleList::GetSharedModule(exe_spec, exe_module_sp, + NULL, NULL, NULL); +if (exe_module_sp && exe_module_sp->GetObjectFile()) { + return error; +} } + exe_module_sp.reset(); } -exe_module_sp.reset(); } - return error; + + return {}; } bool PlatformDarwinKernel::GetSupportedArchitectureAtIndex(uint32_t idx, Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h?rev=334205&r1=334204&r2=334205&view=diff == --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h (original) +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h Thu Jun 7 09:10:42 2018 @@ -127,6