diff options
Diffstat (limited to 'include/lldb/Core')
-rw-r--r-- | include/lldb/Core/ArchSpec.h | 15 | ||||
-rw-r--r-- | include/lldb/Core/Broadcaster.h | 7 | ||||
-rw-r--r-- | include/lldb/Core/Connection.h | 22 | ||||
-rw-r--r-- | include/lldb/Core/ConnectionMachPort.h | 4 | ||||
-rw-r--r-- | include/lldb/Core/ConnectionSharedMemory.h | 3 | ||||
-rw-r--r-- | include/lldb/Core/Debugger.h | 26 | ||||
-rw-r--r-- | include/lldb/Core/Disassembler.h | 6 | ||||
-rw-r--r-- | include/lldb/Core/FormatEntity.h | 260 | ||||
-rw-r--r-- | include/lldb/Core/Mangled.h | 19 | ||||
-rw-r--r-- | include/lldb/Core/Module.h | 16 | ||||
-rw-r--r-- | include/lldb/Core/RegularExpression.h | 41 | ||||
-rw-r--r-- | include/lldb/Core/ValueObject.h | 12 | ||||
-rw-r--r-- | include/lldb/Core/ValueObjectSyntheticFilter.h | 3 |
13 files changed, 353 insertions, 81 deletions
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 (); |