microsoft / microsoft/vscode-cpptools

Unjustified "Trace/breakpoint trap" with GDB server

Open
#1,298 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

debugger embedded
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

First of all thank you for all this work, it's great.
I'm using vscode+cpptools+IAR extension to deveolp embedded device software.
Everything is working fine (with the already known limitation), but there's an issue that I'm not able to identify.
The issue is present always, and could be reproduced in the following ways:

-Each time I launch the server, and no breakpoint are set before the main (that is not the real entry point), I get a Trace/breakpoint trap and the program stop at it. stopAtEntry settings makes no difference.

-Each time I press pause the program correctly stop at the point where it's running, however it generates again Trace/breakpoint trap, even if it knows that it was me requiring the program to pause.

-Each time I set a breakpoint while the program is running, and the breakpoint is far enough from PC, I get a Trace/breakpoint trap in the exact same way as I I had pressed pause.

Since this behaviour is the same on Visual Studio 2017 my first guess is that it has to do to some IPC being out of sync and looked at the common denominator: the MIEngine. I tried then to debug the MIEngine as described in cpptools documentation folder, but cpptools failed to start with the my newly produced binary (sign required?).

The debugger and GDB server I'm using is JLink, and vscode and vscode-cpptools are updated.

This is the launch.json configuration file, I think that it would be easy to reproduce by just using a different binary and a jlink.

{
  "version": "0.2.1",
  "configurations": [
    {
      "name": "Debug J-Link",
      "type": "cppdbg",
      "request": "launch",
      "program": "${workspaceRoot}/project/build/debug/project.out",
      "stopAtEntry": true,
      "cwd": "${workspaceRoot}",
      "externalConsole": false,
      "MIMode": "gdb",
      "miDebuggerPath": "arm-none-eabi-gdb.exe",
      "debugServerPath": "JLinkGDBServerCL.exe",
      "debugServerArgs": "-if swd -singlerun -strict -endian little -speed auto -port 3333 -device STM32F303VE -vd -halt",
      "serverStarted": "Connected\\ to\\ target",
      "targetArchitecture": "arm",
      "serverLaunchTimeout": 5000,
      "filterStderr": false,
      "filterStdout": true,
      "logging": {
        "trace": false,
        "traceResponse": false,
        "engineLogging": true
      },
      "setupCommands": [
        {"text": "target remote localhost:3333"},
        {"text": "monitor flash breakpoints = 1"},
        {"text": "monitor flash download = 1"},
        {"text": "monitor reset"},
        {"text": "load project.out"},
        {"text": "monitor reset"}
      ]
    }
  ]
}

Below the screen of the error, and a trace log when I press pause:

pause_trace.txt

pause

main

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the launch.json configuration and pause_trace.txt attached to the issue, then reproduce the behavior using the J-Link GDB server and the listed MIEngine debugging setup. Compare launch, pause, and breakpoint behavior to determine why a Trace/breakpoint trap is reported; done means these actions no longer produce an unjustified trap.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, vscode
Domain
devtools, embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.