Boost Mobile Crash Debugging with Symbolic Demangle: A Complete Walkthrough
This article explains how the Huolala mobile team built a stable symbol demangling system using the open‑source symbolic‑demangle tool, covering the concepts of name mangling, why symbolic was chosen, step‑by‑step adaptation for newer Swift versions, Linux Python‑wheel building, and practical troubleshooting tips.
1. Introduction
Huolala's mobile platform has a comprehensive stability monitoring system that helps create industry‑leading products, issue alerts, and root‑cause analysis. This article shares the practice of the symbolic‑demangle direction and opens the demangle tool on GitHub for others.
2. What is symbolic demangle?
In programming, demangling restores compiler‑mangled names to readable symbols. Mangling (name mangling) encodes function and variable names with type information, especially in C++ where overloads and namespaces exist. Demangling is essential for debugging, stack tracing, and crash diagnosis across languages like C++, Rust, and Swift.
The following image shows an undecoded stack trace with poor readability:
3. Why choose the symbolic solution?
Huolala's mobile stack mainly uses C++ and Swift. Existing tools (c++filt, swift‑demangle) require language detection, environment setup, and efficiency trade‑offs. An article from ByteDance highlighted the use of the Rust‑implemented symbolic‑demangle to replace LLVM's demangler, reducing operational cost. After evaluating open‑source options, symbolic‑demangle was selected for its low cost and effectiveness.
4. Symbolic practice in Huolala
Symbolic currently supports Swift up to 5.5.1; higher versions need adaptation. The following sections describe adapting to newer Swift versions and building a Python library on Linux.
4.1 Adapting to newer Swift
The adaptation involves two steps: syncing the official Swift demangle source and compiling the symbolic project.
Sync Swift source:
mkdir swift-source && cd swift-source git clone [email protected]:swiftlang/swift.git ./swift/utils/update-checkout --clone cd swift git checkout swift-5.10-RELEASE ./utils/build-script --skip-buildAfter updating sources, copy them to the library: ./update.py swift-source Compile the symbolic Rust project (uses Cargo): cargo build Common build issues and fixes:
Missing LLVM files – copy from llvm‑project.
Missing template names – update type_traits.h from Swift source.
Standard library errors – compile with C++17.
Stale build artifacts – delete target directory.
4.2 Building the Python library on Linux
Generate a wheel package: python3 setup.py bdist_wheel Install the wheel:
pip3 install dist/symbolic-10.2.1-py2.py3-none-macosx_14_0_universal2.whlLinux builds encountered GLIBC version mismatches (required 2.29, Debian 12 provides 2.36). Solutions include using a lower‑version OS (CentOS 7 with GLIBC 2.17) or adjusting GCC versions.
On CentOS 7, upgrade GCC to support C++17 and install required dependencies:
yum -y install centos-release-scl yum clean all yum makecache yum -y install libffi-devel python3-develAfter resolving compiler and library issues, the wheel builds successfully.
5. Final results
Online demangling output matches Xcode's swift‑demangle tool closely.
Local symbolic demangle output:
Xcode swift‑demangle output for comparison:
6. References
Name mangling – Wikipedia
iOS Symbol Parsing Refactoring
symbolic‑demangle GitHub repository
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
