microsoft / microsoft/vscode-cpptools

VScode debugging with GDB doesn't show vector or map contents from header files

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

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

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

説明

Describe the bug

  • OS and Version: Windows 10
  • VS Code Version: 1.57.1
  • C/C++ Extension Version: 1.5.0 insiders3
    When debugging with gbd(mingw64 latest version of Sourceforge) and trying to access variables from header files(.hpp), it says:
    can not access memory

To Reproduce
Please include a code sample and launch.json configuration.
Steps to reproduce the behavior:
Use a C++ file with a .hpp file
add a vector or map as part of the header file
debug with gdb(with pretty printing enabled)
try taking a look the vector contents

lanuch.json
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
    
    {
        "name": "(gdb) Launch",
        "type": "cppdbg",
        "request": "launch",
        "program": "${workspaceFolder}\\bin\\EnderKnightShell.exe",
        "args": [],
        "stopAtEntry": false,
        "cwd": "${workspaceFolder}",
        "environment": [],
        "externalConsole": false,
        "MIMode": "gdb",
        "miDebuggerPath": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin\\gdb.exe",
        "setupCommands": [
            {
                "description": "Enable pretty-printing for gdb",
                "text": "-enable-pretty-printing",
                "ignoreFailures": true
            }
        ],
        "preLaunchTask": "build"
    }
    
    ]
    
}

Additional context
part of the log(I can't copy the full thing)

1: (5403) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (5403) 1066: elapsed time 14\r\n"},"seq":1396}
1: (5403) 1066: elapsed time 14
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (5403) ->&\"\\n\"\r\n"},"seq":1398}
1: (5403) ->&"\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (5403) ->^done\r\n"},"seq":1400}
1: (5403) ->^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (5403) ->(gdb)\r\n"},"seq":1402}
1: (5403) ->(gdb)
--> R (variables-20): {"type":"response","request_seq":20,"success":true,"command":"variables","body":{"variables":[{"name":"eklexer","value":"{...}","type":"lex::Lexer","evaluateName":"eklexer","variablesReference":1003},{"name":"var","value":"0","type":"int","evaluateName":"var","variablesReference":0,"memoryReference":"0x0000000000000000"},{"name":"DebugTokens","value":"{...}","type":"std::vector<std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::allocator<std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > > >","evaluateName":"DebugTokens","variablesReference":1004},{"name":"argc","value":"1","type":"int","evaluateName":"argc","variablesReference":0,"memoryReference":"0x0000000000000001"},{"name":"argv","value":"0x11b1870","type":"char **","evaluateName":"argv","variablesReference":1005,"memoryReference":"0x00000000011b1870"}]},"seq":1404}```

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

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

はじめの一歩

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

調査の方向性

まず、提供された launch.json、MinGW-w64 GDB、および .hpp ファイルの vector または map の値を使用する C++ ソースファイルを使って、Windows 10 で問題を再現します。DebugTokens 変数に対するデバッガーの動作を比較し、そのコンテナーの内容が正しく表示された時点で問題が解決したと判断します。

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

評価

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

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

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