microsoft / microsoft/vscode-cpptools

the debugger gets confused on same named structs that defined in separate c modules

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

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

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

説明

Type: Debugger

Describe the bug

  • OS and Version: Windows 10 (10.0.19041)
  • VS Code Version: 1.50.1 (user setup)
  • C/C++ Extension Version: v1.0.1
  • Other extensions you installed (and if the issue persists after disabling them): ARM (Syntax Highligter), CMake, Cmake Tools, Go, Python, x86 and x86_64 Assembly (Syntax highligther)
  • A clear and concise description of what the bug is.

The debugger does not map correct type info for identical named structs that has different fields on separate c modules.

Steps to Reproduce:

  1. Create two C files for example file1.c and file2.c
  2. Define a struct in each c file with identical name but different fields. for example

in file1.c

typedef struct _hey
{
    char chrarr[60];
    int intval;
}hey;

in file2.c

typedef struct _hey
{
    char chrarr[20];
    int intval;
    int a;
    int b;
}hey;

As you know, these types are not exported outside of the module, so these types are internal and isolated from each other.

  1. create an instance of second type of "hey". put some breakpoint to examine struct's data

  2. when breakpoint hit, add the variable into watch window or just type into debugger console.

Expected result: debugger should have mapped and displayed file2.c's hey type.
Experienced result: debugger maps and shows the data using file1.c's "hey" type instead of file2.c's

Ps: If the issue could not reproduce please try to create an instance for first one. Because I'm not sure that which type have been chosen by the vscode.

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

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

はじめの一歩

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

調査の方向性

同じ名前の別々の構造体を定義する 2 つのサンプルモジュール、file1.c と file2.c で問題を再現します。まず file2.c のインスタンスにブレークポイントを設定し、ウォッチウィンドウまたはデバッガーコンソールで検査します。デバッガーが file1.c の定義ではなく、正しい型を使用して file2.c のフィールドと値を表示すれば完了です。

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

評価

技術スタック
c
領域
devtools
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
35/100

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

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