Skip to content

Commit 1d4a63e

Browse files
Jeffrey Tankusmour
authored andcommitted
Reload fblldb module for reuse lldb-dap
Summary: This diff fixes fblldb custom commands import issue during "reuse lldb-dap" feature. While reusing lldb-dap, we noticed that meta's internal commands such as fbpaste, or py_bt are not available in incremental debug sessions. This happens because `fblldb` module has been loaded in lldb's process address space during the first debug session, so the second debug session's import does not execute the module top level code which performs custom lldb commands registeration. To fix this issue, the diff reload the `fblldb` module which will re-register all internal commands. Long term, we should move everything command registration to lldb's lifetime event callback instead of relying on Python's module system to avoid this kind of issue. Test Plan: `fbpaste` command is available again. Reviewers: samkitono, toyang, alexandreperez, wanyi, #lldb_team Reviewed By: alexandreperez Subscribers: #lldb_team Differential Revision: https://phabricator.intern.facebook.com/D65401873
1 parent e910a3d commit 1d4a63e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lldb/source/Interpreter/CommandInterpreter.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2598,7 +2598,10 @@ void CommandInterpreter::SourceInitFileHome(CommandReturnObject &result,
25982598
//
25992599
// We don't have the fblldbinit module on windows, so we don't include it for
26002600
// that build.
2601-
HandleCommand("script import fblldbinit", eLazyBoolNo, result);
2601+
HandleCommand("script import sys, importlib; "
2602+
"importlib.reload(sys.modules['fblldb']) if 'fblldb' "
2603+
"in sys.modules else __import__('fblldbinit')",
2604+
eLazyBoolNo, result);
26022605
#endif
26032606

26042607
llvm::SmallString<128> init_file;

0 commit comments

Comments
 (0)