From owner-svn-src-all@freebsd.org Wed Apr 26 19:24:58 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A7DB2D51DE0; Wed, 26 Apr 2017 19:24:58 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 528C6CA0; Wed, 26 Apr 2017 19:24:58 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3QJOv2n030772; Wed, 26 Apr 2017 19:24:57 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QJOsGn030740; Wed, 26 Apr 2017 19:24:54 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201704261924.v3QJOsGn030740@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 26 Apr 2017 19:24:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r317455 - in vendor/lldb/dist: cmake/modules cmake/platforms examples/python include/lldb include/lldb/API include/lldb/Core include/lldb/Host include/lldb/Target packages/Python/lldbsu... X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 19:24:58 -0000 Author: dim Date: Wed Apr 26 19:24:53 2017 New Revision: 317455 URL: https://svnweb.freebsd.org/changeset/base/317455 Log: Vendor import of lldb trunk r301441: https://llvm.org/svn/llvm-project/lldb/trunk@301441 Added: vendor/lldb/dist/examples/python/disassembly_mode.py (contents, props changed) vendor/lldb/dist/include/lldb/API/SBTrace.h (contents, props changed) vendor/lldb/dist/include/lldb/API/SBTraceOptions.h (contents, props changed) vendor/lldb/dist/include/lldb/Core/StructuredDataImpl.h (contents, props changed) vendor/lldb/dist/include/lldb/Core/TraceOptions.h (contents, props changed) vendor/lldb/dist/packages/Python/lldbsuite/test/lang/cpp/llvm-style/ vendor/lldb/dist/packages/Python/lldbsuite/test/lang/cpp/llvm-style/Makefile (contents, props changed) vendor/lldb/dist/packages/Python/lldbsuite/test/lang/cpp/llvm-style/TestLLVMStyle.py (contents, props changed) vendor/lldb/dist/packages/Python/lldbsuite/test/lang/cpp/llvm-style/main.cpp (contents, props changed) vendor/lldb/dist/packages/Python/lldbsuite/test/lang/cpp/symbols/ vendor/lldb/dist/packages/Python/lldbsuite/test/lang/cpp/symbols/Makefile (contents, props changed) vendor/lldb/dist/packages/Python/lldbsuite/test/lang/cpp/symbols/TestSymbols.py (contents, props changed) vendor/lldb/dist/packages/Python/lldbsuite/test/lang/cpp/symbols/main.cpp (contents, props changed) vendor/lldb/dist/scripts/interface/SBTrace.i vendor/lldb/dist/scripts/interface/SBTraceOptions.i vendor/lldb/dist/source/API/SBTrace.cpp (contents, props changed) vendor/lldb/dist/source/API/SBTraceOptions.cpp (contents, props changed) Deleted: vendor/lldb/dist/cmake/platforms/Android.cmake Modified: vendor/lldb/dist/cmake/modules/LLDBConfig.cmake vendor/lldb/dist/include/lldb/API/LLDB.h vendor/lldb/dist/include/lldb/API/SBDefines.h vendor/lldb/dist/include/lldb/API/SBError.h vendor/lldb/dist/include/lldb/API/SBProcess.h vendor/lldb/dist/include/lldb/API/SBStructuredData.h vendor/lldb/dist/include/lldb/Core/ValueObject.h vendor/lldb/dist/include/lldb/Host/SocketAddress.h vendor/lldb/dist/include/lldb/Target/Process.h vendor/lldb/dist/include/lldb/lldb-enumerations.h vendor/lldb/dist/include/lldb/lldb-forward.h vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py vendor/lldb/dist/packages/Python/lldbsuite/test/lang/c/inlines/main.c vendor/lldb/dist/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py vendor/lldb/dist/packages/Python/lldbsuite/test/lang/cpp/nsimport/TestCppNsImport.py vendor/lldb/dist/scripts/interface/SBProcess.i vendor/lldb/dist/scripts/interface/SBStructuredData.i vendor/lldb/dist/scripts/lldb.swig vendor/lldb/dist/source/API/CMakeLists.txt vendor/lldb/dist/source/API/SBProcess.cpp vendor/lldb/dist/source/API/SBStructuredData.cpp vendor/lldb/dist/source/Core/ValueObject.cpp vendor/lldb/dist/source/Host/common/SocketAddress.cpp vendor/lldb/dist/source/Host/freebsd/Host.cpp vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp vendor/lldb/dist/source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp vendor/lldb/dist/source/Plugins/Language/CPlusPlus/LibCxx.cpp vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp vendor/lldb/dist/tools/debugserver/source/RNBRemote.cpp vendor/lldb/dist/unittests/Host/SocketAddressTest.cpp vendor/lldb/dist/www/build.html Modified: vendor/lldb/dist/cmake/modules/LLDBConfig.cmake ============================================================================== --- vendor/lldb/dist/cmake/modules/LLDBConfig.cmake Wed Apr 26 19:24:50 2017 (r317454) +++ vendor/lldb/dist/cmake/modules/LLDBConfig.cmake Wed Apr 26 19:24:53 2017 (r317455) @@ -250,12 +250,6 @@ endif() set(LLDB_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(LLDB_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) -# If building on a 32-bit system, make sure off_t can store offsets > 2GB -if( CMAKE_SIZEOF_VOID_P EQUAL 4 ) - add_definitions( -D_LARGEFILE_SOURCE ) - add_definitions( -D_FILE_OFFSET_BITS=64 ) -endif() - if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) message(FATAL_ERROR "In-source builds are not allowed. CMake would overwrite " "the makefiles distributed with LLDB. Please create a directory and run cmake " Added: vendor/lldb/dist/examples/python/disassembly_mode.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/examples/python/disassembly_mode.py Wed Apr 26 19:24:53 2017 (r317455) @@ -0,0 +1,48 @@ +""" Adds the 'toggle-disassembly' command to switch you into a disassembly only mode """ +import lldb + +class DisassemblyMode: + def __init__(self, debugger, unused): + self.dbg = debugger + self.interp = debugger.GetCommandInterpreter() + self.store_state() + self.mode_off = True + + def store_state(self): + self.dis_count = self.get_string_value("stop-disassembly-count") + self.dis_display = self.get_string_value("stop-disassembly-display") + self.before_count = self.get_string_value("stop-line-count-before") + self.after_count = self.get_string_value("stop-line-count-after") + + def get_string_value(self, setting): + result = lldb.SBCommandReturnObject() + self.interp.HandleCommand("settings show " + setting, result) + value = result.GetOutput().split(" = ")[1].rstrip("\n") + return value + + def set_value(self, setting, value): + result = lldb.SBCommandReturnObject() + self.interp.HandleCommand("settings set " + setting + " " + value, result) + + def __call__(self, debugger, command, exe_ctx, result): + if self.mode_off: + self.mode_off = False + self.store_state() + self.set_value("stop-disassembly-display","always") + self.set_value("stop-disassembly-count", "8") + self.set_value("stop-line-count-before", "0") + self.set_value("stop-line-count-after", "0") + result.AppendMessage("Disassembly mode on.") + else: + self.mode_off = True + self.set_value("stop-disassembly-display",self.dis_display) + self.set_value("stop-disassembly-count", self.dis_count) + self.set_value("stop-line-count-before", self.before_count) + self.set_value("stop-line-count-after", self.after_count) + result.AppendMessage("Disassembly mode off.") + + def get_short_help(self): + return "Toggles between a disassembly only mode and normal source mode\n" + +def __lldb_init_module(debugger, unused): + debugger.HandleCommand("command script add -c disassembly_mode.DisassemblyMode toggle-disassembly") Modified: vendor/lldb/dist/include/lldb/API/LLDB.h ============================================================================== --- vendor/lldb/dist/include/lldb/API/LLDB.h Wed Apr 26 19:24:50 2017 (r317454) +++ vendor/lldb/dist/include/lldb/API/LLDB.h Wed Apr 26 19:24:53 2017 (r317455) @@ -63,6 +63,8 @@ #include "lldb/API/SBThread.h" #include "lldb/API/SBThreadCollection.h" #include "lldb/API/SBThreadPlan.h" +#include "lldb/API/SBTrace.h" +#include "lldb/API/SBTraceOptions.h" #include "lldb/API/SBType.h" #include "lldb/API/SBTypeCategory.h" #include "lldb/API/SBTypeEnumMember.h" Modified: vendor/lldb/dist/include/lldb/API/SBDefines.h ============================================================================== --- vendor/lldb/dist/include/lldb/API/SBDefines.h Wed Apr 26 19:24:50 2017 (r317454) +++ vendor/lldb/dist/include/lldb/API/SBDefines.h Wed Apr 26 19:24:53 2017 (r317455) @@ -79,6 +79,8 @@ class LLDB_API SBTarget; class LLDB_API SBThread; class LLDB_API SBThreadCollection; class LLDB_API SBThreadPlan; +class LLDB_API SBTrace; +class LLDB_API SBTraceOptions; class LLDB_API SBType; class LLDB_API SBTypeCategory; class LLDB_API SBTypeEnumMember; Modified: vendor/lldb/dist/include/lldb/API/SBError.h ============================================================================== --- vendor/lldb/dist/include/lldb/API/SBError.h Wed Apr 26 19:24:50 2017 (r317454) +++ vendor/lldb/dist/include/lldb/API/SBError.h Wed Apr 26 19:24:53 2017 (r317455) @@ -61,6 +61,7 @@ protected: friend class SBProcess; friend class SBStructuredData; friend class SBThread; + friend class SBTrace; friend class SBTarget; friend class SBValue; friend class SBWatchpoint; Modified: vendor/lldb/dist/include/lldb/API/SBProcess.h ============================================================================== --- vendor/lldb/dist/include/lldb/API/SBProcess.h Wed Apr 26 19:24:50 2017 (r317454) +++ vendor/lldb/dist/include/lldb/API/SBProcess.h Wed Apr 26 19:24:53 2017 (r317455) @@ -234,6 +234,33 @@ public: bool GetDescription(lldb::SBStream &description); + //------------------------------------------------------------------ + /// Start Tracing with the given SBTraceOptions. + /// + /// @param[in] options + /// Class containing trace options like trace buffer size, meta + /// data buffer size, TraceType and any custom parameters + /// {formatted as a JSON Dictionary}. In case of errors in + /// formatting, an error would be reported. + /// It must be noted that tracing options such as buffer sizes + /// or other custom parameters passed maybe invalid for some + /// trace technologies. In such cases the trace implementations + /// could choose to either throw an error or could round off to + /// the nearest valid options to start tracing if the passed + /// value is not supported. To obtain the actual used trace + /// options please use the GetTraceConfig API. For the custom + /// parameters, only the parameters recognized by the target + /// would be used and others would be ignored. + /// + /// @param[out] error + /// An error explaining what went wrong. + /// + /// @return + /// A SBTrace instance, which should be used + /// to get the trace data or other trace related operations. + //------------------------------------------------------------------ + lldb::SBTrace StartTrace(SBTraceOptions &options, lldb::SBError &error); + uint32_t GetNumSupportedHardwareWatchpoints(lldb::SBError &error) const; //------------------------------------------------------------------ Modified: vendor/lldb/dist/include/lldb/API/SBStructuredData.h ============================================================================== --- vendor/lldb/dist/include/lldb/API/SBStructuredData.h Wed Apr 26 19:24:50 2017 (r317454) +++ vendor/lldb/dist/include/lldb/API/SBStructuredData.h Wed Apr 26 19:24:53 2017 (r317455) @@ -13,8 +13,6 @@ #include "lldb/API/SBDefines.h" #include "lldb/API/SBModule.h" -class StructuredDataImpl; - namespace lldb { class SBStructuredData { @@ -31,14 +29,18 @@ public: bool IsValid() const; + lldb::SBError SetFromJSON(lldb::SBStream &stream); + void Clear(); lldb::SBError GetAsJSON(lldb::SBStream &stream) const; lldb::SBError GetDescription(lldb::SBStream &stream) const; -private: - std::unique_ptr m_impl_up; +protected: + friend class SBTraceOptions; + + StructuredDataImplUP m_impl_up; }; } Added: vendor/lldb/dist/include/lldb/API/SBTrace.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/include/lldb/API/SBTrace.h Wed Apr 26 19:24:53 2017 (r317455) @@ -0,0 +1,122 @@ +//===-- SBTrace.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_SBTrace_h_ +#define LLDB_SBTrace_h_ + +#include "lldb/API/SBDefines.h" +#include "lldb/API/SBError.h" + +class TraceImpl; + +namespace lldb { + +class LLDB_API SBTrace { +public: + SBTrace(); + //------------------------------------------------------------------ + /// Obtain the trace data as raw bytes. + /// + /// @param[out] error + /// An error explaining what went wrong. + /// + /// @param[in] buf + /// Buffer to write the trace data to. + /// + /// @param[in] size + /// The size of the buffer used to read the data. This is + /// also the size of the data intended to read. It is also + /// possible to partially read the trace data for some trace + /// technologies by specifying a smaller buffer. + /// + /// @param[in] offset + /// The start offset to begin reading the trace data. + /// + /// @param[in] thread_id + /// Tracing could be started for the complete process or a + /// single thread, in the first case the uid obtained would + /// map to all the threads existing within the process and the + /// ones spawning later. The thread_id parameter can be used in + /// such a scenario to select the trace data for a specific + /// thread. + /// + /// @return + /// The size of the trace data effectively read by the API call. + //------------------------------------------------------------------ + size_t GetTraceData(SBError &error, void *buf, size_t size, size_t offset = 0, + lldb::tid_t thread_id = LLDB_INVALID_THREAD_ID); + + //------------------------------------------------------------------ + /// Obtain any meta data as raw bytes for the tracing instance. + /// The input parameter definition is similar to the previous + /// function. + //------------------------------------------------------------------ + size_t GetMetaData(SBError &error, void *buf, size_t size, size_t offset = 0, + lldb::tid_t thread_id = LLDB_INVALID_THREAD_ID); + + //------------------------------------------------------------------ + /// Stop the tracing instance. Stopping the trace will also + /// lead to deletion of any gathered trace data. + /// + /// @param[out] error + /// An error explaining what went wrong. + /// + /// @param[in] thread_id + /// The user id could map to a tracing instance for a thread + /// or could also map to a group of threads being traced with + /// the same trace options. A thread_id is normally optional + /// except in the case of tracing a complete process and tracing + /// needs to switched off on a particular thread. + /// A situation could occur where initially a thread (lets say + /// thread A) is being individually traced with a particular uid + /// and then tracing is started on the complete process, in this + /// case thread A will continue without any change. All newly + /// spawned threads would be traced with the uid of the process. + /// Now if the StopTrace API is called for the whole process, + /// thread A will not be stopped and must be stopped separately. + //------------------------------------------------------------------ + void StopTrace(SBError &error, + lldb::tid_t thread_id = LLDB_INVALID_THREAD_ID); + + //------------------------------------------------------------------ + /// Get the trace configuration being used for the trace instance. + /// The threadid in the SBTraceOptions needs to be set when the + /// configuration used by a specific thread is being requested. + /// + /// @param[out] options + /// The trace options actually used by the trace instance + /// would be filled by the API. + /// + /// @param[out] error + /// An error explaining what went wrong. + //------------------------------------------------------------------ + void GetTraceConfig(SBTraceOptions &options, SBError &error); + + lldb::user_id_t GetTraceUID(); + + bool IsValid(); + +protected: + typedef std::shared_ptr TraceImplSP; + + friend class SBProcess; + + void SetTraceUID(lldb::user_id_t uid); + + TraceImplSP m_trace_impl_sp; + + lldb::ProcessSP GetSP() const; + + void SetSP(const ProcessSP &process_sp); + + lldb::ProcessWP m_opaque_wp; +}; +} // namespace lldb + +#endif // LLDB_SBTrace_h_ Added: vendor/lldb/dist/include/lldb/API/SBTraceOptions.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/include/lldb/API/SBTraceOptions.h Wed Apr 26 19:24:53 2017 (r317455) @@ -0,0 +1,58 @@ +//===-- SBTraceOptions ------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef SBTRACEOPTIONS_H_ +#define SBTRACEOPTIONS_H_ + +#include "lldb/API/SBDefines.h" + +namespace lldb { + +class LLDB_API SBTraceOptions { +public: + SBTraceOptions(); + + lldb::TraceType getType() const; + + uint64_t getTraceBufferSize() const; + + /// The trace parameters consist of any custom parameters + /// apart from the generic parameters such as + /// TraceType, trace_buffer_size and meta_data_buffer_size. + /// The returned parameters would be formatted as a JSON Dictionary. + lldb::SBStructuredData getTraceParams(lldb::SBError &error); + + uint64_t getMetaDataBufferSize() const; + + /// SBStructuredData is meant to hold any custom parameters + /// apart from meta buffer size and trace size. They should + /// be formatted as a JSON Dictionary. + void setTraceParams(lldb::SBStructuredData ¶ms); + + void setType(lldb::TraceType type); + + void setTraceBufferSize(uint64_t size); + + void setMetaDataBufferSize(uint64_t size); + + void setThreadID(lldb::tid_t thread_id); + + lldb::tid_t getThreadID(); + + bool IsValid(); + +protected: + friend class SBProcess; + friend class SBTrace; + + lldb::TraceOptionsSP m_traceoptions_sp; +}; +} + +#endif /* SBTRACEOPTIONS_H_ */ Added: vendor/lldb/dist/include/lldb/Core/StructuredDataImpl.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/include/lldb/Core/StructuredDataImpl.h Wed Apr 26 19:24:53 2017 (r317455) @@ -0,0 +1,95 @@ +//===-- StructuredDataImpl.h ------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef liblldb_StructuredDataImpl_h_ +#define liblldb_StructuredDataImpl_h_ + +#include "lldb/Core/Event.h" +#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/Error.h" +#include "lldb/Utility/Stream.h" +#include "lldb/Target/StructuredDataPlugin.h" +#include "lldb/lldb-forward.h" + +#pragma mark-- +#pragma mark StructuredDataImpl + +namespace lldb_private { + +class StructuredDataImpl { +public: + StructuredDataImpl() : m_plugin_wp(), m_data_sp() {} + + StructuredDataImpl(const StructuredDataImpl &rhs) = default; + + StructuredDataImpl(const lldb::EventSP &event_sp) + : m_plugin_wp( + EventDataStructuredData::GetPluginFromEvent(event_sp.get())), + m_data_sp(EventDataStructuredData::GetObjectFromEvent(event_sp.get())) { + } + + ~StructuredDataImpl() = default; + + StructuredDataImpl &operator=(const StructuredDataImpl &rhs) = default; + + bool IsValid() const { return m_data_sp.get() != nullptr; } + + void Clear() { + m_plugin_wp.reset(); + m_data_sp.reset(); + } + + Error GetAsJSON(Stream &stream) const { + Error error; + + if (!m_data_sp) { + error.SetErrorString("No structured data."); + return error; + } + + m_data_sp->Dump(stream); + return error; + } + + Error GetDescription(Stream &stream) const { + Error error; + + if (!m_data_sp) { + error.SetErrorString("Cannot pretty print structured data: " + "no data to print."); + return error; + } + + // Grab the plugin. + auto plugin_sp = lldb::StructuredDataPluginSP(m_plugin_wp); + if (!plugin_sp) { + error.SetErrorString("Cannot pretty print structured data: " + "plugin doesn't exist."); + return error; + } + + // Get the data's description. + return plugin_sp->GetDescription(m_data_sp, stream); + } + + StructuredData::ObjectSP GetObjectSP() { + return m_data_sp; + } + + void SetObjectSP(const StructuredData::ObjectSP &obj) { + m_data_sp = obj; + } + +private: + + lldb::StructuredDataPluginWP m_plugin_wp; + StructuredData::ObjectSP m_data_sp; +}; +} +#endif Added: vendor/lldb/dist/include/lldb/Core/TraceOptions.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/include/lldb/Core/TraceOptions.h Wed Apr 26 19:24:53 2017 (r317455) @@ -0,0 +1,62 @@ +//===-- TraceOptions.h ------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef liblldb_TraceOptions_h_ +#define liblldb_TraceOptions_h_ + +#include "lldb/lldb-defines.h" +#include "lldb/lldb-enumerations.h" + +#include "lldb/Core/StructuredData.h" + +namespace lldb_private { +class TraceOptions { +public: + TraceOptions() + : m_trace_params(new StructuredData::Dictionary()) {} + + const StructuredData::DictionarySP &getTraceParams() const { + return m_trace_params; + } + + lldb::TraceType getType() const { return m_type; } + + uint64_t getTraceBufferSize() const { return m_trace_buffer_size; } + + uint64_t getMetaDataBufferSize() const { return m_meta_data_buffer_size; } + + void setTraceParams(const StructuredData::DictionarySP &dict_obj) { + m_trace_params = dict_obj; + } + + void setType(lldb::TraceType type) { m_type = type; } + + void setTraceBufferSize(uint64_t size) { m_trace_buffer_size = size; } + + void setMetaDataBufferSize(uint64_t size) { m_meta_data_buffer_size = size; } + + void setThreadID(lldb::tid_t thread_id) { m_thread_id = thread_id; } + + lldb::tid_t getThreadID() { return m_thread_id; } + +private: + lldb::TraceType m_type; + uint64_t m_trace_buffer_size; + uint64_t m_meta_data_buffer_size; + lldb::tid_t m_thread_id; + + /// m_trace_params is meant to hold any custom parameters + /// apart from meta buffer size and trace size. + /// The interpretation of such parameters is left to + /// the lldb-server. + StructuredData::DictionarySP m_trace_params; +}; +} + +#endif // liblldb_TraceOptions_h_ \ No newline at end of file Modified: vendor/lldb/dist/include/lldb/Core/ValueObject.h ============================================================================== --- vendor/lldb/dist/include/lldb/Core/ValueObject.h Wed Apr 26 19:24:50 2017 (r317454) +++ vendor/lldb/dist/include/lldb/Core/ValueObject.h Wed Apr 26 19:24:53 2017 (r317455) @@ -27,6 +27,7 @@ #include "lldb/lldb-private-enumerations.h" // for AddressType #include "lldb/lldb-types.h" // for addr_t, offs... +#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/Optional.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" // for StringRef @@ -37,7 +38,6 @@ #include // for recursive_mutex #include // for string #include // for pair -#include #include // for size_t #include // for uint32_t @@ -489,35 +489,19 @@ public: virtual lldb::ValueObjectSP GetChildAtIndex(size_t idx, bool can_create); // this will always create the children if necessary - lldb::ValueObjectSP - GetChildAtIndexPath(const std::initializer_list &idxs, - size_t *index_of_error = nullptr); - - lldb::ValueObjectSP GetChildAtIndexPath(const std::vector &idxs, + lldb::ValueObjectSP GetChildAtIndexPath(llvm::ArrayRef idxs, size_t *index_of_error = nullptr); - lldb::ValueObjectSP GetChildAtIndexPath( - const std::initializer_list> &idxs, - size_t *index_of_error = nullptr); - lldb::ValueObjectSP - GetChildAtIndexPath(const std::vector> &idxs, + GetChildAtIndexPath(llvm::ArrayRef> idxs, size_t *index_of_error = nullptr); // this will always create the children if necessary - lldb::ValueObjectSP - GetChildAtNamePath(const std::initializer_list &names, - ConstString *name_of_error = nullptr); - - lldb::ValueObjectSP GetChildAtNamePath(const std::vector &names, + lldb::ValueObjectSP GetChildAtNamePath(llvm::ArrayRef names, ConstString *name_of_error = nullptr); - lldb::ValueObjectSP GetChildAtNamePath( - const std::initializer_list> &names, - ConstString *name_of_error = nullptr); - lldb::ValueObjectSP - GetChildAtNamePath(const std::vector> &names, + GetChildAtNamePath(llvm::ArrayRef> names, ConstString *name_of_error = nullptr); virtual lldb::ValueObjectSP GetChildMemberWithName(const ConstString &name, Modified: vendor/lldb/dist/include/lldb/Host/SocketAddress.h ============================================================================== --- vendor/lldb/dist/include/lldb/Host/SocketAddress.h Wed Apr 26 19:24:50 2017 (r317454) +++ vendor/lldb/dist/include/lldb/Host/SocketAddress.h Wed Apr 26 19:24:53 2017 (r317455) @@ -41,8 +41,9 @@ public: //---------------------------------------------------------------------------- // Static method to get all address information for a host and/or service //---------------------------------------------------------------------------- - static std::vector GetAddressInfo(const char *hostname, - const char *servname); + static std::vector + GetAddressInfo(const char *hostname, const char *servname, int ai_family, + int ai_socktype, int ai_protocol, int ai_flags = 0); //------------------------------------------------------------------ // Constructors and Destructors Modified: vendor/lldb/dist/include/lldb/Target/Process.h ============================================================================== --- vendor/lldb/dist/include/lldb/Target/Process.h Wed Apr 26 19:24:50 2017 (r317454) +++ vendor/lldb/dist/include/lldb/Target/Process.h Wed Apr 26 19:24:53 2017 (r317455) @@ -36,6 +36,7 @@ #include "lldb/Core/PluginInterface.h" #include "lldb/Core/StructuredData.h" #include "lldb/Core/ThreadSafeValue.h" +#include "lldb/Core/TraceOptions.h" #include "lldb/Core/UserSettingsController.h" #include "lldb/Host/HostThread.h" #include "lldb/Host/ProcessRunLock.h" @@ -2766,6 +2767,79 @@ public: lldb::StructuredDataPluginSP GetStructuredDataPlugin(const ConstString &type_name) const; + //------------------------------------------------------------------ + /// Starts tracing with the configuration provided in options. To + /// enable tracing on the complete process the thread_id in the + /// options should be set to LLDB_INVALID_THREAD_ID. The API returns + /// a user_id which is needed by other API's that manipulate the + /// trace instance. + /// The handling of erroneous or unsupported configuration is left + /// to the trace technology implementations in the server, as they + /// could be returned as an error, or rounded to a valid + /// configuration to start tracing. In the later case the + /// GetTraceConfig should supply the actual used trace + /// configuration. + //------------------------------------------------------------------ + virtual lldb::user_id_t StartTrace(lldb::TraceOptionsSP &options, + Error &error) { + error.SetErrorString("Not implemented"); + return LLDB_INVALID_UID; + } + + //------------------------------------------------------------------ + /// Stops the tracing instance leading to deletion of the trace + /// data. The tracing instance is identified by the user_id which + /// is obtained when tracing was started from the StartTrace. + /// In case tracing of the complete process needs to be stopped + /// the thread_id should be set to LLDB_INVALID_THREAD_ID. + /// In the other case that tracing on an individual thread needs + /// to be stopped a thread_id can be supplied. + //------------------------------------------------------------------ + virtual void StopTrace(lldb::user_id_t uid, lldb::tid_t thread_id, + Error &error) { + error.SetErrorString("Not implemented"); + } + + //------------------------------------------------------------------ + /// Provides the trace data as raw bytes. A buffer needs to be + /// supplied to copy the trace data. The exact behavior of this API + /// may vary across trace technology, as some may support partial + /// reading of the trace data from a specified offset while some + /// may not. The thread_id should be used to select a particular + /// thread for trace extraction. + //------------------------------------------------------------------ + virtual size_t GetData(lldb::user_id_t uid, lldb::tid_t thread_id, + Error &error, void *buf, size_t size, + size_t offset = 0) { + error.SetErrorString("Not implemented"); + return 0; + } + + //------------------------------------------------------------------ + /// Similar API as above except for obtaining meta data + //------------------------------------------------------------------ + virtual size_t GetMetaData(lldb::user_id_t uid, lldb::tid_t thread_id, + Error &error, void *buf, size_t size, + size_t offset = 0) { + error.SetErrorString("Not implemented"); + return 0; + } + + //------------------------------------------------------------------ + /// API to obtain the trace configuration used by a trace instance. + /// Configurations that may be specific to some trace technology + /// should be stored in the custom parameters. The options are + /// transported to the server, which shall interpret accordingly. + /// The thread_id can be specified in the options to obtain the + /// configuration used by a specific thread. The thread_id specified + /// should also match the uid otherwise an error will be returned. + //------------------------------------------------------------------ + virtual void GetTraceConfig(lldb::user_id_t uid, Error &error, + lldb::TraceOptionsSP &options) { + error.SetErrorString("Not implemented"); + return; + } + protected: void SetState(lldb::EventSP &event_sp); Modified: vendor/lldb/dist/include/lldb/lldb-enumerations.h ============================================================================== --- vendor/lldb/dist/include/lldb/lldb-enumerations.h Wed Apr 26 19:24:50 2017 (r317454) +++ vendor/lldb/dist/include/lldb/lldb-enumerations.h Wed Apr 26 19:24:53 2017 (r317455) @@ -718,6 +718,13 @@ enum BasicType { eBasicTypeOther }; +enum TraceType { + eTraceTypeNone = 0, + + // Hardware Trace generated by the processor. + eTraceTypeProcessorTrace +}; + FLAGS_ENUM(TypeClass){ eTypeClassInvalid = (0u), eTypeClassArray = (1u << 0), eTypeClassBlockPointer = (1u << 1), eTypeClassBuiltin = (1u << 2), Modified: vendor/lldb/dist/include/lldb/lldb-forward.h ============================================================================== --- vendor/lldb/dist/include/lldb/lldb-forward.h Wed Apr 26 19:24:50 2017 (r317454) +++ vendor/lldb/dist/include/lldb/lldb-forward.h Wed Apr 26 19:24:53 2017 (r317455) @@ -215,6 +215,7 @@ class StreamFile; class StreamString; class StringList; struct StringSummaryFormat; +class StructuredDataImpl; class StructuredDataPlugin; class SystemRuntime; class TypeSummaryImpl; @@ -254,6 +255,7 @@ class ThreadPlanStepRange; class ThreadPlanStepThrough; class ThreadPlanTracer; class ThreadSpec; +class TraceOptions; class Type; class TypeAndOrName; class TypeCategoryMap; @@ -430,6 +432,7 @@ typedef std::weak_ptr StreamFileSP; typedef std::shared_ptr StringTypeSummaryImplSP; +typedef std::unique_ptr StructuredDataImplUP; typedef std::shared_ptr StructuredDataPluginSP; typedef std::weak_ptr @@ -451,6 +454,7 @@ typedef std::weak_ptr ThreadCollectionSP; typedef std::shared_ptr ThreadPlanSP; typedef std::shared_ptr ThreadPlanTracerSP; +typedef std::shared_ptr TraceOptionsSP; typedef std::shared_ptr TypeSP; typedef std::weak_ptr TypeWP; typedef std::shared_ptr TypeCategoryImplSP; Modified: vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py ============================================================================== --- vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py Wed Apr 26 19:24:50 2017 (r317454) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py Wed Apr 26 19:24:53 2017 (r317455) @@ -17,7 +17,7 @@ class NoreturnUnwind(TestBase): mydir = TestBase.compute_mydir(__file__) @skipIfWindows # clang-cl does not support gcc style attributes. - @expectedFailureAndroid(bugnumber="llvm.org/pr31192", archs=["x86_64"]) + @expectedFailureAndroid(bugnumber="llvm.org/pr31192") @expectedFailureAll(bugnumber="llvm.org/pr31192", oslist=['linux'], compiler="gcc", archs=['arm']) def test(self): """Test that we can backtrace correctly with 'noreturn' functions on the stack""" Modified: vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py ============================================================================== --- vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py Wed Apr 26 19:24:50 2017 (r317454) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py Wed Apr 26 19:24:53 2017 (r317455) @@ -89,7 +89,7 @@ class TestStepOverWatchpoint(TestBase): # resolve_location=True, read=False, write=True write_watchpoint = write_value.Watch(True, False, True, error) - self.assertTrue(read_watchpoint, "Failed to set write watchpoint.") + self.assertTrue(write_watchpoint, "Failed to set write watchpoint.") self.assertTrue(error.Success(), "Error while setting watchpoint: %s" % error.GetCString()) Modified: vendor/lldb/dist/packages/Python/lldbsuite/test/lang/c/inlines/main.c ============================================================================== --- vendor/lldb/dist/packages/Python/lldbsuite/test/lang/c/inlines/main.c Wed Apr 26 19:24:50 2017 (r317454) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/lang/c/inlines/main.c Wed Apr 26 19:24:53 2017 (r317455) @@ -5,6 +5,11 @@ inline void test2(int) __attribute__ ((a void test2(int b) { printf("test2(%d)\n", b); //% self.expect("expression b", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["42"]) + { + int c = b * 2; + printf("c=%d\n", c); //% self.expect("expression b", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["42"]) + //% self.expect("expression c", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["84"]) + } } void test1(int a) { Modified: vendor/lldb/dist/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py ============================================================================== --- vendor/lldb/dist/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py Wed Apr 26 19:24:50 2017 (r317454) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py Wed Apr 26 19:24:53 2017 (r317455) @@ -61,7 +61,7 @@ class StaticVariableTestCase(TestBase): bugnumber="Compiler emits incomplete debug info") @expectedFailureAll( compiler=["clang"], - compiler_version=["<", "3.8"], + compiler_version=["<", "3.9"], bugnumber='llvm.org/pr20550') @add_test_categories(['pyapi']) def test_with_python_api(self): Added: vendor/lldb/dist/packages/Python/lldbsuite/test/lang/cpp/llvm-style/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/lang/cpp/llvm-style/Makefile Wed Apr 26 19:24:53 2017 (r317455) @@ -0,0 +1,3 @@ +LEVEL = ../../../make +CXX_SOURCES := main.cpp +include $(LEVEL)/Makefile.rules \ No newline at end of file Added: vendor/lldb/dist/packages/Python/lldbsuite/test/lang/cpp/llvm-style/TestLLVMStyle.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/lang/cpp/llvm-style/TestLLVMStyle.py Wed Apr 26 19:24:53 2017 (r317455) @@ -0,0 +1,7 @@ +from lldbsuite.test import lldbinline +from lldbsuite.test import decorators + +lldbinline.MakeInlineTest( + __file__, globals(), [ + decorators.expectedFailureAll( + oslist=["windows"], bugnumber="llvm.org/pr24764")]) \ No newline at end of file Added: vendor/lldb/dist/packages/Python/lldbsuite/test/lang/cpp/llvm-style/main.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/lang/cpp/llvm-style/main.cpp Wed Apr 26 19:24:53 2017 (r317455) @@ -0,0 +1,36 @@ +//===-- main.cpp ------------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LIDENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +namespace n { + struct D { + int i; + static int anInt() { return 2; } + int dump() { return i; } + }; + + class C { + public: + int foo(D *D); + }; +} + +using namespace n; + +int C::foo(D* D) { + return D->dump(); //% self.expect("expression -- D->dump()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["int", "2"]) + //% self.expect("expression -- D::anInt()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["int", "2"]) + +} + +int main (int argc, char const *argv[]) +{ + D myD { D::anInt() }; + C().foo(&myD); + return 0; +} Modified: vendor/lldb/dist/packages/Python/lldbsuite/test/lang/cpp/nsimport/TestCppNsImport.py ============================================================================== --- vendor/lldb/dist/packages/Python/lldbsuite/test/lang/cpp/nsimport/TestCppNsImport.py Wed Apr 26 19:24:50 2017 (r317454) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/lang/cpp/nsimport/TestCppNsImport.py Wed Apr 26 19:24:53 2017 (r317455) @@ -111,8 +111,8 @@ class TestCppNsImport(TestBase): test_result = frame.EvaluateExpression("imported") self.assertTrue( - test_result.IsValid() and test_result.GetError().Fail(), - "imported is ambiguous") + test_result.IsValid() and test_result.GetValueAsSigned() == 99, + "imported = 99") test_result = frame.EvaluateExpression("single") self.assertTrue( Added: vendor/lldb/dist/packages/Python/lldbsuite/test/lang/cpp/symbols/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/lang/cpp/symbols/Makefile Wed Apr 26 19:24:53 2017 (r317455) @@ -0,0 +1,3 @@ +LEVEL = ../../../make +CXX_SOURCES := main.cpp +include $(LEVEL)/Makefile.rules Added: vendor/lldb/dist/packages/Python/lldbsuite/test/lang/cpp/symbols/TestSymbols.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/lang/cpp/symbols/TestSymbols.py Wed Apr 26 19:24:53 2017 (r317455) @@ -0,0 +1,7 @@ +from lldbsuite.test import lldbinline +from lldbsuite.test import decorators + +lldbinline.MakeInlineTest( + __file__, globals(), [ + decorators.expectedFailureAll( + oslist=["windows"], bugnumber="llvm.org/pr24764")]) Added: vendor/lldb/dist/packages/Python/lldbsuite/test/lang/cpp/symbols/main.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/packages/Python/lldbsuite/test/lang/cpp/symbols/main.cpp Wed Apr 26 19:24:53 2017 (r317455) @@ -0,0 +1,40 @@ +//===-- main.cpp ------------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LIDENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +void *D = 0; + +class D { + static int i; +}; + +int D::i = 3; + +namespace errno { + int j = 4; +}; + +int twice(int n) +{ + return n * 2; //% self.expect("expression -- D::i", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["int", "3"]) + //% self.expect("expression -- D", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["void"]) + //% self.expect("expression -- errno::j", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["int", "4"]) +} + +const char getAChar() +{ + const char D[] = "Hello world"; + return D[0]; //% self.expect("expression -- D::i", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["int", "3"]) + //% self.expect("expression -- D", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["char", "Hello"]) +} + +int main (int argc, char const *argv[]) +{ + int six = twice(3); + return 0; +} Modified: vendor/lldb/dist/scripts/interface/SBProcess.i ============================================================================== --- vendor/lldb/dist/scripts/interface/SBProcess.i Wed Apr 26 19:24:50 2017 (r317454) +++ vendor/lldb/dist/scripts/interface/SBProcess.i Wed Apr 26 19:24:53 2017 (r317455) @@ -408,6 +408,9 @@ public: lldb::SBError SaveCore(const char *file_name); + lldb::SBTrace + StartTrace(SBTraceOptions &options, lldb::SBError &error); + lldb::SBError GetMemoryRegionInfo(lldb::addr_t load_addr, lldb::SBMemoryRegionInfo ®ion_info); Modified: vendor/lldb/dist/scripts/interface/SBStructuredData.i ============================================================================== --- vendor/lldb/dist/scripts/interface/SBStructuredData.i Wed Apr 26 19:24:50 2017 (r317454) +++ vendor/lldb/dist/scripts/interface/SBStructuredData.i Wed Apr 26 19:24:53 2017 (r317455) @@ -38,5 +38,8 @@ namespace lldb { lldb::SBError GetDescription(lldb::SBStream &stream) const; + + lldb::SBError + SetFromJSON(lldb::SBStream &stream); }; } Added: vendor/lldb/dist/scripts/interface/SBTrace.i ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/scripts/interface/SBTrace.i Wed Apr 26 19:24:53 2017 (r317455) @@ -0,0 +1,34 @@ +//===-- SWIG Interface for SBTrace.h ----------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +namespace lldb { + +class LLDB_API SBTrace { +public: + SBTrace(); + size_t GetTraceData(SBError &error, void *buf, + size_t size, size_t offset, + lldb::tid_t thread_id); + + size_t GetMetaData(SBError &error, void *buf, + size_t size, size_t offset, + lldb::tid_t thread_id); + + void StopTrace(SBError &error, + lldb::tid_t thread_id); + + void GetTraceConfig(SBTraceOptions &options, + SBError &error); + + lldb::user_id_t GetTraceUID(); + + bool IsValid(); + +}; +} // namespace lldb \ No newline at end of file Added: vendor/lldb/dist/scripts/interface/SBTraceOptions.i ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/scripts/interface/SBTraceOptions.i Wed Apr 26 19:24:53 2017 (r317455) @@ -0,0 +1,38 @@ +//===-- SWIG Interface for SBTraceOptions -----------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +namespace lldb { + +class LLDB_API SBTraceOptions { +public: + SBTraceOptions(); + + lldb::TraceType getType() const; + + uint64_t getTraceBufferSize() const; + + lldb::SBStructuredData getTraceParams(lldb::SBError &error); + + uint64_t getMetaDataBufferSize() const; + + void setTraceParams(lldb::SBStructuredData ¶ms); + + void setType(lldb::TraceType type); + + void setTraceBufferSize(uint64_t size); + + void setMetaDataBufferSize(uint64_t size); + + void setThreadID(lldb::tid_t thread_id); *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***