本文整理汇总了C++中ExecutionContext::GetTargetRef方法的典型用法代码示例。如果您正苦于以下问题:C++ ExecutionContext::GetTargetRef方法的具体用法?C++ ExecutionContext::GetTargetRef怎么用?C++ ExecutionContext::GetTargetRef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExecutionContext
的用法示例。
在下文中一共展示了ExecutionContext::GetTargetRef方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DumpRegister
bool DumpRegister(const ExecutionContext &exe_ctx, Stream &strm,
RegisterContext *reg_ctx, const RegisterInfo *reg_info) {
if (reg_info) {
RegisterValue reg_value;
if (reg_ctx->ReadRegister(reg_info, reg_value)) {
strm.Indent();
bool prefix_with_altname = (bool)m_command_options.alternate_name;
bool prefix_with_name = !prefix_with_altname;
reg_value.Dump(&strm, reg_info, prefix_with_name, prefix_with_altname,
m_format_options.GetFormat(), 8);
if ((reg_info->encoding == eEncodingUint) ||
(reg_info->encoding == eEncodingSint)) {
Process *process = exe_ctx.GetProcessPtr();
if (process && reg_info->byte_size == process->GetAddressByteSize()) {
addr_t reg_addr = reg_value.GetAsUInt64(LLDB_INVALID_ADDRESS);
if (reg_addr != LLDB_INVALID_ADDRESS) {
Address so_reg_addr;
if (exe_ctx.GetTargetRef()
.GetSectionLoadList()
.ResolveLoadAddress(reg_addr, so_reg_addr)) {
strm.PutCString(" ");
so_reg_addr.Dump(&strm, exe_ctx.GetBestExecutionContextScope(),
Address::DumpStyleResolvedDescription);
}
}
}
}
strm.EOL();
return true;
}
}
return false;
}
示例2:
bool
DynamicCheckerFunctions::Install(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx)
{
Error error;
m_valid_pointer_check.reset(exe_ctx.GetTargetRef().GetUtilityFunctionForLanguage(g_valid_pointer_check_text,
lldb::eLanguageTypeC,
VALID_POINTER_CHECK_NAME,
error));
if (error.Fail())
return false;
if (!m_valid_pointer_check->Install(diagnostic_manager, exe_ctx))
return false;
Process *process = exe_ctx.GetProcessPtr();
if (process)
{
ObjCLanguageRuntime *objc_language_runtime = process->GetObjCLanguageRuntime();
if (objc_language_runtime)
{
m_objc_object_check.reset(objc_language_runtime->CreateObjectChecker(VALID_OBJC_OBJECT_CHECK_NAME));
if (!m_objc_object_check->Install(diagnostic_manager, exe_ctx))
return false;
}
}
return true;
}
示例3: target_sp
bool
Disassembler::PrintInstructions
(
Disassembler *disasm_ptr,
Debugger &debugger,
const ArchSpec &arch,
const ExecutionContext &exe_ctx,
uint32_t num_instructions,
uint32_t num_mixed_context_lines,
uint32_t options,
Stream &strm
)
{
// We got some things disassembled...
size_t num_instructions_found = disasm_ptr->GetInstructionList().GetSize();
if (num_instructions > 0 && num_instructions < num_instructions_found)
num_instructions_found = num_instructions;
const uint32_t max_opcode_byte_size = disasm_ptr->GetInstructionList().GetMaxOpcocdeByteSize ();
uint32_t offset = 0;
SymbolContext sc;
SymbolContext prev_sc;
AddressRange sc_range;
const Address *pc_addr_ptr = NULL;
StackFrame *frame = exe_ctx.GetFramePtr();
TargetSP target_sp (exe_ctx.GetTargetSP());
SourceManager &source_manager = target_sp ? target_sp->GetSourceManager() : debugger.GetSourceManager();
if (frame)
{
pc_addr_ptr = &frame->GetFrameCodeAddress();
}
const uint32_t scope = eSymbolContextLineEntry | eSymbolContextFunction | eSymbolContextSymbol;
const bool use_inline_block_range = false;
const FormatEntity::Entry *disassembly_format = NULL;
FormatEntity::Entry format;
if (exe_ctx.HasTargetScope())
{
disassembly_format = exe_ctx.GetTargetRef().GetDebugger().GetDisassemblyFormat ();
}
else
{
FormatEntity::Parse("${addr}: ", format);
disassembly_format = &format;
}
// First pass: step through the list of instructions,
// find how long the initial addresses strings are, insert padding
// in the second pass so the opcodes all line up nicely.
size_t address_text_size = 0;
for (size_t i = 0; i < num_instructions_found; ++i)
{
Instruction *inst = disasm_ptr->GetInstructionList().GetInstructionAtIndex (i).get();
if (inst)
{
const Address &addr = inst->GetAddress();
ModuleSP module_sp (addr.GetModule());
if (module_sp)
{
const uint32_t resolve_mask = eSymbolContextFunction | eSymbolContextSymbol;
uint32_t resolved_mask = module_sp->ResolveSymbolContextForAddress(addr, resolve_mask, sc);
if (resolved_mask)
{
StreamString strmstr;
Debugger::FormatDisassemblerAddress (disassembly_format, &sc, NULL, &exe_ctx, &addr, strmstr);
size_t cur_line = strmstr.GetSizeOfLastLine();
if (cur_line > address_text_size)
address_text_size = cur_line;
}
sc.Clear(false);
}
}
}
for (size_t i = 0; i < num_instructions_found; ++i)
{
Instruction *inst = disasm_ptr->GetInstructionList().GetInstructionAtIndex (i).get();
if (inst)
{
const Address &addr = inst->GetAddress();
const bool inst_is_at_pc = pc_addr_ptr && addr == *pc_addr_ptr;
prev_sc = sc;
ModuleSP module_sp (addr.GetModule());
if (module_sp)
{
uint32_t resolved_mask = module_sp->ResolveSymbolContextForAddress(addr, eSymbolContextEverything, sc);
if (resolved_mask)
{
if (num_mixed_context_lines)
{
if (!sc_range.ContainsFileAddress (addr))
{
sc.GetAddressRange (scope, 0, use_inline_block_range, sc_range);
if (sc != prev_sc)
//.........这里部分代码省略.........
示例4: AddArguments
bool ClangUserExpression::AddArguments(ExecutionContext &exe_ctx,
std::vector<lldb::addr_t> &args,
lldb::addr_t struct_address,
DiagnosticManager &diagnostic_manager) {
lldb::addr_t object_ptr = LLDB_INVALID_ADDRESS;
lldb::addr_t cmd_ptr = LLDB_INVALID_ADDRESS;
if (m_needs_object_ptr) {
lldb::StackFrameSP frame_sp = exe_ctx.GetFrameSP();
if (!frame_sp)
return true;
ConstString object_name;
if (m_in_cplusplus_method) {
object_name.SetCString("this");
} else if (m_in_objectivec_method) {
object_name.SetCString("self");
} else {
diagnostic_manager.PutString(
eDiagnosticSeverityError,
"need object pointer but don't know the language");
return false;
}
Status object_ptr_error;
object_ptr = GetObjectPointer(frame_sp, object_name, object_ptr_error);
if (!object_ptr_error.Success()) {
exe_ctx.GetTargetRef().GetDebugger().GetAsyncOutputStream()->Printf(
"warning: `%s' is not accessible (substituting 0)\n",
object_name.AsCString());
object_ptr = 0;
}
if (m_in_objectivec_method) {
ConstString cmd_name("_cmd");
cmd_ptr = GetObjectPointer(frame_sp, cmd_name, object_ptr_error);
if (!object_ptr_error.Success()) {
diagnostic_manager.Printf(
eDiagnosticSeverityWarning,
"couldn't get cmd pointer (substituting NULL): %s",
object_ptr_error.AsCString());
cmd_ptr = 0;
}
}
args.push_back(object_ptr);
if (m_in_objectivec_method)
args.push_back(cmd_ptr);
args.push_back(struct_address);
} else {
args.push_back(struct_address);
}
return true;
}