summaryrefslogtreecommitdiffstats
path: root/lldb/source/Interpreter/ScriptInterpreterPython.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2010-10-07 17:14:24 +0000
committerGreg Clayton <gclayton@apple.com>2010-10-07 17:14:24 +0000
commitc6ed542c9095d81156a17c0d8cf8bea6b6f946e5 (patch)
tree1d22b246aed863adc66b48faadfd50978d673b59 /lldb/source/Interpreter/ScriptInterpreterPython.cpp
parent82d38df40ca79ef35407862f9ec51615dc30f5e0 (diff)
downloadbcm5719-llvm-c6ed542c9095d81156a17c0d8cf8bea6b6f946e5.tar.gz
bcm5719-llvm-c6ed542c9095d81156a17c0d8cf8bea6b6f946e5.zip
More SWIG cleanup. Moved the breakpoint callback function back to the
ScriptInterpreterPython class and made a simple callback function that ScriptInterpreterPython::BreakpointCallbackFunction() now calls so we don't include any internal API stuff into the cpp file that is generated by SWIG. Fixed a few build warnings in debugserver. llvm-svn: 115926
Diffstat (limited to 'lldb/source/Interpreter/ScriptInterpreterPython.cpp')
-rw-r--r--lldb/source/Interpreter/ScriptInterpreterPython.cpp46
1 files changed, 44 insertions, 2 deletions
diff --git a/lldb/source/Interpreter/ScriptInterpreterPython.cpp b/lldb/source/Interpreter/ScriptInterpreterPython.cpp
index a7e34d28414..42d2ef46438 100644
--- a/lldb/source/Interpreter/ScriptInterpreterPython.cpp
+++ b/lldb/source/Interpreter/ScriptInterpreterPython.cpp
@@ -22,6 +22,8 @@
#include <string>
+#include "lldb/API/SBFrame.h"
+#include "lldb/API/SBBreakpointLocation.h"
#include "lldb/Breakpoint/Breakpoint.h"
#include "lldb/Breakpoint/BreakpointLocation.h"
#include "lldb/Breakpoint/StoppointCallbackContext.h"
@@ -36,11 +38,20 @@
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Target/Process.h"
+#include "lldb/Target/Thread.h"
// This function is in the C++ output file generated by SWIG after it is
// run on all of the headers in "lldb/API/SB*.h"
extern "C" void init_lldb (void);
+extern "C" bool
+LLDBSWIGPythonBreakpointCallbackFunction
+(
+ const char *python_function_name,
+ lldb::SBFrame& sb_frame,
+ lldb::SBBreakpointLocation& sb_bp_loc
+);
+
using namespace lldb;
using namespace lldb_private;
@@ -282,7 +293,7 @@ ScriptInterpreterPython::InputReaderCallback
(
void *baton,
InputReader &reader,
- lldb::InputReaderAction notification,
+ InputReaderAction notification,
const char *bytes,
size_t bytes_len
)
@@ -565,7 +576,7 @@ ScriptInterpreterPython::GenerateBreakpointOptionsCommandCallback
(
void *baton,
InputReader &reader,
- lldb::InputReaderAction notification,
+ InputReaderAction notification,
const char *bytes,
size_t bytes_len
)
@@ -764,3 +775,34 @@ ScriptInterpreterPython::GenerateBreakpointCommandCallbackData (StringList &user
return true;
}
+bool
+ScriptInterpreterPython::BreakpointCallbackFunction
+(
+ void *baton,
+ StoppointCallbackContext *context,
+ user_id_t break_id,
+ user_id_t break_loc_id
+)
+{
+ BreakpointOptions::CommandData *bp_option_data = (BreakpointOptions::CommandData *) baton;
+ const char *python_function_name = bp_option_data->script_source.GetStringAtIndex (0);
+
+ if (python_function_name != NULL
+ && python_function_name[0] != '\0')
+ {
+ Thread *thread = context->exe_ctx.thread;
+ Target *target = context->exe_ctx.target;
+ const StackFrameSP stop_frame_sp = thread->GetStackFrameSPForStackFramePtr (context->exe_ctx.frame);
+ BreakpointSP breakpoint_sp = target->GetBreakpointByID (break_id);
+ const BreakpointLocationSP bp_loc_sp = breakpoint_sp->FindLocationByID (break_loc_id);
+
+ SBFrame sb_frame (stop_frame_sp);
+ SBBreakpointLocation sb_bp_loc (bp_loc_sp);
+
+ if (sb_bp_loc.IsValid() || sb_frame.IsValid())
+ return LLDBSWIGPythonBreakpointCallbackFunction (python_function_name, sb_frame, sb_bp_loc);
+ }
+ // We currently always true so we stop in case anything goes wrong when
+ // trying to call the script function
+ return true;
+}
OpenPOWER on IntegriCloud