size_report: Don't assume all paths start with ZEPHYR_BASE

Instead of crashing when a source file outside of ZEPHYR_BASE is
detected we accept it as-is to include it in the report.

This fixes #5866

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
This commit is contained in:
Sebastian Bøe 2018-01-29 17:42:47 +01:00 committed by Anas Nashif
commit d5216a5299

View file

@ -35,7 +35,13 @@ def load_symbols_and_paths(bin_nm, elf_file, path_to_strip=""):
symbol, path = parse_symbol_path_pair(line) symbol, path = parse_symbol_path_pair(line)
if path: if path:
processed_path = Path(path).relative_to(Path(path_to_strip)) p_path = Path(path)
p_path_to_strip = Path(path_to_strip)
try:
processed_path = p_path.relative_to(p_path_to_strip)
except ValueError as e:
# path is valid, but is not prefixed by path_to_strip
processed_path = p_path
else: else:
processed_path = Path(":") processed_path = Path(":")