[Lldb-commits] [PATCH] D48060: Introduce lldb-framework CMake target and centralize its logic
labath accepted this revision. labath added a comment. This revision is now accepted and ready to land. Looks good. I'm really happy with how this turned out. Thank you for your patience. https://reviews.llvm.org/D48060 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D48272: Replace HostInfo::GetLLDBPath with specific functions
labath created this revision. labath added reviewers: clayborg, zturner. Instead of a function taking an enum value determining which path to return, we now have a suite of functions, each returning a single path kind. This makes it easy to move the python-path function into a specific plugin in a follow-up commit. All the users of GetLLDBPath were converted to call specific functions instead. Most of them were hard-coding the enum value anyway, so this conversion was simple. The only exception was SBHostOS, which I've changed to use a switch on the incoming enum value. https://reviews.llvm.org/D48272 Files: include/lldb/Host/HostInfoBase.h source/API/SBHostOS.cpp source/Core/Debugger.cpp source/Core/PluginManager.cpp source/Expression/REPL.cpp source/Host/common/Host.cpp source/Host/common/HostInfoBase.cpp source/Host/macosx/objcxx/Host.mm source/Host/macosx/objcxx/HostInfoMacOSX.mm source/Host/posix/HostInfoPosix.cpp source/Host/posix/PipePosix.cpp source/Host/windows/Host.cpp source/Host/windows/HostInfoWindows.cpp source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp source/Plugins/ExpressionParser/Clang/ClangHost.cpp source/Plugins/Platform/MacOSX/PlatformDarwin.cpp source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp unittests/Target/ModuleCacheTest.cpp Index: unittests/Target/ModuleCacheTest.cpp === --- unittests/Target/ModuleCacheTest.cpp +++ unittests/Target/ModuleCacheTest.cpp @@ -68,8 +68,7 @@ HostInfo::Initialize(); ObjectFileELF::Initialize(); - FileSpec tmpdir_spec; - HostInfo::GetLLDBPath(lldb::ePathTypeLLDBTempSystemDir, s_cache_dir); + s_cache_dir = HostInfo::GetProcessTempDir(); s_test_executable = GetInputFilePath(module_name); } Index: source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp === --- source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -3094,14 +3094,13 @@ PyRun_SimpleString("import sys"); AddToSysPath(AddLocation::End, "."); - FileSpec file_spec; // Don't denormalize paths when calling file_spec.GetPath(). On platforms // that use a backslash as the path separator, this will result in executing // python code containing paths with unescaped backslashes. But Python also // accepts forward slashes, so to make life easier we just use that. - if (HostInfo::GetLLDBPath(ePathTypePythonDir, file_spec)) + if (FileSpec file_spec = HostInfo::GetPythonDir()) AddToSysPath(AddLocation::Beginning, file_spec.GetPath(false)); - if (HostInfo::GetLLDBPath(ePathTypeLLDBShlibDir, file_spec)) + if (FileSpec file_spec = HostInfo::GetShlibDir()) AddToSysPath(AddLocation::Beginning, file_spec.GetPath(false)); PyRun_SimpleString("sys.dont_write_bytecode = 1; import " Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp === --- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp +++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp @@ -534,7 +534,7 @@ if (domainsocket_dir_env != nullptr) g_domainsocket_dir = FileSpec(domainsocket_dir_env, false); else - HostInfo::GetLLDBPath(ePathTypeLLDBTempSystemDir, g_domainsocket_dir); + g_domainsocket_dir = HostInfo::GetProcessTempDir(); }); return g_domainsocket_dir; Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp === --- source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -1008,8 +1008,8 @@ bool debugserver_exists = debugserver_file_spec.Exists(); if (!debugserver_exists) { // The debugserver binary is in the LLDB.framework/Resources directory. -if (HostInfo::GetLLDBPath(ePathTypeSupportExecutableDir, - debugserver_file_spec)) { +debugserver_file_spec = HostInfo::GetSupportExeDir(); +if (debugserver_file_spec) { debugserver_file_spec.AppendPathComponent(DEBUGSERVER_BASENAME); debugserver_exists = debugserver_file_spec.Exists(); if (debugserver_exists) { Index: source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp === --- source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp +++ source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp @@ -173,7 +173,8 @@ FileSpec fspec; uint32_t versions[2]; if (objfile->GetSDKVersion(versions, sizeof(versions))) {
[Lldb-commits] [PATCH] D47302: [WIP] New class SBTargetSettings to store and manipulate all target's properties.
polyakov.alex updated this revision to Diff 151682. polyakov.alex retitled this revision from "[lldb, lldb-mi] Add method AddCurrentTargetSharedObjectPath to the SBDebugger." to "[WIP] New class SBTargetSettings to store and manipulate all target's properties.". polyakov.alex edited the summary of this revision. polyakov.alex added a comment. Herald added a subscriber: mgorny. As we discussed previously, it would be nice to have a class in SB API that will manipulate with SBTarget's properties. I started to work on this and , as I expected, faced with a problem: `TargetProperties` class doesn't have a property with image search paths while `Target` does. It means that we should have a pointer to `Target` to implement things like `SBTargetSettings::AppendImageSearchPath(const char *from, const char *to, SBError &error)`. We may store an additional pointer to `Target`, but, as I understood, it's not what we want from `SBTargetSettings` to be. Moreover, it looks strange that image search path isn't a part of `TargetProperties` while executable and debug file search paths are. I'm looking forward for your comments about this. https://reviews.llvm.org/D47302 Files: include/lldb/API/SBTarget.h include/lldb/API/SBTargetSettings.h source/API/CMakeLists.txt source/API/SBTargetSettings.cpp Index: source/API/SBTargetSettings.cpp === --- /dev/null +++ source/API/SBTargetSettings.cpp @@ -0,0 +1,41 @@ +//===-- SBTargetSettings.cpp *- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#include "lldb/API/SBTargetSettings.h" + +#include "lldb/Target/Target.h" +#include "lldb/Utility/Log.h" +#include "llvm/Support/Casting.h" + +using namespace lldb; +using namespace lldb_private; + +//-- +// SBTargetSettings constructors +//-- +SBTargetSettings::SBTargetSettings() : m_opaque_sp() {} + +SBTargetSettings::SBTargetSettings(const lldb::SBTarget &sb_target) +: m_opaque_sp(sb_target.GetSP()) {} + +//-- +// Destructor +//-- +SBTargetSettings::~SBTargetSettings() = default; + +void SBTargetSettings::AppendImageSearchPath(const char *from, + const char *to) { + SBError error; + AppendImageSearchPath(from, to, error); +} + +void SBTargetSettings::AppendImageSearchPath(const char *from, + const char *to, + SBError &error) { +} Index: source/API/CMakeLists.txt === --- source/API/CMakeLists.txt +++ source/API/CMakeLists.txt @@ -63,6 +63,7 @@ SBSymbolContext.cpp SBSymbolContextList.cpp SBTarget.cpp + SBTargetSettings.cpp SBThread.cpp SBThreadCollection.cpp SBThreadPlan.cpp Index: include/lldb/API/SBTargetSettings.h === --- /dev/null +++ include/lldb/API/SBTargetSettings.h @@ -0,0 +1,50 @@ +//===-- SBTargetSettings.h --*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#ifndef LLDB_SBTargetSettings_h_ +#define LLDB_SBTargetSettings_h_ + +// C Includes +// C++ Includes +// Other libraries and framework includes +// Project includes +#include "lldb/API/SBTarget.h" +#include "lldb/API/SBError.h" + +namespace lldb { + +class LLDB_API SBTargetSettings { +public: + //-- + // Constructors + //-- + SBTargetSettings(); + + SBTargetSettings(const lldb::SBTarget &sb_target); + + //-- + // Destructor + //-- + ~SBTargetSettings(); + + void AppendImageSearchPath(const char *from, const char *to); + + void AppendImageSearchPath(const char *from, const char *to, SBError &error); + + //size_t GetNumImageSearchPaths() const; + + //const char *GetImageSearchPathAtIndex(size_t i); + +private: + lldb::TargetPropertiesSP m_opaque_sp; +}; + +} // namespace lldb + +#endif // LLDB_SBTargetSettings_h_ Index: include/lldb/A
[Lldb-commits] [lldb] r334950 - Use llvm::VersionTuple instead of manual version marshalling
Author: labath Date: Mon Jun 18 08:02:23 2018 New Revision: 334950 URL: http://llvm.org/viewvc/llvm-project?rev=334950&view=rev Log: Use llvm::VersionTuple instead of manual version marshalling Summary: This has multiple advantages: - we need only one function argument/instance variable instead of three - no need to default initialize variables - no custom parsing code - VersionTuple has comparison operators, which makes version comparisons much simpler Reviewers: zturner, friss, clayborg, jingham Subscribers: emaste, lldb-commits Differential Revision: https://reviews.llvm.org/D47889 Modified: lldb/trunk/include/lldb/Core/Module.h lldb/trunk/include/lldb/Host/freebsd/HostInfoFreeBSD.h lldb/trunk/include/lldb/Host/linux/HostInfoLinux.h lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h lldb/trunk/include/lldb/Host/netbsd/HostInfoNetBSD.h lldb/trunk/include/lldb/Host/windows/HostInfoWindows.h lldb/trunk/include/lldb/Interpreter/OptionGroupPlatform.h lldb/trunk/include/lldb/Symbol/ObjectFile.h lldb/trunk/include/lldb/Target/Platform.h lldb/trunk/include/lldb/Target/Process.h lldb/trunk/include/lldb/Utility/Args.h lldb/trunk/source/API/SBModule.cpp lldb/trunk/source/API/SBPlatform.cpp lldb/trunk/source/Core/Module.cpp lldb/trunk/source/Host/freebsd/HostInfoFreeBSD.cpp lldb/trunk/source/Host/linux/HostInfoLinux.cpp lldb/trunk/source/Host/macosx/objcxx/HostInfoMacOSX.mm lldb/trunk/source/Host/netbsd/HostInfoNetBSD.cpp lldb/trunk/source/Host/windows/HostInfoWindows.cpp lldb/trunk/source/Interpreter/OptionGroupPlatform.cpp lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.h lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.h 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/gdb-remote/GDBRemoteCommunicationClient.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h lldb/trunk/source/Target/Platform.cpp lldb/trunk/source/Utility/Args.cpp lldb/trunk/unittests/Platform/PlatformDarwinTest.cpp Modified: lldb/trunk/include/lldb/Core/Module.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=334950&r1=334949&r2=334950&view=diff == --- lldb/trunk/include/lldb/Core/Module.h (original) +++ lldb/trunk/include/lldb/Core/Module.h Mon Jun 18 08:02:23 2018 @@ -703,7 +703,7 @@ public: //-- virtual void SectionFileAddressesChanged(); - uint32_t GetVersion(uint32_t *versions, uint32_t num_versions); + llvm::VersionTuple GetVersion(); //-- /// Load an object file from memory. Modified: lldb/trunk/include/lldb/Host/freebsd/HostInfoFreeBSD.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/freebsd/HostInfoFreeBSD.h?rev=334950&r1=334949&r2=334950&view=diff == --- lldb/trunk/include/lldb/Host/freebsd/HostInfoFreeBSD.h (original) +++ lldb/trunk/include/lldb/Host/freebsd/HostInfoFreeBSD.h Mon Jun 18 08:02:23 2018 @@ -12,12 +12,13 @@ #include "lldb/Host/posix/HostInfoPosix.h" #include "lldb/Utility/FileSpec.h" +#include "llvm/Support/VersionTuple.h" namespace lldb_private { class HostInfoFreeBSD : public HostInfoPosix { public: - static bool GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update); + static llvm::VersionTuple GetOSVersion(); static bool GetOSBuildString(std::string &s); static bool GetOSKernelDescription(std::string &s); static FileSpec GetProgramFileSpec(); Modified: lldb/trunk/include/lldb/Host/linux/HostInfoLinux.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/linux/HostInfoLinux.h?rev=334950&r1=334949&r2=334950&view=diff =
[Lldb-commits] [PATCH] D47889: Use llvm::VersionTuple instead of manual version marshalling
This revision was not accepted when it landed; it landed in state "Needs Review". This revision was automatically updated to reflect the committed changes. Closed by commit rL334950: Use llvm::VersionTuple instead of manual version marshalling (authored by labath, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D47889?vs=151484&id=151718#toc Repository: rL LLVM https://reviews.llvm.org/D47889 Files: lldb/trunk/include/lldb/Core/Module.h lldb/trunk/include/lldb/Host/freebsd/HostInfoFreeBSD.h lldb/trunk/include/lldb/Host/linux/HostInfoLinux.h lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h lldb/trunk/include/lldb/Host/netbsd/HostInfoNetBSD.h lldb/trunk/include/lldb/Host/windows/HostInfoWindows.h lldb/trunk/include/lldb/Interpreter/OptionGroupPlatform.h lldb/trunk/include/lldb/Symbol/ObjectFile.h lldb/trunk/include/lldb/Target/Platform.h lldb/trunk/include/lldb/Target/Process.h lldb/trunk/include/lldb/Utility/Args.h lldb/trunk/source/API/SBModule.cpp lldb/trunk/source/API/SBPlatform.cpp lldb/trunk/source/Core/Module.cpp lldb/trunk/source/Host/freebsd/HostInfoFreeBSD.cpp lldb/trunk/source/Host/linux/HostInfoLinux.cpp lldb/trunk/source/Host/macosx/objcxx/HostInfoMacOSX.mm lldb/trunk/source/Host/netbsd/HostInfoNetBSD.cpp lldb/trunk/source/Host/windows/HostInfoWindows.cpp lldb/trunk/source/Interpreter/OptionGroupPlatform.cpp lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.h lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.h 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/gdb-remote/GDBRemoteCommunicationClient.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h lldb/trunk/source/Target/Platform.cpp lldb/trunk/source/Utility/Args.cpp lldb/trunk/unittests/Platform/PlatformDarwinTest.cpp Index: lldb/trunk/unittests/Platform/PlatformDarwinTest.cpp === --- lldb/trunk/unittests/Platform/PlatformDarwinTest.cpp +++ lldb/trunk/unittests/Platform/PlatformDarwinTest.cpp @@ -19,38 +19,29 @@ using namespace lldb_private; TEST(PlatformDarwinTest, TestParseVersionBuildDir) { - uint32_t A, B, C; + llvm::VersionTuple V; llvm::StringRef D; - std::tie(A, B, C, D) = PlatformDarwin::ParseVersionBuildDir("1.2.3 (test1)"); - EXPECT_EQ(1u, A); - EXPECT_EQ(2u, B); - EXPECT_EQ(3u, C); + std::tie(V, D) = PlatformDarwin::ParseVersionBuildDir("1.2.3 (test1)"); + EXPECT_EQ(llvm::VersionTuple(1, 2, 3), V); EXPECT_EQ("test1", D); - std::tie(A, B, C, D) = PlatformDarwin::ParseVersionBuildDir("2.3 (test2)"); - EXPECT_EQ(2u, A); - EXPECT_EQ(3u, B); + std::tie(V, D) = PlatformDarwin::ParseVersionBuildDir("2.3 (test2)"); + EXPECT_EQ(llvm::VersionTuple(2, 3), V); EXPECT_EQ("test2", D); - std::tie(A, B, C, D) = PlatformDarwin::ParseVersionBuildDir("3 (test3)"); - EXPECT_EQ(3u, A); + std::tie(V, D) = PlatformDarwin::ParseVersionBuildDir("3 (test3)"); + EXPECT_EQ(llvm::VersionTuple(3), V); EXPECT_EQ("test3", D); - std::tie(A, B, C, D) = PlatformDarwin::ParseVersionBuildDir("1.2.3 (test"); - EXPECT_EQ(1u, A); - EXPECT_EQ(2u, B); - EXPECT_EQ(3u, C); + std::tie(V, D) = PlatformDarwin::ParseVersionBuildDir("1.2.3 (test"); + EXPECT_EQ(llvm::VersionTuple(1, 2, 3), V); EXPECT_EQ("test", D); - std::tie(A, B, C, D) = PlatformDarwin::ParseVersionBuildDir("2.3.4 test"); - EXPECT_EQ(2u, A); - EXPECT_EQ(3u, B); - EXPECT_EQ(4u, C); + std::tie(V, D) = PlatformDarwin::ParseVersionBuildDir("2.3.4 test"); + EXPECT_EQ(llvm::VersionTuple(2, 3, 4), V); EXPECT_EQ("", D); - std::tie(A, B, C, D) = PlatformDarwin::ParseVersionBuildDir("3.4.5"); - EXPECT_EQ(3u, A); - EXPECT_EQ(4u, B); - EXPECT_EQ(5u, C); + std::tie(V, D) = PlatformDarwin::ParseVersionBuildDir("3.4.5"); + EXPECT_EQ(llvm::VersionTuple(3, 4, 5), V); } Index: lldb/trunk/source/Host/netbsd/HostInfoNetBSD.cpp ==
[Lldb-commits] [lldb] r334952 - Attempt to fix windows&freebsd builds broken by r334950
Author: labath Date: Mon Jun 18 08:29:42 2018 New Revision: 334952 URL: http://llvm.org/viewvc/llvm-project?rev=334952&view=rev Log: Attempt to fix windows&freebsd builds broken by r334950 Modified: lldb/trunk/source/Host/freebsd/HostInfoFreeBSD.cpp lldb/trunk/source/Host/windows/HostInfoWindows.cpp Modified: lldb/trunk/source/Host/freebsd/HostInfoFreeBSD.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/freebsd/HostInfoFreeBSD.cpp?rev=334952&r1=334951&r2=334952&view=diff == --- lldb/trunk/source/Host/freebsd/HostInfoFreeBSD.cpp (original) +++ lldb/trunk/source/Host/freebsd/HostInfoFreeBSD.cpp Mon Jun 18 08:29:42 2018 @@ -23,7 +23,7 @@ llvm::VersionTuple HostInfoFreeBSD::GetO ::memset(&un, 0, sizeof(utsname)); if (uname(&un) < 0) -return false; +return llvm::VersionTuple(); unsigned major, minor; if (2 == sscanf(un.release, "%u.%u", &major, &minor)) Modified: lldb/trunk/source/Host/windows/HostInfoWindows.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/HostInfoWindows.cpp?rev=334952&r1=334951&r2=334952&view=diff == --- lldb/trunk/source/Host/windows/HostInfoWindows.cpp (original) +++ lldb/trunk/source/Host/windows/HostInfoWindows.cpp Mon Jun 18 08:29:42 2018 @@ -63,12 +63,12 @@ llvm::VersionTuple HostInfoWindows::GetO bool HostInfoWindows::GetOSBuildString(std::string &s) { s.clear(); - uint32_t major, minor, update; - if (!GetOSVersion(major, minor, update)) + llvm::VersionTuple version = GetOSVersion(); + if (version.empty()) return false; llvm::raw_string_ostream stream(s); - stream << "Windows NT " << major << "." << minor << "." << update; + stream << "Windows NT " << version.getAsString(); return true; } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r334953 - Fix netbsd build broken by r334950
Author: labath Date: Mon Jun 18 08:44:36 2018 New Revision: 334953 URL: http://llvm.org/viewvc/llvm-project?rev=334953&view=rev Log: Fix netbsd build broken by r334950 This also includes one more build fix for windows. Modified: lldb/trunk/source/Host/netbsd/HostInfoNetBSD.cpp lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp Modified: lldb/trunk/source/Host/netbsd/HostInfoNetBSD.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/netbsd/HostInfoNetBSD.cpp?rev=334953&r1=334952&r2=334953&view=diff == --- lldb/trunk/source/Host/netbsd/HostInfoNetBSD.cpp (original) +++ lldb/trunk/source/Host/netbsd/HostInfoNetBSD.cpp Mon Jun 18 08:44:36 2018 @@ -26,9 +26,10 @@ llvm::VersionTuple HostInfoNetBSD::GetOS ::memset(&un, 0, sizeof(un)); if (::uname(&un) < 0) -return false; +return VersionTuple(); /* Accept versions like 7.99.21 and 6.1_STABLE */ + uint32_t major, minor, update; int status = ::sscanf(un.release, "%" PRIu32 ".%" PRIu32 ".%" PRIu32, &major, &minor, &update); switch (status) { Modified: lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp?rev=334953&r1=334952&r2=334953&view=diff == --- lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp (original) +++ lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp Mon Jun 18 08:44:36 2018 @@ -568,16 +568,8 @@ void PlatformWindows::GetStatus(Stream & Platform::GetStatus(strm); #ifdef _WIN32 - uint32_t major; - uint32_t minor; - uint32_t update; - if (!HostInfo::GetOSVersion(major, minor, update)) { -strm << "Windows"; -return; - } - - strm << "Host: Windows " << major << '.' << minor << " Build: " << update - << '\n'; + llvm::VersionTuple version = HostInfo::GetOSVersion(); + strm << "Host: Windows " << version.getAsString() << '\n'; #endif } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r334955 - Fix macosx build broken by the VersionTuple refactor
Author: labath Date: Mon Jun 18 09:10:20 2018 New Revision: 334955 URL: http://llvm.org/viewvc/llvm-project?rev=334955&view=rev Log: Fix macosx build broken by the VersionTuple refactor I actually did check that macos builds before committing, but this error was in conditionally compiled code that did not seem to be used on my machine. I also fix a typo in the previous speculative NetBSD patch. Modified: lldb/trunk/source/Host/macosx/objcxx/Host.mm lldb/trunk/source/Host/netbsd/HostInfoNetBSD.cpp 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=334955&r1=334954&r2=334955&view=diff == --- lldb/trunk/source/Host/macosx/objcxx/Host.mm (original) +++ lldb/trunk/source/Host/macosx/objcxx/Host.mm Mon Jun 18 09:10:20 2018 @@ -851,14 +851,11 @@ static short GetPosixspawnFlags(const Pr if (g_use_close_on_exec_flag == eLazyBoolCalculate) { g_use_close_on_exec_flag = eLazyBoolNo; -uint32_t major, minor, update; -if (HostInfo::GetOSVersion(major, minor, update)) { +llvm::VersionTuple version = HostInfo::GetOSVersion(); +if (version > llvm::VersionTuple(10, 7)) { // Kernel panic if we use the POSIX_SPAWN_CLOEXEC_DEFAULT on 10.7 or // earlier - if (major > 10 || (major == 10 && minor > 7)) { -// Only enable for 10.8 and later OS versions -g_use_close_on_exec_flag = eLazyBoolYes; - } + g_use_close_on_exec_flag = eLazyBoolYes; } } #else Modified: lldb/trunk/source/Host/netbsd/HostInfoNetBSD.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/netbsd/HostInfoNetBSD.cpp?rev=334955&r1=334954&r2=334955&view=diff == --- lldb/trunk/source/Host/netbsd/HostInfoNetBSD.cpp (original) +++ lldb/trunk/source/Host/netbsd/HostInfoNetBSD.cpp Mon Jun 18 09:10:20 2018 @@ -26,7 +26,7 @@ llvm::VersionTuple HostInfoNetBSD::GetOS ::memset(&un, 0, sizeof(un)); if (::uname(&un) < 0) -return VersionTuple(); +return llvm::VersionTuple(); /* Accept versions like 7.99.21 and 6.1_STABLE */ uint32_t major, minor, update; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D47992: [lldb-mi] Correct error processing in exec-next command.
clayborg added a comment. In https://reviews.llvm.org/D47992#1134120, @apolyakov wrote: > If you look at `bool CMICmdCmdExecContinue::Execute()`, you'll see that there > are cases in which we need a flexible way to finish MI command(specific > action in error case for example). We have a few options: not to add such an > utility function, add and use it in simple situations where we just want to > check on SBError status or we may create utility function with lambda > functions in which user could specify actions he needs. What are your > thoughts about this? I am just trying to reduce duplicated code with my suggestion. Feel free to code normally when you are doing tricky things for returning in the middle of a function with special error cases. https://reviews.llvm.org/D47992 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D48060: Introduce lldb-framework CMake target and centralize its logic
clayborg added a comment. Indeed!!! So happy to see this work getting done. Great stuff. Will be great to not have to maintain the Xcode project as some point in the near future. https://reviews.llvm.org/D48060 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D48272: Replace HostInfo::GetLLDBPath with specific functions
clayborg accepted this revision. clayborg added a comment. This revision is now accepted and ready to land. Looks good. My only question is do we not require people to only fill in the directory portion of the FileSpec anymore for these functions? I am fine with way since hopefully FileSpec::AppendPathComponent handles things correctly. https://reviews.llvm.org/D48272 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r334968 - Introduce lldb-framework CMake target and centralize its logic
Author: xiaobai Date: Mon Jun 18 11:27:16 2018 New Revision: 334968 URL: http://llvm.org/viewvc/llvm-project?rev=334968&view=rev Log: Introduce lldb-framework CMake target and centralize its logic Summary: In this patch I aim to do the following: 1) Create an lldb-framework target that acts as the target that handles generating LLDB.framework. Previously, liblldb acted as the target for generating the framework in addition to generating the actual lldb library. This made the target feel overloaded. 2) Centralize framework generation as much as it makes sense to do so. 3) Create a target lldb-suite, which depends on every tool and library that makes liblldb fully functional. One result of having this target is it makes tracking dependencies much clearer. Differential Revision: https://reviews.llvm.org/D48060 Added: lldb/trunk/cmake/modules/LLDBFramework.cmake Modified: lldb/trunk/CMakeLists.txt lldb/trunk/cmake/modules/AddLLDB.cmake lldb/trunk/source/API/CMakeLists.txt lldb/trunk/tools/argdumper/CMakeLists.txt lldb/trunk/tools/darwin-debug/CMakeLists.txt lldb/trunk/tools/debugserver/source/CMakeLists.txt lldb/trunk/tools/driver/CMakeLists.txt lldb/trunk/tools/lldb-server/CMakeLists.txt Modified: lldb/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=334968&r1=334967&r2=334968&view=diff == --- lldb/trunk/CMakeLists.txt (original) +++ lldb/trunk/CMakeLists.txt Mon Jun 18 11:27:16 2018 @@ -37,7 +37,18 @@ if(APPLE) add_definitions(-DLLDB_USE_OS_LOG) endif() +# lldb-suite is a dummy target that encompasses all the necessary tools and +# libraries for building a fully-functioning liblldb. +add_custom_target(lldb-suite) + +option(LLDB_BUILD_FRAMEWORK "Build the Darwin LLDB.framework" Off) if(LLDB_BUILD_FRAMEWORK) + if (CMAKE_VERSION VERSION_LESS 3.7) +message(FATAL_ERROR "LLDB_BUILD_FRAMEWORK is not supported on CMake < 3.7") + endif() + if (NOT APPLE) +message(FATAL_ERROR "LLDB.framework can only be generated when targeting Apple platforms") + endif() set(LLDB_FRAMEWORK_DIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_FRAMEWORK_INSTALL_DIR}) endif() @@ -129,6 +140,12 @@ if(LLDB_INCLUDE_TESTS) add_subdirectory(utils/lldb-dotest) endif() +if (LLDB_BUILD_FRAMEWORK) + add_custom_target(lldb-framework) + include(LLDBFramework) + add_dependencies(lldb-suite lldb-framework) +endif() + if (NOT LLDB_DISABLE_PYTHON) # Add a Post-Build Event to copy over Python files and create the symlink # to liblldb.so for the Python API(hardlink on Windows) @@ -147,8 +164,9 @@ if (NOT LLDB_DISABLE_PYTHON) DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py DEPENDS ${LLDB_PYTHON_TARGET_DIR}/lldb.py COMMENT "Python script sym-linking LLDB Python API") -# We depend on liblldb being built before we can do this step. -add_dependencies(finish_swig liblldb lldb-argdumper) + +# We depend on liblldb and lldb-argdumper being built before we can do this step. +add_dependencies(finish_swig lldb-suite) # If we build the readline module, we depend on that happening # first. @@ -159,8 +177,8 @@ if (NOT LLDB_DISABLE_PYTHON) # Ensure we do the python post-build step when building lldb. add_dependencies(lldb finish_swig) -if(LLDB_BUILD_FRAMEWORK) - # The target to install libLLDB needs to depend on finish swig so that the +if (LLDB_BUILD_FRAMEWORK) + # The target to install libLLDB needs to depend on finish_swig so that the # framework build properly copies over the Python files. add_dependencies(install-liblldb finish_swig) endif() Modified: lldb/trunk/cmake/modules/AddLLDB.cmake URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/AddLLDB.cmake?rev=334968&r1=334967&r2=334968&view=diff == --- lldb/trunk/cmake/modules/AddLLDB.cmake (original) +++ lldb/trunk/cmake/modules/AddLLDB.cmake Mon Jun 18 11:27:16 2018 @@ -86,7 +86,7 @@ endfunction(add_lldb_library) function(add_lldb_executable name) cmake_parse_arguments(ARG -"INCLUDE_IN_FRAMEWORK;GENERATE_INSTALL" +"INCLUDE_IN_SUITE;GENERATE_INSTALL" "" "LINK_LIBS;LINK_COMPONENTS" ${ARGN} @@ -99,8 +99,9 @@ function(add_lldb_executable name) set_target_properties(${name} PROPERTIES FOLDER "lldb executables") - if(LLDB_BUILD_FRAMEWORK) -if(ARG_INCLUDE_IN_FRAMEWORK) + if(ARG_INCLUDE_IN_SUITE) +add_dependencies(lldb-suite ${name}) +if(LLDB_BUILD_FRAMEWORK) if(NOT IOS) set(resource_dir "/Resources") set(resource_dots "../") @@ -122,14 +123,16 @@ function(add_lldb_executable name) add_custom_target(install-${name}-stripped DEPENDS ${name}) add_dependencies(install-liblldb-stripped ${name})
[Lldb-commits] [PATCH] D48060: Introduce lldb-framework CMake target and centralize its logic
This revision was automatically updated to reflect the committed changes. Closed by commit rL334968: Introduce lldb-framework CMake target and centralize its logic (authored by xiaobai, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.org/D48060 Files: lldb/trunk/CMakeLists.txt lldb/trunk/cmake/modules/AddLLDB.cmake lldb/trunk/cmake/modules/LLDBFramework.cmake lldb/trunk/source/API/CMakeLists.txt lldb/trunk/tools/argdumper/CMakeLists.txt lldb/trunk/tools/darwin-debug/CMakeLists.txt lldb/trunk/tools/debugserver/source/CMakeLists.txt lldb/trunk/tools/driver/CMakeLists.txt lldb/trunk/tools/lldb-server/CMakeLists.txt Index: lldb/trunk/cmake/modules/AddLLDB.cmake === --- lldb/trunk/cmake/modules/AddLLDB.cmake +++ lldb/trunk/cmake/modules/AddLLDB.cmake @@ -86,7 +86,7 @@ function(add_lldb_executable name) cmake_parse_arguments(ARG -"INCLUDE_IN_FRAMEWORK;GENERATE_INSTALL" +"INCLUDE_IN_SUITE;GENERATE_INSTALL" "" "LINK_LIBS;LINK_COMPONENTS" ${ARGN} @@ -99,8 +99,9 @@ set_target_properties(${name} PROPERTIES FOLDER "lldb executables") - if(LLDB_BUILD_FRAMEWORK) -if(ARG_INCLUDE_IN_FRAMEWORK) + if(ARG_INCLUDE_IN_SUITE) +add_dependencies(lldb-suite ${name}) +if(LLDB_BUILD_FRAMEWORK) if(NOT IOS) set(resource_dir "/Resources") set(resource_dots "../") @@ -122,14 +123,16 @@ add_custom_target(install-${name}-stripped DEPENDS ${name}) add_dependencies(install-liblldb-stripped ${name}) endif() -else() - set_target_properties(${name} PROPERTIES -BUILD_WITH_INSTALL_RPATH On -INSTALL_RPATH "@loader_path/../${LLDB_FRAMEWORK_INSTALL_DIR}") endif() endif() - if(ARG_GENERATE_INSTALL AND NOT (ARG_INCLUDE_IN_FRAMEWORK AND LLDB_BUILD_FRAMEWORK )) + if(LLDB_BUILD_FRAMEWORK AND NOT ARG_INCLUDE_IN_SUITE) +set_target_properties(${name} PROPERTIES + BUILD_WITH_INSTALL_RPATH On + INSTALL_RPATH "@loader_path/../${LLDB_FRAMEWORK_INSTALL_DIR}") + endif() + + if(ARG_GENERATE_INSTALL AND NOT (ARG_INCLUDE_IN_SUITE AND LLDB_BUILD_FRAMEWORK )) install(TARGETS ${name} COMPONENT ${name} RUNTIME DESTINATION bin) @@ -140,7 +143,7 @@ endif() endif() - if(ARG_INCLUDE_IN_FRAMEWORK AND LLDB_BUILD_FRAMEWORK) + if(ARG_INCLUDE_IN_SUITE AND LLDB_BUILD_FRAMEWORK) add_llvm_tool_symlink(${name} ${name} ALWAYS_GENERATE SKIP_INSTALL OUTPUT_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR}) endif() Index: lldb/trunk/cmake/modules/LLDBFramework.cmake === --- lldb/trunk/cmake/modules/LLDBFramework.cmake +++ lldb/trunk/cmake/modules/LLDBFramework.cmake @@ -0,0 +1,44 @@ +file(GLOB public_headers ${LLDB_SOURCE_DIR}/include/lldb/API/*.h) +file(GLOB root_public_headers ${LLDB_SOURCE_DIR}/include/lldb/lldb-*.h) +file(GLOB root_private_headers ${LLDB_SOURCE_DIR}/include/lldb/lldb-private*.h) +list(REMOVE_ITEM root_public_headers ${root_private_headers}) +foreach(header +${public_headers} +${root_public_headers} +${LLDB_SOURCE_DIR}/include/lldb/Utility/SharingPtr.h) + get_filename_component(basename ${header} NAME) + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders/${basename} + DEPENDS ${header} + COMMAND ${CMAKE_COMMAND} -E copy ${header} ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders/${basename}) + list(APPEND framework_headers ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders/${basename}) +endforeach() +add_custom_target(lldb-framework-headers + DEPENDS ${framework_headers} + COMMAND ${LLDB_SOURCE_DIR}/scripts/framework-header-fix.sh ${CMAKE_CURRENT_BINARY_DIR} ${LLDB_VERSION}) + +if (NOT IOS) + if (NOT LLDB_BUILT_STANDALONE) +add_dependencies(lldb-framework clang-headers) + endif() + add_custom_command(TARGET lldb-framework POST_BUILD +COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders $/Headers +COMMAND ${CMAKE_COMMAND} -E create_symlink Versions/Current/Headers ${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Headers +COMMAND ${CMAKE_COMMAND} -E create_symlink ${LLDB_FRAMEWORK_VERSION} ${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Versions/Current +COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/clang/${LLDB_VERSION} $/Resources/Clang + ) +else() + add_custom_command(TARGET lldb-framework POST_BUILD +COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders $/Headers + ) +endif() + +set_target_properties(liblldb PROPERTIES + OUTPUT_NAME LLDB + FRAMEWORK On + FRAMEWORK_VERSION ${LLDB_FRAMEWORK_VERSION} + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR} + PUBLIC_HEADER "${frame
[Lldb-commits] [PATCH] D48060: Introduce lldb-framework CMake target and centralize its logic
xiaobai added a comment. Thank you @labath for your help. I'm much happier with this! Repository: rL LLVM https://reviews.llvm.org/D48060 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D47991: Improve SBThread's stepping API using SBError parameter.
apolyakov updated this revision to Diff 151773. apolyakov edited the summary of this revision. apolyakov added a comment. I removed comments about optional arguments since I didn't find any info about it in LLVM coding style. https://reviews.llvm.org/D47991 Files: include/lldb/API/SBThread.h scripts/interface/SBThread.i source/API/SBThread.cpp Index: source/API/SBThread.cpp === --- source/API/SBThread.cpp +++ source/API/SBThread.cpp @@ -633,6 +633,11 @@ } void SBThread::StepOver(lldb::RunMode stop_other_threads) { + SBError error; // Ignored + StepOver(stop_other_threads, error); +} + +void SBThread::StepOver(lldb::RunMode stop_other_threads, SBError &error) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); std::unique_lock lock; @@ -643,37 +648,38 @@ static_cast(exe_ctx.GetThreadPtr()), Thread::RunModeAsCString(stop_other_threads)); - if (exe_ctx.HasThreadScope()) { -Thread *thread = exe_ctx.GetThreadPtr(); -bool abort_other_plans = false; -StackFrameSP frame_sp(thread->GetStackFrameAtIndex(0)); - -ThreadPlanSP new_plan_sp; -if (frame_sp) { - if (frame_sp->HasDebugInformation()) { -const LazyBool avoid_no_debug = eLazyBoolCalculate; -SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything)); -new_plan_sp = thread->QueueThreadPlanForStepOverRange( -abort_other_plans, sc.line_entry, sc, stop_other_threads, -avoid_no_debug); - } else { -new_plan_sp = thread->QueueThreadPlanForStepSingleInstruction( -true, abort_other_plans, stop_other_threads); - } -} + if (!exe_ctx.HasThreadScope()) { +error.SetErrorString("this SBThread object is invalid"); +return; + } + + Thread *thread = exe_ctx.GetThreadPtr(); + bool abort_other_plans = false; + StackFrameSP frame_sp(thread->GetStackFrameAtIndex(0)); -// This returns an error, we should use it! -ResumeNewPlan(exe_ctx, new_plan_sp.get()); + ThreadPlanSP new_plan_sp; + if (frame_sp) { +if (frame_sp->HasDebugInformation()) { + const LazyBool avoid_no_debug = eLazyBoolCalculate; + SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything)); + new_plan_sp = thread->QueueThreadPlanForStepOverRange( + abort_other_plans, sc.line_entry, sc, stop_other_threads, + avoid_no_debug); +} else { + new_plan_sp = thread->QueueThreadPlanForStepSingleInstruction( + true, abort_other_plans, stop_other_threads); +} } + error = ResumeNewPlan(exe_ctx, new_plan_sp.get()); } void SBThread::StepInto(lldb::RunMode stop_other_threads) { StepInto(NULL, stop_other_threads); } void SBThread::StepInto(const char *target_name, lldb::RunMode stop_other_threads) { - SBError error; + SBError error; // Ignored StepInto(target_name, LLDB_INVALID_LINE_NUMBER, error, stop_other_threads); } @@ -691,41 +697,48 @@ target_name ? target_name : "", Thread::RunModeAsCString(stop_other_threads)); - if (exe_ctx.HasThreadScope()) { -bool abort_other_plans = false; + if (!exe_ctx.HasThreadScope()) { +error.SetErrorString("this SBThread object is invalid"); +return; + } -Thread *thread = exe_ctx.GetThreadPtr(); -StackFrameSP frame_sp(thread->GetStackFrameAtIndex(0)); -ThreadPlanSP new_plan_sp; + bool abort_other_plans = false; -if (frame_sp && frame_sp->HasDebugInformation()) { - SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything)); - AddressRange range; - if (end_line == LLDB_INVALID_LINE_NUMBER) -range = sc.line_entry.range; - else { -if (!sc.GetAddressRangeFromHereToEndLine(end_line, range, error.ref())) - return; - } - - const LazyBool step_out_avoids_code_without_debug_info = - eLazyBoolCalculate; - const LazyBool step_in_avoids_code_without_debug_info = - eLazyBoolCalculate; - new_plan_sp = thread->QueueThreadPlanForStepInRange( - abort_other_plans, range, sc, target_name, stop_other_threads, - step_in_avoids_code_without_debug_info, - step_out_avoids_code_without_debug_info); -} else { - new_plan_sp = thread->QueueThreadPlanForStepSingleInstruction( - false, abort_other_plans, stop_other_threads); + Thread *thread = exe_ctx.GetThreadPtr(); + StackFrameSP frame_sp(thread->GetStackFrameAtIndex(0)); + ThreadPlanSP new_plan_sp; + + if (frame_sp && frame_sp->HasDebugInformation()) { +SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything)); +AddressRange range; +if (end_line == LLDB_INVALID_LINE_NUMBER) + range = sc.line_entry.range; +else { + if (!sc.GetAddressRangeFromHereToEndLine(end_line, range, error.ref())) +return; } -error = ResumeNewPlan(exe_ctx, n
[Lldb-commits] [PATCH] D48295: [WIP] Implement new ReturnMIStatus method of CMICmdBase class.
apolyakov created this revision. apolyakov added reviewers: aprantl, clayborg, labath. Herald added a subscriber: ki.stfu. The new method takes one parameter of type SBError and, if it has an error, sets error message and returns MIstatus::failure, returns MIstatus::success otherwise. https://reviews.llvm.org/D48295 Files: tools/lldb-mi/MICmdBase.cpp tools/lldb-mi/MICmdBase.h Index: tools/lldb-mi/MICmdBase.h === --- tools/lldb-mi/MICmdBase.h +++ tools/lldb-mi/MICmdBase.h @@ -12,6 +12,8 @@ // C Includes // C++ Includes // Other libraries and framework includes +#include "lldb/API/SBError.h" + // Project includes #include "MICmdArgSet.h" #include "MICmdData.h" @@ -80,6 +82,7 @@ // Methods: protected: void SetError(const CMIUtilString &rErrMsg); + bool ReturnMIStatus(const lldb::SBError &error); template T *GetOption(const CMIUtilString &vStrOptionName); bool ParseValidateCmdOptions(); Index: tools/lldb-mi/MICmdBase.cpp === --- tools/lldb-mi/MICmdBase.cpp +++ tools/lldb-mi/MICmdBase.cpp @@ -214,6 +214,23 @@ //++ // +// Details: Short cut function to check MI command's execute status and +// set an error in case of failure. +// Type:Method. +// Args:error - (R) Error description object. +// Return: None. +// Throws: None. +//-- +bool CMICmdBase::ReturnMIStatus(const lldb::SBError &error) { + if (error.Success()) +return MIstatus::success; + + SetError(error.GetCString()); + return MIstatus::failure; +} + +//++ +// // Details: Ask a command to provide its unique identifier. // Type:Method. // Args:A unique identifier for this command class. Index: tools/lldb-mi/MICmdBase.h === --- tools/lldb-mi/MICmdBase.h +++ tools/lldb-mi/MICmdBase.h @@ -12,6 +12,8 @@ // C Includes // C++ Includes // Other libraries and framework includes +#include "lldb/API/SBError.h" + // Project includes #include "MICmdArgSet.h" #include "MICmdData.h" @@ -80,6 +82,7 @@ // Methods: protected: void SetError(const CMIUtilString &rErrMsg); + bool ReturnMIStatus(const lldb::SBError &error); template T *GetOption(const CMIUtilString &vStrOptionName); bool ParseValidateCmdOptions(); Index: tools/lldb-mi/MICmdBase.cpp === --- tools/lldb-mi/MICmdBase.cpp +++ tools/lldb-mi/MICmdBase.cpp @@ -214,6 +214,23 @@ //++ // +// Details: Short cut function to check MI command's execute status and +// set an error in case of failure. +// Type:Method. +// Args:error - (R) Error description object. +// Return: None. +// Throws: None. +//-- +bool CMICmdBase::ReturnMIStatus(const lldb::SBError &error) { + if (error.Success()) +return MIstatus::success; + + SetError(error.GetCString()); + return MIstatus::failure; +} + +//++ +// // Details: Ask a command to provide its unique identifier. // Type:Method. // Args:A unique identifier for this command class. ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r334978 - Fixed file completion for paths that start with '~'.
Author: teemperor Date: Mon Jun 18 13:11:38 2018 New Revision: 334978 URL: http://llvm.org/viewvc/llvm-project?rev=334978&view=rev Log: Fixed file completion for paths that start with '~'. We didn't add the remaining path behind the '~' to the completion string, causing it to just complete directories inside the user home directory. This patch just adds the directory of the remaining path if there is one. Fixes rdar://problem/40147002 Modified: lldb/trunk/source/Commands/CommandCompletions.cpp Modified: lldb/trunk/source/Commands/CommandCompletions.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandCompletions.cpp?rev=334978&r1=334977&r2=334978&view=diff == --- lldb/trunk/source/Commands/CommandCompletions.cpp (original) +++ lldb/trunk/source/Commands/CommandCompletions.cpp Mon Jun 18 13:11:38 2018 @@ -164,6 +164,12 @@ static int DiskFilesOrDirectories(const // search in the fully resolved directory, but CompletionBuffer keeps the // unmodified form that the user typed. Storage = Resolved; +llvm::StringRef RemainderDir = path::parent_path(Remainder.str()); +if (!RemainderDir.empty()) { + // Append the remaining path to the resolved directory. + Storage.append(path::get_separator()); + Storage.append(RemainderDir); +} SearchDir = Storage; } else { SearchDir = path::parent_path(CompletionBuffer); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D48295: [WIP] Implement new ReturnMIStatus method of CMICmdBase class.
apolyakov added a comment. This approach is quite simple and can be used in `-exec-...`, `-target-...` and future commands. Also, I've been thinking about another approach with having a method in CMICmdBase that takes two parameters: pointers to a functions in which user could specify needed actions. But the main problem is that we don't have a knowledge about these functions, they may have any possible signatures. I don't yet know is it possible to have a pointer to a function with variable number of arguments of unknown types. https://reviews.llvm.org/D48295 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D48295: [WIP] Implement new ReturnMIStatus method of CMICmdBase class.
aprantl accepted this revision. aprantl added inline comments. This revision is now accepted and ready to land. Comment at: tools/lldb-mi/MICmdBase.cpp:221 +// Args:error - (R) Error description object. +// Return: None. +// Throws: None. It returns a bool, right? At some point it sure would be nice if we could convert the lldb-mi sources over to the LLVM coding style ... https://reviews.llvm.org/D48295 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D48295: [WIP] Implement new ReturnMIStatus method of CMICmdBase class.
aprantl added a comment. > Also, I've been thinking about another approach with having a method in > CMICmdBase that takes two parameters: pointers to a functions in which user > could specify needed actions. But the main problem is that we don't have a > knowledge about these functions, they may have any possible signatures. I > don't yet know is it possible to have a pointer to a function with variable > number of arguments of unknown types. Could you post an example of two use-cases where you would need different number of arguments? https://reviews.llvm.org/D48295 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D48295: [WIP] Implement new ReturnMIStatus method of CMICmdBase class.
apolyakov added inline comments. Comment at: tools/lldb-mi/MICmdBase.cpp:221 +// Args:error - (R) Error description object. +// Return: None. +// Throws: None. aprantl wrote: > It returns a bool, right? > > At some point it sure would be nice if we could convert the lldb-mi sources > over to the LLVM coding style ... Yep, it does. I'll update this. Is there some code in this commit that doesn't correspond to LLVM coding style? https://reviews.llvm.org/D48295 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D48295: [WIP] Implement new ReturnMIStatus method of CMICmdBase class.
aprantl added inline comments. Comment at: tools/lldb-mi/MICmdBase.cpp:221 +// Args:error - (R) Error description object. +// Return: None. +// Throws: None. apolyakov wrote: > aprantl wrote: > > It returns a bool, right? > > > > At some point it sure would be nice if we could convert the lldb-mi sources > > over to the LLVM coding style ... > Yep, it does. I'll update this. > > Is there some code in this commit that doesn't correspond to LLVM coding > style? I was referring to the variable naming and documentation schema, which is very different from what the rest of the code uses. You are doing the right thing here, you're matching the new code to whatever style is used by the file. https://reviews.llvm.org/D48295 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D48295: [WIP] Implement new ReturnMIStatus method of CMICmdBase class.
apolyakov added a comment. I got an idea how to deal with different number of parameters: what if we suggest to user to create own lambda functions(where he can specify needed actions) without parameters, but with capturing required variables by reference or by value? `auto f = [&x1, &x2...]{do some stuff}`. Looks weird, but... https://reviews.llvm.org/D48295 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D48295: [WIP] Implement new ReturnMIStatus method of CMICmdBase class.
aprantl added a comment. Can you post a more concrete example? I think this sounds like a good idea. https://reviews.llvm.org/D48295 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D48295: [WIP] Implement new ReturnMIStatus method of CMICmdBase class.
apolyakov added a comment. Sure. For example we may look at `bool CMICmdCmdExecContinue::Execute()`, there we may see following code: if (error.Success()) { // CODETAG_DEBUG_SESSION_RUNNING_PROG_RECEIVED_SIGINT_PAUSE_PROGRAM if (!CMIDriver::Instance().SetDriverStateRunningDebugging()) { const CMIUtilString &rErrMsg(CMIDriver::Instance().GetErrorDescription()); SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_SET_NEW_DRIVER_STATE), m_cmdData.strMiCmd.c_str(), rErrMsg.c_str())); return MIstatus::failure; } return MIstatus::success; } instead of this we may do something like auto SetDriverStateRunning = [this] { if (!CMIDriver::Instance().SetDriverStateRunningDebugging()) { const CMIUtilString &rErrMsg(CMIDriver::Instance().GetErrorDescription()); this->SetError(CMIUtilString::Format( MIRSRC(IDS_CMD_ERR_SET_NEW_DRIVER_STATE), this->m_cmdData.strMiCmd.c_str(), rErrMsg.c_str()) ); } }; SuccessHandler = SetDriverStateRunning; and finally we will have a function `CMICmdBase::FinishMICommand` (or another name :D) which will be like: bool CMICmdBase::FinishMICommand(const SBError &error) { if (error.Success()) { // call SucessHandler SucessHandler(); return MIstatus::success; } // call ErrorHandler ErrorHandler(); SetError(error.GetCString()); return MIstatus::failure; } Of course, there will be some default values to SuccessHandler and ErrorHandler(some dummy function). https://reviews.llvm.org/D48295 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D48295: [WIP] Implement new ReturnMIStatus method of CMICmdBase class.
apolyakov added a comment. SuccessHandler and ErrorHandler will be a member variables of CMICmdBase. https://reviews.llvm.org/D48295 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D48302: Search for kext variants is searching from parent directory when it should not be
jasonmolenda created this revision. jasonmolenda added a reviewer: JDevlieghere. Herald added a subscriber: llvm-commits. There's a small perf issue after the changes to r334205; the patch is intended to search all the executables in a kext bundle to discover variants, e.g. /System/Library/Extensions/AppleUSB.kext everything under the AppleUSB.kext subdir should be searched. But the patch used the FileSpec's GetDirectory method, so we ended up recursively searching all the kexts in the parent directory. Functionally, these are equivalent - recursively searching from the parent dir will yield the same result because we require a binary's UUID match before we use it. But it has a high performance cost if we search from the wrong base directory. rdar://problem/41227170 Repository: rL LLVM https://reviews.llvm.org/D48302 Files: source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h Index: source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h === --- source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h +++ source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h @@ -128,7 +128,7 @@ bool recurse); static std::vector - SearchForExecutablesRecursively(const lldb_private::ConstString &dir); + SearchForExecutablesRecursively(const std::string &dir); static void AddKextToMap(PlatformDarwinKernel *thisp, const lldb_private::FileSpec &file_spec); Index: source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp === --- source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp +++ source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp @@ -780,10 +780,10 @@ } std::vector -PlatformDarwinKernel::SearchForExecutablesRecursively(const ConstString &dir) { +PlatformDarwinKernel::SearchForExecutablesRecursively(const std::string &dir) { std::vector executables; std::error_code EC; - for (llvm::sys::fs::recursive_directory_iterator it(dir.GetStringRef(), EC), + for (llvm::sys::fs::recursive_directory_iterator it(dir.c_str(), EC), end; it != end && !EC; it.increment(EC)) { auto status = it->status(); @@ -800,7 +800,7 @@ const FileSpec &kext_bundle_path, const lldb_private::UUID &uuid, const ArchSpec &arch, ModuleSP &exe_module_sp) { for (const auto &exe_file : - SearchForExecutablesRecursively(kext_bundle_path.GetDirectory())) { + SearchForExecutablesRecursively(kext_bundle_path.GetPath())) { if (exe_file.Exists()) { ModuleSpec exe_spec(exe_file); exe_spec.GetUUID() = uuid; Index: source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h === --- source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h +++ source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h @@ -128,7 +128,7 @@ bool recurse); static std::vector - SearchForExecutablesRecursively(const lldb_private::ConstString &dir); + SearchForExecutablesRecursively(const std::string &dir); static void AddKextToMap(PlatformDarwinKernel *thisp, const lldb_private::FileSpec &file_spec); Index: source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp === --- source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp +++ source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp @@ -780,10 +780,10 @@ } std::vector -PlatformDarwinKernel::SearchForExecutablesRecursively(const ConstString &dir) { +PlatformDarwinKernel::SearchForExecutablesRecursively(const std::string &dir) { std::vector executables; std::error_code EC; - for (llvm::sys::fs::recursive_directory_iterator it(dir.GetStringRef(), EC), + for (llvm::sys::fs::recursive_directory_iterator it(dir.c_str(), EC), end; it != end && !EC; it.increment(EC)) { auto status = it->status(); @@ -800,7 +800,7 @@ const FileSpec &kext_bundle_path, const lldb_private::UUID &uuid, const ArchSpec &arch, ModuleSP &exe_module_sp) { for (const auto &exe_file : - SearchForExecutablesRecursively(kext_bundle_path.GetDirectory())) { + SearchForExecutablesRecursively(kext_bundle_path.GetPath())) { if (exe_file.Exists()) { ModuleSpec exe_spec(exe_file); exe_spec.GetUUID() = uuid; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D48295: [WIP] Implement new ReturnMIStatus method of CMICmdBase class.
aprantl added a comment. That sounds like a good overall direction, though I probably wouldn't communicate the function pointers via member variables but rather prefer them to be passed as function arguments or return values. This makes the flow a little more obvious for readers. https://reviews.llvm.org/D48295 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D47792: Fix up Info.plist when building LLDB.framework with CMake
xiaobai added a comment. Friendly ping! https://reviews.llvm.org/D47792 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r334995 - Some NFC changes to how we scan of kexts & kernels in memory in the
Author: jmolenda Date: Mon Jun 18 16:30:03 2018 New Revision: 334995 URL: http://llvm.org/viewvc/llvm-project?rev=334995&view=rev Log: Some NFC changes to how we scan of kexts & kernels in memory in the DynamicLoaderDarwinKernel plugin. Created a new function ReadMachHeader and instead of reading through the target cached memory reader, start by reading only a mach header sized chunk of memory, then check it for a valid mach-o magic # and use the size of the load commands to pre-fetch the entire load commands of the kext which is the only thing we're going to read, instead of letting the generic mach-o parser read it in 512 byte chunks. Functionally this is doing exactly the same thing as before, but by cutting down on the # of packets going back and forth, even on a local connection it's close to a quarter faster than it was before. Modified: lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h Modified: lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp?rev=334995&r1=334994&r2=334995&view=diff == --- lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp (original) +++ lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp Mon Jun 18 16:30:03 2018 @@ -8,8 +8,6 @@ // //===--===// -#include "lldb/Utility/SafeMachO.h" - #include "Plugins/Platform/MacOSX/PlatformDarwinKernel.h" #include "lldb/Breakpoint/StoppointCallbackContext.h" #include "lldb/Core/Debugger.h" @@ -368,46 +366,30 @@ lldb::addr_t DynamicLoaderDarwinKernel:: } //-- -// Given an address in memory, look to see if there is a kernel image at that -// address. Returns a UUID; if a kernel was not found at that address, -// UUID.IsValid() will be false. +// Read the mach_header struct out of memory and return it. +// Returns true if the mach_header was successfully read, +// Returns false if there was a problem reading the header, or it was not +// a Mach-O header. //-- -lldb_private::UUID -DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress(lldb::addr_t addr, -Process *process) { - Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); - if (addr == LLDB_INVALID_ADDRESS) -return UUID(); - - if (log) -log->Printf("DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress: " -"looking for kernel binary at 0x%" PRIx64, -addr); - - // First try a quick test -- read the first 4 bytes and see if there is a - // valid Mach-O magic field there (the first field of the - // mach_header/mach_header_64 struct). +bool +DynamicLoaderDarwinKernel::ReadMachHeader(addr_t addr, Process *process, llvm::MachO::mach_header &header) { Status read_error; - uint8_t magicbuf[4]; - if (process->ReadMemoryFromInferior (addr, magicbuf, sizeof (magicbuf), read_error) != sizeof (magicbuf)) - return UUID(); + + // Read the mach header and see whether it looks like a kernel + if (process->DoReadMemory (addr, &header, sizeof(header), read_error) != + sizeof(header)) +return false; const uint32_t magicks[] = { llvm::MachO::MH_MAGIC_64, llvm::MachO::MH_MAGIC, llvm::MachO::MH_CIGAM, llvm::MachO::MH_CIGAM_64}; bool found_matching_pattern = false; for (size_t i = 0; i < llvm::array_lengthof (magicks); i++) -if (::memcmp (magicbuf, &magicks[i], sizeof (magicbuf)) == 0) +if (::memcmp (&header.magic, &magicks[i], sizeof (uint32_t)) == 0) found_matching_pattern = true; if (found_matching_pattern == false) - return UUID(); - - // Read the mach header and see whether it looks like a kernel - llvm::MachO::mach_header header; - if (process->DoReadMemory(addr, &header, sizeof(header), read_error) != - sizeof(header)) -return UUID(); + return false; if (header.magic == llvm::MachO::MH_CIGAM || header.magic == llvm::MachO::MH_CIGAM_64) { @@ -420,6 +402,35 @@ DynamicLoaderDarwinKernel::CheckForKerne header.flags = llvm::ByteSwap_32(header.flags); } + return true; +} + +//-- +// Given an address in memory, look to see if there is a kernel image at that +// address. +// Returns a UUID; if a kernel was not found at that address, UUID.IsValid() +// will be false. +//-- +lldb_private::UUID +DynamicLoaderD
[Lldb-commits] [PATCH] D48303: Don't take the address of an xvalue when printing an expr result
teemperor created this revision. If we have an xvalue here, we will always hit the `err_typecheck_invalid_lvalue_addrof` error in 'Sema::CheckAddressOfOperand' when trying to take the address of the result. This patch uses the fallback code path where we store the result in a local variable instead when we hit this case. This fixes rdar://problem/40613277 https://reviews.llvm.org/D48303 Files: source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp Index: source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp === --- source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp +++ source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp @@ -292,8 +292,7 @@ // // - During dematerialization, $0 is ignored. - bool is_lvalue = (last_expr->getValueKind() == VK_LValue || -last_expr->getValueKind() == VK_XValue) && + bool is_lvalue = (last_expr->getValueKind() == VK_LValue) && (last_expr->getObjectKind() == OK_Ordinary); QualType expr_qual_type = last_expr->getType(); Index: source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp === --- source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp +++ source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp @@ -292,8 +292,7 @@ // // - During dematerialization, $0 is ignored. - bool is_lvalue = (last_expr->getValueKind() == VK_LValue || -last_expr->getValueKind() == VK_XValue) && + bool is_lvalue = (last_expr->getValueKind() == VK_LValue) && (last_expr->getObjectKind() == OK_Ordinary); QualType expr_qual_type = last_expr->getType(); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D47792: Fix up Info.plist when building LLDB.framework with CMake
sas accepted this revision. sas added a comment. This revision is now accepted and ready to land. LGTM for now. https://reviews.llvm.org/D47792 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D47792: Fix up Info.plist when building LLDB.framework with CMake
clayborg accepted this revision. clayborg added a comment. Looks good to me as long as Xcode still produces the same Info.plist in its LLDB.framework after your changes. https://reviews.llvm.org/D47792 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D48303: Don't take the address of an xvalue when printing an expr result
teemperor planned changes to this revision. teemperor added a comment. - Needs a test https://reviews.llvm.org/D48303 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D48303: Don't take the address of an xvalue when printing an expr result
teemperor updated this revision to Diff 151827. teemperor added a comment. - Added test case https://reviews.llvm.org/D48303 Files: packages/Python/lldbsuite/test/expression_command/xvalue/Makefile packages/Python/lldbsuite/test/expression_command/xvalue/TestXValuePrinting.py packages/Python/lldbsuite/test/expression_command/xvalue/main.cpp source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp Index: source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp === --- source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp +++ source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp @@ -292,8 +292,7 @@ // // - During dematerialization, $0 is ignored. - bool is_lvalue = (last_expr->getValueKind() == VK_LValue || -last_expr->getValueKind() == VK_XValue) && + bool is_lvalue = (last_expr->getValueKind() == VK_LValue) && (last_expr->getObjectKind() == OK_Ordinary); QualType expr_qual_type = last_expr->getType(); Index: packages/Python/lldbsuite/test/expression_command/xvalue/main.cpp === --- /dev/null +++ packages/Python/lldbsuite/test/expression_command/xvalue/main.cpp @@ -0,0 +1,14 @@ +#include + +struct StringRef +{ + const char *data = 0; +}; + +StringRef foo() { return StringRef(); } + +int main(int argc, char const *argv[]) +{ + const char *something = foo().data; + return 0; // Break here +} Index: packages/Python/lldbsuite/test/expression_command/xvalue/TestXValuePrinting.py === --- /dev/null +++ packages/Python/lldbsuite/test/expression_command/xvalue/TestXValuePrinting.py @@ -0,0 +1,37 @@ +from __future__ import print_function + + +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class ExprXValuePrintingTestCase(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +def setUp(self): +# Call super's setUp(). +TestBase.setUp(self) + +self.main_source = "main.cpp" +self.main_source_spec = lldb.SBFileSpec(self.main_source) + +def do_test(self, dictionary=None): +"""Printing an xvalue should work.""" +self.build(dictionary=dictionary) + +(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self, + '// Break here', self.main_source_spec) +frame = thread.GetFrameAtIndex(0) + +value = frame.EvaluateExpression("foo().data") +self.assertTrue(value.IsValid()) +self.assertTrue(value.GetError().Success()) +self.assertEqual(value.GetValueAsUnsigned(), 0) + +@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765") +def test(self): +self.do_test() + Index: packages/Python/lldbsuite/test/expression_command/xvalue/Makefile === --- /dev/null +++ packages/Python/lldbsuite/test/expression_command/xvalue/Makefile @@ -0,0 +1,5 @@ +LEVEL = ../../make + +CXX_SOURCES := main.cpp + +include $(LEVEL)/Makefile.rules Index: source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp === --- source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp +++ source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp @@ -292,8 +292,7 @@ // // - During dematerialization, $0 is ignored. - bool is_lvalue = (last_expr->getValueKind() == VK_LValue || -last_expr->getValueKind() == VK_XValue) && + bool is_lvalue = (last_expr->getValueKind() == VK_LValue) && (last_expr->getObjectKind() == OK_Ordinary); QualType expr_qual_type = last_expr->getType(); Index: packages/Python/lldbsuite/test/expression_command/xvalue/main.cpp === --- /dev/null +++ packages/Python/lldbsuite/test/expression_command/xvalue/main.cpp @@ -0,0 +1,14 @@ +#include + +struct StringRef +{ + const char *data = 0; +}; + +StringRef foo() { return StringRef(); } + +int main(int argc, char const *argv[]) +{ + const char *something = foo().data; + return 0; // Break here +} Index: packages/Python/lldbsuite/test/expression_command/xvalue/TestXValuePrinting.py === --- /dev/null +++ packages/Python/lldbsuite/test/expression_command/xvalue/TestXValuePrinting.py @@ -0,0 +1,37 @@ +from __future__ import print_function + + +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class ExprXValuePrintingTestCase(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +def setUp(self): +# Call super's setUp().
[Lldb-commits] [PATCH] D48303: Don't take the address of an xvalue when printing an expr result
teemperor updated this revision to Diff 151828. teemperor added a comment. - Removed now unnecessary brackets. https://reviews.llvm.org/D48303 Files: packages/Python/lldbsuite/test/expression_command/xvalue/Makefile packages/Python/lldbsuite/test/expression_command/xvalue/TestXValuePrinting.py packages/Python/lldbsuite/test/expression_command/xvalue/main.cpp source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp Index: source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp === --- source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp +++ source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp @@ -292,9 +292,8 @@ // // - During dematerialization, $0 is ignored. - bool is_lvalue = (last_expr->getValueKind() == VK_LValue || -last_expr->getValueKind() == VK_XValue) && - (last_expr->getObjectKind() == OK_Ordinary); + bool is_lvalue = last_expr->getValueKind() == VK_LValue && + last_expr->getObjectKind() == OK_Ordinary; QualType expr_qual_type = last_expr->getType(); const clang::Type *expr_type = expr_qual_type.getTypePtr(); Index: packages/Python/lldbsuite/test/expression_command/xvalue/main.cpp === --- /dev/null +++ packages/Python/lldbsuite/test/expression_command/xvalue/main.cpp @@ -0,0 +1,14 @@ +#include + +struct StringRef +{ + const char *data = 0; +}; + +StringRef foo() { return StringRef(); } + +int main(int argc, char const *argv[]) +{ + const char *something = foo().data; + return 0; // Break here +} Index: packages/Python/lldbsuite/test/expression_command/xvalue/TestXValuePrinting.py === --- /dev/null +++ packages/Python/lldbsuite/test/expression_command/xvalue/TestXValuePrinting.py @@ -0,0 +1,37 @@ +from __future__ import print_function + + +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class ExprXValuePrintingTestCase(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +def setUp(self): +# Call super's setUp(). +TestBase.setUp(self) + +self.main_source = "main.cpp" +self.main_source_spec = lldb.SBFileSpec(self.main_source) + +def do_test(self, dictionary=None): +"""Printing an xvalue should work.""" +self.build(dictionary=dictionary) + +(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self, + '// Break here', self.main_source_spec) +frame = thread.GetFrameAtIndex(0) + +value = frame.EvaluateExpression("foo().data") +self.assertTrue(value.IsValid()) +self.assertTrue(value.GetError().Success()) +self.assertEqual(value.GetValueAsUnsigned(), 0) + +@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765") +def test(self): +self.do_test() + Index: packages/Python/lldbsuite/test/expression_command/xvalue/Makefile === --- /dev/null +++ packages/Python/lldbsuite/test/expression_command/xvalue/Makefile @@ -0,0 +1,5 @@ +LEVEL = ../../make + +CXX_SOURCES := main.cpp + +include $(LEVEL)/Makefile.rules Index: source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp === --- source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp +++ source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp @@ -292,9 +292,8 @@ // // - During dematerialization, $0 is ignored. - bool is_lvalue = (last_expr->getValueKind() == VK_LValue || -last_expr->getValueKind() == VK_XValue) && - (last_expr->getObjectKind() == OK_Ordinary); + bool is_lvalue = last_expr->getValueKind() == VK_LValue && + last_expr->getObjectKind() == OK_Ordinary; QualType expr_qual_type = last_expr->getType(); const clang::Type *expr_type = expr_qual_type.getTypePtr(); Index: packages/Python/lldbsuite/test/expression_command/xvalue/main.cpp === --- /dev/null +++ packages/Python/lldbsuite/test/expression_command/xvalue/main.cpp @@ -0,0 +1,14 @@ +#include + +struct StringRef +{ + const char *data = 0; +}; + +StringRef foo() { return StringRef(); } + +int main(int argc, char const *argv[]) +{ + const char *something = foo().data; + return 0; // Break here +} Index: packages/Python/lldbsuite/test/expression_command/xvalue/TestXValuePrinting.py === --- /dev/null +++ packages/Python/lldbsuite/test/expression_command/xvalue/TestXValuePrinting.py @@ -0,0 +1,37 @@ +from __future__ import print_function + + +import lldb +fro
[Lldb-commits] [PATCH] D47792: Fix up Info.plist when building LLDB.framework with CMake
xiaobai updated this revision to Diff 151840. xiaobai added a comment. Rebasing this commit after my framework refactor https://reviews.llvm.org/D47792 Files: CMakeLists.txt cmake/modules/LLDBFramework.cmake resources/LLDB-Info.plist Index: resources/LLDB-Info.plist === --- resources/LLDB-Info.plist +++ resources/LLDB-Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier - com.apple.${PRODUCT_NAME:rfc1034identifier}.framework + com.apple.${PRODUCT_NAME}.framework CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType Index: cmake/modules/LLDBFramework.cmake === --- cmake/modules/LLDBFramework.cmake +++ cmake/modules/LLDBFramework.cmake @@ -36,6 +36,7 @@ OUTPUT_NAME LLDB FRAMEWORK On FRAMEWORK_VERSION ${LLDB_FRAMEWORK_VERSION} + MACOSX_FRAMEWORK_INFO_PLIST ${LLDB_SOURCE_DIR}/resources/LLDB-Info.plist LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR} PUBLIC_HEADER "${framework_headers}") Index: CMakeLists.txt === --- CMakeLists.txt +++ CMakeLists.txt @@ -49,6 +49,13 @@ if (NOT APPLE) message(FATAL_ERROR "LLDB.framework can only be generated when targeting Apple platforms") endif() + + # These are used to fill out LLDB-Info.plist. These are relevant when building + # the framework, and must be defined before building liblldb. + set(PRODUCT_NAME "LLDB") + set(EXECUTABLE_NAME "LLDB") + set(CURRENT_PROJECT_VERSION "360.99.0") + set(LLDB_FRAMEWORK_DIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_FRAMEWORK_INSTALL_DIR}) endif() Index: resources/LLDB-Info.plist === --- resources/LLDB-Info.plist +++ resources/LLDB-Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier - com.apple.${PRODUCT_NAME:rfc1034identifier}.framework + com.apple.${PRODUCT_NAME}.framework CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType Index: cmake/modules/LLDBFramework.cmake === --- cmake/modules/LLDBFramework.cmake +++ cmake/modules/LLDBFramework.cmake @@ -36,6 +36,7 @@ OUTPUT_NAME LLDB FRAMEWORK On FRAMEWORK_VERSION ${LLDB_FRAMEWORK_VERSION} + MACOSX_FRAMEWORK_INFO_PLIST ${LLDB_SOURCE_DIR}/resources/LLDB-Info.plist LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR} PUBLIC_HEADER "${framework_headers}") Index: CMakeLists.txt === --- CMakeLists.txt +++ CMakeLists.txt @@ -49,6 +49,13 @@ if (NOT APPLE) message(FATAL_ERROR "LLDB.framework can only be generated when targeting Apple platforms") endif() + + # These are used to fill out LLDB-Info.plist. These are relevant when building + # the framework, and must be defined before building liblldb. + set(PRODUCT_NAME "LLDB") + set(EXECUTABLE_NAME "LLDB") + set(CURRENT_PROJECT_VERSION "360.99.0") + set(LLDB_FRAMEWORK_DIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_FRAMEWORK_INSTALL_DIR}) endif() ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r335014 - Fix up Info.plist when building LLDB.framework with CMake
Author: xiaobai Date: Mon Jun 18 19:59:30 2018 New Revision: 335014 URL: http://llvm.org/viewvc/llvm-project?rev=335014&view=rev Log: Fix up Info.plist when building LLDB.framework with CMake Summary: We weren't using the Info.plist template in resources previously. When using that template, some of the key's values weren't being populated because some variables were not being defined. In one case, CMake didn't like the substring expansion syntax of CFBundleIdentifier so I got rid of that. Differential Revision: https://reviews.llvm.org/D47792 Modified: lldb/trunk/CMakeLists.txt lldb/trunk/cmake/modules/LLDBFramework.cmake lldb/trunk/resources/LLDB-Info.plist Modified: lldb/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=335014&r1=335013&r2=335014&view=diff == --- lldb/trunk/CMakeLists.txt (original) +++ lldb/trunk/CMakeLists.txt Mon Jun 18 19:59:30 2018 @@ -49,6 +49,13 @@ if(LLDB_BUILD_FRAMEWORK) if (NOT APPLE) message(FATAL_ERROR "LLDB.framework can only be generated when targeting Apple platforms") endif() + + # These are used to fill out LLDB-Info.plist. These are relevant when building + # the framework, and must be defined before building liblldb. + set(PRODUCT_NAME "LLDB") + set(EXECUTABLE_NAME "LLDB") + set(CURRENT_PROJECT_VERSION "360.99.0") + set(LLDB_FRAMEWORK_DIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_FRAMEWORK_INSTALL_DIR}) endif() Modified: lldb/trunk/cmake/modules/LLDBFramework.cmake URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBFramework.cmake?rev=335014&r1=335013&r2=335014&view=diff == --- lldb/trunk/cmake/modules/LLDBFramework.cmake (original) +++ lldb/trunk/cmake/modules/LLDBFramework.cmake Mon Jun 18 19:59:30 2018 @@ -36,6 +36,7 @@ set_target_properties(liblldb PROPERTIES OUTPUT_NAME LLDB FRAMEWORK On FRAMEWORK_VERSION ${LLDB_FRAMEWORK_VERSION} + MACOSX_FRAMEWORK_INFO_PLIST ${LLDB_SOURCE_DIR}/resources/LLDB-Info.plist LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR} PUBLIC_HEADER "${framework_headers}") Modified: lldb/trunk/resources/LLDB-Info.plist URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/resources/LLDB-Info.plist?rev=335014&r1=335013&r2=335014&view=diff == --- lldb/trunk/resources/LLDB-Info.plist (original) +++ lldb/trunk/resources/LLDB-Info.plist Mon Jun 18 19:59:30 2018 @@ -7,7 +7,7 @@ CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier - com.apple.${PRODUCT_NAME:rfc1034identifier}.framework + com.apple.${PRODUCT_NAME}.framework CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D47792: Fix up Info.plist when building LLDB.framework with CMake
This revision was automatically updated to reflect the committed changes. Closed by commit rL335014: Fix up Info.plist when building LLDB.framework with CMake (authored by xiaobai, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.org/D47792 Files: lldb/trunk/CMakeLists.txt lldb/trunk/cmake/modules/LLDBFramework.cmake lldb/trunk/resources/LLDB-Info.plist Index: lldb/trunk/resources/LLDB-Info.plist === --- lldb/trunk/resources/LLDB-Info.plist +++ lldb/trunk/resources/LLDB-Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier - com.apple.${PRODUCT_NAME:rfc1034identifier}.framework + com.apple.${PRODUCT_NAME}.framework CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType Index: lldb/trunk/cmake/modules/LLDBFramework.cmake === --- lldb/trunk/cmake/modules/LLDBFramework.cmake +++ lldb/trunk/cmake/modules/LLDBFramework.cmake @@ -36,6 +36,7 @@ OUTPUT_NAME LLDB FRAMEWORK On FRAMEWORK_VERSION ${LLDB_FRAMEWORK_VERSION} + MACOSX_FRAMEWORK_INFO_PLIST ${LLDB_SOURCE_DIR}/resources/LLDB-Info.plist LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR} PUBLIC_HEADER "${framework_headers}") Index: lldb/trunk/CMakeLists.txt === --- lldb/trunk/CMakeLists.txt +++ lldb/trunk/CMakeLists.txt @@ -49,6 +49,13 @@ if (NOT APPLE) message(FATAL_ERROR "LLDB.framework can only be generated when targeting Apple platforms") endif() + + # These are used to fill out LLDB-Info.plist. These are relevant when building + # the framework, and must be defined before building liblldb. + set(PRODUCT_NAME "LLDB") + set(EXECUTABLE_NAME "LLDB") + set(CURRENT_PROJECT_VERSION "360.99.0") + set(LLDB_FRAMEWORK_DIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_FRAMEWORK_INSTALL_DIR}) endif() Index: lldb/trunk/resources/LLDB-Info.plist === --- lldb/trunk/resources/LLDB-Info.plist +++ lldb/trunk/resources/LLDB-Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier - com.apple.${PRODUCT_NAME:rfc1034identifier}.framework + com.apple.${PRODUCT_NAME}.framework CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType Index: lldb/trunk/cmake/modules/LLDBFramework.cmake === --- lldb/trunk/cmake/modules/LLDBFramework.cmake +++ lldb/trunk/cmake/modules/LLDBFramework.cmake @@ -36,6 +36,7 @@ OUTPUT_NAME LLDB FRAMEWORK On FRAMEWORK_VERSION ${LLDB_FRAMEWORK_VERSION} + MACOSX_FRAMEWORK_INFO_PLIST ${LLDB_SOURCE_DIR}/resources/LLDB-Info.plist LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR} PUBLIC_HEADER "${framework_headers}") Index: lldb/trunk/CMakeLists.txt === --- lldb/trunk/CMakeLists.txt +++ lldb/trunk/CMakeLists.txt @@ -49,6 +49,13 @@ if (NOT APPLE) message(FATAL_ERROR "LLDB.framework can only be generated when targeting Apple platforms") endif() + + # These are used to fill out LLDB-Info.plist. These are relevant when building + # the framework, and must be defined before building liblldb. + set(PRODUCT_NAME "LLDB") + set(EXECUTABLE_NAME "LLDB") + set(CURRENT_PROJECT_VERSION "360.99.0") + set(LLDB_FRAMEWORK_DIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_FRAMEWORK_INSTALL_DIR}) endif() ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits