1998c8a1cSRyan Brown //===-- LLVMUserExpression.cpp ----------------------------------*- C++ -*-===// 2998c8a1cSRyan Brown // 32946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 42946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information. 52946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6998c8a1cSRyan Brown // 7998c8a1cSRyan Brown //===----------------------------------------------------------------------===// 8998c8a1cSRyan Brown 9998c8a1cSRyan Brown 10998c8a1cSRyan Brown #include "lldb/Expression/LLVMUserExpression.h" 11998c8a1cSRyan Brown #include "lldb/Core/Module.h" 12998c8a1cSRyan Brown #include "lldb/Core/StreamFile.h" 13998c8a1cSRyan Brown #include "lldb/Core/ValueObjectConstResult.h" 14579e70c9SSean Callanan #include "lldb/Expression/DiagnosticManager.h" 15bb089697SAlex Langford #include "lldb/Expression/ExpressionVariable.h" 16998c8a1cSRyan Brown #include "lldb/Expression/IRExecutionUnit.h" 17998c8a1cSRyan Brown #include "lldb/Expression/IRInterpreter.h" 18998c8a1cSRyan Brown #include "lldb/Expression/Materializer.h" 19998c8a1cSRyan Brown #include "lldb/Host/HostInfo.h" 20998c8a1cSRyan Brown #include "lldb/Symbol/Block.h" 21998c8a1cSRyan Brown #include "lldb/Symbol/Function.h" 22998c8a1cSRyan Brown #include "lldb/Symbol/ObjectFile.h" 23998c8a1cSRyan Brown #include "lldb/Symbol/SymbolVendor.h" 24998c8a1cSRyan Brown #include "lldb/Symbol/Type.h" 25998c8a1cSRyan Brown #include "lldb/Symbol/VariableList.h" 26998c8a1cSRyan Brown #include "lldb/Target/ExecutionContext.h" 27998c8a1cSRyan Brown #include "lldb/Target/Process.h" 28998c8a1cSRyan Brown #include "lldb/Target/StackFrame.h" 29998c8a1cSRyan Brown #include "lldb/Target/Target.h" 30998c8a1cSRyan Brown #include "lldb/Target/ThreadPlan.h" 31998c8a1cSRyan Brown #include "lldb/Target/ThreadPlanCallUserExpression.h" 32bf9a7730SZachary Turner #include "lldb/Utility/ConstString.h" 336f9e6901SZachary Turner #include "lldb/Utility/Log.h" 34bf9a7730SZachary Turner #include "lldb/Utility/StreamString.h" 35998c8a1cSRyan Brown 36998c8a1cSRyan Brown using namespace lldb_private; 37998c8a1cSRyan Brown 38*52f3a2faSRaphael Isemann char LLVMUserExpression::ID; 39*52f3a2faSRaphael Isemann 4019a63fc6SJim Ingham LLVMUserExpression::LLVMUserExpression(ExecutionContextScope &exe_scope, 41c5d7df90SZachary Turner llvm::StringRef expr, 42c5d7df90SZachary Turner llvm::StringRef prefix, 4319a63fc6SJim Ingham lldb::LanguageType language, 4419a63fc6SJim Ingham ResultType desired_type, 45*52f3a2faSRaphael Isemann const EvaluateExpressionOptions &options) 46*52f3a2faSRaphael Isemann : UserExpression(exe_scope, expr, prefix, language, desired_type, options), 47998c8a1cSRyan Brown m_stack_frame_bottom(LLDB_INVALID_ADDRESS), 48d5b44036SJonas Devlieghere m_stack_frame_top(LLDB_INVALID_ADDRESS), m_allow_cxx(false), 49d5b44036SJonas Devlieghere m_allow_objc(false), m_transformed_text(), m_execution_unit_sp(), 50*52f3a2faSRaphael Isemann m_materializer_up(), m_jit_module_wp(), m_can_interpret(false), 51*52f3a2faSRaphael Isemann m_materialized_address(LLDB_INVALID_ADDRESS) {} 52998c8a1cSRyan Brown 53b9c1b51eSKate Stone LLVMUserExpression::~LLVMUserExpression() { 54b9c1b51eSKate Stone if (m_target) { 55998c8a1cSRyan Brown lldb::ModuleSP jit_module_sp(m_jit_module_wp.lock()); 56998c8a1cSRyan Brown if (jit_module_sp) 57998c8a1cSRyan Brown m_target->GetImages().Remove(jit_module_sp); 58998c8a1cSRyan Brown } 59998c8a1cSRyan Brown } 60998c8a1cSRyan Brown 61998c8a1cSRyan Brown lldb::ExpressionResults 62b9c1b51eSKate Stone LLVMUserExpression::DoExecute(DiagnosticManager &diagnostic_manager, 63b9c1b51eSKate Stone ExecutionContext &exe_ctx, 64b9c1b51eSKate Stone const EvaluateExpressionOptions &options, 65b9c1b51eSKate Stone lldb::UserExpressionSP &shared_ptr_to_me, 66b9c1b51eSKate Stone lldb::ExpressionVariableSP &result) { 67b9c1b51eSKate Stone // The expression log is quite verbose, and if you're just tracking the 6805097246SAdrian Prantl // execution of the expression, it's quite convenient to have these logs come 6905097246SAdrian Prantl // out with the STEP log as well. 70b9c1b51eSKate Stone Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EXPRESSIONS | 71b9c1b51eSKate Stone LIBLLDB_LOG_STEP)); 72998c8a1cSRyan Brown 733011c7ebSRaphael Isemann if (m_jit_start_addr == LLDB_INVALID_ADDRESS && !m_can_interpret) { 743011c7ebSRaphael Isemann diagnostic_manager.PutString( 753011c7ebSRaphael Isemann eDiagnosticSeverityError, 763011c7ebSRaphael Isemann "Expression can't be run, because there is no JIT compiled function"); 773011c7ebSRaphael Isemann return lldb::eExpressionSetupError; 783011c7ebSRaphael Isemann } 793011c7ebSRaphael Isemann 80998c8a1cSRyan Brown lldb::addr_t struct_address = LLDB_INVALID_ADDRESS; 81998c8a1cSRyan Brown 82b9c1b51eSKate Stone if (!PrepareToExecuteJITExpression(diagnostic_manager, exe_ctx, 83b9c1b51eSKate Stone struct_address)) { 84b9c1b51eSKate Stone diagnostic_manager.Printf( 85b9c1b51eSKate Stone eDiagnosticSeverityError, 86b9c1b51eSKate Stone "errored out in %s, couldn't PrepareToExecuteJITExpression", 87b9c1b51eSKate Stone __FUNCTION__); 88998c8a1cSRyan Brown return lldb::eExpressionSetupError; 89998c8a1cSRyan Brown } 90998c8a1cSRyan Brown 91998c8a1cSRyan Brown lldb::addr_t function_stack_bottom = LLDB_INVALID_ADDRESS; 92998c8a1cSRyan Brown lldb::addr_t function_stack_top = LLDB_INVALID_ADDRESS; 93998c8a1cSRyan Brown 94b9c1b51eSKate Stone if (m_can_interpret) { 95998c8a1cSRyan Brown llvm::Module *module = m_execution_unit_sp->GetModule(); 96998c8a1cSRyan Brown llvm::Function *function = m_execution_unit_sp->GetFunction(); 97998c8a1cSRyan Brown 98b9c1b51eSKate Stone if (!module || !function) { 99e2411fabSZachary Turner diagnostic_manager.PutString( 100b9c1b51eSKate Stone eDiagnosticSeverityError, 101b9c1b51eSKate Stone "supposed to interpret, but nothing is there"); 102998c8a1cSRyan Brown return lldb::eExpressionSetupError; 103998c8a1cSRyan Brown } 104998c8a1cSRyan Brown 10597206d57SZachary Turner Status interpreter_error; 106998c8a1cSRyan Brown 107998c8a1cSRyan Brown std::vector<lldb::addr_t> args; 108998c8a1cSRyan Brown 109b9c1b51eSKate Stone if (!AddArguments(exe_ctx, args, struct_address, diagnostic_manager)) { 110b9c1b51eSKate Stone diagnostic_manager.Printf(eDiagnosticSeverityError, 111b9c1b51eSKate Stone "errored out in %s, couldn't AddArguments", 112579e70c9SSean Callanan __FUNCTION__); 113998c8a1cSRyan Brown return lldb::eExpressionSetupError; 114998c8a1cSRyan Brown } 115998c8a1cSRyan Brown 116998c8a1cSRyan Brown function_stack_bottom = m_stack_frame_bottom; 117998c8a1cSRyan Brown function_stack_top = m_stack_frame_top; 118998c8a1cSRyan Brown 11970355aceSJonas Devlieghere IRInterpreter::Interpret(*module, *function, args, *m_execution_unit_sp, 12070355aceSJonas Devlieghere interpreter_error, function_stack_bottom, 12170355aceSJonas Devlieghere function_stack_top, exe_ctx); 122998c8a1cSRyan Brown 123b9c1b51eSKate Stone if (!interpreter_error.Success()) { 124b9c1b51eSKate Stone diagnostic_manager.Printf(eDiagnosticSeverityError, 125b9c1b51eSKate Stone "supposed to interpret, but failed: %s", 126579e70c9SSean Callanan interpreter_error.AsCString()); 127998c8a1cSRyan Brown return lldb::eExpressionDiscarded; 128998c8a1cSRyan Brown } 129b9c1b51eSKate Stone } else { 130b9c1b51eSKate Stone if (!exe_ctx.HasThreadScope()) { 131b9c1b51eSKate Stone diagnostic_manager.Printf(eDiagnosticSeverityError, 132b9c1b51eSKate Stone "%s called with no thread selected", 133b9c1b51eSKate Stone __FUNCTION__); 134998c8a1cSRyan Brown return lldb::eExpressionSetupError; 135998c8a1cSRyan Brown } 136998c8a1cSRyan Brown 137998c8a1cSRyan Brown Address wrapper_address(m_jit_start_addr); 138998c8a1cSRyan Brown 139998c8a1cSRyan Brown std::vector<lldb::addr_t> args; 140998c8a1cSRyan Brown 141b9c1b51eSKate Stone if (!AddArguments(exe_ctx, args, struct_address, diagnostic_manager)) { 142b9c1b51eSKate Stone diagnostic_manager.Printf(eDiagnosticSeverityError, 143b9c1b51eSKate Stone "errored out in %s, couldn't AddArguments", 144579e70c9SSean Callanan __FUNCTION__); 145998c8a1cSRyan Brown return lldb::eExpressionSetupError; 146998c8a1cSRyan Brown } 147998c8a1cSRyan Brown 148b9c1b51eSKate Stone lldb::ThreadPlanSP call_plan_sp(new ThreadPlanCallUserExpression( 149b9c1b51eSKate Stone exe_ctx.GetThreadRef(), wrapper_address, args, options, 150b9c1b51eSKate Stone shared_ptr_to_me)); 151998c8a1cSRyan Brown 152579e70c9SSean Callanan StreamString ss; 153b9c1b51eSKate Stone if (!call_plan_sp || !call_plan_sp->ValidatePlan(&ss)) { 154c156427dSZachary Turner diagnostic_manager.PutString(eDiagnosticSeverityError, ss.GetString()); 155998c8a1cSRyan Brown return lldb::eExpressionSetupError; 156579e70c9SSean Callanan } 157998c8a1cSRyan Brown 158998c8a1cSRyan Brown ThreadPlanCallUserExpression *user_expression_plan = 159998c8a1cSRyan Brown static_cast<ThreadPlanCallUserExpression *>(call_plan_sp.get()); 160998c8a1cSRyan Brown 161b9c1b51eSKate Stone lldb::addr_t function_stack_pointer = 162b9c1b51eSKate Stone user_expression_plan->GetFunctionStackPointer(); 163998c8a1cSRyan Brown 164998c8a1cSRyan Brown function_stack_bottom = function_stack_pointer - HostInfo::GetPageSize(); 165998c8a1cSRyan Brown function_stack_top = function_stack_pointer; 166998c8a1cSRyan Brown 1673011c7ebSRaphael Isemann LLDB_LOGF(log, 168b9c1b51eSKate Stone "-- [UserExpression::Execute] Execution of expression begins --"); 169998c8a1cSRyan Brown 170998c8a1cSRyan Brown if (exe_ctx.GetProcessPtr()) 171998c8a1cSRyan Brown exe_ctx.GetProcessPtr()->SetRunningUserExpression(true); 172998c8a1cSRyan Brown 173998c8a1cSRyan Brown lldb::ExpressionResults execution_result = 174b9c1b51eSKate Stone exe_ctx.GetProcessRef().RunThreadPlan(exe_ctx, call_plan_sp, options, 175b9c1b51eSKate Stone diagnostic_manager); 176998c8a1cSRyan Brown 177998c8a1cSRyan Brown if (exe_ctx.GetProcessPtr()) 178998c8a1cSRyan Brown exe_ctx.GetProcessPtr()->SetRunningUserExpression(false); 179998c8a1cSRyan Brown 18063e5fb76SJonas Devlieghere LLDB_LOGF(log, "-- [UserExpression::Execute] Execution of expression " 181b9c1b51eSKate Stone "completed --"); 182998c8a1cSRyan Brown 183b9c1b51eSKate Stone if (execution_result == lldb::eExpressionInterrupted || 184b9c1b51eSKate Stone execution_result == lldb::eExpressionHitBreakpoint) { 185248a1305SKonrad Kleine const char *error_desc = nullptr; 186998c8a1cSRyan Brown 187b9c1b51eSKate Stone if (call_plan_sp) { 188998c8a1cSRyan Brown lldb::StopInfoSP real_stop_info_sp = call_plan_sp->GetRealStopInfo(); 189998c8a1cSRyan Brown if (real_stop_info_sp) 190998c8a1cSRyan Brown error_desc = real_stop_info_sp->GetDescription(); 191998c8a1cSRyan Brown } 192998c8a1cSRyan Brown if (error_desc) 193b9c1b51eSKate Stone diagnostic_manager.Printf(eDiagnosticSeverityError, 194b9c1b51eSKate Stone "Execution was interrupted, reason: %s.", 195579e70c9SSean Callanan error_desc); 196998c8a1cSRyan Brown else 197e2411fabSZachary Turner diagnostic_manager.PutString(eDiagnosticSeverityError, 198b9c1b51eSKate Stone "Execution was interrupted."); 199998c8a1cSRyan Brown 200b9c1b51eSKate Stone if ((execution_result == lldb::eExpressionInterrupted && 201b9c1b51eSKate Stone options.DoesUnwindOnError()) || 202b9c1b51eSKate Stone (execution_result == lldb::eExpressionHitBreakpoint && 203b9c1b51eSKate Stone options.DoesIgnoreBreakpoints())) 204579e70c9SSean Callanan diagnostic_manager.AppendMessageToDiagnostic( 205b9c1b51eSKate Stone "The process has been returned to the state before expression " 206b9c1b51eSKate Stone "evaluation."); 207b9c1b51eSKate Stone else { 208998c8a1cSRyan Brown if (execution_result == lldb::eExpressionHitBreakpoint) 209998c8a1cSRyan Brown user_expression_plan->TransferExpressionOwnership(); 210579e70c9SSean Callanan diagnostic_manager.AppendMessageToDiagnostic( 211b9c1b51eSKate Stone "The process has been left at the point where it was " 212b9c1b51eSKate Stone "interrupted, " 213b9c1b51eSKate Stone "use \"thread return -x\" to return to the state before " 214b9c1b51eSKate Stone "expression evaluation."); 215998c8a1cSRyan Brown } 216998c8a1cSRyan Brown 217998c8a1cSRyan Brown return execution_result; 218b9c1b51eSKate Stone } else if (execution_result == lldb::eExpressionStoppedForDebug) { 219e2411fabSZachary Turner diagnostic_manager.PutString( 220579e70c9SSean Callanan eDiagnosticSeverityRemark, 221998c8a1cSRyan Brown "Execution was halted at the first instruction of the expression " 222998c8a1cSRyan Brown "function because \"debug\" was requested.\n" 223b9c1b51eSKate Stone "Use \"thread return -x\" to return to the state before expression " 224b9c1b51eSKate Stone "evaluation."); 225998c8a1cSRyan Brown return execution_result; 226b9c1b51eSKate Stone } else if (execution_result != lldb::eExpressionCompleted) { 227b9c1b51eSKate Stone diagnostic_manager.Printf( 2283011c7ebSRaphael Isemann eDiagnosticSeverityError, "Couldn't execute function; result was %s", 229998c8a1cSRyan Brown Process::ExecutionResultAsCString(execution_result)); 230998c8a1cSRyan Brown return execution_result; 231998c8a1cSRyan Brown } 232998c8a1cSRyan Brown } 233998c8a1cSRyan Brown 234b9c1b51eSKate Stone if (FinalizeJITExecution(diagnostic_manager, exe_ctx, result, 235b9c1b51eSKate Stone function_stack_bottom, function_stack_top)) { 236998c8a1cSRyan Brown return lldb::eExpressionCompleted; 237b9c1b51eSKate Stone } else { 238998c8a1cSRyan Brown return lldb::eExpressionResultUnavailable; 239998c8a1cSRyan Brown } 240998c8a1cSRyan Brown } 241998c8a1cSRyan Brown 242b9c1b51eSKate Stone bool LLVMUserExpression::FinalizeJITExecution( 243b9c1b51eSKate Stone DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx, 244998c8a1cSRyan Brown lldb::ExpressionVariableSP &result, lldb::addr_t function_stack_bottom, 245b9c1b51eSKate Stone lldb::addr_t function_stack_top) { 246998c8a1cSRyan Brown Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); 247998c8a1cSRyan Brown 24863e5fb76SJonas Devlieghere LLDB_LOGF(log, "-- [UserExpression::FinalizeJITExecution] Dematerializing " 249b9c1b51eSKate Stone "after execution --"); 250998c8a1cSRyan Brown 251b9c1b51eSKate Stone if (!m_dematerializer_sp) { 252579e70c9SSean Callanan diagnostic_manager.Printf(eDiagnosticSeverityError, 253b9c1b51eSKate Stone "Couldn't apply expression side effects : no " 254b9c1b51eSKate Stone "dematerializer is present"); 255998c8a1cSRyan Brown return false; 256998c8a1cSRyan Brown } 257998c8a1cSRyan Brown 25897206d57SZachary Turner Status dematerialize_error; 259998c8a1cSRyan Brown 260b9c1b51eSKate Stone m_dematerializer_sp->Dematerialize(dematerialize_error, function_stack_bottom, 261b9c1b51eSKate Stone function_stack_top); 262998c8a1cSRyan Brown 263b9c1b51eSKate Stone if (!dematerialize_error.Success()) { 264b9c1b51eSKate Stone diagnostic_manager.Printf(eDiagnosticSeverityError, 265b9c1b51eSKate Stone "Couldn't apply expression side effects : %s", 266998c8a1cSRyan Brown dematerialize_error.AsCString("unknown error")); 267998c8a1cSRyan Brown return false; 268998c8a1cSRyan Brown } 269998c8a1cSRyan Brown 270b9c1b51eSKate Stone result = 271b9c1b51eSKate Stone GetResultAfterDematerialization(exe_ctx.GetBestExecutionContextScope()); 272998c8a1cSRyan Brown 273998c8a1cSRyan Brown if (result) 274998c8a1cSRyan Brown result->TransferAddress(); 275998c8a1cSRyan Brown 276998c8a1cSRyan Brown m_dematerializer_sp.reset(); 277998c8a1cSRyan Brown 278998c8a1cSRyan Brown return true; 279998c8a1cSRyan Brown } 280998c8a1cSRyan Brown 281b9c1b51eSKate Stone bool LLVMUserExpression::PrepareToExecuteJITExpression( 282b9c1b51eSKate Stone DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx, 283b9c1b51eSKate Stone lldb::addr_t &struct_address) { 284998c8a1cSRyan Brown lldb::TargetSP target; 285998c8a1cSRyan Brown lldb::ProcessSP process; 286998c8a1cSRyan Brown lldb::StackFrameSP frame; 287998c8a1cSRyan Brown 288b9c1b51eSKate Stone if (!LockAndCheckContext(exe_ctx, target, process, frame)) { 289e2411fabSZachary Turner diagnostic_manager.PutString( 290b9c1b51eSKate Stone eDiagnosticSeverityError, 291579e70c9SSean Callanan "The context has changed before we could JIT the expression!"); 292998c8a1cSRyan Brown return false; 293998c8a1cSRyan Brown } 294998c8a1cSRyan Brown 295b9c1b51eSKate Stone if (m_jit_start_addr != LLDB_INVALID_ADDRESS || m_can_interpret) { 296b9c1b51eSKate Stone if (m_materialized_address == LLDB_INVALID_ADDRESS) { 29797206d57SZachary Turner Status alloc_error; 298998c8a1cSRyan Brown 299998c8a1cSRyan Brown IRMemoryMap::AllocationPolicy policy = 300b9c1b51eSKate Stone m_can_interpret ? IRMemoryMap::eAllocationPolicyHostOnly 301b9c1b51eSKate Stone : IRMemoryMap::eAllocationPolicyMirror; 302998c8a1cSRyan Brown 3032c381414SJim Ingham const bool zero_memory = false; 3042c381414SJim Ingham 305b9c1b51eSKate Stone m_materialized_address = m_execution_unit_sp->Malloc( 306d5b44036SJonas Devlieghere m_materializer_up->GetStructByteSize(), 307d5b44036SJonas Devlieghere m_materializer_up->GetStructAlignment(), 308b9c1b51eSKate Stone lldb::ePermissionsReadable | lldb::ePermissionsWritable, policy, 309b9c1b51eSKate Stone zero_memory, alloc_error); 310998c8a1cSRyan Brown 311b9c1b51eSKate Stone if (!alloc_error.Success()) { 312b9c1b51eSKate Stone diagnostic_manager.Printf( 313b9c1b51eSKate Stone eDiagnosticSeverityError, 314579e70c9SSean Callanan "Couldn't allocate space for materialized struct: %s", 315579e70c9SSean Callanan alloc_error.AsCString()); 316998c8a1cSRyan Brown return false; 317998c8a1cSRyan Brown } 318998c8a1cSRyan Brown } 319998c8a1cSRyan Brown 320998c8a1cSRyan Brown struct_address = m_materialized_address; 321998c8a1cSRyan Brown 322b9c1b51eSKate Stone if (m_can_interpret && m_stack_frame_bottom == LLDB_INVALID_ADDRESS) { 32397206d57SZachary Turner Status alloc_error; 324998c8a1cSRyan Brown 325998c8a1cSRyan Brown const size_t stack_frame_size = 512 * 1024; 326998c8a1cSRyan Brown 3272c381414SJim Ingham const bool zero_memory = false; 3282c381414SJim Ingham 329b9c1b51eSKate Stone m_stack_frame_bottom = m_execution_unit_sp->Malloc( 330b9c1b51eSKate Stone stack_frame_size, 8, 331998c8a1cSRyan Brown lldb::ePermissionsReadable | lldb::ePermissionsWritable, 332b9c1b51eSKate Stone IRMemoryMap::eAllocationPolicyHostOnly, zero_memory, alloc_error); 333998c8a1cSRyan Brown 334998c8a1cSRyan Brown m_stack_frame_top = m_stack_frame_bottom + stack_frame_size; 335998c8a1cSRyan Brown 336b9c1b51eSKate Stone if (!alloc_error.Success()) { 337b9c1b51eSKate Stone diagnostic_manager.Printf( 338b9c1b51eSKate Stone eDiagnosticSeverityError, 339b9c1b51eSKate Stone "Couldn't allocate space for the stack frame: %s", 340579e70c9SSean Callanan alloc_error.AsCString()); 341998c8a1cSRyan Brown return false; 342998c8a1cSRyan Brown } 343998c8a1cSRyan Brown } 344998c8a1cSRyan Brown 34597206d57SZachary Turner Status materialize_error; 346998c8a1cSRyan Brown 347d5b44036SJonas Devlieghere m_dematerializer_sp = m_materializer_up->Materialize( 348b9c1b51eSKate Stone frame, *m_execution_unit_sp, struct_address, materialize_error); 349998c8a1cSRyan Brown 350b9c1b51eSKate Stone if (!materialize_error.Success()) { 351b9c1b51eSKate Stone diagnostic_manager.Printf(eDiagnosticSeverityError, 352b9c1b51eSKate Stone "Couldn't materialize: %s", 353579e70c9SSean Callanan materialize_error.AsCString()); 354998c8a1cSRyan Brown return false; 355998c8a1cSRyan Brown } 356998c8a1cSRyan Brown } 357998c8a1cSRyan Brown return true; 358998c8a1cSRyan Brown } 359998c8a1cSRyan Brown 360b9c1b51eSKate Stone lldb::ModuleSP LLVMUserExpression::GetJITModule() { 361998c8a1cSRyan Brown if (m_execution_unit_sp) 362998c8a1cSRyan Brown return m_execution_unit_sp->GetJITModule(); 363998c8a1cSRyan Brown return lldb::ModuleSP(); 364998c8a1cSRyan Brown } 365