diff options
author | Ed Maste <emaste@FreeBSD.org> | 2015-02-06 21:38:51 +0000 |
---|---|---|
committer | Ed Maste <emaste@FreeBSD.org> | 2015-02-06 21:38:51 +0000 |
commit | 205afe679855a4ce8149cdaa94d3f0868ce796dc (patch) | |
tree | 09bc83f73246ee3c7a779605cd0122093d2a8a19 /include/lldb/Core | |
parent | 0cac4ca3916ac24ab6139d03cbfd18db9e715bfe (diff) | |
download | src-205afe679855a4ce8149cdaa94d3f0868ce796dc.tar.gz src-205afe679855a4ce8149cdaa94d3f0868ce796dc.zip |
Import LLDB as of upstream SVN r225923 (git 2b588ecd)vendor/lldb/lldb-r225923
This corresponds with the branchpoint for the 3.6 release.
A number of files not required for the FreeBSD build have been removed.
Sponsored by: DARPA, AFRL
Notes
Notes:
svn path=/vendor/lldb/dist/; revision=278332
svn path=/vendor/lldb/lldb-r225923/; revision=278333; tag=vendor/lldb/lldb-r225923
Diffstat (limited to 'include/lldb/Core')
25 files changed, 726 insertions, 296 deletions
diff --git a/include/lldb/Core/Address.h b/include/lldb/Core/Address.h index 8dd2339f9207..b430ef7cec21 100644 --- a/include/lldb/Core/Address.h +++ b/include/lldb/Core/Address.h @@ -87,6 +87,7 @@ public: ///< and file and line), to information about what the pointer points to ///< if the address is in a section (section of pointers, c strings, etc). DumpStyleResolvedDescriptionNoModule, + DumpStyleResolvedDescriptionNoFunctionArguments, DumpStyleDetailedSymbolContext, ///< Detailed symbol context information for an address for all symbol ///< context members. DumpStyleResolvedPointerDescription ///< Dereference a pointer at the current address and then lookup the diff --git a/include/lldb/Core/ArchSpec.h b/include/lldb/Core/ArchSpec.h index 255beee573b6..694e204cdc0d 100644 --- a/include/lldb/Core/ArchSpec.h +++ b/include/lldb/Core/ArchSpec.h @@ -104,7 +104,6 @@ public: eCore_uknownMach32, eCore_uknownMach64, - eCore_kalimba, eCore_kalimba3, eCore_kalimba4, eCore_kalimba5, @@ -142,10 +141,12 @@ public: kCore_hexagon_first = eCore_hexagon_generic, kCore_hexagon_last = eCore_hexagon_hexagonv5, - kCore_kalimba_first = eCore_kalimba, + kCore_kalimba_first = eCore_kalimba3, kCore_kalimba_last = eCore_kalimba5 }; + typedef void (* StopInfoOverrideCallbackType)(lldb_private::Thread &thread); + //------------------------------------------------------------------ /// Default constructor. /// @@ -459,6 +460,30 @@ public: bool IsCompatibleMatch (const ArchSpec& rhs) const; + //------------------------------------------------------------------ + /// Get a stop info override callback for the current architecture. + /// + /// Most platform specific code should go in lldb_private::Platform, + /// but there are cases where no matter which platform you are on + /// certain things hold true. + /// + /// This callback is currently intended to handle cases where a + /// program stops at an instruction that won't get executed and it + /// allows the stop reasonm, like "breakpoint hit", to be replaced + /// with a different stop reason like "no stop reason". + /// + /// This is specifically used for ARM in Thumb code when we stop in + /// an IT instruction (if/then/else) where the instruction won't get + /// executed and therefore it wouldn't be correct to show the program + /// stopped at the current PC. The code is generic and applies to all + /// ARM CPUs. + /// + /// @return NULL or a valid stop info override callback for the + /// current architecture. + //------------------------------------------------------------------ + StopInfoOverrideCallbackType + GetStopInfoOverrideCallback () const; + protected: bool IsEqualTo (const ArchSpec& rhs, bool exact_match) const; diff --git a/include/lldb/Core/Communication.h b/include/lldb/Core/Communication.h index 7e8209d7d9c6..49532fe123c5 100644 --- a/include/lldb/Core/Communication.h +++ b/include/lldb/Core/Communication.h @@ -12,6 +12,7 @@ // C Includes // C++ Includes +#include <atomic> #include <string> // Other libraries and framework includes @@ -19,6 +20,7 @@ #include "lldb/lldb-private.h" #include "lldb/Core/Broadcaster.h" #include "lldb/Core/Error.h" +#include "lldb/Host/HostThread.h" #include "lldb/Host/Mutex.h" #include "lldb/lldb-private.h" @@ -350,8 +352,8 @@ private: protected: lldb::ConnectionSP m_connection_sp; ///< The connection that is current in use by this communications class. - lldb::thread_t m_read_thread; ///< The read thread handle in case we need to cancel the thread. - bool m_read_thread_enabled; + HostThread m_read_thread; ///< The read thread handle in case we need to cancel the thread. + std::atomic<bool> m_read_thread_enabled; std::string m_bytes; ///< A buffer to cache bytes read in the ReadThread function. Mutex m_bytes_mutex; ///< A mutex to protect multi-threaded access to the cached bytes. Mutex m_write_mutex; ///< Don't let multiple threads write at the same time... diff --git a/include/lldb/Core/Connection.h b/include/lldb/Core/Connection.h index dde3c4b1022c..775e0c846f85 100644 --- a/include/lldb/Core/Connection.h +++ b/include/lldb/Core/Connection.h @@ -46,6 +46,8 @@ public: virtual ~Connection (); + static Connection *CreateDefaultConnection(const char *url); + //------------------------------------------------------------------ /// Connect using the connect string \a url. /// diff --git a/include/lldb/Core/ConnectionFileDescriptor.h b/include/lldb/Core/ConnectionFileDescriptor.h deleted file mode 100644 index 75d0202fcf6c..000000000000 --- a/include/lldb/Core/ConnectionFileDescriptor.h +++ /dev/null @@ -1,118 +0,0 @@ -//===-- ConnectionFileDescriptor.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_ConnectionFileDescriptor_h_ -#define liblldb_ConnectionFileDescriptor_h_ - -// C++ Includes -#include <memory> - -#include "lldb/lldb-forward.h" - -// Other libraries and framework includes -// Project includes -#include "lldb/Core/Connection.h" -#include "lldb/Host/Mutex.h" -#include "lldb/Host/Pipe.h" -#include "lldb/Host/Predicate.h" -#include "lldb/Host/IOObject.h" - -namespace lldb_private { - -class Error; -class Socket; -class SocketAddress; - -class ConnectionFileDescriptor : - public Connection -{ -public: - - ConnectionFileDescriptor (); - - ConnectionFileDescriptor (int fd, bool owns_fd); - - virtual - ~ConnectionFileDescriptor (); - - virtual bool - IsConnected () const; - - virtual lldb::ConnectionStatus - Connect (const char *s, Error *error_ptr); - - virtual lldb::ConnectionStatus - Disconnect (Error *error_ptr); - - virtual size_t - Read (void *dst, - size_t dst_len, - uint32_t timeout_usec, - lldb::ConnectionStatus &status, - Error *error_ptr); - - virtual size_t - Write (const void *src, - size_t src_len, - lldb::ConnectionStatus &status, - Error *error_ptr); - - lldb::ConnectionStatus - BytesAvailable (uint32_t timeout_usec, Error *error_ptr); - - bool - InterruptRead (); - - lldb::IOObjectSP GetReadObject() { return m_read_sp; } - const lldb::IOObjectSP GetReadObject() const { return m_read_sp; } - - uint16_t GetListeningPort(uint32_t timeout_sec); - -protected: - - void - OpenCommandPipe (); - - void - CloseCommandPipe (); - - lldb::ConnectionStatus - SocketListen (const char *host_and_port, Error *error_ptr); - - lldb::ConnectionStatus - ConnectTCP (const char *host_and_port, Error *error_ptr); - - lldb::ConnectionStatus - ConnectUDP (const char *args, Error *error_ptr); - - lldb::ConnectionStatus - NamedSocketConnect (const char *socket_name, Error *error_ptr); - - lldb::ConnectionStatus - NamedSocketAccept (const char *socket_name, Error *error_ptr); - - lldb::IOObjectSP m_read_sp; - lldb::IOObjectSP m_write_sp; - - Predicate<uint16_t> m_port_predicate; // Used when binding to port zero to wait for the thread - // that creates the socket, binds and listens to resolve - // the port number. - - Pipe m_pipe; - Mutex m_mutex; - bool m_shutting_down; // This marks that we are shutting down so if we get woken up from - // BytesAvailable to disconnect, we won't try to read again. - bool m_waiting_for_accept; -private: - DISALLOW_COPY_AND_ASSIGN (ConnectionFileDescriptor); -}; - -} // namespace lldb_private - -#endif // liblldb_ConnectionFileDescriptor_h_ diff --git a/include/lldb/Core/DataBuffer.h b/include/lldb/Core/DataBuffer.h index 64e2a8857837..da4934457233 100644 --- a/include/lldb/Core/DataBuffer.h +++ b/include/lldb/Core/DataBuffer.h @@ -14,6 +14,8 @@ #include <stdint.h> #include <string.h> +#include "lldb/lldb-types.h" + namespace lldb_private { //---------------------------------------------------------------------- diff --git a/include/lldb/Core/DataExtractor.h b/include/lldb/Core/DataExtractor.h index c9db2dab73d2..516953b00c33 100644 --- a/include/lldb/Core/DataExtractor.h +++ b/include/lldb/Core/DataExtractor.h @@ -13,9 +13,13 @@ #include "lldb/lldb-private.h" + +#include "llvm/ADT/SmallVector.h" + #include <limits.h> #include <stdint.h> #include <string.h> +#include <vector> namespace lldb_private { @@ -85,8 +89,11 @@ public: /// /// @param[in] addr_size /// A new address byte size value. + /// + /// @param[in] target_byte_size + /// A size of a target byte in 8-bit host bytes //------------------------------------------------------------------ - DataExtractor (const void* data, lldb::offset_t data_length, lldb::ByteOrder byte_order, uint32_t addr_size); + DataExtractor (const void* data, lldb::offset_t data_length, lldb::ByteOrder byte_order, uint32_t addr_size, uint32_t target_byte_size = 1); //------------------------------------------------------------------ /// Construct with shared data. @@ -104,8 +111,11 @@ public: /// /// @param[in] addr_size /// A new address byte size value. + /// + /// @param[in] target_byte_size + /// A size of a target byte in 8-bit host bytes //------------------------------------------------------------------ - DataExtractor (const lldb::DataBufferSP& data_sp, lldb::ByteOrder byte_order, uint32_t addr_size); + DataExtractor (const lldb::DataBufferSP& data_sp, lldb::ByteOrder byte_order, uint32_t addr_size, uint32_t target_byte_size = 1); //------------------------------------------------------------------ /// Construct with a subset of \a data. @@ -129,8 +139,11 @@ public: /// /// @param[in] length /// The length in bytes of the subset of data. + /// + /// @param[in] target_byte_size + /// A size of a target byte in 8-bit host bytes //------------------------------------------------------------------ - DataExtractor (const DataExtractor& data, lldb::offset_t offset, lldb::offset_t length); + DataExtractor (const DataExtractor& data, lldb::offset_t offset, lldb::offset_t length, uint32_t target_byte_size = 1); DataExtractor (const DataExtractor& rhs); //------------------------------------------------------------------ @@ -863,7 +876,7 @@ public: *offset_ptr += 1; return val; } - + uint16_t GetU16_unchecked (lldb::offset_t *offset_ptr) const; @@ -1300,6 +1313,11 @@ public: return size - offset; return 0; } + + void + Checksum (llvm::SmallVectorImpl<uint8_t> &dest, + uint64_t max_data = 0); + protected: @@ -1311,6 +1329,7 @@ protected: lldb::ByteOrder m_byte_order; ///< The byte order of the data we are extracting from. uint32_t m_addr_size; ///< The address size to use when extracting pointers or addresses mutable lldb::DataBufferSP m_data_sp; ///< The shared pointer to data that can be shared among multilple instances + const uint32_t m_target_byte_size; }; } // namespace lldb_private diff --git a/include/lldb/Core/Debugger.h b/include/lldb/Core/Debugger.h index 7ab62e5b7f3a..15c832f4bf66 100644 --- a/include/lldb/Core/Debugger.h +++ b/include/lldb/Core/Debugger.h @@ -25,6 +25,7 @@ #include "lldb/Core/UserID.h" #include "lldb/Core/UserSettingsController.h" #include "lldb/DataFormatters/FormatManager.h" +#include "lldb/Host/HostThread.h" #include "lldb/Host/Terminal.h" #include "lldb/Interpreter/OptionValueProperties.h" #include "lldb/Target/ExecutionContext.h" @@ -249,6 +250,13 @@ public: Stream &s, ValueObject* valobj = NULL); + static bool + FormatDisassemblerAddress (const char *format, + const SymbolContext *sc, + const SymbolContext *prev_sc, + const ExecutionContext *exe_ctx, + const Address *addr, + Stream &s); void ClearIOHandlers (); @@ -287,10 +295,13 @@ public: bool GetAutoConfirm () const; - + + const char * + GetDisassemblyFormat() const; + const char * GetFrameFormat() const; - + const char * GetThreadFormat() const; @@ -337,6 +348,9 @@ public: GetAutoOneLineSummaries () const; bool + GetEscapeNonPrintables () const; + + bool GetNotifyVoid () const; @@ -364,9 +378,14 @@ public: bool IsHandlingEvents () const { - return IS_VALID_LLDB_HOST_THREAD(m_event_handler_thread); + return m_event_handler_thread.IsJoinable(); } + // This is for use in the command interpreter, when you either want the selected target, or if no target + // is present you want to prime the dummy target with entities that will be copied over to new targets. + Target *GetSelectedOrDummyTarget(bool prefer_dummy = false); + Target *GetDummyTarget(); + protected: friend class CommandInterpreter; @@ -412,11 +431,16 @@ protected: { return m_source_file_cache; } + + void + InstanceInitialize (); + lldb::StreamFileSP m_input_file_sp; lldb::StreamFileSP m_output_file_sp; lldb::StreamFileSP m_error_file_sp; TerminalState m_terminal_state; TargetList m_target_list; + PlatformList m_platform_list; Listener m_listener; std::unique_ptr<SourceManager> m_source_manager_ap; // This is a scratch source manager that we return if we have no targets. @@ -432,12 +456,19 @@ protected: static LoadPluginCallbackType g_load_plugin_callback; typedef std::vector<llvm::sys::DynamicLibrary> LoadedPluginsList; LoadedPluginsList m_loaded_plugins; - lldb::thread_t m_event_handler_thread; - lldb::thread_t m_io_handler_thread; + HostThread m_event_handler_thread; + HostThread m_io_handler_thread; + Broadcaster m_sync_broadcaster; lldb::ListenerSP m_forward_listener_sp; - void - InstanceInitialize (); - + + //---------------------------------------------------------------------- + // Events for m_sync_broadcaster + //---------------------------------------------------------------------- + enum + { + eBroadcastBitEventThreadIsListening = (1 << 0), + }; + private: // Use Debugger::CreateInstance() to get a shared pointer to a new diff --git a/include/lldb/Core/Disassembler.h b/include/lldb/Core/Disassembler.h index 06a703b4c1aa..b0b841b0a925 100644 --- a/include/lldb/Core/Disassembler.h +++ b/include/lldb/Core/Disassembler.h @@ -77,12 +77,60 @@ public: m_address = addr; } + //------------------------------------------------------------------ + /// Dump the text representation of this Instruction to a Stream + /// + /// Print the (optional) address, (optional) bytes, opcode, + /// operands, and instruction comments to a stream. + /// + /// @param[in] s + /// The Stream to add the text to. + /// + /// @param[in] show_address + /// Whether the address (using disassembly_addr_format_spec formatting) + /// should be printed. + /// + /// @param[in] show_bytes + /// Whether the bytes of the assembly instruction should be printed. + /// + /// @param[in] max_opcode_byte_size + /// The size (in bytes) of the largest instruction in the list that + /// we are printing (for text justification/alignment purposes) + /// Only needed if show_bytes is true. + /// + /// @param[in] exe_ctx + /// The current execution context, if available. May be used in + /// the assembling of the operands+comments for this instruction. + /// Pass NULL if not applicable. + /// + /// @param[in] sym_ctx + /// The SymbolContext for this instruction. + /// Pass NULL if not available/computed. + /// Only needed if show_address is true. + /// + /// @param[in] prev_sym_ctx + /// The SymbolContext for the previous instruction. Depending on + /// the disassembly address format specification, a change in + /// Symbol / Function may mean that a line is printed with the new + /// symbol/function name. + /// Pass NULL if unavailable, or if this is the first instruction of + /// the InstructionList. + /// Only needed if show_address is true. + /// + /// @param[in] disassembly_addr_format_spec + /// The format specification for how addresses are printed. + /// Only needed if show_address is true. + //------------------------------------------------------------------ + virtual void Dump (Stream *s, uint32_t max_opcode_byte_size, bool show_address, bool show_bytes, - const ExecutionContext* exe_ctx); + const ExecutionContext* exe_ctx, + const SymbolContext *sym_ctx, + const SymbolContext *prev_sym_ctx, + const char *disassembly_addr_format_spec); virtual bool DoesBranch () = 0; diff --git a/include/lldb/Core/FileSpecList.h b/include/lldb/Core/FileSpecList.h index f94bdae83c01..7730690ca5b7 100644 --- a/include/lldb/Core/FileSpecList.h +++ b/include/lldb/Core/FileSpecList.h @@ -119,12 +119,15 @@ public: /// @param[in] full /// Should FileSpec::Equal be called with "full" true or false. /// + /// @param[in] remove_backup_dots + /// Should FileSpec::Equal be called with "remove_backup_dots" true or false. + /// /// @return /// The index of the file that matches \a file if it is found, /// else UINT32_MAX is returned. //------------------------------------------------------------------ size_t - FindFileIndex (size_t idx, const FileSpec &file, bool full) const; + FindFileIndex (size_t idx, const FileSpec &file, bool full, bool remove_backup_dots = false) const; //------------------------------------------------------------------ /// Get file at index. diff --git a/include/lldb/Core/IOHandler.h b/include/lldb/Core/IOHandler.h index f477ebd48007..02e6bde1edb6 100644 --- a/include/lldb/Core/IOHandler.h +++ b/include/lldb/Core/IOHandler.h @@ -19,9 +19,11 @@ #include "lldb/Core/ConstString.h" #include "lldb/Core/Error.h" #include "lldb/Core/Flags.h" +#include "lldb/Core/Stream.h" #include "lldb/Core/StringList.h" #include "lldb/Core/ValueObjectList.h" #include "lldb/Host/Mutex.h" +#include "lldb/Host/Predicate.h" namespace curses { @@ -34,9 +36,23 @@ namespace lldb_private { class IOHandler { public: - IOHandler (Debugger &debugger); + enum class Type { + CommandInterpreter, + CommandList, + Confirm, + Curses, + Expression, + ProcessIO, + PythonInterpreter, + PythonCode, + Other + }; + + IOHandler (Debugger &debugger, + IOHandler::Type type); IOHandler (Debugger &debugger, + IOHandler::Type type, const lldb::StreamFileSP &input_sp, const lldb::StreamFileSP &output_sp, const lldb::StreamFileSP &error_sp, @@ -97,6 +113,12 @@ namespace lldb_private { return m_done; } + Type + GetType () const + { + return m_type; + } + virtual void Activate () { @@ -128,7 +150,19 @@ namespace lldb_private { { return ConstString(); } + + virtual const char * + GetCommandPrefix () + { + return NULL; + } + virtual const char * + GetHelpPrologue() + { + return NULL; + } + int GetInputFD(); @@ -206,13 +240,21 @@ namespace lldb_private { //------------------------------------------------------------------ bool GetIsRealTerminal (); - + + void + SetPopped (bool b); + + void + WaitForPop (); + protected: Debugger &m_debugger; lldb::StreamFileSP m_input_sp; lldb::StreamFileSP m_output_sp; lldb::StreamFileSP m_error_sp; + Predicate<bool> m_popped; Flags m_flags; + Type m_type; void *m_user_data; bool m_done; bool m_active; @@ -254,7 +296,12 @@ namespace lldb_private { IOHandlerActivated (IOHandler &io_handler) { } - + + virtual void + IOHandlerDeactivated (IOHandler &io_handler) + { + } + virtual int IOHandlerComplete (IOHandler &io_handler, const char *current_line, @@ -264,6 +311,44 @@ namespace lldb_private { int max_matches, StringList &matches); + virtual const char * + IOHandlerGetFixIndentationCharacters () + { + return NULL; + } + + //------------------------------------------------------------------ + /// Called when a new line is created or one of an identifed set of + /// indentation characters is typed. + /// + /// This function determines how much indentation should be added + /// or removed to match the recommended amount for the final line. + /// + /// @param[in] io_handler + /// The IOHandler that responsible for input. + /// + /// @param[in] lines + /// The current input up to the line to be corrected. Lines + /// following the line containing the cursor are not included. + /// + /// @param[in] cursor_position + /// The number of characters preceeding the cursor on the final + /// line at the time. + /// + /// @return + /// Returns an integer describing the number of spaces needed + /// to correct the indentation level. Positive values indicate + /// that spaces should be added, while negative values represent + /// spaces that should be removed. + //------------------------------------------------------------------ + virtual int + IOHandlerFixIndentation (IOHandler &io_handler, + const StringList &lines, + int cursor_position) + { + return 0; + } + //------------------------------------------------------------------ /// Called when a line or lines have been retrieved. /// @@ -275,40 +360,55 @@ namespace lldb_private { //------------------------------------------------------------------ virtual void IOHandlerInputComplete (IOHandler &io_handler, std::string &data) = 0; - + + virtual void + IOHandlerInputInterrupted (IOHandler &io_handler, std::string &data) + { + } + //------------------------------------------------------------------ - /// Called when a line in \a lines has been updated when doing - /// multi-line input. + /// Called to determine whether typing enter after the last line in + /// \a lines should end input. This function will not be called on + /// IOHandler objects that are getting single lines. + /// @param[in] io_handler + /// The IOHandler that responsible for updating the lines. + /// + /// @param[in] lines + /// The current multi-line content. May be altered to provide + /// alternative input when complete. /// /// @return - /// Return an enumeration to indicate the status of the current - /// line: - /// Success - The line is good and should be added to the - /// multiple lines - /// Error - There is an error with the current line and it - /// need to be re-edited before it is acceptable - /// Done - The lines collection is complete and ready to be - /// returned. + /// Return an boolean to indicate whether input is complete, + /// true indicates that no additional input is necessary, while + /// false indicates that more input is required. //------------------------------------------------------------------ - virtual LineStatus - IOHandlerLinesUpdated (IOHandler &io_handler, - StringList &lines, - uint32_t line_idx, - Error &error) + virtual bool + IOHandlerIsInputComplete (IOHandler &io_handler, + StringList &lines) { - return LineStatus::Done; // Stop getting lines on the first line that is updated - // subclasses should do something more intelligent here. - // This function will not be called on IOHandler objects - // that are getting single lines. + // Impose no requirements for input to be considered + // complete. subclasses should do something more intelligent. + return true; } - virtual ConstString IOHandlerGetControlSequence (char ch) { return ConstString(); } + virtual const char * + IOHandlerGetCommandPrefix () + { + return NULL; + } + + virtual const char * + IOHandlerGetHelpPrologue () + { + return NULL; + } + //------------------------------------------------------------------ // Intercept the IOHandler::Interrupt() calls and do something. // @@ -356,30 +456,21 @@ namespace lldb_private { return ConstString(); } - virtual LineStatus - IOHandlerLinesUpdated (IOHandler &io_handler, - StringList &lines, - uint32_t line_idx, - Error &error) + virtual bool + IOHandlerIsInputComplete (IOHandler &io_handler, + StringList &lines) { - if (line_idx == UINT32_MAX) + // Determine whether the end of input signal has been entered + const size_t num_lines = lines.GetSize(); + if (num_lines > 0 && lines[num_lines - 1] == m_end_line) { - // Remove the last empty line from "lines" so it doesn't appear - // in our final expression and return true to indicate we are done + // Remove the terminal line from "lines" so it doesn't appear in + // the resulting input and return true to indicate we are done // getting lines lines.PopBack(); - return LineStatus::Done; - } - else if (line_idx + 1 == lines.GetSize()) - { - // The last line was edited, if this line is empty, then we are done - // getting our multiple lines. - if (lines[line_idx] == m_end_line) - { - return LineStatus::Done; - } + return true; } - return LineStatus::Success; + return false; } protected: const std::string m_end_line; @@ -390,20 +481,26 @@ namespace lldb_private { { public: IOHandlerEditline (Debugger &debugger, + IOHandler::Type type, const char *editline_name, // Used for saving history files const char *prompt, + const char *continuation_prompt, bool multi_line, + bool color_prompts, uint32_t line_number_start, // If non-zero show line numbers starting at 'line_number_start' IOHandlerDelegate &delegate); IOHandlerEditline (Debugger &debugger, + IOHandler::Type type, const lldb::StreamFileSP &input_sp, const lldb::StreamFileSP &output_sp, const lldb::StreamFileSP &error_sp, uint32_t flags, const char *editline_name, // Used for saving history files const char *prompt, + const char *continuation_prompt, bool multi_line, + bool color_prompts, uint32_t line_number_start, // If non-zero show line numbers starting at 'line_number_start' IOHandlerDelegate &delegate); @@ -429,11 +526,10 @@ namespace lldb_private { GotEOF(); virtual void - Activate () - { - IOHandler::Activate(); - m_delegate.IOHandlerActivated(*this); - } + Activate (); + + virtual void + Deactivate (); virtual ConstString GetControlSequence (char ch) @@ -442,11 +538,29 @@ namespace lldb_private { } virtual const char * + GetCommandPrefix () + { + return m_delegate.IOHandlerGetCommandPrefix (); + } + + virtual const char * + GetHelpPrologue () + { + return m_delegate.IOHandlerGetHelpPrologue (); + } + + virtual const char * GetPrompt (); virtual bool SetPrompt (const char *prompt); - + + const char * + GetContinuationPrompt (); + + void + SetContinuationPrompt (const char *prompt); + bool GetLine (std::string &line, bool &interrupted); @@ -456,14 +570,40 @@ namespace lldb_private { void SetBaseLineNumber (uint32_t line); - private: - static LineStatus - LineCompletedCallback (Editline *editline, - StringList &lines, - uint32_t line_idx, - Error &error, - void *baton); + bool + GetInterruptExits () + { + return m_interrupt_exits; + } + void + SetInterruptExits (bool b) + { + m_interrupt_exits = b; + } + + const StringList * + GetCurrentLines () const + { + return m_current_lines_ptr; + } + + uint32_t + GetCurrentLineIndex () const; + + private: +#ifndef LLDB_DISABLE_LIBEDIT + static bool + IsInputCompleteCallback (Editline *editline, + StringList &lines, + void *baton); + + static int + FixIndentationCallback (Editline *editline, + const StringList &lines, + int cursor_position, + void *baton); + static int AutoCompleteCallback (const char *current_line, const char *cursor, const char *last_char, @@ -471,18 +611,28 @@ namespace lldb_private { int max_matches, StringList &matches, void *baton); +#endif protected: +#ifndef LLDB_DISABLE_LIBEDIT std::unique_ptr<Editline> m_editline_ap; +#endif IOHandlerDelegate &m_delegate; std::string m_prompt; + std::string m_continuation_prompt; + StringList *m_current_lines_ptr; uint32_t m_base_line_number; // If non-zero, then show line numbers in prompt - bool m_multi_line; + uint32_t m_curr_line_idx; + bool m_multi_line; + bool m_color_prompts; + bool m_interrupt_exits; }; + // The order of base classes is important. Look at the constructor of IOHandlerConfirm + // to see how. class IOHandlerConfirm : - public IOHandlerEditline, - public IOHandlerDelegate + public IOHandlerDelegate, + public IOHandlerEditline { public: IOHandlerConfirm (Debugger &debugger, @@ -607,7 +757,8 @@ namespace lldb_private { if (sp) { Mutex::Locker locker (m_mutex); - m_stack.push (sp); + sp->SetPopped (false); + m_stack.push_back (sp); // Set m_top the non-locking IsTop() call m_top = sp.get(); } @@ -627,7 +778,7 @@ namespace lldb_private { { Mutex::Locker locker (m_mutex); if (!m_stack.empty()) - sp = m_stack.top(); + sp = m_stack.back(); } return sp; } @@ -637,12 +788,16 @@ namespace lldb_private { { Mutex::Locker locker (m_mutex); if (!m_stack.empty()) - m_stack.pop(); + { + lldb::IOHandlerSP sp (m_stack.back()); + m_stack.pop_back(); + sp->SetPopped (true); + } // Set m_top the non-locking IsTop() call if (m_stack.empty()) m_top = NULL; else - m_top = m_stack.top().get(); + m_top = m_stack.back().get(); } Mutex & @@ -657,6 +812,19 @@ namespace lldb_private { return m_top == io_handler_sp.get(); } + bool + CheckTopIOHandlerTypes (IOHandler::Type top_type, IOHandler::Type second_top_type) + { + Mutex::Locker locker (m_mutex); + const size_t num_io_handlers = m_stack.size(); + if (num_io_handlers >= 2 && + m_stack[num_io_handlers-1]->GetType() == top_type && + m_stack[num_io_handlers-2]->GetType() == second_top_type) + { + return true; + } + return false; + } ConstString GetTopIOHandlerControlSequence (char ch) { @@ -665,9 +833,26 @@ namespace lldb_private { return ConstString(); } - protected: + const char * + GetTopIOHandlerCommandPrefix() + { + if (m_top) + return m_top->GetCommandPrefix(); + return NULL; + } + + const char * + GetTopIOHandlerHelpPrologue() + { + if (m_top) + return m_top->GetHelpPrologue(); + return NULL; + } + + protected: - std::stack<lldb::IOHandlerSP> m_stack; + typedef std::vector<lldb::IOHandlerSP> collection; + collection m_stack; mutable Mutex m_mutex; IOHandler *m_top; diff --git a/include/lldb/Core/Mangled.h b/include/lldb/Core/Mangled.h index 7dc0eca3e8db..2f3df6afd8dc 100644 --- a/include/lldb/Core/Mangled.h +++ b/include/lldb/Core/Mangled.h @@ -37,7 +37,8 @@ public: enum NamePreference { ePreferMangled, - ePreferDemangled + ePreferDemangled, + ePreferDemangledWithoutArguments }; //---------------------------------------------------------------------- diff --git a/include/lldb/Core/ModuleList.h b/include/lldb/Core/ModuleList.h index c3074d4d6510..a46e212da9bb 100644 --- a/include/lldb/Core/ModuleList.h +++ b/include/lldb/Core/ModuleList.h @@ -279,6 +279,16 @@ public: SymbolContextList& sc_list); //------------------------------------------------------------------ + /// @see Module::FindFunctions () + //------------------------------------------------------------------ + size_t + FindFunctions(const RegularExpression &name, + bool include_symbols, + bool include_inlines, + bool append, + SymbolContextList& sc_list); + + //------------------------------------------------------------------ /// Find global and static variables by name. /// /// @param[in] name @@ -586,6 +596,13 @@ public: return ModuleIterable(m_modules, GetMutex()); } + typedef AdaptedIterable<collection, lldb::ModuleSP, vector_adapter> ModuleIterableNoLocking; + ModuleIterableNoLocking + ModulesNoLocking () + { + return ModuleIterableNoLocking(m_modules); + } + }; } // namespace lldb_private diff --git a/include/lldb/Core/PluginManager.h b/include/lldb/Core/PluginManager.h index a2ac67bf9f25..55e6df06d842 100644 --- a/include/lldb/Core/PluginManager.h +++ b/include/lldb/Core/PluginManager.h @@ -342,7 +342,46 @@ public: static UnwindAssemblyCreateInstance GetUnwindAssemblyCreateCallbackForPluginName (const ConstString &name); + + //------------------------------------------------------------------ + // MemoryHistory + //------------------------------------------------------------------ + static bool + RegisterPlugin (const ConstString &name, + const char *description, + MemoryHistoryCreateInstance create_callback); + + static bool + UnregisterPlugin (MemoryHistoryCreateInstance create_callback); + + static MemoryHistoryCreateInstance + GetMemoryHistoryCreateCallbackAtIndex (uint32_t idx); + + static MemoryHistoryCreateInstance + GetMemoryHistoryCreateCallbackForPluginName (const ConstString &name); + + //------------------------------------------------------------------ + // InstrumentationRuntime + //------------------------------------------------------------------ + static bool + RegisterPlugin (const ConstString &name, + const char *description, + InstrumentationRuntimeCreateInstance create_callback, + InstrumentationRuntimeGetType get_type_callback); + + static bool + UnregisterPlugin (InstrumentationRuntimeCreateInstance create_callback); + static InstrumentationRuntimeGetType + GetInstrumentationRuntimeGetTypeCallbackAtIndex (uint32_t idx); + + static InstrumentationRuntimeCreateInstance + GetInstrumentationRuntimeCreateCallbackAtIndex (uint32_t idx); + + static InstrumentationRuntimeCreateInstance + GetInstrumentationRuntimeCreateCallbackForPluginName (const ConstString &name); + + //------------------------------------------------------------------ // Some plug-ins might register a DebuggerInitializeCallback // callback when registering the plug-in. After a new Debugger diff --git a/include/lldb/Core/RegularExpression.h b/include/lldb/Core/RegularExpression.h index 8e36811fa750..00d8310b4806 100644 --- a/include/lldb/Core/RegularExpression.h +++ b/include/lldb/Core/RegularExpression.h @@ -39,6 +39,9 @@ inline void regfree(llvm_regex_t * a) } #else +#if __ANDROID_NDK__ +#include <regex> +#endif #include <regex.h> #endif #include <stdint.h> diff --git a/include/lldb/Core/SearchFilter.h b/include/lldb/Core/SearchFilter.h index 57f1b9c1a0a5..bbb7509cedb2 100644 --- a/include/lldb/Core/SearchFilter.h +++ b/include/lldb/Core/SearchFilter.h @@ -225,8 +225,10 @@ public: virtual void Dump (Stream *s) const; -protected: + lldb::SearchFilterSP + CopyForBreakpoint (Breakpoint &breakpoint); +protected: // These are utility functions to assist with the search iteration. They are used by the // default Search method. @@ -248,26 +250,40 @@ protected: const SymbolContext &context, Searcher &searcher); + virtual lldb::SearchFilterSP + DoCopyForBreakpoint (Breakpoint &breakpoint) = 0; + + void + SetTarget(lldb::TargetSP &target_sp) + { + m_target_sp = target_sp; + } + lldb::TargetSP m_target_sp; // Every filter has to be associated with a target for // now since you need a starting place for the search. }; //---------------------------------------------------------------------- -/// @class SearchFilterForNonModuleSpecificSearches SearchFilter.h "lldb/Core/SearchFilter.h" -/// @brief This is a SearchFilter that searches through all modules. It also consults the Target::ModuleIsExcludedForNonModuleSpecificSearches. +/// @class SearchFilterForUnconstrainedSearches SearchFilter.h "lldb/Core/SearchFilter.h" +/// @brief This is a SearchFilter that searches through all modules. It also consults the Target::ModuleIsExcludedForUnconstrainedSearches. //---------------------------------------------------------------------- -class SearchFilterForNonModuleSpecificSearches : +class SearchFilterForUnconstrainedSearches : public SearchFilter { public: - SearchFilterForNonModuleSpecificSearches (const lldb::TargetSP &targetSP) : SearchFilter(targetSP) {} - ~SearchFilterForNonModuleSpecificSearches () {} + SearchFilterForUnconstrainedSearches (const lldb::TargetSP &target_sp) : SearchFilter(target_sp) {} + ~SearchFilterForUnconstrainedSearches () {} - virtual bool - ModulePasses (const FileSpec &module_spec); + bool + ModulePasses (const FileSpec &module_spec) override; - virtual bool - ModulePasses (const lldb::ModuleSP &module_sp); + bool + ModulePasses (const lldb::ModuleSP &module_sp) override; + +protected: + lldb::SearchFilterSP + DoCopyForBreakpoint (Breakpoint &breakpoint) override; + }; //---------------------------------------------------------------------- @@ -301,32 +317,36 @@ public: const SearchFilterByModule& operator=(const SearchFilterByModule& rhs); - virtual bool - ModulePasses (const lldb::ModuleSP &module_sp); + bool + ModulePasses (const lldb::ModuleSP &module_sp) override; - virtual bool - ModulePasses (const FileSpec &spec); + bool + ModulePasses (const FileSpec &spec) override; - virtual bool - AddressPasses (Address &address); + bool + AddressPasses (Address &address) override; - virtual bool - CompUnitPasses (FileSpec &fileSpec); + bool + CompUnitPasses (FileSpec &fileSpec) override; - virtual bool - CompUnitPasses (CompileUnit &compUnit); + bool + CompUnitPasses (CompileUnit &compUnit) override; - virtual void - GetDescription(Stream *s); + void + GetDescription(Stream *s) override; - virtual uint32_t - GetFilterRequiredItems (); + uint32_t + GetFilterRequiredItems () override; - virtual void - Dump (Stream *s) const; + void + Dump (Stream *s) const override; - virtual void - Search (Searcher &searcher); + void + Search (Searcher &searcher) override; + +protected: + lldb::SearchFilterSP + DoCopyForBreakpoint (Breakpoint &breakpoint) override; private: FileSpec m_module_spec; @@ -358,32 +378,36 @@ public: const SearchFilterByModuleList& operator=(const SearchFilterByModuleList& rhs); - virtual bool - ModulePasses (const lldb::ModuleSP &module_sp); + bool + ModulePasses (const lldb::ModuleSP &module_sp) override; - virtual bool - ModulePasses (const FileSpec &spec); + bool + ModulePasses (const FileSpec &spec) override; - virtual bool - AddressPasses (Address &address); + bool + AddressPasses (Address &address) override; - virtual bool - CompUnitPasses (FileSpec &fileSpec); + bool + CompUnitPasses (FileSpec &fileSpec) override; - virtual bool - CompUnitPasses (CompileUnit &compUnit); + bool + CompUnitPasses (CompileUnit &compUnit) override; - virtual void - GetDescription(Stream *s); + void + GetDescription(Stream *s) override; - virtual uint32_t - GetFilterRequiredItems (); + uint32_t + GetFilterRequiredItems () override; - virtual void - Dump (Stream *s) const; + void + Dump (Stream *s) const override; - virtual void - Search (Searcher &searcher); + void + Search (Searcher &searcher) override; + +protected: + lldb::SearchFilterSP + DoCopyForBreakpoint (Breakpoint &breakpoint) override; private: FileSpecList m_module_spec_list; @@ -416,26 +440,30 @@ public: const SearchFilterByModuleListAndCU& operator=(const SearchFilterByModuleListAndCU& rhs); - virtual bool - AddressPasses (Address &address); + bool + AddressPasses (Address &address) override; - virtual bool - CompUnitPasses (FileSpec &fileSpec); + bool + CompUnitPasses (FileSpec &fileSpec) override; - virtual bool - CompUnitPasses (CompileUnit &compUnit); + bool + CompUnitPasses (CompileUnit &compUnit) override; - virtual void - GetDescription(Stream *s); + void + GetDescription(Stream *s) override; - virtual uint32_t - GetFilterRequiredItems (); + uint32_t + GetFilterRequiredItems () override; - virtual void - Dump (Stream *s) const; + void + Dump (Stream *s) const override; - virtual void - Search (Searcher &searcher); + void + Search (Searcher &searcher) override; + +protected: + lldb::SearchFilterSP + DoCopyForBreakpoint (Breakpoint &breakpoint) override; private: FileSpecList m_module_spec_list; diff --git a/include/lldb/Core/Section.h b/include/lldb/Core/Section.h index 32dac5f35b84..65d408e29867 100644 --- a/include/lldb/Core/Section.h +++ b/include/lldb/Core/Section.h @@ -120,7 +120,8 @@ public: lldb::offset_t file_offset, lldb::offset_t file_size, uint32_t log2align, - uint32_t flags); + uint32_t flags, + uint32_t target_byte_size = 1); // Create a section that is a child of parent_section_sp Section (const lldb::SectionSP &parent_section_sp, // NULL for top level sections, non-NULL for child sections @@ -134,7 +135,8 @@ public: lldb::offset_t file_offset, lldb::offset_t file_size, uint32_t log2align, - uint32_t flags); + uint32_t flags, + uint32_t target_byte_size = 1); ~Section (); @@ -297,6 +299,12 @@ public: m_log2align = align; } + // Get the number of host bytes required to hold a target byte + uint32_t + GetTargetByteSize() const + { + return m_target_byte_size; + } protected: @@ -317,6 +325,8 @@ protected: // hits unless the children contain the address. m_encrypted:1, // Set to true if the contents are encrypted m_thread_specific:1;// This section is thread specific + uint32_t m_target_byte_size; // Some architectures have non-8-bit byte size. This is specified as + // as a multiple number of a host bytes private: DISALLOW_COPY_AND_ASSIGN (Section); }; diff --git a/include/lldb/Core/StreamString.h b/include/lldb/Core/StreamString.h index a26ad2d16a05..1aa46dd80a68 100644 --- a/include/lldb/Core/StreamString.h +++ b/include/lldb/Core/StreamString.h @@ -46,6 +46,9 @@ public: size_t GetSize() const; + size_t + GetSizeOfLastLine () const; + std::string & GetString(); diff --git a/include/lldb/Core/ThreadSafeDenseMap.h b/include/lldb/Core/ThreadSafeDenseMap.h new file mode 100644 index 000000000000..f5a7ccfb2ffa --- /dev/null +++ b/include/lldb/Core/ThreadSafeDenseMap.h @@ -0,0 +1,65 @@ +//===-- ThreadSafeDenseMap.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_ThreadSafeDenseMap_h_ +#define liblldb_ThreadSafeDenseMap_h_ + +// C Includes +// C++ Includes + +// Other libraries and framework includes +#include "llvm/ADT/DenseMap.h" + +// Project includes +#include "lldb/Host/Mutex.h" + +namespace lldb_private { + +template <typename _KeyType, typename _ValueType> +class ThreadSafeDenseMap +{ +public: + typedef llvm::DenseMap<_KeyType,_ValueType> LLVMMapType; + + ThreadSafeDenseMap(unsigned map_initial_capacity = 0, + Mutex::Type mutex_type = Mutex::eMutexTypeNormal) : + m_map(map_initial_capacity), + m_mutex(mutex_type) + { + } + + void + Insert (_KeyType k, _ValueType v) + { + Mutex::Locker locker(m_mutex); + m_map.insert(std::make_pair(k,v)); + } + + void + Erase (_KeyType k) + { + Mutex::Locker locker(m_mutex); + m_map.erase(k); + } + + _ValueType + Lookup (_KeyType k) + { + Mutex::Locker locker(m_mutex); + return m_map.lookup(k); + } + +protected: + LLVMMapType m_map; + Mutex m_mutex; +}; + +} // namespace lldb_private + +#endif // liblldb_ThreadSafeSTLMap_h_ diff --git a/include/lldb/Core/ThreadSafeSTLMap.h b/include/lldb/Core/ThreadSafeSTLMap.h index 703ce481f637..4235edc92ade 100644 --- a/include/lldb/Core/ThreadSafeSTLMap.h +++ b/include/lldb/Core/ThreadSafeSTLMap.h @@ -16,6 +16,7 @@ // Other libraries and framework includes // Project includes +#include "lldb/lldb-defines.h" #include "lldb/Host/Mutex.h" namespace lldb_private { diff --git a/include/lldb/Core/ValueObject.h b/include/lldb/Core/ValueObject.h index 6a08ec6507f9..fa96c8989913 100644 --- a/include/lldb/Core/ValueObject.h +++ b/include/lldb/Core/ValueObject.h @@ -14,9 +14,11 @@ // C++ Includes #include <map> #include <vector> + // Other libraries and framework includes -// Project includes +#include "llvm/ADT/SmallVector.h" +// Project includes #include "lldb/lldb-private.h" #include "lldb/Core/DataExtractor.h" #include "lldb/Core/Error.h" @@ -88,6 +90,7 @@ public: { eExpressionPathScanEndReasonEndOfString = 1, // out of data to parse eExpressionPathScanEndReasonNoSuchChild, // child element not found + eExpressionPathScanEndReasonNoSuchSyntheticChild, // (synthetic) child element not found eExpressionPathScanEndReasonEmptyRangeNotAllowed, // [] only allowed for arrays eExpressionPathScanEndReasonDotInsteadOfArrow, // . used when -> should be used eExpressionPathScanEndReasonArrowInsteadOfDot, // -> used when . should be used @@ -129,6 +132,7 @@ public: eClearUserVisibleDataItemsLocation = 1u << 3, eClearUserVisibleDataItemsDescription = 1u << 4, eClearUserVisibleDataItemsSyntheticChildren = 1u << 5, + eClearUserVisibleDataItemsValidator = 1u << 6, eClearUserVisibleDataItemsAllStrings = eClearUserVisibleDataItemsValue | eClearUserVisibleDataItemsSummary | eClearUserVisibleDataItemsLocation | eClearUserVisibleDataItemsDescription, eClearUserVisibleDataItemsAll = 0xFFFF }; @@ -268,12 +272,6 @@ public: m_mod_id = new_id; } - bool - IsFirstEvaluation () const - { - return m_first_update; - } - void SetNeedsUpdate () { @@ -322,7 +320,6 @@ public: ProcessModID m_mod_id; // This is the stop id when this ValueObject was last evaluated. ExecutionContextRef m_exe_ctx_ref; bool m_needs_update; - bool m_first_update; }; const EvaluationPoint & @@ -378,6 +375,9 @@ public: // this vends a TypeImpl that is useful at the SB API layer virtual TypeImpl GetTypeImpl (); + + virtual bool + CanProvideValue (); //------------------------------------------------------------------ // Subclasses must implement the functions below. @@ -607,6 +607,18 @@ public: GetSummaryAsCString (TypeSummaryImpl* summary_ptr, std::string& destination); + bool + GetSummaryAsCString (std::string& destination, + const TypeSummaryOptions& options); + + bool + GetSummaryAsCString (TypeSummaryImpl* summary_ptr, + std::string& destination, + const TypeSummaryOptions& options); + + std::pair<TypeValidatorResult, std::string> + GetValidationStatus (); + const char * GetObjectDescription (); @@ -700,6 +712,10 @@ public: virtual bool IsSynthetic() { return false; } + lldb::ValueObjectSP + GetQualifiedRepresentationIfAvailable (lldb::DynamicValueType dynValue, + bool synthValue); + virtual lldb::ValueObjectSP CreateConstantValue (const ConstString &name); @@ -752,6 +768,18 @@ public: return false; } + virtual bool + DoesProvideSyntheticValue () + { + return false; + } + + bool + IsSyntheticChildrenGenerated (); + + void + SetSyntheticChildrenGenerated (bool b); + virtual SymbolContextScope * GetSymbolContextScope(); @@ -768,11 +796,17 @@ public: const ExecutionContext& exe_ctx); static lldb::ValueObjectSP + CreateValueObjectFromExpression (const char* name, + const char* expression, + const ExecutionContext& exe_ctx, + const EvaluateExpressionOptions& options); + + static lldb::ValueObjectSP CreateValueObjectFromAddress (const char* name, uint64_t address, const ExecutionContext& exe_ctx, ClangASTType type); - + static lldb::ValueObjectSP CreateValueObjectFromData (const char* name, const DataExtractor& data, @@ -787,6 +821,9 @@ public: const DumpValueObjectOptions& options); + lldb::ValueObjectSP + Persist (); + // returns true if this is a char* or a char[] // if it is a char* and check_pointer is true, // it also checks that the pointer is valid @@ -794,7 +831,7 @@ public: IsCStringContainer (bool check_pointer = false); size_t - ReadPointedString (Stream& s, + ReadPointedString (lldb::DataBufferSP& buffer_sp, Error& error, uint32_t max_length = 0, bool honor_array = true, @@ -834,6 +871,10 @@ public: m_format = format; } + + virtual lldb::LanguageType + GetPreferredDisplayLanguage (); + lldb::TypeSummaryImplSP GetSummaryFormat() { @@ -848,6 +889,20 @@ public: ClearUserVisibleData(eClearUserVisibleDataItemsSummary); } + lldb::TypeValidatorImplSP + GetValidator() + { + UpdateFormatsIfNeeded(); + return m_type_validator_sp; + } + + void + SetValidator(lldb::TypeValidatorImplSP format) + { + m_type_validator_sp = format; + ClearUserVisibleData(eClearUserVisibleDataItemsValidator); + } + void SetValueFormat(lldb::TypeFormatImplSP format) { @@ -1018,7 +1073,9 @@ protected: std::string m_summary_str; // Cached summary string that will get cleared if/when the value is updated. std::string m_object_desc_str; // Cached result of the "object printer". This differs from the summary // in that the summary is consed up by us, the object_desc_string is builtin. - + + llvm::Optional<std::pair<TypeValidatorResult, std::string>> m_validation_result; + ClangASTType m_override_type;// If the type of the value object should be overridden, the type to impose. ValueObjectManager *m_manager; // This object is managed by the root object (any ValueObject that gets created @@ -1043,9 +1100,12 @@ protected: lldb::TypeSummaryImplSP m_type_summary_sp; lldb::TypeFormatImplSP m_type_format_sp; lldb::SyntheticChildrenSP m_synthetic_children_sp; + lldb::TypeValidatorImplSP m_type_validator_sp; ProcessModID m_user_id_of_forced_summary; AddressType m_address_type_of_ptr_or_ref_children; + llvm::SmallVector<uint8_t, 16> m_value_checksum; + bool m_value_is_valid:1, m_value_did_change:1, m_children_count_valid:1, @@ -1055,7 +1115,8 @@ protected: m_is_bitfield_for_scalar:1, m_is_child_at_offset:1, m_is_getting_summary:1, - m_did_calculate_complete_objc_class_type:1; + m_did_calculate_complete_objc_class_type:1, + m_is_synthetic_children_generated:1; friend class ClangExpressionDeclMap; // For GetValue friend class ClangExpressionVariable; // For SetName @@ -1150,6 +1211,9 @@ protected: GetLocationAsCStringImpl (const Value& value, const DataExtractor& data); + bool + IsChecksumEmpty (); + private: //------------------------------------------------------------------ // For ValueObject only diff --git a/include/lldb/Core/ValueObjectChild.h b/include/lldb/Core/ValueObjectChild.h index 07d1f294bd80..7bbfe8a662d1 100644 --- a/include/lldb/Core/ValueObjectChild.h +++ b/include/lldb/Core/ValueObjectChild.h @@ -106,6 +106,7 @@ protected: protected: friend class ValueObject; friend class ValueObjectConstResult; + friend class ValueObjectConstResultImpl; ValueObjectChild (ValueObject &parent, const ClangASTType &clang_type, const ConstString &name, diff --git a/include/lldb/Core/ValueObjectConstResult.h b/include/lldb/Core/ValueObjectConstResult.h index dd87fc848ae8..4e05d50132ec 100644 --- a/include/lldb/Core/ValueObjectConstResult.h +++ b/include/lldb/Core/ValueObjectConstResult.h @@ -59,7 +59,8 @@ public: static lldb::ValueObjectSP Create (ExecutionContextScope *exe_scope, Value &value, - const ConstString &name); + const ConstString &name, + Module* module = nullptr); // When an expression fails to evaluate, we return an error static lldb::ValueObjectSP @@ -126,6 +127,9 @@ public: virtual lldb::ValueObjectSP GetDynamicValue (lldb::DynamicValueType valueType); + + virtual lldb::LanguageType + GetPreferredDisplayLanguage (); protected: virtual bool @@ -169,7 +173,8 @@ private: ValueObjectConstResult (ExecutionContextScope *exe_scope, const Value &value, - const ConstString &name); + const ConstString &name, + Module* module = nullptr); ValueObjectConstResult (ExecutionContextScope *exe_scope, const Error& error); diff --git a/include/lldb/Core/ValueObjectConstResultImpl.h b/include/lldb/Core/ValueObjectConstResultImpl.h index 271b93823569..e3574e8a4d4e 100644 --- a/include/lldb/Core/ValueObjectConstResultImpl.h +++ b/include/lldb/Core/ValueObjectConstResultImpl.h @@ -47,13 +47,6 @@ public: lldb::ValueObjectSP AddressOf (Error &error); - bool - NeedsDerefOnTarget() - { - m_impl_backend->UpdateValueIfNeeded(false); - return (m_impl_backend->GetValue().GetValueType() == Value::eValueTypeHostAddress); - } - lldb::addr_t GetLiveAddress() { @@ -68,9 +61,6 @@ public: m_live_address_type = address_type; } - lldb::ValueObjectSP - DerefOnTarget(); - virtual lldb::addr_t GetAddressOf (bool scalar_is_load_address = true, AddressType *address_type = NULL); diff --git a/include/lldb/Core/ValueObjectSyntheticFilter.h b/include/lldb/Core/ValueObjectSyntheticFilter.h index e12698f49bb1..49c5601dc0e5 100644 --- a/include/lldb/Core/ValueObjectSyntheticFilter.h +++ b/include/lldb/Core/ValueObjectSyntheticFilter.h @@ -12,10 +12,10 @@ // C Includes // C++ Includes -#include <map> #include <vector> // Other libraries and framework includes // Project includes +#include "lldb/Core/ThreadSafeSTLMap.h" #include "lldb/Core/ValueObject.h" namespace lldb_private { @@ -132,11 +132,12 @@ public: GetNonSyntheticValue (); virtual bool - ResolveValue (Scalar &scalar) + CanProvideValue (); + + virtual bool + DoesProvideSyntheticValue () { - if (m_parent) - return m_parent->ResolveValue(scalar); - return false; + return (UpdateValueIfNeeded(), m_provides_value == eLazyBoolYes); } protected: @@ -153,8 +154,8 @@ protected: lldb::SyntheticChildrenSP m_synth_sp; std::unique_ptr<SyntheticChildrenFrontEnd> m_synth_filter_ap; - typedef std::map<uint32_t, ValueObject*> ByIndexMap; - typedef std::map<const char*, uint32_t> NameToIndexMap; + typedef ThreadSafeSTLMap<uint32_t, ValueObject*> ByIndexMap; + typedef ThreadSafeSTLMap<const char*, uint32_t> NameToIndexMap; typedef ByIndexMap::iterator ByIndexIterator; typedef NameToIndexMap::iterator NameToIndexIterator; @@ -167,12 +168,14 @@ protected: LazyBool m_might_have_children; + LazyBool m_provides_value; + private: friend class ValueObject; ValueObjectSynthetic (ValueObject &parent, lldb::SyntheticChildrenSP filter); void - CopyParentData (); + CopyValueData (ValueObject *source); //------------------------------------------------------------------ // For ValueObject only |