Added to the public API to allow symbolication:
- New SBSection objects that are object file sections which can be accessed through the SBModule classes. You can get the number of sections, get a section at index, and find a section by name. - SBSections can contain subsections (first find "__TEXT" on darwin, then us the resulting SBSection to find "__text" sub section). - Set load addresses for a SBSection in the SBTarget interface - Set the load addresses of all SBSection in a SBModule in the SBTarget interface - Add a new module the an existing target in the SBTarget interface - Get a SBSection from a SBAddress object This should get us a lot closer to being able to symbolicate using LLDB through the public API. llvm-svn: 140437
This commit is contained in:
@@ -217,6 +217,11 @@ SBModule::get() const
|
||||
return m_opaque_sp.get();
|
||||
}
|
||||
|
||||
const lldb::ModuleSP &
|
||||
SBModule::get_sp() const
|
||||
{
|
||||
return m_opaque_sp;
|
||||
}
|
||||
|
||||
void
|
||||
SBModule::SetModule (const lldb::ModuleSP& module_sp)
|
||||
@@ -225,15 +230,17 @@ SBModule::SetModule (const lldb::ModuleSP& module_sp)
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SBModule::ResolveFileAddress (lldb::addr_t vm_addr, SBAddress& addr)
|
||||
SBAddress
|
||||
SBModule::ResolveFileAddress (lldb::addr_t vm_addr)
|
||||
{
|
||||
if (m_opaque_sp && addr.IsValid())
|
||||
return m_opaque_sp->ResolveFileAddress (vm_addr, addr.ref());
|
||||
|
||||
if (addr.IsValid())
|
||||
addr->Clear();
|
||||
return false;
|
||||
lldb::SBAddress sb_addr;
|
||||
if (m_opaque_sp)
|
||||
{
|
||||
Address addr;
|
||||
if (m_opaque_sp->ResolveFileAddress (vm_addr, addr))
|
||||
sb_addr.ref() = addr;
|
||||
}
|
||||
return sb_addr;
|
||||
}
|
||||
|
||||
SBSymbolContext
|
||||
@@ -292,6 +299,40 @@ SBModule::GetSymbolAtIndex (size_t idx)
|
||||
return sb_symbol;
|
||||
}
|
||||
|
||||
size_t
|
||||
SBModule::GetNumSections ()
|
||||
{
|
||||
if (m_opaque_sp)
|
||||
{
|
||||
ObjectFile *obj_file = m_opaque_sp->GetObjectFile();
|
||||
if (obj_file)
|
||||
{
|
||||
SectionList *section_list = obj_file->GetSectionList ();
|
||||
if (section_list)
|
||||
return section_list->GetSize();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBSection
|
||||
SBModule::GetSectionAtIndex (size_t idx)
|
||||
{
|
||||
SBSection sb_section;
|
||||
if (m_opaque_sp)
|
||||
{
|
||||
ObjectFile *obj_file = m_opaque_sp->GetObjectFile();
|
||||
if (obj_file)
|
||||
{
|
||||
SectionList *section_list = obj_file->GetSectionList ();
|
||||
|
||||
if (section_list)
|
||||
sb_section.SetSection(section_list->GetSectionAtIndex (idx).get());
|
||||
}
|
||||
}
|
||||
return sb_section;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
SBModule::FindFunctions (const char *name,
|
||||
uint32_t name_type_mask,
|
||||
@@ -396,3 +437,30 @@ SBModule::FindTypes (const char* type)
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
SBSection
|
||||
SBModule::FindSection (const char *sect_name)
|
||||
{
|
||||
SBSection sb_section;
|
||||
|
||||
if (IsValid())
|
||||
{
|
||||
ObjectFile *objfile = m_opaque_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.SetSection(section_sp.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return sb_section;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user