diff options
Diffstat (limited to 'include/lldb/Core')
38 files changed, 841 insertions, 163 deletions
diff --git a/include/lldb/Core/Address.h b/include/lldb/Core/Address.h index 322019395ae7..8dd2339f9207 100644 --- a/include/lldb/Core/Address.h +++ b/include/lldb/Core/Address.h @@ -230,7 +230,7 @@ public: /// offset based address, and \a style lets the user choose. /// /// @param[in] s - /// The stream to which to dump the object descripton. + /// The stream to which to dump the object description. /// /// @param[in] style /// The display style for the address. @@ -310,7 +310,7 @@ public: /// /// This function will first resolve its address to a load address. /// Then, if the address turns out to be in code address, return the - /// load address for a an opcode. This address object might have + /// load address for an opcode. This address object might have /// extra bits set (bit zero will be set to Thumb functions for an /// ARM target) that are required for changing the program counter /// and this function will remove any bits that are intended for @@ -362,7 +362,7 @@ public: /// offset (for absolute addresses that have no section). /// /// @return - /// Returns \b true if the the offset is valid, \b false + /// Returns \b true if the offset is valid, \b false /// otherwise. //------------------------------------------------------------------ bool diff --git a/include/lldb/Core/AddressRange.h b/include/lldb/Core/AddressRange.h index bd3ab2ab5da5..9d781f3e85ae 100644 --- a/include/lldb/Core/AddressRange.h +++ b/include/lldb/Core/AddressRange.h @@ -189,7 +189,7 @@ public: /// how the base address gets displayed. /// /// @param[in] s - /// The stream to which to dump the object descripton. + /// The stream to which to dump the object description. /// /// @param[in] style /// The display style for the address. @@ -215,7 +215,7 @@ public: /// and pointer values, reference counts, etc. /// /// @param[in] s - /// The stream to which to dump the object descripton. + /// The stream to which to dump the object description. //------------------------------------------------------------------ void DumpDebug (Stream *s) const; diff --git a/include/lldb/Core/ArchSpec.h b/include/lldb/Core/ArchSpec.h index 1ccb385783a0..255beee573b6 100644 --- a/include/lldb/Core/ArchSpec.h +++ b/include/lldb/Core/ArchSpec.h @@ -50,6 +50,7 @@ public: eCore_arm_armv7m, eCore_arm_armv7em, eCore_arm_xscale, + eCore_thumb, eCore_thumbv4t, eCore_thumbv5, @@ -57,11 +58,14 @@ public: eCore_thumbv6, eCore_thumbv6m, eCore_thumbv7, - eCore_thumbv7f, eCore_thumbv7s, eCore_thumbv7k, + eCore_thumbv7f, eCore_thumbv7m, eCore_thumbv7em, + eCore_arm_arm64, + eCore_arm_armv8, + eCore_arm_aarch64, eCore_mips64, @@ -89,6 +93,7 @@ public: eCore_x86_32_i386, eCore_x86_32_i486, eCore_x86_32_i486sx, + eCore_x86_32_i686, eCore_x86_64_x86_64, eCore_x86_64_x86_64h, // Haswell enabled x86_64 @@ -98,6 +103,12 @@ public: eCore_uknownMach32, eCore_uknownMach64, + + eCore_kalimba, + eCore_kalimba3, + eCore_kalimba4, + eCore_kalimba5, + kNumCores, kCore_invalid, @@ -107,6 +118,7 @@ public: kCore_ppc_any, kCore_ppc64_any, kCore_x86_32_any, + kCore_x86_64_any, kCore_hexagon_any, kCore_arm_first = eCore_arm_generic, @@ -122,10 +134,16 @@ public: kCore_ppc64_last = eCore_ppc64_ppc970_64, kCore_x86_32_first = eCore_x86_32_i386, - kCore_x86_32_last = eCore_x86_32_i486sx, + kCore_x86_32_last = eCore_x86_32_i686, + + kCore_x86_64_first = eCore_x86_64_x86_64, + kCore_x86_64_last = eCore_x86_64_x86_64h, kCore_hexagon_first = eCore_hexagon_generic, - kCore_hexagon_last = eCore_hexagon_hexagonv5 + kCore_hexagon_last = eCore_hexagon_hexagonv5, + + kCore_kalimba_first = eCore_kalimba, + kCore_kalimba_last = eCore_kalimba5 }; //------------------------------------------------------------------ @@ -228,7 +246,7 @@ public: /// /// This will be something like "ubuntu", "fedora", etc. on Linux. /// This should be the same value returned by - /// Host::GetDistributionId (). + /// HostInfo::GetDistributionId (). ///------------------------------------------------------------------ void SetDistributionId (const char* distribution_id); @@ -302,7 +320,7 @@ public: /// /// @param[in] cpu The required CPU type. /// - /// @return True if the object and CPU type were sucessfully set. + /// @return True if the object and CPU type were successfully set. //------------------------------------------------------------------ bool SetArchitecture (ArchitectureType arch_type, @@ -351,6 +369,24 @@ public: GetMachOCPUSubType () const; //------------------------------------------------------------------ + /// Architecture data byte width accessor + /// + /// @return the size in 8-bit (host) bytes of a minimum addressable + /// unit from the Architecture's data bus + //------------------------------------------------------------------ + uint32_t + GetDataByteSize() const; + + //------------------------------------------------------------------ + /// Architecture code byte width accessor + /// + /// @return the size in 8-bit (host) bytes of a minimum addressable + /// unit from the Architecture's code bus + //------------------------------------------------------------------ + uint32_t + GetCodeByteSize() const; + + //------------------------------------------------------------------ /// Architecture tripple accessor. /// /// @return A triple describing this ArchSpec. diff --git a/include/lldb/Core/ClangForward.h b/include/lldb/Core/ClangForward.h index 0b3f13a16602..ef7308d25f7f 100644 --- a/include/lldb/Core/ClangForward.h +++ b/include/lldb/Core/ClangForward.h @@ -58,6 +58,7 @@ namespace clang class DiagnosticsEngine; class DiagnosticOptions; class EnumDecl; + class EnumConstantDecl; class Expr; class ExternalASTSource; class ExtVectorElementExpr; diff --git a/include/lldb/Core/Communication.h b/include/lldb/Core/Communication.h index 2dde55044171..7e8209d7d9c6 100644 --- a/include/lldb/Core/Communication.h +++ b/include/lldb/Core/Communication.h @@ -59,7 +59,7 @@ namespace lldb_private { /// /// bool Communication::StartReadThread (Error *); /// -/// If true is returned a read thead has been spawned that will +/// If true is returned a read thread has been spawned that will /// continually execute a call to the pure virtual DoRead function: /// /// size_t Communication::ReadFromConnection (void *, size_t, uint32_t); @@ -300,7 +300,7 @@ public: //------------------------------------------------------------------ /// The static read thread function. This function will call /// the "DoRead" function continuously and wait for data to become - /// avaialble. When data is received it will append the available + /// available. When data is received it will append the available /// data to the internal cache and broadcast a /// \b eBroadcastBitReadThreadGotBytes event. /// diff --git a/include/lldb/Core/ConnectionFileDescriptor.h b/include/lldb/Core/ConnectionFileDescriptor.h index 15598c9b1335..75d0202fcf6c 100644 --- a/include/lldb/Core/ConnectionFileDescriptor.h +++ b/include/lldb/Core/ConnectionFileDescriptor.h @@ -10,24 +10,23 @@ #ifndef liblldb_ConnectionFileDescriptor_h_ #define liblldb_ConnectionFileDescriptor_h_ -// C Includes -#ifndef _WIN32 -#include <sys/socket.h> -#include <sys/types.h> -#include <netinet/in.h> -#endif - // 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 : @@ -64,81 +63,52 @@ public: lldb::ConnectionStatus &status, Error *error_ptr); - // If the read file descriptor is a socket, then return - // the port number that is being used by the socket. - uint16_t - GetReadPort () const; - - // If the write file descriptor is a socket, then return - // the port number that is being used by the socket. - uint16_t - GetWritePort () const; + lldb::ConnectionStatus + BytesAvailable (uint32_t timeout_usec, Error *error_ptr); - uint16_t - GetBoundPort (uint32_t timeout_sec); + bool + InterruptRead (); -protected: + lldb::IOObjectSP GetReadObject() { return m_read_sp; } + const lldb::IOObjectSP GetReadObject() const { return m_read_sp; } - typedef enum - { - eFDTypeFile, // Other FD requireing read/write - eFDTypeSocket, // Socket requiring send/recv - eFDTypeSocketUDP // Unconnected UDP socket requiring sendto/recvfrom - } FDType; + uint16_t GetListeningPort(uint32_t timeout_sec); + +protected: void OpenCommandPipe (); void CloseCommandPipe (); - - lldb::ConnectionStatus - BytesAvailable (uint32_t timeout_usec, Error *error_ptr); 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 - NamedSocketAccept (const char *socket_name, Error *error_ptr); - - lldb::ConnectionStatus NamedSocketConnect (const char *socket_name, Error *error_ptr); - + lldb::ConnectionStatus - Close (int& fd, FDType type, Error *error); - - int m_fd_send; - int m_fd_recv; - FDType m_fd_send_type; - FDType m_fd_recv_type; - std::unique_ptr<SocketAddress> m_udp_send_sockaddr; - uint32_t m_socket_timeout_usec; - int m_pipe_read; // A pipe that we select on the reading end of along with - int m_pipe_write; // m_fd_recv so we can force ourselves out of the select. - Mutex m_mutex; - 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 - bool m_should_close_fd; // True if this class should close the file descriptor when it goes away. - 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. + NamedSocketAccept (const char *socket_name, Error *error_ptr); - static uint16_t - GetSocketPort (int fd); - - static int - GetSocketOption(int fd, int level, int option_name, int &option_value); + lldb::IOObjectSP m_read_sp; + lldb::IOObjectSP m_write_sp; - static int - SetSocketOption(int fd, int level, int option_name, int option_value); - - bool - SetSocketReceiveTimeout (uint32_t timeout_usec); + 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); }; diff --git a/include/lldb/Core/ConstString.h b/include/lldb/Core/ConstString.h index 684cc8f921ed..cfa237c46862 100644 --- a/include/lldb/Core/ConstString.h +++ b/include/lldb/Core/ConstString.h @@ -303,7 +303,7 @@ public: /// returns an integer result. /// /// NOTE: only call this function when you want a true string - /// comparision. If you want string equality use the, use the == + /// comparison. If you want string equality use the, use the == /// operator as it is much more efficient. Also if you want string /// inequality, use the != operator for the same reasons. /// @@ -383,7 +383,7 @@ public: //------------------------------------------------------------------ /// Set the C string value and its mangled counterpart. /// - /// Object files and debug sybmols often use mangled string to + /// Object files and debug symbols often use mangled string to /// represent the linkage name for a symbol, function or global. /// The string pool can efficiently store these values and their /// counterparts so when we run into another instance of a mangled @@ -406,7 +406,7 @@ public: /// Retrieve the mangled or demangled counterpart for a mangled /// or demangled ConstString. /// - /// Object files and debug sybmols often use mangled string to + /// Object files and debug symbols often use mangled string to /// represent the linkage name for a symbol, function or global. /// The string pool can efficiently store these values and their /// counterparts so when we run into another instance of a mangled @@ -478,7 +478,7 @@ public: //------------------------------------------------------------------ /// Get the size in bytes of the current global string pool. /// - /// Reports the the size in bytes of all shared C string values, + /// Reports the size in bytes of all shared C string values, /// containers and any other values as a byte size for the /// entire string pool. /// diff --git a/include/lldb/Core/DataBuffer.h b/include/lldb/Core/DataBuffer.h index e64245dead3d..64e2a8857837 100644 --- a/include/lldb/Core/DataBuffer.h +++ b/include/lldb/Core/DataBuffer.h @@ -20,7 +20,7 @@ namespace lldb_private { /// @class DataBuffer DataBuffer.h "lldb/Core/DataBuffer.h" /// @brief A pure virtual protocol class for abstracted data buffers. /// -/// DataBuffer is an abtract class that gets packaged into a shared pointer +/// DataBuffer is an abstract class that gets packaged into a shared pointer /// that can use to implement various ways to store data (on the heap, /// memory mapped, cached inferior memory). It gets used by DataExtractor /// so many DataExtractor objects can share the same data and sub-ranges diff --git a/include/lldb/Core/DataBufferHeap.h b/include/lldb/Core/DataBufferHeap.h index dac9a28befb9..ad73fabe5f1e 100644 --- a/include/lldb/Core/DataBufferHeap.h +++ b/include/lldb/Core/DataBufferHeap.h @@ -122,6 +122,9 @@ public: CopyData (const void *src, lldb::offset_t src_len); void + AppendData (const void *src, uint64_t src_len); + + void Clear(); private: diff --git a/include/lldb/Core/DataBufferMemoryMap.h b/include/lldb/Core/DataBufferMemoryMap.h index d4a448a5df52..944b975a318a 100644 --- a/include/lldb/Core/DataBufferMemoryMap.h +++ b/include/lldb/Core/DataBufferMemoryMap.h @@ -100,7 +100,12 @@ public: /// @param[in] length /// The size in bytes that should be mapped starting \a offset /// bytes into the file. If \a length is \c SIZE_MAX, map - /// as many bytes as possible. + /// as many bytes as possible. Even though it may be possible + /// for a 32-bit host debugger to debug a 64-bit target, size_t + /// still dictates the maximum possible size that can be mapped + /// into this process. For this kind of cross-arch debugging + /// scenario, mappings and views should be managed at a higher + /// level. /// /// @return /// The number of bytes mapped starting from the \a offset. @@ -108,7 +113,7 @@ public: size_t MemoryMapFromFileSpec (const FileSpec* file, lldb::offset_t offset = 0, - lldb::offset_t length = SIZE_MAX, + size_t length = SIZE_MAX, bool writeable = false); //------------------------------------------------------------------ @@ -137,7 +142,7 @@ public: size_t MemoryMapFromFileDescriptor (int fd, lldb::offset_t offset, - lldb::offset_t length, + size_t length, bool write, bool fd_is_file); diff --git a/include/lldb/Core/DataEncoder.h b/include/lldb/Core/DataEncoder.h index 658cce0d2b4b..7cd5d6808152 100644 --- a/include/lldb/Core/DataEncoder.h +++ b/include/lldb/Core/DataEncoder.h @@ -173,7 +173,7 @@ public: } //------------------------------------------------------------------ - /// Get a the data start pointer. + /// Get the data start pointer. /// /// @return /// Returns a pointer to the first byte contained in this @@ -234,7 +234,7 @@ public: /// The size in byte of the integer to encode. /// /// @param[in] value - /// The integer value to write. The least significate bytes of + /// The integer value to write. The least significant bytes of /// the integer value will be written if the size is less than /// 8 bytes. /// @@ -253,7 +253,7 @@ public: /// start encoding. /// /// @param[int] src - /// The buffer that contains the the bytes to encode. + /// The buffer that contains the bytes to encode. /// /// @param[in] src_len /// The number of bytes to encode. diff --git a/include/lldb/Core/Debugger.h b/include/lldb/Core/Debugger.h index e80ec8516793..7ab62e5b7f3a 100644 --- a/include/lldb/Core/Debugger.h +++ b/include/lldb/Core/Debugger.h @@ -31,6 +31,14 @@ #include "lldb/Target/Platform.h" #include "lldb/Target/TargetList.h" +namespace llvm +{ +namespace sys +{ +class DynamicLibrary; +} +} + namespace lldb_private { //---------------------------------------------------------------------- @@ -51,9 +59,9 @@ friend class SourceManager; // For GetSourceFileCache. public: - typedef lldb::DynamicLibrarySP (*LoadPluginCallbackType) (const lldb::DebuggerSP &debugger_sp, - const FileSpec& spec, - Error& error); + typedef llvm::sys::DynamicLibrary (*LoadPluginCallbackType) (const lldb::DebuggerSP &debugger_sp, + const FileSpec& spec, + Error& error); static lldb::DebuggerSP CreateInstance (lldb::LogOutputCallback log_callback = NULL, void *baton = NULL); @@ -352,6 +360,13 @@ public: void CancelForwardEvents (const lldb::ListenerSP &listener_sp); + + bool + IsHandlingEvents () const + { + return IS_VALID_LLDB_HOST_THREAD(m_event_handler_thread); + } + protected: friend class CommandInterpreter; @@ -415,12 +430,11 @@ protected: lldb::StreamSP m_log_callback_stream_sp; ConstString m_instance_name; static LoadPluginCallbackType g_load_plugin_callback; - typedef std::vector<lldb::DynamicLibrarySP> LoadedPluginsList; + 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; lldb::ListenerSP m_forward_listener_sp; - bool m_event_handler_thread_alive; void InstanceInitialize (); diff --git a/include/lldb/Core/EmulateInstruction.h b/include/lldb/Core/EmulateInstruction.h index 19a3269ae374..774d80968ff9 100644 --- a/include/lldb/Core/EmulateInstruction.h +++ b/include/lldb/Core/EmulateInstruction.h @@ -94,7 +94,7 @@ public: enum ContextType { eContextInvalid = 0, - // Read an instruciton opcode from memory + // Read an instruction opcode from memory eContextReadOpcode, // Usually used for writing a register value whose source value is an @@ -223,13 +223,13 @@ public: struct ISAAndImmediate { uint32_t isa; - uint32_t unsigned_data32; // immdiate data + uint32_t unsigned_data32; // immediate data } ISAAndImmediate; struct ISAAndImmediateSigned { uint32_t isa; - int32_t signed_data32; // signed immdiate data + int32_t signed_data32; // signed immediate data } ISAAndImmediateSigned; uint32_t isa; @@ -409,7 +409,7 @@ public: TestEmulation (Stream *out_stream, ArchSpec &arch, OptionValueDictionary *test_data) = 0; virtual bool - GetRegisterInfo (uint32_t reg_kind, uint32_t reg_num, RegisterInfo ®_info) = 0; + GetRegisterInfo (lldb::RegisterKind reg_kind, uint32_t reg_num, RegisterInfo ®_info) = 0; //---------------------------------------------------------------------- // Optional overrides @@ -421,7 +421,7 @@ public: CreateFunctionEntryUnwind (UnwindPlan &unwind_plan); static const char * - TranslateRegister (uint32_t reg_kind, uint32_t reg_num, std::string ®_name); + TranslateRegister (lldb::RegisterKind reg_kind, uint32_t reg_num, std::string ®_name); //---------------------------------------------------------------------- // RegisterInfo variants @@ -449,25 +449,25 @@ public: // Register kind and number variants //---------------------------------------------------------------------- bool - ReadRegister (uint32_t reg_kind, + ReadRegister (lldb::RegisterKind reg_kind, uint32_t reg_num, RegisterValue& reg_value); bool WriteRegister (const Context &context, - uint32_t reg_kind, + lldb::RegisterKind reg_kind, uint32_t reg_num, const RegisterValue& reg_value); uint64_t - ReadRegisterUnsigned (uint32_t reg_kind, + ReadRegisterUnsigned (lldb::RegisterKind reg_kind, uint32_t reg_num, uint64_t fail_value, bool *success_ptr); bool WriteRegisterUnsigned (const Context &context, - uint32_t reg_kind, + lldb::RegisterKind reg_kind, uint32_t reg_num, uint64_t reg_value); @@ -611,7 +611,7 @@ public: static bool GetBestRegisterKindAndNumber (const RegisterInfo *reg_info, - uint32_t ®_kind, + lldb::RegisterKind ®_kind, uint32_t ®_num); static uint32_t diff --git a/include/lldb/Core/Error.h b/include/lldb/Core/Error.h index 39c67f621c92..a1687689fc3f 100644 --- a/include/lldb/Core/Error.h +++ b/include/lldb/Core/Error.h @@ -209,6 +209,13 @@ public: void SetMachError (uint32_t err); + + void + SetExpressionError (lldb::ExpressionResults, const char *mssg); + + int + SetExpressionErrorWithFormat (lldb::ExpressionResults, const char *format, ...) __attribute__ ((format (printf, 3,4))); + //------------------------------------------------------------------ /// Set accesssor with an error value and type. /// @@ -301,7 +308,7 @@ protected: /// Member variables //------------------------------------------------------------------ ValueType m_code; ///< Error code as an integer value. - lldb::ErrorType m_type; ///< The type of the above error code. + lldb::ErrorType m_type; ///< The type of the above error code. mutable std::string m_string; ///< A string representation of the error code. }; diff --git a/include/lldb/Core/IOHandler.h b/include/lldb/Core/IOHandler.h index 78d1e7447db4..f477ebd48007 100644 --- a/include/lldb/Core/IOHandler.h +++ b/include/lldb/Core/IOHandler.h @@ -73,7 +73,7 @@ namespace lldb_private { // Called when CTRL+C is pressed which usually causes // Debugger::DispatchInputInterrupt to be called. - virtual void + virtual bool Interrupt () = 0; virtual void @@ -191,7 +191,7 @@ namespace lldb_private { /// /// This will return true if the input stream is a terminal (tty or /// pty) and can cause IO handlers to do different things (like - /// for a comfirmation when deleting all breakpoints). + /// for a confirmation when deleting all breakpoints). //------------------------------------------------------------------ bool GetIsInteractive (); @@ -200,9 +200,9 @@ namespace lldb_private { /// Check if the input is coming from a real terminal. /// /// A real terminal has a valid size with a certain number of rows - /// and colums. If this function returns true, then terminal escape + /// and columns. If this function returns true, then terminal escape /// sequences are expected to work (cursor movement escape sequences, - /// clearning lines, etc). + /// clearing lines, etc). //------------------------------------------------------------------ bool GetIsRealTerminal (); @@ -267,7 +267,7 @@ namespace lldb_private { //------------------------------------------------------------------ /// Called when a line or lines have been retrieved. /// - /// This funtion can handle the current line and possibly call + /// This function can handle the current line and possibly call /// IOHandler::SetIsDone(true) when the IO handler is done like when /// "quit" is entered as a command, of when an empty line is /// received. It is up to the delegate to determine when a line @@ -304,11 +304,22 @@ namespace lldb_private { virtual ConstString - GetControlSequence (char ch) + IOHandlerGetControlSequence (char ch) { return ConstString(); } + //------------------------------------------------------------------ + // Intercept the IOHandler::Interrupt() calls and do something. + // + // Return true if the interrupt was handled, false if the IOHandler + // should continue to try handle the interrupt itself. + //------------------------------------------------------------------ + virtual bool + IOHandlerInterrupt (IOHandler &io_handler) + { + return false; + } protected: Completion m_completion; // Support for common builtin completions bool m_io_handler_done; @@ -338,7 +349,7 @@ namespace lldb_private { } virtual ConstString - GetControlSequence (char ch) + IOHandlerGetControlSequence (char ch) { if (ch == 'd') return ConstString (m_end_line + "\n"); @@ -364,7 +375,9 @@ namespace lldb_private { // 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 LineStatus::Success; } @@ -380,6 +393,7 @@ namespace lldb_private { const char *editline_name, // Used for saving history files const char *prompt, bool multi_line, + uint32_t line_number_start, // If non-zero show line numbers starting at 'line_number_start' IOHandlerDelegate &delegate); IOHandlerEditline (Debugger &debugger, @@ -390,6 +404,7 @@ namespace lldb_private { const char *editline_name, // Used for saving history files const char *prompt, bool multi_line, + uint32_t line_number_start, // If non-zero show line numbers starting at 'line_number_start' IOHandlerDelegate &delegate); virtual @@ -407,7 +422,7 @@ namespace lldb_private { virtual void Cancel (); - virtual void + virtual bool Interrupt (); virtual void @@ -423,7 +438,7 @@ namespace lldb_private { virtual ConstString GetControlSequence (char ch) { - return m_delegate.GetControlSequence (ch); + return m_delegate.IOHandlerGetControlSequence (ch); } virtual const char * @@ -433,11 +448,14 @@ namespace lldb_private { SetPrompt (const char *prompt); bool - GetLine (std::string &line); + GetLine (std::string &line, bool &interrupted); bool - GetLines (StringList &lines); - + GetLines (StringList &lines, bool &interrupted); + + void + SetBaseLineNumber (uint32_t line); + private: static LineStatus LineCompletedCallback (Editline *editline, @@ -458,6 +476,7 @@ namespace lldb_private { std::unique_ptr<Editline> m_editline_ap; IOHandlerDelegate &m_delegate; std::string m_prompt; + uint32_t m_base_line_number; // If non-zero, then show line numbers in prompt bool m_multi_line; }; @@ -517,7 +536,7 @@ namespace lldb_private { virtual void Cancel (); - virtual void + virtual bool Interrupt (); virtual void @@ -551,8 +570,8 @@ namespace lldb_private { virtual void Refresh (); - virtual void - Interrupt (); + virtual bool + HandleInterrupt (); virtual void GotEOF(); diff --git a/include/lldb/Core/Listener.h b/include/lldb/Core/Listener.h index a12a65d705db..2dbd2eb436ce 100644 --- a/include/lldb/Core/Listener.h +++ b/include/lldb/Core/Listener.h @@ -76,7 +76,7 @@ public: StopListeningForEvents (Broadcaster* broadcaster, uint32_t event_mask); - // Returns true if an event was recieved, false if we timed out. + // Returns true if an event was received, false if we timed out. bool WaitForEvent (const TimeValue *timeout, lldb::EventSP &event_sp); diff --git a/include/lldb/Core/Mangled.h b/include/lldb/Core/Mangled.h index 8732dc00270c..7dc0eca3e8db 100644 --- a/include/lldb/Core/Mangled.h +++ b/include/lldb/Core/Mangled.h @@ -153,7 +153,7 @@ public: /// demangled name to be computed currently (we don't use the accessor). /// /// @param[in] s - /// The stream to which to dump the object descripton. + /// The stream to which to dump the object description. //---------------------------------------------------------------------- void Dump (Stream *s) const; @@ -162,7 +162,7 @@ public: /// Dump a debug description of this object to a Stream \a s. /// /// @param[in] s - /// The stream to which to dump the object descripton. + /// The stream to which to dump the object description. //---------------------------------------------------------------------- void DumpDebug (Stream *s) const; @@ -219,7 +219,7 @@ public: /// Which name would you prefer to get? /// /// @return - /// A const reference to the the preferred name string object if this + /// A const reference to the preferred name string object if this /// object has a valid name of that kind, else a const reference to the /// other name is returned. //---------------------------------------------------------------------- diff --git a/include/lldb/Core/Module.h b/include/lldb/Core/Module.h index 56650582791b..bfde7cbc5db9 100644 --- a/include/lldb/Core/Module.h +++ b/include/lldb/Core/Module.h @@ -68,7 +68,7 @@ public: /// use ModuleList::GetSharedModule(). /// /// @param[in] file_spec - /// The file specification for the on disk repesentation of + /// The file specification for the on disk representation of /// this executable image. /// /// @param[in] arch @@ -88,10 +88,14 @@ public: Module (const FileSpec& file_spec, const ArchSpec& arch, const ConstString *object_name = NULL, - off_t object_offset = 0, + lldb::offset_t object_offset = 0, const TimeValue *object_mod_time_ptr = NULL); Module (const ModuleSpec &module_spec); + + static lldb::ModuleSP + CreateJITModule (const lldb::ObjectFileJITDelegateSP &delegate_sp); + //------------------------------------------------------------------ /// Destructor. //------------------------------------------------------------------ @@ -193,7 +197,7 @@ public: /// in a module. /// /// @param[in] s - /// The stream to which to dump the object descripton. + /// The stream to which to dump the object description. //------------------------------------------------------------------ void Dump (Stream *s); @@ -415,7 +419,7 @@ public: VariableList& variable_list); //------------------------------------------------------------------ - /// Find global and static variables by regular exression. + /// Find global and static variables by regular expression. /// /// @param[in] regex /// A regular expression to use when matching the name. @@ -468,11 +472,11 @@ public: /// /// @param[in] type_name /// The name of the type we are looking for that is a fully - /// or partially qualfieid type name. + /// or partially qualified type name. /// /// @param[in] exact_match - /// If \b true, \a type_name is fully qualifed and must match - /// exactly. If \b false, \a type_name is a partially qualfied + /// If \b true, \a type_name is fully qualified and must match + /// exactly. If \b false, \a type_name is a partially qualified /// name where the leading namespaces or classes can be /// omitted to make finding types that a user may type /// easier. @@ -700,14 +704,40 @@ public: virtual SectionList * GetSectionList (); + //------------------------------------------------------------------ + /// Notify the module that the file addresses for the Sections have + /// been updated. + /// + /// If the Section file addresses for a module are updated, this + /// method should be called. Any parts of the module, object file, + /// or symbol file that has cached those file addresses must invalidate + /// or update its cache. + //------------------------------------------------------------------ + virtual void + SectionFileAddressesChanged (); + uint32_t GetVersion (uint32_t *versions, uint32_t num_versions); - // Load an object file from memory. + //------------------------------------------------------------------ + /// Load an object file from memory. + /// + /// If available, the size of the object file in memory may be + /// passed to avoid additional round trips to process memory. + /// If the size is not provided, a default value is used. This + /// value should be large enough to enable the ObjectFile plugins + /// to read the header of the object file without going back to the + /// process. + /// + /// @return + /// The object file loaded from memory or NULL, if the operation + /// failed (see the `error` for more information in that case). + //------------------------------------------------------------------ ObjectFile * GetMemoryObjectFile (const lldb::ProcessSP &process_sp, lldb::addr_t header_addr, - Error &error); + Error &error, + size_t size_to_read = 512); //------------------------------------------------------------------ /// Get the symbol vendor interface for the current architecture. /// @@ -755,12 +785,12 @@ public: /// A debugging function that will cause everything in a module to /// be parsed. /// - /// All compile units will be pasred, along with all globals and + /// All compile units will be parsed, along with all globals and /// static variables and all functions for those compile units. /// All types, scopes, local variables, static variables, global /// variables, and line tables will be parsed. This can be used /// prior to dumping a module to see a complete list of the - /// resuling debug information that gets parsed, or as a debug + /// resulting debug information that gets parsed, or as a debug /// function to ensure that the module can consume all of the /// debug data the symbol vendor provides. //------------------------------------------------------------------ @@ -948,7 +978,7 @@ public: //------------------------------------------------------------------ // Return true if the file backing this module has changed since the - // module was originally created since we saved the intial file + // module was originally created since we saved the initial file // modification time when the module first gets created. //------------------------------------------------------------------ bool @@ -1156,7 +1186,9 @@ protected: friend class SymbolFile; private: - + + Module (); // Only used internally by CreateJITModule () + size_t FindTypes_Impl (const SymbolContext& sc, const ConstString &name, diff --git a/include/lldb/Core/ModuleList.h b/include/lldb/Core/ModuleList.h index f03f79fb00ce..c3074d4d6510 100644 --- a/include/lldb/Core/ModuleList.h +++ b/include/lldb/Core/ModuleList.h @@ -15,6 +15,7 @@ #include "lldb/lldb-private.h" #include "lldb/Host/Mutex.h" +#include "lldb/Utility/Iterable.h" namespace lldb_private { @@ -137,7 +138,7 @@ public: /// /// Clears the list of modules and releases a reference to each /// module object and if the reference count goes to zero, the - /// module will be deleted. Also relese all memory that might be + /// module will be deleted. Also release all memory that might be /// held by any collection classes (like std::vector) //------------------------------------------------------------------ void @@ -149,7 +150,7 @@ public: /// the supplied stream \a s. /// /// @param[in] s - /// The stream to which to dump the object descripton. + /// The stream to which to dump the object description. /// /// @see Module::Dump(Stream *) const //------------------------------------------------------------------ @@ -307,7 +308,7 @@ public: VariableList& variable_list) const; //------------------------------------------------------------------ - /// Find global and static variables by regular exression. + /// Find global and static variables by regular expression. /// /// @param[in] regex /// A regular expression to use when matching the name. @@ -577,6 +578,14 @@ protected: Notifier* m_notifier; +public: + typedef LockingAdaptedIterable<collection, lldb::ModuleSP, vector_adapter> ModuleIterable; + ModuleIterable + Modules() + { + return ModuleIterable(m_modules, GetMutex()); + } + }; } // namespace lldb_private diff --git a/include/lldb/Core/ModuleSpec.h b/include/lldb/Core/ModuleSpec.h index dfeb7b73ca37..195fd991f8de 100644 --- a/include/lldb/Core/ModuleSpec.h +++ b/include/lldb/Core/ModuleSpec.h @@ -370,7 +370,6 @@ public: if (dumped_something) strm.PutCString(", "); strm.Printf("object_mod_time = 0x%" PRIx64, m_object_mod_time.GetAsSecondsSinceJan1_1970()); - dumped_something = true; } } @@ -387,14 +386,15 @@ public: if (!FileSpec::Equal(fspec, GetFileSpec(), fspec.GetDirectory().IsEmpty() == false)) return false; } - if (match_module_spec.GetPlatformFileSpecPtr()) + if (GetPlatformFileSpec() && match_module_spec.GetPlatformFileSpecPtr()) { const FileSpec &fspec = match_module_spec.GetPlatformFileSpec(); if (!FileSpec::Equal(fspec, GetPlatformFileSpec(), fspec.GetDirectory().IsEmpty() == false)) return false; } - if (match_module_spec.GetSymbolFileSpecPtr()) + // Only match the symbol file spec if there is one in this ModuleSpec + if (GetSymbolFileSpec() && match_module_spec.GetSymbolFileSpecPtr()) { const FileSpec &fspec = match_module_spec.GetSymbolFileSpec(); if (!FileSpec::Equal(fspec, GetSymbolFileSpec(), fspec.GetDirectory().IsEmpty() == false)) diff --git a/include/lldb/Core/PluginManager.h b/include/lldb/Core/PluginManager.h index e02f43f4fa8b..a2ac67bf9f25 100644 --- a/include/lldb/Core/PluginManager.h +++ b/include/lldb/Core/PluginManager.h @@ -80,6 +80,24 @@ public: GetDynamicLoaderCreateCallbackForPluginName (const ConstString &name); //------------------------------------------------------------------ + // JITLoader + //------------------------------------------------------------------ + static bool + RegisterPlugin (const ConstString &name, + const char *description, + JITLoaderCreateInstance create_callback, + DebuggerInitializeCallback debugger_init_callback = NULL); + + static bool + UnregisterPlugin (JITLoaderCreateInstance create_callback); + + static JITLoaderCreateInstance + GetJITLoaderCreateCallbackAtIndex (uint32_t idx); + + static JITLoaderCreateInstance + GetJITLoaderCreateCallbackForPluginName (const ConstString &name); + + //------------------------------------------------------------------ // EmulateInstruction //------------------------------------------------------------------ static bool @@ -157,7 +175,8 @@ public: const char *description, ObjectFileCreateInstance create_callback, ObjectFileCreateMemoryInstance create_memory_callback, - ObjectFileGetModuleSpecifications get_module_specifications); + ObjectFileGetModuleSpecifications get_module_specifications, + ObjectFileSaveCore save_core = NULL); static bool UnregisterPlugin (ObjectFileCreateInstance create_callback); @@ -177,6 +196,8 @@ public: static ObjectFileCreateMemoryInstance GetObjectFileCreateMemoryCallbackForPluginName (const ConstString &name); + static Error + SaveCore (const lldb::ProcessSP &process_sp, const FileSpec &outfile); //------------------------------------------------------------------ // ObjectContainer diff --git a/include/lldb/Core/RegisterValue.h b/include/lldb/Core/RegisterValue.h index cf29cea46d36..1b1a71a11c5a 100644 --- a/include/lldb/Core/RegisterValue.h +++ b/include/lldb/Core/RegisterValue.h @@ -374,6 +374,12 @@ namespace lldb_private { uint32_t GetByteSize () const; + static uint32_t + GetMaxByteSize () + { + return kMaxRegisterByteSize; + } + void Clear(); diff --git a/include/lldb/Core/RegularExpression.h b/include/lldb/Core/RegularExpression.h index c116d439b94a..8e36811fa750 100644 --- a/include/lldb/Core/RegularExpression.h +++ b/include/lldb/Core/RegularExpression.h @@ -119,7 +119,7 @@ public: RegularExpression (); //------------------------------------------------------------------ - /// Constructor that takes a regulare expression with flags. + /// Constructor that takes a regular expression with flags. /// /// Constructor that compiles \a re using \a flags and stores the /// resulting compiled regular expression into this object. @@ -129,7 +129,7 @@ public: /// compile. /// /// @param[in] flags - /// Flags that are passed the the \c regcomp() function. + /// Flags that are passed to the \c regcomp() function. //------------------------------------------------------------------ explicit RegularExpression (const char* re, int flags); @@ -141,7 +141,7 @@ public: //------------------------------------------------------------------ /// Destructor. /// - /// Any previosuly compiled regular expression contained in this + /// Any previously compiled regular expression contained in this /// object will be freed. //------------------------------------------------------------------ ~RegularExpression (); @@ -154,10 +154,10 @@ public: /// Compile a regular expression. /// /// Compile a regular expression using the supplied regular - /// expression text and flags. The compied regular expression lives + /// expression text and flags. The compiled regular expression lives /// in this object so that it can be readily used for regular /// expression matches. Execute() can be called after the regular - /// expression is compiled. Any previosuly compiled regular + /// expression is compiled. Any previously compiled regular /// expression contained in this object will be freed. /// /// @param[in] re @@ -165,7 +165,7 @@ public: /// expression to compile. /// /// @param[in] flags - /// Flags that are passed the the \c regcomp() function. + /// Flags that are passed to the \c regcomp() function. /// /// @return /// \b true if the regular expression compiles successfully, diff --git a/include/lldb/Core/Section.h b/include/lldb/Core/Section.h index 437eaf59b9c4..32dac5f35b84 100644 --- a/include/lldb/Core/Section.h +++ b/include/lldb/Core/Section.h @@ -119,6 +119,7 @@ public: lldb::addr_t vm_size, lldb::offset_t file_offset, lldb::offset_t file_size, + uint32_t log2align, uint32_t flags); // Create a section that is a child of parent_section_sp @@ -132,6 +133,7 @@ public: lldb::addr_t vm_size, lldb::offset_t file_offset, lldb::offset_t file_size, + uint32_t log2align, uint32_t flags); ~Section (); @@ -284,6 +286,17 @@ public: return m_obj_file; } + uint32_t GetLog2Align() + { + return m_log2align; + } + + void + SetLog2Align(uint32_t align) + { + m_log2align = align; + } + protected: @@ -296,6 +309,7 @@ protected: lldb::addr_t m_byte_size; // Size in bytes that this section will occupy in memory at runtime lldb::offset_t m_file_offset; // Object file offset (if any) lldb::offset_t m_file_size; // Object file size (can be smaller than m_byte_size for zero filled sections...) + uint32_t m_log2align; // log_2(align) of the section (i.e. section has to be aligned to 2^m_log2align) SectionList m_children; // Child sections bool m_fake:1, // If true, then this section only can contain the address if one of its // children contains an address. This allows for gaps between the children diff --git a/include/lldb/Core/SourceManager.h b/include/lldb/Core/SourceManager.h index d8c9eccd3477..0f65be1bee4b 100644 --- a/include/lldb/Core/SourceManager.h +++ b/include/lldb/Core/SourceManager.h @@ -85,7 +85,7 @@ public: CalculateLineOffsets (uint32_t line = UINT32_MAX); FileSpec m_file_spec_orig; // The original file spec that was used (can be different from m_file_spec) - FileSpec m_file_spec; // The actualy file spec being used (if the target has source mappings, this might be different from m_file_spec_orig) + FileSpec m_file_spec; // The actually file spec being used (if the target has source mappings, this might be different from m_file_spec_orig) TimeValue m_mod_time; // Keep the modification time that this file data is valid for uint32_t m_source_map_mod_id; // If the target uses path remappings, be sure to clear our notion of a source file if the path modification ID changes lldb::DataBufferSP m_data_sp; diff --git a/include/lldb/Core/Stream.h b/include/lldb/Core/Stream.h index 0fd4aac041a9..11780aa6ff0f 100644 --- a/include/lldb/Core/Stream.h +++ b/include/lldb/Core/Stream.h @@ -472,7 +472,7 @@ public: /// Indent the current line in the stream. /// /// Indent the current line using the current indentation level and - /// print an optional string following the idenatation spaces. + /// print an optional string following the indentation spaces. /// /// @param[in] s /// A C string to print following the indentation. If NULL, just diff --git a/include/lldb/Core/StructuredData.h b/include/lldb/Core/StructuredData.h new file mode 100644 index 000000000000..a4cabf4fe352 --- /dev/null +++ b/include/lldb/Core/StructuredData.h @@ -0,0 +1,486 @@ +//===-- StructuredData.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_StructuredData_h_ +#define liblldb_StructuredData_h_ + +// C Includes +// C++ Includes + +#include <map> +#include <utility> +#include <vector> +#include <string> + +#include "llvm/ADT/StringRef.h" + +// Other libraries and framework includes +// Project includes +#include "lldb/lldb-defines.h" +#include "lldb/Core/ConstString.h" +#include "lldb/Core/Stream.h" + +namespace lldb_private { + +//---------------------------------------------------------------------- +/// @class StructuredData StructuredData.h "lldb/Core/StructuredData.h" +/// @brief A class which can hold structured data +/// +/// The StructuredData class is designed to hold the data from a JSON +/// or plist style file -- a serialized data structure with dictionaries +/// (maps, hashes), arrays, and concrete values like integers, floating +/// point numbers, strings, booleans. +/// +/// StructuredData does not presuppose any knowledge of the schema for +/// the data it is holding; it can parse JSON data, for instance, and +/// other parts of lldb can iterate through the parsed data set to find +/// keys and values that may be present. +//---------------------------------------------------------------------- + +class StructuredData +{ +public: + + class Object; + class Array; + class Integer; + class Float; + class Boolean; + class String; + class Dictionary; + + typedef std::shared_ptr<Object> ObjectSP; + typedef std::shared_ptr<Array> ArraySP; + typedef std::shared_ptr<Dictionary> DictionarySP; + + enum class Type { + eTypeInvalid = -1, + eTypeNull = 0, + eTypeArray, + eTypeInteger, + eTypeFloat, + eTypeBoolean, + eTypeString, + eTypeDictionary + }; + + class Object : + public std::enable_shared_from_this<Object> + { + public: + + Object (Type t = Type::eTypeInvalid) : + m_type (t) + { + } + + virtual ~Object () + { + } + + virtual void + Clear () + { + m_type = Type::eTypeInvalid; + } + + Type + GetType () const + { + return m_type; + } + + void + SetType (Type t) + { + m_type = t; + } + + Array * + GetAsArray () + { + if (m_type == Type::eTypeArray) + return (Array *)this; + return NULL; + } + + Dictionary * + GetAsDictionary () + { + if (m_type == Type::eTypeDictionary) + return (Dictionary *)this; + return NULL; + } + + Integer * + GetAsInteger () + { + if (m_type == Type::eTypeInteger) + return (Integer *)this; + return NULL; + } + + Float * + GetAsFloat () + { + if (m_type == Type::eTypeFloat) + return (Float *)this; + return NULL; + } + + Boolean * + GetAsBoolean () + { + if (m_type == Type::eTypeBoolean) + return (Boolean *)this; + return NULL; + } + + String * + GetAsString () + { + if (m_type == Type::eTypeString) + return (String *)this; + return NULL; + } + + ObjectSP + GetObjectForDotSeparatedPath (llvm::StringRef path); + + virtual void + Dump (Stream &s) const = 0; + + private: + Type m_type; + }; + + class Array : public Object + { + public: + Array () : + Object (Type::eTypeArray) + { + } + + virtual + ~Array() + { + } + + size_t + GetSize() + { + return m_items.size(); + } + + ObjectSP + operator[](size_t idx) + { + if (idx < m_items.size()) + return m_items[idx]; + return ObjectSP(); + } + + ObjectSP + GetItemAtIndex (size_t idx) + { + if (idx < m_items.size()) + return m_items[idx]; + return ObjectSP(); + } + + void + Push(ObjectSP item) + { + m_items.push_back(item); + } + + void + AddItem(ObjectSP item) + { + m_items.push_back(item); + } + + virtual void + Dump (Stream &s) const; + + protected: + typedef std::vector<ObjectSP> collection; + collection m_items; + }; + + + class Integer : public Object + { + public: + Integer () : + Object (Type::eTypeInteger), + m_value () + { + } + + virtual ~Integer() + { + } + + void + SetValue (uint64_t value) + { + m_value = value; + } + + uint64_t + GetValue () + { + return m_value; + } + + virtual void + Dump (Stream &s) const; + + protected: + uint64_t m_value; + }; + + class Float : public Object + { + public: + Float () : + Object (Type::eTypeFloat), + m_value () + { + } + + virtual ~Float() + { + } + + void + SetValue (double value) + { + m_value = value; + } + + double + GetValue () + { + return m_value; + } + + virtual void + Dump (Stream &s) const; + + protected: + double m_value; + }; + + class Boolean : public Object + { + public: + Boolean () : + Object (Type::eTypeBoolean), + m_value () + { + } + + virtual ~Boolean() + { + } + + void + SetValue (bool value) + { + m_value = value; + } + + bool + GetValue () + { + return m_value; + } + + virtual void + Dump (Stream &s) const; + + protected: + bool m_value; + }; + + + + class String : public Object + { + public: + String () : + Object (Type::eTypeString), + m_value () + { + } + + void + SetValue (std::string string) + { + m_value = string; + } + + std::string + GetValue () + { + return m_value; + } + + virtual void + Dump (Stream &s) const; + + protected: + std::string m_value; + }; + + class Dictionary : public Object + { + public: + Dictionary () : + Object (Type::eTypeDictionary), + m_dict () + { + } + + virtual ~Dictionary() + { + } + size_t + GetSize() + { + return m_dict.size(); + } + + ObjectSP + GetKeys() + { + ObjectSP object_sp(new Array ()); + Array *array = object_sp->GetAsArray(); + collection::const_iterator iter; + for (iter = m_dict.begin(); iter != m_dict.end(); ++iter) + { + ObjectSP key_object_sp(new String()); + key_object_sp->GetAsString()->SetValue(iter->first.AsCString()); + array->Push(key_object_sp); + } + return object_sp; + } + + ObjectSP + GetValueForKey (const char *key) + { + ObjectSP value_sp; + if (key) + { + ConstString key_cs(key); + for (collection::const_iterator iter = m_dict.begin(); iter != m_dict.end(); ++iter) + { + if (key_cs == iter->first) + { + value_sp = iter->second; + break; + } + } + } + return value_sp; + } + + bool + HasKey (const char *key) + { + ConstString key_cs (key); + collection::const_iterator search = m_dict.find(key_cs); + if (search != m_dict.end()) + { + return true; + } + else + { + return false; + } + } + + void + AddItem (const char *key, ObjectSP value) + { + ConstString key_cs(key); + m_dict[key_cs] = value; + } + + void + AddIntegerItem (const char *key, uint64_t value) + { + ObjectSP val_obj (new Integer()); + val_obj->GetAsInteger()->SetValue (value); + AddItem (key, val_obj); + } + + void + AddFloatItem (const char *key, double value) + { + ObjectSP val_obj (new Float()); + val_obj->GetAsFloat()->SetValue (value); + AddItem (key, val_obj); + } + + void + AddStringItem (const char *key, std::string value) + { + ObjectSP val_obj (new String()); + val_obj->GetAsString()->SetValue (value); + AddItem (key, val_obj); + } + + void + AddBooleanItem (const char *key, bool value) + { + ObjectSP val_obj (new Boolean()); + val_obj->GetAsBoolean()->SetValue (value); + AddItem (key, val_obj); + } + + virtual void + Dump (Stream &s) const; + + protected: + typedef std::map<ConstString, ObjectSP> collection; + collection m_dict; + }; + + class Null : public Object + { + public: + Null () : + Object (Type::eTypeNull) + { + } + + virtual ~Null() + { + } + + virtual void + Dump (Stream &s) const; + + protected: + }; + + + static ObjectSP + ParseJSON (std::string json_text); + +}; // class StructuredData + + +} // namespace lldb_private + +#endif // liblldb_StructuredData_h_ diff --git a/include/lldb/Core/UserID.h b/include/lldb/Core/UserID.h index ea6af74759bf..230e43fa551f 100644 --- a/include/lldb/Core/UserID.h +++ b/include/lldb/Core/UserID.h @@ -19,12 +19,12 @@ namespace lldb_private { /// @class UserID UserID.h "lldb/Core/UserID.h" /// @brief A mix in class that contains a generic user ID. /// -/// UserID is desinged as a mix in class that can contain an integer -/// based unique identifier for a varietly of objects in lldb. +/// UserID is designed as a mix in class that can contain an integer +/// based unique identifier for a variety of objects in lldb. /// /// The value for this identifier is chosen by each parser plug-in. A /// value should be chosen that makes sense for each kind of object -/// should and allows quick access to further and more in depth parsing. +/// and should allow quick access to further and more in depth parsing. /// /// Symbol table entries can use this to store the original symbol table /// index, functions can use it to store the symbol table index or the diff --git a/include/lldb/Core/Value.h b/include/lldb/Core/Value.h index c7d44322333c..957cedeb0dcc 100644 --- a/include/lldb/Core/Value.h +++ b/include/lldb/Core/Value.h @@ -124,9 +124,15 @@ public: Value(); Value(const Scalar& scalar); Value(const Vector& vector); - Value(const uint8_t *bytes, int len); + Value(const void *bytes, int len); Value(const Value &rhs); + void + SetBytes (const void *bytes, int len); + + void + AppendBytes (const void *bytes, int len); + Value & operator=(const Value &rhs); @@ -232,8 +238,23 @@ public: return false; } - void + size_t ResizeData(size_t len); + + size_t + AppendDataToHostBuffer (const Value &rhs); + + DataBufferHeap & + GetBuffer () + { + return m_data_buffer; + } + + const DataBufferHeap & + GetBuffer () const + { + return m_data_buffer; + } bool ValueOf(ExecutionContext *exe_ctx); diff --git a/include/lldb/Core/ValueObject.h b/include/lldb/Core/ValueObject.h index e2847c778484..6a08ec6507f9 100644 --- a/include/lldb/Core/ValueObject.h +++ b/include/lldb/Core/ValueObject.h @@ -35,7 +35,7 @@ namespace lldb_private { /// ValueObject: /// /// This abstract class provides an interface to a particular value, be it a register, a local or global variable, -/// that is evaluated in some particular scope. The ValueObject also has the capibility of being the "child" of +/// that is evaluated in some particular scope. The ValueObject also has the capability of being the "child" of /// some other variable object, and in turn of having children. /// If a ValueObject is a root variable object - having no parent - then it must be constructed with respect to some /// particular ExecutionContextScope. If it is a child, it inherits the ExecutionContextScope from its parent. @@ -380,7 +380,7 @@ public: GetTypeImpl (); //------------------------------------------------------------------ - // Sublasses must implement the functions below. + // Subclasses must implement the functions below. //------------------------------------------------------------------ virtual uint64_t GetByteSize() = 0; @@ -389,12 +389,15 @@ public: GetValueType() const = 0; //------------------------------------------------------------------ - // Sublasses can implement the functions below. + // Subclasses can implement the functions below. //------------------------------------------------------------------ virtual ConstString GetTypeName(); virtual ConstString + GetDisplayTypeName(); + + virtual ConstString GetQualifiedTypeName(); virtual lldb::LanguageType @@ -427,6 +430,9 @@ public: return false; } + bool + IsBaseClass (uint32_t& depth); + virtual bool IsDereferenceOfParent () { @@ -465,7 +471,7 @@ public: return true; } - virtual off_t + virtual lldb::offset_t GetByteOffset() { return 0; @@ -528,7 +534,7 @@ public: GetDeclaration (Declaration &decl); //------------------------------------------------------------------ - // The functions below should NOT be modified by sublasses + // The functions below should NOT be modified by subclasses //------------------------------------------------------------------ const Error & GetError(); @@ -671,6 +677,9 @@ public: GetSyntheticChildAtOffset(uint32_t offset, const ClangASTType& type, bool can_create); virtual lldb::ValueObjectSP + GetSyntheticBase (uint32_t offset, const ClangASTType& type, bool can_create); + + virtual lldb::ValueObjectSP GetDynamicValue (lldb::DynamicValueType valueType); lldb::DynamicValueType @@ -712,6 +721,10 @@ public: { } + // Find the address of the C++ vtable pointer + virtual lldb::addr_t + GetCPPVTableAddress(AddressType &address_type); + virtual lldb::ValueObjectSP Cast (const ClangASTType &clang_ast_type); @@ -762,7 +775,7 @@ public: static lldb::ValueObjectSP CreateValueObjectFromData (const char* name, - DataExtractor& data, + const DataExtractor& data, const ExecutionContext& exe_ctx, ClangASTType type); @@ -793,7 +806,7 @@ public: uint32_t item_count = 1); virtual uint64_t - GetData (DataExtractor& data); + GetData (DataExtractor& data, Error &error); virtual bool SetData (DataExtractor &data, Error &error); @@ -961,7 +974,7 @@ protected: void SetChildrenCount (size_t count) { - m_children_count = count; + Clear(count); } size_t @@ -971,10 +984,10 @@ protected: } void - Clear() + Clear(size_t new_count = 0) { - m_children_count = 0; Mutex::Locker locker(m_mutex); + m_children_count = new_count; m_children.clear(); } @@ -1127,7 +1140,7 @@ protected: ClearDynamicTypeInformation (); //------------------------------------------------------------------ - // Sublasses must implement the functions below. + // Subclasses must implement the functions below. //------------------------------------------------------------------ virtual ClangASTType diff --git a/include/lldb/Core/ValueObjectChild.h b/include/lldb/Core/ValueObjectChild.h index 780529a4af11..07d1f294bd80 100644 --- a/include/lldb/Core/ValueObjectChild.h +++ b/include/lldb/Core/ValueObjectChild.h @@ -32,7 +32,7 @@ public: return m_byte_size; } - virtual off_t + virtual lldb::offset_t GetByteOffset() { return m_byte_offset; @@ -62,6 +62,9 @@ public: virtual ConstString GetQualifiedTypeName(); + virtual ConstString + GetDisplayTypeName(); + virtual bool IsInScope (); diff --git a/include/lldb/Core/ValueObjectConstResult.h b/include/lldb/Core/ValueObjectConstResult.h index 4964d0589a09..dd87fc848ae8 100644 --- a/include/lldb/Core/ValueObjectConstResult.h +++ b/include/lldb/Core/ValueObjectConstResult.h @@ -80,6 +80,9 @@ public: virtual ConstString GetTypeName(); + virtual ConstString + GetDisplayTypeName(); + virtual bool IsInScope (); diff --git a/include/lldb/Core/ValueObjectDynamicValue.h b/include/lldb/Core/ValueObjectDynamicValue.h index 68f88c96e545..7607bd38137d 100644 --- a/include/lldb/Core/ValueObjectDynamicValue.h +++ b/include/lldb/Core/ValueObjectDynamicValue.h @@ -37,6 +37,9 @@ public: virtual ConstString GetQualifiedTypeName(); + + virtual ConstString + GetDisplayTypeName(); virtual size_t CalculateNumChildren(); diff --git a/include/lldb/Core/ValueObjectMemory.h b/include/lldb/Core/ValueObjectMemory.h index 627d73eb4b27..41b43188a46a 100644 --- a/include/lldb/Core/ValueObjectMemory.h +++ b/include/lldb/Core/ValueObjectMemory.h @@ -47,6 +47,9 @@ public: virtual ConstString GetTypeName(); + virtual ConstString + GetDisplayTypeName(); + virtual size_t CalculateNumChildren(); diff --git a/include/lldb/Core/ValueObjectRegister.h b/include/lldb/Core/ValueObjectRegister.h index 6820629f08e1..f7c7683d60bc 100644 --- a/include/lldb/Core/ValueObjectRegister.h +++ b/include/lldb/Core/ValueObjectRegister.h @@ -45,6 +45,9 @@ public: virtual ConstString GetQualifiedTypeName(); + + virtual ConstString + GetDisplayTypeName(); virtual size_t CalculateNumChildren(); diff --git a/include/lldb/Core/ValueObjectSyntheticFilter.h b/include/lldb/Core/ValueObjectSyntheticFilter.h index f1d8c885c255..e12698f49bb1 100644 --- a/include/lldb/Core/ValueObjectSyntheticFilter.h +++ b/include/lldb/Core/ValueObjectSyntheticFilter.h @@ -41,6 +41,9 @@ public: virtual ConstString GetQualifiedTypeName(); + + virtual ConstString + GetDisplayTypeName(); virtual bool MightHaveChildren(); diff --git a/include/lldb/Core/ValueObjectVariable.h b/include/lldb/Core/ValueObjectVariable.h index 8a30b00f6bbd..0e32d09057dc 100644 --- a/include/lldb/Core/ValueObjectVariable.h +++ b/include/lldb/Core/ValueObjectVariable.h @@ -39,6 +39,9 @@ public: virtual ConstString GetQualifiedTypeName(); + + virtual ConstString + GetDisplayTypeName(); virtual size_t CalculateNumChildren(); diff --git a/include/lldb/Core/dwarf.h b/include/lldb/Core/dwarf.h index 91c8dfb9d0da..9fa8816229a9 100644 --- a/include/lldb/Core/dwarf.h +++ b/include/lldb/Core/dwarf.h @@ -12,7 +12,7 @@ #include <stdint.h> -// Get the DWARF constant defintions from llvm +// Get the DWARF constant definitions from llvm #include "llvm/Support/Dwarf.h" // and stuff them in our default namespace using namespace llvm::dwarf; |