diff options
| author | Ed Maste <emaste@FreeBSD.org> | 2013-11-06 16:48:53 +0000 |
|---|---|---|
| committer | Ed Maste <emaste@FreeBSD.org> | 2013-11-06 16:48:53 +0000 |
| commit | f21a844f60ae6c74fcf1fddca32461acce3c1ee0 (patch) | |
| tree | 56d79f94966870db1cecd65a7264510a25fd1cba /include/lldb/Expression | |
| parent | 37d22554be9f5a677dad2a95b7ef22fe59c66a8a (diff) | |
Notes
Diffstat (limited to 'include/lldb/Expression')
| -rw-r--r-- | include/lldb/Expression/ClangExpressionDeclMap.h | 14 | ||||
| -rw-r--r-- | include/lldb/Expression/ClangFunction.h | 65 | ||||
| -rw-r--r-- | include/lldb/Expression/ClangUserExpression.h | 83 | ||||
| -rw-r--r-- | include/lldb/Expression/DWARFExpression.h | 21 | ||||
| -rw-r--r-- | include/lldb/Expression/IRExecutionUnit.h | 11 | ||||
| -rw-r--r-- | include/lldb/Expression/IRForTarget.h | 1 |
6 files changed, 82 insertions, 113 deletions
diff --git a/include/lldb/Expression/ClangExpressionDeclMap.h b/include/lldb/Expression/ClangExpressionDeclMap.h index b2a43e0ac75f4..b04e1bd6f1163 100644 --- a/include/lldb/Expression/ClangExpressionDeclMap.h +++ b/include/lldb/Expression/ClangExpressionDeclMap.h @@ -291,6 +291,9 @@ public: /// @param[in] name /// The name of the symbol. /// + /// @param[in] module + /// The module to limit the search to. This can be NULL + /// /// @return /// Valid load address for the symbol //------------------------------------------------------------------ @@ -298,7 +301,8 @@ public: GetSymbolAddress (Target &target, Process *process, const ConstString &name, - lldb::SymbolType symbol_type); + lldb::SymbolType symbol_type, + Module *module = NULL); lldb::addr_t GetSymbolAddress (const ConstString &name, @@ -504,12 +508,16 @@ private: /// @param[in] name /// The name as a plain C string. /// + /// @param[in] module + /// The module to limit the search to. This can be NULL + /// /// @return /// The LLDB Symbol found, or NULL if none was found. - //--------------------------------------------------------- + //------------------------------------------------------------------ const Symbol * FindGlobalDataSymbol (Target &target, - const ConstString &name); + const ConstString &name, + Module *module = NULL); //------------------------------------------------------------------ /// Given a target, find a variable that matches the given name and diff --git a/include/lldb/Expression/ClangFunction.h b/include/lldb/Expression/ClangFunction.h index 3f96f7bd31175..9cb22ed15cb5d 100644 --- a/include/lldb/Expression/ClangFunction.h +++ b/include/lldb/Expression/ClangFunction.h @@ -67,8 +67,8 @@ class ClangFunction : public ClangExpression { friend class ASTStructExtractor; public: - //------------------------------------------------------------------ - /// Constructor + //------------------------------------------------------------------ + /// Constructor /// /// @param[in] exe_scope /// An execution context scope that gets us at least a target and @@ -84,14 +84,14 @@ public: /// @param[in] arg_value_list /// The default values to use when calling this function. Can /// be overridden using WriteFunctionArguments(). - //------------------------------------------------------------------ - ClangFunction (ExecutionContextScope &exe_scope, + //------------------------------------------------------------------ + ClangFunction (ExecutionContextScope &exe_scope, Function &function_ptr, ClangASTContext *ast_context, const ValueList &arg_value_list); //------------------------------------------------------------------ - /// Constructor + /// Constructor /// /// @param[in] exe_scope /// An execution context scope that gets us at least a target and @@ -110,32 +110,32 @@ public: /// @param[in] arg_value_list /// The default values to use when calling this function. Can /// be overridden using WriteFunctionArguments(). - //------------------------------------------------------------------ - ClangFunction (ExecutionContextScope &exe_scope, + //------------------------------------------------------------------ + ClangFunction (ExecutionContextScope &exe_scope, const ClangASTType &return_type, const Address& function_address, const ValueList &arg_value_list); //------------------------------------------------------------------ - /// Destructor - //------------------------------------------------------------------ - virtual + /// Destructor + //------------------------------------------------------------------ + virtual ~ClangFunction(); //------------------------------------------------------------------ - /// Compile the wrapper function + /// Compile the wrapper function /// /// @param[in] errors /// The stream to print parser errors to. /// /// @return /// The number of errors. - //------------------------------------------------------------------ + //------------------------------------------------------------------ unsigned CompileFunction (Stream &errors); //------------------------------------------------------------------ - /// Insert the default function wrapper and its default argument struct + /// Insert the default function wrapper and its default argument struct /// /// @param[in] exe_ctx /// The execution context to insert the function and its arguments @@ -151,14 +151,14 @@ public: /// /// @return /// True on success; false otherwise. - //------------------------------------------------------------------ + //------------------------------------------------------------------ bool InsertFunction (ExecutionContext &exe_ctx, lldb::addr_t &args_addr_ref, Stream &errors); //------------------------------------------------------------------ - /// Insert the default function wrapper (using the JIT) + /// Insert the default function wrapper (using the JIT) /// /// @param[in] exe_ctx /// The execution context to insert the function and its arguments @@ -169,12 +169,12 @@ public: /// /// @return /// True on success; false otherwise. - //------------------------------------------------------------------ + //------------------------------------------------------------------ bool WriteFunctionWrapper (ExecutionContext &exe_ctx, Stream &errors); //------------------------------------------------------------------ - /// Insert the default function argument struct + /// Insert the default function argument struct /// /// @param[in] exe_ctx /// The execution context to insert the function and its arguments @@ -190,13 +190,13 @@ public: /// /// @return /// True on success; false otherwise. - //------------------------------------------------------------------ + //------------------------------------------------------------------ bool WriteFunctionArguments (ExecutionContext &exe_ctx, lldb::addr_t &args_addr_ref, Stream &errors); //------------------------------------------------------------------ - /// Insert an argument struct with a non-default function address and + /// Insert an argument struct with a non-default function address and /// non-default argument values /// /// @param[in] exe_ctx @@ -219,7 +219,7 @@ public: /// /// @return /// True on success; false otherwise. - //------------------------------------------------------------------ + //------------------------------------------------------------------ bool WriteFunctionArguments (ExecutionContext &exe_ctx, lldb::addr_t &args_addr_ref, Address function_address, @@ -227,7 +227,7 @@ public: Stream &errors); //------------------------------------------------------------------ - /// [Static] Execute a function, passing it a single void* parameter. + /// [Static] Execute a function, passing it a single void* parameter. /// ClangFunction uses this to call the wrapper function. /// /// @param[in] exe_ctx @@ -266,7 +266,7 @@ public: /// /// @return /// Returns one of the ExecutionResults enum indicating function call status. - //------------------------------------------------------------------ + //------------------------------------------------------------------ static ExecutionResults ExecuteFunction (ExecutionContext &exe_ctx, lldb::addr_t function_address, @@ -446,7 +446,7 @@ public: /// /// @return /// A ThreadPlan for executing the function. - //------------------------------------------------------------------ + //------------------------------------------------------------------ static ThreadPlan * GetThreadPlanToCallFunction (ExecutionContext &exe_ctx, lldb::addr_t func_addr, @@ -482,7 +482,7 @@ public: /// /// @return /// A ThreadPlan for executing the function. - //------------------------------------------------------------------ + //------------------------------------------------------------------ ThreadPlan * GetThreadPlanToCallFunction (ExecutionContext &exe_ctx, lldb::addr_t &args_addr_ref, @@ -514,7 +514,7 @@ public: /// /// @return /// True on success; false otherwise. - //------------------------------------------------------------------ + //------------------------------------------------------------------ bool FetchFunctionResults (ExecutionContext &exe_ctx, lldb::addr_t args_addr, Value &ret_value); @@ -528,7 +528,7 @@ public: /// /// @param[in] args_addr /// The address of the argument struct. - //------------------------------------------------------------------ + //------------------------------------------------------------------ void DeallocateFunctionResults (ExecutionContext &exe_ctx, lldb::addr_t args_addr); @@ -614,9 +614,9 @@ public: return m_arg_values; } private: - //------------------------------------------------------------------ - // For ClangFunction only - //------------------------------------------------------------------ + //------------------------------------------------------------------ + // For ClangFunction only + //------------------------------------------------------------------ std::unique_ptr<ClangExpressionParser> m_parser; ///< The parser responsible for compiling the function. std::unique_ptr<IRExecutionUnit> m_execution_unit_ap; @@ -624,17 +624,18 @@ private: Function *m_function_ptr; ///< The function we're going to call. May be NULL if we don't have debug info for the function. Address m_function_addr; ///< If we don't have the FunctionSP, we at least need the address & return type. ClangASTType m_function_return_type; ///< The opaque clang qual type for the function return type. - ClangASTContext *m_clang_ast_context; ///< This is the clang_ast_context that we're getting types from the and value, and the function return the function pointer is NULL. std::string m_wrapper_function_name; ///< The name of the wrapper function. std::string m_wrapper_function_text; ///< The contents of the wrapper function. std::string m_wrapper_struct_name; ///< The name of the struct that contains the target function address, arguments, and result. std::list<lldb::addr_t> m_wrapper_args_addrs; ///< The addresses of the arguments to the wrapper function. + std::unique_ptr<ASTStructExtractor> m_struct_extractor; ///< The class that generates the argument struct below. + bool m_struct_valid; ///< True if the ASTStructExtractor has populated the variables below. - //------------------------------------------------------------------ - /// These values are populated by the ASTStructExtractor + //------------------------------------------------------------------ + /// These values are populated by the ASTStructExtractor size_t m_struct_size; ///< The size of the argument struct, in bytes. std::vector<uint64_t> m_member_offsets; ///< The offset of each member in the struct, in bytes. uint64_t m_return_size; ///< The size of the result variable, in bytes. diff --git a/include/lldb/Expression/ClangUserExpression.h b/include/lldb/Expression/ClangUserExpression.h index 47bfebb466487..b8c3c128acf49 100644 --- a/include/lldb/Expression/ClangUserExpression.h +++ b/include/lldb/Expression/ClangUserExpression.h @@ -126,13 +126,8 @@ public: /// The execution context to use when looking up entities that /// are needed for parsing (locations of variables, etc.) /// - /// @param[in] unwind_on_error - /// If true, and the execution stops before completion, we unwind the - /// function call, and return the program state to what it was before the - /// execution. If false, we leave the program in the stopped state. - /// - /// @param[in] ignore_breakpoints - /// If true, ignore breakpoints while executing the expression. + /// @param[in] options + /// Expression evaluation options. /// /// @param[in] shared_ptr_to_me /// This is a shared pointer to this ClangUserExpression. This is @@ -145,29 +140,15 @@ public: /// A pointer to direct at the persistent variable in which the /// expression's result is stored. /// - /// @param[in] try_all_threads - /// If true, then we will try to run all threads if the function doesn't complete on - /// one thread. See timeout_usec for the interaction of this variable and - /// the timeout. - /// - /// @param[in] timeout_usec - /// Timeout value (0 for no timeout). If try_all_threads is true, then we - /// will try on one thread for the lesser of .25 sec and half the total timeout. - /// then switch to running all threads, otherwise this will be the total timeout. - /// - /// /// @return /// A Process::Execution results value. //------------------------------------------------------------------ ExecutionResults Execute (Stream &error_stream, ExecutionContext &exe_ctx, - bool unwind_on_error, - bool ignore_breakpoints, + const EvaluateExpressionOptions& options, ClangUserExpressionSP &shared_ptr_to_me, - lldb::ClangExpressionVariableSP &result, - bool try_all_threads, - uint32_t timeout_usec); + lldb::ClangExpressionVariableSP &result); ThreadPlan * GetThreadPlanToExecuteJITExpression (Stream &error_stream, @@ -300,25 +281,8 @@ public: /// @param[in] exe_ctx /// The execution context to use when evaluating the expression. /// - /// @param[in] execution_policy - /// Determines whether or not to try using the IR interpreter to - /// avoid running the expression on the parser. - /// - /// @param[in] language - /// If not eLanguageTypeUnknown, a language to use when parsing - /// the expression. Currently restricted to those languages - /// supported by Clang. - /// - /// @param[in] unwind_on_error - /// True if the thread's state should be restored in the case - /// of an error. - /// - /// @param[in] ignore_breakpoints - /// If true, ignore breakpoints while executing the expression. - /// - /// @param[in] result_type - /// If not eResultTypeAny, the type of the desired result. Will - /// result in parse errors if impossible. + /// @param[in] options + /// Expression evaluation options. /// /// @param[in] expr_cstr /// A C string containing the expression to be evaluated. @@ -330,45 +294,20 @@ public: /// @param[in/out] result_valobj_sp /// If execution is successful, the result valobj is placed here. /// - /// @param[in] try_all_threads - /// If true, then we will try to run all threads if the function doesn't complete on - /// one thread. See timeout_usec for the interaction of this variable and - /// the timeout. - /// - /// @param[in] timeout_usec - /// Timeout value (0 for no timeout). If try_all_threads is true, then we - /// will try on one thread for the lesser of .25 sec and half the total timeout. - /// then switch to running all threads, otherwise this will be the total timeout. + /// @param[out] + /// Filled in with an error in case the expression evaluation + /// fails to parse, run, or evaluated. /// /// @result /// A Process::ExecutionResults value. eExecutionCompleted for success. //------------------------------------------------------------------ static ExecutionResults Evaluate (ExecutionContext &exe_ctx, - lldb_private::ExecutionPolicy execution_policy, - lldb::LanguageType language, - ResultType desired_type, - bool unwind_on_error, - bool ignore_breakpoints, + const EvaluateExpressionOptions& options, const char *expr_cstr, const char *expr_prefix, lldb::ValueObjectSP &result_valobj_sp, - bool try_all_threads, - uint32_t timeout_usec); - - static ExecutionResults - EvaluateWithError (ExecutionContext &exe_ctx, - lldb_private::ExecutionPolicy execution_policy, - lldb::LanguageType language, - ResultType desired_type, - bool unwind_on_error, - bool ignore_breakpoints, - const char *expr_cstr, - const char *expr_prefix, - lldb::ValueObjectSP &result_valobj_sp, - Error &error, - bool try_all_threads, - uint32_t timeout_usec); + Error &error); static const Error::ValueType kNoResult = 0x1001; ///< ValueObject::GetError() returns this if there is no result from the expression. private: diff --git a/include/lldb/Expression/DWARFExpression.h b/include/lldb/Expression/DWARFExpression.h index 2692831ecc847..5ecdf7fe9ee58 100644 --- a/include/lldb/Expression/DWARFExpression.h +++ b/include/lldb/Expression/DWARFExpression.h @@ -58,7 +58,8 @@ public: /// @param[in] data_length /// The byte length of the location expression. //------------------------------------------------------------------ - DWARFExpression(const DataExtractor& data, + DWARFExpression(lldb::ModuleSP module, + const DataExtractor& data, lldb::offset_t data_offset, lldb::offset_t data_length); @@ -172,6 +173,9 @@ public: /// Make the expression parser read its location information from a /// given data source /// + /// @param[in] module_sp + /// The module that defines the DWARF expression. + /// /// @param[in] data /// A data extractor configured to read the DWARF location expression's /// bytecode. @@ -183,7 +187,7 @@ public: /// The byte length of the location expression. //------------------------------------------------------------------ void - SetOpcodeData(const DataExtractor& data, lldb::offset_t data_offset, lldb::offset_t data_length); + SetOpcodeData(lldb::ModuleSP module_sp, const DataExtractor& data, lldb::offset_t data_offset, lldb::offset_t data_length); //------------------------------------------------------------------ /// Copy the DWARF location expression into a local buffer. @@ -199,6 +203,9 @@ public: /// the data, it shouldn't amount to that much for the variables we /// end up parsing. /// + /// @param[in] module_sp + /// The module that defines the DWARF expression. + /// /// @param[in] data /// A data extractor configured to read and copy the DWARF /// location expression's bytecode. @@ -210,7 +217,8 @@ public: /// The byte length of the location expression. //------------------------------------------------------------------ void - CopyOpcodeData (const DataExtractor& data, + CopyOpcodeData (lldb::ModuleSP module_sp, + const DataExtractor& data, lldb::offset_t data_offset, lldb::offset_t data_length); @@ -279,6 +287,9 @@ public: /// expression. The location expression may access the target's /// memory, especially if it comes from the expression parser. /// + /// @param[in] opcode_ctx + /// The module which defined the expression. + /// /// @param[in] opcodes /// This is a static method so the opcodes need to be provided /// explicitly. @@ -332,6 +343,7 @@ public: ClangExpressionVariableList *expr_locals, ClangExpressionDeclMap *decl_map, RegisterContext *reg_ctx, + lldb::ModuleSP opcode_ctx, const DataExtractor& opcodes, const lldb::offset_t offset, const lldb::offset_t length, @@ -410,7 +422,8 @@ protected: //------------------------------------------------------------------ /// Classes that inherit from DWARFExpression can see and modify these //------------------------------------------------------------------ - + + lldb::ModuleWP m_module_wp; ///< Module which defined this expression. DataExtractor m_data; ///< A data extractor capable of reading opcode bytes lldb::RegisterKind m_reg_kind; ///< One of the defines that starts with LLDB_REGKIND_ lldb::addr_t m_loclist_slide; ///< A value used to slide the location list offsets so that diff --git a/include/lldb/Expression/IRExecutionUnit.h b/include/lldb/Expression/IRExecutionUnit.h index 885b6516b0c6a..2820317e108e2 100644 --- a/include/lldb/Expression/IRExecutionUnit.h +++ b/include/lldb/Expression/IRExecutionUnit.h @@ -287,7 +287,8 @@ private: /// Allocated space. //------------------------------------------------------------------ virtual uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment, - unsigned SectionID); + unsigned SectionID, + llvm::StringRef SectionName); //------------------------------------------------------------------ /// Allocate space for data, and add it to the m_spaceBlocks map @@ -308,7 +309,9 @@ private: /// Allocated space. //------------------------------------------------------------------ virtual uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment, - unsigned SectionID, bool IsReadOnly); + unsigned SectionID, + llvm::StringRef SectionName, + bool IsReadOnly); //------------------------------------------------------------------ /// Allocate space for a global variable, and add it to the @@ -388,6 +391,10 @@ private: return m_default_mm_ap->GetNumStubSlabs(); } + virtual void registerEHFrames(uint8_t *Addr, uint64_t LoadAddr, size_t Size) { + return m_default_mm_ap->registerEHFrames(Addr, LoadAddr, Size); + } + //------------------------------------------------------------------ /// Passthrough interface stub //------------------------------------------------------------------ diff --git a/include/lldb/Expression/IRForTarget.h b/include/lldb/Expression/IRForTarget.h index 151bf2ab4774b..566328772502d 100644 --- a/include/lldb/Expression/IRForTarget.h +++ b/include/lldb/Expression/IRForTarget.h @@ -19,6 +19,7 @@ #include "llvm/Pass.h" #include <map> +#include <functional> namespace llvm { class BasicBlock; |
