| # Copyright 2024 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| # |
| # A starlark input file for bazel cquery that prints lines listing the |
| # directories containing the debug symbols for all binaries of a given |
| # fuchsia package. |
| # |
| # All paths are relative to the Bazel execroot. Example output: |
| # |
| # ``` |
| # bazel-out/x86_64-fastbuild-ST-191ad9aaea0e/bin/examples/drivers/template/pkg_fuchsia_package.elf_binaries/.build-id |
| # bazel-out/x86_64-fastbuild-ST-191ad9aaea0e/bin/examples/drivers/template/pkg_fuchsia_package_build_id_dir |
| # external/fuchsia_clang/lib/debug/.build-id |
| # external/fuchsia_sdk/.build-id |
| # ``` |
| # |
| # Example use: |
| # bazel cquery <config-options> |
| # --output=starlark --starlark:file=/path/to/this/file \ |
| # //path/to/fuchsia:package |
| # |
| def format(target): |
| debug_info = providers(target)["@@rules_fuchsia+//fuchsia/private:providers.bzl%FuchsiaDebugSymbolInfo"] |
| lines = [] |
| for dirs in debug_info.build_id_dirs_mapping.values(): |
| lines += [dir.path for dir in dirs.to_list()] |
| |
| return "\n".join(sorted(lines)) |