summaryrefslogtreecommitdiffstats
path: root/lldb/source/API/SBBreakpointLocation.cpp
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2014-04-02 01:04:55 +0000
committerJim Ingham <jingham@apple.com>2014-04-02 01:04:55 +0000
commitd80102e4203691c31314fb3f65c5f91d86dbf06e (patch)
tree47bf527eebc2300e2d86f96c3c85a1a021f3eac9 /lldb/source/API/SBBreakpointLocation.cpp
parent3c2b13b25825d0e8cd798e2e1e78b31f2f516d32 (diff)
downloadbcm5719-llvm-d80102e4203691c31314fb3f65c5f91d86dbf06e.tar.gz
bcm5719-llvm-d80102e4203691c31314fb3f65c5f91d86dbf06e.zip
Add the ability to set python breakpoint commands from the SBBreakpoint & SBBreakpointLocation API's.
You can either provide the function name, or function body text. Also propagate the compilation error up from where it is checked so we can report compilation errors. <rdar://problem/9898371> llvm-svn: 205380
Diffstat (limited to 'lldb/source/API/SBBreakpointLocation.cpp')
-rw-r--r--lldb/source/API/SBBreakpointLocation.cpp46
1 files changed, 45 insertions, 1 deletions
diff --git a/lldb/source/API/SBBreakpointLocation.cpp b/lldb/source/API/SBBreakpointLocation.cpp
index 6fdf59f38b4..b2b94484f9c 100644
--- a/lldb/source/API/SBBreakpointLocation.cpp
+++ b/lldb/source/API/SBBreakpointLocation.cpp
@@ -17,10 +17,13 @@
#include "lldb/lldb-defines.h"
#include "lldb/Breakpoint/Breakpoint.h"
#include "lldb/Breakpoint/BreakpointLocation.h"
-#include "lldb/Target/ThreadSpec.h"
+#include "lldb/Core/Debugger.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
+#include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Interpreter/ScriptInterpreter.h"
+#include "lldb/Target/ThreadSpec.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/ThreadSpec.h"
@@ -160,6 +163,47 @@ SBBreakpointLocation::GetCondition ()
}
void
+SBBreakpointLocation::SetScriptCallbackFunction (const char *callback_function_name)
+{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+
+ if (log)
+ log->Printf ("SBBreakpointLocation(%p)::SetScriptCallbackFunction (callback=%s)", m_opaque_sp.get(), callback_function_name);
+
+ if (m_opaque_sp)
+ {
+ Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+ BreakpointOptions *bp_options = m_opaque_sp->GetLocationOptions();
+ m_opaque_sp->GetBreakpoint().GetTarget().GetDebugger().GetCommandInterpreter().GetScriptInterpreter()->SetBreakpointCommandCallbackFunction (bp_options,
+ callback_function_name);
+
+ }
+}
+
+SBError
+SBBreakpointLocation::SetScriptCallbackBody (const char *callback_body_text)
+{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+
+ if (log)
+ log->Printf ("SBBreakpoint(%p)::SetScriptCallbackBody: callback body:\n%s)", m_opaque_sp.get(), callback_body_text);
+
+ SBError sb_error;
+ if (m_opaque_sp)
+ {
+ Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+ BreakpointOptions *bp_options = m_opaque_sp->GetLocationOptions();
+ Error error = m_opaque_sp->GetBreakpoint().GetTarget().GetDebugger().GetCommandInterpreter().GetScriptInterpreter()->SetBreakpointCommandCallback (bp_options,
+ callback_body_text);
+ sb_error.SetError(error);
+ }
+ else
+ sb_error.SetErrorString("invalid breakpoint");
+
+ return sb_error;
+}
+
+void
SBBreakpointLocation::SetThreadID (tid_t thread_id)
{
if (m_opaque_sp)
OpenPOWER on IntegriCloud