aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/OperatingSystem/Python
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2021-07-09 09:23:54 -0700
committerJonas Devlieghere <jonas@devlieghere.com>2021-07-09 10:05:39 -0700
commitf9517353959b4ef5c706e4356b56aeb9e0087584 (patch)
tree5960dcb4a254fe27fcd73f78c2aca32efd83464a /lldb/source/Plugins/OperatingSystem/Python
parent0ac7532cc17aebf1b93d95142c5edec7e66ebad0 (diff)
downloadllvm-f9517353959b4ef5c706e4356b56aeb9e0087584.zip
llvm-f9517353959b4ef5c706e4356b56aeb9e0087584.tar.gz
llvm-f9517353959b4ef5c706e4356b56aeb9e0087584.tar.bz2
[lldb] Add the ability to silently import scripted commands
Add the ability to silence command script import. The motivation for this change is being able to add command script import -s lldb.macosx.crashlog to your ~/.lldbinit without it printing the following message at the beginning of every debug session. "malloc_info", "ptr_refs", "cstr_refs", "find_variable", and "objc_refs" commands have been installed, use the "--help" options on these commands for detailed help. In addition to forwarding the silent option to LoadScriptingModule, this also changes ScriptInterpreterPythonImpl::ExecuteOneLineWithReturn and ScriptInterpreterPythonImpl::ExecuteMultipleLines to honor the enable IO option in ExecuteScriptOptions, which until now was ignored. Note that IO is only enabled (or disabled) at the start of a session, and for this particular use case, that's done when taking the Python lock in LoadScriptingModule, which means that the changes to these two functions are not strictly necessary, but (IMO) desirable nonetheless. Differential revision: https://reviews.llvm.org/D105327
Diffstat (limited to 'lldb/source/Plugins/OperatingSystem/Python')
-rw-r--r--lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
index a117ce0..730c88f 100644
--- a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
+++ b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
@@ -91,13 +91,13 @@ OperatingSystemPython::OperatingSystemPython(lldb_private::Process *process,
std::string os_plugin_class_name(
python_module_path.GetFilename().AsCString(""));
if (!os_plugin_class_name.empty()) {
- const bool init_session = false;
+ LoadScriptOptions options;
char python_module_path_cstr[PATH_MAX];
python_module_path.GetPath(python_module_path_cstr,
sizeof(python_module_path_cstr));
Status error;
- if (m_interpreter->LoadScriptingModule(python_module_path_cstr,
- init_session, error)) {
+ if (m_interpreter->LoadScriptingModule(python_module_path_cstr, options,
+ error)) {
// Strip the ".py" extension if there is one
size_t py_extension_pos = os_plugin_class_name.rfind(".py");
if (py_extension_pos != std::string::npos)