本文整理汇总了C++中ArchSpec::GetAddressByteSize方法的典型用法代码示例。如果您正苦于以下问题:C++ ArchSpec::GetAddressByteSize方法的具体用法?C++ ArchSpec::GetAddressByteSize怎么用?C++ ArchSpec::GetAddressByteSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArchSpec
的用法示例。
在下文中一共展示了ArchSpec::GetAddressByteSize方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: data
lldb::DisassemblerSP
Disassembler::DisassembleBytes (const ArchSpec &arch,
const char *plugin_name,
const char *flavor,
const Address &start,
const void *src,
size_t src_len,
uint32_t num_instructions,
bool data_from_file)
{
lldb::DisassemblerSP disasm_sp;
if (src)
{
disasm_sp = Disassembler::FindPlugin(arch, flavor, plugin_name);
if (disasm_sp)
{
DataExtractor data(src, src_len, arch.GetByteOrder(), arch.GetAddressByteSize());
(void)disasm_sp->DecodeInstructions (start,
data,
0,
num_instructions,
false,
data_from_file);
}
}
return disasm_sp;
}
示例2: GetByteSize
uint64_t Type::GetByteSize() {
if (m_byte_size == 0) {
switch (m_encoding_uid_type) {
case eEncodingInvalid:
case eEncodingIsSyntheticUID:
break;
case eEncodingIsUID:
case eEncodingIsConstUID:
case eEncodingIsRestrictUID:
case eEncodingIsVolatileUID:
case eEncodingIsTypedefUID: {
Type *encoding_type = GetEncodingType();
if (encoding_type)
m_byte_size = encoding_type->GetByteSize();
if (m_byte_size == 0)
m_byte_size = GetLayoutCompilerType().GetByteSize(nullptr);
} break;
// If we are a pointer or reference, then this is just a pointer size;
case eEncodingIsPointerUID:
case eEncodingIsLValueReferenceUID:
case eEncodingIsRValueReferenceUID: {
ArchSpec arch;
if (m_symbol_file->GetObjectFile()->GetArchitecture(arch))
m_byte_size = arch.GetAddressByteSize();
} break;
}
}
return m_byte_size;
}
示例3: if
lldb::TypeSystemSP
GoASTContext::CreateInstance (lldb::LanguageType language, Module *module, Target *target, const char *compiler_options)
{
if (language == eLanguageTypeGo)
{
ArchSpec arch;
std::shared_ptr<GoASTContext> go_ast_sp;
if (module)
{
arch = module->GetArchitecture();
go_ast_sp = std::shared_ptr<GoASTContext>(new GoASTContext);
}
else if (target)
{
arch = target->GetArchitecture();
go_ast_sp = std::shared_ptr<GoASTContextForExpr>(new GoASTContextForExpr(target->shared_from_this()));
}
if (arch.IsValid())
{
go_ast_sp->SetAddressByteSize(arch.GetAddressByteSize());
return go_ast_sp;
}
}
return lldb::TypeSystemSP();
}
示例4: data
lldb::DisassemblerSP
Disassembler::DisassembleBytes
(
const ArchSpec &arch,
const char *plugin_name,
const Address &start,
const void *bytes,
size_t length,
uint32_t num_instructions
)
{
lldb::DisassemblerSP disasm_sp;
if (bytes)
{
disasm_sp.reset(Disassembler::FindPlugin(arch, plugin_name));
if (disasm_sp)
{
DataExtractor data(bytes, length, arch.GetByteOrder(), arch.GetAddressByteSize());
(void)disasm_sp->DecodeInstructions (start,
data,
0,
num_instructions,
false);
}
}
return disasm_sp;
}
示例5: make_pair
static llvm::Optional<std::pair<lldb::ByteOrder, uint32_t>>
GetByteOrderAndAddrSize(Thread *thread) {
if (!thread)
return llvm::None;
ProcessSP process_sp = thread->GetProcess();
if (!process_sp)
return llvm::None;
ArchSpec arch = process_sp->GetTarget().GetArchitecture();
return std::make_pair(arch.GetByteOrder(), arch.GetAddressByteSize());
}
示例6: FileSpec
FileSpec
HostInfoAndroid::ResolveLibraryPath(const std::string& module_path, const ArchSpec& arch)
{
static const char* const ld_library_path_separator = ":";
static const char* const default_lib32_path[] = {
"/vendor/lib",
"/system/lib",
nullptr
};
static const char* const default_lib64_path[] = {
"/vendor/lib64",
"/system/lib64",
nullptr
};
if (module_path.empty() || module_path[0] == '/')
return FileSpec(module_path.c_str(), true);
SmallVector<StringRef, 4> ld_paths;
if (const char* ld_library_path = ::getenv("LD_LIBRARY_PATH"))
StringRef(ld_library_path).split(ld_paths, StringRef(ld_library_path_separator), -1, false);
const char* const* default_lib_path = nullptr;
switch (arch.GetAddressByteSize())
{
case 4:
default_lib_path = default_lib32_path;
break;
case 8:
default_lib_path = default_lib64_path;
break;
default:
assert(false && "Unknown address byte size");
return FileSpec();
}
for(const char* const* it = default_lib_path; *it; ++it)
ld_paths.push_back(StringRef(*it));
for (const StringRef& path : ld_paths)
{
FileSpec file_candidate(path.str().c_str(), true);
file_candidate.AppendPathComponent(module_path.c_str());
if (file_candidate.Exists())
return file_candidate;
}
return FileSpec();
}
示例7: func_range
bool
CompactUnwindInfo::GetUnwindPlan (Target &target, Address addr, UnwindPlan& unwind_plan)
{
if (!IsValid (target.GetProcessSP()))
{
return false;
}
FunctionInfo function_info;
if (GetCompactUnwindInfoForFunction (target, addr, function_info))
{
// shortcut return for functions that have no compact unwind
if (function_info.encoding == 0)
return false;
ArchSpec arch;
if (m_objfile.GetArchitecture (arch))
{
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND));
if (log && log->GetVerbose())
{
StreamString strm;
addr.Dump (&strm, NULL, Address::DumpStyle::DumpStyleResolvedDescriptionNoFunctionArguments, Address::DumpStyle::DumpStyleFileAddress, arch.GetAddressByteSize());
log->Printf ("Got compact unwind encoding 0x%x for function %s", function_info.encoding, strm.GetData());
}
if (function_info.valid_range_offset_start != 0 && function_info.valid_range_offset_end != 0)
{
SectionList *sl = m_objfile.GetSectionList ();
if (sl)
{
addr_t func_range_start_file_addr =
function_info.valid_range_offset_start + m_objfile.GetHeaderAddress().GetFileAddress();
AddressRange func_range (func_range_start_file_addr,
function_info.valid_range_offset_end - function_info.valid_range_offset_start,
sl);
unwind_plan.SetPlanValidAddressRange (func_range);
}
}
if (arch.GetTriple().getArch() == llvm::Triple::x86_64)
{
return CreateUnwindPlan_x86_64 (target, function_info, unwind_plan, addr);
}
if (arch.GetTriple().getArch() == llvm::Triple::x86)
{
return CreateUnwindPlan_i386 (target, function_info, unwind_plan, addr);
}
}
}
return false;
}
示例8: TypeSystem
JavaASTContext::JavaASTContext(const ArchSpec &arch)
: TypeSystem(eKindJava), m_pointer_byte_size(arch.GetAddressByteSize()) {}