2010-06-09 00:52:24 +08:00
|
|
|
//===-- SBBreakpointLocation.cpp --------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2010-09-20 13:20:02 +08:00
|
|
|
// In order to guarantee correct working with Python, Python.h *MUST* be
|
|
|
|
// the *FIRST* header file included:
|
|
|
|
|
|
|
|
#include <Python.h>
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/API/SBBreakpointLocation.h"
|
|
|
|
#include "lldb/API/SBDefines.h"
|
|
|
|
#include "lldb/API/SBDebugger.h"
|
2010-09-20 13:20:02 +08:00
|
|
|
#include "lldb/API/SBStream.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
#include "lldb/lldb-types.h"
|
|
|
|
#include "lldb/lldb-defines.h"
|
|
|
|
#include "lldb/Breakpoint/BreakpointLocation.h"
|
2010-06-16 10:00:15 +08:00
|
|
|
#include "lldb/Target/ThreadSpec.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Core/Stream.h"
|
|
|
|
#include "lldb/Core/StreamFile.h"
|
2010-06-18 09:47:08 +08:00
|
|
|
#include "lldb/Target/ThreadSpec.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//class SBBreakpointLocation
|
|
|
|
|
|
|
|
SBBreakpointLocation::SBBreakpointLocation ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SBBreakpointLocation::SBBreakpointLocation (const lldb::BreakpointLocationSP &break_loc_sp) :
|
2010-06-23 09:19:29 +08:00
|
|
|
m_opaque_sp (break_loc_sp)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SBBreakpointLocation::~SBBreakpointLocation ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
SBBreakpointLocation::IsValid() const
|
|
|
|
{
|
2010-06-23 09:19:29 +08:00
|
|
|
return m_opaque_sp.get() != NULL;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
addr_t
|
|
|
|
SBBreakpointLocation::GetLoadAddress ()
|
|
|
|
{
|
|
|
|
addr_t ret_addr = LLDB_INVALID_ADDRESS;
|
|
|
|
|
2010-06-23 09:19:29 +08:00
|
|
|
if (m_opaque_sp)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
2010-06-23 09:19:29 +08:00
|
|
|
ret_addr = m_opaque_sp->GetLoadAddress();
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return ret_addr;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SBBreakpointLocation::SetEnabled (bool enabled)
|
|
|
|
{
|
2010-06-23 09:19:29 +08:00
|
|
|
if (m_opaque_sp)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
2010-06-23 09:19:29 +08:00
|
|
|
m_opaque_sp->SetEnabled (enabled);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
SBBreakpointLocation::IsEnabled ()
|
|
|
|
{
|
2010-06-23 09:19:29 +08:00
|
|
|
if (m_opaque_sp)
|
|
|
|
return m_opaque_sp->IsEnabled();
|
2010-06-09 00:52:24 +08:00
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2010-07-10 04:39:50 +08:00
|
|
|
uint32_t
|
2010-06-09 00:52:24 +08:00
|
|
|
SBBreakpointLocation::GetIgnoreCount ()
|
|
|
|
{
|
2010-06-23 09:19:29 +08:00
|
|
|
if (m_opaque_sp)
|
|
|
|
return m_opaque_sp->GetIgnoreCount();
|
2010-06-09 00:52:24 +08:00
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2010-07-10 04:39:50 +08:00
|
|
|
SBBreakpointLocation::SetIgnoreCount (uint32_t n)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
2010-06-23 09:19:29 +08:00
|
|
|
if (m_opaque_sp)
|
|
|
|
m_opaque_sp->SetIgnoreCount (n);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2010-10-22 09:15:49 +08:00
|
|
|
void
|
|
|
|
SBBreakpointLocation::SetCondition (const char *condition)
|
|
|
|
{
|
|
|
|
m_opaque_sp->SetCondition (condition);
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *
|
|
|
|
SBBreakpointLocation::GetCondition ()
|
|
|
|
{
|
|
|
|
return m_opaque_sp->GetConditionText ();
|
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
void
|
|
|
|
SBBreakpointLocation::SetThreadID (tid_t thread_id)
|
|
|
|
{
|
2010-06-23 09:19:29 +08:00
|
|
|
if (m_opaque_sp)
|
|
|
|
m_opaque_sp->SetThreadID (thread_id);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
tid_t
|
|
|
|
SBBreakpointLocation::GetThreadID ()
|
|
|
|
{
|
|
|
|
tid_t sb_thread_id = (lldb::tid_t) LLDB_INVALID_THREAD_ID;
|
2010-06-23 09:19:29 +08:00
|
|
|
if (m_opaque_sp)
|
|
|
|
sb_thread_id = m_opaque_sp->GetLocationOptions()->GetThreadSpecNoCreate()->GetTID();
|
2010-06-09 00:52:24 +08:00
|
|
|
return sb_thread_id;
|
|
|
|
}
|
|
|
|
|
2010-06-18 09:47:08 +08:00
|
|
|
void
|
|
|
|
SBBreakpointLocation::SetThreadIndex (uint32_t index)
|
|
|
|
{
|
2010-06-23 09:19:29 +08:00
|
|
|
if (m_opaque_sp)
|
|
|
|
m_opaque_sp->GetLocationOptions()->GetThreadSpec()->SetIndex (index);
|
2010-06-18 09:47:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t
|
|
|
|
SBBreakpointLocation::GetThreadIndex() const
|
|
|
|
{
|
2010-06-23 09:19:29 +08:00
|
|
|
if (m_opaque_sp)
|
2010-06-18 09:47:08 +08:00
|
|
|
{
|
2010-06-23 09:19:29 +08:00
|
|
|
const ThreadSpec *thread_spec = m_opaque_sp->GetOptionsNoCreate()->GetThreadSpecNoCreate();
|
2010-06-18 09:47:08 +08:00
|
|
|
if (thread_spec == NULL)
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
return thread_spec->GetIndex();
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
SBBreakpointLocation::SetThreadName (const char *thread_name)
|
|
|
|
{
|
2010-06-23 09:19:29 +08:00
|
|
|
if (m_opaque_sp)
|
|
|
|
m_opaque_sp->GetLocationOptions()->GetThreadSpec()->SetName (thread_name);
|
2010-06-18 09:47:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const char *
|
|
|
|
SBBreakpointLocation::GetThreadName () const
|
|
|
|
{
|
2010-06-23 09:19:29 +08:00
|
|
|
if (m_opaque_sp)
|
2010-06-18 09:47:08 +08:00
|
|
|
{
|
2010-06-23 09:19:29 +08:00
|
|
|
const ThreadSpec *thread_spec = m_opaque_sp->GetOptionsNoCreate()->GetThreadSpecNoCreate();
|
2010-06-18 09:47:08 +08:00
|
|
|
if (thread_spec == NULL)
|
|
|
|
return NULL;
|
|
|
|
else
|
|
|
|
return thread_spec->GetName();
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SBBreakpointLocation::SetQueueName (const char *queue_name)
|
|
|
|
{
|
2010-06-23 09:19:29 +08:00
|
|
|
if (m_opaque_sp)
|
|
|
|
m_opaque_sp->GetLocationOptions()->GetThreadSpec()->SetQueueName (queue_name);
|
2010-06-18 09:47:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const char *
|
|
|
|
SBBreakpointLocation::GetQueueName () const
|
|
|
|
{
|
2010-06-23 09:19:29 +08:00
|
|
|
if (m_opaque_sp)
|
2010-06-18 09:47:08 +08:00
|
|
|
{
|
2010-06-23 09:19:29 +08:00
|
|
|
const ThreadSpec *thread_spec = m_opaque_sp->GetOptionsNoCreate()->GetThreadSpecNoCreate();
|
2010-06-18 09:47:08 +08:00
|
|
|
if (thread_spec == NULL)
|
|
|
|
return NULL;
|
|
|
|
else
|
|
|
|
return thread_spec->GetQueueName();
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
bool
|
|
|
|
SBBreakpointLocation::IsResolved ()
|
|
|
|
{
|
2010-06-23 09:19:29 +08:00
|
|
|
if (m_opaque_sp)
|
|
|
|
return m_opaque_sp->IsResolved();
|
2010-06-09 00:52:24 +08:00
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SBBreakpointLocation::SetLocation (const lldb::BreakpointLocationSP &break_loc_sp)
|
|
|
|
{
|
2010-06-23 09:19:29 +08:00
|
|
|
if (m_opaque_sp)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
|
|
|
// Uninstall the callbacks?
|
|
|
|
}
|
2010-06-23 09:19:29 +08:00
|
|
|
m_opaque_sp = break_loc_sp;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2010-09-20 13:20:02 +08:00
|
|
|
bool
|
|
|
|
SBBreakpointLocation::GetDescription (const char *description_level, SBStream &description)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
2010-06-23 09:19:29 +08:00
|
|
|
if (m_opaque_sp)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
|
|
|
DescriptionLevel level;
|
|
|
|
if (strcmp (description_level, "brief") == 0)
|
|
|
|
level = eDescriptionLevelBrief;
|
|
|
|
else if (strcmp (description_level, "full") == 0)
|
|
|
|
level = eDescriptionLevelFull;
|
|
|
|
else if (strcmp (description_level, "verbose") == 0)
|
|
|
|
level = eDescriptionLevelVerbose;
|
|
|
|
else
|
|
|
|
level = eDescriptionLevelBrief;
|
|
|
|
|
2010-09-23 07:01:29 +08:00
|
|
|
description.ref();
|
2010-09-20 13:20:02 +08:00
|
|
|
m_opaque_sp->GetDescription (description.get(), level);
|
|
|
|
description.get()->EOL();
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
2010-09-20 13:20:02 +08:00
|
|
|
else
|
|
|
|
description.Printf ("No value");
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
SBBreakpoint
|
|
|
|
SBBreakpointLocation::GetBreakpoint ()
|
|
|
|
{
|
|
|
|
SBBreakpoint sb_bp;
|
2010-06-23 09:19:29 +08:00
|
|
|
if (m_opaque_sp)
|
|
|
|
*sb_bp = m_opaque_sp->GetBreakpoint ().GetSP();
|
2010-06-09 00:52:24 +08:00
|
|
|
return sb_bp;
|
|
|
|
}
|
|
|
|
|