-
Notifications
You must be signed in to change notification settings - Fork 15.3k
lldb-dap: Stop using replicated variable ids #124232
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
Open
Anthony-Eid
wants to merge
18
commits into
llvm:main
Choose a base branch
from
Anthony-Eid:fix-variable-request
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 10 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
30658e9
Fix variable request from reusing variable_ids
Anthony-Eid 9707978
Add createScope changes
Anthony-Eid 50230c2
Fix some bugs
Anthony-Eid be3e97d
Merge branch 'main' into fix-variable-request
Anthony-Eid c73d4c4
remove unused GetScopedsKind func
Anthony-Eid 2712abd
Fix hardcoded scope references in DAP variable handling
Anthony-Eid d0f1e86
Fix set data breakpoint test by using the correct variable reference
Anthony-Eid 875b926
Have llm (Claude Opus 4) Generate a regression test
Anthony-Eid 4dae801
Format test files with darker
Anthony-Eid a52fe07
Remove unused global defines and set First Var Ref to 1
Anthony-Eid 5f47586
Use scopekind instead of hardcoded comparisons in CreateScope
Anthony-Eid b7548f1
Stop storing duplicate scopes in variables
Anthony-Eid c8196a2
Apply Python formatting to fix CI darker checks
Anthony-Eid 2387952
Hopefully fix failing tests (They're not running on my end)
Anthony-Eid bc00325
Actually fix the failing tests for real
Anthony-Eid facb489
Simplify Scopes request handler
Anthony-Eid c4df0a8
Fix variables test
Anthony-Eid 348f21c
Simplify ScopeData and improve naming in ready frame function
Anthony-Eid File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,8 +29,8 @@ namespace lldb_dap { | |
| /// | ||
| /// \return | ||
| /// A `protocol::Scope` | ||
| static Scope CreateScope(const llvm::StringRef name, int64_t variablesReference, | ||
| int64_t namedVariables, bool expensive) { | ||
| Scope CreateScope(const llvm::StringRef name, int64_t variablesReference, | ||
| int64_t namedVariables, bool expensive) { | ||
| Scope scope; | ||
| scope.name = name; | ||
|
|
||
|
|
@@ -41,9 +41,9 @@ static Scope CreateScope(const llvm::StringRef name, int64_t variablesReference, | |
| // if we add the arguments above the local scope as the locals scope will not | ||
| // be expanded if we enter a function with arguments. It becomes more | ||
| // annoying when the scope has arguments, return_value and locals. | ||
| if (variablesReference == VARREF_LOCALS) | ||
| if (name == "Locals") | ||
| scope.presentationHint = Scope::eScopePresentationHintLocals; | ||
| else if (variablesReference == VARREF_REGS) | ||
| else if (name == "Registers") | ||
| scope.presentationHint = Scope::eScopePresentationHintRegisters; | ||
|
|
||
| scope.variablesReference = variablesReference; | ||
|
|
@@ -75,22 +75,31 @@ ScopesRequestHandler::Run(const ScopesArguments &args) const { | |
| frame.GetThread().GetProcess().SetSelectedThread(frame.GetThread()); | ||
| frame.GetThread().SetSelectedFrame(frame.GetFrameID()); | ||
| } | ||
| dap.variables.locals = frame.GetVariables(/*arguments=*/true, | ||
| /*locals=*/true, | ||
| /*statics=*/false, | ||
| /*in_scope_only=*/true); | ||
| dap.variables.globals = frame.GetVariables(/*arguments=*/false, | ||
| /*locals=*/false, | ||
| /*statics=*/true, | ||
| /*in_scope_only=*/true); | ||
| dap.variables.registers = frame.GetRegisters(); | ||
|
|
||
| std::vector scopes = {CreateScope("Locals", VARREF_LOCALS, | ||
| dap.variables.locals.GetSize(), false), | ||
| CreateScope("Globals", VARREF_GLOBALS, | ||
| dap.variables.globals.GetSize(), false), | ||
| CreateScope("Registers", VARREF_REGS, | ||
| dap.variables.registers.GetSize(), false)}; | ||
|
|
||
| uint32_t frame_id = frame.GetFrameID(); | ||
|
|
||
| dap.variables.ReadyFrame(frame_id, frame); | ||
| dap.variables.SwitchFrame(frame_id); | ||
|
|
||
| std::vector<Scope> scopes = {}; | ||
|
|
||
| int64_t variable_reference = dap.variables.GetNewVariableReference(false); | ||
| scopes.push_back(CreateScope("Locals", variable_reference, | ||
| dap.variables.locals.GetSize(), false)); | ||
|
|
||
| dap.variables.AddScopeKind(variable_reference, ScopeKind::Locals, frame_id); | ||
|
||
|
|
||
| variable_reference = dap.variables.GetNewVariableReference(false); | ||
| scopes.push_back(CreateScope("Globals", variable_reference, | ||
| dap.variables.globals.GetSize(), false)); | ||
| dap.variables.AddScopeKind(variable_reference, ScopeKind::Globals, frame_id); | ||
|
|
||
| variable_reference = dap.variables.GetNewVariableReference(false); | ||
| scopes.push_back(CreateScope("Registers", variable_reference, | ||
| dap.variables.registers.GetSize(), false)); | ||
|
|
||
| dap.variables.AddScopeKind(variable_reference, ScopeKind::Registers, | ||
| frame_id); | ||
|
|
||
| return ScopesResponseBody{std::move(scopes)}; | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Should we move this up a layer and take the presentation hint as a paramter instead of checking for specific names?
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.
I passed ScopeKind in to the function instead of name now, and use ScopeKind variant to generate the correct presentation hint and name for the scope. Is that an adequate fix for this?