| OLD | NEW |
| 1 #!/bin/sh | 1 #!/bin/sh |
| 2 | 2 |
| 3 # This script is a wrapper for OS X nm(1) tool. nm(1) perform C++ function | 3 # This script is a wrapper for OS X nm(1) tool. nm(1) perform C++ function |
| 4 # names demangling, so we're piping its output to c++filt(1) tool which does it. | 4 # names demangling, so we're piping its output to c++filt(1) tool which does it. |
| 5 # But c++filt(1) comes with XCode (as a part of GNU binutils), so it doesn't | 5 # But c++filt(1) comes with XCode (as a part of GNU binutils), so it doesn't |
| 6 # guaranteed to exist on a system. | 6 # guaranteed to exist on a system. |
| 7 # | 7 # |
| 8 # An alternative approach is to perform demangling in tick processor, but | 8 # An alternative approach is to perform demangling in tick processor, but |
| 9 # for GNU C++ ABI this is a complex process (see cp-demangle.c sources), and | 9 # for GNU C++ ABI this is a complex process (see cp-demangle.c sources), and |
| 10 # can't be done partially, because term boundaries are plain text symbols, such | 10 # can't be done partially, because term boundaries are plain text symbols, such |
| 11 # as 'N', 'E', so one can't just do a search through a function name, it really | 11 # as 'N', 'E', so one can't just do a search through a function name, it really |
| 12 # needs to be parsed, which requires a lot of knowledge to be coded in. | 12 # needs to be parsed, which requires a lot of knowledge to be coded in. |
| 13 | 13 |
| 14 if [ "`which c++filt`" == "" ]; then | 14 if [ "`which c++filt`" == "" ]; then |
| 15 nm $@ | 15 nm "$@" |
| 16 else | 16 else |
| 17 nm $@ | c++filt -p -i | 17 nm "$@" | c++filt -p -i |
| 18 fi | 18 fi |
| OLD | NEW |