Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global variables are not shown for AVR + avr-stub #2334

Open
maxgerhardt opened this issue Jan 29, 2021 · 6 comments
Open

Global variables are not shown for AVR + avr-stub #2334

maxgerhardt opened this issue Jan 29, 2021 · 6 comments
Labels
bug debug PIO Unified Debugger

Comments

@maxgerhardt
Copy link

For the given platformio.ini

[env:uno]
platform = atmelavr
board = uno
framework = arduino
debug_tool = avr-stub
debug_port = \\.\COM14
debug_build_flags = -O0 -ggdb3 -g3
lib_deps =
    jdolinay/avr-debugger @ ~1.1

and creating a simple sketch

#include "Arduino.h"
#include "avr8-stub.h"

volatile int lastAnalogRead = 0;

void setup()
{
  // initialize GDB stub
  debug_init();
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop()
{
  lastAnalogRead = analogRead(A0);
  if(lastAnalogRead > 128) 
      digitalWrite(LED_BUILTIN, HIGH);
  delay(1000);
  digitalWrite(LED_BUILTIN, LOW);
  delay(1000);
}

the global variable lastAnalogRead is not shown

grafik

Although it shows up when doing a info variables command in the GDB console, as also see in the output above.

The error does not change when the debug_build_flags are removed.

The debugger still shows local variables as normal.

grafik

Using latest PlatformIO home and core version.

@ivankravets ivankravets added bug debug PIO Unified Debugger labels Jan 30, 2021
@vtmarvin
Copy link

Had the same problem (cpp development for Arduino UNO), watch tooltip stated that it is "unable to create variable object" and I was not able to see any watched variables in UI.
I tried to add some debug flags and to change port from COM3 to \.\COM3 but with no success.
After playing with platformio.ini a while I gave it up and returned to original configuration I started with and ... it started working at least partially.
image

Now I see variable in watches but not in global/local variables.
Variable was and is still present while using list variables in debug console

My platformio.ini

[env:uno]
platform = atmelavr
board = uno
framework = arduino
debug_tool = avr-stub
debug_port = COM3

; GDB stub implementation
lib_deps =
    jdolinay/avr-debugger @ ~1.1

It still works after restarting VSC/PIO.

@nelsonov
Copy link

I am having exactly the same problem with both an Uno and a Mega2560. Is there a workaround for this?

@Fr33man85
Copy link

1+

@jacksontong
Copy link

same problem

@jfdzar
Copy link

jfdzar commented Feb 9, 2022

Same problem here!

@smwoodward
Copy link

I'm also having the same issue. I can see it under watch and in terminal when I print the variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug debug PIO Unified Debugger
Projects
None yet
Development

No branches or pull requests

8 participants