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-06-09 00:52:24 +08:00
|
|
|
#include "lldb/API/SBFileSpec.h"
|
2010-09-20 13:20:02 +08:00
|
|
|
#include "lldb/API/SBStream.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Core/Module.h"
|
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
SBFileSpec
|
|
|
|
SBModule::GetFileSpec () const
|
|
|
|
{
|
|
|
|
SBFileSpec file_spec;
|
2010-06-23 09:19:29 +08:00
|
|
|
if (m_opaque_sp)
|
|
|
|
file_spec.SetFileSpec(m_opaque_sp->GetFileSpec());
|
2010-06-09 00:52:24 +08:00
|
|
|
return file_spec;
|
|
|
|
}
|
|
|
|
|
|
|
|
const uint8_t *
|
|
|
|
SBModule::GetUUIDBytes () const
|
|
|
|
{
|
2010-06-23 09:19:29 +08:00
|
|
|
if (m_opaque_sp)
|
|
|
|
return (const uint8_t *)m_opaque_sp->GetUUID().GetBytes();
|
2010-06-09 00:52:24 +08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
bool
|
|
|
|
SBModule::ResolveFileAddress (lldb::addr_t vm_addr, SBAddress& addr)
|
|
|
|
{
|
|
|
|
if (m_opaque_sp)
|
|
|
|
return m_opaque_sp->ResolveFileAddress (vm_addr, *addr);
|
|
|
|
|
|
|
|
addr->Clear();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
SBSymbolContext
|
|
|
|
SBModule::ResolveSymbolContextForAddress (const SBAddress& addr, uint32_t resolve_scope)
|
|
|
|
{
|
|
|
|
SBSymbolContext sb_sc;
|
|
|
|
if (m_opaque_sp && addr.IsValid())
|
|
|
|
m_opaque_sp->ResolveSymbolContextForAddress (*addr, resolve_scope, *sb_sc);
|
|
|
|
return sb_sc;
|
|
|
|
}
|
|
|
|
|
2010-09-20 13:20:02 +08:00
|
|
|
bool
|
|
|
|
SBModule::GetDescription (SBStream &description)
|
|
|
|
{
|
|
|
|
if (m_opaque_sp)
|
|
|
|
{
|
2010-09-23 07:01:29 +08:00
|
|
|
description.ref();
|
2010-09-20 13:20:02 +08:00
|
|
|
m_opaque_sp->Dump (description.get());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
description.Printf ("No value");
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|