On 04/17/2011 07:35 PM, Jonathan Wakely wrote:
Are you compiling with -g ?
Are you using GDB 7.0 or later?
GNU gdb (GDB) Fedora (7.2-46.fc14)
The gcc version: actually, I noticed that maybe I should get a release
version.
$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/mnt/nvs/home/devel/soft/gcc_4.6_1/libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.6-20110318/configure
--prefix=/mnt/nvs/home/devel/soft/gcc_4.6_1/ --enable-libssp
--enable-cloog-backend=ppl --enable-lto
--with-mpfr=/mnt/nvs/home/devel/soft/gcc_4.6_1/
--with-gmp=/mnt/nvs/home/devel/soft/gcc_4.6_1/
--with-mpc=/mnt/nvs/home/devel/soft/gcc_4.6_1/
--with-ppl=/mnt/nvs/home/devel/soft/gcc_4.6_1/
--with-cloog=/mnt/nvs/home/devel/soft/gcc_4.6_1/ CPPFLAGS='-mtune=core2
-mssse3' CXXFLAGS='-mtune=core2 -mssse3' --enable-threads
--enable-__cxa_atexit --with-system-zlib --enable-decimal-float
--enable-plugin --enable-tls --enable-languages=c,c++,lto --enable-shared
Thread model: posix
gcc version 4.6.0 20110318 (prerelease) (GCC)
Tried different compiling options: "-g", or "-g -ggdb" or "-flto -O3
<lots of options>". Since you asked, I double checked that linking step
gets the above options.
What I get is:
Exception: Test
Backtrace:
./firstTest() [0x4036a8]
./firstTest() [0x40baa7]
./firstTest() [0x40e497]
./firstTest() [0x40807e]
./firstTest() [0x40851d]
/lib64/libc.so.6(__libc_start_main+0xfd) [0x3699c1ee5d]
./firstTest() [0x402d79]
With -O3 the only difference is the number of stack frames. "firstTest"
is the name of the binary.
$ ldd firstTest
linux-vdso.so.1 => (0x00007fff6ff02000)
libcudart.so.3 => /mnt/back/cuda/cuda/lib64/libcudart.so.3
(0x00007f46e6ee5000)
libstdc++.so.6 =>
/mnt/nvs/home/devel//soft/gcc_4.6_1//lib64/libstdc++.so.6
(0x00007f46e6bb3000)
libm.so.6 => /lib64/libm.so.6 (0x000000369a800000)
libgcc_s.so.1 =>
/mnt/nvs/home/devel//soft/gcc_4.6_1//lib64/libgcc_s.so.1
(0x00007f46e6979000)
libc.so.6 => /lib64/libc.so.6 (0x0000003699c00000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x000000369a000000)
libdl.so.2 => /lib64/libdl.so.2 (0x000000369a400000)
librt.so.1 => /lib64/librt.so.1 (0x000000369b000000)
/lib64/ld-linux-x86-64.so.2 (0x0000003699400000)
$