diff options
Diffstat (limited to 'include')
62 files changed, 1684 insertions, 437 deletions
diff --git a/include/lldb/API/SBLaunchInfo.h b/include/lldb/API/SBLaunchInfo.h new file mode 100644 index 000000000000..a5921ab90d48 --- /dev/null +++ b/include/lldb/API/SBLaunchInfo.h @@ -0,0 +1,186 @@ +//===-- SBLaunchInfo.h ------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLDB_SBLaunchInfo_h_ +#define LLDB_SBLaunchInfo_h_ + +#include "lldb/API/SBDefines.h" + +namespace lldb { + +class SBPlatform; +class SBTarget; + +class SBLaunchInfo +{ +public: + SBLaunchInfo (const char **argv); + + ~SBLaunchInfo(); + + lldb::pid_t + GetProcessID(); + + uint32_t + GetUserID(); + + uint32_t + GetGroupID(); + + bool + UserIDIsValid (); + + bool + GroupIDIsValid (); + + void + SetUserID (uint32_t uid); + + void + SetGroupID (uint32_t gid); + + SBFileSpec + GetExecutableFile (); + + //---------------------------------------------------------------------- + /// Set the executable file that will be used to launch the process and + /// optionally set it as the first argument in the argument vector. + /// + /// This only needs to be specified if clients wish to carefully control + /// the exact path will be used to launch a binary. If you create a + /// target with a symlink, that symlink will get resolved in the target + /// and the resolved path will get used to launch the process. Calling + /// this function can help you still launch your process using the + /// path of your choice. + /// + /// If this function is not called prior to launching with + /// SBTarget::Launch(...), the target will use the resolved executable + /// path that was used to create the target. + /// + /// @param[in] exe_file + /// The override path to use when launching the executable. + /// + /// @param[in] add_as_first_arg + /// If true, then the path will be inserted into the argument vector + /// prior to launching. Otherwise the argument vector will be left + /// alone. + //---------------------------------------------------------------------- + void + SetExecutableFile (SBFileSpec exe_file, bool add_as_first_arg); + + + //---------------------------------------------------------------------- + /// Get the listener that will be used to receive process events. + /// + /// If no listener has been set via a call to + /// SBLaunchInfo::SetListener(), then an invalid SBListener will be + /// returned (SBListener::IsValid() will return false). If a listener + /// has been set, then the valid listener object will be returned. + //---------------------------------------------------------------------- + SBListener + GetListener (); + + //---------------------------------------------------------------------- + /// Set the listener that will be used to receive process events. + /// + /// By default the SBDebugger, which has a listener, that the SBTarget + /// belongs to will listen for the process events. Calling this function + /// allows a different listener to be used to listen for process events. + //---------------------------------------------------------------------- + void + SetListener (SBListener &listener); + + uint32_t + GetNumArguments (); + + const char * + GetArgumentAtIndex (uint32_t idx); + + void + SetArguments (const char **argv, bool append); + + uint32_t + GetNumEnvironmentEntries (); + + const char * + GetEnvironmentEntryAtIndex (uint32_t idx); + + void + SetEnvironmentEntries (const char **envp, bool append); + + void + Clear (); + + const char * + GetWorkingDirectory () const; + + void + SetWorkingDirectory (const char *working_dir); + + uint32_t + GetLaunchFlags (); + + void + SetLaunchFlags (uint32_t flags); + + const char * + GetProcessPluginName (); + + void + SetProcessPluginName (const char *plugin_name); + + const char * + GetShell (); + + void + SetShell (const char * path); + + uint32_t + GetResumeCount (); + + void + SetResumeCount (uint32_t c); + + bool + AddCloseFileAction (int fd); + + bool + AddDuplicateFileAction (int fd, int dup_fd); + + bool + AddOpenFileAction (int fd, const char *path, bool read, bool write); + + bool + AddSuppressFileAction (int fd, bool read, bool write); + + void + SetLaunchEventData (const char *data); + + const char * + GetLaunchEventData () const; + + bool + GetDetachOnError() const; + + void + SetDetachOnError(bool enable); + +protected: + friend class SBPlatform; + friend class SBTarget; + + lldb_private::ProcessLaunchInfo & + ref (); + + ProcessLaunchInfoSP m_opaque_sp; +}; + +} // namespace lldb + +#endif // LLDB_SBLaunchInfo_h_ diff --git a/include/lldb/API/SBPlatform.h b/include/lldb/API/SBPlatform.h index 16a546d81f9b..42b2d0492895 100644 --- a/include/lldb/API/SBPlatform.h +++ b/include/lldb/API/SBPlatform.h @@ -12,11 +12,15 @@ #include "lldb/API/SBDefines.h" +#include <functional> + struct PlatformConnectOptions; struct PlatformShellCommand; namespace lldb { + class SBLaunchInfo; + class SBPlatformConnectOptions { public: @@ -171,6 +175,12 @@ namespace lldb { Run (SBPlatformShellCommand &shell_command); SBError + Launch (SBLaunchInfo &launch_info); + + SBError + Kill (const lldb::pid_t pid); + + SBError MakeDirectory (const char *path, uint32_t file_permissions = eFilePermissionsDirectoryDefault); uint32_t @@ -190,6 +200,9 @@ namespace lldb { void SetSP (const lldb::PlatformSP& platform_sp); + SBError + ExecuteConnected (const std::function<lldb_private::Error(const lldb::PlatformSP&)>& func); + lldb::PlatformSP m_opaque_sp; }; diff --git a/include/lldb/API/SBTarget.h b/include/lldb/API/SBTarget.h index a628467caa43..322cf04159ff 100644 --- a/include/lldb/API/SBTarget.h +++ b/include/lldb/API/SBTarget.h @@ -15,6 +15,7 @@ #include "lldb/API/SBBroadcaster.h" #include "lldb/API/SBFileSpec.h" #include "lldb/API/SBFileSpecList.h" +#include "lldb/API/SBLaunchInfo.h" #include "lldb/API/SBSymbolContextList.h" #include "lldb/API/SBType.h" #include "lldb/API/SBValue.h" @@ -24,166 +25,6 @@ namespace lldb { class SBPlatform; -class SBLaunchInfo -{ -public: - SBLaunchInfo (const char **argv); - - ~SBLaunchInfo(); - - uint32_t - GetUserID(); - - uint32_t - GetGroupID(); - - bool - UserIDIsValid (); - - bool - GroupIDIsValid (); - - void - SetUserID (uint32_t uid); - - void - SetGroupID (uint32_t gid); - - SBFileSpec - GetExecutableFile (); - - //---------------------------------------------------------------------- - /// Set the executable file that will be used to launch the process and - /// optionally set it as the first argument in the argument vector. - /// - /// This only needs to be specified if clients wish to carefully control - /// the exact path will be used to launch a binary. If you create a - /// target with a symlink, that symlink will get resolved in the target - /// and the resolved path will get used to launch the process. Calling - /// this function can help you still launch your process using the - /// path of your choice. - /// - /// If this function is not called prior to launching with - /// SBTarget::Launch(...), the target will use the resolved executable - /// path that was used to create the target. - /// - /// @param[in] exe_file - /// The override path to use when launching the executable. - /// - /// @param[in] add_as_first_arg - /// If true, then the path will be inserted into the argument vector - /// prior to launching. Otherwise the argument vector will be left - /// alone. - //---------------------------------------------------------------------- - void - SetExecutableFile (SBFileSpec exe_file, bool add_as_first_arg); - - - //---------------------------------------------------------------------- - /// Get the listener that will be used to receive process events. - /// - /// If no listener has been set via a call to - /// SBLaunchInfo::SetListener(), then an invalid SBListener will be - /// returned (SBListener::IsValid() will return false). If a listener - /// has been set, then the valid listener object will be returned. - //---------------------------------------------------------------------- - SBListener - GetListener (); - - //---------------------------------------------------------------------- - /// Set the listener that will be used to receive process events. - /// - /// By default the SBDebugger, which has a listener, that the SBTarget - /// belongs to will listen for the process events. Calling this function - /// allows a different listener to be used to listen for process events. - //---------------------------------------------------------------------- - void - SetListener (SBListener &listener); - - uint32_t - GetNumArguments (); - - const char * - GetArgumentAtIndex (uint32_t idx); - - void - SetArguments (const char **argv, bool append); - - uint32_t - GetNumEnvironmentEntries (); - - const char * - GetEnvironmentEntryAtIndex (uint32_t idx); - - void - SetEnvironmentEntries (const char **envp, bool append); - - void - Clear (); - - const char * - GetWorkingDirectory () const; - - void - SetWorkingDirectory (const char *working_dir); - - uint32_t - GetLaunchFlags (); - - void - SetLaunchFlags (uint32_t flags); - - const char * - GetProcessPluginName (); - - void - SetProcessPluginName (const char *plugin_name); - - const char * - GetShell (); - - void - SetShell (const char * path); - - uint32_t - GetResumeCount (); - - void - SetResumeCount (uint32_t c); - - bool - AddCloseFileAction (int fd); - - bool - AddDuplicateFileAction (int fd, int dup_fd); - - bool - AddOpenFileAction (int fd, const char *path, bool read, bool write); - - bool - AddSuppressFileAction (int fd, bool read, bool write); - - void - SetLaunchEventData (const char *data); - - const char * - GetLaunchEventData () const; - - bool - GetDetachOnError() const; - - void - SetDetachOnError(bool enable); - -protected: - friend class SBTarget; - - lldb_private::ProcessLaunchInfo & - ref (); - - ProcessLaunchInfoSP m_opaque_sp; -}; - class SBAttachInfo { public: diff --git a/include/lldb/API/SBType.h b/include/lldb/API/SBType.h index 303ddff6dc09..7990fc0696a9 100644 --- a/include/lldb/API/SBType.h +++ b/include/lldb/API/SBType.h @@ -153,6 +153,9 @@ public: IsArrayType (); bool + IsVectorType (); + + bool IsTypedefType (); lldb::SBType @@ -175,6 +178,9 @@ public: lldb::SBType GetArrayElementType (); + + lldb::SBType + GetVectorElementType (); lldb::SBType GetCanonicalType(); diff --git a/include/lldb/Breakpoint/Breakpoint.h b/include/lldb/Breakpoint/Breakpoint.h index 61acc061aebc..883571a3ce9a 100644 --- a/include/lldb/Breakpoint/Breakpoint.h +++ b/include/lldb/Breakpoint/Breakpoint.h @@ -714,6 +714,19 @@ protected: bool IgnoreCountShouldStop (); + void + IncrementHitCount() + { + m_hit_count++; + } + + void + DecrementHitCount() + { + assert (m_hit_count > 0); + m_hit_count--; + } + private: // This one should only be used by Target to copy breakpoints from target to target - primarily from the dummy // target to prime new targets. @@ -733,7 +746,10 @@ private: BreakpointLocationList m_locations; // The list of locations currently found for this breakpoint. std::string m_kind_description; bool m_resolve_indirect_symbols; - + uint32_t m_hit_count; // Number of times this breakpoint/watchpoint has been hit. This is kept + // separately from the locations hit counts, since locations can go away when + // their backing library gets unloaded, and we would lose hit counts. + void SendBreakpointChangedEvent (lldb::BreakpointEventType eventKind); diff --git a/include/lldb/Breakpoint/BreakpointLocation.h b/include/lldb/Breakpoint/BreakpointLocation.h index 8d5ebce411df..642256386785 100644 --- a/include/lldb/Breakpoint/BreakpointLocation.h +++ b/include/lldb/Breakpoint/BreakpointLocation.h @@ -390,6 +390,7 @@ protected: friend class BreakpointSite; friend class BreakpointLocationList; friend class Process; + friend class StopInfoBreakpoint; //------------------------------------------------------------------ /// Set the breakpoint site for this location to \a bp_site_sp. @@ -417,6 +418,9 @@ private: void BumpHitCount(); + void + UndoBumpHitCount(); + //------------------------------------------------------------------ // Constructors and Destructors diff --git a/include/lldb/Breakpoint/StoppointLocation.h b/include/lldb/Breakpoint/StoppointLocation.h index 452c6388c82d..32a1dbd4386e 100644 --- a/include/lldb/Breakpoint/StoppointLocation.h +++ b/include/lldb/Breakpoint/StoppointLocation.h @@ -134,6 +134,9 @@ protected: ++m_hit_count; } + void + DecrementHitCount (); + private: //------------------------------------------------------------------ // For StoppointLocation only diff --git a/include/lldb/Core/ArchSpec.h b/include/lldb/Core/ArchSpec.h index 694e204cdc0d..93630f043822 100644 --- a/include/lldb/Core/ArchSpec.h +++ b/include/lldb/Core/ArchSpec.h @@ -277,6 +277,21 @@ public: } //------------------------------------------------------------------ + /// Merges fields from another ArchSpec into this ArchSpec. + /// + /// This will use the supplied ArchSpec to fill in any fields of + /// the triple in this ArchSpec which were unspecified. This can + /// be used to refine a generic ArchSpec with a more specific one. + /// For example, if this ArchSpec's triple is something like + /// i386-unknown-unknown-unknown, and we have a triple which is + /// x64-pc-windows-msvc, then merging that triple into this one + /// will result in the triple i386-pc-windows-msvc. + /// + //------------------------------------------------------------------ + void + MergeFrom(const ArchSpec &other); + + //------------------------------------------------------------------ /// Sets this ArchSpec according to the given architecture name. /// /// The architecture name can be one of the generic system default diff --git a/include/lldb/Core/Broadcaster.h b/include/lldb/Core/Broadcaster.h index 64b12ca8a938..6d54b1b43133 100644 --- a/include/lldb/Core/Broadcaster.h +++ b/include/lldb/Core/Broadcaster.h @@ -419,12 +419,7 @@ public: HijackBroadcaster (Listener *listener, uint32_t event_mask = UINT32_MAX); bool - IsHijackedForEvent (uint32_t event_mask) - { - if (m_hijacking_listeners.size() > 0) - return (event_mask & m_hijacking_masks.back()) != 0; - return false; - } + IsHijackedForEvent (uint32_t event_mask); //------------------------------------------------------------------ /// Restore the state of the Broadcaster from a previous hijack attempt. diff --git a/include/lldb/Core/Connection.h b/include/lldb/Core/Connection.h index 775e0c846f85..a7b911ac382f 100644 --- a/include/lldb/Core/Connection.h +++ b/include/lldb/Core/Connection.h @@ -12,6 +12,7 @@ // C Includes // C++ Includes +#include <string> // Other libraries and framework includes // Project includes #include "lldb/lldb-private.h" @@ -133,13 +134,13 @@ public: /// /// Subclasses must override this function. /// - /// @param[in] src - /// A source buffer that must be at least \a src_len bytes + /// @param[in] dst + /// A desination buffer that must be at least \a dst_len bytes /// long. /// - /// @param[in] src_len + /// @param[in] dst_len /// The number of bytes to attempt to write, and also the - /// number of bytes are currently available in \a src. + /// number of bytes are currently available in \a dst. /// /// @param[out] error_ptr /// A pointer to an error object that should be given an @@ -150,7 +151,18 @@ public: /// The number of bytes actually Written. //------------------------------------------------------------------ virtual size_t - Write (const void *buffer, size_t length, lldb::ConnectionStatus &status, Error *error_ptr) = 0; + Write (const void *dst, size_t dst_len, lldb::ConnectionStatus &status, Error *error_ptr) = 0; + + //------------------------------------------------------------------ + /// Returns a URI that describes this connection object + /// + /// Subclasses may override this function. + /// + /// @return + /// Returns URI or an empty string if disconnecteds + //------------------------------------------------------------------ + virtual std::string + GetURI() = 0; private: //------------------------------------------------------------------ diff --git a/include/lldb/Core/ConnectionMachPort.h b/include/lldb/Core/ConnectionMachPort.h index 04ec7f69136b..78eb78cb95f4 100644 --- a/include/lldb/Core/ConnectionMachPort.h +++ b/include/lldb/Core/ConnectionMachPort.h @@ -56,6 +56,9 @@ public: lldb::ConnectionStatus &status, lldb_private::Error *error_ptr); + virtual std::string + GetURI(); + lldb::ConnectionStatus BootstrapCheckIn (const char *port_name, lldb_private::Error *error_ptr); @@ -83,6 +86,7 @@ protected: mach_port_t m_port; private: + std::string m_uri; DISALLOW_COPY_AND_ASSIGN (ConnectionMachPort); diff --git a/include/lldb/Core/ConnectionSharedMemory.h b/include/lldb/Core/ConnectionSharedMemory.h index 0f9cdcb8a92d..48e62142954e 100644 --- a/include/lldb/Core/ConnectionSharedMemory.h +++ b/include/lldb/Core/ConnectionSharedMemory.h @@ -53,6 +53,9 @@ public: virtual size_t Write (const void *src, size_t src_len, lldb::ConnectionStatus &status, Error *error_ptr); + virtual std::string + GetURI(); + lldb::ConnectionStatus Open (bool create, const char *name, size_t size, Error *error_ptr); diff --git a/include/lldb/Core/Debugger.h b/include/lldb/Core/Debugger.h index 15c832f4bf66..9a3f9736fdca 100644 --- a/include/lldb/Core/Debugger.h +++ b/include/lldb/Core/Debugger.h @@ -19,6 +19,7 @@ #include "lldb/lldb-public.h" #include "lldb/Core/Broadcaster.h" #include "lldb/Core/Communication.h" +#include "lldb/Core/FormatEntity.h" #include "lldb/Core/IOHandler.h" #include "lldb/Core/Listener.h" #include "lldb/Core/SourceManager.h" @@ -158,8 +159,6 @@ public: // To get the target's source manager, call GetSourceManager on the target instead. SourceManager & GetSourceManager (); - -public: lldb::TargetSP GetSelectedTarget () @@ -224,6 +223,12 @@ public: ConstString GetTopIOHandlerControlSequence(char ch); + const char * + GetIOHandlerCommandPrefix(); + + const char * + GetIOHandlerHelpPrologue(); + bool HideTopIOHandler(); @@ -243,15 +248,7 @@ public: GetDebuggerAtIndex (size_t index); static bool - FormatPrompt (const char *format, - const SymbolContext *sc, - const ExecutionContext *exe_ctx, - const Address *addr, - Stream &s, - ValueObject* valobj = NULL); - - static bool - FormatDisassemblerAddress (const char *format, + FormatDisassemblerAddress (const FormatEntity::Entry *format, const SymbolContext *sc, const SymbolContext *prev_sc, const ExecutionContext *exe_ctx, @@ -296,13 +293,13 @@ public: bool GetAutoConfirm () const; - const char * + const FormatEntity::Entry * GetDisassemblyFormat() const; - const char * + const FormatEntity::Entry * GetFrameFormat() const; - const char * + const FormatEntity::Entry * GetThreadFormat() const; lldb::ScriptLanguage @@ -352,7 +349,6 @@ public: bool GetNotifyVoid () const; - const ConstString & GetInstanceName() diff --git a/include/lldb/Core/Disassembler.h b/include/lldb/Core/Disassembler.h index b0b841b0a925..64d35e67bfd0 100644 --- a/include/lldb/Core/Disassembler.h +++ b/include/lldb/Core/Disassembler.h @@ -117,7 +117,7 @@ public: /// the InstructionList. /// Only needed if show_address is true. /// - /// @param[in] disassembly_addr_format_spec + /// @param[in] disassembly_addr_format /// The format specification for how addresses are printed. /// Only needed if show_address is true. //------------------------------------------------------------------ @@ -130,7 +130,7 @@ public: const ExecutionContext* exe_ctx, const SymbolContext *sym_ctx, const SymbolContext *prev_sym_ctx, - const char *disassembly_addr_format_spec); + const FormatEntity::Entry *disassembly_addr_format); virtual bool DoesBranch () = 0; @@ -457,7 +457,7 @@ protected: //------------------------------------------------------------------ // Classes that inherit from Disassembler can see and modify these //------------------------------------------------------------------ - const ArchSpec m_arch; + ArchSpec m_arch; InstructionList m_instruction_list; lldb::addr_t m_base_addr; std::string m_flavor; diff --git a/include/lldb/Core/FormatEntity.h b/include/lldb/Core/FormatEntity.h new file mode 100644 index 000000000000..32ff9ea4e3eb --- /dev/null +++ b/include/lldb/Core/FormatEntity.h @@ -0,0 +1,260 @@ +//===-- FormatEntity.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_FormatEntity_h_ +#define liblldb_FormatEntity_h_ +#if defined(__cplusplus) + +#include <string> +#include <vector> + +#include "lldb/lldb-private.h" +#include "lldb/Core/Error.h" + +namespace llvm +{ + class StringRef; +} + +namespace lldb_private +{ + class FormatEntity + { + public: + struct Entry + { + enum class Type { + Invalid, + ParentNumber, + ParentString, + InsertString, + Root, + String, + Scope, + Variable, + VariableSynthetic, + ScriptVariable, + ScriptVariableSynthetic, + AddressLoad, + AddressFile, + AddressLoadOrFile, + ProcessID, + ProcessFile, + ScriptProcess, + ThreadID, + ThreadProtocolID, + ThreadIndexID, + ThreadName, + ThreadQueue, + ThreadStopReason, + ThreadReturnValue, + ThreadCompletedExpression, + ScriptThread, + ThreadInfo, + TargetArch, + ScriptTarget, + ModuleFile, + File, + FrameIndex, + FrameRegisterPC, + FrameRegisterSP, + FrameRegisterFP, + FrameRegisterFlags, + FrameRegisterByName, + ScriptFrame, + FunctionID, + FunctionDidChange, + FunctionInitialFunction, + FunctionName, + FunctionNameWithArgs, + FunctionNameNoArgs, + FunctionAddrOffset, + FunctionAddrOffsetConcrete, + FunctionLineOffset, + FunctionPCOffset, + LineEntryFile, + LineEntryLineNumber, + LineEntryStartAddress, + LineEntryEndAddress, + CurrentPCArrow + }; + + enum FormatType + { + None, + UInt32, + UInt64, + CString + }; + + struct Definition + { + const char *name; + const char *string; // Insert this exact string into the output + Entry::Type type; + FormatType format_type; // uint32_t, uint64_t, cstr, or anything that can be formatted by printf or lldb::Format + uint64_t data; + uint32_t num_children; + Definition *children; // An array of "num_children" Definition entries, + bool keep_separator; + }; + + Entry (Type t = Type::Invalid, + const char *s = NULL, + const char *f = NULL) : + string (s ? s : ""), + printf_format (f ? f : ""), + children (), + definition (NULL), + type (t), + fmt (lldb::eFormatDefault), + number (0), + deref (false) + { + } + + Entry (llvm::StringRef s); + Entry (char ch); + + void + AppendChar (char ch); + + void + AppendText (const llvm::StringRef &s); + + void + AppendText (const char *cstr); + + void + AppendEntry (const Entry &&entry) + { + children.push_back(entry); + } + + void + Clear () + { + string.clear(); + printf_format.clear(); + children.clear(); + definition = NULL; + type = Type::Invalid; + fmt = lldb::eFormatDefault; + number = 0; + deref = false; + } + + static const char * + TypeToCString (Type t); + + void + Dump (Stream &s, int depth = 0) const; + + bool + operator == (const Entry &rhs) const + { + if (string != rhs.string) + return false; + if (printf_format != rhs.printf_format) + return false; + const size_t n = children.size(); + const size_t m = rhs.children.size(); + for (size_t i=0; i < std::min<size_t>(n, m); ++i) + { + if (!(children[i] == rhs.children[i])) + return false; + } + if (children != rhs.children) + return false; + if (definition != rhs.definition) + return false; + if (type != rhs.type) + return false; + if (fmt != rhs.fmt) + return false; + if (deref != rhs.deref) + return false; + return true; + } + + std::string string; + std::string printf_format; + std::vector<Entry> children; + Definition *definition; + Type type; + lldb::Format fmt; + lldb::addr_t number; + bool deref; + }; + + static bool + Format (const Entry &entry, + Stream &s, + const SymbolContext *sc, + const ExecutionContext *exe_ctx, + const Address *addr, + ValueObject* valobj, + bool function_changed, + bool initial_function); + + static bool + FormatStringRef (const llvm::StringRef &format, + Stream &s, + const SymbolContext *sc, + const ExecutionContext *exe_ctx, + const Address *addr, + ValueObject* valobj, + bool function_changed, + bool initial_function); + + static bool + FormatCString (const char *format, + Stream &s, + const SymbolContext *sc, + const ExecutionContext *exe_ctx, + const Address *addr, + ValueObject* valobj, + bool function_changed, + bool initial_function); + + static Error + Parse (const llvm::StringRef &format, Entry &entry); + + static Error + ExtractVariableInfo (llvm::StringRef &format_str, + llvm::StringRef &variable_name, + llvm::StringRef &variable_format); + + static size_t + AutoComplete (const char *s, + int match_start_point, + int max_return_elements, + bool &word_complete, + StringList &matches); + + //---------------------------------------------------------------------- + // Format the current elements into the stream \a s. + // + // The root element will be stripped off and the format str passed in + // will be either an empty string (print a description of this object), + // or contain a . separated series like a domain name that identifies + // further sub elements to display. + //---------------------------------------------------------------------- + static bool + FormatFileSpec (const FileSpec &file, Stream &s, llvm::StringRef elements, llvm::StringRef element_format); + protected: + + static Error + ParseInternal (llvm::StringRef &format, Entry &parent_entry, uint32_t depth); + + }; + +} +#endif // #if defined(__cplusplus) +#endif // liblldb_FormatEntity_h_ diff --git a/include/lldb/Core/Mangled.h b/include/lldb/Core/Mangled.h index 2f3df6afd8dc..87b23799882f 100644 --- a/include/lldb/Core/Mangled.h +++ b/include/lldb/Core/Mangled.h @@ -290,6 +290,25 @@ public: void SetValue (const ConstString &name); + //---------------------------------------------------------------------- + /// Get the language only if it is definitive what the language is from + /// the mangling. + /// + /// For a mangled name to have a language it must have both a mangled + /// and a demangled name and it must be definitive from the mangling + /// what the language is. + /// + /// Standard C function names will return eLanguageTypeUnknown because + /// they aren't mangled and it isn't clear what language the name + /// represents (there will be no mangled name). + /// + /// @return + /// The language for the mangled/demangled name, eLanguageTypeUnknown + /// if there is no mangled or demangled counterpart. + //---------------------------------------------------------------------- + lldb::LanguageType + GetLanguage (); + private: //---------------------------------------------------------------------- /// Mangled member variables. diff --git a/include/lldb/Core/Module.h b/include/lldb/Core/Module.h index bfde7cbc5db9..60fbb989502e 100644 --- a/include/lldb/Core/Module.h +++ b/include/lldb/Core/Module.h @@ -941,17 +941,8 @@ public: const ConstString &object_name); bool - GetIsDynamicLinkEditor () const - { - return m_is_dynamic_loader_module; - } - - void - SetIsDynamicLinkEditor (bool b) - { - m_is_dynamic_loader_module = b; - } - + GetIsDynamicLinkEditor (); + ClangASTContext & GetClangASTContext (); @@ -1124,8 +1115,7 @@ protected: bool m_did_load_objfile:1, m_did_load_symbol_vendor:1, m_did_parse_uuid:1, - m_did_init_ast:1, - m_is_dynamic_loader_module:1; + m_did_init_ast:1; mutable bool m_file_has_changed:1, m_first_file_changed_log:1; /// See if the module was modified after it was initially opened. diff --git a/include/lldb/Core/RegularExpression.h b/include/lldb/Core/RegularExpression.h index 00d8310b4806..a58d17b4a794 100644 --- a/include/lldb/Core/RegularExpression.h +++ b/include/lldb/Core/RegularExpression.h @@ -121,23 +121,6 @@ public: //------------------------------------------------------------------ RegularExpression (); - //------------------------------------------------------------------ - /// 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. - /// - /// @param[in] re - /// A c string that represents the regular expression to - /// compile. - /// - /// @param[in] flags - /// Flags that are passed to the \c regcomp() function. - //------------------------------------------------------------------ - explicit - RegularExpression (const char* re, int flags); - - // This one uses flags = REG_EXTENDED. explicit RegularExpression (const char* re); @@ -157,7 +140,7 @@ public: /// Compile a regular expression. /// /// Compile a regular expression using the supplied regular - /// expression text and flags. The compiled regular expression lives + /// expression text. 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 previously compiled regular @@ -167,9 +150,6 @@ public: /// A NULL terminated C string that represents the regular /// expression to compile. /// - /// @param[in] flags - /// Flags that are passed to the \c regcomp() function. - /// /// @return /// \b true if the regular expression compiles successfully, /// \b false otherwise. @@ -177,9 +157,6 @@ public: bool Compile (const char* re); - bool - Compile (const char* re, int flags); - //------------------------------------------------------------------ /// Executes a regular expression. /// @@ -187,8 +164,7 @@ public: /// expression that is already in this object against the match /// string \a s. If any parens are used for regular expression /// matches \a match_count should indicate the number of regmatch_t - /// values that are present in \a match_ptr. The regular expression - /// will be executed using the \a execute_flags + /// values that are present in \a match_ptr. /// /// @param[in] string /// The string to match against the compile regular expression. @@ -198,15 +174,12 @@ public: /// properly initialized with the desired number of maximum /// matches, or NULL if no parenthesized matching is needed. /// - /// @param[in] execute_flags - /// Flags to pass to the \c regexec() function. - /// /// @return /// \b true if \a string matches the compiled regular /// expression, \b false otherwise. //------------------------------------------------------------------ bool - Execute (const char* string, Match *match = NULL, int execute_flags = 0) const; + Execute (const char* string, Match *match = NULL) const; size_t GetErrorAsCString (char *err_str, size_t err_str_max_len) const; @@ -233,12 +206,6 @@ public: const char* GetText () const; - int - GetCompileFlags () const - { - return m_compile_flags; - } - //------------------------------------------------------------------ /// Test if valid. /// @@ -256,7 +223,6 @@ public: { Free(); m_re.clear(); - m_compile_flags = 0; m_comp_err = 1; } @@ -276,7 +242,6 @@ private: std::string m_re; ///< A copy of the original regular expression text int m_comp_err; ///< Error code for the regular expression compilation regex_t m_preg; ///< The compiled regular expression - int m_compile_flags; ///< Stores the flags from the last compile. }; } // namespace lldb_private diff --git a/include/lldb/Core/ValueObject.h b/include/lldb/Core/ValueObject.h index fa96c8989913..b50adfb69564 100644 --- a/include/lldb/Core/ValueObject.h +++ b/include/lldb/Core/ValueObject.h @@ -527,9 +527,14 @@ public: virtual lldb::ModuleSP GetModule(); - virtual ValueObject* + ValueObject* GetRoot (); + // Given a ValueObject, loop over itself and its parent, and its parent's parent, .. + // until either the given callback returns false, or you end up at a null pointer + ValueObject* + FollowParentChain (std::function<bool(ValueObject*)>); + virtual bool GetDeclaration (Declaration &decl); @@ -875,6 +880,9 @@ public: virtual lldb::LanguageType GetPreferredDisplayLanguage (); + void + SetPreferredDisplayLanguage (lldb::LanguageType); + lldb::TypeSummaryImplSP GetSummaryFormat() { @@ -1106,6 +1114,8 @@ protected: llvm::SmallVector<uint8_t, 16> m_value_checksum; + lldb::LanguageType m_preferred_display_language; + bool m_value_is_valid:1, m_value_did_change:1, m_children_count_valid:1, diff --git a/include/lldb/Core/ValueObjectSyntheticFilter.h b/include/lldb/Core/ValueObjectSyntheticFilter.h index 49c5601dc0e5..aa784add7409 100644 --- a/include/lldb/Core/ValueObjectSyntheticFilter.h +++ b/include/lldb/Core/ValueObjectSyntheticFilter.h @@ -140,6 +140,9 @@ public: return (UpdateValueIfNeeded(), m_provides_value == eLazyBoolYes); } + virtual bool + SetValueFromCString (const char *value_str, Error& error); + protected: virtual bool UpdateValue (); diff --git a/include/lldb/DataFormatters/TypeSummary.h b/include/lldb/DataFormatters/TypeSummary.h index 2d4e03ad9b5d..8b90dd0c4895 100644 --- a/include/lldb/DataFormatters/TypeSummary.h +++ b/include/lldb/DataFormatters/TypeSummary.h @@ -23,6 +23,8 @@ #include "lldb/lldb-public.h" #include "lldb/lldb-enumerations.h" +#include "lldb/Core/Error.h" +#include "lldb/Core/FormatEntity.h" #include "lldb/Core/ValueObject.h" #include "lldb/Interpreter/ScriptInterpreterPython.h" #include "lldb/Symbol/Type.h" @@ -372,31 +374,27 @@ namespace lldb_private { // simple string-based summaries, using ${var to show data struct StringSummaryFormat : public TypeSummaryImpl { - std::string m_format; + std::string m_format_str; + FormatEntity::Entry m_format; + Error m_error; StringSummaryFormat(const TypeSummaryImpl::Flags& flags, const char* f); + virtual + ~StringSummaryFormat() + { + } + const char* GetSummaryString () const { - return m_format.c_str(); + return m_format_str.c_str(); } void - SetSummaryString (const char* data) - { - if (data) - m_format.assign(data); - else - m_format.clear(); - } - - virtual - ~StringSummaryFormat() - { - } - + SetSummaryString (const char* f); + virtual bool FormatObject(ValueObject *valobj, std::string& dest, diff --git a/include/lldb/Expression/ASTResultSynthesizer.h b/include/lldb/Expression/ASTResultSynthesizer.h index 79709de3546a..410a862fc12a 100644 --- a/include/lldb/Expression/ASTResultSynthesizer.h +++ b/include/lldb/Expression/ASTResultSynthesizer.h @@ -91,7 +91,7 @@ public: //---------------------------------------------------------------------- /// Passthrough stub //---------------------------------------------------------------------- - void HandleVTable(clang::CXXRecordDecl *RD, bool DefinitionRequired); + void HandleVTable(clang::CXXRecordDecl *RD); //---------------------------------------------------------------------- /// Passthrough stub diff --git a/include/lldb/Expression/ASTStructExtractor.h b/include/lldb/Expression/ASTStructExtractor.h index 9e467797a398..25193744c9e0 100644 --- a/include/lldb/Expression/ASTStructExtractor.h +++ b/include/lldb/Expression/ASTStructExtractor.h @@ -99,7 +99,7 @@ public: //---------------------------------------------------------------------- /// Passthrough stub //---------------------------------------------------------------------- - void HandleVTable(clang::CXXRecordDecl *RD, bool DefinitionRequired); + void HandleVTable(clang::CXXRecordDecl *RD); //---------------------------------------------------------------------- /// Passthrough stub diff --git a/include/lldb/Expression/IRExecutionUnit.h b/include/lldb/Expression/IRExecutionUnit.h index c15c65c92a3b..bd1a795a158e 100644 --- a/include/lldb/Expression/IRExecutionUnit.h +++ b/include/lldb/Expression/IRExecutionUnit.h @@ -207,6 +207,9 @@ private: DisassembleFunction (Stream &stream, lldb::ProcessSP &process_sp); + void + ReportSymbolLookupError(const ConstString &name); + class MemoryManager : public llvm::SectionMemoryManager { public: @@ -282,10 +285,10 @@ private: //------------------------------------------------------------------ /// Passthrough interface stub //------------------------------------------------------------------ + virtual uint64_t getSymbolAddress(const std::string &Name); + virtual void *getPointerToNamedFunction(const std::string &Name, - bool AbortOnFailure = true) { - return m_default_mm_ap->getPointerToNamedFunction(Name, AbortOnFailure); - } + bool AbortOnFailure = true); private: std::unique_ptr<SectionMemoryManager> m_default_mm_ap; ///< The memory allocator to use in actually creating space. All calls are passed through to it. IRExecutionUnit &m_parent; ///< The execution unit this is a proxy for. @@ -390,6 +393,7 @@ private: std::vector<std::string> m_cpu_features; llvm::SmallVector<JittedFunction, 1> m_jitted_functions; ///< A vector of all functions that have been JITted into machine code const ConstString m_name; + std::vector<ConstString> m_failed_lookups; std::atomic<bool> m_did_jit; diff --git a/include/lldb/Host/File.h b/include/lldb/Host/File.h index 2738679b5e03..8219cc06fdc2 100644 --- a/include/lldb/Host/File.h +++ b/include/lldb/Host/File.h @@ -42,7 +42,8 @@ public: eOpenOptionNonBlocking = (1u << 4), // File reads eOpenOptionCanCreate = (1u << 5), // Create file if doesn't already exist eOpenOptionCanCreateNewOnly = (1u << 6), // Can create file only if it doesn't already exist - eOpenoptionDontFollowSymlinks = (1u << 7) + eOpenoptionDontFollowSymlinks = (1u << 7), + eOpenOptionCloseOnExec = (1u << 8) // Close the file when executing a new process }; static mode_t diff --git a/include/lldb/Host/Host.h b/include/lldb/Host/Host.h index ce12689fc047..9a68c698c826 100644 --- a/include/lldb/Host/Host.h +++ b/include/lldb/Host/Host.h @@ -246,9 +246,6 @@ public: static const lldb_private::UnixSignalsSP& GetUnixSignals (); - static lldb::pid_t - LaunchApplication (const FileSpec &app_file_spec); - static Error LaunchProcess (ProcessLaunchInfo &launch_info); diff --git a/include/lldb/Host/PipeBase.h b/include/lldb/Host/PipeBase.h index 8cad2507d32c..5ef2bb530281 100644 --- a/include/lldb/Host/PipeBase.h +++ b/include/lldb/Host/PipeBase.h @@ -14,6 +14,7 @@ #include <string> #include "lldb/Core/Error.h" +#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" namespace lldb_private @@ -25,6 +26,7 @@ class PipeBase virtual Error CreateNew(bool child_process_inherit) = 0; virtual Error CreateNew(llvm::StringRef name, bool child_process_inherit) = 0; + virtual Error CreateWithUniqueName(llvm::StringRef prefix, bool child_process_inherit, llvm::SmallVectorImpl<char>& name) = 0; virtual Error OpenAsReader(llvm::StringRef name, bool child_process_inherit) = 0; diff --git a/include/lldb/Host/Socket.h b/include/lldb/Host/Socket.h index 77069ae35f79..ee85f85fcaf2 100644 --- a/include/lldb/Host/Socket.h +++ b/include/lldb/Host/Socket.h @@ -70,22 +70,35 @@ public: int GetOption (int level, int option_name, int &option_value); int SetOption (int level, int option_name, int option_value); - static uint16_t GetPortNumber(const NativeSocket& socket); - uint16_t GetPortNumber () const; + // returns port number or 0 if error + static uint16_t GetLocalPortNumber (const NativeSocket& socket); + + // returns port number or 0 if error + uint16_t GetLocalPortNumber () const; + + // returns ip address string or empty string if error + std::string GetLocalIPAddress () const; + + // must be connected + // returns port number or 0 if error + uint16_t GetRemotePortNumber () const; + + // must be connected + // returns ip address string or empty string if error + std::string GetRemoteIPAddress () const; NativeSocket GetNativeSocket () const { return m_socket; } - SocketProtocol GetSocketProtocol() const { return m_protocol; } + SocketProtocol GetSocketProtocol () const { return m_protocol; } virtual Error Read (void *buf, size_t &num_bytes); virtual Error Write (const void *buf, size_t &num_bytes); - virtual Error PreDisconnect(); - virtual Error Close(); + virtual Error PreDisconnect (); + virtual Error Close (); - virtual bool IsValid() const { return m_socket != kInvalidSocketValue; } - virtual WaitableHandle GetWaitableHandle(); + virtual bool IsValid () const { return m_socket != kInvalidSocketValue; } + virtual WaitableHandle GetWaitableHandle (); -protected: static bool DecodeHostAndPort (llvm::StringRef host_and_port, std::string &host_str, @@ -93,7 +106,7 @@ protected: int32_t& port, Error *error_ptr); - +protected: SocketProtocol m_protocol; NativeSocket m_socket; SocketAddress m_udp_send_sockaddr; // Send address used for UDP connections. diff --git a/include/lldb/Host/SocketAddress.h b/include/lldb/Host/SocketAddress.h index 3598a42a82d0..9666f56489f6 100644 --- a/include/lldb/Host/SocketAddress.h +++ b/include/lldb/Host/SocketAddress.h @@ -31,6 +31,7 @@ typedef ADDRESS_FAMILY sa_family_t; // C++ Includes // Other libraries and framework includes // Project includes +#include <string> namespace lldb_private { @@ -100,6 +101,12 @@ public: SetFamily (sa_family_t family); //------------------------------------------------------------------ + // Get the address + //------------------------------------------------------------------ + std::string + GetIPAddress () const; + + //------------------------------------------------------------------ // Get the port if the socket address for the family has a port //------------------------------------------------------------------ uint16_t diff --git a/include/lldb/Host/StringConvert.h b/include/lldb/Host/StringConvert.h new file mode 100644 index 000000000000..3cc260cf2be1 --- /dev/null +++ b/include/lldb/Host/StringConvert.h @@ -0,0 +1,45 @@ +//===-- StringConvert.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_StringConvert_h_ +#define liblldb_StringConvert_h_ + +// C Includes +#include <stdint.h> + +// C++ Includes + +// Other libraries and framework includes +// Project includes + +namespace lldb_private { + +namespace StringConvert { + +//---------------------------------------------------------------------- +/// @namespace StringConvert StringConvert.h "lldb/Host/StringConvert.h" +/// @brief Utility classes for converting strings into Integers +//---------------------------------------------------------------------- + +int32_t +ToSInt32 (const char *s, int32_t fail_value = 0, int base = 0, bool *success_ptr = nullptr); + +uint32_t +ToUInt32 (const char *s, uint32_t fail_value = 0, int base = 0, bool *success_ptr = nullptr); + +int64_t +ToSInt64 (const char *s, int64_t fail_value = 0, int base = 0, bool *success_ptr = nullptr); + +uint64_t +ToUInt64 (const char *s, uint64_t fail_value = 0, int base = 0, bool *success_ptr = nullptr); + +} // namespace StringConvert +} // namespace lldb_private + +#endif diff --git a/include/lldb/Host/common/NativeBreakpoint.h b/include/lldb/Host/common/NativeBreakpoint.h new file mode 100644 index 000000000000..367003b94e35 --- /dev/null +++ b/include/lldb/Host/common/NativeBreakpoint.h @@ -0,0 +1,66 @@ +//===-- NativeBreakpoint.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_NativeBreakpoint_h_ +#define liblldb_NativeBreakpoint_h_ + +#include "lldb/lldb-types.h" + +namespace lldb_private +{ + class NativeBreakpointList; + + class NativeBreakpoint + { + friend class NativeBreakpointList; + + public: + // The assumption is that derived breakpoints are enabled when created. + NativeBreakpoint (lldb::addr_t addr); + + virtual + ~NativeBreakpoint (); + + Error + Enable (); + + Error + Disable (); + + lldb::addr_t + GetAddress () const { return m_addr; } + + bool + IsEnabled () const { return m_enabled; } + + virtual bool + IsSoftwareBreakpoint () const = 0; + + protected: + const lldb::addr_t m_addr; + int32_t m_ref_count; + + virtual Error + DoEnable () = 0; + + virtual Error + DoDisable () = 0; + + private: + bool m_enabled; + + // ----------------------------------------------------------- + // interface for NativeBreakpointList + // ----------------------------------------------------------- + void AddRef (); + int32_t DecRef (); + }; +} + +#endif // ifndef liblldb_NativeBreakpoint_h_ diff --git a/include/lldb/Host/common/NativeBreakpointList.h b/include/lldb/Host/common/NativeBreakpointList.h new file mode 100644 index 000000000000..51617330d075 --- /dev/null +++ b/include/lldb/Host/common/NativeBreakpointList.h @@ -0,0 +1,53 @@ +//===-- NativeBreakpointList.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_NativeBreakpointList_h_ +#define liblldb_NativeBreakpointList_h_ + +#include "lldb/lldb-private-forward.h" +#include "lldb/Core/Error.h" +#include "lldb/Host/Mutex.h" +// #include "lldb/Host/NativeBreakpoint.h" + +#include <functional> +#include <map> + +namespace lldb_private +{ + class NativeBreakpointList + { + public: + typedef std::function<Error (lldb::addr_t addr, size_t size_hint, bool hardware, NativeBreakpointSP &breakpoint_sp)> CreateBreakpointFunc; + + NativeBreakpointList (); + + Error + AddRef (lldb::addr_t addr, size_t size_hint, bool hardware, CreateBreakpointFunc create_func); + + Error + DecRef (lldb::addr_t addr); + + Error + EnableBreakpoint (lldb::addr_t addr); + + Error + DisableBreakpoint (lldb::addr_t addr); + + Error + GetBreakpoint (lldb::addr_t addr, NativeBreakpointSP &breakpoint_sp); + + private: + typedef std::map<lldb::addr_t, NativeBreakpointSP> BreakpointMap; + + Mutex m_mutex; + BreakpointMap m_breakpoints; + }; +} + +#endif // ifndef liblldb_NativeBreakpointList_h_ diff --git a/include/lldb/Host/common/NativeProcessProtocol.h b/include/lldb/Host/common/NativeProcessProtocol.h new file mode 100644 index 000000000000..83c14a5ab37a --- /dev/null +++ b/include/lldb/Host/common/NativeProcessProtocol.h @@ -0,0 +1,349 @@ +//===-- NativeProcessProtocol.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_NativeProcessProtocol_h_ +#define liblldb_NativeProcessProtocol_h_ + +#include <vector> + +#include "lldb/lldb-private-forward.h" +#include "lldb/lldb-types.h" +#include "lldb/Core/Error.h" +#include "lldb/Host/Mutex.h" + +#include "NativeBreakpointList.h" +#include "NativeWatchpointList.h" + +namespace lldb_private +{ + class MemoryRegionInfo; + class ResumeActionList; + + //------------------------------------------------------------------ + // NativeProcessProtocol + //------------------------------------------------------------------ + class NativeProcessProtocol : + public std::enable_shared_from_this<NativeProcessProtocol> + { + friend class SoftwareBreakpoint; + + public: + static NativeProcessProtocol * + CreateInstance (lldb::pid_t pid); + + // lldb_private::Host calls should be used to launch a process for debugging, and + // then the process should be attached to. When attaching to a process + // lldb_private::Host calls should be used to locate the process to attach to, + // and then this function should be called. + NativeProcessProtocol (lldb::pid_t pid); + + public: + virtual ~NativeProcessProtocol () + { + } + + virtual Error + Resume (const ResumeActionList &resume_actions) = 0; + + virtual Error + Halt () = 0; + + virtual Error + Detach () = 0; + + //------------------------------------------------------------------ + /// Sends a process a UNIX signal \a signal. + /// + /// @return + /// Returns an error object. + //------------------------------------------------------------------ + virtual Error + Signal (int signo) = 0; + + //------------------------------------------------------------------ + /// Tells a process to interrupt all operations as if by a Ctrl-C. + /// + /// The default implementation will send a local host's equivalent of + /// a SIGSTOP to the process via the NativeProcessProtocol::Signal() + /// operation. + /// + /// @return + /// Returns an error object. + //------------------------------------------------------------------ + virtual Error + Interrupt (); + + virtual Error + Kill () = 0; + + //---------------------------------------------------------------------- + // Memory and memory region functions + //---------------------------------------------------------------------- + + virtual Error + GetMemoryRegionInfo (lldb::addr_t load_addr, MemoryRegionInfo &range_info); + + virtual Error + ReadMemory (lldb::addr_t addr, void *buf, lldb::addr_t size, lldb::addr_t &bytes_read) = 0; + + virtual Error + WriteMemory (lldb::addr_t addr, const void *buf, lldb::addr_t size, lldb::addr_t &bytes_written) = 0; + + virtual Error + AllocateMemory (lldb::addr_t size, uint32_t permissions, lldb::addr_t &addr) = 0; + + virtual Error + DeallocateMemory (lldb::addr_t addr) = 0; + + virtual lldb::addr_t + GetSharedLibraryInfoAddress () = 0; + + virtual bool + IsAlive () const; + + virtual size_t + UpdateThreads () = 0; + + virtual bool + GetArchitecture (ArchSpec &arch) const = 0; + + //---------------------------------------------------------------------- + // Breakpoint functions + //---------------------------------------------------------------------- + virtual Error + SetBreakpoint (lldb::addr_t addr, uint32_t size, bool hardware) = 0; + + virtual Error + RemoveBreakpoint (lldb::addr_t addr); + + virtual Error + EnableBreakpoint (lldb::addr_t addr); + + virtual Error + DisableBreakpoint (lldb::addr_t addr); + + //---------------------------------------------------------------------- + // Watchpoint functions + //---------------------------------------------------------------------- + virtual const NativeWatchpointList::WatchpointMap& + GetWatchpointMap () const; + + virtual uint32_t + GetMaxWatchpoints () const; + + virtual Error + SetWatchpoint (lldb::addr_t addr, size_t size, uint32_t watch_flags, bool hardware); + + virtual Error + RemoveWatchpoint (lldb::addr_t addr); + + //---------------------------------------------------------------------- + // Accessors + //---------------------------------------------------------------------- + lldb::pid_t + GetID() const + { + return m_pid; + } + + lldb::StateType + GetState () const; + + bool + IsRunning () const + { + return m_state == lldb::eStateRunning || IsStepping(); + } + + bool + IsStepping () const + { + return m_state == lldb::eStateStepping; + } + + bool + CanResume () const + { + return m_state == lldb::eStateStopped; + } + + bool + GetByteOrder (lldb::ByteOrder &byte_order) const; + + //---------------------------------------------------------------------- + // Exit Status + //---------------------------------------------------------------------- + virtual bool + GetExitStatus (lldb_private::ExitType *exit_type, int *status, std::string &exit_description); + + virtual bool + SetExitStatus (lldb_private::ExitType exit_type, int status, const char *exit_description, bool bNotifyStateChange); + + //---------------------------------------------------------------------- + // Access to threads + //---------------------------------------------------------------------- + NativeThreadProtocolSP + GetThreadAtIndex (uint32_t idx); + + NativeThreadProtocolSP + GetThreadByID (lldb::tid_t tid); + + void + SetCurrentThreadID (lldb::tid_t tid) + { + m_current_thread_id = tid; + } + + lldb::tid_t + GetCurrentThreadID () + { + return m_current_thread_id; + } + + NativeThreadProtocolSP + GetCurrentThread () + { + return GetThreadByID (m_current_thread_id); + } + + //---------------------------------------------------------------------- + // Access to inferior stdio + //---------------------------------------------------------------------- + virtual + int GetTerminalFileDescriptor () + { + return m_terminal_fd; + } + + //---------------------------------------------------------------------- + // Stop id interface + //---------------------------------------------------------------------- + + uint32_t + GetStopID () const; + + // --------------------------------------------------------------------- + // Callbacks for low-level process state changes + // --------------------------------------------------------------------- + class NativeDelegate + { + public: + virtual + ~NativeDelegate () {} + + virtual void + InitializeDelegate (NativeProcessProtocol *process) = 0; + + virtual void + ProcessStateChanged (NativeProcessProtocol *process, lldb::StateType state) = 0; + + virtual void + DidExec (NativeProcessProtocol *process) = 0; + }; + + //------------------------------------------------------------------ + /// Register a native delegate. + /// + /// Clients can register nofication callbacks by passing in a + /// NativeDelegate impl and passing it into this function. + /// + /// Note: it is required that the lifetime of the + /// native_delegate outlive the NativeProcessProtocol. + /// + /// @param[in] native_delegate + /// A NativeDelegate impl to be called when certain events + /// happen within the NativeProcessProtocol or related threads. + /// + /// @return + /// true if the delegate was registered successfully; + /// false if the delegate was already registered. + /// + /// @see NativeProcessProtocol::NativeDelegate. + //------------------------------------------------------------------ + bool + RegisterNativeDelegate (NativeDelegate &native_delegate); + + //------------------------------------------------------------------ + /// Unregister a native delegate previously registered. + /// + /// @param[in] native_delegate + /// A NativeDelegate impl previously registered with this process. + /// + /// @return Returns \b true if the NativeDelegate was + /// successfully removed from the process, \b false otherwise. + /// + /// @see NativeProcessProtocol::NativeDelegate + //------------------------------------------------------------------ + bool + UnregisterNativeDelegate (NativeDelegate &native_delegate); + + protected: + lldb::pid_t m_pid; + + std::vector<NativeThreadProtocolSP> m_threads; + lldb::tid_t m_current_thread_id; + mutable Mutex m_threads_mutex; + + lldb::StateType m_state; + mutable Mutex m_state_mutex; + + lldb_private::ExitType m_exit_type; + int m_exit_status; + std::string m_exit_description; + Mutex m_delegates_mutex; + std::vector<NativeDelegate*> m_delegates; + NativeBreakpointList m_breakpoint_list; + NativeWatchpointList m_watchpoint_list; + int m_terminal_fd; + uint32_t m_stop_id; + + // ----------------------------------------------------------- + // Internal interface for state handling + // ----------------------------------------------------------- + void + SetState (lldb::StateType state, bool notify_delegates = true); + + // Derived classes need not implement this. It can be used as a + // hook to clear internal caches that should be invalidated when + // stop ids change. + // + // Note this function is called with the state mutex obtained + // by the caller. + virtual void + DoStopIDBumped (uint32_t newBumpId); + + // ----------------------------------------------------------- + // Internal interface for software breakpoints + // ----------------------------------------------------------- + Error + SetSoftwareBreakpoint (lldb::addr_t addr, uint32_t size_hint); + + virtual Error + GetSoftwareBreakpointTrapOpcode (size_t trap_opcode_size_hint, size_t &actual_opcode_size, const uint8_t *&trap_opcode_bytes) = 0; + + // ----------------------------------------------------------- + /// Notify the delegate that an exec occurred. + /// + /// Provide a mechanism for a delegate to clear out any exec- + /// sensitive data. + // ----------------------------------------------------------- + void + NotifyDidExec (); + + NativeThreadProtocolSP + GetThreadByIDUnlocked (lldb::tid_t tid); + + private: + + void + SynchronouslyNotifyProcessStateChanged (lldb::StateType state); + }; +} + +#endif // #ifndef liblldb_NativeProcessProtocol_h_ diff --git a/include/lldb/Target/NativeRegisterContext.h b/include/lldb/Host/common/NativeRegisterContext.h index fa4ab013f234..e9c03e3c20a4 100644 --- a/include/lldb/Target/NativeRegisterContext.h +++ b/include/lldb/Host/common/NativeRegisterContext.h @@ -15,6 +15,7 @@ // Other libraries and framework includes // Project includes #include "lldb/lldb-private.h" +#include "lldb/Host/common/NativeWatchpointList.h" namespace lldb_private { @@ -44,6 +45,9 @@ public: virtual uint32_t GetRegisterCount () const = 0; + virtual uint32_t + GetUserRegisterCount () const = 0; + virtual const RegisterInfo * GetRegisterInfoAtIndex (uint32_t reg) const = 0; @@ -92,6 +96,9 @@ public: virtual bool ClearHardwareWatchpoint (uint32_t hw_index); + virtual Error + ClearAllHardwareWatchpoints (); + virtual bool HardwareSingleStep (bool enable); diff --git a/include/lldb/Target/NativeRegisterContextRegisterInfo.h b/include/lldb/Host/common/NativeRegisterContextRegisterInfo.h index 5631005ca56e..b2a29de4e5a4 100644 --- a/include/lldb/Target/NativeRegisterContextRegisterInfo.h +++ b/include/lldb/Host/common/NativeRegisterContextRegisterInfo.h @@ -31,6 +31,9 @@ namespace lldb_private uint32_t GetRegisterCount () const override; + uint32_t + GetUserRegisterCount () const override; + const RegisterInfo * GetRegisterInfoAtIndex (uint32_t reg_index) const override; diff --git a/include/lldb/Host/common/NativeThreadProtocol.h b/include/lldb/Host/common/NativeThreadProtocol.h new file mode 100644 index 000000000000..954ffb36a94f --- /dev/null +++ b/include/lldb/Host/common/NativeThreadProtocol.h @@ -0,0 +1,82 @@ +//===-- NativeThreadProtocol.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_NativeThreadProtocol_h_ +#define liblldb_NativeThreadProtocol_h_ + +#include <memory> + +#include "lldb/lldb-private-forward.h" +#include "lldb/lldb-types.h" +#include "lldb/Host/Debug.h" + +namespace lldb_private +{ + //------------------------------------------------------------------ + // NativeThreadProtocol + //------------------------------------------------------------------ + class NativeThreadProtocol: + public std::enable_shared_from_this<NativeThreadProtocol> + { + public: + NativeThreadProtocol (NativeProcessProtocol *process, lldb::tid_t tid); + + virtual ~NativeThreadProtocol() + { + } + + virtual std::string + GetName() = 0; + + virtual lldb::StateType + GetState () = 0; + + virtual NativeRegisterContextSP + GetRegisterContext () = 0; + + virtual Error + ReadRegister (uint32_t reg, RegisterValue ®_value); + + virtual Error + WriteRegister (uint32_t reg, const RegisterValue ®_value); + + virtual Error + SaveAllRegisters (lldb::DataBufferSP &data_sp); + + virtual Error + RestoreAllRegisters (lldb::DataBufferSP &data_sp); + + virtual bool + GetStopReason (ThreadStopInfo &stop_info, std::string& description) = 0; + + lldb::tid_t + GetID() const + { + return m_tid; + } + + NativeProcessProtocolSP + GetProcess (); + + // --------------------------------------------------------------------- + // Thread-specific watchpoints + // --------------------------------------------------------------------- + virtual Error + SetWatchpoint (lldb::addr_t addr, size_t size, uint32_t watch_flags, bool hardware) = 0; + + virtual Error + RemoveWatchpoint (lldb::addr_t addr) = 0; + + protected: + NativeProcessProtocolWP m_process_wp; + lldb::tid_t m_tid; + }; +} + +#endif // #ifndef liblldb_NativeThreadProtocol_h_ diff --git a/include/lldb/Host/common/NativeWatchpointList.h b/include/lldb/Host/common/NativeWatchpointList.h new file mode 100644 index 000000000000..7b310e5a0db0 --- /dev/null +++ b/include/lldb/Host/common/NativeWatchpointList.h @@ -0,0 +1,47 @@ +//===-- NativeWatchpointList.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_NativeWatchpointList_h_ +#define liblldb_NativeWatchpointList_h_ + +#include "lldb/lldb-private-forward.h" +#include "lldb/Core/Error.h" + +#include <map> + +namespace lldb_private +{ + struct NativeWatchpoint + { + lldb::addr_t m_addr; + size_t m_size; + uint32_t m_watch_flags; + bool m_hardware; + }; + + class NativeWatchpointList + { + public: + Error + Add (lldb::addr_t addr, size_t size, uint32_t watch_flags, bool hardware); + + Error + Remove (lldb::addr_t addr); + + using WatchpointMap = std::map<lldb::addr_t, NativeWatchpoint>; + + const WatchpointMap& + GetWatchpointMap () const; + + private: + WatchpointMap m_watchpoints; + }; +} + +#endif // ifndef liblldb_NativeWatchpointList_h_ diff --git a/include/lldb/Host/common/SoftwareBreakpoint.h b/include/lldb/Host/common/SoftwareBreakpoint.h new file mode 100644 index 000000000000..1fed19eca612 --- /dev/null +++ b/include/lldb/Host/common/SoftwareBreakpoint.h @@ -0,0 +1,51 @@ +//===-- SoftwareBreakpoint.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_SoftwareBreakpoint_h_ +#define liblldb_SoftwareBreakpoint_h_ + +#include "lldb/lldb-private-forward.h" +#include "NativeBreakpoint.h" + +namespace lldb_private +{ + class SoftwareBreakpoint : public NativeBreakpoint + { + public: + static Error + CreateSoftwareBreakpoint (NativeProcessProtocol &process, lldb::addr_t addr, size_t size_hint, NativeBreakpointSP &breakpoint_spn); + + SoftwareBreakpoint (NativeProcessProtocol &process, lldb::addr_t addr, const uint8_t *saved_opcodes, const uint8_t *trap_opcodes, size_t opcode_size); + + protected: + Error + DoEnable () override; + + Error + DoDisable () override; + + bool + IsSoftwareBreakpoint () const override; + + private: + /// Max number of bytes that a software trap opcode sequence can occupy. + static const size_t MAX_TRAP_OPCODE_SIZE = 8; + + NativeProcessProtocol &m_process; + uint8_t m_saved_opcodes [MAX_TRAP_OPCODE_SIZE]; + uint8_t m_trap_opcodes [MAX_TRAP_OPCODE_SIZE]; + const size_t m_opcode_size; + + static Error + EnableSoftwareBreakpoint (NativeProcessProtocol &process, lldb::addr_t addr, size_t bp_opcode_size, const uint8_t *bp_opcode_bytes, uint8_t *saved_opcode_bytes); + + }; +} + +#endif // #ifndef liblldb_SoftwareBreakpoint_h_ diff --git a/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h b/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h index 4d326d71fa75..660b9d169bfc 100644 --- a/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h +++ b/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h @@ -50,6 +50,8 @@ class ConnectionFileDescriptor : public Connection virtual size_t Write(const void *src, size_t src_len, lldb::ConnectionStatus &status, Error *error_ptr); + virtual std::string GetURI(); + lldb::ConnectionStatus BytesAvailable(uint32_t timeout_usec, Error *error_ptr); bool InterruptRead(); @@ -75,7 +77,7 @@ class ConnectionFileDescriptor : public Connection void CloseCommandPipe(); - lldb::ConnectionStatus SocketListen(const char *host_and_port, Error *error_ptr); + lldb::ConnectionStatus SocketListenAndAccept(const char *host_and_port, Error *error_ptr); lldb::ConnectionStatus ConnectTCP(const char *host_and_port, Error *error_ptr); @@ -99,6 +101,8 @@ class ConnectionFileDescriptor : public Connection bool m_waiting_for_accept; bool m_child_processes_inherit; + std::string m_uri; + private: DISALLOW_COPY_AND_ASSIGN(ConnectionFileDescriptor); }; diff --git a/include/lldb/Host/posix/PipePosix.h b/include/lldb/Host/posix/PipePosix.h index 0ab3ff7f6775..fbdac66149d6 100644 --- a/include/lldb/Host/posix/PipePosix.h +++ b/include/lldb/Host/posix/PipePosix.h @@ -36,6 +36,8 @@ public: Error CreateNew(llvm::StringRef name, bool child_process_inherit) override; Error + CreateWithUniqueName(llvm::StringRef prefix, bool child_process_inherit, llvm::SmallVectorImpl<char>& name) override; + Error OpenAsReader(llvm::StringRef name, bool child_process_inherit) override; Error OpenAsWriterWithTimeout(llvm::StringRef name, bool child_process_inherit, const std::chrono::microseconds &timeout) override; diff --git a/include/lldb/Interpreter/Args.h b/include/lldb/Interpreter/Args.h index 1071bd6fd047..fe29df468de7 100644 --- a/include/lldb/Interpreter/Args.h +++ b/include/lldb/Interpreter/Args.h @@ -347,18 +347,6 @@ public: bool trailing = true, bool return_null_if_empty = true); - static int32_t - StringToSInt32 (const char *s, int32_t fail_value = 0, int base = 0, bool *success_ptr = NULL); - - static uint32_t - StringToUInt32 (const char *s, uint32_t fail_value = 0, int base = 0, bool *success_ptr = NULL); - - static int64_t - StringToSInt64 (const char *s, int64_t fail_value = 0, int base = 0, bool *success_ptr = NULL); - - static uint64_t - StringToUInt64 (const char *s, uint64_t fail_value = 0, int base = 0, bool *success_ptr = NULL); - static bool UInt64ValueIsValidForByteSize (uint64_t uval64, size_t total_byte_size) { diff --git a/include/lldb/Interpreter/CommandInterpreter.h b/include/lldb/Interpreter/CommandInterpreter.h index baaa271a4285..20b6ff95be8b 100644 --- a/include/lldb/Interpreter/CommandInterpreter.h +++ b/include/lldb/Interpreter/CommandInterpreter.h @@ -224,6 +224,7 @@ public: eCommandTypesBuiltin = 0x0001, // native commands such as "frame" eCommandTypesUserDef = 0x0002, // scripted commands eCommandTypesAliases = 0x0004, // aliases such as "po" + eCommandTypesHidden = 0x0008, // commands prefixed with an underscore eCommandTypesAllThem = 0xFFFF // all commands }; @@ -431,6 +432,11 @@ public: StreamString &help_string); void + OutputFormattedHelpText (Stream &strm, + const char *prefix, + const char *help_text); + + void OutputFormattedHelpText (Stream &stream, const char *command_word, const char *separator, @@ -607,6 +613,9 @@ public: bool asynchronously, void *baton); + const char * + GetCommandPrefix (); + //------------------------------------------------------------------ // Properties //------------------------------------------------------------------ diff --git a/include/lldb/Interpreter/OptionGroupPlatform.h b/include/lldb/Interpreter/OptionGroupPlatform.h index 970ad328ccb7..f7de50c86a56 100644 --- a/include/lldb/Interpreter/OptionGroupPlatform.h +++ b/include/lldb/Interpreter/OptionGroupPlatform.h @@ -102,8 +102,10 @@ public: SetSDKBuild (const ConstString &sdk_build) { m_sdk_build = sdk_build; - } - + } + + bool + PlatformMatches(const lldb::PlatformSP &platform_sp) const; protected: std::string m_platform_name; diff --git a/include/lldb/Interpreter/OptionValue.h b/include/lldb/Interpreter/OptionValue.h index 0e8f23453a8a..787430a96ef5 100644 --- a/include/lldb/Interpreter/OptionValue.h +++ b/include/lldb/Interpreter/OptionValue.h @@ -17,6 +17,7 @@ #include "lldb/lldb-defines.h" #include "lldb/Core/ConstString.h" #include "lldb/Core/Error.h" +#include "lldb/Core/FormatEntity.h" namespace lldb_private { @@ -45,7 +46,8 @@ namespace lldb_private { eTypeSInt64, eTypeString, eTypeUInt64, - eTypeUUID + eTypeUUID, + eTypeFormatEntity } Type; enum { @@ -309,7 +311,13 @@ namespace lldb_private { const OptionValueUUID * GetAsUUID () const; - + + OptionValueFormatEntity * + GetAsFormatEntity (); + + const OptionValueFormatEntity * + GetAsFormatEntity () const; + bool GetBooleanValue (bool fail_value = false) const; @@ -341,6 +349,9 @@ namespace lldb_private { bool SetFormatValue (lldb::Format new_value); + const FormatEntity::Entry * + GetFormatEntity () const; + const RegularExpression * GetRegexValue () const; diff --git a/include/lldb/Interpreter/OptionValueFormatEntity.h b/include/lldb/Interpreter/OptionValueFormatEntity.h new file mode 100644 index 000000000000..cc988998bda0 --- /dev/null +++ b/include/lldb/Interpreter/OptionValueFormatEntity.h @@ -0,0 +1,107 @@ +//===-- OptionValueFormatEntity.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_OptionValueFormatEntity_h_ +#define liblldb_OptionValueFormatEntity_h_ + +// C Includes +// C++ Includes +// Other libraries and framework includes +// Project includes +#include "lldb/Core/FormatEntity.h" +#include "lldb/Interpreter/OptionValue.h" + +namespace lldb_private { + +class OptionValueFormatEntity : public OptionValue +{ +public: + OptionValueFormatEntity (const char *default_format); + + virtual + ~OptionValueFormatEntity() + { + } + + //--------------------------------------------------------------------- + // Virtual subclass pure virtual overrides + //--------------------------------------------------------------------- + + OptionValue::Type + GetType () const override + { + return eTypeFormatEntity; + } + + void + DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; + + Error + SetValueFromCString (const char *value, + VarSetOperationType op = eVarSetOperationAssign) override; + + bool + Clear () override; + + lldb::OptionValueSP + DeepCopy () const override; + + size_t + AutoComplete (CommandInterpreter &interpreter, + const char *s, + int match_start_point, + int max_return_elements, + bool &word_complete, + StringList &matches) override; + + //--------------------------------------------------------------------- + // Subclass specific functions + //--------------------------------------------------------------------- + + FormatEntity::Entry & + GetCurrentValue() + { + return m_current_entry; + } + + const FormatEntity::Entry & + GetCurrentValue() const + { + return m_current_entry; + } + + void + SetCurrentValue (const FormatEntity::Entry &value) + { + m_current_entry = value; + } + + FormatEntity::Entry & + GetDefaultValue() + { + return m_default_entry; + } + + const FormatEntity::Entry & + GetDefaultValue() const + { + return m_default_entry; + } + + +protected: + std::string m_current_format; + std::string m_default_format; + FormatEntity::Entry m_current_entry; + FormatEntity::Entry m_default_entry; +}; + +} // namespace lldb_private + +#endif // liblldb_OptionValueFormatEntity_h_ diff --git a/include/lldb/Interpreter/OptionValueProperties.h b/include/lldb/Interpreter/OptionValueProperties.h index a67ea5d66e54..6f7f4995ed15 100644 --- a/include/lldb/Interpreter/OptionValueProperties.h +++ b/include/lldb/Interpreter/OptionValueProperties.h @@ -15,6 +15,7 @@ // Other libraries and framework includes // Project includes #include "lldb/Core/ConstString.h" +#include "lldb/Core/FormatEntity.h" #include "lldb/Core/UniqueCStringMap.h" #include "lldb/Interpreter/OptionValue.h" #include "lldb/Interpreter/Property.h" @@ -191,6 +192,9 @@ public: bool SetPropertyAtIndexAsEnumeration (const ExecutionContext *exe_ctx, uint32_t idx, int64_t new_value); + const FormatEntity::Entry * + GetPropertyAtIndexAsFormatEntity (const ExecutionContext *exe_ctx, uint32_t idx); + const RegularExpression * GetPropertyAtIndexAsOptionValueRegex (const ExecutionContext *exe_ctx, uint32_t idx) const; diff --git a/include/lldb/Interpreter/OptionValueRegex.h b/include/lldb/Interpreter/OptionValueRegex.h index bb8c4588e22a..295bb98b69e6 100644 --- a/include/lldb/Interpreter/OptionValueRegex.h +++ b/include/lldb/Interpreter/OptionValueRegex.h @@ -24,9 +24,9 @@ namespace lldb_private { class OptionValueRegex : public OptionValue { public: - OptionValueRegex (const char *value = NULL, uint32_t regex_flags = 0) : + OptionValueRegex (const char *value = NULL) : OptionValue(), - m_regex (value, regex_flags) + m_regex (value) { } @@ -75,10 +75,10 @@ public: } void - SetCurrentValue (const char *value, uint32_t regex_flags) + SetCurrentValue (const char *value) { if (value && value[0]) - m_regex.Compile (value, regex_flags); + m_regex.Compile (value); else m_regex.Clear(); } diff --git a/include/lldb/Interpreter/OptionValues.h b/include/lldb/Interpreter/OptionValues.h index c66fc4dab2f6..2ccab994674b 100644 --- a/include/lldb/Interpreter/OptionValues.h +++ b/include/lldb/Interpreter/OptionValues.h @@ -21,6 +21,7 @@ #include "lldb/Interpreter/OptionValueFileSpec.h" #include "lldb/Interpreter/OptionValueFileSpecList.h" #include "lldb/Interpreter/OptionValueFormat.h" +#include "lldb/Interpreter/OptionValueFormatEntity.h" #include "lldb/Interpreter/OptionValuePathMappings.h" #include "lldb/Interpreter/OptionValueProperties.h" #include "lldb/Interpreter/OptionValueRegex.h" diff --git a/include/lldb/Interpreter/ScriptInterpreter.h b/include/lldb/Interpreter/ScriptInterpreter.h index 35ba9491ded0..1b4b88161927 100644 --- a/include/lldb/Interpreter/ScriptInterpreter.h +++ b/include/lldb/Interpreter/ScriptInterpreter.h @@ -240,7 +240,13 @@ public: bool m_set_lldb_globals; bool m_maskout_errors; }; - + + virtual bool + Interrupt() + { + return false; + } + virtual bool ExecuteOneLine (const char *command, CommandReturnObject *result, @@ -290,13 +296,13 @@ public: } virtual bool - GenerateTypeScriptFunction (const char* oneliner, std::string& output, void* name_token = NULL) + GenerateTypeScriptFunction (const char* oneliner, std::string& output, const void* name_token = NULL) { return false; } virtual bool - GenerateTypeScriptFunction (StringList &input, std::string& output, void* name_token = NULL) + GenerateTypeScriptFunction (StringList &input, std::string& output, const void* name_token = NULL) { return false; } @@ -308,13 +314,13 @@ public: } virtual bool - GenerateTypeSynthClass (StringList &input, std::string& output, void* name_token = NULL) + GenerateTypeSynthClass (StringList &input, std::string& output, const void* name_token = NULL) { return false; } virtual bool - GenerateTypeSynthClass (const char* oneliner, std::string& output, void* name_token = NULL) + GenerateTypeSynthClass (const char* oneliner, std::string& output, const void* name_token = NULL) { return false; } diff --git a/include/lldb/Interpreter/ScriptInterpreterPython.h b/include/lldb/Interpreter/ScriptInterpreterPython.h index edcc4c44facb..94ed16e02ca2 100644 --- a/include/lldb/Interpreter/ScriptInterpreterPython.h +++ b/include/lldb/Interpreter/ScriptInterpreterPython.h @@ -41,125 +41,128 @@ public: ~ScriptInterpreterPython (); bool + Interrupt() override; + + bool ExecuteOneLine (const char *command, CommandReturnObject *result, - const ExecuteScriptOptions &options = ExecuteScriptOptions()); + const ExecuteScriptOptions &options = ExecuteScriptOptions()) override; void - ExecuteInterpreterLoop (); + ExecuteInterpreterLoop () override; bool ExecuteOneLineWithReturn (const char *in_string, ScriptInterpreter::ScriptReturnType return_type, void *ret_value, - const ExecuteScriptOptions &options = ExecuteScriptOptions()); + const ExecuteScriptOptions &options = ExecuteScriptOptions()) override; lldb_private::Error ExecuteMultipleLines (const char *in_string, - const ExecuteScriptOptions &options = ExecuteScriptOptions()); + const ExecuteScriptOptions &options = ExecuteScriptOptions()) override; Error - ExportFunctionDefinitionToInterpreter (StringList &function_def); + ExportFunctionDefinitionToInterpreter (StringList &function_def) override; bool - GenerateTypeScriptFunction (StringList &input, std::string& output, void* name_token = NULL); + GenerateTypeScriptFunction (StringList &input, std::string& output, const void* name_token = NULL) override; bool - GenerateTypeSynthClass (StringList &input, std::string& output, void* name_token = NULL); + GenerateTypeSynthClass (StringList &input, std::string& output, const void* name_token = NULL) override; bool - GenerateTypeSynthClass (const char* oneliner, std::string& output, void* name_token = NULL); + GenerateTypeSynthClass (const char* oneliner, std::string& output, const void* name_token = NULL) override; // use this if the function code is just a one-liner script bool - GenerateTypeScriptFunction (const char* oneliner, std::string& output, void* name_token = NULL); + GenerateTypeScriptFunction (const char* oneliner, std::string& output, const void* name_token = NULL) override; - virtual bool - GenerateScriptAliasFunction (StringList &input, std::string& output); + bool + GenerateScriptAliasFunction (StringList &input, std::string& output) override; lldb::ScriptInterpreterObjectSP CreateSyntheticScriptedProvider (const char *class_name, - lldb::ValueObjectSP valobj); + lldb::ValueObjectSP valobj) override; lldb::ScriptInterpreterObjectSP - virtual CreateScriptedThreadPlan (const char *class_name, - lldb::ThreadPlanSP thread_plan); + CreateScriptedThreadPlan (const char *class_name, + lldb::ThreadPlanSP thread_plan) override; - virtual bool + bool ScriptedThreadPlanExplainsStop (lldb::ScriptInterpreterObjectSP implementor_sp, Event *event, - bool &script_error); - virtual bool + bool &script_error) override; + bool ScriptedThreadPlanShouldStop (lldb::ScriptInterpreterObjectSP implementor_sp, Event *event, - bool &script_error); - virtual lldb::StateType + bool &script_error) override; + lldb::StateType ScriptedThreadPlanGetRunState (lldb::ScriptInterpreterObjectSP implementor_sp, - bool &script_error); + bool &script_error) override; - virtual lldb::ScriptInterpreterObjectSP + lldb::ScriptInterpreterObjectSP OSPlugin_CreatePluginObject (const char *class_name, - lldb::ProcessSP process_sp); + lldb::ProcessSP process_sp) override; - virtual lldb::ScriptInterpreterObjectSP - OSPlugin_RegisterInfo (lldb::ScriptInterpreterObjectSP os_plugin_object_sp); + lldb::ScriptInterpreterObjectSP + OSPlugin_RegisterInfo (lldb::ScriptInterpreterObjectSP os_plugin_object_sp) override; - virtual lldb::ScriptInterpreterObjectSP - OSPlugin_ThreadsInfo (lldb::ScriptInterpreterObjectSP os_plugin_object_sp); + lldb::ScriptInterpreterObjectSP + OSPlugin_ThreadsInfo (lldb::ScriptInterpreterObjectSP os_plugin_object_sp) override; - virtual lldb::ScriptInterpreterObjectSP + lldb::ScriptInterpreterObjectSP OSPlugin_RegisterContextData (lldb::ScriptInterpreterObjectSP os_plugin_object_sp, - lldb::tid_t thread_id); + lldb::tid_t thread_id) override; - virtual lldb::ScriptInterpreterObjectSP + lldb::ScriptInterpreterObjectSP OSPlugin_CreateThread (lldb::ScriptInterpreterObjectSP os_plugin_object_sp, lldb::tid_t tid, - lldb::addr_t context); + lldb::addr_t context) override; - virtual lldb::ScriptInterpreterObjectSP + lldb::ScriptInterpreterObjectSP LoadPluginModule (const FileSpec& file_spec, - lldb_private::Error& error); + lldb_private::Error& error) override; - virtual lldb::ScriptInterpreterObjectSP + lldb::ScriptInterpreterObjectSP GetDynamicSettings (lldb::ScriptInterpreterObjectSP plugin_module_sp, Target* target, const char* setting_name, - lldb_private::Error& error); + lldb_private::Error& error) override; - virtual size_t - CalculateNumChildren (const lldb::ScriptInterpreterObjectSP& implementor); + size_t + CalculateNumChildren (const lldb::ScriptInterpreterObjectSP& implementor) override; - virtual lldb::ValueObjectSP - GetChildAtIndex (const lldb::ScriptInterpreterObjectSP& implementor, uint32_t idx); + lldb::ValueObjectSP + GetChildAtIndex (const lldb::ScriptInterpreterObjectSP& implementor, uint32_t idx) override; - virtual int - GetIndexOfChildWithName (const lldb::ScriptInterpreterObjectSP& implementor, const char* child_name); + int + GetIndexOfChildWithName (const lldb::ScriptInterpreterObjectSP& implementor, const char* child_name) override; - virtual bool - UpdateSynthProviderInstance (const lldb::ScriptInterpreterObjectSP& implementor); + bool + UpdateSynthProviderInstance (const lldb::ScriptInterpreterObjectSP& implementor) override; - virtual bool - MightHaveChildrenSynthProviderInstance (const lldb::ScriptInterpreterObjectSP& implementor); + bool + MightHaveChildrenSynthProviderInstance (const lldb::ScriptInterpreterObjectSP& implementor) override; - virtual lldb::ValueObjectSP - GetSyntheticValue (const lldb::ScriptInterpreterObjectSP& implementor); + lldb::ValueObjectSP + GetSyntheticValue (const lldb::ScriptInterpreterObjectSP& implementor) override; - virtual bool + bool RunScriptBasedCommand(const char* impl_function, const char* args, ScriptedCommandSynchronicity synchronicity, lldb_private::CommandReturnObject& cmd_retobj, Error& error, - const lldb_private::ExecutionContext& exe_ctx); + const lldb_private::ExecutionContext& exe_ctx) override; Error - GenerateFunction(const char *signature, const StringList &input); + GenerateFunction(const char *signature, const StringList &input) override; Error - GenerateBreakpointCommandCallbackData (StringList &input, std::string& output); + GenerateBreakpointCommandCallbackData (StringList &input, std::string& output) override; bool - GenerateWatchpointCommandCallbackData (StringList &input, std::string& output); + GenerateWatchpointCommandCallbackData (StringList &input, std::string& output) override; // static size_t // GenerateBreakpointOptionsCommandCallback (void *baton, @@ -186,21 +189,21 @@ public: StoppointCallbackContext *context, lldb::user_id_t watch_id); - virtual bool + bool GetScriptedSummary (const char *function_name, lldb::ValueObjectSP valobj, lldb::ScriptInterpreterObjectSP& callee_wrapper_sp, const TypeSummaryOptions& options, - std::string& retval); + std::string& retval) override; - virtual void - Clear (); + void + Clear () override; - virtual bool - GetDocumentationForItem (const char* item, std::string& dest); + bool + GetDocumentationForItem (const char* item, std::string& dest) override; - virtual bool - CheckObjectExists (const char* name) + bool + CheckObjectExists (const char* name) override { if (!name || !name[0]) return false; @@ -208,76 +211,76 @@ public: return GetDocumentationForItem (name,temp); } - virtual bool + bool RunScriptFormatKeyword (const char* impl_function, Process* process, std::string& output, - Error& error); + Error& error) override; - virtual bool + bool RunScriptFormatKeyword (const char* impl_function, Thread* thread, std::string& output, - Error& error); + Error& error) override; - virtual bool + bool RunScriptFormatKeyword (const char* impl_function, Target* target, std::string& output, - Error& error); + Error& error) override; - virtual bool + bool RunScriptFormatKeyword (const char* impl_function, StackFrame* frame, std::string& output, - Error& error); + Error& error) override; - virtual bool + bool RunScriptFormatKeyword (const char* impl_function, ValueObject* value, std::string& output, - Error& error); + Error& error) override; - virtual bool + bool LoadScriptingModule (const char* filename, bool can_reload, bool init_session, lldb_private::Error& error, - lldb::ScriptInterpreterObjectSP* module_sp = nullptr); + lldb::ScriptInterpreterObjectSP* module_sp = nullptr) override; - virtual lldb::ScriptInterpreterObjectSP - MakeScriptObject (void* object); + lldb::ScriptInterpreterObjectSP + MakeScriptObject (void* object) override; - virtual std::unique_ptr<ScriptInterpreterLocker> - AcquireInterpreterLock (); + std::unique_ptr<ScriptInterpreterLocker> + AcquireInterpreterLock () override; void CollectDataForBreakpointCommandCallback (std::vector<BreakpointOptions *> &bp_options_vec, - CommandReturnObject &result); + CommandReturnObject &result) override; void CollectDataForWatchpointCommandCallback (WatchpointOptions *wp_options, - CommandReturnObject &result); + CommandReturnObject &result) override; /// Set the callback body text into the callback for the breakpoint. Error SetBreakpointCommandCallback (BreakpointOptions *bp_options, - const char *callback_body); + const char *callback_body) override; void SetBreakpointCommandCallbackFunction (BreakpointOptions *bp_options, - const char *function_name); + const char *function_name) override; /// Set a one-liner as the callback for the watchpoint. void SetWatchpointCommandCallback (WatchpointOptions *wp_options, - const char *oneliner); + const char *oneliner) override; StringList ReadCommandInputFromUser (FILE *in_file); virtual void - ResetOutputFileHandle (FILE *new_fh); + ResetOutputFileHandle (FILE *new_fh) override; static void InitializePrivate (); @@ -331,11 +334,11 @@ public: //---------------------------------------------------------------------- // IOHandlerDelegate //---------------------------------------------------------------------- - virtual void - IOHandlerActivated (IOHandler &io_handler); + void + IOHandlerActivated (IOHandler &io_handler) override; - virtual void - IOHandlerInputComplete (IOHandler &io_handler, std::string &data); + void + IOHandlerInputComplete (IOHandler &io_handler, std::string &data) override; protected: @@ -448,6 +451,26 @@ public: }; protected: + uint32_t + IsExecutingPython () const + { + return m_lock_count > 0; + } + + uint32_t + IncrementLockCount() + { + return ++m_lock_count; + } + + uint32_t + DecrementLockCount() + { + if (m_lock_count > 0) + --m_lock_count; + return m_lock_count; + } + enum ActiveIOHandler { eIOHandlerNone, eIOHandlerBreakpoint, @@ -480,6 +503,7 @@ protected: bool m_session_is_active; bool m_pty_slave_is_open; bool m_valid_session; + uint32_t m_lock_count; PyThreadState *m_command_thread_state; }; } // namespace lldb_private diff --git a/include/lldb/Symbol/ClangASTType.h b/include/lldb/Symbol/ClangASTType.h index ef23a8be645b..94c768780a00 100644 --- a/include/lldb/Symbol/ClangASTType.h +++ b/include/lldb/Symbol/ClangASTType.h @@ -97,6 +97,10 @@ public: bool *is_incomplete) const; bool + IsVectorType (ClangASTType *element_type, + uint64_t *size) const; + + bool IsArrayOfScalarType () const; bool @@ -347,10 +351,10 @@ public: //---------------------------------------------------------------------- uint64_t - GetByteSize () const; + GetByteSize (ExecutionContext *exe_ctx) const; uint64_t - GetBitSize () const; + GetBitSize (ExecutionContext *exe_ctx) const; lldb::Encoding GetEncoding (uint64_t &count) const; diff --git a/include/lldb/Symbol/ObjectFile.h b/include/lldb/Symbol/ObjectFile.h index bdc6ae8c9e81..8bcf92de42e5 100644 --- a/include/lldb/Symbol/ObjectFile.h +++ b/include/lldb/Symbol/ObjectFile.h @@ -767,6 +767,23 @@ public: return 0; } + + //------------------------------------------------------------------ + /// Return true if this file is a dynamic link editor (dyld) + /// + /// Often times dyld has symbols that mirror symbols in libc and + /// other shared libraries (like "malloc" and "free") and the user + /// does _not_ want to stop in these shared libraries by default. + /// We can ask the ObjectFile if it is such a file and should be + /// avoided for things like settings breakpoints and doing function + /// lookups for expressions. + //------------------------------------------------------------------ + virtual bool + GetIsDynamicLinkEditor() + { + return false; + } + //------------------------------------------------------------------ // Member Functions //------------------------------------------------------------------ diff --git a/include/lldb/Symbol/SymbolContext.h b/include/lldb/Symbol/SymbolContext.h index d40d1453cb17..64490627b84d 100644 --- a/include/lldb/Symbol/SymbolContext.h +++ b/include/lldb/Symbol/SymbolContext.h @@ -347,6 +347,7 @@ public: Block * block; ///< The Block for a given query LineEntry line_entry; ///< The LineEntry for a given query Symbol * symbol; ///< The Symbol for a given query + Variable * variable; ///< The global variable matching the given query }; diff --git a/include/lldb/Target/FileAction.h b/include/lldb/Target/FileAction.h index 228a9e6098c1..4015cbb5ea89 100644 --- a/include/lldb/Target/FileAction.h +++ b/include/lldb/Target/FileAction.h @@ -1,4 +1,4 @@ -//===-- ProcessLaunchInfo.h -------------------------------------*- C++ -*-===// +//===-- FileAction.h --------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // diff --git a/include/lldb/Target/LanguageRuntime.h b/include/lldb/Target/LanguageRuntime.h index 0aaa67c2382c..d5ed81956475 100644 --- a/include/lldb/Target/LanguageRuntime.h +++ b/include/lldb/Target/LanguageRuntime.h @@ -102,6 +102,13 @@ public: virtual lldb::SearchFilterSP CreateExceptionSearchFilter (); + + virtual bool + GetTypeBitSize (const ClangASTType& clang_type, + uint64_t &size) + { + return false; + } protected: //------------------------------------------------------------------ diff --git a/include/lldb/Target/ObjCLanguageRuntime.h b/include/lldb/Target/ObjCLanguageRuntime.h index a3fee91428fa..42a391478e3e 100644 --- a/include/lldb/Target/ObjCLanguageRuntime.h +++ b/include/lldb/Target/ObjCLanguageRuntime.h @@ -20,6 +20,7 @@ // Project includes #include "lldb/lldb-private.h" #include "lldb/Core/PluginInterface.h" +#include "lldb/Core/ThreadSafeDenseMap.h" #include "lldb/Symbol/ClangASTType.h" #include "lldb/Symbol/DeclVendor.h" #include "lldb/Symbol/Type.h" @@ -514,6 +515,10 @@ public: m_negative_complete_class_cache.clear(); } + virtual bool + GetTypeBitSize (const ClangASTType& clang_type, + uint64_t &size); + protected: //------------------------------------------------------------------ // Classes that inherit from ObjCLanguageRuntime can see and modify these @@ -610,11 +615,13 @@ private: typedef std::multimap<uint32_t, ObjCISA> HashToISAMap; typedef ISAToDescriptorMap::iterator ISAToDescriptorIterator; typedef HashToISAMap::iterator HashToISAIterator; + typedef ThreadSafeDenseMap<void*, uint64_t> TypeSizeCache; MsgImplMap m_impl_cache; LazyBool m_has_new_literals_and_indexing; ISAToDescriptorMap m_isa_to_descriptor; HashToISAMap m_hash_to_isa_map; + TypeSizeCache m_type_size_cache; protected: uint32_t m_isa_to_descriptor_stop_id; diff --git a/include/lldb/Target/Platform.h b/include/lldb/Target/Platform.h index 8b14cc2a0ece..f4596bd00f0b 100644 --- a/include/lldb/Target/Platform.h +++ b/include/lldb/Target/Platform.h @@ -28,7 +28,7 @@ // TODO pull NativeDelegate class out of NativeProcessProtocol so we // can just forward ref the NativeDelegate rather than include it here. -#include "../../../source/Host/common/NativeProcessProtocol.h" +#include "lldb/Host/common/NativeProcessProtocol.h" namespace lldb_private { @@ -380,6 +380,12 @@ namespace lldb_private { LaunchProcess (ProcessLaunchInfo &launch_info); //------------------------------------------------------------------ + /// Kill process on a platform. + //------------------------------------------------------------------ + virtual Error + KillProcess (const lldb::pid_t pid); + + //------------------------------------------------------------------ /// Lets a platform answer if it is compatible with a given /// architecture and the target triple contained within. //------------------------------------------------------------------ @@ -569,7 +575,7 @@ namespace lldb_private { // Appends the platform-specific options required to find the modules for the current platform. virtual void - AddClangModuleCompilationOptions (std::vector<std::string> &options); + AddClangModuleCompilationOptions (Target *target, std::vector<std::string> &options); ConstString GetWorkingDirectory (); @@ -952,8 +958,7 @@ namespace lldb_private { uint32_t m_update_os_version; ArchSpec m_system_arch; // The architecture of the kernel or the remote platform typedef std::map<uint32_t, ConstString> IDToNameMap; - Mutex m_uid_map_mutex; - Mutex m_gid_map_mutex; + Mutex m_mutex; // Mutex for modifying Platform data structures that should only be used for non-reentrant code IDToNameMap m_uid_map; IDToNameMap m_gid_map; size_t m_max_uid_name_len; @@ -967,7 +972,6 @@ namespace lldb_private { std::string m_local_cache_directory; std::vector<ConstString> m_trap_handlers; bool m_calculated_trap_handlers; - Mutex m_trap_handler_mutex; //------------------------------------------------------------------ /// Ask the Platform subclass to fill in the list of trap handler names @@ -988,7 +992,7 @@ namespace lldb_private { const char * GetCachedUserName (uint32_t uid) { - Mutex::Locker locker (m_uid_map_mutex); + Mutex::Locker locker (m_mutex); IDToNameMap::iterator pos = m_uid_map.find (uid); if (pos != m_uid_map.end()) { @@ -1004,7 +1008,7 @@ namespace lldb_private { const char * SetCachedUserName (uint32_t uid, const char *name, size_t name_len) { - Mutex::Locker locker (m_uid_map_mutex); + Mutex::Locker locker (m_mutex); ConstString const_name (name); m_uid_map[uid] = const_name; if (m_max_uid_name_len < name_len) @@ -1016,7 +1020,7 @@ namespace lldb_private { void SetUserNameNotFound (uint32_t uid) { - Mutex::Locker locker (m_uid_map_mutex); + Mutex::Locker locker (m_mutex); m_uid_map[uid] = ConstString(); } @@ -1024,14 +1028,14 @@ namespace lldb_private { void ClearCachedUserNames () { - Mutex::Locker locker (m_uid_map_mutex); + Mutex::Locker locker (m_mutex); m_uid_map.clear(); } const char * GetCachedGroupName (uint32_t gid) { - Mutex::Locker locker (m_gid_map_mutex); + Mutex::Locker locker (m_mutex); IDToNameMap::iterator pos = m_gid_map.find (gid); if (pos != m_gid_map.end()) { @@ -1047,7 +1051,7 @@ namespace lldb_private { const char * SetCachedGroupName (uint32_t gid, const char *name, size_t name_len) { - Mutex::Locker locker (m_gid_map_mutex); + Mutex::Locker locker (m_mutex); ConstString const_name (name); m_gid_map[gid] = const_name; if (m_max_gid_name_len < name_len) @@ -1059,14 +1063,14 @@ namespace lldb_private { void SetGroupNameNotFound (uint32_t gid) { - Mutex::Locker locker (m_gid_map_mutex); + Mutex::Locker locker (m_mutex); m_gid_map[gid] = ConstString(); } void ClearCachedGroupNames () { - Mutex::Locker locker (m_gid_map_mutex); + Mutex::Locker locker (m_mutex); m_gid_map.clear(); } diff --git a/include/lldb/Target/Process.h b/include/lldb/Target/Process.h index e04de511c797..6608391b94fd 100644 --- a/include/lldb/Target/Process.h +++ b/include/lldb/Target/Process.h @@ -678,13 +678,16 @@ public: bool IsLastResumeForUserExpression () const { + // If we haven't yet resumed the target, then it can't be for a user expression... + if (m_resume_id == 0) + return false; + return m_resume_id == m_last_user_expression_resume; } void SetRunningUserExpression (bool on) { - // REMOVEME printf ("Setting running user expression %s at resume id %d - value: %d.\n", on ? "on" : "off", m_resume_id, m_running_user_expression); if (on) m_running_user_expression++; else @@ -3177,6 +3180,7 @@ protected: lldb::IOHandlerSP m_process_input_reader; Communication m_stdio_communication; Mutex m_stdio_communication_mutex; + bool m_stdio_disable; /// Remember process launch setting std::string m_stdout_data; std::string m_stderr_data; Mutex m_profile_data_comm_mutex; diff --git a/include/lldb/Utility/AnsiTerminal.h b/include/lldb/Utility/AnsiTerminal.h index 036950c1bd45..9a5117ae74ea 100644 --- a/include/lldb/Utility/AnsiTerminal.h +++ b/include/lldb/Utility/AnsiTerminal.h @@ -50,37 +50,6 @@ namespace lldb_utility { namespace ansi { - const char *k_escape_start = "\033["; - const char *k_escape_end = "m"; - - const char *k_fg_black = "30"; - const char *k_fg_red = "31"; - const char *k_fg_green = "32"; - const char *k_fg_yellow = "33"; - const char *k_fg_blue = "34"; - const char *k_fg_purple = "35"; - const char *k_fg_cyan = "36"; - const char *k_fg_white = "37"; - - const char *k_bg_black = "40"; - const char *k_bg_red = "41"; - const char *k_bg_green = "42"; - const char *k_bg_yellow = "43"; - const char *k_bg_blue = "44"; - const char *k_bg_purple = "45"; - const char *k_bg_cyan = "46"; - const char *k_bg_white = "47"; - - const char *k_ctrl_normal = "0"; - const char *k_ctrl_bold = "1"; - const char *k_ctrl_faint = "2"; - const char *k_ctrl_italic = "3"; - const char *k_ctrl_underline = "4"; - const char *k_ctrl_slow_blink = "5"; - const char *k_ctrl_fast_blink = "6"; - const char *k_ctrl_negative = "7"; - const char *k_ctrl_conceal = "8"; - const char *k_ctrl_crossed_out = "9"; inline std::string FormatAnsiTerminalCodes(const char *format, bool do_color = true) diff --git a/include/lldb/Utility/ProcessStructReader.h b/include/lldb/Utility/ProcessStructReader.h index 7b05d93151aa..d053b702462e 100644 --- a/include/lldb/Utility/ProcessStructReader.h +++ b/include/lldb/Utility/ProcessStructReader.h @@ -59,7 +59,7 @@ namespace lldb_private { // no support for bitfields in here (yet) if (is_bitfield) return; - auto size = field_type.GetByteSize(); + auto size = field_type.GetByteSize(nullptr); // no support for things larger than a uint64_t (yet) if (size > 8) return; @@ -67,7 +67,7 @@ namespace lldb_private { size_t byte_index = static_cast<size_t>(bit_offset / 8); m_fields[const_name] = FieldImpl{field_type, byte_index, static_cast<size_t>(size)}; } - size_t total_size = struct_type.GetByteSize(); + size_t total_size = struct_type.GetByteSize(nullptr); lldb::DataBufferSP buffer_sp(new DataBufferHeap(total_size,0)); Error error; process->ReadMemoryFromInferior(base_addr, diff --git a/include/lldb/lldb-enumerations.h b/include/lldb/lldb-enumerations.h index 87ee14875734..f70ee0cd7b28 100644 --- a/include/lldb/lldb-enumerations.h +++ b/include/lldb/lldb-enumerations.h @@ -290,7 +290,11 @@ namespace lldb { eSymbolContextBlock = (1u << 4), ///< Set when the deepest \a block is requested from a query, or was located in query results eSymbolContextLineEntry = (1u << 5), ///< Set when \a line_entry is requested from a query, or was located in query results eSymbolContextSymbol = (1u << 6), ///< Set when \a symbol is requested from a query, or was located in query results - eSymbolContextEverything = ((eSymbolContextSymbol << 1) - 1u) ///< Indicates to try and lookup everything up during a query. + eSymbolContextEverything = ((eSymbolContextSymbol << 1) - 1u), ///< Indicates to try and lookup everything up during a routine symbol context query. + eSymbolContextVariable = (1u << 7) ///< Set when \a global or static variable is requested from a query, or was located in query results. + ///< eSymbolContextVariable is potentially expensive to lookup so it isn't included in + ///< eSymbolContextEverything which stops it from being used during frame PC lookups and + ///< many other potential address to symbol context lookups. } SymbolContextItem; typedef enum Permissions @@ -374,6 +378,8 @@ namespace lldb { eLanguageTypeUPC = 0x0012, ///< Unified Parallel C. eLanguageTypeD = 0x0013, ///< D. eLanguageTypePython = 0x0014, ///< Python. + // NOTE: The below are DWARF5 constants, subject to change upon + // completion of the DWARF5 specification eLanguageTypeOpenCL = 0x0015, ///< OpenCL. eLanguageTypeGo = 0x0016, ///< Go. eLanguageTypeModula3 = 0x0017, ///< Modula 3. @@ -386,6 +392,9 @@ namespace lldb { eLanguageTypeSwift = 0x001e, ///< Swift. eLanguageTypeJulia = 0x001f, ///< Julia. eLanguageTypeDylan = 0x0020, ///< Dylan. + eLanguageTypeC_plus_plus_14 = 0x0021, ///< ISO C++:2014. + eLanguageTypeFortran03 = 0x0022, ///< ISO Fortran 2003. + eLanguageTypeFortran08 = 0x0023, ///< ISO Fortran 2008. eNumLanguageTypes } LanguageType; diff --git a/include/lldb/lldb-forward.h b/include/lldb/lldb-forward.h index 1ecb2f179bb2..53f59dd62096 100644 --- a/include/lldb/lldb-forward.h +++ b/include/lldb/lldb-forward.h @@ -146,6 +146,7 @@ class OptionValueEnumeration; class OptionValueFileSpec; class OptionValueFileSpecList; class OptionValueFormat; +class OptionValueFormatEntity; class OptionValuePathMappings; class OptionValueProperties; class OptionValueRegex; |