[lldb][NFC] Fix all formatting errors in .cpp file headers
Summary:
A *.cpp file header in LLDB (and in LLDB) should like this:
```
//===-- TestUtilities.cpp -------------------------------------------------===//
```
However in LLDB most of our source files have arbitrary changes to this format and
these changes are spreading through LLDB as folks usually just use the existing
source files as templates for their new files (most notably the unnecessary
editor language indicator `-*- C++ -*-` is spreading and in every review
someone is pointing out that this is wrong, resulting in people pointing out that this
is done in the same way in other files).
This patch removes most of these inconsistencies including the editor language indicators,
all the different missing/additional '-' characters, files that center the file name, missing
trailing `===//` (mostly caused by clang-format breaking the line).
Reviewers: aprantl, espindola, jfb, shafik, JDevlieghere
Reviewed By: JDevlieghere
Subscribers: dexonsmith, wuzish, emaste, sdardis, nemanjai, kbarton, MaskRay, atanasyan, arphaman, jfb, abidh, jsji, JDevlieghere, usaxena95, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D73258
2020-01-24 15:23:27 +08:00
|
|
|
//===-- LLVMUserExpression.cpp --------------------------------------------===//
|
2015-11-03 03:30:40 +08:00
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2015-11-03 03:30:40 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
|
|
|
|
#include "lldb/Expression/LLVMUserExpression.h"
|
|
|
|
#include "lldb/Core/Module.h"
|
|
|
|
#include "lldb/Core/StreamFile.h"
|
|
|
|
#include "lldb/Core/ValueObjectConstResult.h"
|
2016-03-19 08:03:59 +08:00
|
|
|
#include "lldb/Expression/DiagnosticManager.h"
|
2019-07-19 08:39:51 +08:00
|
|
|
#include "lldb/Expression/ExpressionVariable.h"
|
2015-11-03 03:30:40 +08:00
|
|
|
#include "lldb/Expression/IRExecutionUnit.h"
|
|
|
|
#include "lldb/Expression/IRInterpreter.h"
|
|
|
|
#include "lldb/Expression/Materializer.h"
|
|
|
|
#include "lldb/Host/HostInfo.h"
|
|
|
|
#include "lldb/Symbol/Block.h"
|
|
|
|
#include "lldb/Symbol/Function.h"
|
|
|
|
#include "lldb/Symbol/ObjectFile.h"
|
|
|
|
#include "lldb/Symbol/SymbolVendor.h"
|
|
|
|
#include "lldb/Symbol/Type.h"
|
|
|
|
#include "lldb/Symbol/VariableList.h"
|
|
|
|
#include "lldb/Target/ExecutionContext.h"
|
|
|
|
#include "lldb/Target/Process.h"
|
|
|
|
#include "lldb/Target/StackFrame.h"
|
|
|
|
#include "lldb/Target/Target.h"
|
|
|
|
#include "lldb/Target/ThreadPlan.h"
|
|
|
|
#include "lldb/Target/ThreadPlanCallUserExpression.h"
|
2017-02-03 05:39:50 +08:00
|
|
|
#include "lldb/Utility/ConstString.h"
|
2017-03-04 04:56:28 +08:00
|
|
|
#include "lldb/Utility/Log.h"
|
2017-02-03 05:39:50 +08:00
|
|
|
#include "lldb/Utility/StreamString.h"
|
2015-11-03 03:30:40 +08:00
|
|
|
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
2019-11-12 17:04:32 +08:00
|
|
|
char LLVMUserExpression::ID;
|
|
|
|
|
2015-11-03 10:11:24 +08:00
|
|
|
LLVMUserExpression::LLVMUserExpression(ExecutionContextScope &exe_scope,
|
2016-11-08 12:52:16 +08:00
|
|
|
llvm::StringRef expr,
|
|
|
|
llvm::StringRef prefix,
|
2015-11-03 10:11:24 +08:00
|
|
|
lldb::LanguageType language,
|
|
|
|
ResultType desired_type,
|
2019-11-12 17:04:32 +08:00
|
|
|
const EvaluateExpressionOptions &options)
|
|
|
|
: UserExpression(exe_scope, expr, prefix, language, desired_type, options),
|
2015-11-03 03:30:40 +08:00
|
|
|
m_stack_frame_bottom(LLDB_INVALID_ADDRESS),
|
2019-02-13 14:25:41 +08:00
|
|
|
m_stack_frame_top(LLDB_INVALID_ADDRESS), m_allow_cxx(false),
|
|
|
|
m_allow_objc(false), m_transformed_text(), m_execution_unit_sp(),
|
2019-11-12 17:04:32 +08:00
|
|
|
m_materializer_up(), m_jit_module_wp(), m_can_interpret(false),
|
|
|
|
m_materialized_address(LLDB_INVALID_ADDRESS) {}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-11-03 03:30:40 +08:00
|
|
|
LLVMUserExpression::~LLVMUserExpression() {
|
|
|
|
if (m_target) {
|
|
|
|
lldb::ModuleSP jit_module_sp(m_jit_module_wp.lock());
|
|
|
|
if (jit_module_sp)
|
|
|
|
m_target->GetImages().Remove(jit_module_sp);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2015-11-03 03:30:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
lldb::ExpressionResults
|
|
|
|
LLVMUserExpression::DoExecute(DiagnosticManager &diagnostic_manager,
|
2016-04-13 01:17:35 +08:00
|
|
|
ExecutionContext &exe_ctx,
|
|
|
|
const EvaluateExpressionOptions &options,
|
2015-11-03 03:30:40 +08:00
|
|
|
lldb::UserExpressionSP &shared_ptr_to_me,
|
|
|
|
lldb::ExpressionVariableSP &result) {
|
|
|
|
// The expression log is quite verbose, and if you're just tracking the
|
2018-05-01 00:49:04 +08:00
|
|
|
// execution of the expression, it's quite convenient to have these logs come
|
|
|
|
// out with the STEP log as well.
|
2015-11-03 03:30:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EXPRESSIONS |
|
|
|
|
LIBLLDB_LOG_STEP));
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2019-10-29 22:13:02 +08:00
|
|
|
if (m_jit_start_addr == LLDB_INVALID_ADDRESS && !m_can_interpret) {
|
|
|
|
diagnostic_manager.PutString(
|
|
|
|
eDiagnosticSeverityError,
|
|
|
|
"Expression can't be run, because there is no JIT compiled function");
|
|
|
|
return lldb::eExpressionSetupError;
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2019-10-29 22:13:02 +08:00
|
|
|
lldb::addr_t struct_address = LLDB_INVALID_ADDRESS;
|
|
|
|
|
|
|
|
if (!PrepareToExecuteJITExpression(diagnostic_manager, exe_ctx,
|
|
|
|
struct_address)) {
|
|
|
|
diagnostic_manager.Printf(
|
|
|
|
eDiagnosticSeverityError,
|
|
|
|
"errored out in %s, couldn't PrepareToExecuteJITExpression",
|
|
|
|
__FUNCTION__);
|
|
|
|
return lldb::eExpressionSetupError;
|
|
|
|
}
|
|
|
|
|
|
|
|
lldb::addr_t function_stack_bottom = LLDB_INVALID_ADDRESS;
|
|
|
|
lldb::addr_t function_stack_top = LLDB_INVALID_ADDRESS;
|
|
|
|
|
|
|
|
if (m_can_interpret) {
|
|
|
|
llvm::Module *module = m_execution_unit_sp->GetModule();
|
|
|
|
llvm::Function *function = m_execution_unit_sp->GetFunction();
|
|
|
|
|
|
|
|
if (!module || !function) {
|
|
|
|
diagnostic_manager.PutString(
|
2015-11-03 03:30:40 +08:00
|
|
|
eDiagnosticSeverityError,
|
2019-10-29 22:13:02 +08:00
|
|
|
"supposed to interpret, but nothing is there");
|
2015-11-03 03:30:40 +08:00
|
|
|
return lldb::eExpressionSetupError;
|
|
|
|
}
|
|
|
|
|
2019-10-29 22:13:02 +08:00
|
|
|
Status interpreter_error;
|
2015-11-03 03:30:40 +08:00
|
|
|
|
2019-10-29 22:13:02 +08:00
|
|
|
std::vector<lldb::addr_t> args;
|
2015-11-03 03:30:40 +08:00
|
|
|
|
2019-10-29 22:13:02 +08:00
|
|
|
if (!AddArguments(exe_ctx, args, struct_address, diagnostic_manager)) {
|
|
|
|
diagnostic_manager.Printf(eDiagnosticSeverityError,
|
|
|
|
"errored out in %s, couldn't AddArguments",
|
|
|
|
__FUNCTION__);
|
|
|
|
return lldb::eExpressionSetupError;
|
|
|
|
}
|
2015-11-03 03:30:40 +08:00
|
|
|
|
2019-10-29 22:13:02 +08:00
|
|
|
function_stack_bottom = m_stack_frame_bottom;
|
|
|
|
function_stack_top = m_stack_frame_top;
|
2015-11-03 03:30:40 +08:00
|
|
|
|
2019-10-29 22:13:02 +08:00
|
|
|
IRInterpreter::Interpret(*module, *function, args, *m_execution_unit_sp,
|
|
|
|
interpreter_error, function_stack_bottom,
|
|
|
|
function_stack_top, exe_ctx);
|
2015-11-03 03:30:40 +08:00
|
|
|
|
2019-10-29 22:13:02 +08:00
|
|
|
if (!interpreter_error.Success()) {
|
|
|
|
diagnostic_manager.Printf(eDiagnosticSeverityError,
|
|
|
|
"supposed to interpret, but failed: %s",
|
|
|
|
interpreter_error.AsCString());
|
|
|
|
return lldb::eExpressionDiscarded;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (!exe_ctx.HasThreadScope()) {
|
|
|
|
diagnostic_manager.Printf(eDiagnosticSeverityError,
|
|
|
|
"%s called with no thread selected",
|
|
|
|
__FUNCTION__);
|
|
|
|
return lldb::eExpressionSetupError;
|
|
|
|
}
|
2015-11-03 03:30:40 +08:00
|
|
|
|
2020-05-21 09:00:56 +08:00
|
|
|
// Store away the thread ID for error reporting, in case it exits
|
|
|
|
// during execution:
|
|
|
|
lldb::tid_t expr_thread_id = exe_ctx.GetThreadRef().GetID();
|
|
|
|
|
2019-10-29 22:13:02 +08:00
|
|
|
Address wrapper_address(m_jit_start_addr);
|
2015-11-03 03:30:40 +08:00
|
|
|
|
2019-10-29 22:13:02 +08:00
|
|
|
std::vector<lldb::addr_t> args;
|
2015-11-03 03:30:40 +08:00
|
|
|
|
2019-10-29 22:13:02 +08:00
|
|
|
if (!AddArguments(exe_ctx, args, struct_address, diagnostic_manager)) {
|
|
|
|
diagnostic_manager.Printf(eDiagnosticSeverityError,
|
|
|
|
"errored out in %s, couldn't AddArguments",
|
|
|
|
__FUNCTION__);
|
|
|
|
return lldb::eExpressionSetupError;
|
|
|
|
}
|
2015-11-03 03:30:40 +08:00
|
|
|
|
2019-10-29 22:13:02 +08:00
|
|
|
lldb::ThreadPlanSP call_plan_sp(new ThreadPlanCallUserExpression(
|
|
|
|
exe_ctx.GetThreadRef(), wrapper_address, args, options,
|
|
|
|
shared_ptr_to_me));
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2019-10-29 22:13:02 +08:00
|
|
|
StreamString ss;
|
|
|
|
if (!call_plan_sp || !call_plan_sp->ValidatePlan(&ss)) {
|
|
|
|
diagnostic_manager.PutString(eDiagnosticSeverityError, ss.GetString());
|
|
|
|
return lldb::eExpressionSetupError;
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2019-10-29 22:13:02 +08:00
|
|
|
ThreadPlanCallUserExpression *user_expression_plan =
|
|
|
|
static_cast<ThreadPlanCallUserExpression *>(call_plan_sp.get());
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2019-10-29 22:13:02 +08:00
|
|
|
lldb::addr_t function_stack_pointer =
|
|
|
|
user_expression_plan->GetFunctionStackPointer();
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2019-10-29 22:13:02 +08:00
|
|
|
function_stack_bottom = function_stack_pointer - HostInfo::GetPageSize();
|
|
|
|
function_stack_top = function_stack_pointer;
|
|
|
|
|
|
|
|
LLDB_LOGF(log,
|
|
|
|
"-- [UserExpression::Execute] Execution of expression begins --");
|
|
|
|
|
|
|
|
if (exe_ctx.GetProcessPtr())
|
|
|
|
exe_ctx.GetProcessPtr()->SetRunningUserExpression(true);
|
|
|
|
|
|
|
|
lldb::ExpressionResults execution_result =
|
|
|
|
exe_ctx.GetProcessRef().RunThreadPlan(exe_ctx, call_plan_sp, options,
|
|
|
|
diagnostic_manager);
|
|
|
|
|
|
|
|
if (exe_ctx.GetProcessPtr())
|
|
|
|
exe_ctx.GetProcessPtr()->SetRunningUserExpression(false);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2019-10-29 22:13:02 +08:00
|
|
|
LLDB_LOGF(log, "-- [UserExpression::Execute] Execution of expression "
|
|
|
|
"completed --");
|
|
|
|
|
|
|
|
if (execution_result == lldb::eExpressionInterrupted ||
|
|
|
|
execution_result == lldb::eExpressionHitBreakpoint) {
|
|
|
|
const char *error_desc = nullptr;
|
|
|
|
|
2021-02-15 14:59:31 +08:00
|
|
|
if (user_expression_plan) {
|
|
|
|
if (auto real_stop_info_sp = user_expression_plan->GetRealStopInfo())
|
2019-10-29 22:13:02 +08:00
|
|
|
error_desc = real_stop_info_sp->GetDescription();
|
|
|
|
}
|
|
|
|
if (error_desc)
|
|
|
|
diagnostic_manager.Printf(eDiagnosticSeverityError,
|
|
|
|
"Execution was interrupted, reason: %s.",
|
|
|
|
error_desc);
|
|
|
|
else
|
|
|
|
diagnostic_manager.PutString(eDiagnosticSeverityError,
|
|
|
|
"Execution was interrupted.");
|
|
|
|
|
|
|
|
if ((execution_result == lldb::eExpressionInterrupted &&
|
|
|
|
options.DoesUnwindOnError()) ||
|
|
|
|
(execution_result == lldb::eExpressionHitBreakpoint &&
|
|
|
|
options.DoesIgnoreBreakpoints()))
|
|
|
|
diagnostic_manager.AppendMessageToDiagnostic(
|
|
|
|
"The process has been returned to the state before expression "
|
2015-11-03 03:30:40 +08:00
|
|
|
"evaluation.");
|
2019-10-29 22:13:02 +08:00
|
|
|
else {
|
|
|
|
if (execution_result == lldb::eExpressionHitBreakpoint)
|
|
|
|
user_expression_plan->TransferExpressionOwnership();
|
|
|
|
diagnostic_manager.AppendMessageToDiagnostic(
|
|
|
|
"The process has been left at the point where it was "
|
|
|
|
"interrupted, "
|
|
|
|
"use \"thread return -x\" to return to the state before "
|
|
|
|
"expression evaluation.");
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2019-10-29 22:13:02 +08:00
|
|
|
return execution_result;
|
|
|
|
} else if (execution_result == lldb::eExpressionStoppedForDebug) {
|
|
|
|
diagnostic_manager.PutString(
|
|
|
|
eDiagnosticSeverityRemark,
|
|
|
|
"Execution was halted at the first instruction of the expression "
|
|
|
|
"function because \"debug\" was requested.\n"
|
|
|
|
"Use \"thread return -x\" to return to the state before expression "
|
|
|
|
"evaluation.");
|
|
|
|
return execution_result;
|
2020-05-21 09:00:56 +08:00
|
|
|
} else if (execution_result == lldb::eExpressionThreadVanished) {
|
|
|
|
diagnostic_manager.Printf(
|
|
|
|
eDiagnosticSeverityError,
|
|
|
|
"Couldn't complete execution; the thread "
|
|
|
|
"on which the expression was being run: 0x%" PRIx64
|
|
|
|
" exited during its execution.",
|
|
|
|
expr_thread_id);
|
|
|
|
return execution_result;
|
2019-10-29 22:13:02 +08:00
|
|
|
} else if (execution_result != lldb::eExpressionCompleted) {
|
|
|
|
diagnostic_manager.Printf(
|
|
|
|
eDiagnosticSeverityError, "Couldn't execute function; result was %s",
|
|
|
|
Process::ExecutionResultAsCString(execution_result));
|
|
|
|
return execution_result;
|
2015-11-03 03:30:40 +08:00
|
|
|
}
|
2019-10-29 22:13:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (FinalizeJITExecution(diagnostic_manager, exe_ctx, result,
|
|
|
|
function_stack_bottom, function_stack_top)) {
|
|
|
|
return lldb::eExpressionCompleted;
|
2016-09-07 04:57:50 +08:00
|
|
|
} else {
|
2019-10-29 22:13:02 +08:00
|
|
|
return lldb::eExpressionResultUnavailable;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2015-11-03 03:30:40 +08:00
|
|
|
}
|
|
|
|
|
2016-03-19 08:03:59 +08:00
|
|
|
bool LLVMUserExpression::FinalizeJITExecution(
|
|
|
|
DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
|
2015-11-03 03:30:40 +08:00
|
|
|
lldb::ExpressionVariableSP &result, lldb::addr_t function_stack_bottom,
|
|
|
|
lldb::addr_t function_stack_top) {
|
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
|
|
|
|
|
2019-07-25 01:56:10 +08:00
|
|
|
LLDB_LOGF(log, "-- [UserExpression::FinalizeJITExecution] Dematerializing "
|
|
|
|
"after execution --");
|
2015-11-03 03:30:40 +08:00
|
|
|
|
|
|
|
if (!m_dematerializer_sp) {
|
2016-03-19 08:03:59 +08:00
|
|
|
diagnostic_manager.Printf(eDiagnosticSeverityError,
|
|
|
|
"Couldn't apply expression side effects : no "
|
|
|
|
"dematerializer is present");
|
2015-11-03 03:30:40 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-05-12 12:51:55 +08:00
|
|
|
Status dematerialize_error;
|
2015-11-03 03:30:40 +08:00
|
|
|
|
|
|
|
m_dematerializer_sp->Dematerialize(dematerialize_error, function_stack_bottom,
|
|
|
|
function_stack_top);
|
|
|
|
|
|
|
|
if (!dematerialize_error.Success()) {
|
2016-03-19 08:03:59 +08:00
|
|
|
diagnostic_manager.Printf(eDiagnosticSeverityError,
|
|
|
|
"Couldn't apply expression side effects : %s",
|
|
|
|
dematerialize_error.AsCString("unknown error"));
|
2015-11-03 03:30:40 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
result =
|
|
|
|
GetResultAfterDematerialization(exe_ctx.GetBestExecutionContextScope());
|
|
|
|
|
|
|
|
if (result)
|
|
|
|
result->TransferAddress();
|
|
|
|
|
|
|
|
m_dematerializer_sp.reset();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-03-19 08:03:59 +08:00
|
|
|
bool LLVMUserExpression::PrepareToExecuteJITExpression(
|
|
|
|
DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
|
2015-11-03 03:30:40 +08:00
|
|
|
lldb::addr_t &struct_address) {
|
|
|
|
lldb::TargetSP target;
|
|
|
|
lldb::ProcessSP process;
|
|
|
|
lldb::StackFrameSP frame;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-11-03 03:30:40 +08:00
|
|
|
if (!LockAndCheckContext(exe_ctx, target, process, frame)) {
|
2016-11-13 03:12:56 +08:00
|
|
|
diagnostic_manager.PutString(
|
2016-03-19 08:03:59 +08:00
|
|
|
eDiagnosticSeverityError,
|
|
|
|
"The context has changed before we could JIT the expression!");
|
2015-11-03 03:30:40 +08:00
|
|
|
return false;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2015-11-03 03:30:40 +08:00
|
|
|
if (m_jit_start_addr != LLDB_INVALID_ADDRESS || m_can_interpret) {
|
|
|
|
if (m_materialized_address == LLDB_INVALID_ADDRESS) {
|
2017-05-12 12:51:55 +08:00
|
|
|
Status alloc_error;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-11-03 03:30:40 +08:00
|
|
|
IRMemoryMap::AllocationPolicy policy =
|
|
|
|
m_can_interpret ? IRMemoryMap::eAllocationPolicyHostOnly
|
|
|
|
: IRMemoryMap::eAllocationPolicyMirror;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-11-05 04:32:27 +08:00
|
|
|
const bool zero_memory = false;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-11-05 04:32:27 +08:00
|
|
|
m_materialized_address = m_execution_unit_sp->Malloc(
|
2019-02-13 14:25:41 +08:00
|
|
|
m_materializer_up->GetStructByteSize(),
|
|
|
|
m_materializer_up->GetStructAlignment(),
|
2015-11-05 04:32:27 +08:00
|
|
|
lldb::ePermissionsReadable | lldb::ePermissionsWritable, policy,
|
2015-11-03 03:30:40 +08:00
|
|
|
zero_memory, alloc_error);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-11-03 03:30:40 +08:00
|
|
|
if (!alloc_error.Success()) {
|
2016-03-19 08:03:59 +08:00
|
|
|
diagnostic_manager.Printf(
|
|
|
|
eDiagnosticSeverityError,
|
|
|
|
"Couldn't allocate space for materialized struct: %s",
|
|
|
|
alloc_error.AsCString());
|
2015-11-03 03:30:40 +08:00
|
|
|
return false;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2015-11-03 03:30:40 +08:00
|
|
|
}
|
|
|
|
|
2015-11-05 04:32:27 +08:00
|
|
|
struct_address = m_materialized_address;
|
2015-11-03 03:30:40 +08:00
|
|
|
|
|
|
|
if (m_can_interpret && m_stack_frame_bottom == LLDB_INVALID_ADDRESS) {
|
2017-05-12 12:51:55 +08:00
|
|
|
Status alloc_error;
|
2015-11-03 03:30:40 +08:00
|
|
|
|
|
|
|
const size_t stack_frame_size = 512 * 1024;
|
|
|
|
|
2015-11-05 04:32:27 +08:00
|
|
|
const bool zero_memory = false;
|
|
|
|
|
|
|
|
m_stack_frame_bottom = m_execution_unit_sp->Malloc(
|
|
|
|
stack_frame_size, 8,
|
2015-11-03 03:30:40 +08:00
|
|
|
lldb::ePermissionsReadable | lldb::ePermissionsWritable,
|
2015-11-05 04:32:27 +08:00
|
|
|
IRMemoryMap::eAllocationPolicyHostOnly, zero_memory, alloc_error);
|
2015-11-03 03:30:40 +08:00
|
|
|
|
|
|
|
m_stack_frame_top = m_stack_frame_bottom + stack_frame_size;
|
|
|
|
|
|
|
|
if (!alloc_error.Success()) {
|
2016-03-19 08:03:59 +08:00
|
|
|
diagnostic_manager.Printf(
|
|
|
|
eDiagnosticSeverityError,
|
|
|
|
"Couldn't allocate space for the stack frame: %s",
|
|
|
|
alloc_error.AsCString());
|
2015-11-03 03:30:40 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-05-12 12:51:55 +08:00
|
|
|
Status materialize_error;
|
2015-11-03 03:30:40 +08:00
|
|
|
|
2019-02-13 14:25:41 +08:00
|
|
|
m_dematerializer_sp = m_materializer_up->Materialize(
|
2015-11-03 03:30:40 +08:00
|
|
|
frame, *m_execution_unit_sp, struct_address, materialize_error);
|
|
|
|
|
|
|
|
if (!materialize_error.Success()) {
|
2016-03-19 08:03:59 +08:00
|
|
|
diagnostic_manager.Printf(eDiagnosticSeverityError,
|
|
|
|
"Couldn't materialize: %s",
|
|
|
|
materialize_error.AsCString());
|
2015-11-03 03:30:40 +08:00
|
|
|
return false;
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2015-11-03 03:30:40 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|