MCPcopy Create free account
hub / github.com/FastLED/FastLED / analyze_map_file

Function analyze_map_file

ci/util/symbol_analysis.py:514–556  ·  view source on GitHub ↗

Analyze the map file to understand module dependencies

(map_file: Path)

Source from the content-addressed store, hash-verified

512
513
514def analyze_map_file(map_file: Path) -> dict[str, list[str]]:
515 """Analyze the map file to understand module dependencies"""
516 print(f"Analyzing map file: {map_file}")
517
518 dependencies: dict[str, list[str]] = {}
519 current_archive: Optional[str] = None
520
521 if not map_file.exists():
522 print(f"Map file not found: {map_file}")
523 return {}
524
525 try:
526 with open(map_file, "r") as f:
527 for line in f:
528 line = line.strip()
529
530 # Look for archive member includes - handle both ESP32 and UNO formats
531 if ".a(" in line and ")" in line:
532 # Extract module name
533 start = line.find("(") + 1
534 end = line.find(")")
535 if start > 0 and end > start:
536 current_archive = line[start:end]
537 dependencies[current_archive] = []
538
539 elif current_archive and line and not line.startswith((".", "/", "*")):
540 # This line shows what pulled in the module
541 if "(" in line and ")" in line:
542 # Extract the symbol that caused the inclusion
543 symbol_start = line.find("(") + 1
544 symbol_end = line.find(")")
545 if symbol_start > 0 and symbol_end > symbol_start:
546 symbol = line[symbol_start:symbol_end]
547 dependencies[current_archive].append(symbol)
548 current_archive = None
549 except KeyboardInterrupt as ki:
550 handle_keyboard_interrupt(ki)
551 raise
552 except Exception as e:
553 print(f"Error reading map file: {e}")
554 return {}
555
556 return dependencies
557
558
559def generate_report(

Callers 3

test_analyze_map_fileMethod · 0.90
mainFunction · 0.85

Calls 4

printFunction · 0.50
findMethod · 0.45
appendMethod · 0.45

Tested by 2

test_analyze_map_fileMethod · 0.72