You can use the nm
program (part of binutils) to see the list of symbols used by your program. For example:
$ g++ test.cc -o test
$ nm test | grep GetMax
00002ef0 T __Z6GetMaxIiET_S0_S0_
00002f5c T __Z6GetMaxIiET_S0_S0_.eh
00002f17 T __Z6GetMaxIlET_S0_S0_
00002f80 T __Z6GetMaxIlET_S0_S0_.eh
I don't know why each one has two copies, one with a .eh
suffix, but otherwise you can tell that this particular function was instantiated twice. If you version of nm
supports the -C/--demangle
flag, you can use that to get readable names:
$ nm --demangle test | grep GetMax
00002ef0 T int GetMax<int>(int, int)
00002f5c T _Z6GetMaxIiET_S0_S0_.eh
00002f17 T long GetMax<long>(long, long)
00002f80 T _Z6GetMaxIlET_S0_S0_.eh
If that option isn't supported, you can use c++filt
to demangle them:
$ nm test | grep GetMax | c++filt
00002ef0 T int GetMax<int>(int, int)
00002f5c T __Z6GetMaxIiET_S0_S0_.eh
00002f17 T long GetMax<long>(long, long)
00002f80 T __Z6GetMaxIlET_S0_S0_.eh
So, you can see that GetMax
was instantiated with int
and long
respectively.