klonyyy / STMViewer

Real-time STM32 variable & trace viewer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add drop-down-list to select a variable to watch

wimalopaan opened this issue · comments

One has to manually enter the full name (mangled) of a variable to watch. If one use C++ with templates this is tedious, because one has to look into the .elf-file to get the mangled names: e.g. _ZN4GFSMI7DevicesI10ESC_FOC_016ConfigN3Mcu3Stm9Stm32G431EEE10mDebugTickE is such a name in my case.

It would be beautiful to get a drop-down-list with the de-mangled names: e.g. GFSM<Devices<ESC_FOC_01, Config, Mcu::Stm::Stm32G431> >::mDebugTick

It should be possible to just use the object instance name, without specyfing template parameters - have you tried that? A simplified example that I could try would be helpful as well.

In the above example GFSM<Devices<ESC_FOC_01, Config, Mcu::Stm::Stm32G431> > is the instantiated template and mDebug is a static member inside of that template-class. Do you mean, the name mDebug will suffice?

I mean if you have an object instance for example GFSM<Devices<ESC_FOC_01, Config, Mcu::Stm::Stm32G431> > test; you should be able to use test.mDebug.

I mean if you have an object instance for example GFSM<Devices<ESC_FOC_01, Config, Mcu::Stm::Stm32G431> > test; you should be able to use test.mDebug.

Ok, now I understand.
No, there is no instance of that template-class: all its members are static.

Would it be passible to get a drop-down-list of all objects with static storage for the menu from the .elf-file using de-mangled names? This would be very helpful. If you need an example, I will provide one.

I think I was able to reproduce it, thanks. For now it its not possible, however I will look for an easy solution if there is one. If you want to quickly show some data, you can consider copying it's value to a global variable. I'm aware its ugly but maybe this is something that will make your work faster.

Well, that would be possible, but I think, I stick to the way copying the name from the .elf file.

Maybe another way would be to generate the STMViewer-config-file via some script parsing the .elf.

This might be also helpful. Basically use gdb's autocomplete (so that you get all the types right) and then copy and paste the full name. Just tried it and it works fine:
image

BTW: I'll be working on a window that lists all variables and lets you pick the ones you want, but this is not a simple and quick task ;)