Skip to content

Variables are not displayed in the VARIABLES debug pane #2822

@felias-fogg

Description

@felias-fogg

Describe the problem

After starting debugging, global variables with addresses equal to the start of the .bss and .data segments are not displayed in the VARIABLES debugging pane.

To reproduce

I will describe three ways to reproduce the problem. The first one uses standard Arduino software only with additional hardware, the second uses additional software tools with extra hardware, and the third one uses software only; however, some software is 3rd party.

Use the sketch below.

#define LED LED_BUILTIN
byte thisByte = 0;
byte otherByte = 0;
byte store[2] = {1,2};
byte hiddenByte;
byte hiddenStore[2] = {1,2};

void setup() {
  pinMode(LED, OUTPUT);
}

void loop() {
  int i=digitalRead(1)+20;
  digitalWrite(LED, HIGH);  
  delay(1000); 
  thisByte = thisByte + i + store[i%2];
  digitalWrite(LED, LOW);      
  thisByte = thisByte + i + 1 + hiddenByte + hiddenStore[i%2];
  i = i*5;
  thisByte = thisByte - 3;
  otherByte = thisByte;
  delay(100+thisByte+otherByte);
}
  1. Use Arduino Zero: Select the right board in the boards manager. (Compile and) upload sketch and start debugging. Click on Pause in the Debugging Control Panel. Click on Global in the Variables pane. hiddenSort is not displayed. As one can verify using arm-none-eabi-objdump -x, the address of hiddenSort coincides with the .data segment. There is no variable with an address coinciding with the .bss segment.
  2. Use Atmega328P Xplained Mini (or 168PB or 328PB): Add https://felias-fogg.github.io/package_debugging_index.json to the list of Additional boards manager URLs. Install the additional core Atmel AVR Xplained-minis (Debug enabled) in the Boards manager. In the boards manager, select the appropriate board. In the Tools menu select Compiler LTO and choose LTO disabled, in order to enable that global variables are displayed (I believe that this is another bug!). Compile and start debugging. Click on Global in the Variables pane. hiddenStore and hiddenByte are not displayed. As one can verify using avr-objdump -x, the address of hiddenStore coincides with the .data segment and the address of hiddenByte coincides with the .bss segment.
  3. Use simavr simulator: Do everything as described in (2), but stop before "Compile and start debugging". Choose Simulator (simavr) as the Programmer in the Tools menu. Now compile and start debugging. Then continue as described in (2), which will have the same outcome.

Expected behavior

The expected behavior is that the variables hiddenByte and hiddenStore are displayed.

Arduino IDE version

2.3.7-nightly

Operating system

macOS

Operating system version

15.7.1

Additional context

Mac mini M2 (not that this matters)

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest nightly build
  • My report contains all necessary details

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions