本文整理汇总了C++中ObjectFile::GetSectionList方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectFile::GetSectionList方法的具体用法?C++ ObjectFile::GetSectionList怎么用?C++ ObjectFile::GetSectionList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectFile
的用法示例。
在下文中一共展示了ObjectFile::GetSectionList方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
//------------------------------------------------------------------
// Static Functions
//------------------------------------------------------------------
enum ObjCRuntimeVersions
AppleObjCRuntime::GetObjCVersion (Process *process, ModuleSP &objc_module_sp)
{
ModuleList &images = process->GetTarget().GetImages();
size_t num_images = images.GetSize();
for (size_t i = 0; i < num_images; i++)
{
ModuleSP module_sp = images.GetModuleAtIndex(i);
if (AppleIsModuleObjCLibrary (module_sp))
{
objc_module_sp = module_sp;
ObjectFile *ofile = module_sp->GetObjectFile();
if (!ofile)
return eObjC_VersionUnknown;
SectionList *sections = ofile->GetSectionList();
if (!sections)
return eObjC_VersionUnknown;
SectionSP v1_telltale_section_sp = sections->FindSectionByName(ConstString ("__OBJC"));
if (v1_telltale_section_sp)
{
return eAppleObjC_V1;
}
return eAppleObjC_V2;
}
}
return eObjC_VersionUnknown;
}
示例2: module_sp
SBSection
SBModule::FindSection (const char *sect_name)
{
SBSection sb_section;
ModuleSP module_sp (GetSP ());
if (sect_name && module_sp)
{
ObjectFile *objfile = module_sp->GetObjectFile();
if (objfile)
{
SectionList *section_list = objfile->GetSectionList();
if (section_list)
{
ConstString const_sect_name(sect_name);
SectionSP section_sp (section_list->FindSectionByName(const_sect_name));
if (section_sp)
{
sb_section.SetSP (section_sp);
}
}
}
}
return sb_section;
}
示例3: locker
bool
Module::ResolveFileAddress (lldb::addr_t vm_addr, Address& so_addr)
{
Mutex::Locker locker (m_mutex);
Timer scoped_timer(__PRETTY_FUNCTION__, "Module::ResolveFileAddress (vm_addr = 0x%llx)", vm_addr);
ObjectFile* ofile = GetObjectFile();
if (ofile)
return so_addr.ResolveAddressUsingFileSections(vm_addr, ofile->GetSectionList());
return false;
}
示例4:
// Get a valid shared pointer to this section object
SectionSP
Section::GetSharedPointer() const
{
SectionSP this_sp;
if (m_parent)
this_sp = m_parent->GetChildren().GetSharedPointer (this, false);
else
{
ObjectFile *objfile = m_module->GetObjectFile();
if (objfile)
{
SectionList *section_list = objfile->GetSectionList();
if (section_list)
this_sp = section_list->GetSharedPointer (this, false);
}
}
return this_sp;
}
示例5: if
//.........这里部分代码省略.........
}
else if (exe_ctx->GetTargetPtr() == NULL)
{
error.SetErrorString ("can't read file address (invalid target)");
}
else
{
address = m_value.ULongLong(LLDB_INVALID_ADDRESS);
if (address == LLDB_INVALID_ADDRESS)
{
error.SetErrorString ("invalid file address");
}
else
{
if (module == NULL)
{
// The only thing we can currently lock down to a module so that
// we can resolve a file address, is a variable.
Variable *variable = GetVariable();
if (variable)
{
SymbolContext var_sc;
variable->CalculateSymbolContext(&var_sc);
module = var_sc.module_sp.get();
}
}
if (module)
{
bool resolved = false;
ObjectFile *objfile = module->GetObjectFile();
if (objfile)
{
Address so_addr(address, objfile->GetSectionList());
addr_t load_address = so_addr.GetLoadAddress (exe_ctx->GetTargetPtr());
bool process_launched_and_stopped = exe_ctx->GetProcessPtr()
? StateIsStoppedState(exe_ctx->GetProcessPtr()->GetState(), true /* must_exist */)
: false;
// Don't use the load address if the process has exited.
if (load_address != LLDB_INVALID_ADDRESS && process_launched_and_stopped)
{
resolved = true;
address = load_address;
address_type = eAddressTypeLoad;
data.SetByteOrder(exe_ctx->GetTargetRef().GetArchitecture().GetByteOrder());
data.SetAddressByteSize(exe_ctx->GetTargetRef().GetArchitecture().GetAddressByteSize());
}
else
{
if (so_addr.IsSectionOffset())
{
resolved = true;
file_so_addr = so_addr;
data.SetByteOrder(objfile->GetByteOrder());
data.SetAddressByteSize(objfile->GetAddressByteSize());
}
}
}
if (!resolved)
{
Variable *variable = GetVariable();
if (module)
{
if (variable)
error.SetErrorStringWithFormat ("unable to resolve the module for file address 0x%" PRIx64 " for variable '%s' in %s",
示例6: if
Error
Value::GetValueAsData (ExecutionContext *exe_ctx,
clang::ASTContext *ast_context,
DataExtractor &data,
uint32_t data_offset,
Module *module)
{
data.Clear();
Error error;
lldb::addr_t address = LLDB_INVALID_ADDRESS;
AddressType address_type = eAddressTypeFile;
Address file_so_addr;
switch (m_value_type)
{
default:
error.SetErrorStringWithFormat("invalid value type %i", m_value_type);
break;
case eValueTypeScalar:
data.SetByteOrder (lldb::endian::InlHostByteOrder());
if (m_context_type == eContextTypeClangType && ast_context)
{
uint32_t ptr_bit_width = ClangASTType::GetClangTypeBitWidth (ast_context,
ClangASTContext::GetVoidPtrType(ast_context, false));
uint32_t ptr_byte_size = (ptr_bit_width + 7) / 8;
data.SetAddressByteSize (ptr_byte_size);
}
else
data.SetAddressByteSize(sizeof(void *));
if (m_value.GetData (data))
return error; // Success;
error.SetErrorStringWithFormat("extracting data from value failed");
break;
case eValueTypeLoadAddress:
if (exe_ctx == NULL)
{
error.SetErrorString ("can't read load address (no execution context)");
}
else
{
Process *process = exe_ctx->GetProcessPtr();
if (process == NULL)
{
error.SetErrorString ("can't read load address (invalid process)");
}
else
{
address = m_value.ULongLong(LLDB_INVALID_ADDRESS);
address_type = eAddressTypeLoad;
data.SetByteOrder(process->GetTarget().GetArchitecture().GetByteOrder());
data.SetAddressByteSize(process->GetTarget().GetArchitecture().GetAddressByteSize());
}
}
break;
case eValueTypeFileAddress:
if (exe_ctx == NULL)
{
error.SetErrorString ("can't read file address (no execution context)");
}
else if (exe_ctx->GetTargetPtr() == NULL)
{
error.SetErrorString ("can't read file address (invalid target)");
}
else
{
address = m_value.ULongLong(LLDB_INVALID_ADDRESS);
if (address == LLDB_INVALID_ADDRESS)
{
error.SetErrorString ("invalid file address");
}
else
{
if (module == NULL)
{
// The only thing we can currently lock down to a module so that
// we can resolve a file address, is a variable.
Variable *variable = GetVariable();
if (variable)
{
SymbolContext var_sc;
variable->CalculateSymbolContext(&var_sc);
module = var_sc.module_sp.get();
}
}
if (module)
{
bool resolved = false;
ObjectFile *objfile = module->GetObjectFile();
if (objfile)
{
Address so_addr(address, objfile->GetSectionList());
addr_t load_address = so_addr.GetLoadAddress (exe_ctx->GetTargetPtr());
bool process_launched_and_stopped = exe_ctx->GetProcessPtr()
? StateIsStoppedState(exe_ctx->GetProcessPtr()->GetState(), true /* must_exist */)
: false;
// Don't use the load address if the process has exited.
//.........这里部分代码省略.........
示例7: exe_ctx
//.........这里部分代码省略.........
m_value.SetContext(Value::eContextTypeVariable, variable);
ClangASTType clang_type = GetClangType();
if (clang_type.IsValid())
m_value.SetClangType(clang_type);
Value::ValueType value_type = m_value.GetValueType();
switch (value_type)
{
case Value::eValueTypeFileAddress:
SetAddressTypeOfChildren(eAddressTypeFile);
break;
case Value::eValueTypeHostAddress:
SetAddressTypeOfChildren(eAddressTypeHost);
break;
case Value::eValueTypeLoadAddress:
case Value::eValueTypeScalar:
case Value::eValueTypeVector:
SetAddressTypeOfChildren(eAddressTypeLoad);
break;
}
switch (value_type)
{
case Value::eValueTypeVector:
// fall through
case Value::eValueTypeScalar:
// The variable value is in the Scalar value inside the m_value.
// We can point our m_data right to it.
m_error = m_value.GetValueAsData (&exe_ctx, m_data, 0, GetModule().get());
break;
case Value::eValueTypeFileAddress:
case Value::eValueTypeLoadAddress:
case Value::eValueTypeHostAddress:
// The DWARF expression result was an address in the inferior
// process. If this variable is an aggregate type, we just need
// the address as the main value as all child variable objects
// will rely upon this location and add an offset and then read
// their own values as needed. If this variable is a simple
// type, we read all data for it into m_data.
// Make sure this type has a value before we try and read it
// If we have a file address, convert it to a load address if we can.
Process *process = exe_ctx.GetProcessPtr();
if (value_type == Value::eValueTypeFileAddress && process && process->IsAlive())
{
lldb::addr_t file_addr = m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
if (file_addr != LLDB_INVALID_ADDRESS)
{
SymbolContext var_sc;
variable->CalculateSymbolContext(&var_sc);
if (var_sc.module_sp)
{
ObjectFile *objfile = var_sc.module_sp->GetObjectFile();
if (objfile)
{
Address so_addr(file_addr, objfile->GetSectionList());
lldb::addr_t load_addr = so_addr.GetLoadAddress (target);
if (load_addr != LLDB_INVALID_ADDRESS)
{
m_value.SetValueType(Value::eValueTypeLoadAddress);
m_value.GetScalar() = load_addr;
}
}
}
}
}
if (!CanProvideValue())
{
// this value object represents an aggregate type whose
// children have values, but this object does not. So we
// say we are changed if our location has changed.
SetValueDidChange (value_type != old_value.GetValueType() || m_value.GetScalar() != old_value.GetScalar());
}
else
{
// Copy the Value and set the context to use our Variable
// so it can extract read its value into m_data appropriately
Value value(m_value);
value.SetContext(Value::eContextTypeVariable, variable);
m_error = value.GetValueAsData(&exe_ctx, m_data, 0, GetModule().get());
SetValueDidChange (value_type != old_value.GetValueType() || m_value.GetScalar() != old_value.GetScalar());
}
break;
}
SetValueIsValid (m_error.Success());
}
else
{
// could not find location, won't allow editing
m_resolved_value.SetContext(Value::eContextTypeInvalid, NULL);
}
}
return m_error.Success();
}