2010-06-09 00:52:24 +08:00
|
|
|
//===-- SBModule.cpp --------------------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "lldb/API/SBModule.h"
|
2010-09-11 02:31:35 +08:00
|
|
|
#include "lldb/API/SBAddress.h"
|
|
|
|
#include "lldb/API/SBFileSpec.h"
|
2010-09-20 13:20:02 +08:00
|
|
|
#include "lldb/API/SBStream.h"
|
2011-06-21 09:34:41 +08:00
|
|
|
#include "lldb/API/SBSymbolContextList.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Core/Module.h"
|
2010-10-26 11:11:13 +08:00
|
|
|
#include "lldb/Core/Log.h"
|
2010-11-01 03:57:43 +08:00
|
|
|
#include "lldb/Core/StreamString.h"
|
2011-06-30 06:09:02 +08:00
|
|
|
#include "lldb/Core/ValueObjectList.h"
|
|
|
|
#include "lldb/Core/ValueObjectVariable.h"
|
2011-07-30 03:53:35 +08:00
|
|
|
#include "lldb/Symbol/SymbolVendor.h"
|
2011-06-30 06:09:02 +08:00
|
|
|
#include "lldb/Symbol/VariableList.h"
|
|
|
|
#include "lldb/Target/Target.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
using namespace lldb;
|
2010-10-26 11:11:13 +08:00
|
|
|
using namespace lldb_private;
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
|
|
|
|
SBModule::SBModule () :
|
2010-06-23 09:19:29 +08:00
|
|
|
m_opaque_sp ()
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SBModule::SBModule (const lldb::ModuleSP& module_sp) :
|
2010-06-23 09:19:29 +08:00
|
|
|
m_opaque_sp (module_sp)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-11-06 07:17:00 +08:00
|
|
|
SBModule::SBModule(const SBModule &rhs) :
|
|
|
|
m_opaque_sp (rhs.m_opaque_sp)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
const SBModule &
|
|
|
|
SBModule::operator = (const SBModule &rhs)
|
|
|
|
{
|
|
|
|
if (this != &rhs)
|
|
|
|
m_opaque_sp = rhs.m_opaque_sp;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
SBModule::~SBModule ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
SBModule::IsValid () const
|
|
|
|
{
|
2010-06-23 09:19:29 +08:00
|
|
|
return m_opaque_sp.get() != NULL;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2011-12-20 04:39:44 +08:00
|
|
|
void
|
|
|
|
SBModule::Clear()
|
|
|
|
{
|
|
|
|
m_opaque_sp.reset();
|
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
SBFileSpec
|
|
|
|
SBModule::GetFileSpec () const
|
|
|
|
{
|
2010-11-06 09:53:30 +08:00
|
|
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2010-10-26 11:11:13 +08:00
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
SBFileSpec file_spec;
|
2010-06-23 09:19:29 +08:00
|
|
|
if (m_opaque_sp)
|
|
|
|
file_spec.SetFileSpec(m_opaque_sp->GetFileSpec());
|
2010-10-26 11:11:13 +08:00
|
|
|
|
|
|
|
if (log)
|
|
|
|
{
|
2010-10-31 11:01:06 +08:00
|
|
|
log->Printf ("SBModule(%p)::GetFileSpec () => SBFileSpec(%p)",
|
|
|
|
m_opaque_sp.get(), file_spec.get());
|
2010-10-26 11:11:13 +08:00
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
return file_spec;
|
|
|
|
}
|
|
|
|
|
2011-04-30 09:09:13 +08:00
|
|
|
lldb::SBFileSpec
|
|
|
|
SBModule::GetPlatformFileSpec () const
|
|
|
|
{
|
|
|
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
|
|
|
|
|
|
|
SBFileSpec file_spec;
|
|
|
|
if (m_opaque_sp)
|
|
|
|
file_spec.SetFileSpec(m_opaque_sp->GetPlatformFileSpec());
|
|
|
|
|
|
|
|
if (log)
|
|
|
|
{
|
|
|
|
log->Printf ("SBModule(%p)::GetPlatformFileSpec () => SBFileSpec(%p)",
|
|
|
|
m_opaque_sp.get(), file_spec.get());
|
|
|
|
}
|
|
|
|
|
|
|
|
return file_spec;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
SBModule::SetPlatformFileSpec (const lldb::SBFileSpec &platform_file)
|
|
|
|
{
|
|
|
|
bool result = false;
|
|
|
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
|
|
|
|
|
|
|
if (m_opaque_sp)
|
|
|
|
{
|
|
|
|
m_opaque_sp->SetPlatformFileSpec(*platform_file);
|
|
|
|
result = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (log)
|
|
|
|
{
|
|
|
|
log->Printf ("SBModule(%p)::SetPlatformFileSpec (SBFileSpec(%p (%s%s%s)) => %i",
|
|
|
|
m_opaque_sp.get(),
|
|
|
|
platform_file.get(),
|
|
|
|
platform_file->GetDirectory().GetCString(),
|
|
|
|
platform_file->GetDirectory() ? "/" : "",
|
|
|
|
platform_file->GetFilename().GetCString(),
|
|
|
|
result);
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
const uint8_t *
|
|
|
|
SBModule::GetUUIDBytes () const
|
|
|
|
{
|
2010-11-06 09:53:30 +08:00
|
|
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2010-10-26 11:11:13 +08:00
|
|
|
|
2010-10-30 12:51:46 +08:00
|
|
|
const uint8_t *uuid_bytes = NULL;
|
2010-06-23 09:19:29 +08:00
|
|
|
if (m_opaque_sp)
|
2010-10-30 12:51:46 +08:00
|
|
|
uuid_bytes = (const uint8_t *)m_opaque_sp->GetUUID().GetBytes();
|
|
|
|
|
|
|
|
if (log)
|
2010-10-26 11:11:13 +08:00
|
|
|
{
|
2010-10-30 12:51:46 +08:00
|
|
|
if (uuid_bytes)
|
2010-10-26 11:11:13 +08:00
|
|
|
{
|
2010-10-30 12:51:46 +08:00
|
|
|
StreamString s;
|
|
|
|
m_opaque_sp->GetUUID().Dump (&s);
|
|
|
|
log->Printf ("SBModule(%p)::GetUUIDBytes () => %s", m_opaque_sp.get(), s.GetData());
|
2010-10-26 11:11:13 +08:00
|
|
|
}
|
2010-10-30 12:51:46 +08:00
|
|
|
else
|
|
|
|
log->Printf ("SBModule(%p)::GetUUIDBytes () => NULL", m_opaque_sp.get());
|
2010-10-26 11:11:13 +08:00
|
|
|
}
|
2010-10-30 12:51:46 +08:00
|
|
|
return uuid_bytes;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-04-01 08:35:55 +08:00
|
|
|
const char *
|
|
|
|
SBModule::GetUUIDString () const
|
|
|
|
{
|
|
|
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
|
|
|
|
|
|
|
static char uuid_string[80];
|
|
|
|
const char * uuid_c_string = NULL;
|
|
|
|
if (m_opaque_sp)
|
|
|
|
uuid_c_string = (const char *)m_opaque_sp->GetUUID().GetAsCString(uuid_string, sizeof(uuid_string));
|
|
|
|
|
|
|
|
if (log)
|
|
|
|
{
|
|
|
|
if (uuid_c_string)
|
|
|
|
{
|
|
|
|
StreamString s;
|
|
|
|
m_opaque_sp->GetUUID().Dump (&s);
|
|
|
|
log->Printf ("SBModule(%p)::GetUUIDString () => %s", m_opaque_sp.get(), s.GetData());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
log->Printf ("SBModule(%p)::GetUUIDString () => NULL", m_opaque_sp.get());
|
|
|
|
}
|
|
|
|
return uuid_c_string;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
bool
|
|
|
|
SBModule::operator == (const SBModule &rhs) const
|
|
|
|
{
|
2010-06-23 09:19:29 +08:00
|
|
|
if (m_opaque_sp)
|
|
|
|
return m_opaque_sp.get() == rhs.m_opaque_sp.get();
|
2010-06-09 00:52:24 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
SBModule::operator != (const SBModule &rhs) const
|
|
|
|
{
|
2010-06-23 09:19:29 +08:00
|
|
|
if (m_opaque_sp)
|
|
|
|
return m_opaque_sp.get() != rhs.m_opaque_sp.get();
|
2010-06-09 00:52:24 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
lldb::ModuleSP &
|
|
|
|
SBModule::operator *()
|
|
|
|
{
|
2010-06-23 09:19:29 +08:00
|
|
|
return m_opaque_sp;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
lldb_private::Module *
|
|
|
|
SBModule::operator ->()
|
|
|
|
{
|
2010-06-23 09:19:29 +08:00
|
|
|
return m_opaque_sp.get();
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const lldb_private::Module *
|
|
|
|
SBModule::operator ->() const
|
|
|
|
{
|
2010-06-23 09:19:29 +08:00
|
|
|
return m_opaque_sp.get();
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
lldb_private::Module *
|
|
|
|
SBModule::get()
|
|
|
|
{
|
2010-06-23 09:19:29 +08:00
|
|
|
return m_opaque_sp.get();
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const lldb_private::Module *
|
|
|
|
SBModule::get() const
|
|
|
|
{
|
2010-06-23 09:19:29 +08:00
|
|
|
return m_opaque_sp.get();
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2011-09-24 08:52:29 +08:00
|
|
|
const lldb::ModuleSP &
|
|
|
|
SBModule::get_sp() const
|
|
|
|
{
|
|
|
|
return m_opaque_sp;
|
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
void
|
|
|
|
SBModule::SetModule (const lldb::ModuleSP& module_sp)
|
|
|
|
{
|
2010-06-23 09:19:29 +08:00
|
|
|
m_opaque_sp = module_sp;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2010-09-11 02:31:35 +08:00
|
|
|
|
2011-09-24 08:52:29 +08:00
|
|
|
SBAddress
|
|
|
|
SBModule::ResolveFileAddress (lldb::addr_t vm_addr)
|
2010-09-11 02:31:35 +08:00
|
|
|
{
|
2011-09-24 08:52:29 +08:00
|
|
|
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;
|
2010-09-11 02:31:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBSymbolContext
|
|
|
|
SBModule::ResolveSymbolContextForAddress (const SBAddress& addr, uint32_t resolve_scope)
|
|
|
|
{
|
|
|
|
SBSymbolContext sb_sc;
|
|
|
|
if (m_opaque_sp && addr.IsValid())
|
2011-07-23 00:46:35 +08:00
|
|
|
m_opaque_sp->ResolveSymbolContextForAddress (addr.ref(), resolve_scope, *sb_sc);
|
2010-09-11 02:31:35 +08:00
|
|
|
return sb_sc;
|
|
|
|
}
|
|
|
|
|
2010-09-20 13:20:02 +08:00
|
|
|
bool
|
|
|
|
SBModule::GetDescription (SBStream &description)
|
|
|
|
{
|
2011-11-13 14:57:31 +08:00
|
|
|
Stream &strm = description.ref();
|
|
|
|
|
2010-09-20 13:20:02 +08:00
|
|
|
if (m_opaque_sp)
|
|
|
|
{
|
2011-11-13 14:57:31 +08:00
|
|
|
m_opaque_sp->GetDescription (&strm);
|
2010-09-20 13:20:02 +08:00
|
|
|
}
|
|
|
|
else
|
2011-11-13 14:57:31 +08:00
|
|
|
strm.PutCString ("No value");
|
2010-09-20 13:20:02 +08:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2010-12-07 13:40:31 +08:00
|
|
|
|
|
|
|
size_t
|
|
|
|
SBModule::GetNumSymbols ()
|
|
|
|
{
|
|
|
|
if (m_opaque_sp)
|
|
|
|
{
|
|
|
|
ObjectFile *obj_file = m_opaque_sp->GetObjectFile();
|
|
|
|
if (obj_file)
|
|
|
|
{
|
|
|
|
Symtab *symtab = obj_file->GetSymtab();
|
|
|
|
if (symtab)
|
|
|
|
return symtab->GetNumSymbols();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
SBSymbol
|
|
|
|
SBModule::GetSymbolAtIndex (size_t idx)
|
|
|
|
{
|
|
|
|
SBSymbol sb_symbol;
|
|
|
|
if (m_opaque_sp)
|
|
|
|
{
|
|
|
|
ObjectFile *obj_file = m_opaque_sp->GetObjectFile();
|
|
|
|
if (obj_file)
|
|
|
|
{
|
|
|
|
Symtab *symtab = obj_file->GetSymtab();
|
|
|
|
if (symtab)
|
|
|
|
sb_symbol.SetSymbol(symtab->SymbolAtIndex (idx));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return sb_symbol;
|
|
|
|
}
|
2011-06-21 09:34:41 +08:00
|
|
|
|
2011-09-24 08:52:29 +08:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2011-06-21 09:34:41 +08:00
|
|
|
uint32_t
|
|
|
|
SBModule::FindFunctions (const char *name,
|
|
|
|
uint32_t name_type_mask,
|
|
|
|
bool append,
|
|
|
|
lldb::SBSymbolContextList& sc_list)
|
|
|
|
{
|
|
|
|
if (!append)
|
|
|
|
sc_list.Clear();
|
2011-12-20 04:16:22 +08:00
|
|
|
if (name && m_opaque_sp)
|
2011-06-21 09:34:41 +08:00
|
|
|
{
|
|
|
|
const bool symbols_ok = true;
|
2011-10-12 10:08:07 +08:00
|
|
|
return m_opaque_sp->FindFunctions (ConstString(name),
|
|
|
|
NULL,
|
2011-06-21 09:34:41 +08:00
|
|
|
name_type_mask,
|
|
|
|
symbols_ok,
|
|
|
|
append,
|
|
|
|
*sc_list);
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-06-30 06:09:02 +08:00
|
|
|
|
|
|
|
SBValueList
|
|
|
|
SBModule::FindGlobalVariables (SBTarget &target, const char *name, uint32_t max_matches)
|
|
|
|
{
|
|
|
|
SBValueList sb_value_list;
|
2011-12-20 04:16:22 +08:00
|
|
|
if (name && m_opaque_sp)
|
2011-06-30 06:09:02 +08:00
|
|
|
{
|
|
|
|
VariableList variable_list;
|
2011-10-12 10:08:07 +08:00
|
|
|
const uint32_t match_count = m_opaque_sp->FindGlobalVariables (ConstString (name),
|
|
|
|
NULL,
|
2011-06-30 06:09:02 +08:00
|
|
|
false,
|
|
|
|
max_matches,
|
|
|
|
variable_list);
|
|
|
|
|
|
|
|
if (match_count > 0)
|
|
|
|
{
|
|
|
|
ValueObjectList &value_object_list = sb_value_list.ref();
|
|
|
|
for (uint32_t i=0; i<match_count; ++i)
|
|
|
|
{
|
|
|
|
lldb::ValueObjectSP valobj_sp;
|
|
|
|
if (target.IsValid())
|
|
|
|
valobj_sp = ValueObjectVariable::Create (target.get(), variable_list.GetVariableAtIndex(i));
|
|
|
|
else
|
|
|
|
valobj_sp = ValueObjectVariable::Create (NULL, variable_list.GetVariableAtIndex(i));
|
|
|
|
if (valobj_sp)
|
|
|
|
value_object_list.Append(valobj_sp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return sb_value_list;
|
|
|
|
}
|
2011-07-30 03:53:35 +08:00
|
|
|
|
|
|
|
lldb::SBType
|
2011-12-20 04:16:22 +08:00
|
|
|
SBModule::FindFirstType (const char *name_cstr)
|
2011-07-30 03:53:35 +08:00
|
|
|
{
|
2011-08-04 06:57:10 +08:00
|
|
|
SBType sb_type;
|
2011-12-20 04:16:22 +08:00
|
|
|
if (name_cstr && IsValid())
|
2011-07-30 03:53:35 +08:00
|
|
|
{
|
2011-08-04 06:57:10 +08:00
|
|
|
SymbolContext sc;
|
|
|
|
TypeList type_list;
|
|
|
|
uint32_t num_matches = 0;
|
|
|
|
ConstString name(name_cstr);
|
|
|
|
|
|
|
|
num_matches = m_opaque_sp->FindTypes(sc,
|
|
|
|
name,
|
2011-10-12 10:08:07 +08:00
|
|
|
NULL,
|
2011-08-04 06:57:10 +08:00
|
|
|
false,
|
|
|
|
1,
|
|
|
|
type_list);
|
|
|
|
|
|
|
|
if (num_matches)
|
|
|
|
sb_type = lldb::SBType(type_list.GetTypeAtIndex(0));
|
2011-07-30 03:53:35 +08:00
|
|
|
}
|
2011-08-04 06:57:10 +08:00
|
|
|
return sb_type;
|
2011-07-30 03:53:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
lldb::SBTypeList
|
2011-12-20 04:16:22 +08:00
|
|
|
SBModule::FindTypes (const char *type)
|
2011-07-30 03:53:35 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
SBTypeList retval;
|
|
|
|
|
2011-12-20 04:16:22 +08:00
|
|
|
if (type && IsValid())
|
2011-07-30 03:53:35 +08:00
|
|
|
{
|
2011-08-04 06:57:10 +08:00
|
|
|
SymbolContext sc;
|
|
|
|
TypeList type_list;
|
|
|
|
uint32_t num_matches = 0;
|
|
|
|
ConstString name(type);
|
2011-07-30 03:53:35 +08:00
|
|
|
|
2011-08-04 06:57:10 +08:00
|
|
|
num_matches = m_opaque_sp->FindTypes(sc,
|
|
|
|
name,
|
2011-10-12 10:08:07 +08:00
|
|
|
NULL,
|
2011-08-04 06:57:10 +08:00
|
|
|
false,
|
|
|
|
UINT32_MAX,
|
|
|
|
type_list);
|
|
|
|
|
|
|
|
for (size_t idx = 0; idx < num_matches; idx++)
|
|
|
|
{
|
|
|
|
TypeSP type_sp (type_list.GetTypeAtIndex(idx));
|
|
|
|
if (type_sp)
|
|
|
|
retval.Append(SBType(type_sp));
|
|
|
|
}
|
2011-07-30 03:53:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return retval;
|
2011-08-10 10:10:13 +08:00
|
|
|
}
|
2011-09-24 08:52:29 +08:00
|
|
|
|
|
|
|
|
|
|
|
SBSection
|
|
|
|
SBModule::FindSection (const char *sect_name)
|
|
|
|
{
|
|
|
|
SBSection sb_section;
|
|
|
|
|
2011-12-20 04:16:22 +08:00
|
|
|
if (sect_name && IsValid())
|
2011-09-24 08:52:29 +08:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2012-01-29 14:07:39 +08:00
|
|
|
lldb::ByteOrder
|
|
|
|
SBModule::GetByteOrder ()
|
|
|
|
{
|
|
|
|
if (m_opaque_sp)
|
|
|
|
return m_opaque_sp->GetArchitecture().GetByteOrder();
|
|
|
|
return eByteOrderInvalid;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *
|
|
|
|
SBModule::GetTriple ()
|
|
|
|
{
|
|
|
|
if (m_opaque_sp)
|
|
|
|
{
|
|
|
|
std::string triple (m_opaque_sp->GetArchitecture().GetTriple().str());
|
|
|
|
// Unique the string so we don't run into ownership issues since
|
|
|
|
// the const strings put the string into the string pool once and
|
|
|
|
// the strings never comes out
|
|
|
|
ConstString const_triple (triple.c_str());
|
|
|
|
return const_triple.GetCString();
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t
|
|
|
|
SBModule::GetAddressByteSize()
|
|
|
|
{
|
|
|
|
if (m_opaque_sp)
|
|
|
|
return m_opaque_sp->GetArchitecture().GetAddressByteSize();
|
|
|
|
return sizeof(void*);
|
|
|
|
}
|
|
|
|
|