本文整理汇总了C++中lldb::StackFrameSP::get方法的典型用法代码示例。如果您正苦于以下问题:C++ StackFrameSP::get方法的具体用法?C++ StackFrameSP::get怎么用?C++ StackFrameSP::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lldb::StackFrameSP
的用法示例。
在下文中一共展示了StackFrameSP::get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Materialize
void Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map,
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;
if (log) {
log->Printf("EntityRegister::Materialize [address = 0x%" PRIx64
", m_register_info = %s]",
(uint64_t)load_addr, m_register_info.name);
}
RegisterValue reg_value;
if (!frame_sp.get()) {
err.SetErrorStringWithFormat(
"couldn't materialize register %s without a stack frame",
m_register_info.name);
return;
}
lldb::RegisterContextSP reg_context_sp = frame_sp->GetRegisterContext();
if (!reg_context_sp->ReadRegister(&m_register_info, reg_value)) {
err.SetErrorStringWithFormat("couldn't read the value of register %s",
m_register_info.name);
return;
}
DataExtractor register_data;
if (!reg_value.GetData(register_data)) {
err.SetErrorStringWithFormat("couldn't get the data for register %s",
m_register_info.name);
return;
}
if (register_data.GetByteSize() != m_register_info.byte_size) {
err.SetErrorStringWithFormat(
"data for register %s had size %llu but we expected %llu",
m_register_info.name, (unsigned long long)register_data.GetByteSize(),
(unsigned long long)m_register_info.byte_size);
return;
}
m_register_contents.reset(new DataBufferHeap(register_data.GetDataStart(),
register_data.GetByteSize()));
Status write_error;
map.WriteMemory(load_addr, register_data.GetDataStart(),
register_data.GetByteSize(), write_error);
if (!write_error.Success()) {
err.SetErrorStringWithFormat(
"couldn't write the contents of register %s: %s",
m_register_info.name, write_error.AsCString());
return;
}
}
示例2: Dematerialize
void Dematerialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map,
lldb::addr_t process_address, lldb::addr_t frame_top,
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;
if (log) {
log->Printf("EntityRegister::Dematerialize [address = 0x%" PRIx64
", m_register_info = %s]",
(uint64_t)load_addr, m_register_info.name);
}
Status extract_error;
DataExtractor register_data;
if (!frame_sp.get()) {
err.SetErrorStringWithFormat(
"couldn't dematerialize register %s without a stack frame",
m_register_info.name);
return;
}
lldb::RegisterContextSP reg_context_sp = frame_sp->GetRegisterContext();
map.GetMemoryData(register_data, load_addr, m_register_info.byte_size,
extract_error);
if (!extract_error.Success()) {
err.SetErrorStringWithFormat("couldn't get the data for register %s: %s",
m_register_info.name,
extract_error.AsCString());
return;
}
if (!memcmp(register_data.GetDataStart(), m_register_contents->GetBytes(),
register_data.GetByteSize())) {
// No write required, and in particular we avoid errors if the register
// wasn't writable
m_register_contents.reset();
return;
}
m_register_contents.reset();
RegisterValue register_value(
const_cast<uint8_t *>(register_data.GetDataStart()),
register_data.GetByteSize(), register_data.GetByteOrder());
if (!reg_context_sp->WriteRegister(&m_register_info, register_value)) {
err.SetErrorStringWithFormat("couldn't write the value of register %s",
m_register_info.name);
return;
}
}
示例3: ret
Materializer::DematerializerSP
Materializer::Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map,
lldb::addr_t process_address, Status &error) {
ExecutionContextScope *exe_scope = frame_sp.get();
if (!exe_scope)
exe_scope = map.GetBestExecutionContextScope();
DematerializerSP dematerializer_sp = m_dematerializer_wp.lock();
if (dematerializer_sp) {
error.SetErrorToGenericError();
error.SetErrorString("Couldn't materialize: already materialized");
}
DematerializerSP ret(
new Dematerializer(*this, frame_sp, map, process_address));
if (!exe_scope) {
error.SetErrorToGenericError();
error.SetErrorString("Couldn't materialize: target doesn't exist");
}
for (EntityUP &entity_up : m_entities) {
entity_up->Materialize(frame_sp, map, process_address, error);
if (!error.Success())
return DematerializerSP();
}
if (Log *log =
lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)) {
log->Printf(
"Materializer::Materialize (frame_sp = %p, process_address = 0x%" PRIx64
") materialized:",
static_cast<void *>(frame_sp.get()), process_address);
for (EntityUP &entity_up : m_entities)
entity_up->DumpToLog(map, process_address, log);
}
m_dematerializer_wp = ret;
return ret;
}
示例4: if
Status ABISysV_ppc64::SetReturnValueObject(lldb::StackFrameSP &frame_sp,
lldb::ValueObjectSP &new_value_sp) {
Status error;
if (!new_value_sp) {
error.SetErrorString("Empty value object for return value.");
return error;
}
CompilerType compiler_type = new_value_sp->GetCompilerType();
if (!compiler_type) {
error.SetErrorString("Null clang type for return value.");
return error;
}
Thread *thread = frame_sp->GetThread().get();
bool is_signed;
uint32_t count;
bool is_complex;
RegisterContext *reg_ctx = thread->GetRegisterContext().get();
bool set_it_simple = false;
if (compiler_type.IsIntegerOrEnumerationType(is_signed) ||
compiler_type.IsPointerType()) {
const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoByName("r3", 0);
DataExtractor data;
Status data_error;
size_t num_bytes = new_value_sp->GetData(data, data_error);
if (data_error.Fail()) {
error.SetErrorStringWithFormat(
"Couldn't convert return value to raw data: %s",
data_error.AsCString());
return error;
}
lldb::offset_t offset = 0;
if (num_bytes <= 8) {
uint64_t raw_value = data.GetMaxU64(&offset, num_bytes);
if (reg_ctx->WriteRegisterFromUnsigned(reg_info, raw_value))
set_it_simple = true;
} else {
error.SetErrorString("We don't support returning longer than 64 bit "
"integer values at present.");
}
} else if (compiler_type.IsFloatingPointType(count, is_complex)) {
if (is_complex)
error.SetErrorString(
"We don't support returning complex values at present");
else {
size_t bit_width = compiler_type.GetBitSize(frame_sp.get());
if (bit_width <= 64) {
DataExtractor data;
Status data_error;
size_t num_bytes = new_value_sp->GetData(data, data_error);
if (data_error.Fail()) {
error.SetErrorStringWithFormat(
"Couldn't convert return value to raw data: %s",
data_error.AsCString());
return error;
}
unsigned char buffer[16];
ByteOrder byte_order = data.GetByteOrder();
data.CopyByteOrderedData(0, num_bytes, buffer, 16, byte_order);
set_it_simple = true;
} else {
// FIXME - don't know how to do 80 bit long doubles yet.
error.SetErrorString(
"We don't support returning float values > 64 bits at present");
}
}
}
if (!set_it_simple) {
// Okay we've got a structure or something that doesn't fit in a simple
// register.
// We should figure out where it really goes, but we don't support this yet.
error.SetErrorString("We only support setting simple integer and float "
"return types at present.");
}
return error;
}