-
Notifications
You must be signed in to change notification settings - Fork 15k
[lldb-dap] Add --no-lldbinit
as a CLI flag
#156131
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
Conversation
@llvm/pr-subscribers-lldb Author: Piyush Jaiswal (piyushjaiswal98) ChangesTLDRThis PR adds MotivationRcently Users reported being unable to control
SummaryThis PR introduces a new command-line flag Key Changes:
Test PlanNew Test Coverage (
|
✅ With the latest revision this PR passed the Python code formatter. |
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.
seems well done
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.
LGTM!
// changing its behavior. The CLI flag --no-lldbinit takes precedence over | ||
// the DAP parameter. | ||
bool should_source_init_files = | ||
!dap.no_lldbinit && arguments.lldbExtSourceInitFile.value_or(true); |
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.
Since we have this flag now, we could remove our custom $__lldb_sourceInitFile
field and just pass this flag instead.
I can also do that in a follow up patch once this is in.
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.
sounds good
TLDR
This PR adds
--no-lldbinit
as a new CLI flag to thelldb-dap
Motivation
Rcently Users reported being unable to control
.lldbinit
file sourcing when debugging through VS Code. #155802.VS Code extensions cannot easily inject custom parameters into the DAP initialize request. Adding
--no-lldbinit
as a CLI flag solves this problem by allowing the decision to skip.lldbinit
files to be made at debugger startup, before any initialization requests are processed.VS Code extensions can control this behavior by specifying the flag through
debugAdapterArgs
or similar mechanisms in launch configurations.Summary
This PR introduces a new command-line flag
--no-lldbinit
(with alias-x
) tolldb-dap
. The flag prevents automatic parsing of.lldbinit
files during debugger initialization, giving users control over whether their LLDB initialization scripts are loaded.Key Changes:
Options.td
): Added the--no-lldbinit
flag with-x
aliasDAP.cpp
): Added support for storing and using the no-lldbinit flagInitializeRequestHandler.cpp
): Modified to respect the flag during debugger initializationlldb-dap.cpp
): Added argument parsing for the new flagdap_server.py & lldbdap_testcase.py
): Enhanced test framework to support additional argumentsTest Plan
New Test Coverage (
TestDAP_launch.py
)Test Method:
test_no_lldbinit_flag()
Test Strategy:
.lldbinit
file with specific settings that would normally be loaded--no-lldbinit
flag.lldbinit
are NOT applied, proving the flag works correctlyTest Environment:
.lldbinit
filestop-disassembly-display never
,target.x86-disassembly-flavor intel
)--no-lldbinit
flag viaadditional_args
parameterValidation Approach:
settings show stop-disassembly-display
command during initialization.lldbinit
was sourced)Testing Infrastructure Enhancements
File Modifications:
dap_server.py
: Enhanced to acceptadditional_args
parameter for passing extra CLI flagslldbdap_testcase.py
: Updatedbuild_and_create_debug_adapter()
method to support additional arguments and environment variablesUnit Test Integration
Unit Test Updates (
DAPTest.cpp
):Test Run
