summaryrefslogtreecommitdiff
path: root/source/Expression
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-05-16 19:47:58 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-05-16 19:47:58 +0000
commitb76161e41bc2c07cd47f9c61f875d1be95e26d10 (patch)
treed03c19ce10dec6419f97df1d4dac9d47eb88982f /source/Expression
parent8b4000f13b303cc154136abc74c55670673e2a96 (diff)
Notes
Diffstat (limited to 'source/Expression')
-rw-r--r--source/Expression/DWARFExpression.cpp14
-rw-r--r--source/Expression/FunctionCaller.cpp8
-rw-r--r--source/Expression/IRDynamicChecks.cpp2
-rw-r--r--source/Expression/IRExecutionUnit.cpp34
-rw-r--r--source/Expression/IRInterpreter.cpp38
-rw-r--r--source/Expression/IRMemoryMap.cpp31
-rw-r--r--source/Expression/LLVMUserExpression.cpp10
-rw-r--r--source/Expression/Materializer.cpp104
-rw-r--r--source/Expression/REPL.cpp8
-rw-r--r--source/Expression/UserExpression.cpp4
-rw-r--r--source/Expression/UtilityFunction.cpp2
11 files changed, 128 insertions, 127 deletions
diff --git a/source/Expression/DWARFExpression.cpp b/source/Expression/DWARFExpression.cpp
index 928577cd7ee46..592a30cdd7800 100644
--- a/source/Expression/DWARFExpression.cpp
+++ b/source/Expression/DWARFExpression.cpp
@@ -655,7 +655,7 @@ void DWARFExpression::GetDescription(Stream *s, lldb::DescriptionLevel level,
static bool ReadRegisterValueAsScalar(RegisterContext *reg_ctx,
lldb::RegisterKind reg_kind,
- uint32_t reg_num, Error *error_ptr,
+ uint32_t reg_num, Status *error_ptr,
Value &value) {
if (reg_ctx == NULL) {
if (error_ptr)
@@ -1250,7 +1250,7 @@ bool DWARFExpression::Evaluate(ExecutionContextScope *exe_scope,
lldb::addr_t loclist_base_load_addr,
const Value *initial_value_ptr,
const Value *object_address_ptr, Value &result,
- Error *error_ptr) const {
+ Status *error_ptr) const {
ExecutionContext exe_ctx(exe_scope);
return Evaluate(&exe_ctx, expr_locals, decl_map, nullptr,
loclist_base_load_addr, initial_value_ptr, object_address_ptr,
@@ -1261,7 +1261,7 @@ bool DWARFExpression::Evaluate(
ExecutionContext *exe_ctx, ClangExpressionVariableList *expr_locals,
ClangExpressionDeclMap *decl_map, RegisterContext *reg_ctx,
lldb::addr_t loclist_base_load_addr, const Value *initial_value_ptr,
- const Value *object_address_ptr, Value &result, Error *error_ptr) const {
+ const Value *object_address_ptr, Value &result, Status *error_ptr) const {
ModuleSP module_sp = m_module_wp.lock();
if (IsLocationList()) {
@@ -1333,7 +1333,7 @@ bool DWARFExpression::Evaluate(
DWARFCompileUnit *dwarf_cu, const lldb::offset_t opcodes_offset,
const lldb::offset_t opcodes_length, const lldb::RegisterKind reg_kind,
const Value *initial_value_ptr, const Value *object_address_ptr,
- Value &result, Error *error_ptr) {
+ Value &result, Status *error_ptr) {
if (opcodes_length == 0) {
if (error_ptr)
@@ -1467,7 +1467,7 @@ bool DWARFExpression::Evaluate(
if (process) {
lldb::addr_t pointer_addr =
stack.back().GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
- Error error;
+ Status error;
lldb::addr_t pointer_value =
process->ReadPointerFromMemory(pointer_addr, error);
if (pointer_value != LLDB_INVALID_ADDRESS) {
@@ -1572,7 +1572,7 @@ bool DWARFExpression::Evaluate(
lldb::addr_t pointer_addr =
stack.back().GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
uint8_t addr_bytes[sizeof(lldb::addr_t)];
- Error error;
+ Status error;
if (process->ReadMemory(pointer_addr, &addr_bytes, size, error) ==
size) {
DataExtractor addr_data(addr_bytes, sizeof(addr_bytes),
@@ -2568,7 +2568,7 @@ bool DWARFExpression::Evaluate(
::memset(curr_piece.GetBuffer().GetBytes(), 0, piece_byte_size);
pieces.AppendDataToHostBuffer(curr_piece);
} else {
- Error error;
+ Status error;
// Extract the current piece into "curr_piece"
Value curr_piece_source_value(stack.back());
stack.pop_back();
diff --git a/source/Expression/FunctionCaller.cpp b/source/Expression/FunctionCaller.cpp
index e2f38a9f50bb1..6f60f8bf9c139 100644
--- a/source/Expression/FunctionCaller.cpp
+++ b/source/Expression/FunctionCaller.cpp
@@ -86,7 +86,7 @@ bool FunctionCaller::WriteFunctionWrapper(
bool can_interpret = false; // should stay that way
- Error jit_error(m_parser->PrepareForExecution(
+ Status jit_error(m_parser->PrepareForExecution(
m_jit_start_addr, m_jit_end_addr, m_execution_unit_sp, exe_ctx,
can_interpret, eExecutionPolicyAlways));
@@ -135,7 +135,7 @@ bool FunctionCaller::WriteFunctionArguments(
return false;
}
- Error error;
+ Status error;
lldb::ExpressionResults return_value = lldb::eExpressionSetupError;
Process *process = exe_ctx.GetProcessPtr();
@@ -172,7 +172,7 @@ bool FunctionCaller::WriteFunctionArguments(
// FIXME: We will need to extend this for Variadic functions.
- Error value_error;
+ Status value_error;
size_t num_args = arg_values.GetSize();
if (num_args != m_arg_values.GetSize()) {
@@ -289,7 +289,7 @@ bool FunctionCaller::FetchFunctionResults(ExecutionContext &exe_ctx,
if (process != jit_process_sp.get())
return false;
- Error error;
+ Status error;
ret_value.GetScalar() = process->ReadUnsignedIntegerFromMemory(
args_addr + m_return_offset, m_return_size, 0, error);
diff --git a/source/Expression/IRDynamicChecks.cpp b/source/Expression/IRDynamicChecks.cpp
index 44ff6295ca185..0c8cba2050c06 100644
--- a/source/Expression/IRDynamicChecks.cpp
+++ b/source/Expression/IRDynamicChecks.cpp
@@ -51,7 +51,7 @@ DynamicCheckerFunctions::~DynamicCheckerFunctions() = default;
bool DynamicCheckerFunctions::Install(DiagnosticManager &diagnostic_manager,
ExecutionContext &exe_ctx) {
- Error error;
+ Status error;
m_valid_pointer_check.reset(
exe_ctx.GetTargetRef().GetUtilityFunctionForLanguage(
g_valid_pointer_check_text, lldb::eLanguageTypeC,
diff --git a/source/Expression/IRExecutionUnit.cpp b/source/Expression/IRExecutionUnit.cpp
index 4309caefbd444..e31483f1728dd 100644
--- a/source/Expression/IRExecutionUnit.cpp
+++ b/source/Expression/IRExecutionUnit.cpp
@@ -50,7 +50,7 @@ IRExecutionUnit::IRExecutionUnit(std::unique_ptr<llvm::LLVMContext> &context_ap,
m_reported_allocations(false) {}
lldb::addr_t IRExecutionUnit::WriteNow(const uint8_t *bytes, size_t size,
- Error &error) {
+ Status &error) {
const bool zero_memory = false;
lldb::addr_t allocation_process_addr =
Malloc(size, 8, lldb::ePermissionsWritable | lldb::ePermissionsReadable,
@@ -62,7 +62,7 @@ lldb::addr_t IRExecutionUnit::WriteNow(const uint8_t *bytes, size_t size,
WriteMemory(allocation_process_addr, bytes, size, error);
if (!error.Success()) {
- Error err;
+ Status err;
Free(allocation_process_addr, err);
return LLDB_INVALID_ADDRESS;
@@ -71,7 +71,7 @@ lldb::addr_t IRExecutionUnit::WriteNow(const uint8_t *bytes, size_t size,
if (Log *log =
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)) {
DataBufferHeap my_buffer(size, 0);
- Error err;
+ Status err;
ReadMemory(my_buffer.GetBytes(), allocation_process_addr, size, err);
if (err.Success()) {
@@ -90,18 +90,18 @@ void IRExecutionUnit::FreeNow(lldb::addr_t allocation) {
if (allocation == LLDB_INVALID_ADDRESS)
return;
- Error err;
+ Status err;
Free(allocation, err);
}
-Error IRExecutionUnit::DisassembleFunction(Stream &stream,
- lldb::ProcessSP &process_wp) {
+Status IRExecutionUnit::DisassembleFunction(Stream &stream,
+ lldb::ProcessSP &process_wp) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
ExecutionContext exe_ctx(process_wp);
- Error ret;
+ Status ret;
ret.Clear();
@@ -152,7 +152,7 @@ Error IRExecutionUnit::DisassembleFunction(Stream &stream,
lldb::DataBufferSP buffer_sp(new DataBufferHeap(func_range.second, 0));
Process *process = exe_ctx.GetProcessPtr();
- Error err;
+ Status err;
process->ReadMemory(func_remote_addr, buffer_sp->GetBytes(),
buffer_sp->GetByteSize(), err);
@@ -203,7 +203,7 @@ Error IRExecutionUnit::DisassembleFunction(Stream &stream,
static void ReportInlineAsmError(const llvm::SMDiagnostic &diagnostic,
void *Context, unsigned LocCookie) {
- Error *err = static_cast<Error *>(Context);
+ Status *err = static_cast<Status *>(Context);
if (err && err->Success()) {
err->SetErrorToGenericError();
@@ -216,7 +216,7 @@ void IRExecutionUnit::ReportSymbolLookupError(const ConstString &name) {
m_failed_lookups.push_back(name);
}
-void IRExecutionUnit::GetRunnableInfo(Error &error, lldb::addr_t &func_addr,
+void IRExecutionUnit::GetRunnableInfo(Status &error, lldb::addr_t &func_addr,
lldb::addr_t &func_end) {
lldb::ProcessSP process_sp(GetProcessWP().lock());
@@ -452,7 +452,7 @@ void IRExecutionUnit::GetRunnableInfo(Error &error, lldb::addr_t &func_addr,
StreamString disassembly_stream;
- Error err = DisassembleFunction(disassembly_stream, process_sp);
+ Status err = DisassembleFunction(disassembly_stream, process_sp);
if (!err.Success()) {
log->Printf("Couldn't disassemble function : %s",
@@ -467,7 +467,7 @@ void IRExecutionUnit::GetRunnableInfo(Error &error, lldb::addr_t &func_addr,
record.dump(log);
DataBufferHeap my_buffer(record.m_size, 0);
- Error err;
+ Status err;
ReadMemory(my_buffer.GetBytes(), record.m_process_address,
record.m_size, err);
@@ -643,7 +643,7 @@ uint8_t *IRExecutionUnit::MemoryManager::allocateCodeSection(
}
if (m_parent.m_reported_allocations) {
- Error err;
+ Status err;
lldb::ProcessSP process_sp =
m_parent.GetBestExecutionContextScope()->CalculateProcess();
@@ -675,7 +675,7 @@ uint8_t *IRExecutionUnit::MemoryManager::allocateDataSection(
}
if (m_parent.m_reported_allocations) {
- Error err;
+ Status err;
lldb::ProcessSP process_sp =
m_parent.GetBestExecutionContextScope()->CalculateProcess();
@@ -1104,7 +1104,7 @@ IRExecutionUnit::GetRemoteRangeForLocal(lldb::addr_t local_address) {
}
bool IRExecutionUnit::CommitOneAllocation(lldb::ProcessSP &process_sp,
- Error &error,
+ Status &error,
AllocationRecord &record) {
if (record.m_process_address != LLDB_INVALID_ADDRESS) {
return true;
@@ -1145,7 +1145,7 @@ bool IRExecutionUnit::CommitOneAllocation(lldb::ProcessSP &process_sp,
bool IRExecutionUnit::CommitAllocations(lldb::ProcessSP &process_sp) {
bool ret = true;
- lldb_private::Error err;
+ lldb_private::Status err;
for (AllocationRecord &record : m_records) {
ret = CommitOneAllocation(process_sp, err, record);
@@ -1189,7 +1189,7 @@ bool IRExecutionUnit::WriteData(lldb::ProcessSP &process_sp) {
bool wrote_something = false;
for (AllocationRecord &record : m_records) {
if (record.m_process_address != LLDB_INVALID_ADDRESS) {
- lldb_private::Error err;
+ lldb_private::Status err;
WriteMemory(record.m_process_address, (uint8_t *)record.m_host_address,
record.m_size, err);
if (err.Success())
diff --git a/source/Expression/IRInterpreter.cpp b/source/Expression/IRInterpreter.cpp
index 6867443cdf5e0..6b5e22329af83 100644
--- a/source/Expression/IRInterpreter.cpp
+++ b/source/Expression/IRInterpreter.cpp
@@ -18,8 +18,8 @@
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/Endian.h"
-#include "lldb/Utility/Error.h"
#include "lldb/Utility/Log.h"
+#include "lldb/Utility/Status.h"
#include "lldb/Utility/StreamString.h"
#include "lldb/Target/ABI.h"
@@ -189,7 +189,7 @@ public:
size_t value_size = m_target_data.getTypeStoreSize(value->getType());
lldb_private::DataExtractor value_extractor;
- lldb_private::Error extract_error;
+ lldb_private::Status extract_error;
m_execution_unit.GetMemoryData(value_extractor, process_address,
value_size, extract_error);
@@ -224,13 +224,13 @@ public:
lldb_private::DataBufferHeap buf(value_byte_size, 0);
- lldb_private::Error get_data_error;
+ lldb_private::Status get_data_error;
if (!cast_scalar.GetAsMemoryData(buf.GetBytes(), buf.GetByteSize(),
m_byte_order, get_data_error))
return false;
- lldb_private::Error write_error;
+ lldb_private::Status write_error;
m_execution_unit.WriteMemory(process_address, buf.GetBytes(),
buf.GetByteSize(), write_error);
@@ -322,12 +322,12 @@ public:
if (data_address == LLDB_INVALID_ADDRESS)
return false;
- lldb_private::Error write_error;
+ lldb_private::Status write_error;
m_execution_unit.WritePointerToMemory(data_address, address, write_error);
if (!write_error.Success()) {
- lldb_private::Error free_error;
+ lldb_private::Status free_error;
m_execution_unit.Free(data_address, free_error);
return false;
}
@@ -356,7 +356,7 @@ public:
size_t constant_size = m_target_data.getTypeStoreSize(constant->getType());
lldb_private::DataBufferHeap buf(constant_size, 0);
- lldb_private::Error get_data_error;
+ lldb_private::Status get_data_error;
lldb_private::Scalar resolved_scalar(
resolved_value.zextOrTrunc(llvm::NextPowerOf2(constant_size) * 8));
@@ -364,7 +364,7 @@ public:
m_byte_order, get_data_error))
return false;
- lldb_private::Error write_error;
+ lldb_private::Status write_error;
m_execution_unit.WriteMemory(process_address, buf.GetBytes(),
buf.GetByteSize(), write_error);
@@ -391,7 +391,7 @@ public:
}
lldb::addr_t Malloc(llvm::Type *type) {
- lldb_private::Error alloc_error;
+ lldb_private::Status alloc_error;
return Malloc(m_target_data.getTypeAllocSize(type),
m_target_data.getPrefTypeAlignment(type));
@@ -402,7 +402,7 @@ public:
lldb_private::DataBufferHeap buf(length, 0);
- lldb_private::Error read_error;
+ lldb_private::Status read_error;
m_execution_unit.ReadMemory(buf.GetBytes(), addr, length, read_error);
@@ -433,7 +433,7 @@ public:
if (const Constant *constant = dyn_cast<Constant>(value)) {
if (!ResolveConstant(data_address, constant)) {
- lldb_private::Error free_error;
+ lldb_private::Status free_error;
m_execution_unit.Free(data_address, free_error);
return LLDB_INVALID_ADDRESS;
}
@@ -499,7 +499,7 @@ static bool CanResolveConstant(llvm::Constant *constant) {
}
bool IRInterpreter::CanInterpret(llvm::Module &module, llvm::Function &function,
- lldb_private::Error &error,
+ lldb_private::Status &error,
const bool support_function_calls) {
lldb_private::Log *log(
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
@@ -648,7 +648,7 @@ bool IRInterpreter::CanInterpret(llvm::Module &module, llvm::Function &function,
bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
llvm::ArrayRef<lldb::addr_t> args,
lldb_private::IRExecutionUnit &execution_unit,
- lldb_private::Error &error,
+ lldb_private::Status &error,
lldb::addr_t stack_frame_bottom,
lldb::addr_t stack_frame_top,
lldb_private::ExecutionContext &exe_ctx) {
@@ -867,7 +867,7 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
return false;
}
- lldb_private::Error write_error;
+ lldb_private::Status write_error;
execution_unit.WritePointerToMemory(P, R, write_error);
@@ -876,7 +876,7 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
log->Printf("Couldn't write the result pointer for an AllocaInst");
error.SetErrorToGenericError();
error.SetErrorString(memory_write_error);
- lldb_private::Error free_error;
+ lldb_private::Status free_error;
execution_unit.Free(P, free_error);
execution_unit.Free(R, free_error);
return false;
@@ -1349,7 +1349,7 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
}
lldb::addr_t R;
- lldb_private::Error read_error;
+ lldb_private::Status read_error;
execution_unit.ReadPointerFromMemory(&R, P, read_error);
if (!read_error.Success()) {
@@ -1374,7 +1374,7 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
return false;
}
- lldb_private::Error write_error;
+ lldb_private::Status write_error;
execution_unit.WriteMemory(D, buffer.GetBytes(), buffer.GetByteSize(),
write_error);
if (!write_error.Success()) {
@@ -1442,7 +1442,7 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
}
lldb::addr_t R;
- lldb_private::Error read_error;
+ lldb_private::Status read_error;
execution_unit.ReadPointerFromMemory(&R, P, read_error);
if (!read_error.Success()) {
@@ -1467,7 +1467,7 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function,
return false;
}
- lldb_private::Error write_error;
+ lldb_private::Status write_error;
execution_unit.WriteMemory(R, buffer.GetBytes(), buffer.GetByteSize(),
write_error);
if (!write_error.Success()) {
diff --git a/source/Expression/IRMemoryMap.cpp b/source/Expression/IRMemoryMap.cpp
index 66510ac978ae7..817c75e66a3b1 100644
--- a/source/Expression/IRMemoryMap.cpp
+++ b/source/Expression/IRMemoryMap.cpp
@@ -14,9 +14,9 @@
#include "lldb/Target/Target.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/DataExtractor.h"
-#include "lldb/Utility/Error.h"
#include "lldb/Utility/LLDBAssert.h"
#include "lldb/Utility/Log.h"
+#include "lldb/Utility/Status.h"
using namespace lldb_private;
@@ -31,7 +31,7 @@ IRMemoryMap::~IRMemoryMap() {
if (process_sp) {
AllocationMap::iterator iter;
- Error err;
+ Status err;
while ((iter = m_allocations.begin()) != m_allocations.end()) {
err.Clear();
@@ -66,7 +66,7 @@ lldb::addr_t IRMemoryMap::FindSpace(size_t size) {
return ret;
if (process_is_alive && process_sp->CanJIT()) {
- Error alloc_error;
+ Status alloc_error;
ret = process_sp->AllocateMemory(size, lldb::ePermissionsReadable |
lldb::ePermissionsWritable,
@@ -104,7 +104,7 @@ lldb::addr_t IRMemoryMap::FindSpace(size_t size) {
end_of_memory != 0xffffffffull);
MemoryRegionInfo region_info;
- Error err = process_sp->GetMemoryRegionInfo(ret, region_info);
+ Status err = process_sp->GetMemoryRegionInfo(ret, region_info);
if (err.Success()) {
while (true) {
if (region_info.GetReadable() != MemoryRegionInfo::OptionalBool::eNo ||
@@ -297,7 +297,7 @@ IRMemoryMap::Allocation::Allocation(lldb::addr_t process_alloc,
lldb::addr_t IRMemoryMap::Malloc(size_t size, uint8_t alignment,
uint32_t permissions, AllocationPolicy policy,
- bool zero_memory, Error &error) {
+ bool zero_memory, Status &error) {
lldb_private::Log *log(
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
error.Clear();
@@ -397,7 +397,7 @@ lldb::addr_t IRMemoryMap::Malloc(size_t size, uint8_t alignment,
permissions, alignment, policy);
if (zero_memory) {
- Error write_error;
+ Status write_error;
std::vector<uint8_t> zero_buf(size, 0);
WriteMemory(aligned_address, zero_buf.data(), size, write_error);
}
@@ -429,7 +429,7 @@ lldb::addr_t IRMemoryMap::Malloc(size_t size, uint8_t alignment,
return aligned_address;
}
-void IRMemoryMap::Leak(lldb::addr_t process_address, Error &error) {
+void IRMemoryMap::Leak(lldb::addr_t process_address, Status &error) {
error.Clear();
AllocationMap::iterator iter = m_allocations.find(process_address);
@@ -445,7 +445,7 @@ void IRMemoryMap::Leak(lldb::addr_t process_address, Error &error) {
allocation.m_leak = true;
}
-void IRMemoryMap::Free(lldb::addr_t process_address, Error &error) {
+void IRMemoryMap::Free(lldb::addr_t process_address, Status &error) {
error.Clear();
AllocationMap::iterator iter = m_allocations.find(process_address);
@@ -512,7 +512,8 @@ bool IRMemoryMap::GetAllocSize(lldb::addr_t address, size_t &size) {
}
void IRMemoryMap::WriteMemory(lldb::addr_t process_address,
- const uint8_t *bytes, size_t size, Error &error) {
+ const uint8_t *bytes, size_t size,
+ Status &error) {
error.Clear();
AllocationMap::iterator iter = FindAllocation(process_address, size);
@@ -587,7 +588,7 @@ void IRMemoryMap::WriteMemory(lldb::addr_t process_address,
void IRMemoryMap::WriteScalarToMemory(lldb::addr_t process_address,
Scalar &scalar, size_t size,
- Error &error) {
+ Status &error) {
error.Clear();
if (size == UINT32_MAX)
@@ -612,7 +613,7 @@ void IRMemoryMap::WriteScalarToMemory(lldb::addr_t process_address,
}
void IRMemoryMap::WritePointerToMemory(lldb::addr_t process_address,
- lldb::addr_t address, Error &error) {
+ lldb::addr_t address, Status &error) {
error.Clear();
Scalar scalar(address);
@@ -621,7 +622,7 @@ void IRMemoryMap::WritePointerToMemory(lldb::addr_t process_address,
}
void IRMemoryMap::ReadMemory(uint8_t *bytes, lldb::addr_t process_address,
- size_t size, Error &error) {
+ size_t size, Status &error) {
error.Clear();
AllocationMap::iterator iter = FindAllocation(process_address, size);
@@ -717,7 +718,7 @@ void IRMemoryMap::ReadMemory(uint8_t *bytes, lldb::addr_t process_address,
void IRMemoryMap::ReadScalarFromMemory(Scalar &scalar,
lldb::addr_t process_address,
- size_t size, Error &error) {
+ size_t size, Status &error) {
error.Clear();
if (size > 0) {
@@ -760,7 +761,7 @@ void IRMemoryMap::ReadScalarFromMemory(Scalar &scalar,
void IRMemoryMap::ReadPointerFromMemory(lldb::addr_t *address,
lldb::addr_t process_address,
- Error &error) {
+ Status &error) {
error.Clear();
Scalar pointer_scalar;
@@ -777,7 +778,7 @@ void IRMemoryMap::ReadPointerFromMemory(lldb::addr_t *address,
void IRMemoryMap::GetMemoryData(DataExtractor &extractor,
lldb::addr_t process_address, size_t size,
- Error &error) {
+ Status &error) {
error.Clear();
if (size > 0) {
diff --git a/source/Expression/LLVMUserExpression.cpp b/source/Expression/LLVMUserExpression.cpp
index 396a7e295033f..83acb8249ba6e 100644
--- a/source/Expression/LLVMUserExpression.cpp
+++ b/source/Expression/LLVMUserExpression.cpp
@@ -106,7 +106,7 @@ LLVMUserExpression::DoExecute(DiagnosticManager &diagnostic_manager,
return lldb::eExpressionSetupError;
}
- Error interpreter_error;
+ Status interpreter_error;
std::vector<lldb::addr_t> args;
@@ -270,7 +270,7 @@ bool LLVMUserExpression::FinalizeJITExecution(
return false;
}
- Error dematerialize_error;
+ Status dematerialize_error;
m_dematerializer_sp->Dematerialize(dematerialize_error, function_stack_bottom,
function_stack_top);
@@ -309,7 +309,7 @@ bool LLVMUserExpression::PrepareToExecuteJITExpression(
if (m_jit_start_addr != LLDB_INVALID_ADDRESS || m_can_interpret) {
if (m_materialized_address == LLDB_INVALID_ADDRESS) {
- Error alloc_error;
+ Status alloc_error;
IRMemoryMap::AllocationPolicy policy =
m_can_interpret ? IRMemoryMap::eAllocationPolicyHostOnly
@@ -335,7 +335,7 @@ bool LLVMUserExpression::PrepareToExecuteJITExpression(
struct_address = m_materialized_address;
if (m_can_interpret && m_stack_frame_bottom == LLDB_INVALID_ADDRESS) {
- Error alloc_error;
+ Status alloc_error;
const size_t stack_frame_size = 512 * 1024;
@@ -357,7 +357,7 @@ bool LLVMUserExpression::PrepareToExecuteJITExpression(
}
}
- Error materialize_error;
+ Status materialize_error;
m_dematerializer_sp = m_materializer_ap->Materialize(
frame, *m_execution_unit_sp, struct_address, materialize_error);
diff --git a/source/Expression/Materializer.cpp b/source/Expression/Materializer.cpp
index 8a22daa5acdd2..39fc5c8c25398 100644
--- a/source/Expression/Materializer.cpp
+++ b/source/Expression/Materializer.cpp
@@ -74,12 +74,12 @@ public:
m_alignment = 8;
}
- void MakeAllocation(IRMemoryMap &map, Error &err) {
+ void MakeAllocation(IRMemoryMap &map, Status &err) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
// Allocate a spare memory area to store the persistent variable's contents.
- Error allocate_error;
+ Status allocate_error;
const bool zero_memory = false;
lldb::addr_t mem = map.Malloc(
@@ -112,7 +112,7 @@ public:
if (m_persistent_variable_sp->m_flags &
ExpressionVariable::EVKeepInTarget) {
- Error leak_error;
+ Status leak_error;
map.Leak(mem, leak_error);
m_persistent_variable_sp->m_flags &=
~ExpressionVariable::EVNeedsAllocation;
@@ -120,7 +120,7 @@ public:
// Write the contents of the variable to the area.
- Error write_error;
+ Status write_error;
map.WriteMemory(mem, m_persistent_variable_sp->GetValueBytes(),
m_persistent_variable_sp->GetByteSize(), write_error);
@@ -134,8 +134,8 @@ public:
}
}
- void DestroyAllocation(IRMemoryMap &map, Error &err) {
- Error deallocate_error;
+ void DestroyAllocation(IRMemoryMap &map, Status &err) {
+ Status deallocate_error;
map.Free((lldb::addr_t)m_persistent_variable_sp->m_live_sp->GetValue()
.GetScalar()
@@ -153,7 +153,7 @@ public:
}
void Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map,
- lldb::addr_t process_address, Error &err) override {
+ lldb::addr_t process_address, Status &err) override {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
const lldb::addr_t load_addr = process_address + m_offset;
@@ -181,7 +181,7 @@ public:
m_persistent_variable_sp->m_live_sp) ||
m_persistent_variable_sp->m_flags &
ExpressionVariable::EVIsLLDBAllocated) {
- Error write_error;
+ Status write_error;
map.WriteScalarToMemory(
load_addr,
@@ -204,7 +204,7 @@ public:
void Dematerialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map,
lldb::addr_t process_address, lldb::addr_t frame_top,
- lldb::addr_t frame_bottom, Error &err) override {
+ lldb::addr_t frame_bottom, Status &err) override {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
const lldb::addr_t load_addr = process_address + m_offset;
@@ -234,7 +234,7 @@ public:
// live variable data hasn't been set up yet. Do this now.
lldb::addr_t location;
- Error read_error;
+ Status read_error;
map.ReadPointerFromMemory(&location, load_addr, read_error);
@@ -304,7 +304,7 @@ public:
m_persistent_variable_sp->ValueUpdated();
- Error read_error;
+ Status read_error;
map.ReadMemory(m_persistent_variable_sp->GetValueBytes(), mem,
m_persistent_variable_sp->GetByteSize(), read_error);
@@ -353,7 +353,7 @@ public:
Log *log) override {
StreamString dump_stream;
- Error err;
+ Status err;
const lldb::addr_t load_addr = process_address + m_offset;
@@ -416,7 +416,7 @@ private:
uint32_t Materializer::AddPersistentVariable(
lldb::ExpressionVariableSP &persistent_variable_sp,
- PersistentVariableDelegate *delegate, Error &err) {
+ PersistentVariableDelegate *delegate, Status &err) {
EntityVector::iterator iter = m_entities.insert(m_entities.end(), EntityUP());
iter->reset(new EntityPersistentVariable(persistent_variable_sp, delegate));
uint32_t ret = AddStructMember(**iter);
@@ -439,7 +439,7 @@ public:
}
void Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map,
- lldb::addr_t process_address, Error &err) override {
+ lldb::addr_t process_address, Status &err) override {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
const lldb::addr_t load_addr = process_address + m_offset;
@@ -464,7 +464,7 @@ public:
return;
}
- Error valobj_error = valobj_sp->GetError();
+ Status valobj_error = valobj_sp->GetError();
if (valobj_error.Fail()) {
err.SetErrorStringWithFormat("couldn't get the value of variable %s: %s",
@@ -475,7 +475,7 @@ public:
if (m_is_reference) {
DataExtractor valobj_extractor;
- Error extract_error;
+ Status extract_error;
valobj_sp->GetData(valobj_extractor, extract_error);
if (!extract_error.Success()) {
@@ -488,7 +488,7 @@ public:
lldb::offset_t offset = 0;
lldb::addr_t reference_addr = valobj_extractor.GetAddress(&offset);
- Error write_error;
+ Status write_error;
map.WritePointerToMemory(load_addr, reference_addr, write_error);
if (!write_error.Success()) {
@@ -504,7 +504,7 @@ public:
lldb::addr_t addr_of_valobj =
valobj_sp->GetAddressOf(scalar_is_load_address, &address_type);
if (addr_of_valobj != LLDB_INVALID_ADDRESS) {
- Error write_error;
+ Status write_error;
map.WritePointerToMemory(load_addr, addr_of_valobj, write_error);
if (!write_error.Success()) {
@@ -515,7 +515,7 @@ public:
}
} else {
DataExtractor data;
- Error extract_error;
+ Status extract_error;
valobj_sp->GetData(data, extract_error);
if (!extract_error.Success()) {
err.SetErrorStringWithFormat("couldn't get the value of %s: %s",
@@ -554,7 +554,7 @@ public:
if (!byte_align)
byte_align = 1;
- Error alloc_error;
+ Status alloc_error;
const bool zero_memory = false;
m_temporary_allocation = map.Malloc(
@@ -574,7 +574,7 @@ public:
return;
}
- Error write_error;
+ Status write_error;
map.WriteMemory(m_temporary_allocation, data.GetDataStart(),
data.GetByteSize(), write_error);
@@ -586,7 +586,7 @@ public:
return;
}
- Error pointer_write_error;
+ Status pointer_write_error;
map.WritePointerToMemory(load_addr, m_temporary_allocation,
pointer_write_error);
@@ -603,7 +603,7 @@ public:
void Dematerialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map,
lldb::addr_t process_address, lldb::addr_t frame_top,
- lldb::addr_t frame_bottom, Error &err) override {
+ lldb::addr_t frame_bottom, Status &err) override {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
const lldb::addr_t load_addr = process_address + m_offset;
@@ -631,7 +631,7 @@ public:
lldb_private::DataExtractor data;
- Error extract_error;
+ Status extract_error;
map.GetMemoryData(data, m_temporary_allocation, valobj_sp->GetByteSize(),
extract_error);
@@ -652,7 +652,7 @@ public:
}
}
- Error set_error;
+ Status set_error;
if (actually_write) {
valobj_sp->SetData(data, set_error);
@@ -665,7 +665,7 @@ public:
}
}
- Error free_error;
+ Status free_error;
map.Free(m_temporary_allocation, free_error);
@@ -689,7 +689,7 @@ public:
const lldb::addr_t load_addr = process_address + m_offset;
dump_stream.Printf("0x%" PRIx64 ": EntityVariable\n", load_addr);
- Error err;
+ Status err;
lldb::addr_t ptr = LLDB_INVALID_ADDRESS;
@@ -746,7 +746,7 @@ public:
void Wipe(IRMemoryMap &map, lldb::addr_t process_address) override {
if (m_temporary_allocation != LLDB_INVALID_ADDRESS) {
- Error free_error;
+ Status free_error;
map.Free(m_temporary_allocation, free_error);
@@ -763,7 +763,7 @@ private:
lldb::DataBufferSP m_original_data;
};
-uint32_t Materializer::AddVariable(lldb::VariableSP &variable_sp, Error &err) {
+uint32_t Materializer::AddVariable(lldb::VariableSP &variable_sp, Status &err) {
EntityVector::iterator iter = m_entities.insert(m_entities.end(), EntityUP());
iter->reset(new EntityVariable(variable_sp));
uint32_t ret = AddStructMember(**iter);
@@ -787,7 +787,7 @@ public:
}
void Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map,
- lldb::addr_t process_address, Error &err) override {
+ lldb::addr_t process_address, Status &err) override {
if (!m_is_program_reference) {
if (m_temporary_allocation != LLDB_INVALID_ADDRESS) {
err.SetErrorString("Trying to create a temporary region for the result "
@@ -806,7 +806,7 @@ public:
if (!byte_align)
byte_align = 1;
- Error alloc_error;
+ Status alloc_error;
const bool zero_memory = true;
m_temporary_allocation = map.Malloc(
@@ -822,7 +822,7 @@ public:
return;
}
- Error pointer_write_error;
+ Status pointer_write_error;
map.WritePointerToMemory(load_addr, m_temporary_allocation,
pointer_write_error);
@@ -837,7 +837,7 @@ public:
void Dematerialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map,
lldb::addr_t process_address, lldb::addr_t frame_top,
- lldb::addr_t frame_bottom, Error &err) override {
+ lldb::addr_t frame_bottom, Status &err) override {
err.Clear();
ExecutionContextScope *exe_scope = map.GetBestExecutionContextScope();
@@ -849,7 +849,7 @@ public:
}
lldb::addr_t address;
- Error read_error;
+ Status read_error;
const lldb::addr_t load_addr = process_address + m_offset;
map.ReadPointerFromMemory(&address, load_addr, read_error);
@@ -867,7 +867,7 @@ public:
return;
}
- Error type_system_error;
+ Status type_system_error;
TypeSystem *type_system = target_sp->GetScratchTypeSystemForLanguage(
&type_system_error, m_type.GetMinimumLanguage());
@@ -937,7 +937,7 @@ public:
ret->m_flags |= ExpressionVariable::EVNeedsAllocation;
if (m_temporary_allocation != LLDB_INVALID_ADDRESS) {
- Error free_error;
+ Status free_error;
map.Free(m_temporary_allocation, free_error);
}
} else {
@@ -956,7 +956,7 @@ public:
dump_stream.Printf("0x%" PRIx64 ": EntityResultVariable\n", load_addr);
- Error err;
+ Status err;
lldb::addr_t ptr = LLDB_INVALID_ADDRESS;
@@ -1013,7 +1013,7 @@ public:
void Wipe(IRMemoryMap &map, lldb::addr_t process_address) override {
if (!m_keep_in_memory && m_temporary_allocation != LLDB_INVALID_ADDRESS) {
- Error free_error;
+ Status free_error;
map.Free(m_temporary_allocation, free_error);
}
@@ -1036,7 +1036,7 @@ uint32_t Materializer::AddResultVariable(const CompilerType &type,
bool is_program_reference,
bool keep_in_memory,
PersistentVariableDelegate *delegate,
- Error &err) {
+ Status &err) {
EntityVector::iterator iter = m_entities.insert(m_entities.end(), EntityUP());
iter->reset(new EntityResultVariable(type, is_program_reference,
keep_in_memory, delegate));
@@ -1054,7 +1054,7 @@ public:
}
void Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map,
- lldb::addr_t process_address, Error &err) override {
+ lldb::addr_t process_address, Status &err) override {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
const lldb::addr_t load_addr = process_address + m_offset;
@@ -1086,7 +1086,7 @@ public:
if (resolved_address == LLDB_INVALID_ADDRESS)
resolved_address = sym_address.GetFileAddress();
- Error pointer_write_error;
+ Status pointer_write_error;
map.WritePointerToMemory(load_addr, resolved_address, pointer_write_error);
@@ -1100,7 +1100,7 @@ public:
void Dematerialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map,
lldb::addr_t process_address, lldb::addr_t frame_top,
- lldb::addr_t frame_bottom, Error &err) override {
+ lldb::addr_t frame_bottom, Status &err) override {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
const lldb::addr_t load_addr = process_address + m_offset;
@@ -1118,7 +1118,7 @@ public:
Log *log) override {
StreamString dump_stream;
- Error err;
+ Status err;
const lldb::addr_t load_addr = process_address + m_offset;
@@ -1151,7 +1151,7 @@ private:
Symbol m_symbol;
};
-uint32_t Materializer::AddSymbol(const Symbol &symbol_sp, Error &err) {
+uint32_t Materializer::AddSymbol(const Symbol &symbol_sp, Status &err) {
EntityVector::iterator iter = m_entities.insert(m_entities.end(), EntityUP());
iter->reset(new EntitySymbol(symbol_sp));
uint32_t ret = AddStructMember(**iter);
@@ -1169,7 +1169,7 @@ public:
}
void Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map,
- lldb::addr_t process_address, Error &err) override {
+ lldb::addr_t process_address, Status &err) override {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
const lldb::addr_t load_addr = process_address + m_offset;
@@ -1216,7 +1216,7 @@ public:
m_register_contents.reset(new DataBufferHeap(register_data.GetDataStart(),
register_data.GetByteSize()));
- Error write_error;
+ Status write_error;
map.WriteMemory(load_addr, register_data.GetDataStart(),
register_data.GetByteSize(), write_error);
@@ -1231,7 +1231,7 @@ public:
void Dematerialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map,
lldb::addr_t process_address, lldb::addr_t frame_top,
- lldb::addr_t frame_bottom, Error &err) override {
+ lldb::addr_t frame_bottom, Status &err) override {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
const lldb::addr_t load_addr = process_address + m_offset;
@@ -1242,7 +1242,7 @@ public:
(uint64_t)load_addr, m_register_info.name);
}
- Error extract_error;
+ Status extract_error;
DataExtractor register_data;
@@ -1291,7 +1291,7 @@ public:
Log *log) override {
StreamString dump_stream;
- Error err;
+ Status err;
const lldb::addr_t load_addr = process_address + m_offset;
@@ -1326,7 +1326,7 @@ private:
};
uint32_t Materializer::AddRegister(const RegisterInfo &register_info,
- Error &err) {
+ Status &err) {
EntityVector::iterator iter = m_entities.insert(m_entities.end(), EntityUP());
iter->reset(new EntityRegister(register_info));
uint32_t ret = AddStructMember(**iter);
@@ -1346,7 +1346,7 @@ Materializer::~Materializer() {
Materializer::DematerializerSP
Materializer::Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map,
- lldb::addr_t process_address, Error &error) {
+ lldb::addr_t process_address, Status &error) {
ExecutionContextScope *exe_scope = frame_sp.get();
if (!exe_scope)
@@ -1389,7 +1389,7 @@ Materializer::Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map,
return ret;
}
-void Materializer::Dematerializer::Dematerialize(Error &error,
+void Materializer::Dematerializer::Dematerialize(Status &error,
lldb::addr_t frame_bottom,
lldb::addr_t frame_top) {
lldb::StackFrameSP frame_sp;
diff --git a/source/Expression/REPL.cpp b/source/Expression/REPL.cpp
index e404537562b7b..84a6405f32686 100644
--- a/source/Expression/REPL.cpp
+++ b/source/Expression/REPL.cpp
@@ -42,7 +42,7 @@ REPL::REPL(LLVMCastKind kind, Target &target) : m_target(target), m_kind(kind) {
REPL::~REPL() = default;
-lldb::REPLSP REPL::Create(Error &err, lldb::LanguageType language,
+lldb::REPLSP REPL::Create(Status &err, lldb::LanguageType language,
Debugger *debugger, Target *target,
const char *repl_options) {
uint32_t idx = 0;
@@ -309,7 +309,7 @@ void REPL::IOHandlerInputComplete(IOHandler &io_handler, std::string &code) {
const char *expr_prefix = nullptr;
lldb::ValueObjectSP result_valobj_sp;
- Error error;
+ Status error;
lldb::ModuleSP jit_module_sp;
lldb::ExpressionResults execution_results =
UserExpression::Evaluate(exe_ctx, expr_options, code.c_str(),
@@ -518,8 +518,8 @@ bool QuitCommandOverrideCallback(void *baton, const char **argv) {
return false;
}
-Error REPL::RunLoop() {
- Error error;
+Status REPL::RunLoop() {
+ Status error;
error = DoInitialization();
m_repl_source_path = GetSourcePath();
diff --git a/source/Expression/UserExpression.cpp b/source/Expression/UserExpression.cpp
index c7cf106e19df4..3386bc4577aec 100644
--- a/source/Expression/UserExpression.cpp
+++ b/source/Expression/UserExpression.cpp
@@ -101,7 +101,7 @@ bool UserExpression::MatchesContext(ExecutionContext &exe_ctx) {
lldb::addr_t UserExpression::GetObjectPointer(lldb::StackFrameSP frame_sp,
ConstString &object_name,
- Error &err) {
+ Status &err) {
err.Clear();
if (!frame_sp) {
@@ -140,7 +140,7 @@ lldb::addr_t UserExpression::GetObjectPointer(lldb::StackFrameSP frame_sp,
lldb::ExpressionResults UserExpression::Evaluate(
ExecutionContext &exe_ctx, const EvaluateExpressionOptions &options,
llvm::StringRef expr, llvm::StringRef prefix,
- lldb::ValueObjectSP &result_valobj_sp, Error &error, uint32_t line_offset,
+ lldb::ValueObjectSP &result_valobj_sp, Status &error, uint32_t line_offset,
std::string *fixed_expression, lldb::ModuleSP *jit_module_sp_ptr) {
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EXPRESSIONS |
LIBLLDB_LOG_STEP));
diff --git a/source/Expression/UtilityFunction.cpp b/source/Expression/UtilityFunction.cpp
index 6772fd18ac5be..52f3bfc4d1286 100644
--- a/source/Expression/UtilityFunction.cpp
+++ b/source/Expression/UtilityFunction.cpp
@@ -65,7 +65,7 @@ UtilityFunction::~UtilityFunction() {
FunctionCaller *UtilityFunction::MakeFunctionCaller(
const CompilerType &return_type, const ValueList &arg_value_list,
- lldb::ThreadSP thread_to_use_sp, Error &error) {
+ lldb::ThreadSP thread_to_use_sp, Status &error) {
if (m_caller_up)
return m_caller_up.get();