()
| 74 | |
| 75 | |
| 76 | def cli() -> None: |
| 77 | import argparse |
| 78 | |
| 79 | parser = argparse.ArgumentParser( |
| 80 | description="Dump object file information using build tools" |
| 81 | ) |
| 82 | |
| 83 | parser.add_argument( |
| 84 | "build_path", |
| 85 | type=Path, |
| 86 | nargs="?", |
| 87 | help="Path to build directory containing build info JSON file", |
| 88 | ) |
| 89 | |
| 90 | args = parser.parse_args() |
| 91 | build_path = args.build_path |
| 92 | |
| 93 | # Check if object file was provided and exists |
| 94 | if build_path is None: |
| 95 | build_path = _prompt_build() |
| 96 | else: |
| 97 | if not _check_build(build_path): |
| 98 | print("Error: Invalid build directory", file=sys.stderr) |
| 99 | sys.exit(1) |
| 100 | |
| 101 | assert build_path is not None |
| 102 | assert build_path |
| 103 | |
| 104 | build_info_path = build_path / "build_info.json" |
| 105 | assert build_info_path.exists(), f"File not found: {build_info_path}" |
| 106 | |
| 107 | tools = load_tools(build_info_path) |
| 108 | |
| 109 | object_file = _prompt_object_file(build_path) |
| 110 | |
| 111 | cmd = [str(tools.objdump_path), "--syms", str(object_file)] |
| 112 | if sys.platform == "win32": |
| 113 | cmd = ["cmd", "/c"] + cmd |
| 114 | cmd_str = subprocess.list2cmdline(cmd) |
| 115 | subprocess.run(cmd, check=True) |
| 116 | print("\nDone. Command used:", cmd_str) |
| 117 | |
| 118 | |
| 119 | if __name__ == "__main__": |
no test coverage detected