本文整理汇总了C++中Symbol::GetAddress方法的典型用法代码示例。如果您正苦于以下问题:C++ Symbol::GetAddress方法的具体用法?C++ Symbol::GetAddress怎么用?C++ Symbol::GetAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symbol
的用法示例。
在下文中一共展示了Symbol::GetAddress方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//.........这里部分代码省略.........
std::vector<AddressRange> ranges;
AddressRange range;
StackFrame *frame = m_exe_ctx.GetFramePtr();
if (m_options.frame_line)
{
if (frame == NULL)
{
result.AppendError ("Cannot disassemble around the current line without a selected frame.\n");
result.SetStatus (eReturnStatusFailed);
return false;
}
LineEntry pc_line_entry (frame->GetSymbolContext(eSymbolContextLineEntry).line_entry);
if (pc_line_entry.IsValid())
{
range = pc_line_entry.range;
}
else
{
m_options.at_pc = true; // No line entry, so just disassemble around the current pc
m_options.show_mixed = false;
}
}
else if (m_options.current_function)
{
if (frame == NULL)
{
result.AppendError ("Cannot disassemble around the current function without a selected frame.\n");
result.SetStatus (eReturnStatusFailed);
return false;
}
Symbol *symbol = frame->GetSymbolContext(eSymbolContextSymbol).symbol;
if (symbol)
{
range.GetBaseAddress() = symbol->GetAddress();
range.SetByteSize(symbol->GetByteSize());
}
}
// Did the "m_options.frame_line" find a valid range already? If so
// skip the rest...
if (range.GetByteSize() == 0)
{
if (m_options.at_pc)
{
if (frame == NULL)
{
result.AppendError ("Cannot disassemble around the current PC without a selected frame.\n");
result.SetStatus (eReturnStatusFailed);
return false;
}
range.GetBaseAddress() = frame->GetFrameCodeAddress();
if (m_options.num_instructions == 0)
{
// Disassembling at the PC always disassembles some number of instructions (not the whole function).
m_options.num_instructions = DEFAULT_DISASM_NUM_INS;
}
ranges.push_back(range);
}
else
{
range.GetBaseAddress().SetOffset (m_options.start_addr);
if (range.GetBaseAddress().IsValid())
{
if (m_options.end_addr != LLDB_INVALID_ADDRESS)
{
if (m_options.end_addr <= m_options.start_addr)
示例2: section_sp
AddressClass
ObjectFile::GetAddressClass (addr_t file_addr)
{
Symtab *symtab = GetSymtab(ObjectFile::eSymtabFromUnifiedSectionList);
if (symtab)
{
Symbol *symbol = symtab->FindSymbolContainingFileAddress(file_addr);
if (symbol)
{
if (symbol->ValueIsAddress())
{
const SectionSP section_sp (symbol->GetAddress().GetSection());
if (section_sp)
{
const SectionType section_type = section_sp->GetType();
switch (section_type)
{
case eSectionTypeInvalid: return eAddressClassUnknown;
case eSectionTypeCode: return eAddressClassCode;
case eSectionTypeContainer: return eAddressClassUnknown;
case eSectionTypeData:
case eSectionTypeDataCString:
case eSectionTypeDataCStringPointers:
case eSectionTypeDataSymbolAddress:
case eSectionTypeData4:
case eSectionTypeData8:
case eSectionTypeData16:
case eSectionTypeDataPointers:
case eSectionTypeZeroFill:
case eSectionTypeDataObjCMessageRefs:
case eSectionTypeDataObjCCFStrings:
return eAddressClassData;
case eSectionTypeDebug:
case eSectionTypeDWARFDebugAbbrev:
case eSectionTypeDWARFDebugAranges:
case eSectionTypeDWARFDebugFrame:
case eSectionTypeDWARFDebugInfo:
case eSectionTypeDWARFDebugLine:
case eSectionTypeDWARFDebugLoc:
case eSectionTypeDWARFDebugMacInfo:
case eSectionTypeDWARFDebugPubNames:
case eSectionTypeDWARFDebugPubTypes:
case eSectionTypeDWARFDebugRanges:
case eSectionTypeDWARFDebugStr:
case eSectionTypeDWARFAppleNames:
case eSectionTypeDWARFAppleTypes:
case eSectionTypeDWARFAppleNamespaces:
case eSectionTypeDWARFAppleObjC:
return eAddressClassDebug;
case eSectionTypeEHFrame: return eAddressClassRuntime;
case eSectionTypeELFSymbolTable:
case eSectionTypeELFDynamicSymbols:
case eSectionTypeELFRelocationEntries:
case eSectionTypeELFDynamicLinkInfo:
case eSectionTypeOther: return eAddressClassUnknown;
}
}
}
const SymbolType symbol_type = symbol->GetType();
switch (symbol_type)
{
case eSymbolTypeAny: return eAddressClassUnknown;
case eSymbolTypeAbsolute: return eAddressClassUnknown;
case eSymbolTypeCode: return eAddressClassCode;
case eSymbolTypeTrampoline: return eAddressClassCode;
case eSymbolTypeResolver: return eAddressClassCode;
case eSymbolTypeData: return eAddressClassData;
case eSymbolTypeRuntime: return eAddressClassRuntime;
case eSymbolTypeException: return eAddressClassRuntime;
case eSymbolTypeSourceFile: return eAddressClassDebug;
case eSymbolTypeHeaderFile: return eAddressClassDebug;
case eSymbolTypeObjectFile: return eAddressClassDebug;
case eSymbolTypeCommonBlock: return eAddressClassDebug;
case eSymbolTypeBlock: return eAddressClassDebug;
case eSymbolTypeLocal: return eAddressClassData;
case eSymbolTypeParam: return eAddressClassData;
case eSymbolTypeVariable: return eAddressClassData;
case eSymbolTypeVariableType: return eAddressClassDebug;
case eSymbolTypeLineEntry: return eAddressClassDebug;
case eSymbolTypeLineHeader: return eAddressClassDebug;
case eSymbolTypeScopeBegin: return eAddressClassDebug;
case eSymbolTypeScopeEnd: return eAddressClassDebug;
case eSymbolTypeAdditional: return eAddressClassUnknown;
case eSymbolTypeCompiler: return eAddressClassDebug;
case eSymbolTypeInstrumentation:return eAddressClassDebug;
case eSymbolTypeUndefined: return eAddressClassUnknown;
case eSymbolTypeObjCClass: return eAddressClassRuntime;
case eSymbolTypeObjCMetaClass: return eAddressClassRuntime;
case eSymbolTypeObjCIVar: return eAddressClassRuntime;
}
}
}
return eAddressClassUnknown;
}
示例3: section_sp
bool
Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, DumpStyle fallback_style, uint32_t addr_size) const
{
// If the section was NULL, only load address is going to work unless we are
// trying to deref a pointer
SectionSP section_sp (GetSection());
if (!section_sp && style != DumpStyleResolvedPointerDescription)
style = DumpStyleLoadAddress;
ExecutionContext exe_ctx (exe_scope);
Target *target = exe_ctx.GetTargetPtr();
// If addr_byte_size is UINT32_MAX, then determine the correct address
// byte size for the process or default to the size of addr_t
if (addr_size == UINT32_MAX)
{
if (target)
addr_size = target->GetArchitecture().GetAddressByteSize ();
else
addr_size = sizeof(addr_t);
}
Address so_addr;
switch (style)
{
case DumpStyleInvalid:
return false;
case DumpStyleSectionNameOffset:
if (section_sp)
{
section_sp->DumpName(s);
s->Printf (" + %" PRIu64, m_offset.load());
}
else
{
s->Address(m_offset, addr_size);
}
break;
case DumpStyleSectionPointerOffset:
s->Printf("(Section *)%p + ", static_cast<void*>(section_sp.get()));
s->Address(m_offset, addr_size);
break;
case DumpStyleModuleWithFileAddress:
if (section_sp)
{
s->Printf("%s[", section_sp->GetModule()->GetFileSpec().GetFilename().AsCString("<Unknown>"));
}
// Fall through
case DumpStyleFileAddress:
{
addr_t file_addr = GetFileAddress();
if (file_addr == LLDB_INVALID_ADDRESS)
{
if (fallback_style != DumpStyleInvalid)
return Dump (s, exe_scope, fallback_style, DumpStyleInvalid, addr_size);
return false;
}
s->Address (file_addr, addr_size);
if (style == DumpStyleModuleWithFileAddress && section_sp)
s->PutChar(']');
}
break;
case DumpStyleLoadAddress:
{
addr_t load_addr = GetLoadAddress (target);
if (load_addr == LLDB_INVALID_ADDRESS)
{
if (fallback_style != DumpStyleInvalid)
return Dump (s, exe_scope, fallback_style, DumpStyleInvalid, addr_size);
return false;
}
s->Address (load_addr, addr_size);
}
break;
case DumpStyleResolvedDescription:
case DumpStyleResolvedDescriptionNoModule:
case DumpStyleResolvedDescriptionNoFunctionArguments:
if (IsSectionOffset())
{
uint32_t pointer_size = 4;
ModuleSP module_sp (GetModule());
if (target)
pointer_size = target->GetArchitecture().GetAddressByteSize();
else if (module_sp)
pointer_size = module_sp->GetArchitecture().GetAddressByteSize();
bool showed_info = false;
if (section_sp)
{
SectionType sect_type = section_sp->GetType();
switch (sect_type)
{
case eSectionTypeData:
if (module_sp)
{
SymbolVendor *sym_vendor = module_sp->GetSymbolVendor();
//.........这里部分代码省略.........