cancel
Showing results for 
Search instead for 
Did you mean: 

Parsing DWARF and static variables declared in functions?

Ziga STEGU
Associate

Do you plan to add support for parsing static variables declared in functions?

You already need to parse DWARF, maybe add location resolution for this type of variables also.

You do it in STM32CubeIDE:

0690X00000DYdI9QAL.png

We do it externally using pyelftools.

Yes, there is a lot of assumptions in our script (compression, dwarf format,...), but it works in our use case.

Kind regards,

Ziga

Code:0690X00000DYd4vQAD.png

Dwarf parsing useing pyelftools (modified example of https://github.com/eliben/pyelftools/blob/master/examples/dwarf_die_tree.py) to output also all DIE properties

0690X00000DYd6wQAD.png

"current_" is on location:

DW_AT_location = [3, 44, 1, 0, 32]

DW_OP_addr = 0x03, next bytes are in little endian

0x2000012C

1 ACCEPTED SOLUTION

Accepted Solutions
stephane.legargeant
ST Employee

Hello

STM32CubeMonitor uses GDB to parse the elf files. This type of variables are listed in a section "Non-debugging symbols:" which has a different formatting and is skipped by the tool.

As a workaround, you can add the variable manually in the list of variables monitored, or use a global variable for debug purpose.

Best regards

Stephane

View solution in original post

2 REPLIES 2
stephane.legargeant
ST Employee

Hello

STM32CubeMonitor uses GDB to parse the elf files. This type of variables are listed in a section "Non-debugging symbols:" which has a different formatting and is skipped by the tool.

As a workaround, you can add the variable manually in the list of variables monitored, or use a global variable for debug purpose.

Best regards

Stephane

Ziga STEGU
Associate

Hi,

thank you for clarifying.

Multiple functions can have same variable name. So name is not unique identifier.

Makes sense.