[#1349] Always use --simple-values in newer versions of GDB.#1400
Merged
WardenGnaw merged 2 commits intomicrosoft:mainfrom May 30, 2023
Merged
[#1349] Always use --simple-values in newer versions of GDB.#1400WardenGnaw merged 2 commits intomicrosoft:mainfrom
--simple-values in newer versions of GDB.#1400WardenGnaw merged 2 commits intomicrosoft:mainfrom
Conversation
Contributor
Author
|
@gregg-miskelly You looked at my previous attempt to fix this issue, pull request #1350, so it would valuable if you could take a look at this attempt too. |
gregg-miskelly
requested changes
May 25, 2023
Member
gregg-miskelly
left a comment
There was a problem hiding this comment.
Otherwise sounds good to me
In newer versions of GDB, the `--simple-values` option to the `-stack-list-arguments`, `-stack-list-locals` and `-stack-list-variables` commands no longer prints the value for references to compound types. This improves the performance of these commands when the stack has references to large data structures. When these versions of GDB are available, take advantage by using `--simple-values` in `DebuggedProcess.GetParameterInfoOnly` to fetch names and types in a single `-stack-list-arguments` command. This is faster than the old approach of using `--no-values` followed with `-var-create` and `-var-delete` for each parameter to get the type. The new method `MICommandFactory.SupportsSimpleValuesExcludesRefTypes` determines if the debugger supports the improved behaviour of the `--simple-values` option, by executing the `-list-features` command and checking for the `"simple-values-ref-types"` feature in the output. We cache the result on the `DebuggedProcess` object as the set of supported features does not change during the lifetime of the debug session.
fb557e8 to
550bcbc
Compare
gregg-miskelly
approved these changes
May 26, 2023
Member
|
@WardenGnaw do you want to take a look as well? These look good to me. @gareth-rees FYI WardenGnaw is on vacation, and Monday is a holiday in the US, so we probably will not get back to you till Tuesday or Wednesday. |
Member
|
LGTM. Linux tests are just being flaky and not failing due to the changes. Thanks again for contributing @gareth-rees! |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
In newer versions of GDB, the
--simple-valuesoption to the-stack-list-arguments,-stack-list-localsand-stack-list-variablescommands no longer prints the value for references to compound types. This improves the performance of these commands when the stack has references to large data structures.When these versions of GDB are available, take advantage by using
--simple-valuesinDebuggedProcess.GetParameterInfoOnlyto fetch names and types in a single-stack-list-argumentscommand. This is faster than the old approach of using--no-valuesfollowed with-var-createand-var-deletefor each parameter to get the type.The new method
MICommandFactory.SupportsSimpleValuesExcludesRefTypesdetermines if the debugger supports the improved behaviour of the--simple-valuesoption, by executing the-list-featurescommand and checking for the"simple-values-ref-types"feature in the output. We cache the result on theDebuggedProcessobject as the set of supported features does not change during the lifetime of the debug session.Fixes #1349 (Unnecessary
-var-createand-var-deletecommands during a stack trace can cause noticeable pause each time the debuggee stops)Details
The behaviour of GDB was changed in commit 51f8dafba8 and this change will be included in the next major release of GDB (version 14). I understand that Microsoft developers are not allowed to look at GDB's source code (see comment from Gregg Miskelly here), so I have summarized the effect of the change above. Let me know if there is anything else you'd like to know about this change.
I repeated the reproduction procedure from #1349, took a copy of the commands issued by a single Step Over operation with ten frames on the stack and attached them here: stack-list-arguments-after.gz. The table below shows the counts of GDB/MI commands issued for the Step Over operation by the MIEngine from
mainagainst GDB 13.1 and the MIEngine from this branch against the updated GDB.-stack-list-arguments-stack-list-frames-stack-list-variables-stack-select-frame-var-create-var-delete