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

Getting unmangled names fails with path lenght exceeds limit

mishbieg opened this issue · comments

Running in cmd with Windows 10 and Python 3.8 results in the following error:

puncover --elf-file <some file>
parsing ELF at <some file>
enhancing function sizes
deriving folders
enhancing file elements
enhancing assembly
enhancing call tree
enhancing siblings
unmangling c++ symbols
Traceback (most recent call last):
  File "c:\python38\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\python38\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Python38\Scripts\puncover.exe\__main__.py", line 7, in <module>
  File "c:\python38\lib\site-packages\puncover\puncover.py", line 82, in main
    builder.build_if_needed()
  File "c:\python38\lib\site-packages\puncover\builders.py", line 32, in build_if_needed
    self.build()
  File "c:\python38\lib\site-packages\puncover\builders.py", line 23, in build
    self.collector.enhance(self.src_root)
  File "c:\python38\lib\site-packages\puncover\collector.py", line 435, in enhance
    self.unmangle_cpp_names()
  File "c:\python38\lib\site-packages\puncover\collector.py", line 319, in unmangle_cpp_names
    unmangled_names = self.gcc_tools.get_unmangled_names(symbol_names)
  File "c:\python38\lib\site-packages\puncover\gcc_tools.py", line 46, in get_unmangled_names
    lines_list =  [self.gcc_tool_lines('c++filt', c) for c in chunks(symbol_names)]
  File "c:\python38\lib\site-packages\puncover\gcc_tools.py", line 46, in <listcomp>
    lines_list =  [self.gcc_tool_lines('c++filt', c) for c in chunks(symbol_names)]
  File "c:\python38\lib\site-packages\puncover\gcc_tools.py", line 25, in gcc_tool_lines
    proc = subprocess.Popen([self.gcc_tool_path(name)] + args, stdout=subprocess.PIPE, cwd=cwd)
  File "c:\python38\lib\subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "c:\python38\lib\subprocess.py", line 1311, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 206] Der Dateiname oder die Erweiterung ist zu lang

Setting the default chunk_size form 1000 to 60 in gcc_tools.py -> get_unmangled_names() solved the issue for me. I do not know the exact limit that Windows enforces. For a permanent fix we could iterate the chunk_size until it fails again. It took me a while to figure out that it was the chunk_size. So we should include that fix so that others don't have to search as long.