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

"Import Variables" shows non-existent array contents at index 1 but none at index 0 #101

Open
amosnier opened this issue Dec 29, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@amosnier
Copy link

Version/Branch:

3650ed7

Operating system:

Xubuntu 24.04.1 LTS

Debug probe:

ST-LINK V3

Microcontroller:

STM32G431RB

Details:

Maybe there is a simpler way to reproduce this, I'm not sure. But I'm hoping it's still fairly easy with the instructions below.

Prerequisites: have ninja, arm-none-eabi-gcc and a fairly new cmake on your path. At least these are the obvious dependencies that come to my mind.

How to reproduce the issue:

git clone ssh://[email protected]/amosnier/mcu_viewer_test_case --depth 1
cd mcu_viewer_test_case
cmake --preset debug
cmake --build build-debug/

And then:

  • Open build-debug/st_motor_control_01_eclipse.map. Search for FOCVars. In my case it's at address 0x20000518 with size 0x26. It's an array with a single item that is declared in Src/mc_config.c.
  • Open MCUViewer. Under "Acquisition Settings", pick the built elf file: build-debug/Src/st_motor_control_01_eclipse.elf.
  • Press "Import variables from *.elf". Search for "FOCVars". Only variables under FOCVars[1] starting at address 0x2000053e, which is is 0x20000518 + 0x26, are showed. That seems like a bug, since FOCVars[1] does not exist (but FOCVars[0] does, at address 0x20000518).

Expected behavior: FOCVars[0] is showed instead of FOCVars[1].

Screenshots/Video:

image

@amosnier
Copy link
Author

amosnier commented Dec 29, 2024

I have just realized that the ELF-import function is in beta. I have now tried "Add variable" and "Update variable addresses", and that works fine. I have also not attached the actual ELF-file, but I'm hoping that my instructions more than compensate for that.

@klonyyy
Copy link
Owner

klonyyy commented Dec 31, 2024

Hey! Thank you for a solid issue description - yes this is a known issue to me - seems that gdb lists the arrays based on how they're declared, so the number in the brackets is the number of elements. I need to implement a better array handling. For now the best solution is the one that you've found out.

@klonyyy klonyyy self-assigned this Dec 31, 2024
@klonyyy klonyyy added the bug Something isn't working label Dec 31, 2024
@klonyyy klonyyy moved this to TODO low priority in MCUViewer Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: TODO low priority
Development

No branches or pull requests

2 participants