11cb0ef41Sopenharmony_ci#!/bin/sh 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ci# This script is a wrapper for OS X nm(1) tool. nm(1) perform C++ function 41cb0ef41Sopenharmony_ci# names demangling, so we're piping its output to c++filt(1) tool which does it. 51cb0ef41Sopenharmony_ci# But c++filt(1) comes with XCode (as a part of GNU binutils), so it doesn't 61cb0ef41Sopenharmony_ci# guaranteed to exist on a system. 71cb0ef41Sopenharmony_ci# 81cb0ef41Sopenharmony_ci# An alternative approach is to perform demangling in tick processor, but 91cb0ef41Sopenharmony_ci# for GNU C++ ABI this is a complex process (see cp-demangle.c sources), and 101cb0ef41Sopenharmony_ci# can't be done partially, because term boundaries are plain text symbols, such 111cb0ef41Sopenharmony_ci# as 'N', 'E', so one can't just do a search through a function name, it really 121cb0ef41Sopenharmony_ci# needs to be parsed, which requires a lot of knowledge to be coded in. 131cb0ef41Sopenharmony_ci 141cb0ef41Sopenharmony_ciif [ "`which c++filt`" == "" ]; then 151cb0ef41Sopenharmony_ci nm "$@" 161cb0ef41Sopenharmony_cielse 171cb0ef41Sopenharmony_ci nm "$@" | sed -n "s/\([0-9a-fA-F]\{8,16\}\) [iItT] \(.*\)/\\1 \\2/p"\ 181cb0ef41Sopenharmony_ci | c++filt -p -i 191cb0ef41Sopenharmony_cifi 20