2010-06-09 00:52:24 +08:00
|
|
|
//===-- Breakpoint.cpp ------------------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
|
|
|
|
// C Includes
|
|
|
|
// C++ Includes
|
|
|
|
// Other libraries and framework includes
|
|
|
|
// Project includes
|
|
|
|
|
|
|
|
#include "lldb/Core/Address.h"
|
|
|
|
#include "lldb/Breakpoint/Breakpoint.h"
|
|
|
|
#include "lldb/Breakpoint/BreakpointLocation.h"
|
2010-10-29 01:27:46 +08:00
|
|
|
#include "lldb/Breakpoint/BreakpointLocationCollection.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Breakpoint/BreakpointResolver.h"
|
2010-10-29 01:27:46 +08:00
|
|
|
#include "lldb/Breakpoint/BreakpointResolverFileLine.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Core/Log.h"
|
|
|
|
#include "lldb/Core/ModuleList.h"
|
|
|
|
#include "lldb/Core/SearchFilter.h"
|
|
|
|
#include "lldb/Core/Stream.h"
|
|
|
|
#include "lldb/Core/StreamString.h"
|
|
|
|
#include "lldb/Symbol/SymbolContext.h"
|
|
|
|
#include "lldb/Target/Target.h"
|
2010-06-16 10:00:15 +08:00
|
|
|
#include "lldb/Target/ThreadSpec.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/lldb-private-log.h"
|
2010-10-29 01:27:46 +08:00
|
|
|
#include "llvm/Support/Casting.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
2010-10-29 01:27:46 +08:00
|
|
|
using namespace llvm;
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
const ConstString &
|
|
|
|
Breakpoint::GetEventIdentifier ()
|
|
|
|
{
|
|
|
|
static ConstString g_identifier("event-identifier.breakpoint.changed");
|
|
|
|
return g_identifier;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// Breakpoint constructor
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
Breakpoint::Breakpoint(Target &target, SearchFilterSP &filter_sp, BreakpointResolverSP &resolver_sp) :
|
|
|
|
m_target (target),
|
|
|
|
m_filter_sp (filter_sp),
|
|
|
|
m_resolver_sp (resolver_sp),
|
|
|
|
m_options (),
|
|
|
|
m_locations ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// Destructor
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
Breakpoint::~Breakpoint()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
Breakpoint::IsInternal () const
|
|
|
|
{
|
|
|
|
return LLDB_BREAK_ID_IS_INTERNAL(m_bid);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Target&
|
|
|
|
Breakpoint::GetTarget ()
|
|
|
|
{
|
|
|
|
return m_target;
|
|
|
|
}
|
|
|
|
|
|
|
|
const Target&
|
|
|
|
Breakpoint::GetTarget () const
|
|
|
|
{
|
|
|
|
return m_target;
|
|
|
|
}
|
|
|
|
|
|
|
|
BreakpointLocationSP
|
2011-02-05 08:38:04 +08:00
|
|
|
Breakpoint::AddLocation (const Address &addr, bool *new_location)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
|
|
|
if (new_location)
|
2011-02-05 08:38:04 +08:00
|
|
|
*new_location = false;
|
|
|
|
BreakpointLocationSP bp_loc_sp (m_locations.FindByAddress(addr));
|
|
|
|
if (!bp_loc_sp)
|
|
|
|
{
|
|
|
|
bp_loc_sp = m_locations.Create (*this, addr);
|
|
|
|
if (bp_loc_sp)
|
|
|
|
{
|
|
|
|
bp_loc_sp->ResolveBreakpointSite();
|
|
|
|
|
|
|
|
if (new_location)
|
|
|
|
*new_location = true;
|
|
|
|
}
|
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
return bp_loc_sp;
|
|
|
|
}
|
|
|
|
|
|
|
|
BreakpointLocationSP
|
2011-02-05 08:38:04 +08:00
|
|
|
Breakpoint::FindLocationByAddress (const Address &addr)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
|
|
|
return m_locations.FindByAddress(addr);
|
|
|
|
}
|
|
|
|
|
|
|
|
break_id_t
|
2011-02-05 08:38:04 +08:00
|
|
|
Breakpoint::FindLocationIDByAddress (const Address &addr)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
|
|
|
return m_locations.FindIDByAddress(addr);
|
|
|
|
}
|
|
|
|
|
|
|
|
BreakpointLocationSP
|
|
|
|
Breakpoint::FindLocationByID (break_id_t bp_loc_id)
|
|
|
|
{
|
|
|
|
return m_locations.FindByID(bp_loc_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
BreakpointLocationSP
|
|
|
|
Breakpoint::GetLocationAtIndex (uint32_t index)
|
|
|
|
{
|
|
|
|
return m_locations.GetByIndex(index);
|
|
|
|
}
|
|
|
|
|
|
|
|
// For each of the overall options we need to decide how they propagate to
|
|
|
|
// the location options. This will determine the precedence of options on
|
|
|
|
// the breakpoint vrs. its locations.
|
|
|
|
|
|
|
|
// Disable at the breakpoint level should override the location settings.
|
|
|
|
// That way you can conveniently turn off a whole breakpoint without messing
|
|
|
|
// up the individual settings.
|
|
|
|
|
|
|
|
void
|
|
|
|
Breakpoint::SetEnabled (bool enable)
|
|
|
|
{
|
|
|
|
m_options.SetEnabled(enable);
|
|
|
|
if (enable)
|
|
|
|
m_locations.ResolveAllBreakpointSites();
|
|
|
|
else
|
|
|
|
m_locations.ClearAllBreakpointSites();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
Breakpoint::IsEnabled ()
|
|
|
|
{
|
|
|
|
return m_options.IsEnabled();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2010-07-10 04:39:50 +08:00
|
|
|
Breakpoint::SetIgnoreCount (uint32_t n)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
|
|
|
m_options.SetIgnoreCount(n);
|
|
|
|
}
|
|
|
|
|
2010-07-10 04:39:50 +08:00
|
|
|
uint32_t
|
2010-06-09 00:52:24 +08:00
|
|
|
Breakpoint::GetIgnoreCount () const
|
|
|
|
{
|
|
|
|
return m_options.GetIgnoreCount();
|
|
|
|
}
|
|
|
|
|
2010-07-24 07:33:17 +08:00
|
|
|
uint32_t
|
|
|
|
Breakpoint::GetHitCount () const
|
|
|
|
{
|
|
|
|
return m_locations.GetHitCount();
|
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
void
|
|
|
|
Breakpoint::SetThreadID (lldb::tid_t thread_id)
|
|
|
|
{
|
2010-06-16 10:00:15 +08:00
|
|
|
m_options.GetThreadSpec()->SetTID(thread_id);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
lldb::tid_t
|
|
|
|
Breakpoint::GetThreadID ()
|
|
|
|
{
|
2010-06-16 10:00:15 +08:00
|
|
|
if (m_options.GetThreadSpec() == NULL)
|
|
|
|
return LLDB_INVALID_THREAD_ID;
|
|
|
|
else
|
|
|
|
return m_options.GetThreadSpec()->GetTID();
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2010-10-15 07:45:03 +08:00
|
|
|
void
|
|
|
|
Breakpoint::SetCondition (const char *condition)
|
|
|
|
{
|
|
|
|
m_options.SetCondition (condition);
|
|
|
|
}
|
|
|
|
|
|
|
|
ThreadPlan *
|
|
|
|
Breakpoint::GetThreadPlanToTestCondition (ExecutionContext &exe_ctx, lldb::BreakpointLocationSP loc_sp, Stream &error)
|
|
|
|
{
|
|
|
|
return m_options.GetThreadPlanToTestCondition (exe_ctx, loc_sp, error);
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *
|
2011-06-16 05:16:00 +08:00
|
|
|
Breakpoint::GetConditionText () const
|
2010-10-15 07:45:03 +08:00
|
|
|
{
|
|
|
|
return m_options.GetConditionText();
|
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
// This function is used when "baton" doesn't need to be freed
|
|
|
|
void
|
|
|
|
Breakpoint::SetCallback (BreakpointHitCallback callback, void *baton, bool is_synchronous)
|
|
|
|
{
|
|
|
|
// The default "Baton" class will keep a copy of "baton" and won't free
|
|
|
|
// or delete it when it goes goes out of scope.
|
|
|
|
m_options.SetCallback(callback, BatonSP (new Baton(baton)), is_synchronous);
|
|
|
|
}
|
|
|
|
|
|
|
|
// This function is used when a baton needs to be freed and therefore is
|
|
|
|
// contained in a "Baton" subclass.
|
|
|
|
void
|
|
|
|
Breakpoint::SetCallback (BreakpointHitCallback callback, const BatonSP &callback_baton_sp, bool is_synchronous)
|
|
|
|
{
|
|
|
|
m_options.SetCallback(callback, callback_baton_sp, is_synchronous);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Breakpoint::ClearCallback ()
|
|
|
|
{
|
|
|
|
m_options.ClearCallback ();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
Breakpoint::InvokeCallback (StoppointCallbackContext *context, break_id_t bp_loc_id)
|
|
|
|
{
|
|
|
|
return m_options.InvokeCallback (context, GetID(), bp_loc_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
BreakpointOptions *
|
|
|
|
Breakpoint::GetOptions ()
|
|
|
|
{
|
|
|
|
return &m_options;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Breakpoint::ResolveBreakpoint ()
|
|
|
|
{
|
|
|
|
if (m_resolver_sp)
|
|
|
|
m_resolver_sp->ResolveBreakpoint(*m_filter_sp);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Breakpoint::ResolveBreakpointInModules (ModuleList &module_list)
|
|
|
|
{
|
|
|
|
if (m_resolver_sp)
|
|
|
|
m_resolver_sp->ResolveBreakpointInModules(*m_filter_sp, module_list);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Breakpoint::ClearAllBreakpointSites ()
|
|
|
|
{
|
|
|
|
m_locations.ClearAllBreakpointSites();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// ModulesChanged: Pass in a list of new modules, and
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void
|
|
|
|
Breakpoint::ModulesChanged (ModuleList &module_list, bool load)
|
|
|
|
{
|
|
|
|
if (load)
|
|
|
|
{
|
|
|
|
// The logic for handling new modules is:
|
|
|
|
// 1) If the filter rejects this module, then skip it.
|
|
|
|
// 2) Run through the current location list and if there are any locations
|
|
|
|
// for that module, we mark the module as "seen" and we don't try to re-resolve
|
|
|
|
// breakpoint locations for that module.
|
|
|
|
// However, we do add breakpoint sites to these locations if needed.
|
|
|
|
// 3) If we don't see this module in our breakpoint location list, call ResolveInModules.
|
|
|
|
|
|
|
|
ModuleList new_modules; // We'll stuff the "unseen" modules in this list, and then resolve
|
2011-02-05 08:38:04 +08:00
|
|
|
// them after the locations pass. Have to do it this way because
|
|
|
|
// resolving breakpoints will add new locations potentially.
|
|
|
|
|
|
|
|
const size_t num_locs = m_locations.GetSize();
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2010-07-10 04:39:50 +08:00
|
|
|
for (size_t i = 0; i < module_list.GetSize(); i++)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
|
|
|
bool seen = false;
|
|
|
|
ModuleSP module_sp (module_list.GetModuleAtIndex (i));
|
|
|
|
if (!m_filter_sp->ModulePasses (module_sp))
|
|
|
|
continue;
|
|
|
|
|
2011-02-05 08:38:04 +08:00
|
|
|
for (size_t loc_idx = 0; loc_idx < num_locs; loc_idx++)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
2010-12-07 07:51:26 +08:00
|
|
|
BreakpointLocationSP break_loc = m_locations.GetByIndex(loc_idx);
|
2010-10-20 11:36:33 +08:00
|
|
|
if (!break_loc->IsEnabled())
|
|
|
|
continue;
|
2010-06-09 00:52:24 +08:00
|
|
|
const Section *section = break_loc->GetAddress().GetSection();
|
2011-02-05 08:38:04 +08:00
|
|
|
if (section == NULL || section->GetModule() == module_sp.get())
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
|
|
|
if (!seen)
|
|
|
|
seen = true;
|
|
|
|
|
|
|
|
if (!break_loc->ResolveBreakpointSite())
|
|
|
|
{
|
2010-11-06 09:53:30 +08:00
|
|
|
LogSP log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
|
2010-06-09 00:52:24 +08:00
|
|
|
if (log)
|
|
|
|
log->Printf ("Warning: could not set breakpoint site for breakpoint location %d of breakpoint %d.\n",
|
|
|
|
break_loc->GetID(), GetID());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!seen)
|
2010-12-13 05:03:32 +08:00
|
|
|
new_modules.AppendIfNeeded (module_sp);
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
if (new_modules.GetSize() > 0)
|
|
|
|
{
|
|
|
|
ResolveBreakpointInModules(new_modules);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Go through the currently set locations and if any have breakpoints in
|
|
|
|
// the module list, then remove their breakpoint sites.
|
|
|
|
// FIXME: Think about this... Maybe it's better to delete the locations?
|
|
|
|
// Are we sure that on load-unload-reload the module pointer will remain
|
|
|
|
// the same? Or do we need to do an equality on modules that is an
|
|
|
|
// "equivalence"???
|
|
|
|
|
2010-07-10 04:39:50 +08:00
|
|
|
for (size_t i = 0; i < module_list.GetSize(); i++)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
|
|
|
ModuleSP module_sp (module_list.GetModuleAtIndex (i));
|
2010-12-07 07:51:26 +08:00
|
|
|
if (m_filter_sp->ModulePasses (module_sp))
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
2010-12-07 07:51:26 +08:00
|
|
|
const size_t num_locs = m_locations.GetSize();
|
|
|
|
for (size_t loc_idx = 0; loc_idx < num_locs; ++loc_idx)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
2010-12-07 07:51:26 +08:00
|
|
|
BreakpointLocationSP break_loc = m_locations.GetByIndex(loc_idx);
|
|
|
|
const Section *section = break_loc->GetAddress().GetSection();
|
|
|
|
if (section && section->GetModule() == module_sp.get())
|
|
|
|
{
|
|
|
|
// Remove this breakpoint since the shared library is
|
|
|
|
// unloaded, but keep the breakpoint location around
|
|
|
|
// so we always get complete hit count and breakpoint
|
|
|
|
// lifetime info
|
2010-06-09 00:52:24 +08:00
|
|
|
break_loc->ClearBreakpointSite();
|
2010-12-07 07:51:26 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Breakpoint::Dump (Stream *)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t
|
|
|
|
Breakpoint::GetNumResolvedLocations() const
|
|
|
|
{
|
|
|
|
// Return the number of breakpoints that are actually resolved and set
|
|
|
|
// down in the inferior process.
|
|
|
|
return m_locations.GetNumResolvedLocations();
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t
|
|
|
|
Breakpoint::GetNumLocations() const
|
|
|
|
{
|
|
|
|
return m_locations.GetSize();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Breakpoint::GetDescription (Stream *s, lldb::DescriptionLevel level, bool show_locations)
|
|
|
|
{
|
|
|
|
assert (s != NULL);
|
2010-06-29 05:30:43 +08:00
|
|
|
s->Printf("%i: ", GetID());
|
2010-06-09 00:52:24 +08:00
|
|
|
GetResolverDescription (s);
|
2010-06-29 05:30:43 +08:00
|
|
|
GetFilterDescription (s);
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2010-07-10 04:39:50 +08:00
|
|
|
const size_t num_locations = GetNumLocations ();
|
|
|
|
const size_t num_resolved_locations = GetNumResolvedLocations ();
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
switch (level)
|
|
|
|
{
|
|
|
|
case lldb::eDescriptionLevelBrief:
|
|
|
|
case lldb::eDescriptionLevelFull:
|
|
|
|
if (num_locations > 0)
|
|
|
|
{
|
2010-07-10 04:39:50 +08:00
|
|
|
s->Printf(", locations = %zu", num_locations);
|
2010-06-09 00:52:24 +08:00
|
|
|
if (num_resolved_locations > 0)
|
2010-07-10 04:39:50 +08:00
|
|
|
s->Printf(", resolved = %zu", num_resolved_locations);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-06-29 05:30:43 +08:00
|
|
|
s->Printf(", locations = 0 (pending)");
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2010-06-18 09:00:58 +08:00
|
|
|
GetOptions()->GetDescription(s, level);
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
if (level == lldb::eDescriptionLevelFull)
|
|
|
|
{
|
2010-06-18 09:00:58 +08:00
|
|
|
s->IndentLess();
|
|
|
|
s->EOL();
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case lldb::eDescriptionLevelVerbose:
|
|
|
|
// Verbose mode does a debug dump of the breakpoint
|
|
|
|
Dump (s);
|
2010-06-18 09:00:58 +08:00
|
|
|
s->EOL ();
|
2011-03-19 09:12:21 +08:00
|
|
|
//s->Indent();
|
2010-06-18 09:00:58 +08:00
|
|
|
GetOptions()->GetDescription(s, level);
|
2010-06-09 00:52:24 +08:00
|
|
|
break;
|
2010-07-10 04:39:50 +08:00
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2011-05-14 09:11:02 +08:00
|
|
|
// The brief description is just the location name (1.2 or whatever). That's pointless to
|
|
|
|
// show in the breakpoint's description, so suppress it.
|
|
|
|
if (show_locations && level != lldb::eDescriptionLevelBrief)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
|
|
|
s->IndentMore();
|
2010-07-10 04:39:50 +08:00
|
|
|
for (size_t i = 0; i < num_locations; ++i)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
|
|
|
BreakpointLocation *loc = GetLocationAtIndex(i).get();
|
|
|
|
loc->GetDescription(s, level);
|
|
|
|
s->EOL();
|
|
|
|
}
|
|
|
|
s->IndentLess();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-07-24 07:33:17 +08:00
|
|
|
Breakpoint::BreakpointEventData::BreakpointEventData (BreakpointEventType sub_type,
|
2010-06-18 09:00:58 +08:00
|
|
|
BreakpointSP &new_breakpoint_sp) :
|
2010-06-09 00:52:24 +08:00
|
|
|
EventData (),
|
2010-07-24 07:33:17 +08:00
|
|
|
m_breakpoint_event (sub_type),
|
2010-06-09 00:52:24 +08:00
|
|
|
m_new_breakpoint_sp (new_breakpoint_sp)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
Breakpoint::BreakpointEventData::~BreakpointEventData ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
const ConstString &
|
|
|
|
Breakpoint::BreakpointEventData::GetFlavorString ()
|
|
|
|
{
|
|
|
|
static ConstString g_flavor ("Breakpoint::BreakpointEventData");
|
|
|
|
return g_flavor;
|
|
|
|
}
|
|
|
|
|
|
|
|
const ConstString &
|
|
|
|
Breakpoint::BreakpointEventData::GetFlavor () const
|
|
|
|
{
|
|
|
|
return BreakpointEventData::GetFlavorString ();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BreakpointSP &
|
|
|
|
Breakpoint::BreakpointEventData::GetBreakpoint ()
|
|
|
|
{
|
|
|
|
return m_new_breakpoint_sp;
|
|
|
|
}
|
|
|
|
|
2010-07-24 07:33:17 +08:00
|
|
|
BreakpointEventType
|
|
|
|
Breakpoint::BreakpointEventData::GetBreakpointEventType () const
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
2010-07-24 07:33:17 +08:00
|
|
|
return m_breakpoint_event;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Breakpoint::BreakpointEventData::Dump (Stream *s) const
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
Breakpoint::BreakpointEventData *
|
|
|
|
Breakpoint::BreakpointEventData::GetEventDataFromEvent (const EventSP &event_sp)
|
|
|
|
{
|
|
|
|
if (event_sp)
|
|
|
|
{
|
|
|
|
EventData *event_data = event_sp->GetData();
|
|
|
|
if (event_data && event_data->GetFlavor() == BreakpointEventData::GetFlavorString())
|
|
|
|
return static_cast <BreakpointEventData *> (event_sp->GetData());
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2010-07-24 07:33:17 +08:00
|
|
|
BreakpointEventType
|
|
|
|
Breakpoint::BreakpointEventData::GetBreakpointEventTypeFromEvent (const EventSP &event_sp)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
|
|
|
BreakpointEventData *data = GetEventDataFromEvent (event_sp);
|
|
|
|
|
|
|
|
if (data == NULL)
|
2010-07-24 07:33:17 +08:00
|
|
|
return eBreakpointEventTypeInvalidType;
|
2010-06-09 00:52:24 +08:00
|
|
|
else
|
2010-07-24 07:33:17 +08:00
|
|
|
return data->GetBreakpointEventType();
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
BreakpointSP
|
|
|
|
Breakpoint::BreakpointEventData::GetBreakpointFromEvent (const EventSP &event_sp)
|
|
|
|
{
|
2010-07-24 07:33:17 +08:00
|
|
|
BreakpointSP bp_sp;
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
BreakpointEventData *data = GetEventDataFromEvent (event_sp);
|
2010-07-24 07:33:17 +08:00
|
|
|
if (data)
|
|
|
|
bp_sp = data->GetBreakpoint();
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2010-07-24 07:33:17 +08:00
|
|
|
return bp_sp;
|
|
|
|
}
|
|
|
|
|
|
|
|
lldb::BreakpointLocationSP
|
|
|
|
Breakpoint::BreakpointEventData::GetBreakpointLocationAtIndexFromEvent (const lldb::EventSP &event_sp, uint32_t bp_loc_idx)
|
|
|
|
{
|
|
|
|
lldb::BreakpointLocationSP bp_loc_sp;
|
|
|
|
|
|
|
|
BreakpointEventData *data = GetEventDataFromEvent (event_sp);
|
|
|
|
if (data)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
2010-07-24 07:33:17 +08:00
|
|
|
Breakpoint *bp = data->GetBreakpoint().get();
|
|
|
|
if (bp)
|
|
|
|
bp_loc_sp = bp->GetLocationAtIndex(bp_loc_idx);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
2010-07-24 07:33:17 +08:00
|
|
|
|
|
|
|
return bp_loc_sp;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
Breakpoint::GetResolverDescription (Stream *s)
|
|
|
|
{
|
|
|
|
if (m_resolver_sp)
|
|
|
|
m_resolver_sp->GetDescription (s);
|
|
|
|
}
|
|
|
|
|
2010-10-29 01:27:46 +08:00
|
|
|
|
|
|
|
bool
|
|
|
|
Breakpoint::GetMatchingFileLine (const ConstString &filename, uint32_t line_number, BreakpointLocationCollection &loc_coll)
|
|
|
|
{
|
|
|
|
// TODO: To be correct, this method needs to fill the breakpoint location collection
|
|
|
|
// with the location IDs which match the filename and line_number.
|
|
|
|
//
|
|
|
|
|
|
|
|
if (m_resolver_sp)
|
|
|
|
{
|
|
|
|
BreakpointResolverFileLine *resolverFileLine = dyn_cast<BreakpointResolverFileLine>(m_resolver_sp.get());
|
|
|
|
if (resolverFileLine &&
|
|
|
|
resolverFileLine->m_file_spec.GetFilename() == filename &&
|
|
|
|
resolverFileLine->m_line_number == line_number)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
void
|
|
|
|
Breakpoint::GetFilterDescription (Stream *s)
|
|
|
|
{
|
|
|
|
m_filter_sp->GetDescription (s);
|
|
|
|
}
|
|
|
|
|
|
|
|
const BreakpointSP
|
|
|
|
Breakpoint::GetSP ()
|
|
|
|
{
|
2011-09-17 16:33:22 +08:00
|
|
|
// This object contains an instrusive ref count base class so we can
|
|
|
|
// easily make a shared pointer to this object
|
|
|
|
return BreakpointSP (this);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|