19f2f44ceSEd Maste //===-- LLVMUserExpression.cpp ----------------------------------*- C++ -*-===//
29f2f44ceSEd Maste //
39f2f44ceSEd Maste // The LLVM Compiler Infrastructure
49f2f44ceSEd Maste //
59f2f44ceSEd Maste // This file is distributed under the University of Illinois Open Source
69f2f44ceSEd Maste // License. See LICENSE.TXT for details.
79f2f44ceSEd Maste //
89f2f44ceSEd Maste //===----------------------------------------------------------------------===//
99f2f44ceSEd Maste
109f2f44ceSEd Maste
119f2f44ceSEd Maste #include "lldb/Expression/LLVMUserExpression.h"
129f2f44ceSEd Maste #include "lldb/Core/Module.h"
139f2f44ceSEd Maste #include "lldb/Core/StreamFile.h"
149f2f44ceSEd Maste #include "lldb/Core/ValueObjectConstResult.h"
154bb0738eSEd Maste #include "lldb/Expression/DiagnosticManager.h"
169f2f44ceSEd Maste #include "lldb/Expression/ExpressionSourceCode.h"
179f2f44ceSEd Maste #include "lldb/Expression/IRExecutionUnit.h"
189f2f44ceSEd Maste #include "lldb/Expression/IRInterpreter.h"
199f2f44ceSEd Maste #include "lldb/Expression/Materializer.h"
209f2f44ceSEd Maste #include "lldb/Host/HostInfo.h"
219f2f44ceSEd Maste #include "lldb/Symbol/Block.h"
229f2f44ceSEd Maste #include "lldb/Symbol/ClangASTContext.h"
234bb0738eSEd Maste #include "lldb/Symbol/ClangExternalASTSourceCommon.h"
249f2f44ceSEd Maste #include "lldb/Symbol/Function.h"
259f2f44ceSEd Maste #include "lldb/Symbol/ObjectFile.h"
269f2f44ceSEd Maste #include "lldb/Symbol/SymbolVendor.h"
279f2f44ceSEd Maste #include "lldb/Symbol/Type.h"
289f2f44ceSEd Maste #include "lldb/Symbol/VariableList.h"
299f2f44ceSEd Maste #include "lldb/Target/ExecutionContext.h"
309f2f44ceSEd Maste #include "lldb/Target/Process.h"
319f2f44ceSEd Maste #include "lldb/Target/StackFrame.h"
329f2f44ceSEd Maste #include "lldb/Target/Target.h"
339f2f44ceSEd Maste #include "lldb/Target/ThreadPlan.h"
349f2f44ceSEd Maste #include "lldb/Target/ThreadPlanCallUserExpression.h"
35f678e45dSDimitry Andric #include "lldb/Utility/ConstString.h"
36f678e45dSDimitry Andric #include "lldb/Utility/Log.h"
37f678e45dSDimitry Andric #include "lldb/Utility/StreamString.h"
389f2f44ceSEd Maste
399f2f44ceSEd Maste using namespace lldb_private;
409f2f44ceSEd Maste
LLVMUserExpression(ExecutionContextScope & exe_scope,llvm::StringRef expr,llvm::StringRef prefix,lldb::LanguageType language,ResultType desired_type,const EvaluateExpressionOptions & options)419f2f44ceSEd Maste LLVMUserExpression::LLVMUserExpression(ExecutionContextScope &exe_scope,
42435933ddSDimitry Andric llvm::StringRef expr,
43435933ddSDimitry Andric llvm::StringRef prefix,
449f2f44ceSEd Maste lldb::LanguageType language,
459f2f44ceSEd Maste ResultType desired_type,
469f2f44ceSEd Maste const EvaluateExpressionOptions &options)
47435933ddSDimitry Andric : UserExpression(exe_scope, expr, prefix, language, desired_type, options),
489f2f44ceSEd Maste m_stack_frame_bottom(LLDB_INVALID_ADDRESS),
49f678e45dSDimitry Andric m_stack_frame_top(LLDB_INVALID_ADDRESS),
50f678e45dSDimitry Andric m_allow_cxx(false),
51f678e45dSDimitry Andric m_allow_objc(false),
52f678e45dSDimitry Andric m_transformed_text(),
53435933ddSDimitry Andric m_execution_unit_sp(), m_materializer_ap(), m_jit_module_wp(),
54435933ddSDimitry Andric m_enforce_valid_object(true), m_in_cplusplus_method(false),
55435933ddSDimitry Andric m_in_objectivec_method(false), m_in_static_method(false),
56435933ddSDimitry Andric m_needs_object_ptr(false), m_target(NULL), m_can_interpret(false),
57435933ddSDimitry Andric m_materialized_address(LLDB_INVALID_ADDRESS) {}
589f2f44ceSEd Maste
~LLVMUserExpression()59435933ddSDimitry Andric LLVMUserExpression::~LLVMUserExpression() {
60435933ddSDimitry Andric if (m_target) {
619f2f44ceSEd Maste lldb::ModuleSP jit_module_sp(m_jit_module_wp.lock());
629f2f44ceSEd Maste if (jit_module_sp)
639f2f44ceSEd Maste m_target->GetImages().Remove(jit_module_sp);
649f2f44ceSEd Maste }
659f2f44ceSEd Maste }
669f2f44ceSEd Maste
679f2f44ceSEd Maste lldb::ExpressionResults
DoExecute(DiagnosticManager & diagnostic_manager,ExecutionContext & exe_ctx,const EvaluateExpressionOptions & options,lldb::UserExpressionSP & shared_ptr_to_me,lldb::ExpressionVariableSP & result)68435933ddSDimitry Andric LLVMUserExpression::DoExecute(DiagnosticManager &diagnostic_manager,
69435933ddSDimitry Andric ExecutionContext &exe_ctx,
70435933ddSDimitry Andric const EvaluateExpressionOptions &options,
71435933ddSDimitry Andric lldb::UserExpressionSP &shared_ptr_to_me,
72435933ddSDimitry Andric lldb::ExpressionVariableSP &result) {
73435933ddSDimitry Andric // The expression log is quite verbose, and if you're just tracking the
74*4ba319b5SDimitry Andric // execution of the expression, it's quite convenient to have these logs come
75*4ba319b5SDimitry Andric // out with the STEP log as well.
76435933ddSDimitry Andric Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EXPRESSIONS |
77435933ddSDimitry Andric LIBLLDB_LOG_STEP));
789f2f44ceSEd Maste
79435933ddSDimitry Andric if (m_jit_start_addr != LLDB_INVALID_ADDRESS || m_can_interpret) {
809f2f44ceSEd Maste lldb::addr_t struct_address = LLDB_INVALID_ADDRESS;
819f2f44ceSEd Maste
82435933ddSDimitry Andric if (!PrepareToExecuteJITExpression(diagnostic_manager, exe_ctx,
83435933ddSDimitry Andric struct_address)) {
84435933ddSDimitry Andric diagnostic_manager.Printf(
85435933ddSDimitry Andric eDiagnosticSeverityError,
86435933ddSDimitry Andric "errored out in %s, couldn't PrepareToExecuteJITExpression",
87435933ddSDimitry Andric __FUNCTION__);
889f2f44ceSEd Maste return lldb::eExpressionSetupError;
899f2f44ceSEd Maste }
909f2f44ceSEd Maste
919f2f44ceSEd Maste lldb::addr_t function_stack_bottom = LLDB_INVALID_ADDRESS;
929f2f44ceSEd Maste lldb::addr_t function_stack_top = LLDB_INVALID_ADDRESS;
939f2f44ceSEd Maste
94435933ddSDimitry Andric if (m_can_interpret) {
959f2f44ceSEd Maste llvm::Module *module = m_execution_unit_sp->GetModule();
969f2f44ceSEd Maste llvm::Function *function = m_execution_unit_sp->GetFunction();
979f2f44ceSEd Maste
98435933ddSDimitry Andric if (!module || !function) {
99435933ddSDimitry Andric diagnostic_manager.PutString(
100435933ddSDimitry Andric eDiagnosticSeverityError,
101435933ddSDimitry Andric "supposed to interpret, but nothing is there");
1029f2f44ceSEd Maste return lldb::eExpressionSetupError;
1039f2f44ceSEd Maste }
1049f2f44ceSEd Maste
1055517e702SDimitry Andric Status interpreter_error;
1069f2f44ceSEd Maste
1079f2f44ceSEd Maste std::vector<lldb::addr_t> args;
1089f2f44ceSEd Maste
109435933ddSDimitry Andric if (!AddArguments(exe_ctx, args, struct_address, diagnostic_manager)) {
110435933ddSDimitry Andric diagnostic_manager.Printf(eDiagnosticSeverityError,
111435933ddSDimitry Andric "errored out in %s, couldn't AddArguments",
1124bb0738eSEd Maste __FUNCTION__);
1139f2f44ceSEd Maste return lldb::eExpressionSetupError;
1149f2f44ceSEd Maste }
1159f2f44ceSEd Maste
1169f2f44ceSEd Maste function_stack_bottom = m_stack_frame_bottom;
1179f2f44ceSEd Maste function_stack_top = m_stack_frame_top;
1189f2f44ceSEd Maste
119435933ddSDimitry Andric IRInterpreter::Interpret(*module, *function, args,
120435933ddSDimitry Andric *m_execution_unit_sp.get(), interpreter_error,
121435933ddSDimitry Andric function_stack_bottom, function_stack_top,
122435933ddSDimitry Andric exe_ctx);
1239f2f44ceSEd Maste
124435933ddSDimitry Andric if (!interpreter_error.Success()) {
125435933ddSDimitry Andric diagnostic_manager.Printf(eDiagnosticSeverityError,
126435933ddSDimitry Andric "supposed to interpret, but failed: %s",
1274bb0738eSEd Maste interpreter_error.AsCString());
1289f2f44ceSEd Maste return lldb::eExpressionDiscarded;
1299f2f44ceSEd Maste }
130435933ddSDimitry Andric } else {
131435933ddSDimitry Andric if (!exe_ctx.HasThreadScope()) {
132435933ddSDimitry Andric diagnostic_manager.Printf(eDiagnosticSeverityError,
133435933ddSDimitry Andric "%s called with no thread selected",
134435933ddSDimitry Andric __FUNCTION__);
1359f2f44ceSEd Maste return lldb::eExpressionSetupError;
1369f2f44ceSEd Maste }
1379f2f44ceSEd Maste
1389f2f44ceSEd Maste Address wrapper_address(m_jit_start_addr);
1399f2f44ceSEd Maste
1409f2f44ceSEd Maste std::vector<lldb::addr_t> args;
1419f2f44ceSEd Maste
142435933ddSDimitry Andric if (!AddArguments(exe_ctx, args, struct_address, diagnostic_manager)) {
143435933ddSDimitry Andric diagnostic_manager.Printf(eDiagnosticSeverityError,
144435933ddSDimitry Andric "errored out in %s, couldn't AddArguments",
1454bb0738eSEd Maste __FUNCTION__);
1469f2f44ceSEd Maste return lldb::eExpressionSetupError;
1479f2f44ceSEd Maste }
1489f2f44ceSEd Maste
149435933ddSDimitry Andric lldb::ThreadPlanSP call_plan_sp(new ThreadPlanCallUserExpression(
150435933ddSDimitry Andric exe_ctx.GetThreadRef(), wrapper_address, args, options,
151435933ddSDimitry Andric shared_ptr_to_me));
1529f2f44ceSEd Maste
1534bb0738eSEd Maste StreamString ss;
154435933ddSDimitry Andric if (!call_plan_sp || !call_plan_sp->ValidatePlan(&ss)) {
155435933ddSDimitry Andric diagnostic_manager.PutString(eDiagnosticSeverityError, ss.GetString());
1569f2f44ceSEd Maste return lldb::eExpressionSetupError;
1574bb0738eSEd Maste }
1589f2f44ceSEd Maste
1599f2f44ceSEd Maste ThreadPlanCallUserExpression *user_expression_plan =
1609f2f44ceSEd Maste static_cast<ThreadPlanCallUserExpression *>(call_plan_sp.get());
1619f2f44ceSEd Maste
162435933ddSDimitry Andric lldb::addr_t function_stack_pointer =
163435933ddSDimitry Andric user_expression_plan->GetFunctionStackPointer();
1649f2f44ceSEd Maste
1659f2f44ceSEd Maste function_stack_bottom = function_stack_pointer - HostInfo::GetPageSize();
1669f2f44ceSEd Maste function_stack_top = function_stack_pointer;
1679f2f44ceSEd Maste
1689f2f44ceSEd Maste if (log)
169435933ddSDimitry Andric log->Printf(
170435933ddSDimitry Andric "-- [UserExpression::Execute] Execution of expression begins --");
1719f2f44ceSEd Maste
1729f2f44ceSEd Maste if (exe_ctx.GetProcessPtr())
1739f2f44ceSEd Maste exe_ctx.GetProcessPtr()->SetRunningUserExpression(true);
1749f2f44ceSEd Maste
1759f2f44ceSEd Maste lldb::ExpressionResults execution_result =
176435933ddSDimitry Andric exe_ctx.GetProcessRef().RunThreadPlan(exe_ctx, call_plan_sp, options,
177435933ddSDimitry Andric diagnostic_manager);
1789f2f44ceSEd Maste
1799f2f44ceSEd Maste if (exe_ctx.GetProcessPtr())
1809f2f44ceSEd Maste exe_ctx.GetProcessPtr()->SetRunningUserExpression(false);
1819f2f44ceSEd Maste
1829f2f44ceSEd Maste if (log)
183435933ddSDimitry Andric log->Printf("-- [UserExpression::Execute] Execution of expression "
184435933ddSDimitry Andric "completed --");
1859f2f44ceSEd Maste
186435933ddSDimitry Andric if (execution_result == lldb::eExpressionInterrupted ||
187435933ddSDimitry Andric execution_result == lldb::eExpressionHitBreakpoint) {
1889f2f44ceSEd Maste const char *error_desc = NULL;
1899f2f44ceSEd Maste
190435933ddSDimitry Andric if (call_plan_sp) {
1919f2f44ceSEd Maste lldb::StopInfoSP real_stop_info_sp = call_plan_sp->GetRealStopInfo();
1929f2f44ceSEd Maste if (real_stop_info_sp)
1939f2f44ceSEd Maste error_desc = real_stop_info_sp->GetDescription();
1949f2f44ceSEd Maste }
1959f2f44ceSEd Maste if (error_desc)
196435933ddSDimitry Andric diagnostic_manager.Printf(eDiagnosticSeverityError,
197435933ddSDimitry Andric "Execution was interrupted, reason: %s.",
1984bb0738eSEd Maste error_desc);
1999f2f44ceSEd Maste else
200435933ddSDimitry Andric diagnostic_manager.PutString(eDiagnosticSeverityError,
201435933ddSDimitry Andric "Execution was interrupted.");
2029f2f44ceSEd Maste
203435933ddSDimitry Andric if ((execution_result == lldb::eExpressionInterrupted &&
204435933ddSDimitry Andric options.DoesUnwindOnError()) ||
205435933ddSDimitry Andric (execution_result == lldb::eExpressionHitBreakpoint &&
206435933ddSDimitry Andric options.DoesIgnoreBreakpoints()))
2074bb0738eSEd Maste diagnostic_manager.AppendMessageToDiagnostic(
208435933ddSDimitry Andric "The process has been returned to the state before expression "
209435933ddSDimitry Andric "evaluation.");
210435933ddSDimitry Andric else {
2119f2f44ceSEd Maste if (execution_result == lldb::eExpressionHitBreakpoint)
2129f2f44ceSEd Maste user_expression_plan->TransferExpressionOwnership();
2134bb0738eSEd Maste diagnostic_manager.AppendMessageToDiagnostic(
214435933ddSDimitry Andric "The process has been left at the point where it was "
215435933ddSDimitry Andric "interrupted, "
216435933ddSDimitry Andric "use \"thread return -x\" to return to the state before "
217435933ddSDimitry Andric "expression evaluation.");
2189f2f44ceSEd Maste }
2199f2f44ceSEd Maste
2209f2f44ceSEd Maste return execution_result;
221435933ddSDimitry Andric } else if (execution_result == lldb::eExpressionStoppedForDebug) {
222435933ddSDimitry Andric diagnostic_manager.PutString(
2234bb0738eSEd Maste eDiagnosticSeverityRemark,
2249f2f44ceSEd Maste "Execution was halted at the first instruction of the expression "
2259f2f44ceSEd Maste "function because \"debug\" was requested.\n"
226435933ddSDimitry Andric "Use \"thread return -x\" to return to the state before expression "
227435933ddSDimitry Andric "evaluation.");
2289f2f44ceSEd Maste return execution_result;
229435933ddSDimitry Andric } else if (execution_result != lldb::eExpressionCompleted) {
230435933ddSDimitry Andric diagnostic_manager.Printf(
231435933ddSDimitry Andric eDiagnosticSeverityError,
232435933ddSDimitry Andric "Couldn't execute function; result was %s",
2339f2f44ceSEd Maste Process::ExecutionResultAsCString(execution_result));
2349f2f44ceSEd Maste return execution_result;
2359f2f44ceSEd Maste }
2369f2f44ceSEd Maste }
2379f2f44ceSEd Maste
238435933ddSDimitry Andric if (FinalizeJITExecution(diagnostic_manager, exe_ctx, result,
239435933ddSDimitry Andric function_stack_bottom, function_stack_top)) {
2409f2f44ceSEd Maste return lldb::eExpressionCompleted;
241435933ddSDimitry Andric } else {
2429f2f44ceSEd Maste return lldb::eExpressionResultUnavailable;
2439f2f44ceSEd Maste }
244435933ddSDimitry Andric } else {
245435933ddSDimitry Andric diagnostic_manager.PutString(
246435933ddSDimitry Andric eDiagnosticSeverityError,
2474bb0738eSEd Maste "Expression can't be run, because there is no JIT compiled function");
2489f2f44ceSEd Maste return lldb::eExpressionSetupError;
2499f2f44ceSEd Maste }
2509f2f44ceSEd Maste }
2519f2f44ceSEd Maste
FinalizeJITExecution(DiagnosticManager & diagnostic_manager,ExecutionContext & exe_ctx,lldb::ExpressionVariableSP & result,lldb::addr_t function_stack_bottom,lldb::addr_t function_stack_top)252435933ddSDimitry Andric bool LLVMUserExpression::FinalizeJITExecution(
253435933ddSDimitry Andric DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
2549f2f44ceSEd Maste lldb::ExpressionVariableSP &result, lldb::addr_t function_stack_bottom,
255435933ddSDimitry Andric lldb::addr_t function_stack_top) {
2569f2f44ceSEd Maste Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
2579f2f44ceSEd Maste
2589f2f44ceSEd Maste if (log)
259435933ddSDimitry Andric log->Printf("-- [UserExpression::FinalizeJITExecution] Dematerializing "
260435933ddSDimitry Andric "after execution --");
2619f2f44ceSEd Maste
262435933ddSDimitry Andric if (!m_dematerializer_sp) {
2634bb0738eSEd Maste diagnostic_manager.Printf(eDiagnosticSeverityError,
264435933ddSDimitry Andric "Couldn't apply expression side effects : no "
265435933ddSDimitry Andric "dematerializer is present");
2669f2f44ceSEd Maste return false;
2679f2f44ceSEd Maste }
2689f2f44ceSEd Maste
2695517e702SDimitry Andric Status dematerialize_error;
2709f2f44ceSEd Maste
271435933ddSDimitry Andric m_dematerializer_sp->Dematerialize(dematerialize_error, function_stack_bottom,
272435933ddSDimitry Andric function_stack_top);
2739f2f44ceSEd Maste
274435933ddSDimitry Andric if (!dematerialize_error.Success()) {
275435933ddSDimitry Andric diagnostic_manager.Printf(eDiagnosticSeverityError,
276435933ddSDimitry Andric "Couldn't apply expression side effects : %s",
2779f2f44ceSEd Maste dematerialize_error.AsCString("unknown error"));
2789f2f44ceSEd Maste return false;
2799f2f44ceSEd Maste }
2809f2f44ceSEd Maste
281435933ddSDimitry Andric result =
282435933ddSDimitry Andric GetResultAfterDematerialization(exe_ctx.GetBestExecutionContextScope());
2839f2f44ceSEd Maste
2849f2f44ceSEd Maste if (result)
2859f2f44ceSEd Maste result->TransferAddress();
2869f2f44ceSEd Maste
2879f2f44ceSEd Maste m_dematerializer_sp.reset();
2889f2f44ceSEd Maste
2899f2f44ceSEd Maste return true;
2909f2f44ceSEd Maste }
2919f2f44ceSEd Maste
PrepareToExecuteJITExpression(DiagnosticManager & diagnostic_manager,ExecutionContext & exe_ctx,lldb::addr_t & struct_address)292435933ddSDimitry Andric bool LLVMUserExpression::PrepareToExecuteJITExpression(
293435933ddSDimitry Andric DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
294435933ddSDimitry Andric lldb::addr_t &struct_address) {
2959f2f44ceSEd Maste lldb::TargetSP target;
2969f2f44ceSEd Maste lldb::ProcessSP process;
2979f2f44ceSEd Maste lldb::StackFrameSP frame;
2989f2f44ceSEd Maste
299435933ddSDimitry Andric if (!LockAndCheckContext(exe_ctx, target, process, frame)) {
300435933ddSDimitry Andric diagnostic_manager.PutString(
301435933ddSDimitry Andric eDiagnosticSeverityError,
3024bb0738eSEd Maste "The context has changed before we could JIT the expression!");
3039f2f44ceSEd Maste return false;
3049f2f44ceSEd Maste }
3059f2f44ceSEd Maste
306435933ddSDimitry Andric if (m_jit_start_addr != LLDB_INVALID_ADDRESS || m_can_interpret) {
307435933ddSDimitry Andric if (m_materialized_address == LLDB_INVALID_ADDRESS) {
3085517e702SDimitry Andric Status alloc_error;
3099f2f44ceSEd Maste
3109f2f44ceSEd Maste IRMemoryMap::AllocationPolicy policy =
311435933ddSDimitry Andric m_can_interpret ? IRMemoryMap::eAllocationPolicyHostOnly
312435933ddSDimitry Andric : IRMemoryMap::eAllocationPolicyMirror;
3139f2f44ceSEd Maste
3149f2f44ceSEd Maste const bool zero_memory = false;
3159f2f44ceSEd Maste
316435933ddSDimitry Andric m_materialized_address = m_execution_unit_sp->Malloc(
317435933ddSDimitry Andric m_materializer_ap->GetStructByteSize(),
3189f2f44ceSEd Maste m_materializer_ap->GetStructAlignment(),
319435933ddSDimitry Andric lldb::ePermissionsReadable | lldb::ePermissionsWritable, policy,
320435933ddSDimitry Andric zero_memory, alloc_error);
3219f2f44ceSEd Maste
322435933ddSDimitry Andric if (!alloc_error.Success()) {
323435933ddSDimitry Andric diagnostic_manager.Printf(
324435933ddSDimitry Andric eDiagnosticSeverityError,
3254bb0738eSEd Maste "Couldn't allocate space for materialized struct: %s",
3264bb0738eSEd Maste alloc_error.AsCString());
3279f2f44ceSEd Maste return false;
3289f2f44ceSEd Maste }
3299f2f44ceSEd Maste }
3309f2f44ceSEd Maste
3319f2f44ceSEd Maste struct_address = m_materialized_address;
3329f2f44ceSEd Maste
333435933ddSDimitry Andric if (m_can_interpret && m_stack_frame_bottom == LLDB_INVALID_ADDRESS) {
3345517e702SDimitry Andric Status alloc_error;
3359f2f44ceSEd Maste
3369f2f44ceSEd Maste const size_t stack_frame_size = 512 * 1024;
3379f2f44ceSEd Maste
3389f2f44ceSEd Maste const bool zero_memory = false;
3399f2f44ceSEd Maste
340435933ddSDimitry Andric m_stack_frame_bottom = m_execution_unit_sp->Malloc(
341435933ddSDimitry Andric stack_frame_size, 8,
3429f2f44ceSEd Maste lldb::ePermissionsReadable | lldb::ePermissionsWritable,
343435933ddSDimitry Andric IRMemoryMap::eAllocationPolicyHostOnly, zero_memory, alloc_error);
3449f2f44ceSEd Maste
3459f2f44ceSEd Maste m_stack_frame_top = m_stack_frame_bottom + stack_frame_size;
3469f2f44ceSEd Maste
347435933ddSDimitry Andric if (!alloc_error.Success()) {
348435933ddSDimitry Andric diagnostic_manager.Printf(
349435933ddSDimitry Andric eDiagnosticSeverityError,
350435933ddSDimitry Andric "Couldn't allocate space for the stack frame: %s",
3514bb0738eSEd Maste alloc_error.AsCString());
3529f2f44ceSEd Maste return false;
3539f2f44ceSEd Maste }
3549f2f44ceSEd Maste }
3559f2f44ceSEd Maste
3565517e702SDimitry Andric Status materialize_error;
3579f2f44ceSEd Maste
358435933ddSDimitry Andric m_dematerializer_sp = m_materializer_ap->Materialize(
359435933ddSDimitry Andric frame, *m_execution_unit_sp, struct_address, materialize_error);
3609f2f44ceSEd Maste
361435933ddSDimitry Andric if (!materialize_error.Success()) {
362435933ddSDimitry Andric diagnostic_manager.Printf(eDiagnosticSeverityError,
363435933ddSDimitry Andric "Couldn't materialize: %s",
3644bb0738eSEd Maste materialize_error.AsCString());
3659f2f44ceSEd Maste return false;
3669f2f44ceSEd Maste }
3679f2f44ceSEd Maste }
3689f2f44ceSEd Maste return true;
3699f2f44ceSEd Maste }
3709f2f44ceSEd Maste
GetJITModule()371435933ddSDimitry Andric lldb::ModuleSP LLVMUserExpression::GetJITModule() {
3729f2f44ceSEd Maste if (m_execution_unit_sp)
3739f2f44ceSEd Maste return m_execution_unit_sp->GetJITModule();
3749f2f44ceSEd Maste return lldb::ModuleSP();
3759f2f44ceSEd Maste }
376