Giter Club home page Giter Club logo

elf-size-analyze's People

Contributors

adel-mamin avatar amirgon avatar dkuschmierz avatar jedrzejboczar avatar samryanuofl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

elf-size-analyze's Issues

[Feature request] Wide print

I have rather long typenames due to template types and namespaces, and the default printing method cuts the symbol names, to the point I can't distinguish them.

======================================== ROM =========================================
Symbol                                                              Size        %     
======================================================================================
/my/project/path/src/util                      2.3 KiB   100.00
  convert                                                             1.7 KiB    73.03
    CompactParse.cc                                                   1.1 KiB    45.40
      pj_impl_1_0_0::tryParseNumber(char const*)                      1.1 KiB    45.40
    UTF16Parse.cc                                                   664.0 B      27.63
      writeCodeunit(char*, int)                                     303.0 B      12.61
      pj_impl_1_0_0::tryConvertInplace(char*, bool)                 242.0 B      10.07
      parseHex4Unchecked(char const*)                               119.0 B       4.95
  arena/DynArenaImpl.cc                                             648.0 B      26.97
    pj_impl_1_0_0::DynArenaImpl::setAvailable(unsigned short, ...   332.0 B      13.82
    pj_impl_1_0_0::DynArenaImpl::resizeAlloc(unsigned long, un...   110.0 B       4.58
    pj_impl_1_0_0::DynArenaImpl::DynArenaImpl(pj_impl_1_0_0::D...   103.0 B       4.29
    pj_impl_1_0_0::DynArenaImpl::DynArenaImpl(pj_impl_1_0_0::D...   103.0 B       4.29
?                                                                     0.0 B       0.00
======================================================================================
Symbols total                                                         2.3 KiB         
======================================================================================

(Note the last 2 results)

Could you please add an option to use the longest symbol name to calculate the table width and as such print all full symbol names?

Publish to pypi

Hi @jedrzejboczar
I forked this awesome script and refactored it, added json support and created a project out of it. Now, after some more beautifying and adding some UnitTests, I want to publish it to pypi. Is it ok for you if I publish it from my repository or do you want me to create a PR for your repo and you publish it to pypi?

-W (html output) does not support --no-cumulative-size

    html = generate_html_output(nodedict, title, args.css)
  File "/usr2/kting/.local/lib/python3.7/site-packages/elf_size_analyze/html/gen.py", line 38, in generate_html_output
    overall_size = overall_size + y["cumulative_size"]
TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'

Looks like gen is trying to access cumulative_size which is None if --no-cumulative-size is set

A word of thanks

Dear @jedrzejboczar,

I could not find a better place to write this message, so I am opening it here and closing it right away to not mess up with your open issues ๐Ÿ˜„

Your script has been very instrumental in my analysis of embedded software binaries at work. To give you a small insight into the type of work we are doing, we had to strip the unnecessary code from our flight software binaries, and this is where your HTML visualization was especially useful. The workflow I was following was pretty simple: I printed the script's HTML output to PDF and went to highlight the most obvious candidates for removal from the flight executable along with the sizes that these components consume. After I had highlighted everything, I could quickly collect the candidate components and the total size that could be saved by removing all unused code. The HTML-to-PDF experience made the process very UX-friendly.

Thanks for putting this script together. It is definitely very useful.

Cheers,
Stanislav (Reflex Aerospace GmbH)

LLVM doesn't support nm --line-numbers option

I tried running this but got the following error:

C:/msys64/clang64/bin/nm.exe: error: : unknown argument '--line-numbers'
Traceback (most recent call last):
  File "/home/david/.local/pipx/.cache/640b108cb1cbb91/bin/elf-size-analyze", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/david/.local/pipx/.cache/640b108cb1cbb91/lib/python3.11/site-packages/elf_size_analyze/__main__.py", line 72, in main
    fileinfo = extract_elf_symbols_fileinfo(args.elf, get_exe('nm'))
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/david/.local/pipx/.cache/640b108cb1cbb91/lib/python3.11/site-packages/elf_size_analyze/symbol.py", line 177, in extract_elf_symbols_fileinfo
    raise subprocess.CalledProcessError(nm_proc.returncode,
subprocess.CalledProcessError: Command '['nm', '--portability', '--line-numbers', '_build/projection-clang64-install/winrt/_winrt.pyd']' returned non-zero exit status 1.  

Apparently the LLVM version of nm does not support the --line-numbers option. llvm/llvm-project#39348

Is there a workaround?

Total size seems to be not correct

Hi,

first of all thanks for the great alternative to size_report. But it seems that the reported size is not correct. For my elf file I have the following data points:

Linker output:

Memory region         Used Size  Region Size  %age Used
           FLASH:      920184 B     941568 B     97.73%
            SRAM:      235186 B       256 KB     89.72%
        IDT_LIST:          0 GB         2 KB      0.00%

The size_report --rom version reports me 920047 and your tool prints 816200. Unfortunately I cannot share the reports and don't really know how to help further to pin down the problem.

html output failed for non-english enviroment

UnicodeDecodeError: 'gbk' codec can't decode byte 0xa6 in position 477: illegal multibyte sequence

it can be solved by (html/gen.py)
`
def generate_html_output(node_dict, title, custom_css=None):
table_content = ""

custom_css = custom_css or DEFAULT_CSS
with open(custom_css, encoding='utf-8') as f:
    css_styles = f.read()

with open(JAVASCRIPT, encoding='utf-8') as f:
    javascript = f.read()

... ...
`
open file with utf-8 encoding.

filepath case is not preserved

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

WPS disabling from WLAN_Lib_M2B_Standard_STA_AP

To disable WPS feature from WLAN_Lib_M2B_Standard_STA_AP, I tried to change #define WLAN_CONFIG_WPS 0 in wlanconfig.h. The first problem faced it was in wps_supplicant.c and wps_supplicant.h files. For example in wps_supplicant.h, functions's declarations and definitions depend on #ifdef CONFIG_WPS and #else. But in wps_supplicant.c same functions are defined without condition on ifdef CONFIG_WPS. To resolve this problem of redefinitions I tried to comment functions in wps_suplicant.c and I kept the functions defined in wps_supplicant.h that they return just 0 without doing nothing. The second problem faced was of #define IEEE8021X_EAPOL that is defined in wlan_cfg.h like that:
#if WLAN_CONFIG_WPS
#define CONFIG_WPS 1
#define EAP_WSC 1
#ifdef CONFIG_AP
#define EAP_SERVER_WSC 1
#endif /* CONFIG_AP /
#define IEEE8021X_EAPOL 1
#define EAP_TLS_NONE 1
#endif
As I disabled WLAN_CONFIG_WPS, we don't have a definition of "IEEE8021X_EAPOL". I tried to build and I had this error:
C:/git/STM32_Wifi/Firmware/Middlewares/ST/WLAN_Lib/wpa_supplicant/wpa_supplicant_bsd3/wpa_supplicant/wps_supplicant.c:452:7: error: 'struct wpa_ssid' has no member named 'eap'
When I looked in config_ssid.h, I found ;
#ifdef IEEE8021X_EAPOL
#define EAPOL_FLAG_REQUIRE_KEY_UNICAST BIT(0)
#define EAPOL_FLAG_REQUIRE_KEY_BROADCAST BIT(1)
/
*
* eapol_flags - Bit field of IEEE 802.1X/EAPOL options (EAPOL_FLAG_*)
*/
int eapol_flags;

/**
 * eap - EAP peer configuration for this network
 */
struct eap_peer_config eap;

#endif /* IEEE8021X_EAPOL /
So the definition of eap struct depends on the definition of IEEE8021X_EAPOL in config_ssid.h but it doesn't depend on #ifdef IEEE8021X_EAPOL in wps_supplicant.c.
I need to understand this problem: why there are #ifdef IEEE8021X_EAPOL in file and not in other and also why we have #define IEEE8021X_EAPOL 1 inside of WPS enabling:
#if WLAN_CONFIG_WPS
#define CONFIG_WPS 1
#define EAP_WSC 1
#ifdef CONFIG_AP
#define EAP_SERVER_WSC 1
#endif /
CONFIG_AP */
#define IEEE8021X_EAPOL 1
#define EAP_TLS_NONE 1
#endif

Could we have a possibility to fully disable WPS feature independently as a module?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.