forked from platformio/platformio-core
Return file+line for sizedata instead of "location"
This commit is contained in:
@@ -160,8 +160,16 @@ def _collect_symbols_info(env, elffile, elf_path, sections):
|
|||||||
for symbol in symbols:
|
for symbol in symbols:
|
||||||
if symbol["name"].startswith("_Z"):
|
if symbol["name"].startswith("_Z"):
|
||||||
symbol["demangled_name"] = demangled_names.get(symbol["name"])
|
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
|
return symbols
|
||||||
|
|
||||||
|
|
||||||
@@ -210,10 +218,7 @@ def DumpSizeData(_, target, source, env): # pylint: disable=unused-argument
|
|||||||
|
|
||||||
files = dict()
|
files = dict()
|
||||||
for symbol in _collect_symbols_info(env, elffile, elf_path, sections):
|
for symbol in _collect_symbols_info(env, elffile, elf_path, sections):
|
||||||
file_path, _ = symbol.get("location").rsplit(":", 1)
|
file_path = symbol.get("file") or "unknown"
|
||||||
if not file_path or file_path.startswith("?"):
|
|
||||||
file_path = "unknown"
|
|
||||||
|
|
||||||
if not files.get(file_path, {}):
|
if not files.get(file_path, {}):
|
||||||
files[file_path] = {"symbols": [], "ram_size": 0, "flash_size": 0}
|
files[file_path] = {"symbols": [], "ram_size": 0, "flash_size": 0}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user