microsoft / microsoft/vscode-cpptools

VScode debugging with GDB doesn't show vector or map contents from header files

Abierto
#7,771 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

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

Descripción

Describe the bug

  • OS and Version: Windows 10
  • VS Code Version: 1.57.1
  • C/C++ Extension Version: 1.5.0 insiders3
    When debugging with gbd(mingw64 latest version of Sourceforge) and trying to access variables from header files(.hpp), it says:
    can not access memory

To Reproduce
Please include a code sample and launch.json configuration.
Steps to reproduce the behavior:
Use a C++ file with a .hpp file
add a vector or map as part of the header file
debug with gdb(with pretty printing enabled)
try taking a look the vector contents

lanuch.json
{
    // 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}\\bin\\EnderKnightShell.exe",
        "args": [],
        "stopAtEntry": false,
        "cwd": "${workspaceFolder}",
        "environment": [],
        "externalConsole": false,
        "MIMode": "gdb",
        "miDebuggerPath": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin\\gdb.exe",
        "setupCommands": [
            {
                "description": "Enable pretty-printing for gdb",
                "text": "-enable-pretty-printing",
                "ignoreFailures": true
            }
        ],
        "preLaunchTask": "build"
    }
    
    ]
    
}

Additional context
part of the log(I can't copy the full thing)

1: (5403) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (5403) 1066: elapsed time 14\r\n"},"seq":1396}
1: (5403) 1066: elapsed time 14
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (5403) ->&\"\\n\"\r\n"},"seq":1398}
1: (5403) ->&"\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (5403) ->^done\r\n"},"seq":1400}
1: (5403) ->^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (5403) ->(gdb)\r\n"},"seq":1402}
1: (5403) ->(gdb)
--> R (variables-20): {"type":"response","request_seq":20,"success":true,"command":"variables","body":{"variables":[{"name":"eklexer","value":"{...}","type":"lex::Lexer","evaluateName":"eklexer","variablesReference":1003},{"name":"var","value":"0","type":"int","evaluateName":"var","variablesReference":0,"memoryReference":"0x0000000000000000"},{"name":"DebugTokens","value":"{...}","type":"std::vector<std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::allocator<std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > > >","evaluateName":"DebugTokens","variablesReference":1004},{"name":"argc","value":"1","type":"int","evaluateName":"argc","variablesReference":0,"memoryReference":"0x0000000000000001"},{"name":"argv","value":"0x11b1870","type":"char **","evaluateName":"argv","variablesReference":1005,"memoryReference":"0x00000000011b1870"}]},"seq":1404}```

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

Comience reproduciendo el problema en Windows 10 con el launch.json proporcionado, MinGW-w64 GDB y un archivo de código fuente C++ que utilice valores de vector o map de un archivo .hpp. Compare el comportamiento del depurador para la variable DebugTokens y considere resuelto el problema cuando el contenido de su contenedor se muestre correctamente.

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

Evaluación

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

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.