diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2019-01-19 10:06:29 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2019-01-19 10:06:29 +0000 |
| commit | 94994d372d014ce4c8758b9605d63fae651bd8aa (patch) | |
| tree | 51c0b708bd59f205d6b35cb2a8c24d62f0c33d77 /include/lldb/Expression | |
| parent | 39be7ce23363d12ae3e49aeb1fdb2bfeb892e836 (diff) | |
Notes
Diffstat (limited to 'include/lldb/Expression')
| -rw-r--r-- | include/lldb/Expression/DWARFExpression.h | 9 | ||||
| -rw-r--r-- | include/lldb/Expression/Expression.h | 4 | ||||
| -rw-r--r-- | include/lldb/Expression/ExpressionParser.h | 36 | ||||
| -rw-r--r-- | include/lldb/Expression/ExpressionVariable.h | 4 | ||||
| -rw-r--r-- | include/lldb/Expression/FunctionCaller.h | 4 | ||||
| -rw-r--r-- | include/lldb/Expression/IRExecutionUnit.h | 6 | ||||
| -rw-r--r-- | include/lldb/Expression/IRMemoryMap.h | 28 | ||||
| -rw-r--r-- | include/lldb/Expression/LLVMUserExpression.h | 4 | ||||
| -rw-r--r-- | include/lldb/Expression/Materializer.h | 4 | ||||
| -rw-r--r-- | include/lldb/Expression/REPL.h | 6 | ||||
| -rw-r--r-- | include/lldb/Expression/UserExpression.h | 32 | ||||
| -rw-r--r-- | include/lldb/Expression/UtilityFunction.h | 4 |
12 files changed, 87 insertions, 54 deletions
diff --git a/include/lldb/Expression/DWARFExpression.h b/include/lldb/Expression/DWARFExpression.h index b4bd9697da58..cdede56d86d9 100644 --- a/include/lldb/Expression/DWARFExpression.h +++ b/include/lldb/Expression/DWARFExpression.h @@ -12,8 +12,8 @@ #include "lldb/Core/Address.h" #include "lldb/Core/Disassembler.h" -#include "lldb/Core/Scalar.h" #include "lldb/Utility/DataExtractor.h" +#include "lldb/Utility/Scalar.h" #include "lldb/Utility/Status.h" #include "lldb/lldb-private.h" #include <functional> @@ -40,7 +40,10 @@ public: enum LocationListFormat : uint8_t { NonLocationList, // Not a location list RegularLocationList, // Location list format used in non-split dwarf files - SplitDwarfLocationList, // Location list format used in split dwarf files + SplitDwarfLocationList, // Location list format used in pre-DWARF v5 split + // dwarf files (.debug_loc.dwo) + LocLists, // Location list format used in DWARF v5 + // (.debug_loclists/.debug_loclists.dwo). }; //------------------------------------------------------------------ @@ -153,6 +156,8 @@ public: bool Update_DW_OP_addr(lldb::addr_t file_addr); + void SetModule(const lldb::ModuleSP &module) { m_module_wp = module; } + bool ContainsThreadLocalStorage() const; bool LinkThreadLocalStorage( diff --git a/include/lldb/Expression/Expression.h b/include/lldb/Expression/Expression.h index 6b9363864722..162dcd3e4672 100644 --- a/include/lldb/Expression/Expression.h +++ b/include/lldb/Expression/Expression.h @@ -10,14 +10,10 @@ #ifndef liblldb_Expression_h_ #define liblldb_Expression_h_ -// C Includes -// C++ Includes #include <map> #include <string> #include <vector> -// Other libraries and framework includes -// Project includes #include "lldb/Expression/ExpressionTypeSystemHelper.h" #include "lldb/lldb-forward.h" diff --git a/include/lldb/Expression/ExpressionParser.h b/include/lldb/Expression/ExpressionParser.h index 66957926650a..7d337bd00ca6 100644 --- a/include/lldb/Expression/ExpressionParser.h +++ b/include/lldb/Expression/ExpressionParser.h @@ -10,6 +10,7 @@ #ifndef liblldb_ExpressionParser_h_ #define liblldb_ExpressionParser_h_ +#include "lldb/Utility/CompletionRequest.h" #include "lldb/Utility/Status.h" #include "lldb/lldb-private-enumerations.h" #include "lldb/lldb-public.h" @@ -50,6 +51,41 @@ public: virtual ~ExpressionParser(){}; //------------------------------------------------------------------ + /// Attempts to find possible command line completions for the given + /// expression. + /// + /// @param[out] request + /// The completion request to fill out. The completion should be a string + /// that would complete the current token at the cursor position. + /// Note that the string in the list replaces the current token + /// in the command line. + /// + /// @param[in] line + /// The line with the completion cursor inside the expression as a string. + /// The first line in the expression has the number 0. + /// + /// @param[in] pos + /// The character position in the line with the completion cursor. + /// If the value is 0, then the cursor is on top of the first character + /// in the line (i.e. the user has requested completion from the start of + /// the expression). + /// + /// @param[in] typed_pos + /// The cursor position in the line as typed by the user. If the user + /// expression has not been transformed in some form (e.g. wrapping it + /// in a function body for C languages), then this is equal to the + /// 'pos' parameter. The semantics of this value are otherwise equal to + /// 'pos' (e.g. a value of 0 means the cursor is at start of the + /// expression). + /// + /// @return + /// True if we added any completion results to the output; + /// false otherwise. + //------------------------------------------------------------------ + virtual bool Complete(CompletionRequest &request, unsigned line, unsigned pos, + unsigned typed_pos) = 0; + + //------------------------------------------------------------------ /// Parse a single expression and convert it to IR using Clang. Don't wrap /// the expression in anything at all. /// diff --git a/include/lldb/Expression/ExpressionVariable.h b/include/lldb/Expression/ExpressionVariable.h index 89b0500faf9c..01e9c416e7c0 100644 --- a/include/lldb/Expression/ExpressionVariable.h +++ b/include/lldb/Expression/ExpressionVariable.h @@ -10,15 +10,11 @@ #ifndef liblldb_ExpressionVariable_h_ #define liblldb_ExpressionVariable_h_ -// C Includes -// C++ Includes #include <memory> #include <vector> -// Other libraries and framework includes #include "llvm/ADT/DenseMap.h" -// Project includes #include "lldb/Core/ValueObject.h" #include "lldb/Utility/ConstString.h" #include "lldb/lldb-public.h" diff --git a/include/lldb/Expression/FunctionCaller.h b/include/lldb/Expression/FunctionCaller.h index c36263e34240..0ec7e202dac9 100644 --- a/include/lldb/Expression/FunctionCaller.h +++ b/include/lldb/Expression/FunctionCaller.h @@ -10,15 +10,11 @@ #ifndef liblldb_FunctionCaller_h_ #define liblldb_FunctionCaller_h_ -// C Includes -// C++ Includes #include <list> #include <memory> #include <string> #include <vector> -// Other libraries and framework includes -// Project includes #include "lldb/Core/Address.h" #include "lldb/Core/Value.h" #include "lldb/Expression/Expression.h" diff --git a/include/lldb/Expression/IRExecutionUnit.h b/include/lldb/Expression/IRExecutionUnit.h index e73f8956d955..b966d135deab 100644 --- a/include/lldb/Expression/IRExecutionUnit.h +++ b/include/lldb/Expression/IRExecutionUnit.h @@ -10,18 +10,14 @@ #ifndef liblldb_IRExecutionUnit_h_ #define liblldb_IRExecutionUnit_h_ -// C Includes -// C++ Includes #include <atomic> #include <memory> #include <string> #include <vector> -// Other libraries and framework includes #include "llvm/ExecutionEngine/SectionMemoryManager.h" #include "llvm/IR/Module.h" -// Project includes #include "lldb/Expression/IRMemoryMap.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/SymbolContext.h" @@ -112,7 +108,7 @@ public: void PopulateSectionList(lldb_private::ObjectFile *obj_file, lldb_private::SectionList §ion_list) override; - bool GetArchitecture(lldb_private::ArchSpec &arch) override; + ArchSpec GetArchitecture() override; lldb::ModuleSP GetJITModule(); diff --git a/include/lldb/Expression/IRMemoryMap.h b/include/lldb/Expression/IRMemoryMap.h index df8a03f4763f..026ca6b98110 100644 --- a/include/lldb/Expression/IRMemoryMap.h +++ b/include/lldb/Expression/IRMemoryMap.h @@ -39,7 +39,7 @@ public: IRMemoryMap(lldb::TargetSP target_sp); ~IRMemoryMap(); - enum AllocationPolicy { + enum AllocationPolicy : uint8_t { eAllocationPolicyInvalid = 0, ///< It is an error for an allocation to have this policy. eAllocationPolicyHostOnly, ///< This allocation was created in the host and @@ -91,32 +91,32 @@ protected: private: struct Allocation { lldb::addr_t - m_process_alloc; ///< The (unaligned) base for the remote allocation + m_process_alloc; ///< The (unaligned) base for the remote allocation. lldb::addr_t - m_process_start; ///< The base address of the allocation in the process - size_t m_size; ///< The size of the requested allocation - uint32_t m_permissions; ///< The access permissions on the memory in the - ///process. In the host, the memory is always - ///read/write. - uint8_t m_alignment; ///< The alignment of the requested allocation + m_process_start; ///< The base address of the allocation in the process. + size_t m_size; ///< The size of the requested allocation. DataBufferHeap m_data; - ///< Flags + /// Flags. Keep these grouped together to avoid structure padding. AllocationPolicy m_policy; bool m_leak; + uint8_t m_permissions; ///< The access permissions on the memory in the + /// process. In the host, the memory is always + /// read/write. + uint8_t m_alignment; ///< The alignment of the requested allocation. public: Allocation(lldb::addr_t process_alloc, lldb::addr_t process_start, size_t size, uint32_t permissions, uint8_t alignment, AllocationPolicy m_policy); - Allocation() - : m_process_alloc(LLDB_INVALID_ADDRESS), - m_process_start(LLDB_INVALID_ADDRESS), m_size(0), m_permissions(0), - m_alignment(0), m_data(), m_policy(eAllocationPolicyInvalid), - m_leak(false) {} + DISALLOW_COPY_AND_ASSIGN(Allocation); }; + static_assert(sizeof(Allocation) <= + (4 * sizeof(lldb::addr_t)) + sizeof(DataBufferHeap), + "IRMemoryMap::Allocation is larger than expected"); + lldb::ProcessWP m_process_wp; lldb::TargetWP m_target_wp; typedef std::map<lldb::addr_t, Allocation> AllocationMap; diff --git a/include/lldb/Expression/LLVMUserExpression.h b/include/lldb/Expression/LLVMUserExpression.h index a2f87e8a6e25..1ba822265fca 100644 --- a/include/lldb/Expression/LLVMUserExpression.h +++ b/include/lldb/Expression/LLVMUserExpression.h @@ -10,16 +10,12 @@ #ifndef liblldb_LLVMUserExpression_h #define liblldb_LLVMUserExpression_h -// C Includes -// C++ Includes #include <map> #include <string> #include <vector> -// Other libraries and framework includes #include "llvm/IR/LegacyPassManager.h" -// Project includes #include "lldb/Expression/UserExpression.h" namespace lldb_private { diff --git a/include/lldb/Expression/Materializer.h b/include/lldb/Expression/Materializer.h index b86bc656d6b5..0bdfd372e921 100644 --- a/include/lldb/Expression/Materializer.h +++ b/include/lldb/Expression/Materializer.h @@ -10,13 +10,9 @@ #ifndef liblldb_Materializer_h #define liblldb_Materializer_h -// C Includes -// C++ Includes #include <memory> #include <vector> -// Other libraries and framework includes -// Project includes #include "lldb/Expression/IRMemoryMap.h" #include "lldb/Symbol/TaggedASTType.h" #include "lldb/Target/StackFrame.h" diff --git a/include/lldb/Expression/REPL.h b/include/lldb/Expression/REPL.h index 0c1e97fec259..f7780772cbea 100644 --- a/include/lldb/Expression/REPL.h +++ b/include/lldb/Expression/REPL.h @@ -10,12 +10,8 @@ #ifndef lldb_REPL_h #define lldb_REPL_h -// C Includes -// C++ Includes #include <string> -// Other libraries and framework includes -// Project includes #include "lldb/../../source/Commands/CommandObjectExpression.h" #include "lldb/Interpreter/OptionGroupFormat.h" #include "lldb/Interpreter/OptionGroupValueObjectDisplay.h" @@ -117,7 +113,7 @@ public: int IOHandlerComplete(IOHandler &io_handler, const char *current_line, const char *cursor, const char *last_char, int skip_first_n_matches, int max_matches, - StringList &matches) override; + StringList &matches, StringList &descriptions) override; protected: static int CalculateActualIndentation(const StringList &lines); diff --git a/include/lldb/Expression/UserExpression.h b/include/lldb/Expression/UserExpression.h index 96ca80c882e5..812d7e9a0eac 100644 --- a/include/lldb/Expression/UserExpression.h +++ b/include/lldb/Expression/UserExpression.h @@ -10,14 +10,10 @@ #ifndef liblldb_UserExpression_h_ #define liblldb_UserExpression_h_ -// C Includes -// C++ Includes #include <memory> #include <string> #include <vector> -// Other libraries and framework includes -// Project includes #include "lldb/Core/Address.h" #include "lldb/Expression/Expression.h" #include "lldb/Expression/Materializer.h" @@ -98,6 +94,34 @@ public: lldb_private::ExecutionPolicy execution_policy, bool keep_result_in_memory, bool generate_debug_info) = 0; + //------------------------------------------------------------------ + /// Attempts to find possible command line completions for the given + /// (possible incomplete) user expression. + /// + /// @param[in] exe_ctx + /// The execution context to use when looking up entities that + /// are needed for parsing and completing (locations of functions, types + /// of variables, persistent variables, etc.) + /// + /// @param[out] request + /// The completion request to fill out. The completion should be a string + /// that would complete the current token at the cursor position. + /// Note that the string in the list replaces the current token + /// in the command line. + /// + /// @param[in] complete_pos + /// The position of the cursor inside the user expression string. + /// The completion process starts on the token that the cursor is in. + /// + /// @return + /// True if we added any completion results to the output; + /// false otherwise. + //------------------------------------------------------------------ + virtual bool Complete(ExecutionContext &exe_ctx, CompletionRequest &request, + unsigned complete_pos) { + return false; + } + virtual bool CanInterpret() = 0; bool MatchesContext(ExecutionContext &exe_ctx); diff --git a/include/lldb/Expression/UtilityFunction.h b/include/lldb/Expression/UtilityFunction.h index 5d4bc8676b95..4c87f4d10479 100644 --- a/include/lldb/Expression/UtilityFunction.h +++ b/include/lldb/Expression/UtilityFunction.h @@ -11,13 +11,9 @@ #ifndef liblldb_UtilityFunction_h_ #define liblldb_UtilityFunction_h_ -// C Includes -// C++ Includes #include <memory> #include <string> -// Other libraries and framework includes -// Project includes #include "lldb/Expression/Expression.h" #include "lldb/lldb-forward.h" #include "lldb/lldb-private.h" |
