有时候通过 ldd 发现 g++ 编译的 文件有 undefined symbol 问题,但是提示出来的函数名称是转化过的,可以通过 c++filt 还原
user_00@(none):module> ldd -r ./gift_logic.so linux-gate.so.1 => (0xf776b000) /$LIB/libonion.so => /lib/libonion.so (0xf2241000) libpthread.so.0 => /lib/libpthread.so.0 (0xf221c000) libdl.so.2 => /lib/libdl.so.2 (0xf2217000) libz.so.1 => /lib/libz.so.1 (0xf2205000) libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xf2121000) libm.so.6 => /lib/libm.so.6 (0xf20fa000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xf20ef000) libc.so.6 => /lib/libc.so.6 (0xf1fad000) /lib/ld-linux.so.2 (0xf776c000)undefined symbol: _ZN5tbase4tlog5CTLog5log_iEiiPKcz (./gift_logic.so)
这里 _ZN5tbase4tlog5CTLog5log_iEiiPKcz ???
user_00@(none):module> c++filt _ZN5tbase4tlog5CTLog5log_iEiiPKcztbase::tlog::CTLog::log_i(int, int, char const*, ...)
通过 c++filt 命令就可以比较方便的获取到原型.