HBehrens / puncover

Analyses C/C++ build output for code size, static variables, and stack usage

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crashes if `arm-none-eabi-objdump` is missing.

katyo opened this issue · comments

Zephyr RTOS assume using it's own SDK with prefix arm-zephyr-eabi- not an arm-none-eabi-.
When I trying run puncover it fails with the following backtrace:

$ .venv/bin/puncover --gcc_tools_base /nix/store/l204mqmlaccq7njix0mxk5y26hvgh6js-zephyr-sdk-0.15.2/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-
Traceback (most recent call last):
  File ".venv/bin/puncover", line 33, in <module>
    sys.exit(load_entry_point('puncover==0.3.4', 'console_scripts', 'puncover')())
  File ".venv/lib/python3.10/site-packages/puncover/puncover.py", line 55, in main
    gcc_tools_base = os.path.join(find_arm_tools_location(), 'bin/arm-none-eabi-')
  File "/nix/store/5axq6aw8j3vcs2m7gi440cwpcckl7ql9-python3-3.10.9/lib/python3.10/posixpath.py", line 76, in join
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType
def find_arm_tools_location():
    obj_dump = find_executable("arm-none-eabi-objdump") # <--- gives None so function returns None
    return dirname(dirname(obj_dump)) if obj_dump else None

# ...

def main():
    gcc_tools_base = os.path.join(find_arm_tools_location(), 'bin/arm-none-eabi-') # <--- it fails because arg is None
    # ...

I've submitted a PR that (at least partially) solves this:

#80

Regards,

JB

I also confirm this problem. The fix from @jeanbaptistelab can solve this.

I just stumbled upon this problem. I trying to use it in Zephyr and since it is using virtualenv, the arm-toolchain is not installed in the initial system PATH.