Update Rust demangling to use rustc-demangle

The rust-demangle-capi crate hasn't been updated since 2016 and
out-of-date. Instead, Breakpad needs to use C API offered by the
rustc-demangle to demangle Rust symbols.

*** TESTING ***

1) Set up rustc-demangle

> git clone https://github.com/rust-lang/rustc-demangle.git
> cd rustc-demangle
> cargo build -p rustc-demangle-capi --release

2) Breakpad

> ./configure --with-rustc-demangle=<path to rustc-demangle>
> make check src/common/dward_cu_to_module

Change-Id: Ib68b62ef329f1397bc379a1d04c632781e4b2069
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3273324
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
This commit is contained in:
Alex Pankhurst 2021-11-10 13:25:30 -08:00 committed by Joshua Peraza
parent fe35cd43f2
commit 38ee0be4d1
6 changed files with 56 additions and 55 deletions

View file

@ -219,30 +219,30 @@ AC_ARG_ENABLE(selftest,
[selftest=false])
AM_CONDITIONAL(SELFTEST, test x$selftest = xtrue)
AC_ARG_WITH(rust-demangle,
AS_HELP_STRING([--with-rust-demangle=/path/to/rust-demangle-capi],
[Link against the rust-demangle library]
AC_ARG_WITH(rustc-demangle,
AS_HELP_STRING([--with-rustc-demangle=/path/to/rustc-demangle],
[Link against the rustc-demangle library]
[to demangle Rust language symbols during]
[symbol dumping (default is no)]
[Pass the path to the crate root.]),
[case "${withval}" in
yes)
AC_MSG_ERROR(You must pass the path to the rust-demangle-capi crate for --with-rust-demangle)
AC_MSG_ERROR(You must pass the path to the rustc-demangle crate for --with-rustc-demangle)
;;
no)
rust_demangle=false
rustc_demangle=false
;;
*)
if ! test -f "${withval}/Cargo.toml"; then
AC_MSG_ERROR(You must pass the path to the rust-demangle-capi crate for --with-rust-demangle)
AC_MSG_ERROR(You must pass the path to the rustc-demangle crate for --with-rustc-demangle)
fi
RUST_DEMANGLE_CFLAGS="-DHAVE_RUST_DEMANGLE -I${withval}/target/include"
RUST_DEMANGLE_LIBS="-L${withval}/target/release -lrust_demangle -lpthread -ldl"
RUSTC_DEMANGLE_CFLAGS="-DHAVE_RUSTC_DEMANGLE -I${withval}/crates/capi/include"
RUSTC_DEMANGLE_LIBS="-L${withval}/target/release -lrustc_demangle -lpthread -ldl"
;;
esac],
[rust_demangle=false])
AC_ARG_VAR([RUST_DEMANGLE_CFLAGS], [Compiler flags for rust-demangle])
AC_ARG_VAR([RUST_DEMANGLE_LIBS], [Linker flags for rust-demangle])
[rustc_demangle=false])
AC_ARG_VAR([RUSTC_DEMANGLE_CFLAGS], [Compiler flags for rustc-demangle])
AC_ARG_VAR([RUSTC_DEMANGLE_LIBS], [Linker flags for rustc-demangle])
AC_ARG_WITH(tests-as-root,
AS_HELP_STRING([--with-tests-as-root],