Vscode-cpptools: GDB Remote Target Debugging: can't see stdout console

Created on 15 Mar 2019  路  5Comments  路  Source: microsoft/vscode-cpptools

Type: Debugger

  • OS and Version: Ubuntu 18.04.2 LTS
  • VS Code Version: 1.32.3
  • C/C++ Extension Version: 0.21.0

I am developing an application that runs on an ARM Cortex-M3 device. I am debugging using Segger JLink. I use JLinkGDBServer and arm-none-eabi-gdb as a client. Debugging works fine, except that I can't see stdout in the console or in an extern terminal. My launch.json configuration is something like this:

"name": "Remote Target - Debug (C/C++ extension)",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder:}/my_program.elf",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands":
[
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{"text": "target remote localhost:2331"},
{"text": "monitor reset"},
{"text": "load ${workspaceFolder}/my_program.elf"},
{"text": "monitor semihosting enable"},
],
"targetArchitecture": "arm",
"miDebuggerPath": "/home/dani/arm_tools/gcc-arm-none-eabi-8-2018-q4-major/bin/arm-none-eabi-gdb",
"debugServerPath": "/usr/bin/JLinkGDBServer",
"debugServerArgs": "-select USB -device STM32F107RC -if SWD -speed auto"

As I said, debugging works perfect. I get an exception when entering main, but I heard that is normal. The thing is that I can't see the output of my printfs anywhere. The only way for me to see the stdout is to launch a telnet session externally: when the program hits the exception on main, I execute telnet localhost 2333 on a terminal, and then I see the stdout there. I have tried to set this up as a preLaunchTask, but I can't, as telnet fails because the GDB server hasn't started yet (if I could execute this task just after GDB launches, then it would work).

Can you help me with the proper configuration?

debugger embedded investigate

All 5 comments

@robotdad Do you have a working configuration for this scenario where the output shows?

Don't know exactly what you mean, I copied my launch configuration in the description. What else do you need?

The output of printfs only shows if, once debugging, I open a new terminal and type telnet localhost 2333. 2333 is the port where JLinkGDBServer is sending stdout.

@dsanz006 Sorry for the confusion, I was contacting another team member who has more experience with the JLinkGDBServer configurations. The question is for him if he has experienced this issue and has a working configuration that he could share.

Hi @WardenGnaw are there any updates on this? Did you talk to your colleague?

This issue has been closed automatically because it has not had recent activity.

Was this page helpful?
0 / 5 - 0 ratings