microsoft / microsoft/vscode-cpptools

stopAtConnect is not stopping early enough.

Abierto
#13,541 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

bug debugger help wanted
Lenguaje dominante
TypeScript
Estrellas
6.2k
Forks
1.7k
Merge medio
14 h 46 min
PR fusionados (30 d)
61

Descripción

Environment

VS Code version info:

Version: 1.100.0-insider (system setup)
Commit: 1b000ef82b3c3082833f6b04e050bc0e4e12ae3b
Date: 2025-04-18T05:31:28.011Z
Electron: 34.5.1
ElectronBuildId: 11369351
Chromium: 132.0.6834.210
Node.js: 20.19.0
V8: 13.2.152.41-electron.0
OS: Windows_NT x64 10.0.26200

C/C++ extension:

ms-vscode.cpptools
Version
1.24.5
Last Updated
2025-04-18, 08:14:49

OS and version of remote machine (if applicable):

Running VSCode inside WSL w/Ubuntu 22.04

GDB / LLDB version:

GNU gdb (GNU Toolchain for the A-profile Architecture 10.2-2020.11 (arm-10.16)) 10.1.90.20201028-git

Bug Summary and Steps to Reproduce

Bug Summary:

Using WSL + Ubuntu 22.04
I am building an ARM TFA project and attempting to debug it under QEMU.
Everything works fine if I launch QEMU and GDB from the command line.

Now I am trying to launch GDB under VS Code to get a better debugging experience (source & variable display windows)

The GDB command line I use is very simple:

/home/.../bin/aarch64-none-elf-gdb -x launch.gdb /home/.../AARCH64/bl2.elf

launch.gdb has all the instructions necessary to attach to my GDB and set my interesting breakpoints.

Notably launch.gdb does NOT continue execution and QEMU is setup to waiting for the debugger to attach AND continue program execution manually. This is because the part I am trying to debug is in the early boot loader.

I created a tasks.json entry to launch QEMU and that works fine. However, I cannot seem to find a configuration for launch.json which will cause the debugger to attach and then stop.

for example, the normal command-line GDB output is as simple as this:

Reading symbols from /home/.../AARCH64/bl2.elf...
0x0000000080000000 in ?? ()
Breakpoint 1 at 0x80101e28: file io_storage.c, line 63.
Breakpoint 2 at 0x801008e4: file io_storage.c, line 212.
Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal]
(gdb)

However, when I use VSCode, QEMU starts running and goes past the part of the code I want to debug.

Reproducing this is a bit difficult because it requires a qemu and TFA build setup, but I have attached the launch.json & debug console output. Hopefully there will be some clue here.

Appreciate any help

Debugger Configurations

