microsoft / microsoft/vscode-cpptools

GDB stops on break points which are not set

Aperta
#10,432 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

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

Descrizione

Environment
  • OS and version:
    windows 10
  • VS Code:
    Version: 1.74.3 (user setup)
    Commit: 97dec172d3256f8ca4bfb2143f3f76b503ca0534
    Date: 2023-01-09T16:59:02.252Z
    Electron: 19.1.8
    Chromium: 102.0.5005.167
    Node.js: 16.14.2
    V8: 10.2.154.15-electron.0
    OS: Windows_NT x64 10.0.19045
    Sandboxed: No
  • C/C++ extension:
    v1.13.9
  • OS and version of remote machine (if applicable):
  • GDB / LLDB version:
    GNU gdb (GDB) 12.1 (mingw64)
Bug Summary and Steps to Reproduce

Bug Summary:
Steps to reproduce:
run the code in debug :

int calcualteSkyLine(const std::vector<int>& skyline)
{
 

    int brushCount = 0;
    int prevHeight = 0;

    for(const auto& elm : skyline)
    {
        if(elm > prevHeight)
        {
            brushCount = brushCount + (elm - prevHeight);
        }
        prevHeight = elm ;         
    }
    return brushCount;
}

int main(int argv,char** argc)
{
    
    const std::vector<int>  buldingvec = {1,3,2,1,2,1,5,3,3,4,2};
    calcualteSkyLine(buldingvec);
    return 0;
}

see the debug line stops on breaks that are not set in the IDE very annoying ... happens in every project random stops

image
image

Debugger Configurations
{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: g++.exe build active file",
            "command": "C:\\msys64\\mingw64\\bin\\g++.exe",
            "args": [
                "--debug",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "C:\\msys64\\mingw64\\bin"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}



{
    // 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}/${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,  //this will call a dos prompt window for cin and cout
            "MIMode": "gdb",
            "miDebuggerPath": "C:\\msys64\\mingw64\\bin\\gdb.exe",
            "preLaunchTask": "cppbuild", //this must same as command in task.json
            "logging": {"trace": true, "traceResponse": true,
                        "engineLogging": true,
                        "exceptions": true,
                        "moduleLoad": true,
                        "programOutput": true},
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        }
    ]
}
Debugger Logs
=thread-group-added,id="i1"
GNU gdb (GDB) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-w64-mingw32".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
Warning: Debuggee TargetArchitecture not detected, assuming x86_64.
=cmd-param-changed,param="pagination",value="off"
[New Thread 1116.0x3448]
[New Thread 1116.0x12c]
[New Thread 1116.0x1d04]

Thread 1 hit Breakpoint 1, main (argv=1, argc=0x1e3e63329b0) at C:\dev\my\cpp\mingw_projects\Questions\Q4\main.cpp:54
54	    const std::vector<int>  buldingvec = {1,3,2,1,2,1,5,3,3,4,2};
Loaded 'C:\Windows\SYSTEM32\ntdll.dll'. Symbols loaded.
Loaded 'C:\Windows\System32\kernel32.dll'. Symbols loaded.
Loaded 'C:\Windows\System32\KernelBase.dll'. Symbols loaded.
Loaded 'C:\Program Files\SentinelOne\Sentinel Agent 22.2.4.558\InProcessClient64.dll'. Symbols loaded.
Loaded 'C:\Windows\System32\advapi32.dll'. Symbols loaded.
Loaded 'C:\Windows\System32\msvcrt.dll'. Symbols loaded.
Loaded 'C:\Windows\System32\sechost.dll'. Symbols loaded.
Loaded 'C:\Windows\System32\rpcrt4.dll'. Symbols loaded.
Loaded 'C:\msys64\mingw64\bin\libgcc_s_seh-1.dll'. Symbols loaded.
Loaded 'C:\msys64\mingw64\bin\libstdc++-6.dll'. Symbols loaded.
Loaded 'C:\msys64\mingw64\bin\libwinpthread-1.dll'. Symbols loaded.

Thread 1 hit Breakpoint 4, calcualteSkyLine (skyline=std::vector of length 11, capacity 11 = {...}) at C:\dev\my\cpp\mingw_projects\Questions\Q4\main.cpp:37
37	    int brushCount = 0;
Execute debugger commands using "-exec <command>", for example "-exec info registers" will list registers in use (when GDB is the debugger)
[New Thread 1116.0x5434]

