lvgl / lv_port_pc_vscode

MIT License
217 stars 136 forks source link

Use printf to debug in VS Code #11

Closed HerrAugust closed 2 years ago

HerrAugust commented 2 years ago

Hi all, is there any way to use printf or something similar to debug the code in Visual Studio Code v1.61.1+? Thanks!

microwavesafe commented 2 years ago

printf should just work. Also if you hit F5 it should invoke the debugger where you can set break points and inspect variables.

HerrAugust commented 2 years ago

Thank you! Debugger with break points both work, but printf does not. Maybe there is some hidden window in Visual Studio Code?

microwavesafe commented 2 years ago

I did have an issue with printf when I didn't use the Microsoft C/C++ extension for debugging. It's been a while since I used printf, but it was there under one of the windows. Have you tried checking through all the output / terminal windows?

microwavesafe commented 2 years ago

I just tried it. Interestingly it didn't show without a trailing newline (in my case printf("Hello world\n")). The debugger opened a new terminal window to display it.

Screenshot from 2021-10-20 16-07-43

HerrAugust commented 2 years ago

I confirm it on Ubuntu. To make it work it is necessary to put the \n at the end of printf:

printf("Hello\n");

arilink commented 3 months ago

@HerrAugust @microwavesafe @rzr @SIvaCoHan I use printf("Hello\n"); but it still no log。any body know why?