(NOTE: using request:attach doesn't seem to solve my problem either).

launch.json

        {
            "name": "Attach GDB",
            "type": "cppdbg",
            "request": "launch",
            "stopAtConnect": true,
            "cwd": "${workspaceFolder}/test",
            "program": "${workspaceFolder}/Build/.../AARCH64/bl2.elf",
            "MIMode": "gdb",
            "miDebuggerServerAddress": "localhost:1234",
            "miDebuggerPath": "${workspaceFolder}/.../bin/aarch64-none-elf-gdb",
            "miDebuggerArgs": "-x ${workspaceFolder}/test/launch.gdb",
            "preLaunchTask": "Start Qemu And Console",
            "launchCompleteCommand": "None",
            "customLaunchSetupCommands": [
            ],
            "logging": {
                "engineLogging": true
            }
        }


 tasks.json
        {
            "label": "Start Qemu And Console",
            "type": "shell",
            "command": "${workspaceFolder}/debug_session.sh",
            "presentation": {
                "echo": true,
                "reveal": "always",
                "focus": false,
                "panel": "new"
            }
        }
Debugger Logs
Debug Console panel in VSCode displays this (paths redacted)

1: (50) LaunchOptions{"name":"Attach GDB2","type":"cppdbg","request":"launch","stopAtConnect":true,"cwd":"/home/.../test","program":"//home/.../AARCH64/bl2.elf","MIMode":"gdb","miDebuggerServerAddress":"localhost:1234","miDebuggerPath":"/home/.../bin/aarch64-none-elf-gdb","preLaunchTask":"Start Qemu And Console","miDebuggerArgs":"-x /home/.../test/launch.gdb","launchCompleteCommand":"None","customLaunchSetupCommands":[],"logging":{"engineLogging":true},"__configurationTarget":6,"configSource":"workspaceFolder","debugType":"debug","__sessionId":"1b036eb1-0b7f-4782-98ac-2c6760e05dfa"}
1: (81) Starting: "/home/.../bin/aarch64-none-elf-gdb" --interpreter=mi -x /home/.../test/launch.gdb
1: (128) DebuggerPid=199483
1: (162) ->=thread-group-added,id="i1"
1: (166) ->~"GNU gdb (GNU Toolchain for the A-profile Architecture 10.2-2020.11 (arm-10.16)) 10.1.90.20201028-git\n"
1: (166) ->~"Copyright (C) 2020 Free Software Foundation, Inc.\n"
1: (167) ->~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law."
1: (167) ->~"\nType \"show copying\" and \"show warranty\" for details.\n"
1: (167) ->~"This GDB was configured as \"--host=x86_64-pc-linux-gnu --target=aarch64-none-elf\".\n"
1: (167) ->~"Type \"show configuration\" for configuration details.\n"
1: (167) ->~"For bug reporting instructions, please see:\n"
1: (167) ->~"<https://bugs.linaro.org/>.\n"
1: (167) ->~"Find the GDB manual and other documentation resources online at:\n    <http://www.gnu.org/software/gdb/documentation/>."
1: (167) ->~"\n\n"
1: (167) ->~"For help, type \"help\".\n"
1: (167) ->~"Type \"apropos word\" to search for commands related to \"word\".\n"
1: (167) ->=cmd-param-changed,param="print pretty",value="on"
1: (167) ->=thread-group-started,id="i1",pid="1"
1: (168) ->&"warning: No executable has been specified and target does not support\ndetermining executable automatically.  Try using the \"file\" command."
1: (168) ->&"\n"
1: (168) ->=thread-created,id="1",group-id="i1"
1: (168) ->=thread-created,id="2",group-id="i1"
1: (168) ->=thread-created,id="3",group-id="i1"
1: (168) ->=thread-created,id="4",group-id="i1"
1: (168) ->=thread-created,id="5",group-id="i1"
1: (168) ->=thread-created,id="6",group-id="i1"
1: (168) ->=thread-created,id="7",group-id="i1"
1: (168) ->=thread-created,id="8",group-id="i1"
1: (168) ->~"0x0000000080102358 in ?? ()\n"
1: (168) ->*stopped,frame={addr="0x0000000080102358",func="??",args=[],arch="aarch64"},thread-id="1",stopped-threads="all"
1: (168) ->&"No symbol table is loaded.  Use the \"file\" command.\n"
1: (168) ->~"Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal]\n"
1: (168) ->&"No symbol table is loaded.  Use the \"file\" command.\n"
1: (168) ->~"Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal]\n"
1: (168) ->&"No symbol table is loaded.  Use the \"file\" command.\n"
1: (168) ->~"Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal]\n"
1: (168) ->&"No symbol table is loaded.  Use the \"file\" command.\n"
1: (168) ->~"Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal]\n"
1: (168) ->(gdb)
1: (172) <-1001-thread-info 1
1: (174) ->1001^done,threads=[{id="1",target-id="Thread 1.1",details="CPU#0 [halted ]",frame={level="0",addr="0x0000000080102358",func="??",args=[],arch="aarch64"},state="stopped"}]
1: (175) ->(gdb)
1: (177) <-1002-thread-info 2
1: (177) <-1003-thread-info 3
1: (178) <-1004-thread-info 4
1: (178) <-1005-thread-info 5
1: (178) <-1006-thread-info 6
1: (178) <-1007-thread-info 7
1: (178) <-1008-thread-info 8
1: (179) ->1002^done,threads=[{id="2",target-id="Thread 1.2",details="CPU#1 [halted ]",frame={level="0",addr="0x0000000100000004",func="??",args=[],arch="aarch64"},state="stopped"}]
1: (179) ->(gdb)
1: (181) ->1003^done,threads=[{id="3",target-id="Thread 1.3",details="CPU#2 [halted ]",frame={level="0",addr="0x0000000100000004",func="??",args=[],arch="aarch64"},state="stopped"}]
1: (181) ->(gdb)
1: (182) <-1009-gdb-set mi-async on
1: (183) ->1004^done,threads=[{id="4",target-id="Thread 1.4",details="CPU#3 [halted ]",frame={level="0",addr="0x0000000100000004",func="??",args=[],arch="aarch64"},state="stopped"}]
1: (183) ->(gdb)
1: (184) ->1005^done,threads=[{id="5",target-id="Thread 1.5",details="CPU#4 [halted ]",frame={level="0",addr="0x0000000100000004",func="??",args=[],arch="aarch64"},state="stopped"}]
1: (185) ->(gdb)
1: (185) 1001: elapsed time 12
1: (187) ->1006^done,threads=[{id="6",target-id="Thread 1.6",details="CPU#5 [halted ]",frame={level="0",addr="0x0000000100000004",func="??",args=[],arch="aarch64"},state="stopped"}]
1: (187) ->(gdb)
1: (189) ->1007^done,threads=[{id="7",target-id="Thread 1.7",details="CPU#6 [halted ]",frame={level="0",addr="0x0000000100000004",func="??",args=[],arch="aarch64"},state="stopped"}]
1: (189) ->(gdb)
1: (190) 1002: elapsed time 12
1: (190) 1003: elapsed time 13
1: (190) 1004: elapsed time 13
1: (191) 1005: elapsed time 12
1: (191) 1006: elapsed time 12
1: (191) ->1008^done,threads=[{id="8",target-id="Thread 1.8",details="CPU#7 [halted ]",frame={level="0",addr="0x0000000100000004",func="??",args=[],arch="aarch64"},state="stopped"}]
1: (191) ->(gdb)
1: (191) ->1009^error,msg="Cannot change this setting while the inferior is running."
1: (191) ->(gdb)
1: (191) 1007: elapsed time 12
1: (191) 1008: elapsed time 13
1: (191) 1009: elapsed time 8
1: (192) <-1010-gdb-set target-async on
1: (193) ->1010^error,msg="Cannot change this setting while the inferior is running."
1: (193) ->(gdb)
1: (193) 1010: elapsed time 0
1: (197) <-1011-interpreter-exec console "set pagination off"
1: (198) ->=cmd-param-changed,param="pagination",value="off"
1: (198) ->1011^done
1: (198) ->(gdb)
1: (198) 1011: elapsed time 0
1: (198) <-1012-gdb-set auto-solib-add on
1: (199) ->1012^done
1: (199) ->(gdb)
1: (199) 1012: elapsed time 0
1: (199) <-1013-gdb-set solib-search-path //home/.../AARCH64:
1: (199) ->1013^done
1: (199) ->(gdb)
1: (199) 1013: elapsed time 0
1: (200) <-1014-environment-cd /home/.../test
1: (200) ->1014^done
1: (200) ->(gdb)
1: (200) 1014: elapsed time 0
1: (200) <-1015-file-exec-and-symbols //home/.../AARCH64/bl2.elf
1: (204) ->1015^done
1: (204) ->(gdb)
1: (204) 1015: elapsed time 3
1: (205) <-1016-interpreter-exec console "show architecture"
1: (206) ->~"The target architecture is set to \"auto\" (currently \"aarch64\").\n"
1: (206) ->1016^done
1: (206) ->(gdb)
1: (206) 1016: elapsed time 0
1: (207) <-1017-break-insert -f main
1: (208) ->&"Function \"main\" not defined.\n"
1: (209) ->1017^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="main",times="0",original-location="main"}
1: (209) ->(gdb)
1: (209) 1017: elapsed time 1
1: (209) <-1018-target-select remote localhost:1234
1: (210) ->=thread-exited,id="1",group-id="i1"
1: (210) ->=thread-exited,id="2",group-id="i1"
1: (210) ->=thread-exited,id="3",group-id="i1"
1: (210) ->=thread-exited,id="4",group-id="i1"
1: (210) ->=thread-exited,id="5",group-id="i1"
1: (210) ->=thread-exited,id="6",group-id="i1"
1: (210) ->=thread-exited,id="7",group-id="i1"
1: (210) ->=thread-exited,id="8",group-id="i1"
1: (210) ->=thread-group-exited,id="i1"
1: (213) <--gdb-exit
1: (13427) ->1018^error,msg="localhost:1234: Connection timed out."
1: (13428) ->(gdb)
1: (13428) ->^exit
1: (13428) 1018: elapsed time 13218
1: (13431) Send Event AD7MessageEvent
1: (13432) "/home/.../bin/aarch64-none-elf-gdb" exited with code 0 (0x0).
1: (13432) <-logout
1: (13437) Send Event AD7ProgramDestroyEvent
The program '//home/.../AARCH64/bl2.elf' has exited with code 0 (0x00000000).
Other Extensions

No response

Additional Information

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza con la configuración stopAtConnect de launch.json y los Debugger Logs, especialmente con la secuencia en torno a target-select remote localhost:1234 y el tiempo de espera. Compara esa secuencia con el comportamiento previsto de adjuntar y detenerse; el trabajo estará terminado cuando un lanzamiento de cppdbg contra la configuración de QEMU mostrada permanezca detenido de forma fiable al establecer la conexión antes de continuar.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
cpp, ubuntu, vscode
Área
devtools
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.