PlatformIO Community

How to find my GLOBAL variables in PlatformIO debugger?

I managed to get the debugger up and running with the esp-rog JTAG debugger. I am quite happy, except with the Global Variables window (in the upper left part of the screen)

When I expand the “global” heading, a bunch of variables is display, and it makes it very difficult to locate the global variables of my program. Is there a FINS command available? Or can those not-my-own-programs global variables be hidden somehow?

I am using Window 10 (1909), PlatformIO 4.2.1, and Visual Studio Code 1.42.1

With best regards

Volker

Sorry, there is no UI for this case due to limits from VSCode editor.

1 Like

I met the same problem.
What does that mean? Do you mean the global variable was there and VS Code just didn’t show it ?
Then, how to observe the globe variable during debugging ?

And, there is another question:

When I debugging UNO, I found that, the code on board run itself, no matter I set breakpoint or not. That is to say, my debugging operation - “step xxx” doesn’t control the process on board.

You are looking at a 2 year old answer. Local, global and static (compilation-unit global variables) are already shown in the debugger.

grafik

How did you manage to debug a real Uno board? PlatformIO only has support for the simavr simulator, no real debugger.

I saw there was 3 problems in your snapshot, what were they? Were they all irrelevant

They are irrelevant to debugging because these are not compile errors. VSCode’s C++ Intellisense thinks these are C++ errors when they actually arent; it just cannot comprehend the code correctly.

grafik

In this case it doesn’t understand GCC’s __attribute__((constructor(101))). Since it compiles, it can be debugged, so that has nothing to do with being able to see variables in the debugger.

I want to use simavr in vs code by platformIO extension, and I found this page has some usage:

http://fabricesalvaire.github.io/simavr/gitorious-get-started.html

my question is:

in “### 2.3.1.4. Debug with GDB
TBD”

what does “TBD” mean ?

Well, that documentation and repository are very old and shouldn’t be used as a reference anymore, so better use the official repository. Also, the version of simavr that PlatformIO includes is based on that repository plus a couple of mods from my fork.

@maxgerhardt
It is possible to debug a real Arduino board even without an external debugger circuit through the avr_debug library. Also, I already got experimental support for the mentioned library into my fork of the atmelavr platform and probably will create a PR in the following days

1 Like

I am trying to debug Arduino UNO project by simavr in vs code on ubuntu, what I have done was:

1、install VS Code
2、install “platformIO” extension in vs code
3、sudo apt-get install simavr
4、added in “platformio.ini”:
[env:myenv]
platform = atmelavr
board = uno
debug_tool = simavr

5、sudo apt-get install gcc make
6、sudo apt-get install gcc-avr avr-libc
7、sudo apt-get install libelf-dev
8、sudo apt-get install freeglut3 freeglut3-dev

how about next ?

There is no need to compile or install the ubuntu version, PlatformIO already comes with its own binaries. You only need to press F5 to start the debug session and it will also install the simavr package if it wasn’t already installed.

1 Like

It seemed that, platformIO could run itself, so what’s the function of VS Code ?
I saw even in the homepage of https://platformio .org, it was recommended that VS Code be installed first, if I haven’t installed VS Code, what would happen ? could I also debug Arduino UNO project in it ?

…to have a GUI interface to an otherwise CLI only program?

pio debug commands are also accessible from the CLI (https://docs.platformio.org/en/latest/core/userguide/cmd_debug.html)

1 Like