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
This commit is contained in:
Greg Clayton
2010-10-07 17:14:24 +00:00
parent 82d38df40c
commit c6ed542c90
3 changed files with 88 additions and 82 deletions

View File

@@ -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;
}