jedrzejboczar / elf-size-analyze

Script for analyzing ELF memory usage
Apache License 2.0
125 stars 23 forks source link

filepath case is not preserved #26

Open maruncz opened 7 months ago

maruncz commented 7 months ago

Hi i just noticed, that in some cases filepath case is not preserved and output is confusing. For example i have both BatteryReader.cpp and batteryreader.hpp one section has some functions and other as the rest. see this output: out.txt

im using windows 10 machine and msp430-gcc in version 9.3.1

jedrzejboczar commented 7 months ago

I am not sure where the path case could be changed. Can you try using nm --portability --line-numbers file.elf to see if the paths are correct there?

May this be related to the fact that on Windows filesystem paths are not case-sensitive? Can you try to reproduce the issue on Linux/MacOs?

Or maybe you could try on Windows in a folder with case-sensitive paths enabled (it seems it is possible to enable this in NTFS on per-folder basis). But I'd say that it could be specific to the Windows gcc toolchain, as it may assume that the filesystem is case-insensitive.

maruncz commented 7 months ago

Hi

out.txt here is output of nm, it is broken here as well. But it is all over the place, there are even / and \ mixed together.

I don't think that copying that output elf file to linux machine and testing it would yield different results, and i don't have much time now setting up whole develompent on linux machine.

I'm not sure how well you know gcc toolchain in general, but you can look into that particular toolchain source codes here https://www.ti.com/tool/MSP430-GCC-OPENSOURCE (it is the MSP430 variant, not to be confused with MSP432 which is just arm toolchain)

I did quick search and i was wondering, if this might be issue with build system?

jedrzejboczar commented 6 months ago

I don't think I would be able to easily spot the problem in the toolchain itself, and even then it probably wouldn't be easy to solve. You could try checking the build system, maybe it is the root ause of the problem. You can check if the case of paths is consistent in all the build system files.

I think that the easiest solution from the perspective of elf-size-analyze would be to just add a switch that makes all the file paths lowercase, this way you would loose the PascalCase naming but at least it would be consistent. What do you think?

jedrzejboczar commented 6 months ago

You could check with this version https://github.com/jedrzejboczar/elf-size-analyze/tree/jb/lowercase-filename passing the --lowercase-paths argument (I haven't tested this though).

maruncz commented 6 months ago

Hi, thanks for this workaround. I was not able to run that development version. I'm not able to create venv, and running it directly links to old version of argparser

jedrzejboczar commented 6 months ago

Hmm, I'm not sure how venv setup on Windows works and if it's problematic. I don't know how else you could test this. You can probably just clone this git repo, checkout the branch, enter the directory and use python -m elf_size_analyze -h (or python3).

maruncz commented 6 months ago

Hi, thanks for the tip on how to run development version. I was able to test it and it is less confusing with all paths lowercase.