-
Notifications
You must be signed in to change notification settings - Fork 6
/
syms.sh
executable file
·46 lines (40 loc) · 922 Bytes
/
syms.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# input is name of the function to be mangled
# output is mangled name
function searchfor() {
for file in `find ./build/mother3 -name "*.o"`
do
nm $file | cut -d' ' -f3 | sed 's/\(.*\)/\1\n/' | sed '/^$/d' | grep $1
done
}
# special case: destructor
if [ "${1#*~}" != "$1" ]
then
# get the string length of the symbol name
tmp=${1#*~}
len=${#tmp}
searchfor _._$len$tmp
exit 0
fi
# check if argument contains qualified name (::)
if [ ${1#*::} != $1 ]
then
#if so, set class name and function name
class=${1%::*}
function=${1#*::}
# special case: constructor
# check class and function name are identical
if [ $class == $function ]
then
searchfor ^__${#function}$function
exit 0
fi
else
class=""
function=$1
fi
if [ -z "$class" ]
then
searchfor $function
else
searchfor $function.*__${#class}$class # qual name
fi