-
Notifications
You must be signed in to change notification settings - Fork 341
[lldb/interpreter] Add Swift REPL init file support #1717
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[lldb/interpreter] Add Swift REPL init file support #1717
Conversation
@swift-ci test |
@swift-ci test linux platform |
510a0d2
to
6e9b74b
Compare
@swift-ci test |
@swift-ci please test linux |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How are users supposed to know what file LLDB will read for the Swift REPL. You probably want to mention this in the man page. If you decide to go with the .lldbinit-language-repl
scheme you could even do this on llvm.org.
cc8b780
to
19953a1
Compare
I'll move this to llvm.org, and cherrypick it afterwards. |
Provider a wrapper around llvm::sys::path::home_directory in the FileSystem class. This will make it possible for the reproducers to intercept the call in a central place.
19953a1
to
3cec419
Compare
This patch changes the command interpreter sourcing logic for the REPL init file. Instead of looking for a arbitrary file name, it standardizes the REPL init file name to match to following scheme: `.lldbinit-<language>-repl` This will make the naming more homogenous and the sourcing logic future-proof. rdar://65836048 Differential Revision: https://reviews.llvm.org/D86987 Signed-off-by: Med Ismail Bennani <[email protected]>
Previously, before loading the REPL language-specific init file, lldb checked the selected target language in which case it returned an unknown language type with the REPL target. Instead, the patch calls `Language::GetLanguagesSupportingREPLs` and look for the first element of that set. In case lldb was not configured with a REPL language, then, it will just stop sourcing the REPL init file and fallback to the original logic (continuing with the default init file). rdar://65836048 Differential Revision: https://reviews.llvm.org/D87076 Signed-off-by: Med Ismail Bennani <[email protected]>
This test adds `breakpoint set` commands with different source locations to a temporary `.lldbinit-swift-repl` and `.lldbinit` and after launching lldb, it checks that the breakpoint set in the debugger matches the source location from the SwiftREPL initfile. rdar://65836048 Signed-off-by: Med Ismail Bennani <[email protected]>
3cec419
to
c1bba7c
Compare
52d43e1 handles the change on llvm.org
@swift-ci test |
Did you also cherry-pick the llvm.org patches to the Bastille branch? |
Some users complained that when using the Swift REPL (LLDB launched with
--repl
option), it would try to read their home init file, which can causeunintended behaviour.
To solve this issue, this patch introduces a new, more specific, Swift
REPL init file, conveniently named
.lldbinit-swift-repl
. If the usercreates this file in his home directory, and launches LLDB in REPL mode,
it will override the default init file.
This behaviour only applies when REPL mode is enabled.
rdar://65836048
Signed-off-by: Med Ismail Bennani [email protected]