[Lldb-commits] [PATCH] D29288: Switch std::call_once to llvm::call_once
clayborg added a comment. See inlined comment about initialization when llvm::once_flag is a member variable Comment at: include/lldb/Core/Debugger.h:379 lldb::ListenerSP m_forward_listener_sp; - std::once_flag m_clear_once; + llvm::once_flag m_clear_once; Is there a valid default initializer for the llvm::once_flag? If so, we are good to go, if not, we need to either initialize it manually, probably by adding another macro to llvm to do the initialization. Static versions might rely on the compiler zeroing out the memory... Repository: rL LLVM https://reviews.llvm.org/D29288 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D29288: Switch std::call_once to llvm::call_once
krytarowski added inline comments. Comment at: include/lldb/Core/Debugger.h:379 lldb::ListenerSP m_forward_listener_sp; - std::once_flag m_clear_once; + llvm::once_flag m_clear_once; clayborg wrote: > Is there a valid default initializer for the llvm::once_flag? If so, we are > good to go, if not, we need to either initialize it manually, probably by > adding another macro to llvm to do the initialization. Static versions might > rely on the compiler zeroing out the memory... Yes, there is a valid default initializer for llvm::once_flag. Related entry in LLVM - D29566 Repository: rL LLVM https://reviews.llvm.org/D29288 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D29288: Switch std::call_once to llvm::call_once
clayborg accepted this revision. clayborg added a comment. This revision is now accepted and ready to land. Thanks for doing the right thing in LLVM first, looks great! Repository: rL LLVM https://reviews.llvm.org/D29288 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r294202 - Switch std::call_once to llvm::call_once
Author: kamil Date: Mon Feb 6 11:55:02 2017 New Revision: 294202 URL: http://llvm.org/viewvc/llvm-project?rev=294202&view=rev Log: Switch std::call_once to llvm::call_once Summary: The std::call_once implementation in libstdc++ has problems on few systems: NetBSD, OpenBSD and Linux PPC. LLVM ships with a homegrown implementation llvm::call_once to help on these platforms. This change is required in the NetBSD LLDB port. std::call_once with libstdc++ results with crashing the debugger. Sponsored by Reviewers: labath, joerg, emaste, mehdi_amini, clayborg Reviewed By: labath, clayborg Subscribers: #lldb Tags: #lldb Differential Revision: https://reviews.llvm.org/D29288 Modified: lldb/trunk/include/lldb/Core/Debugger.h lldb/trunk/source/Commands/CommandObjectPlatform.cpp lldb/trunk/source/Core/Debugger.cpp lldb/trunk/source/Core/ModuleList.cpp lldb/trunk/source/Host/common/Editline.cpp lldb/trunk/source/Host/common/HostInfoBase.cpp lldb/trunk/source/Host/linux/HostInfoLinux.cpp lldb/trunk/source/Host/windows/HostInfoWindows.cpp lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp lldb/trunk/source/Plugins/Language/Go/GoLanguage.cpp lldb/trunk/source/Plugins/Language/Java/JavaLanguage.cpp lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIXLog.cpp lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindowsLog.cpp lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp lldb/trunk/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h lldb/trunk/source/Symbol/ClangASTContext.cpp lldb/trunk/source/Symbol/GoASTContext.cpp lldb/trunk/source/Target/Language.cpp lldb/trunk/source/Utility/ConstString.cpp lldb/trunk/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp Modified: lldb/trunk/include/lldb/Core/Debugger.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Debugger.h?rev=294202&r1=294201&r2=294202&view=diff == --- lldb/trunk/include/lldb/Core/Debugger.h (original) +++ lldb/trunk/include/lldb/Core/Debugger.h Mon Feb 6 11:55:02 2017 @@ -34,6 +34,8 @@ #include "lldb/Target/TargetList.h" #include "lldb/lldb-public.h" +#include "llvm/Support/Threading.h" + namespace llvm { namespace sys { class DynamicLibrary; @@ -374,7 +376,7 @@ protected: HostThread m_io_handler_thread; Broadcaster m_sync_broadcaster; lldb::ListenerSP m_forward_listener_sp; - std::once_flag m_clear_once; + llvm::once_flag m_clear_once; //-- // Events for m_sync_broadcaster Modified: lldb/trunk/source/Commands/CommandObjectPlatform.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectPlatform.cpp?rev=294202&r1=294201&r2=294202&view=diff == --- lldb/trunk/source/Commands/CommandObjectPlatform.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectPlatform.cpp Mon Feb 6 11:55:02 2017 @@ -29,6 +29,7 @@ #include "lldb/Target/Process.h" #include "llvm/ADT/SmallString.h" +#include "llvm/Support/Threading.h" using namespace lldb; using namespace lldb_private; @@ -1248,8 +1249,8 @@ protected: public: CommandOptions() : Options(), match_info(), show_args(false), verbose(false) { - static std::once_flag g_once_flag; - std::call_once(g_once_flag, []() { + static llvm::once_flag g_once_flag; + llvm::call_once(g_once_flag, []() { PosixPlatformCommandOptionValidator *posix_validator = new PosixPlatformCommandOptionValidator(); for (auto &Option : g_platform_process_list_options) { Modified: lldb/trunk/source/Core/Debugger.cpp URL:
[Lldb-commits] [PATCH] D29288: Switch std::call_once to llvm::call_once
This revision was automatically updated to reflect the committed changes. Closed by commit rL294202: Switch std::call_once to llvm::call_once (authored by kamil). Changed prior to commit: https://reviews.llvm.org/D29288?vs=87153&id=87252#toc Repository: rL LLVM https://reviews.llvm.org/D29288 Files: lldb/trunk/include/lldb/Core/Debugger.h lldb/trunk/source/Commands/CommandObjectPlatform.cpp lldb/trunk/source/Core/Debugger.cpp lldb/trunk/source/Core/ModuleList.cpp lldb/trunk/source/Host/common/Editline.cpp lldb/trunk/source/Host/common/HostInfoBase.cpp lldb/trunk/source/Host/linux/HostInfoLinux.cpp lldb/trunk/source/Host/windows/HostInfoWindows.cpp lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp lldb/trunk/source/Plugins/Language/Go/GoLanguage.cpp lldb/trunk/source/Plugins/Language/Java/JavaLanguage.cpp lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIXLog.cpp lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindowsLog.cpp lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp lldb/trunk/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h lldb/trunk/source/Symbol/ClangASTContext.cpp lldb/trunk/source/Symbol/GoASTContext.cpp lldb/trunk/source/Target/Language.cpp lldb/trunk/source/Utility/ConstString.cpp lldb/trunk/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp Index: lldb/trunk/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp === --- lldb/trunk/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp +++ lldb/trunk/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp @@ -46,10 +46,10 @@ s_os_activity_stream_set_event_handler; bool LookupSPICalls() { - static std::once_flag s_once_flag; + static llvm::once_flag s_once_flag; static bool s_has_spi; - std::call_once(s_once_flag, [] { + llvm::call_once(s_once_flag, [] { dlopen ("/System/Library/PrivateFrameworks/LoggingSupport.framework/LoggingSupport", RTLD_NOW); s_os_activity_stream_for_pid = (os_activity_stream_for_pid_t)dlsym( RTLD_DEFAULT, "os_activity_stream_for_pid"); Index: lldb/trunk/source/Host/common/HostInfoBase.cpp === --- lldb/trunk/source/Host/common/HostInfoBase.cpp +++ lldb/trunk/source/Host/common/HostInfoBase.cpp @@ -22,9 +22,10 @@ #include "llvm/Support/Host.h" #include "llvm/Support/Path.h" #include "llvm/Support/ScopedPrinter.h" +#include "llvm/Support/Threading.h" #include "llvm/Support/raw_ostream.h" -#include // std::once +#include #include using namespace lldb; @@ -79,45 +80,45 @@ } uint32_t HostInfoBase::GetNumberCPUS() { - static std::once_flag g_once_flag; - std::call_once(g_once_flag, []() { + static llvm::once_flag g_once_flag; + llvm::call_once(g_once_flag, []() { g_fields->m_number_cpus = std::thread::hardware_concurrency(); }); return g_fields->m_number_cpus; } uint32_t HostInfoBase::GetMaxThreadNameLength() { return 0; } llvm::StringRef HostInfoBase::GetVendorString() { - static std::once_flag g_once_flag; - std::call_once(g_once_flag, []() { + static llvm::once_flag g_once_flag; + llvm::call_once(g_once_flag, []() { g_fields->m_vendor_string = HostInfo::GetArchitecture().GetTriple().getVendorName().str(); }); return g_fields->m_vendor_string; } llvm::StringRef HostInfoBase::GetOSString() { - static std::once_flag g_once_flag; - std::call_once(g_once_flag, []() { + static llvm::once_flag g_once_flag; + llvm::call_once(g_once_flag, []() { g_fields->m_os_string = std::move(HostInfo::GetArchitecture().GetTriple().getOSName()); }); return g_fields->m_os_string; } llvm::StringRef HostInfoBase::GetTargetTriple() { - static std::once_flag g_once_flag;
[Lldb-commits] [lldb] r294206 - Fix Xcode project.
Author: gclayton Date: Mon Feb 6 12:10:39 2017 New Revision: 294206 URL: http://llvm.org/viewvc/llvm-project?rev=294206&view=rev Log: Fix Xcode project. 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=294206&r1=294205&r2=294206&view=diff == --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Mon Feb 6 12:10:39 2017 @@ -331,6 +331,11 @@ 2670F8121862B44A006B332C /* libncurses.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 2670F8111862B44A006B332C /* libncurses.dylib */; }; 26744EF11338317700EF765A /* GDBRemoteCommunicationClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26744EED1338317700EF765A /* GDBRemoteCommunicationClient.cpp */; }; 26744EF31338317700EF765A /* GDBRemoteCommunicationServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26744EEF1338317700EF765A /* GDBRemoteCommunicationServer.cpp */; }; + 26764C971E48F482008D3573 /* ConstString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26764C961E48F482008D3573 /* ConstString.cpp */; }; + 26764C991E48F4D2008D3573 /* Error.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26764C981E48F4D2008D3573 /* Error.cpp */; }; + 26764C9E1E48F51E008D3573 /* Stream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26764C9D1E48F51E008D3573 /* Stream.cpp */; }; + 26764CA01E48F528008D3573 /* RegularExpression.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26764C9F1E48F528008D3573 /* RegularExpression.cpp */; }; + 26764CA21E48F547008D3573 /* StreamString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26764CA11E48F547008D3573 /* StreamString.cpp */; }; 26780C611867C33D00234593 /* libncurses.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 2670F8111862B44A006B332C /* libncurses.dylib */; }; 267A47FB1B1411C40021A5BC /* NativeRegisterContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 267A47FA1B1411C40021A5BC /* NativeRegisterContext.cpp */; }; 267A47FF1B1411D90021A5BC /* NativeWatchpointList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 267A47FE1B1411D90021A5BC /* NativeWatchpointList.cpp */; }; @@ -393,14 +398,12 @@ 2689003113353E0400698AC0 /* Broadcaster.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E6D10F1B85900F91463 /* Broadcaster.cpp */; }; 2689003213353E0400698AC0 /* Communication.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E6E10F1B85900F91463 /* Communication.cpp */; }; 2689003313353E0400698AC0 /* Connection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E6F10F1B85900F91463 /* Connection.cpp */; }; - 2689003513353E0400698AC0 /* ConstString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E9410F1B85900F91463 /* ConstString.cpp */; }; 2689003613353E0400698AC0 /* DataBufferHeap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E7210F1B85900F91463 /* DataBufferHeap.cpp */; }; 2689003713353E0400698AC0 /* DataBufferMemoryMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E7310F1B85900F91463 /* DataBufferMemoryMap.cpp */; }; 2689003813353E0400698AC0 /* DataExtractor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E7110F1B85900F91463 /* DataExtractor.cpp */; }; 2689003913353E0400698AC0 /* Debugger.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 263664921140A4930075843B /* Debugger.cpp */; }; 2689003A13353E0400698AC0 /* Disassembler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E7610F1B85900F91463 /* Disassembler.cpp */; }; 2689003B13353E0400698AC0 /* EmulateInstruction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26D9FDC812F784FD0003F2EE /* EmulateInstruction.cpp */; }; - 2689003C13353E0400698AC0 /* Error.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E7810F1B85900F91463 /* Error.cpp */; }; 2689003D13353E0400698AC0 /* Event.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E7910F1B85900F91463 /* Event.cpp */; }; 2689003E13353E0400698AC0 /* FileSpecList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E7B10F1B85900F91463 /* FileSpecList.cpp */; }; 2689004113353E0400698AC0 /* Listener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E7E10F1B85900F91463 /* Listener.cpp */; }; @@ -410,15 +413,12 @@ 2689004513353E0400698AC0 /* ModuleChild.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E8210F1B85900F91463 /* ModuleChild.cpp */; }; 2689004613353E0400698AC0 /* ModuleList.cpp in Sou
[Lldb-commits] [lldb] r294210 - Get rid of Error::PutToLog().
Author: zturner Date: Mon Feb 6 12:31:44 2017 New Revision: 294210 URL: http://llvm.org/viewvc/llvm-project?rev=294210&view=rev Log: Get rid of Error::PutToLog(). Instead just rely on LLDB_LOG(). This is part of an effort to sort out dependency hell in LLDB. Error is in Utility, but Log is in Core. Core can depend on Utility, but not vice versa. So this patch moves the knowledge about how to log Errors from the Error class to the Log file. Differential Revision: https://reviews.llvm.org/D29514 Modified: lldb/trunk/include/lldb/Utility/Error.h lldb/trunk/source/Core/Communication.cpp lldb/trunk/source/Host/common/Host.cpp lldb/trunk/source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp lldb/trunk/source/Utility/Error.cpp Modified: lldb/trunk/include/lldb/Utility/Error.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Error.h?rev=294210&r1=294209&r2=294210&view=diff == --- lldb/trunk/include/lldb/Utility/Error.h (original) +++ lldb/trunk/include/lldb/Utility/Error.h Mon Feb 6 12:31:44 2017 @@ -12,6 +12,7 @@ #if defined(__cplusplus) #include "llvm/Support/DataTypes.h" +#include "llvm/Support/FormatAdapters.h" #include "llvm/Support/FormatVariadic.h" #include @@ -24,8 +25,6 @@ namespace lldb_private { -class Log; - //-- /// @class Error Error.h "lldb/Utility/Error.h" /// @brief An error handling class. @@ -148,48 +147,6 @@ public: lldb::ErrorType GetType() const; //-- - /// Log an error to Log(). - /// - /// Log the error given a formatted string \a format. If the this - /// object contains an error code, update the error string to - /// contain the prefix "error: ", followed by the formatted string, - /// followed by the error value and any string that describes the - /// error value. This allows more context to be given to an error - /// string that remains cached in this object. Logging always occurs - /// even when the error code contains a non-error value. - /// - /// @param[in] format - /// A printf style format string. - /// - /// @param[in] ... - /// Variable arguments that are needed for the printf style - /// format string \a format. - //-- - void PutToLog(Log *log, const char *format, ...) - __attribute__((format(printf, 3, 4))); - - //-- - /// Log an error to Log() if the error value is an error. - /// - /// Log the error given a formatted string \a format only if the - /// error value in this object describes an error condition. If the - /// this object contains an error, update the error string to - /// contain the prefix "error: " followed by the formatted string, - /// followed by the error value and any string that describes the - /// error value. This allows more context to be given to an error - /// string that remains cached in this object. - /// - /// @param[in] format - /// A printf style format string. - /// - /// @param[in] ... - /// Variable arguments that are needed for the printf style - /// format string \a format. - //-- - void LogIfError(Log *log, const char *format, ...) - __attribute__((format(printf, 3, 4))); - - //-- /// Set accessor from a kern_return_t. /// /// Set accesssor for the error value to \a err and the error type @@ -304,10 +261,7 @@ protected: namespace llvm { template <> struct format_provider { static void format(const lldb_private::Error &error, llvm::raw_ostream &OS, - llvm::StringRef Options) { -llvm::format_provider::format(error.AsCString(), OS, - Options); - } + llvm::StringRef Options); }; } Modified: lldb/trunk/source/Core/Communication.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Communication.cpp?rev=294210&r1=294209&r2=294210&view=diff == --- lldb/trunk/source/Core/Communication.cpp (original) +++ lldb/trunk/source/Core/Communication.cpp Mon Feb 6 12:31:44 2017 @@ -322,10 +322,9 @@ lldb::thread_result_t Communication::Rea comm->Disconnect(); done = true; } - if (log) -error.LogIfError( -log, "%p Communication::ReadFromConnection () => status = %s", p, -Communication::ConnectionStatusAsCString(status)); + if (error.Fail()) +LLDB_LOG(log, "error: {0}, status = {1}", error, + Communication::ConnectionStatusAsCString(status)); break; ca
[Lldb-commits] [PATCH] D29514: Change Error::PutToLog to LLDB_LOG_ERROR
This revision was automatically updated to reflect the committed changes. Closed by commit rL294210: Get rid of Error::PutToLog(). (authored by zturner). Changed prior to commit: https://reviews.llvm.org/D29514?vs=87036&id=87260#toc Repository: rL LLVM https://reviews.llvm.org/D29514 Files: lldb/trunk/include/lldb/Utility/Error.h lldb/trunk/source/Core/Communication.cpp lldb/trunk/source/Host/common/Host.cpp lldb/trunk/source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp lldb/trunk/source/Utility/Error.cpp Index: lldb/trunk/include/lldb/Utility/Error.h === --- lldb/trunk/include/lldb/Utility/Error.h +++ lldb/trunk/include/lldb/Utility/Error.h @@ -12,6 +12,7 @@ #if defined(__cplusplus) #include "llvm/Support/DataTypes.h" +#include "llvm/Support/FormatAdapters.h" #include "llvm/Support/FormatVariadic.h" #include @@ -24,8 +25,6 @@ namespace lldb_private { -class Log; - //-- /// @class Error Error.h "lldb/Utility/Error.h" /// @brief An error handling class. @@ -148,48 +147,6 @@ lldb::ErrorType GetType() const; //-- - /// Log an error to Log(). - /// - /// Log the error given a formatted string \a format. If the this - /// object contains an error code, update the error string to - /// contain the prefix "error: ", followed by the formatted string, - /// followed by the error value and any string that describes the - /// error value. This allows more context to be given to an error - /// string that remains cached in this object. Logging always occurs - /// even when the error code contains a non-error value. - /// - /// @param[in] format - /// A printf style format string. - /// - /// @param[in] ... - /// Variable arguments that are needed for the printf style - /// format string \a format. - //-- - void PutToLog(Log *log, const char *format, ...) - __attribute__((format(printf, 3, 4))); - - //-- - /// Log an error to Log() if the error value is an error. - /// - /// Log the error given a formatted string \a format only if the - /// error value in this object describes an error condition. If the - /// this object contains an error, update the error string to - /// contain the prefix "error: " followed by the formatted string, - /// followed by the error value and any string that describes the - /// error value. This allows more context to be given to an error - /// string that remains cached in this object. - /// - /// @param[in] format - /// A printf style format string. - /// - /// @param[in] ... - /// Variable arguments that are needed for the printf style - /// format string \a format. - //-- - void LogIfError(Log *log, const char *format, ...) - __attribute__((format(printf, 3, 4))); - - //-- /// Set accessor from a kern_return_t. /// /// Set accesssor for the error value to \a err and the error type @@ -304,10 +261,7 @@ namespace llvm { template <> struct format_provider { static void format(const lldb_private::Error &error, llvm::raw_ostream &OS, - llvm::StringRef Options) { -llvm::format_provider::format(error.AsCString(), OS, - Options); - } + llvm::StringRef Options); }; } Index: lldb/trunk/source/Host/common/Host.cpp === --- lldb/trunk/source/Host/common/Host.cpp +++ lldb/trunk/source/Host/common/Host.cpp @@ -685,10 +685,10 @@ posix_spawnattr_t attr; error.SetError(::posix_spawnattr_init(&attr), eErrorTypePOSIX); - if (error.Fail() || log) -error.PutToLog(log, "::posix_spawnattr_init ( &attr )"); - if (error.Fail()) + if (error.Fail()) { +LLDB_LOG(log, "error: {0}, ::posix_spawnattr_init ( &attr )", error); return error; + } // Make a quick class that will cleanup the posix spawn attributes in case // we return in the middle of this function. @@ -709,11 +709,12 @@ short flags = GetPosixspawnFlags(launch_info); error.SetError(::posix_spawnattr_setflags(&attr, flags), eErrorTypePOSIX); - if (error.Fail() || log) -error.PutToLog(log, "::posix_spawnattr_setflags ( &attr, flags=0x%8.8x )", - flags); - if (error.Fail()) + if (error.Fail()) { +LLDB_LOG(log, + "error: {0}, ::posix_spawnattr_setflags ( &attr, flags={1:x} )", + error, flags); return error; + } // posix_spawnattr_setbinpref_np appears to be an Apple extension per: // http://www.unix.com/man-page/OSX/3/posix_
[Lldb-commits] [lldb] r294211 - Fix missing include in NativeProcessLinux
Author: labath Date: Mon Feb 6 12:36:58 2017 New Revision: 294211 URL: http://llvm.org/viewvc/llvm-project?rev=294211&view=rev Log: Fix missing include in NativeProcessLinux Modified: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp Modified: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp?rev=294211&r1=294210&r2=294211&view=diff == --- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp (original) +++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp Mon Feb 6 12:36:58 2017 @@ -32,6 +32,8 @@ #include "lldb/Host/ThreadLauncher.h" #include "lldb/Host/common/NativeBreakpoint.h" #include "lldb/Host/common/NativeRegisterContext.h" +#include "lldb/Host/linux/Ptrace.h" +#include "lldb/Host/linux/Uio.h" #include "lldb/Host/posix/ProcessLauncherPosixFork.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Target/Process.h" @@ -47,20 +49,15 @@ #include "ProcFileReader.h" #include "Procfs.h" -// System includes - They have to be included after framework includes because -// they define some -// macros which collide with variable names in other modules +#include "llvm/Support/Threading.h" + #include #include - #include #include #include #include -#include "lldb/Host/linux/Ptrace.h" -#include "lldb/Host/linux/Uio.h" - // Support hardware breakpoints in case it has not been defined #ifndef TRAP_HWBKPT #define TRAP_HWBKPT 4 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D29352: [CMake] Final dependency cleanup patch!
beanz updated this revision to Diff 87265. beanz added a comment. Rebasing patch https://reviews.llvm.org/D29352 Files: cmake/LLDBDependencies.cmake cmake/modules/AddLLDB.cmake source/API/CMakeLists.txt source/Initialization/CMakeLists.txt source/Plugins/Process/CMakeLists.txt source/Plugins/Process/Windows/Common/CMakeLists.txt tools/intel-mpx/CMakeLists.txt tools/lldb-server/CMakeLists.txt unittests/CMakeLists.txt Index: unittests/CMakeLists.txt === --- unittests/CMakeLists.txt +++ unittests/CMakeLists.txt @@ -39,7 +39,6 @@ POST_BUILD COMMAND "${CMAKE_COMMAND}" -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/Inputs) - lldb_link_common_libs(${test_name} EXE) target_link_libraries(${test_name} ${ARG_LINK_LIBS} ${CLANG_USED_LIBS} ${LLDB_SYSTEM_LIBS}) endfunction() Index: tools/lldb-server/CMakeLists.txt === --- tools/lldb-server/CMakeLists.txt +++ tools/lldb-server/CMakeLists.txt @@ -23,90 +23,6 @@ include_directories(../../source) - -set( LLDB_USED_LIBS - lldbBase - lldbBreakpoint - lldbCommands - lldbDataFormatters - lldbHost - lldbCore - lldbExpression - lldbInitialization - lldbInterpreter - lldbSymbol - lldbTarget - lldbUtility - - # Plugins - lldbPluginDisassemblerLLVM - lldbPluginSymbolFileDWARF - lldbPluginSymbolFilePDB - lldbPluginSymbolFileSymtab - lldbPluginDynamicLoaderPosixDYLD - - lldbPluginCPlusPlusLanguage - lldbPluginGoLanguage - lldbPluginJavaLanguage - lldbPluginObjCLanguage - lldbPluginObjCPlusPlusLanguage - lldbPluginOCamlLanguage - - lldbPluginObjectFileELF - lldbPluginObjectFileJIT - lldbPluginSymbolVendorELF - lldbPluginPlatformPOSIX - lldbPluginObjectContainerBSDArchive - lldbPluginObjectContainerMachOArchive - lldbPluginProcessGDBRemote - lldbPluginProcessUtility - lldbPluginObjectContainerMachOArchive - lldbPluginObjectContainerBSDArchive - lldbPluginPlatformMacOSX - lldbPluginUnwindAssemblyInstEmulation - lldbPluginUnwindAssemblyX86 - lldbPluginAppleObjCRuntime - lldbPluginCXXItaniumABI - lldbPluginInstructionARM - lldbPluginInstructionARM64 - lldbPluginInstructionMIPS - lldbPluginInstructionMIPS64 - lldbPluginObjectFilePECOFF - lldbPluginExpressionParserClang - lldbPluginExpressionParserGo - ) - -# Linux-only libraries -if ( CMAKE_SYSTEM_NAME MATCHES "Linux|Android" ) - list(APPEND LLDB_USED_LIBS -lldbPluginProcessLinux -lldbPluginProcessPOSIX - ) -endif () - -# Darwin-only libraries -if ( CMAKE_SYSTEM_NAME MATCHES "Darwin" ) - list(APPEND LLDB_USED_LIBS -lldbPluginObjectFileMachO -) -endif() - -set( CLANG_USED_LIBS - clangAnalysis - clangAST - clangBasic - clangCodeGen - clangDriver - clangEdit - clangFrontend - clangLex - clangParse - clangRewrite - clangRewriteFrontend - clangSema - clangSerialization - ) - set(LLDB_SYSTEM_LIBS) if (NOT LLDB_DISABLE_LIBEDIT) list(APPEND LLDB_SYSTEM_LIBS edit) @@ -142,53 +58,24 @@ endif() endif() -set(LLVM_LINK_COMPONENTS - ${LLVM_TARGETS_TO_BUILD} - interpreter - asmparser - bitreader - bitwriter - codegen - demangle - ipo - selectiondag - bitreader - mc - mcjit - core - mcdisassembler - executionengine - runtimedyld - option - support - coverage - target - ) - add_lldb_tool(lldb-server INCLUDE_IN_FRAMEWORK Acceptor.cpp lldb-gdbserver.cpp lldb-platform.cpp lldb-server.cpp LLDBServerUtilities.cpp -) -# The Darwin linker doesn't understand --start-group/--end-group. -if (LLDB_LINKER_SUPPORTS_GROUPS) - target_link_libraries(lldb-server --Wl,--start-group ${LLDB_USED_LIBS} -Wl,--end-group) - target_link_libraries(lldb-server --Wl,--start-group ${CLANG_USED_LIBS} -Wl,--end-group) -else() - target_link_libraries(lldb-server ${LLDB_USED_LIBS}) - target_link_libraries(lldb-server ${CLANG_USED_LIBS}) -endif() -if(NOT LLVM_LINK_LLVM_DYLIB) - # This is necessary in !LLVM_LINK_LLVM_DYLIB as LLDB's libs do not track their - # dependencies properly. It is conditional because in a LLVM_LINK_LLVM_DYLIB - # build it would introduce duplicate symbols (add_lldb_tool links to libLLVM, - # and this would add the individual .a files as well). - llvm_config(lldb-server ${LLVM_LINK_COMPONENTS}) -endif() +LINK_LIBS + lldbBase + lldbCore + lldbHost + lldbInitialization + lldbInterpreter + ${EXTRA_LLDB_LIBS} + ${LLDB_SYSTEM_LIBS} + +LINK_COMPONENTS + Support +) target_link_libraries(lldb-server ${LLDB_SYSTEM_LIBS}) Index: tools/intel-mpx/CMakeLists.txt === --- tools/intel-mpx/CMakeLists.txt +++ tools/intel-mpx/CMakeLists.txt @@ -8,16 +8,8 @@ IntelMPXTablePlugin.cpp ) -target_link_libraries(lldb-intel-mpxtable PUBLIC liblldb) - -if (LLDB_LINKER_SUPPORTS_GROUPS) - target_link_libraries
[Lldb-commits] [lldb] r294213 - Try to fix build on non-Windows platforms.
Author: zturner Date: Mon Feb 6 12:49:16 2017 New Revision: 294213 URL: http://llvm.org/viewvc/llvm-project?rev=294213&view=rev Log: Try to fix build on non-Windows platforms. Modified: lldb/trunk/source/Host/common/Host.cpp Modified: lldb/trunk/source/Host/common/Host.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=294213&r1=294212&r2=294213&view=diff == --- lldb/trunk/source/Host/common/Host.cpp (original) +++ lldb/trunk/source/Host/common/Host.cpp Mon Feb 6 12:49:16 2017 @@ -795,14 +795,14 @@ Error Host::LaunchProcessPosixSpawn(cons #else if (::getcwd(current_dir, sizeof(current_dir)) == NULL) { error.SetError(errno, eErrorTypePOSIX); - error.LogIfError(log, "unable to save the current directory"); + LLDB_LOG(log, "error: {0}, unable to save the current directory", error); return error; } if (::chdir(working_dir.GetCString()) == -1) { error.SetError(errno, eErrorTypePOSIX); - error.LogIfError(log, "unable to change working directory to %s", - working_dir.GetCString()); + LLDB_LOG(log, "error: {0}, unable to change working directory to {1}", + error, working_dir); return error; } #endif @@ -876,8 +876,9 @@ Error Host::LaunchProcessPosixSpawn(cons #else if (::chdir(current_dir) == -1 && error.Success()) { error.SetError(errno, eErrorTypePOSIX); - error.LogIfError(log, "unable to change current directory back to %s", - current_dir); + LLDB_LOG(log, + "error: {0}, unable to change current directory back to {1}", + error, current_dir); } #endif } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r294215 - Really fix build on non-windows platforms :)
Author: labath Date: Mon Feb 6 12:56:34 2017 New Revision: 294215 URL: http://llvm.org/viewvc/llvm-project?rev=294215&view=rev Log: Really fix build on non-windows platforms :) Modified: lldb/trunk/source/Host/common/Host.cpp Modified: lldb/trunk/source/Host/common/Host.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=294215&r1=294214&r2=294215&view=diff == --- lldb/trunk/source/Host/common/Host.cpp (original) +++ lldb/trunk/source/Host/common/Host.cpp Mon Feb 6 12:56:34 2017 @@ -863,7 +863,7 @@ Error Host::LaunchProcessPosixSpawn(cons error, result_pid, exe_path, &attr, argv, envp); if (log) { for (int ii = 0; argv[ii]; ++ii) - LLDB_LOG("argv[{0}] = '{1}'", ii, argv[ii]); + LLDB_LOG(log, "argv[{0}] = '{1}'", ii, argv[ii]); } } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r294219 - Remove the verbose category in the dwarf channel
Author: labath Date: Mon Feb 6 13:19:30 2017 New Revision: 294219 URL: http://llvm.org/viewvc/llvm-project?rev=294219&view=rev Log: Remove the verbose category in the dwarf channel Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp?rev=294219&r1=294218&r2=294219&view=diff == --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp Mon Feb 6 13:19:30 2017 @@ -256,16 +256,15 @@ size_t DWARFCompileUnit::ExtractDIEsIfNe m_die_array.end()); exact_size_die_array.swap(m_die_array); } - Log *verbose_log( - LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO | DWARF_LOG_VERBOSE)); - if (verbose_log) { + Log *log(LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO)); + if (log && log->GetVerbose()) { StreamString strm; Dump(&strm); if (m_die_array.empty()) strm.Printf("error: no DIE for compile unit"); else m_die_array[0].Dump(m_dwarf2Data, this, strm, UINT32_MAX); -verbose_log->PutString(strm.GetString()); +log->PutString(strm.GetString()); } if (!m_dwo_symbol_file) Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp?rev=294219&r1=294218&r2=294219&view=diff == --- lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp Mon Feb 6 13:19:30 2017 @@ -78,8 +78,6 @@ void LogChannelDWARF::Disable(const char flag_bits &= ~DWARF_LOG_DEBUG_MAP; else if (::strcasecmp(arg, "default") == 0) flag_bits &= ~DWARF_LOG_DEFAULT; -else if (::strcasecmp(arg, "verbose") == 0) - flag_bits &= ~DWARF_LOG_VERBOSE; else if (::strncasecmp(arg, "comp", 4) == 0) flag_bits &= ~DWARF_LOG_TYPE_COMPLETION; else { @@ -133,8 +131,6 @@ bool LogChannelDWARF::Enable( flag_bits |= DWARF_LOG_DEBUG_MAP; else if (::strcasecmp(arg, "default") == 0) flag_bits |= DWARF_LOG_DEFAULT; -else if (::strcasecmp(arg, "verbose") == 0) - flag_bits |= DWARF_LOG_VERBOSE; else if (::strncasecmp(arg, "comp", 4) == 0) flag_bits |= DWARF_LOG_TYPE_COMPLETION; else { Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h?rev=294219&r1=294218&r2=294219&view=diff == --- lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h Mon Feb 6 13:19:30 2017 @@ -16,7 +16,6 @@ // Project includes #include "lldb/Core/Log.h" -#define DWARF_LOG_VERBOSE (1u << 0) #define DWARF_LOG_DEBUG_INFO (1u << 1) #define DWARF_LOG_DEBUG_LINE (1u << 2) #define DWARF_LOG_DEBUG_PUBNAMES (1u << 3) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r294222 - Fix darwin build (error.PutToLog fallout)
Author: labath Date: Mon Feb 6 13:31:02 2017 New Revision: 294222 URL: http://llvm.org/viewvc/llvm-project?rev=294222&view=rev Log: Fix darwin build (error.PutToLog fallout) Modified: lldb/trunk/source/Host/macosx/Host.mm Modified: lldb/trunk/source/Host/macosx/Host.mm URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Host.mm?rev=294222&r1=294221&r2=294222&view=diff == --- lldb/trunk/source/Host/macosx/Host.mm (original) +++ lldb/trunk/source/Host/macosx/Host.mm Mon Feb 6 13:31:02 2017 @@ -957,9 +957,7 @@ static Error getXPCAuthorization(Process if (createStatus != errAuthorizationSuccess) { error.SetError(1, eErrorTypeGeneric); error.SetErrorString("Can't create authorizationRef."); - if (log) { -error.PutToLog(log, "%s", error.AsCString()); - } + LLDB_LOG(log, "error: {0}", error); return error; } @@ -1012,9 +1010,7 @@ static Error getXPCAuthorization(Process error.SetError(2, eErrorTypeGeneric); error.SetErrorStringWithFormat( "Launching as root needs root authorization."); - if (log) { -error.PutToLog(log, "%s", error.AsCString()); - } + LLDB_LOG(log, "error: {0}", error); if (authorizationRef) { AuthorizationFree(authorizationRef, kAuthorizationFlagDefaults); @@ -1050,9 +1046,7 @@ static Error LaunchProcessXPC(const char error.SetError(3, eErrorTypeGeneric); error.SetErrorStringWithFormat("Launching root via XPC needs to " "externalize authorization reference."); - if (log) { -error.PutToLog(log, "%s", error.AsCString()); - } + LLDB_LOG(log, "error: {0}", error); return error; } xpc_service = LaunchUsingXPCRightName; @@ -1060,9 +1054,7 @@ static Error LaunchProcessXPC(const char error.SetError(4, eErrorTypeGeneric); error.SetErrorStringWithFormat( "Launching via XPC is only currently available for root."); -if (log) { - error.PutToLog(log, "%s", error.AsCString()); -} +LLDB_LOG(log, "error: {0}", error); return error; } @@ -1146,9 +1138,7 @@ static Error LaunchProcessXPC(const char error.SetErrorStringWithFormat( "Problems with launching via XPC. Error type : %i, code : %i", errorType, errorCode); - if (log) { -error.PutToLog(log, "%s", error.AsCString()); - } + LLDB_LOG(log, "error: {0}", error); if (authorizationRef) { AuthorizationFree(authorizationRef, kAuthorizationFlagDefaults); @@ -1160,9 +1150,7 @@ static Error LaunchProcessXPC(const char error.SetErrorStringWithFormat( "Problems with launching via XPC. XPC error : %s", xpc_dictionary_get_string(reply, XPC_ERROR_KEY_DESCRIPTION)); -if (log) { - error.PutToLog(log, "%s", error.AsCString()); -} +LLDB_LOG(log, "error: {0}", error); } return error; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r294223 - Remove the verbose category in the posix channel
Author: labath Date: Mon Feb 6 13:31:05 2017 New Revision: 294223 URL: http://llvm.org/viewvc/llvm-project?rev=294223&view=rev Log: Remove the verbose category in the posix channel replace by LLDB_LOGV Modified: lldb/trunk/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIXLog.cpp lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIXLog.h Modified: lldb/trunk/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp?rev=294223&r1=294222&r2=294223&view=diff == --- lldb/trunk/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp (original) +++ lldb/trunk/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp Mon Feb 6 13:31:05 2017 @@ -53,8 +53,7 @@ FreeBSDThread::FreeBSDThread(Process &pr : Thread(process, tid), m_frame_ap(), m_breakpoint(), m_thread_name_valid(false), m_thread_name(), m_posix_thread(NULL) { Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD)); - if (log && log->GetMask().Test(POSIX_LOG_VERBOSE)) -log->Printf("FreeBSDThread::%s (tid = %" PRIi64 ")", __FUNCTION__, tid); + LLDB_LOGV(log, "tid = {0}", tid); // Set the current watchpoints for this thread. Target &target = GetProcess()->GetTarget(); @@ -215,8 +214,7 @@ FreeBSDThread::CreateRegisterContextForF uint32_t concrete_frame_idx = 0; Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD)); - if (log && log->GetMask().Test(POSIX_LOG_VERBOSE)) -log->Printf("FreeBSDThread::%s ()", __FUNCTION__); + LLDB_LOGV(log, "called"); if (frame) concrete_frame_idx = frame->GetConcreteFrameIndex(); 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=294223&r1=294222&r2=294223&view=diff == --- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp (original) +++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp Mon Feb 6 13:31:05 2017 @@ -290,8 +290,7 @@ Error ProcessFreeBSD::DoAttachToProcessW assert(m_monitor == NULL); Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); - if (log && log->GetMask().Test(POSIX_LOG_VERBOSE)) -log->Printf("ProcessFreeBSD::%s(pid = %" PRIi64 ")", __FUNCTION__, GetID()); + LLDB_LOGV(log, "pid = {0}", GetID()); m_monitor = new ProcessMonitor(this, pid, error); @@ -537,9 +536,7 @@ ProcessFreeBSD::CreateNewFreeBSDThread(l void ProcessFreeBSD::RefreshStateAfterStop() { Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); - if (log && log->GetMask().Test(POSIX_LOG_VERBOSE)) -log->Printf("ProcessFreeBSD::%s(), message_queue size = %d", __FUNCTION__, -(int)m_message_queue.size()); + LLDB_LOGV(log, "message_queue size = {0}", m_message_queue.size()); std::lock_guard guard(m_message_mutex); @@ -551,10 +548,8 @@ void ProcessFreeBSD::RefreshStateAfterSt // Resolve the thread this message corresponds to and pass it along. lldb::tid_t tid = message.GetTID(); -if (log) - log->Printf( - "ProcessFreeBSD::%s(), message_queue size = %d, pid = %" PRIi64, - __FUNCTION__, (int)m_message_queue.size(), tid); +LLDB_LOGV(log, " message_queue size = {0}, pid = {1}", + m_message_queue.size(), tid); m_thread_list.RefreshStateAfterStop(); @@ -566,10 +561,7 @@ void ProcessFreeBSD::RefreshStateAfterSt if (message.GetKind() == ProcessMessage::eExitMessage) { // FIXME: We should tell the user about this, but the limbo message is // probably better for that. - if (log) -log->Printf("ProcessFreeBSD::%s() removing thread, tid = %" PRIi64, -__FUNCTION__, tid); - + LLDB_LOG(log, "removing thread, tid = {0}", tid); std::lock_guard guard(m_thread_list.GetMutex()); ThreadSP thread_sp = m_thread_list.RemoveThreadByID(tid, false); Modified: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp?rev=294223&r1=294222&r2=294223&view=diff == --- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp (original) +++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp Mon Feb 6 13:31:05 2017 @@ -140,8 +140,7 @@ void DisplayBytes(StreamString &s, void } void PtraceDisplayBytes(int &req, void *data, size_t data_size) { - Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PT
[Lldb-commits] [lldb] r294224 - Remove the verbose category in the gdb-remote channel
Author: labath Date: Mon Feb 6 13:31:09 2017 New Revision: 294224 URL: http://llvm.org/viewvc/llvm-project?rev=294224&view=rev Log: Remove the verbose category in the gdb-remote channel replace by LLDB_LOGV Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=294224&r1=294223&r2=294224&view=diff == --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Mon Feb 6 13:31:09 2017 @@ -321,8 +321,7 @@ GDBRemoteCommunication::WaitForPacketNoL uint8_t buffer[8192]; Error error; - Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PACKETS | - GDBR_LOG_VERBOSE)); + Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PACKETS)); // Check for a packet from our cache first without trying any reading... if (CheckForPacket(NULL, 0, packet) != PacketType::Invalid) @@ -334,12 +333,12 @@ GDBRemoteCommunication::WaitForPacketNoL lldb::ConnectionStatus status = eConnectionStatusNoConnection; size_t bytes_read = Read(buffer, sizeof(buffer), timeout, status, &error); -if (log) - log->Printf("%s: Read (buffer, (sizeof(buffer), timeout = %ld us, " - "status = %s, error = %s) => bytes_read = %" PRIu64, - LLVM_PRETTY_FUNCTION, long(timeout ? timeout->count() : -1), - Communication::ConnectionStatusAsCString(status), - error.AsCString(), (uint64_t)bytes_read); +LLDB_LOGV(log, + "Read(buffer, sizeof(buffer), timeout = {0} us, " + "status = {1}, error = {2}) => bytes_read = {3}", + long(timeout ? timeout->count() : -1), + Communication::ConnectionStatusAsCString(status), error, + bytes_read); if (bytes_read > 0) { if (CheckForPacket(buffer, bytes_read, packet) != PacketType::Invalid) Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=294224&r1=294223&r2=294224&view=diff == --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Mon Feb 6 13:31:09 2017 @@ -1617,9 +1617,7 @@ bool ProcessGDBRemote::UpdateThreadList( ThreadList &new_thread_list) { // locker will keep a mutex locked until it goes out of scope Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_THREAD)); - if (log && log->GetMask().Test(GDBR_LOG_VERBOSE)) -log->Printf("ProcessGDBRemote::%s (pid = %" PRIu64 ")", __FUNCTION__, -GetID()); + LLDB_LOGV(log, "pid = {0}", GetID()); size_t num_thread_ids = m_thread_ids.size(); // The "m_thread_ids" thread ID list should always be updated after each stop @@ -1638,17 +1636,11 @@ bool ProcessGDBRemote::UpdateThreadList( old_thread_list_copy.RemoveThreadByProtocolID(tid, false)); if (!thread_sp) { thread_sp.reset(new ThreadGDBRemote(*this, tid)); -if (log && log->GetMask().Test(GDBR_LOG_VERBOSE)) - log->Printf("ProcessGDBRemote::%s Making new thread: %p for thread " - "ID: 0x%" PRIx64 ".\n", - __FUNCTION__, static_cast(thread_sp.get()), - thread_sp->GetID()); +LLDB_LOGV(log, "Making new thread: {0} for thread ID: {1:x}.", + thread_sp.get(), thread_sp->GetID()); } else { -if (log && log->GetMask().Test(GDBR_LOG_VERBOSE)) - log->Printf("ProcessGDBRemote::%s Found old thread: %p for thread " - "ID: 0x%" PRIx64 ".\n", - __FUNCTION__, static_cast(thread_sp.get()), - thread_sp->GetID()); +LLDB_LOGV(log, "Found old thread: {0} for thread ID: {1:x}.", + thread_sp.get(), thread_sp->GetID()); } SetThreadPc(thread_sp, i); Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp?rev=294224&r1=294223&r2=294224&view=diff ==
[Lldb-commits] [lldb] r294221 - Fix darwin build (llvm::once_flag fallout)
Author: labath Date: Mon Feb 6 13:30:59 2017 New Revision: 294221 URL: http://llvm.org/viewvc/llvm-project?rev=294221&view=rev Log: Fix darwin build (llvm::once_flag fallout) Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp lldb/trunk/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp?rev=294221&r1=294220&r2=294221&view=diff == --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp (original) +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp Mon Feb 6 13:30:59 2017 @@ -24,6 +24,7 @@ #include "lldb/Utility/LLDBAssert.h" #include "lldb/Utility/PseudoTerminal.h" #include "lldb/Utility/StreamString.h" +#include "llvm/Support/Threading.h" using namespace lldb; using namespace lldb_private; Modified: lldb/trunk/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp?rev=294221&r1=294220&r2=294221&view=diff == --- lldb/trunk/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp (original) +++ lldb/trunk/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp Mon Feb 6 13:30:59 2017 @@ -46,10 +46,10 @@ static os_activity_stream_set_event_hand s_os_activity_stream_set_event_handler; bool LookupSPICalls() { - static llvm::once_flag s_once_flag; + static std::once_flag s_once_flag; static bool s_has_spi; - llvm::call_once(s_once_flag, [] { + std::call_once(s_once_flag, [] { dlopen ("/System/Library/PrivateFrameworks/LoggingSupport.framework/LoggingSupport", RTLD_NOW); s_os_activity_stream_for_pid = (os_activity_stream_for_pid_t)dlsym( RTLD_DEFAULT, "os_activity_stream_for_pid"); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r294243 - Switch PlatformLinux to LLDB_LOG
Author: labath Date: Mon Feb 6 15:30:44 2017 New Revision: 294243 URL: http://llvm.org/viewvc/llvm-project?rev=294243&view=rev Log: Switch PlatformLinux to LLDB_LOG Modified: lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp Modified: lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp?rev=294243&r1=294242&r2=294243&view=diff == --- lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp (original) +++ lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp Mon Feb 6 15:30:44 2017 @@ -45,19 +45,9 @@ static uint32_t g_initialize_count = 0; PlatformSP PlatformLinux::CreateInstance(bool force, const ArchSpec *arch) { Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - if (log) { -const char *arch_name; -if (arch && arch->GetArchitectureName()) - arch_name = arch->GetArchitectureName(); -else - arch_name = ""; - -const char *triple_cstr = -arch ? arch->GetTriple().getTriple().c_str() : ""; - -log->Printf("PlatformLinux::%s(force=%s, arch={%s,%s})", __FUNCTION__, -force ? "true" : "false", arch_name, triple_cstr); - } + LLDB_LOG(log, "force = {0}, arch=({1}, {2})", force, + arch ? arch->GetArchitectureName() : "", + arch ? arch->GetTriple().getTriple() : ""); bool create = force; if (create == false && arch && arch->IsValid()) { @@ -80,18 +70,10 @@ PlatformSP PlatformLinux::CreateInstance } } + LLDB_LOG(log, "create = {0}", create); if (create) { -if (log) - log->Printf("PlatformLinux::%s() creating remote-linux platform", - __FUNCTION__); return PlatformSP(new PlatformLinux(false)); } - - if (log) -log->Printf( -"PlatformLinux::%s() aborting creation of remote-linux platform", -__FUNCTION__); - return PlatformSP(); } @@ -290,19 +272,15 @@ bool PlatformLinux::CanDebugProcess() { } // For local debugging, Linux will override the debug logic to use llgs-launch -// rather than -// lldb-launch, llgs-attach. This differs from current lldb-launch, -// debugserver-attach -// approach on MacOSX. +// rather than lldb-launch, llgs-attach. This differs from current lldb-launch, +// debugserver-attach approach on MacOSX. lldb::ProcessSP PlatformLinux::DebugProcess(ProcessLaunchInfo &launch_info, Debugger &debugger, Target *target, // Can be NULL, if NULL create a new // target, else use existing one Error &error) { Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - if (log) -log->Printf("PlatformLinux::%s entered (target %p)", __FUNCTION__, -static_cast(target)); + LLDB_LOG(log, "target {0}", target); // If we're a remote host, use standard behavior from parent class. if (!IsHost()) @@ -325,61 +303,42 @@ PlatformLinux::DebugProcess(ProcessLaunc // Ensure we have a target. if (target == nullptr) { -if (log) - log->Printf("PlatformLinux::%s creating new target", __FUNCTION__); - +LLDB_LOG(log, "creating new target"); TargetSP new_target_sp; error = debugger.GetTargetList().CreateTarget(debugger, "", "", false, nullptr, new_target_sp); if (error.Fail()) { - if (log) -log->Printf("PlatformLinux::%s failed to create new target: %s", -__FUNCTION__, error.AsCString()); + LLDB_LOG(log, "failed to create new target: {0}", error); return process_sp; } target = new_target_sp.get(); if (!target) { error.SetErrorString("CreateTarget() returned nullptr"); - if (log) -log->Printf("PlatformLinux::%s failed: %s", __FUNCTION__, -error.AsCString()); + LLDB_LOG(log, "error: {0}", error); return process_sp; } - } else { -if (log) - log->Printf("PlatformLinux::%s using provided target", __FUNCTION__); } // Mark target as currently selected target. debugger.GetTargetList().SetSelectedTarget(target); // Now create the gdb-remote process. - if (log) -log->Printf( -"PlatformLinux::%s having target create process with gdb-remote plugin", -__FUNCTION__); + LLDB_LOG(log, "having target create process with gdb-remote plugin"); process_sp = target->CreateProcess( launch_info.GetListenerForProcess(debugger), "gdb-remote", nullptr); if (!process_sp) { error.SetErrorString("CreateProcess() failed for gdb-remote process"); -if (log) - log->Printf("PlatformLinux::%s failed: %s", __FUNCTION__, - error.AsCString()); +LLDB_LOG(log, "error: {0}", error); return process_sp; - } else { -if (log) - log->Printf("PlatformLinu
[Lldb-commits] [lldb] r294244 - Remove verbose category in the kdp channel
Author: labath Date: Mon Feb 6 15:46:22 2017 New Revision: 294244 URL: http://llvm.org/viewvc/llvm-project?rev=294244&view=rev Log: Remove verbose category in the kdp channel Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.cpp lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.h Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp?rev=294244&r1=294243&r2=294244&view=diff == --- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp Mon Feb 6 15:46:22 2017 @@ -200,8 +200,7 @@ size_t CommunicationKDP::WaitForPacketWi uint8_t buffer[8192]; Error error; - Log *log(ProcessKDPLog::GetLogIfAllCategoriesSet(KDP_LOG_PACKETS | - KDP_LOG_VERBOSE)); + Log *log(ProcessKDPLog::GetLogIfAllCategoriesSet(KDP_LOG_PACKETS)); // Check for a packet from our cache first without trying any reading... if (CheckForPacket(NULL, 0, packet)) @@ -216,12 +215,12 @@ size_t CommunicationKDP::WaitForPacketWi : std::chrono::microseconds(timeout_usec), status, &error); -if (log) - log->Printf("%s: Read (buffer, (sizeof(buffer), timeout_usec = 0x%x, " - "status = %s, error = %s) => bytes_read = %" PRIu64, - LLVM_PRETTY_FUNCTION, timeout_usec, +LLDB_LOGV(log, + "Read (buffer, sizeof(buffer), timeout_usec = 0x{0:x}, " + "status = {1}, error = {2}) => bytes_read = {4}", + timeout_usec, Communication::ConnectionStatusAsCString(status), - error.AsCString(), (uint64_t)bytes_read); + error, bytes_read); if (bytes_read > 0) { if (CheckForPacket(buffer, bytes_read, packet)) Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp?rev=294244&r1=294243&r2=294244&view=diff == --- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp Mon Feb 6 15:46:22 2017 @@ -518,8 +518,7 @@ bool ProcessKDP::UpdateThreadList(Thread ThreadList &new_thread_list) { // locker will keep a mutex locked until it goes out of scope Log *log(ProcessKDPLog::GetLogIfAllCategoriesSet(KDP_LOG_THREAD)); - if (log && log->GetMask().Test(KDP_LOG_VERBOSE)) -log->Printf("ProcessKDP::%s (pid = %" PRIu64 ")", __FUNCTION__, GetID()); + LLDB_LOGV(log, "pid = {0}", GetID()); // Even though there is a CPU mask, it doesn't mean we can see each CPU // individually, there is really only one. Lets call this thread 1. Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.cpp?rev=294244&r1=294243&r2=294244&view=diff == --- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.cpp Mon Feb 6 15:46:22 2017 @@ -73,8 +73,6 @@ void ProcessKDPLog::DisableLog(const cha flag_bits &= ~KDP_LOG_STEP; else if (::strcasecmp(arg, "thread") == 0) flag_bits &= ~KDP_LOG_THREAD; -else if (::strcasecmp(arg, "verbose") == 0) - flag_bits &= ~KDP_LOG_VERBOSE; else if (::strncasecmp(arg, "watch", 5) == 0) flag_bits &= ~KDP_LOG_WATCHPOINTS; else { @@ -138,8 +136,6 @@ Log *ProcessKDPLog::EnableLog(StreamSP & flag_bits |= KDP_LOG_STEP; else if (::strcasecmp(arg, "thread") == 0) flag_bits |= KDP_LOG_THREAD; - else if (::strcasecmp(arg, "verbose") == 0) -flag_bits |= KDP_LOG_VERBOSE; else if (::strncasecmp(arg, "watch", 5) == 0) flag_bits |= KDP_LOG_WATCHPOINTS; else { Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.h?rev=294244&r1=294243&r2=294244&view=diff == --- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.h (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/Pr
[Lldb-commits] [PATCH] D29615: Convert Log class to llvm streams
labath created this revision. Herald added subscribers: mgorny, emaste. This converts LLDB's logging to use llvm streams instead of lldb_private::Stream and friends. The changes are mostly straight-forward and amount to s/lldb_private::Stream/llvm::raw_ostream. The part worth calling out is the rewrite of the StreamCallback class. Previously this class contained a per-thread buffer of data written. I assume this had something to do with it trying to make sure each log line is delivered as a single event, instead of multiple (possibly interleaved) events. However, this is no longer relevant as the Log class already writes things to a temporary buffer and then delivers the message as a single "write", so I have just removed the code in question. https://reviews.llvm.org/D29615 Files: include/lldb/Core/Debugger.h include/lldb/Core/Log.h include/lldb/Core/Logging.h include/lldb/Core/StreamCallback.h source/Core/Debugger.cpp source/Core/Log.cpp source/Core/Logging.cpp source/Core/StreamCallback.cpp source/Plugins/Process/POSIX/ProcessPOSIXLog.cpp source/Plugins/Process/POSIX/ProcessPOSIXLog.h source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h tools/lldb-server/LLDBServerUtilities.cpp unittests/Core/CMakeLists.txt unittests/Core/LogTest.cpp unittests/Core/StreamCallbackTest.cpp Index: unittests/Core/StreamCallbackTest.cpp === --- /dev/null +++ unittests/Core/StreamCallbackTest.cpp @@ -0,0 +1,28 @@ +//===-- StreamCallbackTest.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/Core/StreamCallback.h" +#include "gtest/gtest.h" + +using namespace lldb; +using namespace lldb_private; + +static char test_baton; +static size_t callback_count = 0; +static void TestCallback(const char *data, void *baton) { + EXPECT_STREQ("Foobar", data); + EXPECT_EQ(&test_baton, baton); + ++callback_count; +} + +TEST(StreamCallbackTest, Callback) { + StreamCallback stream(TestCallback, &test_baton); + stream << "Foobar"; + EXPECT_EQ(1u, callback_count); +} Index: unittests/Core/LogTest.cpp === --- unittests/Core/LogTest.cpp +++ unittests/Core/LogTest.cpp @@ -18,12 +18,14 @@ static std::string GetLogString(uint32_t log_options, const char *format, int arg) { - std::shared_ptr stream_sp(new StreamString()); + std::string stream_string; + std::shared_ptr stream_sp( + new llvm::raw_string_ostream(stream_string)); Log log_(stream_sp); log_.GetOptions().Reset(log_options); Log *log = &log_; LLDB_LOG(log, format, arg); - return stream_sp->GetString(); + return stream_sp->str(); } TEST(LogTest, LLDB_LOG_nullptr) { Index: unittests/Core/CMakeLists.txt === --- unittests/Core/CMakeLists.txt +++ unittests/Core/CMakeLists.txt @@ -7,6 +7,7 @@ LogTest.cpp ScalarTest.cpp StateTest.cpp + StreamCallbackTest.cpp StructuredDataTest.cpp TimerTest.cpp Index: tools/lldb-server/LLDBServerUtilities.cpp === --- tools/lldb-server/LLDBServerUtilities.cpp +++ tools/lldb-server/LLDBServerUtilities.cpp @@ -16,25 +16,32 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" +#include "llvm/Support/FileSystem.h" using namespace lldb; using namespace lldb_private::lldb_server; using namespace llvm; +static std::shared_ptr GetLogStream(StringRef log_file) { + if (!log_file.empty()) { +std::error_code EC; +std::shared_ptr stream_sp = std::make_shared( +log_file, EC, sys::fs::F_Text | sys::fs::F_Append); +if (!EC) + return stream_sp; +errs() << llvm::formatv( +"Failed to open log file `{0}`: {1}\nWill log to stderr instead.\n", +log_file, EC.message()); + } + // No need to delete the stderr stream. + return std::shared_ptr(&errs(), [](raw_ostream *) {}); +} + bool LLDBServerUtilities::SetupLogging(const std::string &log_file, const StringRef &log_channels, uint32_t log_options) { - lldb::StreamSP log_stream_sp; - if (log_file.empty()) { -log_stream_sp.reset(new StreamFile(stdout, false)); - } else { -uint32_t options = File::eOpenOptionWrite | File::eOpenOptionCanCreate | - File::eOpenOptionCloseOnExec | File::eOpenOptionAppend; -if (!(log_options & LLDB_LOG_OPTION_
[Lldb-commits] [PATCH] D29615: Convert Log class to llvm streams
zturner added a comment. Where is the logging callback used? It seems rather odd that we would need to notify someone every time a log message was generated. Comment at: source/Core/StreamCallback.cpp:22 StreamCallback::StreamCallback(lldb::LogOutputCallback callback, void *baton) -: Stream(0, 4, eByteOrderBig), m_callback(callback), m_baton(baton), - m_accumulated_data(), m_collection_mutex() {} I find it rather odd that this was hardcoding big endian. Was the endianness here important for some reason? https://reviews.llvm.org/D29615 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D29615: Convert Log class to llvm streams
labath added a comment. The log callback gets passed down from the SB API (in the SBDebugger constructor, no less). My best guess is that it is (was?) used to display the debugger log in some IDE window. Comment at: source/Core/StreamCallback.cpp:22 StreamCallback::StreamCallback(lldb::LogOutputCallback callback, void *baton) -: Stream(0, 4, eByteOrderBig), m_callback(callback), m_baton(baton), - m_accumulated_data(), m_collection_mutex() {} zturner wrote: > I find it rather odd that this was hardcoding big endian. Was the endianness > here important for some reason? I think that was there just because you needed to specify some value. As we were always printing strings, it did not matter anyway. https://reviews.llvm.org/D29615 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D29615: Convert Log class to llvm streams
> On Feb 6, 2017, at 7:19 PM, Pavel Labath via Phabricator via lldb-commits > wrote: > > labath added a comment. > > The log callback gets passed down from the SB API (in the SBDebugger > constructor, no less). My best guess is that it is (was?) used to display the > debugger log in some IDE window. That's a pretty good guess. It is used so that the logs from Xcode and the logs from lldb get interleaved and written to one place. It's quite handy in some circumstances to see Xcode say "I was trying to do X" then lldb say "I was told to do X and did it this way." Plus it means there's an easy way to funnel the whole log to one place. It has to get passed in when you construct the debugger otherwise you stand to lose some log information. We don't put it in a window, there's not much information in there that an ordinary user could understand, it would just be noise. But we do tell people to generate appropriate logs and send them to us. Jim > > > > > Comment at: source/Core/StreamCallback.cpp:22 > StreamCallback::StreamCallback(lldb::LogOutputCallback callback, void *baton) > -: Stream(0, 4, eByteOrderBig), m_callback(callback), m_baton(baton), > - m_accumulated_data(), m_collection_mutex() {} > > zturner wrote: >> I find it rather odd that this was hardcoding big endian. Was the >> endianness here important for some reason? > I think that was there just because you needed to specify some value. As we > were always printing strings, it did not matter anyway. > > > https://reviews.llvm.org/D29615 > > > > ___ > 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] buildbot numbers for the week of 01/15/2017 - 01/21/2017
Hello everyone, Below are some buildbot numbers for the week of 01/15/2017 - 01/21/2017. Please see the same data in attached csv files: The longest time each builder was red during the last week; "Status change ratio" by active builder (percent of builds that changed the builder status from greed to red or from red to green); Count of commits by project; Number of completed builds, failed builds and average build time for successful builds per active builder; Average waiting time for a revision to get build result per active builder (response time). Thanks Galina The longest time each builder was red during the last week: buildername | was_red +- clang-3stage-ubuntu| 68:57:56 sanitizer-x86_64-linux | 66:57:59 llvm-sphinx-docs | 52:51:07 clang-ppc64be-linux-multistage | 38:21:54 clang-ppc64be-linux-lnt| 36:03:16 clang-x64-ninja-win7 | 31:23:47 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast | 30:10:03 clang-x86-windows-msvc2015 | 29:51:13 sanitizer-x86_64-linux-fuzzer | 29:34:25 lld-x86_64-win7| 24:16:13 clang-cmake-thumbv7-a15-full-sh| 19:37:35 sanitizer-x86_64-linux-fast| 13:41:12 libcxx-libcxxabi-x86_64-linux-debian-noexceptions | 13:37:16 sanitizer-x86_64-linux-bootstrap | 13:26:39 lldb-windows7-android | 10:55:24 perf-x86_64-penryn-O3-polly| 10:41:08 clang-cmake-aarch64-lld| 09:35:35 libcxx-libcxxabi-libunwind-x86_64-linux-debian | 09:21:02 sanitizer-ppc64be-linux| 06:40:40 perf-x86_64-penryn-O3-polly-parallel-fast | 06:00:57 lldb-x86_64-darwin-13.4| 05:47:22 lldb-x86_64-ubuntu-14.04-android | 05:46:09 perf-x86_64-penryn-O3-polly-unprofitable | 05:22:06 libcxx-libcxxabi-x86_64-linux-debian | 04:57:18 clang-cmake-aarch64-full | 04:53:32 lldb-x86_64-ubuntu-14.04-buildserver | 03:49:05 libcxx-libcxxabi-libunwind-aarch64-linux-noexceptions | 03:46:25 clang-cmake-armv7-a15-selfhost-neon| 03:15:56 clang-cmake-armv7-a15-selfhost | 03:13:01 clang-cmake-aarch64-quick | 03:10:30 clang-cmake-armv7-a15-full | 03:07:35 clang-lld-x86_64-2stage| 02:58:45 clang-with-thin-lto-ubuntu | 02:41:36 clang-with-lto-ubuntu | 02:27:18 clang-x86_64-linux-selfhost-modules-2 | 02:18:39 libcxx-libcxxabi-x86_64-linux-ubuntu-msan | 01:56:49 libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11 | 01:53:54 clang-ppc64le-linux| 01:51:42 sanitizer-ppc64le-linux| 01:51:28 llvm-avr-linux | 01:36:35 clang-x86_64-linux-selfhost-modules| 01:25:08 clang-cuda-build | 01:23:49 libcxx-libcxxabi-libunwind-arm-linux-noexceptions | 01:22:32 libcxx-libcxxabi-libunwind-arm-linux | 01:22:30 libcxx-libcxxabi-libunwind-aarch64-linux | 01:22:15 lldb-amd64-ninja-netbsd7 | 01:19:27 perf-x86_64-penryn-O3-polly-before-vectorizer-unprofitable | 01:08:49 polly-arm-linux| 01:04:14 llvm-hexagon-elf | 01:04:00 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx03 | 01:02:42 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx1z | 01:00:28 polly-amd64-linux | 00:57:26 sanitizer-x86_64-linux-autoconf| 00:53:34 lld-x86_64-freebsd | 00:52:49 clang-hexagon-elf | 00:52:42 sanitizer-windows | 00:51:10 clang-bpf-build| 00:49:58 clang-cmake-armv7-a15 | 00:49:19 clang-cmake-aarch64-42vma | 00:47:32 clang-x86_64-debian-fast
[Lldb-commits] Buildbot numbers for the week of 01/22/2017 - 01/28/2017
Hello everyone, Below are some buildbot numbers for the week of 01/22/2017 - 01/28/2017. Please see the same data in attached csv files: The longest time each builder was red during the last week; "Status change ratio" by active builder (percent of builds that changed the builder status from greed to red or from red to green); Count of commits by project; Number of completed builds, failed builds and average build time for successful builds per active builder; Average waiting time for a revision to get build result per active builder (response time). Thanks Galina The longest time each builder was red during the last week: buildername | was_red +-- sanitizer-x86_64-linux | 110:22:30 perf-x86_64-penryn-O3-polly-before-vectorizer | 91:21:29 perf-x86_64-penryn-O3-polly-before-vectorizer-detect-only | 84:15:58 perf-x86_64-penryn-O3 | 82:05:43 perf-x86_64-penryn-O3-polly-before-vectorizer-unprofitable | 78:52:21 perf-x86_64-penryn-O3-polly| 78:50:42 perf-x86_64-penryn-O3-polly-unprofitable | 78:26:52 perf-x86_64-penryn-O3-polly-parallel-fast | 78:16:50 perf-x86_64-penryn-O3-polly-fast | 76:27:45 lldb-windows7-android | 60:49:15 libomp-ompt-clang-x86_64-linux-debian | 37:19:35 sanitizer-x86_64-linux-fuzzer | 33:33:24 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast | 24:51:08 clang-ppc64be-linux-multistage | 24:45:54 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast | 24:42:10 clang-ppc64le-linux-lnt| 24:28:20 clang-ppc64be-linux| 23:19:28 clang-ppc64le-linux| 23:06:43 sanitizer-ppc64le-linux| 22:56:24 sanitizer-ppc64be-linux| 22:28:03 clang-ppc64be-linux-lnt| 22:26:44 clang-cmake-aarch64-lld| 19:27:24 sanitizer-x86_64-linux-bootstrap | 18:40:55 sanitizer-x86_64-linux-autoconf| 18:02:36 clang-cmake-armv7-a15-selfhost | 14:23:03 sanitizer-x86_64-linux-fast| 14:01:37 clang-cuda-build | 13:35:48 clang-native-aarch64-full | 13:29:54 clang-cmake-armv7-a15-full | 12:27:04 clang-cmake-armv7-a15 | 12:20:14 clang-hexagon-elf | 12:05:20 llvm-hexagon-elf | 12:04:32 clang-cmake-aarch64-42vma | 12:04:00 clang-cmake-aarch64-39vma | 12:03:42 clang-cmake-aarch64-quick | 12:03:22 clang-cmake-thumbv7-a15-full-sh| 12:01:47 clang-cmake-thumbv7-a15| 11:59:35 clang-cmake-armv7-a15-selfhost-neon| 11:37:03 clang-cmake-aarch64-full | 11:31:15 clang-with-lto-ubuntu | 09:05:58 clang-x64-ninja-win7 | 08:41:46 clang-x86_64-debian-fast | 08:34:02 clang-x86_64-linux-selfhost-modules| 08:14:36 clang-with-thin-lto-ubuntu | 08:01:05 clang-native-arm-lnt | 07:57:44 lld-x86_64-darwin13| 07:23:46 lld-x86_64-win7| 07:22:20 lld-x86_64-freebsd | 07:17:15 clang-bpf-build| 06:45:17 clang-lld-x86_64-2stage| 06:33:25 clang-x86-windows-msvc2015 | 05:10:49 lldb-amd64-ninja-netbsd7 | 04:58:55 lldb-x86_64-ubuntu-14.04-android | 04:39:10 polly-amd64-linux | 04:19:14 libcxx-libcxxabi-x86_64-linux-ubuntu-tsan | 04:16:57 clang-s390x-linux | 04:14:27 libcxx-libcxxabi-x86_64-linux-ubuntu-msan | 04:10:06 libcxx-libcxxabi-libunwind-arm-linux | 03:56:32 libcxx-libcxxabi-x86_64-linux-ubuntu-asan | 03:54:00 libcxx-libcxxabi-x86_64-li