Return a dictionary of symbols scraped from build files
(nm: str, build_root: Path)
| 170 | |
| 171 | |
| 172 | def get_cached_symbols(nm: str, build_root: Path) -> Dict[str, Symbol]: |
| 173 | """Return a dictionary of symbols scraped from build files""" |
| 174 | global symbols_cache |
| 175 | |
| 176 | if symbols_cache is not None: |
| 177 | return symbols_cache |
| 178 | symbols = {} |
| 179 | |
| 180 | if not build_root.is_dir(): |
| 181 | error("Specified buck-out is not a directory") |
| 182 | |
| 183 | for root, _, files in os.walk(build_root): |
| 184 | root_path = Path(root) |
| 185 | for file_name in files: |
| 186 | file_path = root_path / file_name |
| 187 | if file_path.suffix == OBJECT_SUFFIX: |
| 188 | object_file_path = file_path |
| 189 | source_file_name = object_file_path.name[: -len(OBJECT_SUFFIX)] |
| 190 | |
| 191 | object_file_rel = Path(os.path.relpath(object_file_path, build_root)) |
| 192 | if "codegen" in str(object_file_path): |
| 193 | source_file_path = source_file_name + " (generated)" |
| 194 | else: |
| 195 | source_file_path = ( |
| 196 | PROJECT_ROOT / object_file_rel.parent.parent / source_file_name |
| 197 | ) |
| 198 | get_object_symbols(nm, symbols, object_file_path, source_file_path) |
| 199 | |
| 200 | symbols_cache = symbols |
| 201 | return symbols_cache |
| 202 | |
| 203 | |
| 204 | def check_dependencies(readelf: str, binary_file: Path) -> int: |
no test coverage detected