Thread 1 hit Breakpoint 8, calcualteSkyLine (skyline=std::vector of length 11, capacity 11 = {...}) at C:\dev\my\cpp\mingw_projects\Questions\Q4\main.cpp:42
42	        if(elm > prevHeight)

Thread 1 hit Breakpoint 8, calcualteSkyLine (skyline=std::vector of length 11, capacity 11 = {...}) at C:\dev\my\cpp\mingw_projects\Questions\Q4\main.cpp:42
42	        if(elm > prevHeight)

Thread 1 hit Breakpoint 8, calcualteSkyLine (skyline=std::vector of length 11, capacity 11 = {...}) at C:\dev\my\cpp\mingw_projects\Questions\Q4\main.cpp:42
42	        if(elm > prevHeight)

Thread 1 hit Breakpoint 8, calcualteSkyLine (skyline=std::vector of length 11, capacity 11 = {...}) at C:\dev\my\cpp\mingw_projects\Questions\Q4\main.cpp:42
42	        if(elm > prevHeight)

Thread 1 hit Breakpoint 8, calcualteSkyLine (skyline=std::vector of length 11, capacity 11 = {...}) at C:\dev\my\cpp\mingw_projects\Questions\Q4\main.cpp:42
42	        if(elm > prevHeight)

Thread 1 hit Breakpoint 8, calcualteSkyLine (skyline=std::vector of length 11, capacity 11 = {...}) at C:\dev\my\cpp\mingw_projects\Questions\Q4\main.cpp:42
42	        if(elm > prevHeight)

Thread 1 hit Breakpoint 8, calcualteSkyLine (skyline=std::vector of length 11, capacity 11 = {...}) at C:\dev\my\cpp\mingw_projects\Questions\Q4\main.cpp:42
42	        if(elm > prevHeight)

Thread 1 hit Breakpoint 8, calcualteSkyLine (skyline=std::vector of length 11, capacity 11 = {...}) at C:\dev\my\cpp\mingw_projects\Questions\Q4\main.cpp:42
42	        if(elm > prevHeight)

Thread 1 hit Breakpoint 8, calcualteSkyLine (skyline=std::vector of length 11, capacity 11 = {...}) at C:\dev\my\cpp\mingw_projects\Questions\Q4\main.cpp:42
42	        if(elm > prevHeight)

Thread 1 hit Breakpoint 8, calcualteSkyLine (skyline=std::vector of length 11, capacity 11 = {...}) at C:\dev\my\cpp\mingw_projects\Questions\Q4\main.cpp:42
42	        if(elm > prevHeight)

Thread 1 hit Breakpoint 8, calcualteSkyLine (skyline=std::vector of length 11, capacity 11 = {...}) at C:\dev\my\cpp\mingw_projects\Questions\Q4\main.cpp:42
42	        if(elm > prevHeight)

Thread 1 hit Breakpoint 9, calcualteSkyLine (skyline=std::vector of length 11, capacity 11 = {...}) at C:\dev\my\cpp\mingw_projects\Questions\Q4\main.cpp:48
48	    return brushCount;

Thread 1 hit Breakpoint 6, calcualteSkyLine (skyline=std::vector of length 11, capacity 11 = {...}) at C:\dev\my\cpp\mingw_projects\Questions\Q4\main.cpp:49
49	}
[Thread 1116.0x5434 exited with code 0]
[Thread 1116.0x3448 exited with code 0]
[Thread 1116.0x12c exited with code 0]
[Thread 1116.0x1d04 exited with code 0]
[Inferior 1 (process 1116) exited normally]
The program 'c:\dev\my\cpp\mingw_projects\Questions\Q4\main.exe' has exited with code 0 (0x00000000).
Other Extensions

No response

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

Inizia riproducendo gli arresti segnalati con il codice sorgente C++ fornito, la configurazione di avvio, l’attività di build, GDB 12.1 e l’ambiente Windows 10. Confronta i log del debugger con i breakpoint configurati in VS Code e determina perché l’esecuzione si arresta alle righe 42, 48 e 49. Il lavoro è completato quando il debugger si arresta solo sui breakpoint impostati dall’utente, preservando al contempo il normale comportamento dello stepping e dei breakpoint.

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
Abbastanza chiara
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.