| commit | 7979d57ad006d679c8ad6dcee1b9a9d31a3ff8d3 | [log] [tgz] |
|---|---|---|
| author | Aleksei Vetrov <vvvvvv@google.com> | Tue Dec 12 22:04:40 2023 +0000 |
| committer | Giuliano Procida <gprocida@google.com> | Wed Dec 13 11:25:58 2023 +0000 |
| tree | 888ca6b24fd50016311990d7143fd857a122a511 | |
| parent | 20fb84fcd511d8f92e27444f4357334d5d55d05e [diff] |
DWARF processor: treat empty location expression as no location Change `GetExpression` to `MaybeGetExpression`, which returns an empty optional if the expression is empty. Handle this the same as "attribute is not present" in `MaybeGetExpression` callers. According to the DWARF 5 standard: > If no location attribute is present in a variable entry representing > the definition of a variable (that is, with no DW_AT_declaration > attribute), or if the location attribute is present but has an empty > location description (as described in Section 2.6 on page 38), the > variable is assumed to exist in the source code but not in the > executable program. So according to the standard, an empty DWARF location expression is equivalent to "no location attribute is present". PiperOrigin-RevId: 590329297 Change-Id: Ia09b078d1a4acaa93e50c3ab9f9b0985b1598043
The STG (symbol-type graph) is an ABI representation and this project contains tools for the creation and comparison of such representations.
The ABI extraction tool, stg, emits a native ABI format. Parsers exist for libabigail's XML format, BTF and ELF / DWARF.
The ABI diff tool, stgdiff, supports multiple reporting options.
STG has a versioned native file format. Older formats can be read and rewritten as the latest.
NOTE: STG is under active developement. Tool arguments and behaviour are subject to change.
We intend to package STG for major distributions. Currently we have packages as follows:
| Distribution | Package |
|---|---|
| Arch Linux (AUR) | stg-git |
This source code is available at https://android.googlesource.com/platform/external/stg/.
Instructions are included for local and Docker builds.
STG is written in C++20. It is known to compile with GCC 11, Clang 15 or later versions.
| Dependency | Debian | RedHat |
|---|---|---|
| build | cmake | cmake |
| ELF, BTF | libelf-dev | elfutils-devel |
| DWARF | libdw-dev | elfutils-devel |
| XML | libxml2-dev | libxml2-devel |
| BTF | linux-libc-dev | kernel-headers |
| native format | libprotobuf-dev | protobuf-devel |
| native format | protobuf-compiler | protobuf-compiler |
| allocator[^1] | libjemalloc-dev | jemalloc-devel |
| catch2[^2] | catch2 | catch2-devel |
[^1]: jemalloc is optional, but will likely improve performance. [^2]: catch2 is optional, but required to build the test suite.
Build STG using CMake as follows:
$ mkdir build && cd build $ cmake .. $ cmake --build . --parallel
Run the STG unit test suite:
$ ctest
A Dockerfile is provided to build a container with the STG tools:
$ docker build -t stg .
And then enter the container:
$ docker run -it stg
Note that the Dockerfile provides only a production image. To use Docker as a development environment, you can comment out everything after the line # second stage.
After that you may bind your development code to the container:
$ docker run -it $PWD:/src -it stg
The source code is added to /src, so when your code is bound you can edit on your host and re-compile in the container.
See CONTRIBUTING.md for details.
Please send feedback, questions and bug reports to kernel-team@android.com.