ebs-universe / fpv-gcc

Analysing GCC generated Map files for measuring code footprint
https://fpv-gcc.readthedocs.io/en/latest/
GNU General Public License v3.0
44 stars 6 forks source link

AttributeError: 'NoneType' object has no attribute 'replace' #7

Open laqieer opened 2 years ago

laqieer commented 2 years ago

Error

Traceback (most recent call last):
  File "/home/laqieer/.local/bin/fpvgcc", line 8, in <module>
    sys.exit(main())
  File "/home/laqieer/.local/lib/python3.9/site-packages/fpvgcc/cli.py", line 227, in main
    state_machine = process_map_file(args.mapfile, profile=profile)
  File "/home/laqieer/.local/lib/python3.9/site-packages/fpvgcc/fpv.py", line 570, in process_map_file
    process_linkermap_line(line, sm)
  File "/home/laqieer/.local/lib/python3.9/site-packages/fpvgcc/fpv.py", line 520, in process_linkermap_line
    process_linkermap_section_headings_line(l, sm)
  File "/home/laqieer/.local/lib/python3.9/site-packages/fpvgcc/fpv.py", line 341, in process_linkermap_section_headings_line
    newnode = linkermap_get_newnode(name, sm, True)
  File "/home/laqieer/.local/lib/python3.9/site-packages/fpvgcc/fpv.py", line 314, in linkermap_get_newnode
    newnodename = objfile.replace('.', '_')
AttributeError: 'NoneType' object has no attribute 'replace'

Version

1.0.0

Mapfile

fe7-jp-stunning-tribble.map.txt

Toolchain

$ dkp-pacman -Qs devkitARM
local/devkitARM r57-8 (gp32-dev gp2x-dev gba-dev nds-dev 3ds-dev)
    Toolchain for gp2x, gp32, Nintendo gba, nds, dsi, (3)ds & switch homebrew development
$ $DEVKITARM/bin/arm-none-eabi-gcc --version
arm-none-eabi-gcc (devkitARM release 57) 11.2.0
$ $DEVKITARM/bin/arm-none-eabi-ld --version
GNU ld (GNU Binutils) 2.37
chintal commented 2 months ago

I'm unsure what is actually wrong here. While the crash is sort of worked around, the resulting data generated is still very wrong. This is stranger still because arm-none-eabi-gcc generated map files usually work fine.

Further investigation into the specific map file will be needed.

laqieer commented 2 months ago

I resolved the error by removing duplicated output section name according to info reminded in 1.1.2, but it cannot analyze the map to show correct data yet as you said.

The motivation is to analyze space usage by parsing map file, and I did it using several alternatives as you mentioned in the README, and they work as expected. Finally I wrote a small tool to analyze my map file and generate space analysis report by myself. More details: https://github.com/laqieer/FEHR/wiki/Development#space-analysis

It is glad to see your reply after 2 years, thanks!