[all-commits] [llvm/llvm-project] b9139a: Fix expression evaluation result expansion in lldb...

jeffreytan81 via All-commits all-commits at lists.llvm.org
Tue Aug 3 15:32:06 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b9139acb85a4e5203364838e47b2e1ee90055ad3
      https://github.com/llvm/llvm-project/commit/b9139acb85a4e5203364838e47b2e1ee90055ad3
  Author: Jeffrey Tan <jeffreytan at fb.com>
  Date:   2021-08-03 (Tue, 03 Aug 2021)

  Changed paths:
    M lldb/test/API/tools/lldb-vscode/variables/TestVSCode_variables.py
    M lldb/tools/lldb-vscode/VSCode.cpp
    M lldb/tools/lldb-vscode/VSCode.h
    M lldb/tools/lldb-vscode/lldb-vscode.cpp

  Log Message:
  -----------
  Fix expression evaluation result expansion in lldb-vscode

VScode now sends a "scopes" DAP request immediately after any expression evaluation.
This scopes request would clear and invalidate any non-scoped expandable variables in g_vsc.variables, causing later "variables" request to return empty result.
The symptom is that any expandable variables in VScode watch window/debug console UI to return empty content.

This diff fixes this issue by only clearing the expandable variables at process continue time. To achieve this, we have to repopulate all scoped variables
during context switch for each "scopes" request without clearing global expandable variables.
So the PR puts the scoped variables into its own locals/globals/registers; and all expandable variables into separate "expandableVariables" list.
Also, instead of using the variable index for "variableReference", it generates a new variableReference id each time as the key of "expandableVariables".

As a further new feature, this PR adds a new "expandablePermanentVariables" which has the lifetime of debug session. Any expandable variables from debug console
are added into this list. This enables users to snapshot expanable old variable in debug console and compare with new variables if desire.

Reviewed By: clayborg

Differential Revision: https://reviews.llvm.org/D105166




More information about the All-commits mailing list