diff options
author | Enrico Granata <egranata@apple.com> | 2014-10-01 21:47:29 +0000 |
---|---|---|
committer | Enrico Granata <egranata@apple.com> | 2014-10-01 21:47:29 +0000 |
commit | 06be059ad9950c7f33a63ecabfb3562f34dd3d51 (patch) | |
tree | 6c32e91937ab5375eaaa8c3a0503d42d929e5792 /lldb/scripts/Python/python-wrapper.swig | |
parent | ebcf42cdec7a51b8fe6b07cf01ce0f7bd0e8be86 (diff) | |
download | llvm-06be059ad9950c7f33a63ecabfb3562f34dd3d51.zip llvm-06be059ad9950c7f33a63ecabfb3562f34dd3d51.tar.gz llvm-06be059ad9950c7f33a63ecabfb3562f34dd3d51.tar.bz2 |
Allow Python commands to optionally take an SBExecutionContext argument in case they need to handle 'where they want to act' separately from the notion of 'currently-selected entity' that is associated to the debugger. Do this in an (hopefully) non-breaking way by running an argcount check before passing in the new argument. Update the test case to also check for this new feature. www update to follow
llvm-svn: 218834
Diffstat (limited to 'lldb/scripts/Python/python-wrapper.swig')
-rw-r--r-- | lldb/scripts/Python/python-wrapper.swig | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lldb/scripts/Python/python-wrapper.swig b/lldb/scripts/Python/python-wrapper.swig index 0c63824..bf22198 100644 --- a/lldb/scripts/Python/python-wrapper.swig +++ b/lldb/scripts/Python/python-wrapper.swig @@ -770,13 +770,15 @@ LLDBSwigPythonCallCommand const char *session_dictionary_name, lldb::DebuggerSP& debugger, const char* args, - lldb_private::CommandReturnObject& cmd_retobj + lldb_private::CommandReturnObject& cmd_retobj, + lldb::ExecutionContextRefSP exe_ctx_ref_sp ) { lldb::SBCommandReturnObject cmd_retobj_sb(&cmd_retobj); SBCommandReturnObjectReleaser cmd_retobj_sb_releaser(cmd_retobj_sb); lldb::SBDebugger debugger_sb(debugger); + lldb::SBExecutionContext exe_ctx_sb(exe_ctx_ref_sp); bool retval = false; @@ -791,7 +793,12 @@ LLDBSwigPythonCallCommand // pass the pointer-to cmd_retobj_sb or watch the underlying object disappear from under you // see comment above for SBCommandReturnObjectReleaser for further details PyObject* pvalue = NULL; - pvalue = pfunc(debugger_sb, args, &cmd_retobj_sb, session_dict = FindSessionDictionary(session_dictionary_name)); + + PyCallable::argc argc = pfunc.GetNumArguments(); + if (argc.num_args == 5 || argc.varargs == true) + pvalue = pfunc(debugger_sb, args, exe_ctx_sb, &cmd_retobj_sb, session_dict = FindSessionDictionary(session_dictionary_name)); + else + pvalue = pfunc(debugger_sb, args, &cmd_retobj_sb, session_dict = FindSessionDictionary(session_dictionary_name)); Py_XINCREF (session_dict); Py_XDECREF (pvalue); |