"Commands are in the Python language.",
},
{
+ eScriptLanguageLua,
+ "lua",
+ "Commands are in the Python language.",
+ },
+ {
eSortOrderByName,
"default-script",
"Commands are in the default scripting language.",
option_arg, GetDefinitions()[option_idx].enum_values,
eScriptLanguageNone, error);
- m_use_script_language = (m_script_language == eScriptLanguagePython ||
- m_script_language == eScriptLanguageDefault);
+ switch (m_script_language) {
+ case eScriptLanguagePython:
+ case eScriptLanguageLua:
+ m_use_script_language = true;
+ break;
+ case eScriptLanguageNone:
+ case eScriptLanguageUnknown:
+ m_use_script_language = false;
+ break;
+ }
break;
case 'e': {
case 'F':
m_use_one_liner = false;
- m_use_script_language = true;
m_function_name.assign(option_arg);
break;
return false;
}
- if (!m_options.m_use_script_language &&
- !m_options.m_function_name.empty()) {
- result.AppendError("need to enable scripting to have a function run as a "
- "watchpoint command");
- result.SetStatus(eReturnStatusFailed);
- return false;
+ if (!m_options.m_function_name.empty()) {
+ if (!m_options.m_use_script_language) {
+ m_options.m_script_language = GetDebugger().GetScriptLanguage();
+ m_options.m_use_script_language = true;
+ }
}
std::vector<uint32_t> valid_wp_ids;
// to set or collect command callback. Otherwise, call the methods
// associated with this object.
if (m_options.m_use_script_language) {
+ ScriptInterpreter *script_interp = GetDebugger().GetScriptInterpreter(
+ /*can_create=*/true, m_options.m_script_language);
// Special handling for one-liner specified inline.
if (m_options.m_use_one_liner) {
- GetDebugger().GetScriptInterpreter()->SetWatchpointCommandCallback(
+ script_interp->SetWatchpointCommandCallback(
wp_options, m_options.m_one_liner.c_str());
}
// Special handling for using a Python function by name instead of
else if (!m_options.m_function_name.empty()) {
std::string oneliner(m_options.m_function_name);
oneliner += "(frame, wp, internal_dict)";
- GetDebugger().GetScriptInterpreter()->SetWatchpointCommandCallback(
+ script_interp->SetWatchpointCommandCallback(
wp_options, oneliner.c_str());
} else {
- GetDebugger()
- .GetScriptInterpreter()
- ->CollectDataForWatchpointCommandCallback(wp_options, result);
+ script_interp->CollectDataForWatchpointCommandCallback(wp_options,
+ result);
}
} else {
// Special handling for one-liner specified inline.