From 3236fb6b3db779587557a349877927d6c0131312 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 29 Oct 2019 17:01:20 +0200 Subject: [PATCH] Return file+line for sizedata instead of "location" --- platformio/builder/tools/piosize.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/platformio/builder/tools/piosize.py b/platformio/builder/tools/piosize.py index 593375f1..84d3bf12 100644 --- a/platformio/builder/tools/piosize.py +++ b/platformio/builder/tools/piosize.py @@ -160,8 +160,16 @@ def _collect_symbols_info(env, elffile, elf_path, sections): for symbol in symbols: if symbol["name"].startswith("_Z"): symbol["demangled_name"] = demangled_names.get(symbol["name"]) - symbol["location"] = symbol_locations.get(hex(symbol["addr"])) - + location = symbol_locations.get(hex(symbol["addr"])) + if not location or "?" in location: + continue + symbol["file"] = location + symbol["line"] = 0 + if ":" in location: + file_, line = location.rsplit(":", 1) + if line.isdigit(): + symbol["file"] = file_ + symbol["line"] = int(line) return symbols @@ -210,10 +218,7 @@ def DumpSizeData(_, target, source, env): # pylint: disable=unused-argument files = dict() for symbol in _collect_symbols_info(env, elffile, elf_path, sections): - file_path, _ = symbol.get("location").rsplit(":", 1) - if not file_path or file_path.startswith("?"): - file_path = "unknown" - + file_path = symbol.get("file") or "unknown" if not files.get(file_path, {}): files[file_path] = {"symbols": [], "ram_size": 0, "flash_size": 0}