Skip to content

Cannot pause debugger on Linux #807

Open

Description

  • VSCode Version: Code - Insiders 1.14.0-insider (42ede266aa9ce62e258d54e73576642ab684eb43, 2017-06-06T05:11:05.627Z)
  • OS Version: Linux x64 4.8.0-53-generic
  • Extensions:
Extension Author Version
code-gnu-global austin 0.2.2
gitlens eamodio 3.6.1
cpptools ms-vscode 0.11.4

Steps to Reproduce:

Log from DEBUG CONSOLE:

C pause: {"threadId":57005}
 R: {"success":true,"message":null,"request_seq":12,"command":"pause","body":null,"running":false,"refs":null,"seq":0,"type":"response"}

Clone of microsoft/vscode#28246. Wasn't sure which repo was appropriate for this ticket.

Activity

  1. pieandcakes commented on Jun 8, 2017

    @pieandcakes
    Contributor

    Can you set breakpoints? the log looks like it paused. Does the UI look like its still running?

  2. AlanRosenthal commented on Jun 8, 2017

    @AlanRosenthal
    Author

    It doesn't actually pause the CPU.
    I can set only set breakpoints before the debugger starts or when its already halted at another breakpoint.

    This is the log when trying to set a breakpoint when the cpu isn't halted:

    C setBreakpoints: {"source":{"path":"/home/arosenthal/Documents/code/path/to/file.c","name":"file.c"},"lines":[47],"breakpoints":[{"line":47}],"sourceModified":false}
     R: {"success":true,"message":null,"request_seq":19,"command":"setBreakpoints","body":{"breakpoints":[{"id":1,"verified":true,"line":47,"message":null}]},"running":false,"refs":null,"seq":0,"type":"response"}
    E breakpoint: {"reason":"changed","breakpoint":{"id":1,"verified":false,"line":47,"message":"Attempting to bind the breakpoint...."},"type":"breakpoint"}
    1: (42477) ->~"\nProgram received signal "
    1: (42478) ->~"SIGTRAP, Trace/breakpoint trap.\n"
    E output: {"category":"stdout","output":"\nProgram received signal ","data":null,"type":"output"}
    
  3. pieandcakes commented on Jun 8, 2017

    @pieandcakes
    Contributor

    Alan Rosenthal (@AlanRosenthal) was this working before?

  4. AlanRosenthal commented on Jun 8, 2017

    @AlanRosenthal
    Author

    It was working on Windows, not on Linux.

  5. pieandcakes commented on Jun 8, 2017

    @pieandcakes
    Contributor

    Which version of Linux is this? it says Linux x64 generic. I have Ubuntu but I can't repro this.

  6. AlanRosenthal commented on Jun 8, 2017

    @AlanRosenthal
    Author

    This is the log when trying (and succeeding) to set a breakpoint when the cpu IS halted:

    C setBreakpoints: {"source":{"path":"/home/arosenthal/path/to/file.c","name":"file.c"},"lines":[445],"breakpoints":[{"line":445}],"sourceModified":false}
    1: (34465) <-1020-break-insert -f file.c:445
    1: (34469) ->1020^done,bkpt={number="3",type="breakpoint",disp="keep",enabled="y",addr="0x600168b8",func="Function",file="../../../path/to/file.c",fullname="/home/arosenthal/path/to/file.c",line="445",thread-groups=["i1"],times="0",original-location="file.c:445"}
    1: (34469) ->(gdb)
    1: (34470) 1020: elapsed time 5
     R: {"success":true,"message":null,"request_seq":20,"command":"setBreakpoints","body":{"breakpoints":[{"id":2,"verified":true,"line":445,"message":null}]},"running":false,"refs":null,"seq":0,"type":"response"}
    E breakpoint: {"reason":"changed","breakpoint":{"id":2,"verified":true,"line":445,"message":null},"type":"breakpoint"}
    
  7. AlanRosenthal commented on Jun 8, 2017

    @AlanRosenthal
    Author
    arosenthal@alan-lenovo-ubuntu:~$ lsb_release -a
    No LSB modules are available.
    Distributor ID:	Ubuntu
    Description:	Ubuntu 16.04.2 LTS
    Release:	16.04
    Codename:	xenial
    
  8. AlanRosenthal commented on Jun 8, 2017

    @AlanRosenthal
    Author
    arosenthal@alan-lenovo-ubuntu:~$ arm-none-eabi-gdb-py --version
    GNU gdb (GNU Tools for ARM Embedded Processors) 7.10.1.20151217-cvs
    Copyright (C) 2015 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 "--host=i686-linux-gnu --target=arm-none-eabi".
    Type "show configuration" for configuration details.
    For bug reporting instructions, please see:
    <http://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".
    
  9. pieandcakes commented on Jun 8, 2017

    @pieandcakes
    Contributor

    I'll have to see if I can find an arm Linux device here so I can test this.

  10. AlanRosenthal commented on Jun 8, 2017

    @AlanRosenthal
    Author

    in case you need my launch.json: #792 (comment)

  11. pieandcakes commented on Jun 8, 2017

    @pieandcakes
    Contributor
  12. partyzzzan commented on Oct 11, 2017

    @partyzzzan

    Pierson Lee (@pieandcakes) I have same situation, I cannot pause debugger or set breakpoints while it's running.

    Same log I got when I tried to pause:

    C pause: {"threadId":-2}
     R: {"success":true,"message":null,"request_seq":11,"command":"pause","body":null,"running":false,"refs":null,"seq":0,"type":"response"}
    

    VS Code Version 1.17.0
    OS version:

          System Version: macOS 10.12.6 (16G29)
          Kernel Version: Darwin 16.7.0
    

    I tried to use following versions of arm gdb:

    GNU gdb (GNU Tools for ARM Embedded Processors 6-2017-q1-update) 7.12.1.20170215-git
    This GDB was configured as "--host=x86_64-apple-darwin10 --target=arm-none-eabi".
    

    and

    GNU gdb (GNU Tools for ARM Embedded Processors) 7.10.1.20160923-cvs
    This GDB was configured as "--host=x86_64-apple-darwin10 --target=arm-none-eabi".
    

    launch.json:

    {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "Debug",
                "type": "cppdbg",
                "request": "launch",
                "targetArchitecture": "arm",
                "MIMode": "gdb",
                "miDebuggerPath": "/usr/local/bin/arm-none-eabi-gdb",
                "debugServerPath": "/usr/local/bin/openocd",
                "debugServerArgs": "-f ${workspaceRoot}/oocd_stlink.cfg",
                "program":"${workspaceRoot}/build/mcuboard.elf",
                "setupCommands": [
                    { "text": "target remote localhost:3333" },
                    { "text": "file ${workspaceRoot}/build/mcuboard.elf" },
                    { "text": "monitor reset init" },
                    { "text": "mon reg"},
                    { "text": "info frame"}
                ],
                "stopAtEntry": true,
                "serverStarted": "Info\\ :\\ [\\w\\d\\.]*:\\ hardware",
                "cwd": "${workspaceRoot}",
                "filterStderr": true,
                "filterStdout": false,
                "logging": { "trace": true, "traceResponse": true, "engineLogging": true }
            }
        ]
    }
    
  13. pieandcakes commented on Oct 12, 2017

    @pieandcakes
    Contributor

    partyzan (@partyzzzan) Can you enable "engineLogging": true in your logging block and let me know what you get back? It looks like we request to pause the debugger and the fact that you get a success message means gdb is telling us you have paused.

    Setting breakpoints while running is a different issue than pausing.

  14. 10 remaining items

  15. noizex commented on Apr 23, 2019

    @noizex

    Sorry Kiwi (@kiwi616), I haven't worked on it since encountering the issue - decided to give it some time, as maybe it was some intermittent issue that will get fixed. I see it's still a problem there? I will try to come back to my debugger and see if I still have the same problem.

  16. duddie commented on Oct 29, 2019

    @duddie

    Hi, has anyone sorted it out?

  17. mguc commented on Apr 7, 2020

    @mguc

    Is there any progress on this issue? I'm working with openocd (0.10.0) and GNU gdb (GNU Tools for Arm Embedded Processors 9-2019-q4-major) and I'm having the same problem with vscode 1.43.2.

  18. pieandcakes commented on Apr 8, 2020

    @pieandcakes
    Contributor
  19. eurijk commented on Sep 23, 2020

    @eurijk

    I'm seeing this on VSCode 1.49.1 using cppdbg if you start without any breakpoints and have stopAtEntry set to false.

    I am able to see the CALL STACK, click on a thread, then pause via that means, or hot add a breakpoint, but it is strange behavior to not have the main pause button available.

  20. stansotn commented on Oct 22, 2020

    @stansotn

    I am having the same issue when debugging a remote embedded target. Every time I run gdb in a terminal, everything works fine, that is I can ctrl+c interrupt any time and read the registers, memory etc.. When debugging in vscode, pause button does nothing, there is no way to interrupt execution, though breakpoints work fine.

    Am I doing anything wrong? Please let me know if you would like more info. This is a very crucial issue for me.

    Edit: I tried with different debugger probes (jlink and stlink each has its own gdb server) and the issue persists. I think it has to do with vscode communicating to arm-none-eabi-gdb (aka arm embedded debugger).

    vscode version

    Version: 1.50.1
    Commit: d2e414d9e4239a252d1ab117bd7067f125afd80a
    Date: 2020-10-13T14:53:05.704Z
    Electron: 9.2.1
    Chrome: 83.0.4103.122
    Node.js: 12.14.1
    V8: 8.3.110.13-electron.0
    OS: Darwin x64 19.6.0
    

    launch file

    "version": "0.2.0",
        "configurations": [
            {
                "name": "debug",
                "type": "cppdbg",
                "request": "launch",
                "program": "${workspaceRoot}/build/Debug/bin/windrider.elf",
                "miDebuggerPath": "/Applications/ARM/bin/arm-none-eabi-gdb",
                "cwd": "${workspaceRoot}",
                "MIMode": "gdb",
                "externalConsole": true,
                "setupCommands": [
                    {
                        "description": "Enable pretty-printing for gdb",
                        "text": "-enable-pretty-printing",
                        "ignoreFailures": true
                    },
                    {
                        "description": "Connect to gdb server",
                        "text": "target remote localhost:61234"
                    },
                    {
                        "description": "load executable",
                        "text": "file ${workspaceRoot}/build/Debug/bin/windrider.elf"
                    },
                    {
                        "description": "Flash Firmware, Reset and Halt Target",
                        "text": "load"
                    },
                ]
            }
        ]
  21. lkrzysciak commented on Oct 22, 2020

    @lkrzysciak

    Add to launch.json file debugServerPath and debugServerArgs parameters in order to run gdb server with the plugin. I had the same issue before that.

    My launch.json file

    {
        // 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 app",
                "type": "cppdbg",
                "request": "launch",
                "program": "${command:cmake.launchTargetPath}",
                "args": [],
                "stopAtEntry": true,
                "cwd": "${workspaceFolder}",
                "environment": [],
                "externalConsole": false,
                "MIMode": "gdb",
                "miDebuggerPath": "/usr/bin/gdb-multiarch",
                // "miDebuggerServerAddress": "localhost:2331",
                "debugServerPath": "JLinkGDBServer",
                "debugServerArgs": "-device STM32F042K6 -halt",
                "logging": { "engineLogging": false, "trace": false, "traceResponse": false },
                "preLaunchTask": "Deploy",
                "setupCommands": [
                    {
                        "description": "Enable pretty-printing for gdb",
                        "text": "-enable-pretty-printing",
                        "ignoreFailures": true
                    },
                    {"text": "target remote localhost:2331" },
                    {"text": "tbreak main"},
                    {"text": "monitor halt"},
                    {"text": "monitor reset"},           
                ],
            }
        ]
    }
    

    It was tested with arm-none-eabi-gdb debugger as well.

  22. stansotn commented on Oct 23, 2020

    @stansotn

    @lukas9409 Amazing! Thank you, it works! What's wrong with running the gdb server in a separate terminal?

  23. lkrzysciak commented on Oct 23, 2020

    @lkrzysciak

    Frankly speaking I don't know. That's really good question for the plugin development team. I suppose that plugin need to know it is remote session. If you set miDebuggerServerAddress (you can delete debugServerPath and debugServerArgs) it still works. However this solution is not enough for me, due to setupCommands are called before remote connection (the monitor commands only works with remotes).

    To sum up, it isn't the correct solution, but rather workaround of issue. If you run a gdbserver on remote machine (connection via network) it fails.

    BTW: Adding setupCommands to connected remote (after target remote command) would be a nice feature!

  24. biboc commented on Mar 26, 2021

    @biboc

    I made it work by using Cortex-Debug 0.3.12 extension.
    The extension launch gdb server as well, it is the same as @lukas9409 mentioned earlier

    Here is my launch.json if it can help:

    {
        "version": "0.2.0",
        "configurations": [
            {
                "type": "cortex-debug",
                "request": "launch",
                "name": "Debug (OpenOCD)",
                "servertype": "openocd",
                "cwd": "${workspaceRoot}",
                "runToMain": true,
                "executable": "bin/hello-world.elf",
                "device": "DEVICE_NAME",
                "configFiles": [
                    "dist/openocd.cfg"
                ],
                "swoConfig": {
                    "enabled": true,
                    "cpuFrequency": 8000000,
                    "swoFrequency": 2000000,
                    "source": "probe",
                    "decoders": [
                        { "type": "console", "label": "ITM", "port": 0 }
                    ]
                }
            }
        ]
    }
    

    Play/Pause works

  25. stansotn commented on Mar 27, 2021

    @stansotn

    Cortex-Debug works for me too, but it's very specific with the devices it supports. The point here is that the native vscode cpptools extension should be agnostic to the flavor of the remote gdb server.

  26. lygstate commented on Jun 24, 2021

    @lygstate
    Contributor

    Also faced this annoy bug on win32/mingw
    It's seems the cppdbg didn't implement pause instruction properly.

  27. ThoSe1990 commented on Jul 7, 2021

    @ThoSe1990

    same here, cant pause program during execution nor adding breakpoints.

    breakppoints which are added before program execution are recognized, then when a already added breakpoint is reached, it is possible to add other brekapoints, but once i run the programm it isnt possible to add breakpoints anymore.

    when i just try to pause the running porgramm, i need to kill the task because stopping via the stop button doesnt work as well then....

    ms-vscode.cpptools v1.4.1

    Edit: probelm occured on windows.

  28. seppeon commented on Dec 14, 2021

    @seppeon

    Yeah, same here, with mingw.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions