cortex-debug icon indicating copy to clipboard operation
cortex-debug copied to clipboard

Spurious newlines in semihosting debug output

Open TomCrypto opened this issue 6 years ago • 1 comments

I'm not sure if this is the same as #115 (it certainly seems related) but any semihosting operation from the device seems to automatically append a newline in the debug output window regardless of whether or not a newline was requested. The result is that string interpolation code on the device e.g. string formatting that has to do multiple semihosting write calls end up producing output that's broken up like this .

The problem doesn't arise with a normal GDB session so I think this is coming from the extension, and makes it very hard to parse debugging output at a glance from the debug output window.

TomCrypto avatar Aug 05 '19 03:08 TomCrypto

I've run into the same issue. I'm using J-Link as the server and when I run this all separately in two different terminals I get an output like I would expect. As an example:

X-axis: -0.0031738281

If I use this extension, I get this as an output:

X-axis: 
-
0.
00
31738281

After enough print statements, the output window basically becomes unreadable. This is my launch.json file:

{
  "name": "Cortex Debug",
  "cwd": "${workspaceRoot}",
  "executable": "${workspaceFolder}/stm32f4-rust",
  "device": "stm32f407vg",
  "request": "launch",
  "type": "cortex-debug",
  "servertype": "jlink",
  "interface": "swd",
  "runToMain": true,
  "postLaunchCommands": [
    "monitor semihosting enable",
    "monitor semihosting ioclient 2"
  ],
  "swoConfig": {
    "source": "probe",
    "enabled": true,
    "swoFrequency": 2000000,
    "cpuFrequency": 168000000,
    "decoders": [
      {
        "port": 0,
        "label": "ITM",
        "type": "console"
      }
    ]
  }
}
`

senorclean avatar Feb 24 '21 04:02 senorclean