microsoft / microsoft/vscode-cpptools

[OSX] lldb cannot read bitfield dwarf debug info generated by -mmacosx-version-min=10.11

Aperta
#2,823 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug debugger
Lingua principale
TypeScript
Stelle
6.2k
Fork
1.7k
Merge medio
14h 46m
PR unite (30g)
61

Descrizione

Type: Debugger

Describe the bug

  • OS and Version: MacOSX 10.4.1
  • VS Code Version: 1.29.0
  • C/C++ Extension Version: 0.20.1
  • A clear and concise description of what the bug is.

Starting from MacOSX target 10.11, clang tunes it's debug information for lldb. This causes the version of lldb embedded in the cpptools extension to misreport bitfield values.

To Reproduce

#include <stdio.h>

int main() {
    struct Test {
        unsigned short a;
        unsigned short b : 1;
        unsigned short c: 15;
    };

    Test x = {0};
    x.a = 5;
    printf("%hu", x.b);
    return 0;
}
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(lldb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/a.out",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "lldb"
        }
    ]
}

Steps to reproduce the behavior:

  1. Run clang++ test.cc -mmacosx-version-min=10.11 -g
  2. Place a breakpoint at line 10: x.a = 5
  3. Launch debugger
  4. Step over x.a = 5 and see that x.b or x.c changes value (lldb cannot find the right addresses for the bitfields.

Additional context
Compilation where older lldb works:

  1. clang++ -c test.cc -mmacosx-version-min=10.10 -g
  2. clang++ -c test.cc -mmacosx-version-min=10.11 -ggdb

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo il caso minimo test.cc con clang++ usando -mmacosx-version-min=10.10 e 10.11, quindi avvialo con la configurazione .vscode/launch.json fornita. Confronta come il debugger segnala x.b e x.c dopo aver eseguito un'operazione step over su x.a = 5; completato significa che i valori dei bitfield rimangono corretti per il target 10.11.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
cpp, vscode
Ambito
devtools
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.