-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debugging: Unable to halt execution using arm gdb #833
Comments
From @timurey on June 18, 2017 18:30 Have the same issue. |
I just tried "stopAtEntry" and it seems to have no effect whatsoever. arm-none-eabi-gcc -x assembler-with-cpp -c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-sp-d16 -mfloat-abi=hard -O0 -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 For me, execution halts on a breakpoint at the beginning of main regardless of "stopAtEntry" value. I can add multiple breakpoints while the target is halted and they all work. It's just that I cannot halt with the pause button or add new breakpoints anymore while it's running. I would need a way to send ctrl+c to the arm-none-eabi-gdb process. |
@am1ko Can you enable I have seen issues in GDB where it won't allow us to set breakpoints while running in MI mode. |
@pieandcakes logs attached I tried to halt and add breakpoints from vscode when recording the log but I see no log entries written at those times. The breakpoint you see being hit is something that I trigger by controlling the ui of the program being debugged. |
My gcc options: But if I connect to openocd via telnet, I can halting program by |
Result:
in telnet console:
But still can't halt running or add breakpoint. |
vscode version 1.15.1 (1.15.1) After updating vscode and gcc I now see debug output when trying to break. Still does not work though C pause: {"threadId":57005} |
@pieandcakes C evaluate: {"expression":"-exec -gdb-set target-async off","frameId":1000,"context":"repl"} |
If I do I can break the execution successfully form bash by sending SIGINT to the gdb process vscode pause button still doesn't work. |
Did you try using "hardware breakpoint" instead of "software breakpoint" ? |
@pieandcakes, any news on this? |
@robotdad @paulmaybee Is this something you've seen with embedded arm devices and arm gdb with MIEngine? |
In my case, I use arm device, arm-none-eabi-gdb
I'm not able to:
|
@biboc Would you be able to try changing EDIT: actually this won't change the way it works, so ignore this. |
@pieandcakes is there any method that would send SIGINT to the arm-none-eabi-gdb process? I have tested that it works, just don't know how to trigger it from vscode. "I can break the execution successfully form bash by sending SIGINT to the gdb process |
I'm also encountering this issue. Has there been any resolution? |
@iitgrad Can you try my previous response and let me know if this works? |
@pieandcakes can you clarify where/how I should be sending |
@btashton the With the version that was release, |
Interesting. When I run via GDB I am able to halt the processor without an issues. But using the pause button in vscode I get this where the pause does nothing and I eventually hit another breakpoint. 1: (9343) <--exec-continue
1: (9343) ->^running
1: (9344) ->*running,thread-id="all"
1: (9344) ->(gdb)
1: (9344) ->(gdb)
C pause: {"threadId":1073430440}
C pause: {"threadId":1073430440}
1: (20453) ->@"Target halted. PRO_CPU: PC=0x400D206D (active) APP_CPU: PC=0x400E10BE \n"``` |
How are you halting the processor when you are using GDB? |
I send a SIGINT via ctrl-c or kill -2 The output looks like this:
|
@btashton right. That's what we do based on my comment. When you are using gdbserver though I don't think it goes through (but i'll have to check). |
Got it. Unfortunately, that seems to have no effect. |
@BillPlunkett can you try and add
to your |
hahaha, you're one step ahead of me, @pieandcakes. When I add the following: |
@BillPlunkett ok good to know. I'll see if I can get a fix in for next release. |
Awesome, thank you. |
Running into the same issue as @btashton and @BillPlunkett. When I press pause button to interrupt the program, i see the following logged in the console:
Furthermore, when i stop debugging (via the stop button), i see So it seems that the extension is sending SIGINT and SIGKILL to the wrong process somehow? I can reproduce this at will and would love to help fixing this @pieandcakes, if you can give some pointers where to look. |
I'm very willing to help anyway I can in fixing this, too. I am a big fan of VS Code, but currently having to use Eclipse as a GDB front end for remote debug due to this issue. |
@igrr @BillPlunkett the debug adapter code is here and the instructions on how to get it set up are here for this extension. I think there are two parts to this.
Thank you for offering to look into it. |
Thanks for the pointers, @pieandcakes. However I did notice that in Debugger.cs, Looking at CmdBreakInternal, I am not sure whether the case of local gdb and remote gdb server is handled correctly. In all cases, PID is taken from debuggee PIDs, but it should be debugger PID. I.e. we should send the signal to GDB process, which will in turn interrupt the remote. |
I have confirmed (by adding some logging, can't get remote debugging of MIDebug working yet) that Edit: 42000 is the magic value which GDB uses as the PID if the remote target does not support multiprocess extensions and sends only the thread id (https://github.com/bminor/binutils-gdb/blob/417e50dbcfd4b8dd699f48df5ac9b9a733fd80e2/gdb/remote.c#L14834-L14836) |
@igrr Thank you for investigating.
and try your scenario with the updated bits, can you confirm it works? |
With this change it does work on Mac (haven't tested on Linux, assume it's also going to work). I assume that the proper change would be to introduce a new option, However going back to Windows, I can't get a breakpoint in CmdBreakInternal to get hit, when I press the 'pause' button in VS Code. (Breakpoints in various initialisation functions do get hit.) |
It seems that this is fixed by microsoft/MIEngine@ecc1b0e. |
@igrr So it's fixed with 0.24.0? It has an updated MIEngine. |
This seems not yet working either with VS2017 (15.9.19) and VS2019 (16.4.3). Still have to pause through 'kill -2'. |
@dcrivelli this is for the extension for VS Code, not VS. Please open a detailed issue for your scenario on https://github.com/microsoft/miengine with repro steps and i'll look into it. |
hi. any update? I have the same problem |
I am having the same problem with embedded ARM. More details in #807 |
I'm using a different compiler but having the same issue. Remote target is halted but VSCode interface not synced with remote target. |
I also had some difficulty getting 'pause' to work in a remote gdb/gdbserver session. For me, the key was to set MIDebuggerServerAddress to the ip address:port of the gdb server. Without that, everything works fine except pausing the running target. |
VSCode Version: 1.56.2 Steps to Reproduce (same as @am1ko): Quoting am1ko: One addition is that trying to stop the target after pressing "play" with no other breakpoints set does not work. I can kill the gdb process with the pid, and sending a kill -2 works. See launch.json below. |
I meet the same issue, see details #7719 Unable to set breakpoint or pause on a running application with extended-remote connection debug |
There was a long-standing bug (microsoft/vscode-cpptools#833) in the debugger config that is resolved by this commit. Pausing would not work with the previous configuration, which used setupCommands to script the GDB setup and used OpenOCD from within a pipe connection. The cpptools extension did not know it was connected to a remote server, which caused pausing, setting breakpoints, and all sorts of other weird behavior to occur. Launch.json no longer launches OpenOCD from a pipe connection. Instead, it uses the new debugServerPath, debugServerArgs, miDebuggerServerAddress, and serverStarted config options. This tells the cpptools extension how to launch OpenOCD as a server, which gets us the same nice all-in-one launching as the previous method. It should be noted that filterStderr is necessary because OpenOCD outputs to stderr by default. Now, the debugger works perfectly. Flash was removed as a pre-launch task as well in favor of resetting the target micro on startup. The user may not want to re-flash to program every time.
From @am1ko on April 26, 2017 19:21
Steps to Reproduce:
The result is that nothing happens. Any attempt to use the debug console results is
"Unable to perform this action because the process is running."
The way to halt the execution when using command line arm-none-eabi-gdb is to press ctrl-c (SIGINT?). Could this option be added to vscode debugger config?
launch.txt
Copied from original issue: microsoft/vscode#25467
The text was updated successfully, but these errors were encountered: