microsoft / microsoft/vscode-cpptools

gdb executes expression from hovering over a define (expression) without brackets

Aperta
#12,628 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

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

Descrizione

Environment
  • OS and version: Win11 22H2
  • VS Code: 1.92.2
  • C/C++ extension: ms-vscode.cpptools
  • OS and version of remote machine (if applicable):
  • GDB / LLDB version: GNU gdb (Arm GNU Toolchain 13.3.Rel1 (Build arm-13.24)) 14.2.90.20240526-git
Bug Summary and Steps to Reproduce

Bug Summary:
I'm not sure if this is the correct extension for the bug.
It is from an old c-project.

Hovering over a define with an expression, will lead the gdb to execute the expression.
#define LED_ON led = 100
#define LED_OFF led = 0

uint8_t led = 0;

LED_ON;
dely(100);
LED_OFF;

The extension tries to get the value of the define.
But the gdb executes the expression of the define and sets the this value to the memory of the halted microcontroller.

197-var-create --thread 4 --frame 0 hover_41cfaa7f209f0751459adf07e2163093f0baf6914b74b82363bf47de05986d92 @ "LED_ON"
-> =memory-changed,thread-group="i1",addr="0x20010f92",len="0x1"

So i can switch on or off the LED only with hovering over the define.
It is the same with a normal variable.

Debugger Configurations
{
    // 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": "Debug cortex-debug jlink",
            "request": "launch",
            "type": "cortex-debug",
            "servertype": "jlink",
            "cwd": "${workspaceFolder}",
            "executable": "${command:cmake.launchTargetPath}",
            "serverpath": "JLinkGDBServerCL.exe",
            "toolchainPrefix": "arm-none-eabi",
            "device": "STM32F205VG",
            "interface": "swd",
            "runToEntryPoint": "main",
            "svdPath": "${workspaceFolder}/Tools/Debug/STM32F215.svd",
            "rtos": "FreeRTOS",
            "showDevDebugOutput": "both",
            "liveWatch": {
                "enabled": true,
                "samplesPerSecond": 4
            },
            "swoConfig": {
                "enabled": true,
                "source": "socket",
                "swoFrequency": 4000000,
                // "swoFrequency": 6000000, // Only J-Link Ultra
                "cpuFrequency": 120000000,
                "decoders": [
                    // {
                    //     "label": "Port 0",
                    //     "type": "console",
                    //     "port": 0,
                    //     "showOnStartup": true,
                    //     // "logfile": "",
                    //     "timestamp": false,
                    //     "encoding": "ascii",
                    // },
                    // ... copy and change port and label
                ]
            }
        }
Debugger Logs
197-var-create --thread 4 --frame 0 hover_41cfaa7f209f0751459adf07e2163093f0baf6914b74b82363bf47de05986d92 @ "TEST_0"
-> =memory-changed,thread-group="i1",addr="0x20010f92",len="0x1"
GDB -> App: {"output":"","outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"memory-changed","output":[["thread-group","i1"],["addr","0x20010f92"],["len","0x1"]]}]}
-> 197^done,name="hover_41cfaa7f209f0751459adf07e2163093f0baf6914b74b82363bf47de05986d92",numchild="0",value="0x0",type="uint8_t",has_more="0"
GDB -> App: {"output":"","token":197,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["name","hover_41cfaa7f209f0751459adf07e2163093f0baf6914b74b82363bf47de05986d92"],["numchild","0"],["value","0x0"],["type","uint8_t"],["has_more","0"]]}}
Other Extensions

marus25.cortex-debug

Additional Information

No response

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

Non sono indicati file sorgente né test. Inizia tracciando il percorso di hover che emette la richiesta GDB/MI var-create, quindi riproduci il problema con le macro LED_ON e LED_OFF sulla configurazione Cortex-M indicata. Il lavoro è completato quando il passaggio del mouse su un define o una variabile il cui valore è un'espressione non modifica più la memoria del target.

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

Valutazione

Stack tecnologico
c, typescript
Ambito
devtools, embedded-iot
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.