2010-06-08 16:52:24 +00:00
|
|
|
//===-- SBLineEntry.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/SBLineEntry.h"
|
|
|
|
#include "lldb/Symbol/LineEntry.h"
|
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
|
|
|
|
|
|
|
|
SBLineEntry::SBLineEntry () :
|
2010-06-23 01:19:29 +00:00
|
|
|
m_opaque_ap ()
|
2010-06-08 16:52:24 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SBLineEntry::SBLineEntry (const SBLineEntry &rhs) :
|
2010-06-23 01:19:29 +00:00
|
|
|
m_opaque_ap ()
|
2010-06-08 16:52:24 +00:00
|
|
|
{
|
|
|
|
if (rhs.IsValid())
|
|
|
|
{
|
2010-06-23 01:19:29 +00:00
|
|
|
m_opaque_ap.reset (new lldb_private::LineEntry (*rhs));
|
2010-06-08 16:52:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SBLineEntry::SBLineEntry (const lldb_private::LineEntry *lldb_object_ptr) :
|
2010-06-23 01:19:29 +00:00
|
|
|
m_opaque_ap ()
|
2010-06-08 16:52:24 +00:00
|
|
|
{
|
|
|
|
if (lldb_object_ptr)
|
2010-06-23 01:19:29 +00:00
|
|
|
m_opaque_ap.reset (new lldb_private::LineEntry(*lldb_object_ptr));
|
2010-06-08 16:52:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const SBLineEntry &
|
|
|
|
SBLineEntry::operator = (const SBLineEntry &rhs)
|
|
|
|
{
|
|
|
|
if (this != &rhs)
|
|
|
|
{
|
|
|
|
if (rhs.IsValid())
|
2010-06-23 01:19:29 +00:00
|
|
|
m_opaque_ap.reset (new lldb_private::LineEntry(*rhs));
|
2010-06-08 16:52:24 +00:00
|
|
|
}
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SBLineEntry::SetLineEntry (const lldb_private::LineEntry &lldb_object_ref)
|
|
|
|
{
|
2010-06-23 01:19:29 +00:00
|
|
|
if (m_opaque_ap.get())
|
|
|
|
(*m_opaque_ap.get()) = lldb_object_ref;
|
2010-06-08 16:52:24 +00:00
|
|
|
else
|
2010-06-23 01:19:29 +00:00
|
|
|
m_opaque_ap.reset (new lldb_private::LineEntry (lldb_object_ref));
|
2010-06-08 16:52:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SBLineEntry::~SBLineEntry ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SBAddress
|
|
|
|
SBLineEntry::GetStartAddress () const
|
|
|
|
{
|
|
|
|
SBAddress sb_address;
|
2010-06-23 01:19:29 +00:00
|
|
|
if (m_opaque_ap.get())
|
|
|
|
sb_address.SetAddress(&m_opaque_ap->range.GetBaseAddress());
|
2010-06-08 16:52:24 +00:00
|
|
|
return sb_address;
|
|
|
|
}
|
|
|
|
|
|
|
|
SBAddress
|
|
|
|
SBLineEntry::GetEndAddress () const
|
|
|
|
{
|
|
|
|
SBAddress sb_address;
|
2010-06-23 01:19:29 +00:00
|
|
|
if (m_opaque_ap.get())
|
2010-06-08 16:52:24 +00:00
|
|
|
{
|
2010-06-23 01:19:29 +00:00
|
|
|
sb_address.SetAddress(&m_opaque_ap->range.GetBaseAddress());
|
|
|
|
sb_address.OffsetAddress(m_opaque_ap->range.GetByteSize());
|
2010-06-08 16:52:24 +00:00
|
|
|
}
|
|
|
|
return sb_address;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
SBLineEntry::IsValid () const
|
|
|
|
{
|
2010-06-23 01:19:29 +00:00
|
|
|
return m_opaque_ap.get() != NULL;
|
2010-06-08 16:52:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SBFileSpec
|
|
|
|
SBLineEntry::GetFileSpec () const
|
|
|
|
{
|
|
|
|
SBFileSpec sb_file_spec;
|
2010-06-23 01:19:29 +00:00
|
|
|
if (m_opaque_ap.get() && m_opaque_ap->file)
|
|
|
|
sb_file_spec.SetFileSpec(m_opaque_ap->file);
|
2010-06-08 16:52:24 +00:00
|
|
|
return sb_file_spec;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t
|
|
|
|
SBLineEntry::GetLine () const
|
|
|
|
{
|
2010-06-23 01:19:29 +00:00
|
|
|
if (m_opaque_ap.get())
|
|
|
|
return m_opaque_ap->line;
|
2010-06-08 16:52:24 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t
|
|
|
|
SBLineEntry::GetColumn () const
|
|
|
|
{
|
2010-06-23 01:19:29 +00:00
|
|
|
if (m_opaque_ap.get())
|
|
|
|
return m_opaque_ap->column;
|
2010-06-08 16:52:24 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
SBLineEntry::operator == (const SBLineEntry &rhs) const
|
|
|
|
{
|
2010-06-23 01:19:29 +00:00
|
|
|
lldb_private::LineEntry *lhs_ptr = m_opaque_ap.get();
|
|
|
|
lldb_private::LineEntry *rhs_ptr = rhs.m_opaque_ap.get();
|
2010-06-08 16:52:24 +00:00
|
|
|
|
|
|
|
if (lhs_ptr && rhs_ptr)
|
|
|
|
return lldb_private::LineEntry::Compare (*lhs_ptr, *rhs_ptr) == 0;
|
|
|
|
|
|
|
|
return lhs_ptr == rhs_ptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
SBLineEntry::operator != (const SBLineEntry &rhs) const
|
|
|
|
{
|
2010-06-23 01:19:29 +00:00
|
|
|
lldb_private::LineEntry *lhs_ptr = m_opaque_ap.get();
|
|
|
|
lldb_private::LineEntry *rhs_ptr = rhs.m_opaque_ap.get();
|
2010-06-08 16:52:24 +00:00
|
|
|
|
|
|
|
if (lhs_ptr && rhs_ptr)
|
|
|
|
return lldb_private::LineEntry::Compare (*lhs_ptr, *rhs_ptr) != 0;
|
|
|
|
|
|
|
|
return lhs_ptr != rhs_ptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
const lldb_private::LineEntry *
|
|
|
|
SBLineEntry::operator->() const
|
|
|
|
{
|
2010-06-23 01:19:29 +00:00
|
|
|
return m_opaque_ap.get();
|
2010-06-08 16:52:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const lldb_private::LineEntry &
|
|
|
|
SBLineEntry::operator*() const
|
|
|
|
{
|
2010-06-23 01:19:29 +00:00
|
|
|
return *m_opaque_ap;
|
2010-06-08 16:52:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|