microsoft / microsoft/vscode-cpptools

Locals in Variables spinning forever when the below attached program is debugged

オープン
#12,800 コメント 0 件 リアクション 3 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

debugger help wanted
主要言語
TypeScript
スター
6.2k
フォーク
1.7k
平均マージ
14時間 46分
マージ済み PR(30日)
61

説明

Environment
  • OS and version: macos
  • VS Code: 1.93.1
  • C/C++ extension: v1.21.6
  • OS and version of remote machine (if applicable):
  • GDB / LLDB version: lldb-1500.0.404.7
    Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Bug Summary and Steps to Reproduce

Bug Summary:

Steps to reproduce:

  1. Run the below program in gdb debugger
  2. set break at function subarr
  3. when breakpoint is hit, the locals variable starts to spin
Debugger Configurations
{
    "tasks": [
        {
            "label": "compile and run cpp",
            "type": "shell",
            "command": "g++ -std=c++17 -o ${fileBasenameNoExtension} ${file} && ./${fileBasenameNoExtension} < input.txt > output.txt && cat output.txt",
            "group": {
                "kind": "build",
                "isDefault": false
            }
        },
        {
            "label": "compile and run no input",
            "type": "shell",
            "command": "g++ -std=c++17 -o ${fileBasenameNoExtension} ${file} && ./${fileBasenameNoExtension}",
            "group": {
                "kind": "build",
                "isDefault": false
            }
        },
        {
            "label": "compile and run c",
            "type": "shell",
            "command": "gcc -o ${fileBasenameNoExtension} ${file} && ./${fileBasenameNoExtension} < input.txt > output.txt && cat output.txt",
            "group": {
                "kind": "build",
                "isDefault": false
            }
        },
        {
            "label": "compile and run python",
            "type": "shell",
            "command": "python3 ${file} < input.txt > output.txt && cat output.txt",
            "group": {
                "kind": "build",
                "isDefault": false
            }
        },
        {
            "type": "cppbuild",
            "label": "C/C++: clang++ build active file",
            "command": "/usr/bin/clang++",
            "args": [
                "-fcolor-diagnostics",
                "-fansi-escape-codes",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": false
            },
            "detail": "Task generated by Debugger."
        },
        {
            "type": "cppbuild",
            "label": "C/C++: clang build active file",
            "command": "/usr/bin/clang",
            "args": [
                "-fcolor-diagnostics",
                "-fansi-escape-codes",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": false
            },
            "detail": "Task generated by Debugger."
        },
        {
            "type": "cppbuild",
            "label": "C/C++: g++ build active file",
            "command": "/usr/bin/g++",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": false
            },
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}
Debugger Logs
This is no launch.json file
Other Extensions

No response

Additional Information

Program being run
`#include <bits/stdc++.h>

int subarr(vector& nums, int p) {
int sum = 0;
int sz = nums.size();
for (int i = 0; i < sz; i++)
{
sum+=nums[i];
}
int target = sum % p;
unordered_map<int, int> umap; //<csum, idx>
umap[0] = -1;
int csum = 0;
int res = INT_MAX;
for (int i = 0; i < sz; i++)
{
csum += nums[i];
int other_half = (csum % p - target + p) % p;
if (umap.find(other_half) != umap.end())
{
res = min(res, i - umap[other_half]);
}
umap[csum] = i;
}
return res != INT_MAX ? res : -1;
}

int main(int argc, char const *argv[])
{
vector v{3,1,4,2};
int p = 6;
auto res = subarr(v, p);
cout << res << endl;
return 0;
}
`
Screenshot 2024-10-03 at 10 39 55 PM

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

添付された C++ プログラムで問題を再現し、subarr にブレークポイントを設定して、実行が停止したときの Locals ビューを確認します。まずデバッガーの設定と利用可能なログを確認してください。Locals ビューがいつまでもスピナーを表示し続けるのではなく、レンダリングされれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
cpp, vscode
領域
developer-experience, tooling
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。