scripts: size_report: keep full path until inserting into tree
This changes how paths are stored in intermediate structures so that full paths are stored. This makes it more consistent with those structures to avoid an issue where some paths are full paths, some are relateive to ZEPHYR_BASE. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
parent
1e8f6be1fd
commit
3e695ccef9
1 changed files with 5 additions and 13 deletions
|
@ -219,8 +219,6 @@ def get_section_ranges(elf):
|
|||
|
||||
def get_die_filename(die, lineprog):
|
||||
"""Get the source code filename associated with a DIE"""
|
||||
zephyrbase = os.path.normpath(args.zephyrbase)
|
||||
|
||||
file_index = die.attributes['DW_AT_decl_file'].value
|
||||
file_entry = lineprog['file_entry'][file_index - 1]
|
||||
|
||||
|
@ -242,15 +240,9 @@ def get_die_filename(die, lineprog):
|
|||
try:
|
||||
path = path.resolve()
|
||||
except OSError as e:
|
||||
if '<built-in>' in str(path):
|
||||
# This is expected, built-ins can't be resolved
|
||||
return path
|
||||
raise e
|
||||
try:
|
||||
new_path = path.relative_to(zephyrbase)
|
||||
path = new_path
|
||||
except ValueError:
|
||||
pass
|
||||
# built-ins can't be resolved, so it's not an issue
|
||||
if '<built-in>' not in str(path):
|
||||
raise e
|
||||
|
||||
return path
|
||||
|
||||
|
@ -570,8 +562,8 @@ def generate_any_tree(symbol_dict):
|
|||
path = Path(file, name)
|
||||
if path.is_absolute():
|
||||
zb = Path(args.zephyrbase)
|
||||
if zb.parent in path.parents:
|
||||
path = path.relative_to(zb.parent)
|
||||
if zb in path.parents:
|
||||
path = path.relative_to(zb)
|
||||
|
||||
_insert_one_elem(root, path, size)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue