microsoft / microsoft/vscode-cpptools

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

Offen
#6,352 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

debugger more info needed
Vorherrschende Sprache
TypeScript
Sterne
6.2k
Forks
1.7k
Ø Merge
14 Std. 46 Min.
Gemergte PRs (30 T.)
61

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Reproduziere das Problem mit den beiden Beispielmodulen file1.c und file2.c, die separate Structs mit demselben Namen definieren. Beginne damit, einen Breakpoint bei einer Instanz aus file2.c zu setzen und sie im Überwachungsfenster oder in der Debugger-Konsole zu untersuchen. Als erledigt gilt die Aufgabe, wenn der Debugger die Felder und Werte von file2.c unter Verwendung des korrekten Typs statt der Definition aus file1.c anzeigt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
c
Bereich
devtools
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.