summaryrefslogtreecommitdiff
path: root/source/API/SBBreakpoint.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/API/SBBreakpoint.cpp')
-rw-r--r--source/API/SBBreakpoint.cpp47
1 files changed, 43 insertions, 4 deletions
diff --git a/source/API/SBBreakpoint.cpp b/source/API/SBBreakpoint.cpp
index 6a0ff9536c2c..b6720071e17c 100644
--- a/source/API/SBBreakpoint.cpp
+++ b/source/API/SBBreakpoint.cpp
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "lldb/API/SBBreakpoint.h"
#include "lldb/API/SBBreakpointLocation.h"
#include "lldb/API/SBDebugger.h"
@@ -23,6 +19,8 @@
#include "lldb/Breakpoint/Breakpoint.h"
#include "lldb/Breakpoint/BreakpointIDList.h"
#include "lldb/Breakpoint/BreakpointLocation.h"
+#include "lldb/Breakpoint/BreakpointResolver.h"
+#include "lldb/Breakpoint/BreakpointResolverScripted.h"
#include "lldb/Breakpoint/StoppointCallbackContext.h"
#include "lldb/Core/Address.h"
#include "lldb/Core/Debugger.h"
@@ -487,6 +485,40 @@ bool SBBreakpoint::GetDescription(SBStream &s, bool include_locations) {
return false;
}
+SBError
+SBBreakpoint::AddLocation(SBAddress &address) {
+ BreakpointSP bkpt_sp = GetSP();
+ SBError error;
+
+ if (!address.IsValid()) {
+ error.SetErrorString("Can't add an invalid address.");
+ return error;
+ }
+
+ if (!bkpt_sp) {
+ error.SetErrorString("No breakpoint to add a location to.");
+ return error;
+ }
+
+ if (!llvm::isa<BreakpointResolverScripted>(bkpt_sp->GetResolver().get())) {
+ error.SetErrorString("Only a scripted resolver can add locations.");
+ return error;
+ }
+
+ if (bkpt_sp->GetSearchFilter()->AddressPasses(address.ref()))
+ bkpt_sp->AddLocation(address.ref());
+ else
+ {
+ StreamString s;
+ address.get()->Dump(&s, &bkpt_sp->GetTarget(),
+ Address::DumpStyleModuleWithFileAddress);
+ error.SetErrorStringWithFormat("Address: %s didn't pass the filter.",
+ s.GetData());
+ }
+ return error;
+}
+
+
void SBBreakpoint
::SetCallback(SBBreakpointHitCallback callback,
void *baton) {
@@ -656,6 +688,13 @@ SBBreakpoint::GetNumBreakpointLocationsFromEvent(const lldb::SBEvent &event) {
return num_locations;
}
+bool SBBreakpoint::IsHardware() const {
+ BreakpointSP bkpt_sp = GetSP();
+ if (bkpt_sp)
+ return bkpt_sp->IsHardware();
+ return false;
+}
+
BreakpointSP SBBreakpoint::GetSP() const { return m_opaque_wp.lock(); }
// This is simple collection of breakpoint id's and their target.