12-07-2020 06:12 AM
I am looking for a way to improve the readability of objdump disassembly. I am using SDK 2018.2
When looking at the output of arm-none-eabi-objdump -d myappl.elf, I am surprised that only function addresses are resolved to symbols, but no data. If I want to see for example what the compiler did with a global variable, I have to include -t to objdump, find the name, for instance
00200814 l .bss 00000001 globalVar
and then look for a sequence like
120378: e3003814 movw r3, #2068 ; 0x814
12037c: e3403020 movt r3, #32
120380: e3a02001 mov r2, #1
If this is now a larger structure, in code accessing a few different pieces of data, this becomes really tedious. Even attributing accesses to a single data in a larger function is something you quickly give up on. I am also a bit surprised that number literals seem to default to signed decimal integer - not very useful in most cases.
Are there any options, or other tools, that could help me generate better disassembly? Code is compiled with -g3
12-09-2020 12:44 AM
Is the code compiled with -O0 as well? Anyway could you maybe provide a sample code that can be used to reproduce the issue easily? To be honest I don't think there is much more that can be done apart from using -g3 and -O0 but maybe with some testing somebody can figure out bit more verbosity in the GCC dump.
12-09-2020 02:53 AM
Hi @ibaie ,
The code is compiled with -g3. I am really only after the way objdump shows disassembly, for whatever code the compiler generates. In fact, in this particular situation I wanted to compare store and load between different optimization levels.
In my above example, objdump puts the hexadecimal representation of the argument in the comment, where I also would have expected a symbol name. This would be normally the case with other architectures I have worked with. The symbol name is there, as the symbol table shows.
I did not find a solution for referencing data symbols that way. But I have downloaded the latest GCC and binutils from ARM, and discovered the --visualize-jumps option in that objdump version, which also can be quite useful: