@@ -453,8 +453,9 @@ ScriptInterpreterPythonImpl::ScriptInterpreterPythonImpl(Debugger &debugger)
453
453
// Reloading modules requires a different syntax in Python 2 and Python 3.
454
454
// This provides a consistent syntax no matter what version of Python.
455
455
run_string.Clear ();
456
- run_string.Printf (" run_one_line (%s, 'from importlib import reload as reload_module')" ,
457
- m_dictionary_name.c_str ());
456
+ run_string.Printf (
457
+ " run_one_line (%s, 'from importlib import reload as reload_module')" ,
458
+ m_dictionary_name.c_str ());
458
459
PyRun_SimpleString (run_string.GetData ());
459
460
460
461
// WARNING: temporary code that loads Cocoa formatters - this should be done
@@ -770,21 +771,19 @@ llvm::Expected<unsigned>
770
771
ScriptInterpreterPythonImpl::GetMaxPositionalArgumentsForCallable (
771
772
const llvm::StringRef &callable_name) {
772
773
if (callable_name.empty ()) {
773
- return llvm::createStringError (
774
- llvm::inconvertibleErrorCode (),
775
- " called with empty callable name." );
776
- }
777
- Locker py_lock (this , Locker::AcquireLock |
778
- Locker::InitSession |
779
- Locker::NoSTDIN);
780
- auto dict = PythonModule::MainModule ()
781
- .ResolveName <PythonDictionary>(m_dictionary_name);
774
+ return llvm::createStringError (llvm::inconvertibleErrorCode (),
775
+ " called with empty callable name." );
776
+ }
777
+ Locker py_lock (this ,
778
+ Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
779
+ auto dict = PythonModule::MainModule ().ResolveName <PythonDictionary>(
780
+ m_dictionary_name);
782
781
auto pfunc = PythonObject::ResolveNameWithDictionary<PythonCallable>(
783
782
callable_name, dict);
784
783
if (!pfunc.IsAllocated ()) {
785
- return llvm::createStringError (
786
- llvm::inconvertibleErrorCode () ,
787
- " can't find callable: %s " , callable_name.str ().c_str ());
784
+ return llvm::createStringError (llvm::inconvertibleErrorCode (),
785
+ " can't find callable: %s " ,
786
+ callable_name.str ().c_str ());
788
787
}
789
788
llvm::Expected<PythonCallable::ArgInfo> arg_info = pfunc.GetArgInfo ();
790
789
if (!arg_info)
@@ -1266,8 +1265,7 @@ Status ScriptInterpreterPythonImpl::SetBreakpointCommandCallback(
1266
1265
1267
1266
// Set a Python one-liner as the callback for the watchpoint.
1268
1267
void ScriptInterpreterPythonImpl::SetWatchpointCommandCallback (
1269
- WatchpointOptions *wp_options, const char *user_input,
1270
- bool is_callback) {
1268
+ WatchpointOptions *wp_options, const char *user_input, bool is_callback) {
1271
1269
auto data_up = std::make_unique<WatchpointOptions::CommandData>();
1272
1270
1273
1271
// It's necessary to set both user_source and script_source to the oneliner.
@@ -1293,8 +1291,7 @@ Status ScriptInterpreterPythonImpl::ExportFunctionDefinitionToInterpreter(
1293
1291
std::string function_def_string (function_def.CopyList ());
1294
1292
1295
1293
Status error = ExecuteMultipleLines (
1296
- function_def_string.c_str (),
1297
- ExecuteScriptOptions ().SetEnableIO (false ));
1294
+ function_def_string.c_str (), ExecuteScriptOptions ().SetEnableIO (false ));
1298
1295
return error;
1299
1296
}
1300
1297
@@ -2075,7 +2072,8 @@ int ScriptInterpreterPythonImpl::GetIndexOfChildWithName(
2075
2072
{
2076
2073
Locker py_lock (this ,
2077
2074
Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
2078
- ret_val = SWIGBridge::LLDBSwigPython_GetIndexOfChildWithName (implementor, child_name);
2075
+ ret_val = SWIGBridge::LLDBSwigPython_GetIndexOfChildWithName (implementor,
2076
+ child_name);
2079
2077
}
2080
2078
2081
2079
return ret_val;
@@ -2467,7 +2465,8 @@ bool ScriptInterpreterPythonImpl::LoadScriptingModule(
2467
2465
// the lifetime of the process in which this LLDB framework is living.
2468
2466
const bool does_contain_executed = ExecuteOneLineWithReturn (
2469
2467
command_stream.GetData (),
2470
- ScriptInterpreterPythonImpl::eScriptReturnTypeBool, &does_contain, exc_options);
2468
+ ScriptInterpreterPythonImpl::eScriptReturnTypeBool, &does_contain,
2469
+ exc_options);
2471
2470
2472
2471
const bool was_imported_globally = does_contain_executed && does_contain;
2473
2472
const bool was_imported_locally =
@@ -2684,7 +2683,7 @@ bool ScriptInterpreterPythonImpl::RunScriptBasedParsedCommand(
2684
2683
args_arr_sp->AddStringItem (entry.ref ());
2685
2684
}
2686
2685
StructuredDataImpl args_impl (args_arr_sp);
2687
-
2686
+
2688
2687
ret_val = SWIGBridge::LLDBSwigPythonCallParsedCommandObject (
2689
2688
static_cast <PyObject *>(impl_obj_sp->GetValue ()), debugger_sp,
2690
2689
args_impl, cmd_retobj, exe_ctx_ref_sp);
@@ -2786,8 +2785,7 @@ bool ScriptInterpreterPythonImpl::GetDocumentationForItem(const char *item,
2786
2785
2787
2786
if (ExecuteOneLineWithReturn (
2788
2787
command, ScriptInterpreter::eScriptReturnTypeCharStrOrNone,
2789
- &result_ptr,
2790
- ExecuteScriptOptions ().SetEnableIO (false ))) {
2788
+ &result_ptr, ExecuteScriptOptions ().SetEnableIO (false ))) {
2791
2789
if (result_ptr)
2792
2790
dest.assign (result_ptr);
2793
2791
return true ;
@@ -2885,7 +2883,7 @@ uint32_t ScriptInterpreterPythonImpl::GetFlagsForCommandObject(
2885
2883
return result;
2886
2884
}
2887
2885
2888
- StructuredData::ObjectSP
2886
+ StructuredData::ObjectSP
2889
2887
ScriptInterpreterPythonImpl::GetOptionsForCommandObject (
2890
2888
StructuredData::GenericSP cmd_obj_sp) {
2891
2889
StructuredData::ObjectSP result = {};
@@ -2930,10 +2928,10 @@ ScriptInterpreterPythonImpl::GetOptionsForCommandObject(
2930
2928
PyErr_Clear ();
2931
2929
return {};
2932
2930
}
2933
- return py_return.CreateStructuredObject ();
2931
+ return py_return.CreateStructuredObject ();
2934
2932
}
2935
2933
2936
- StructuredData::ObjectSP
2934
+ StructuredData::ObjectSP
2937
2935
ScriptInterpreterPythonImpl::GetArgumentsForCommandObject (
2938
2936
StructuredData::GenericSP cmd_obj_sp) {
2939
2937
StructuredData::ObjectSP result = {};
@@ -2978,19 +2976,18 @@ ScriptInterpreterPythonImpl::GetArgumentsForCommandObject(
2978
2976
PyErr_Clear ();
2979
2977
return {};
2980
2978
}
2981
- return py_return.CreateStructuredObject ();
2979
+ return py_return.CreateStructuredObject ();
2982
2980
}
2983
2981
2984
- void
2985
- ScriptInterpreterPythonImpl::OptionParsingStartedForCommandObject (
2982
+ void ScriptInterpreterPythonImpl::OptionParsingStartedForCommandObject (
2986
2983
StructuredData::GenericSP cmd_obj_sp) {
2987
2984
2988
2985
Locker py_lock (this , Locker::AcquireLock | Locker::NoSTDIN, Locker::FreeLock);
2989
2986
2990
2987
static char callee_name[] = " option_parsing_started" ;
2991
2988
2992
2989
if (!cmd_obj_sp)
2993
- return ;
2990
+ return ;
2994
2991
2995
2992
PythonObject implementor (PyRefType::Borrowed,
2996
2993
(PyObject *)cmd_obj_sp->GetValue ());
@@ -3016,10 +3013,9 @@ ScriptInterpreterPythonImpl::OptionParsingStartedForCommandObject(
3016
3013
if (PyErr_Occurred ())
3017
3014
PyErr_Clear ();
3018
3015
3019
- // option_parsing_starting doesn't return anything, ignore anything but
3016
+ // option_parsing_starting doesn't return anything, ignore anything but
3020
3017
// python errors.
3021
- unwrapOrSetPythonException (
3022
- As<bool >(implementor.CallMethod (callee_name)));
3018
+ unwrapOrSetPythonException (As<bool >(implementor.CallMethod (callee_name)));
3023
3019
3024
3020
// if it fails, print the error but otherwise go on
3025
3021
if (PyErr_Occurred ()) {
@@ -3029,8 +3025,7 @@ ScriptInterpreterPythonImpl::OptionParsingStartedForCommandObject(
3029
3025
}
3030
3026
}
3031
3027
3032
- bool
3033
- ScriptInterpreterPythonImpl::SetOptionValueForCommandObject (
3028
+ bool ScriptInterpreterPythonImpl::SetOptionValueForCommandObject (
3034
3029
StructuredData::GenericSP cmd_obj_sp, ExecutionContext *exe_ctx,
3035
3030
llvm::StringRef long_option, llvm::StringRef value) {
3036
3031
StructuredData::ObjectSP result = {};
@@ -3065,15 +3060,15 @@ ScriptInterpreterPythonImpl::SetOptionValueForCommandObject(
3065
3060
3066
3061
if (PyErr_Occurred ())
3067
3062
PyErr_Clear ();
3068
-
3063
+
3069
3064
lldb::ExecutionContextRefSP exe_ctx_ref_sp;
3070
3065
if (exe_ctx)
3071
3066
exe_ctx_ref_sp.reset (new ExecutionContextRef (exe_ctx));
3072
3067
PythonObject ctx_ref_obj = SWIGBridge::ToSWIGWrapper (exe_ctx_ref_sp);
3073
-
3074
- bool py_return = unwrapOrSetPythonException (
3075
- As< bool >( implementor.CallMethod (callee_name, ctx_ref_obj, long_option. str (). c_str (),
3076
- value.str ().c_str ())));
3068
+
3069
+ bool py_return = unwrapOrSetPythonException (As< bool >(
3070
+ implementor.CallMethod (callee_name, ctx_ref_obj,
3071
+ long_option. str (). c_str (), value.str ().c_str ())));
3077
3072
3078
3073
// if it fails, print the error but otherwise go on
3079
3074
if (PyErr_Occurred ()) {
0 commit comments