我试图了解在X32平台(带有ILP32的x86_64)上进行测试的库中的崩溃。当我回溯它时,我看到:
(gdb) bt full
#0 0xf6e02e1b in _Unwind_Resume ()
from /lib/x86_64-linux-gnux32/libgcc_s.so.1
No symbol table info available.
#1 0x00454b12 in __gnu_cxx::__exchange_and_add_single (
__val=<optimized out>, __mem=<optimized out>)
at /usr/include/c++/6/ext/atomicity.h:68
__result = <optimized out>
#2 __gnu_cxx::__exchange_and_add_dispatch (__val=0xffffffff, __mem=0x8)
at /usr/include/c++/6/ext/atomicity.h:84
No locals.
#3 std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release (this=0x0)
at /usr/include/c++/6/bits/shared_ptr_base.h:162
No locals.
#4 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count (
this=0xffffaa78, __in_chrg=<optimized out>)
at /usr/include/c++/6/bits/shared_ptr_base.h:662
No locals.
...
和
(gdb) f 1
#1 0x00454b12 in __gnu_cxx::__exchange_and_add_single (
__val=<optimized out>, __mem=<optimized out>)
at /usr/include/c++/6/ext/atomicity.h:68
68 *__mem += __val;
(gdb) p __mem
$1 = <optimized out>
(gdb) p __val
$2 = <optimized out>
当我查看反汇编时,我看到以下内容。 $pc
为0x454b12: mov %eax,%ebx
。
(gdb) x/6i $pc-4
0x454b0e: push %rbx
0x454b0f: or %ch,%bl
0x454b11: outsl %ds:(%rsi),(%dx)
0x454b12: mov %eax,%ebx
0x454b14: mov -0x170(%ebp),%eax
0x454b1b: lea -0x168(%rbp),%edx
对于outsl
,我__gnu_cxx::__exchange_and_add_single
看起来不寻常。
任何人都可以解释正在生成的__gnu_cxx::__exchange_and_add_single
代码的内容吗?
$ gcc -dumpmachine
x86_64-linux-gnux32
$ gcc --version
gcc (Debian 6.3.0-2) 6.3.0 20161229
Copyright (C) 2016 Free Software Foundation, Inc.
...