Skip to content

Commit d5216a5

Browse files
SebastianBoeAnas Nashif
authored andcommitted
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 <[email protected]>
1 parent b23d599 commit d5216a5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

scripts/footprint/size_report

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,13 @@ def load_symbols_and_paths(bin_nm, elf_file, path_to_strip=""):
3535
symbol, path = parse_symbol_path_pair(line)
3636

3737
if path:
38-
processed_path = Path(path).relative_to(Path(path_to_strip))
38+
p_path = Path(path)
39+
p_path_to_strip = Path(path_to_strip)
40+
try:
41+
processed_path = p_path.relative_to(p_path_to_strip)
42+
except ValueError as e:
43+
# path is valid, but is not prefixed by path_to_strip
44+
processed_path = p_path
3945
else:
4046
processed_path = Path(":")
4147

0 commit comments

Comments
 (0)