()
| 853 | |
| 854 | |
| 855 | def main(): |
| 856 | import argparse |
| 857 | |
| 858 | parser = argparse.ArgumentParser( |
| 859 | description="Enhanced symbol analysis with optional function call analysis for any platform" |
| 860 | ) |
| 861 | parser.add_argument( |
| 862 | "--board", help="Board name to analyze (e.g., uno, esp32dev, esp32s3)" |
| 863 | ) |
| 864 | parser.add_argument( |
| 865 | "--example", |
| 866 | default="Blink", |
| 867 | help="Example name for finding example-specific build_info_{example}.json", |
| 868 | ) |
| 869 | parser.add_argument( |
| 870 | "--no-enhanced", |
| 871 | action="store_false", |
| 872 | dest="enhanced", |
| 873 | default=True, |
| 874 | help="Disable enhanced analysis with function call graph (enhanced is default)", |
| 875 | ) |
| 876 | parser.add_argument( |
| 877 | "--show-calls-to", |
| 878 | help="Show what functions call a specific function (enables enhanced mode)", |
| 879 | ) |
| 880 | parser.add_argument( |
| 881 | "--basic", |
| 882 | action="store_true", |
| 883 | help="Use basic nm-only symbol analysis (for backward compatibility). Default is comprehensive analysis with readelf + nm", |
| 884 | ) |
| 885 | args = parser.parse_args() |
| 886 | |
| 887 | # Enable enhanced mode if show-calls-to is specified |
| 888 | enhanced_mode = args.enhanced or args.show_calls_to |
| 889 | |
| 890 | # Use comprehensive symbol analysis by default, basic only if requested |
| 891 | comprehensive_symbols = not args.basic |
| 892 | |
| 893 | # Find build info |
| 894 | build_info_path, board_name = find_board_build_info(args.board, args.example) |
| 895 | print(f"Found build info for {board_name}: {build_info_path}") |
| 896 | |
| 897 | with open(build_info_path) as f: |
| 898 | build_info = json.load(f) |
| 899 | |
| 900 | # Get board info using proper board mapping |
| 901 | board = create_board(board_name) |
| 902 | real_board_name = board.get_real_board_name() |
| 903 | |
| 904 | # Try the real board name first, then fall back to directory name |
| 905 | if real_board_name in build_info: |
| 906 | board_info = build_info[real_board_name] |
| 907 | actual_board_key = real_board_name |
| 908 | if real_board_name != board_name: |
| 909 | print( |
| 910 | f"Note: Using board key '{real_board_name}' from board mapping (directory was '{board_name}')" |
| 911 | ) |
| 912 | elif board_name in build_info: |
no test coverage detected