gdb 奇怪的回溯,没有函数名,只有?

问题描述 投票:0回答:1

我们的程序仅由C编写,带有标志编译

-g -O2 -Wall

程序有时会崩溃,我们得到了一些崩溃信息,但没有 函数名,只有一些'??'标记,我们不知道在哪里 发生错误。

我们看到“程序因信号

SIGSEGV
而终止”,但它是 无法告诉我们错误发生在哪里。

我们的系统是

Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-98-generic x86_64)

gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.5)

有崩溃信息:

 sudo gdb test core.31137   
[sudo] password for dbsj:   
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1  
Copyright (C) 2016 Free Software Foundation, Inc. 
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> 
This is free software: you are free to change and redistribute it. 
There is NO WARRANTY, to the extent permitted by law.  Type "show copying" 
and "show warranty" for details. 
This GDB was configured as "x86_64-linux-gnu". 
Type "show configuration" for configuration details. 
For bug reporting instructions, please see: 
<http://www.gnu.org/software/gdb/bugs/>. 
Find the GDB manual and other documentation resources online at: 
<http://www.gnu.org/software/gdb/documentation/>. 
For help, type "help". 
Type "apropos word" to search for commands related to "word"... 
Reading symbols from test...(no debugging symbols found)...done. 

 warning: core file may not match specified executable file. 
[New LWP 31147] 
[New LWP 31149] 
[New LWP 31142] 
[New LWP 31137] 
[New LWP 31141] 
[New LWP 31148] 
[New LWP 31143] 
[New LWP 31139] 
[New LWP 31145] 
[New LWP 31144] 
[New LWP 31146] 
[New LWP 31140] 
Core was generated by `./skynet dreamgame/config_publish/dataserver_patched'. 
Program terminated with signal SIGSEGV, Segmentation fault. 
#0  0x000000000044a0f3 in ?? () 
[Current thread is 1 (LWP 31147)] 
(gdb) where 
#0  0x000000000044a0f3 in ?? () 
#1  0x0000000000001000 in ?? () 
#2  0x00007f4dcdd0f300 in ?? () 
#3  0x000000000044df5f in ?? () 
#4  0x00007f4dfbad8001 in ?? () 
#5  0x00007f4dd63d5140 in ?? () 
#6  0x00007f4dd63d50c0 in ?? () 
#7  0x00007f4dbc34f180 in ?? () 
#8  0x0000000000000001 in ?? () 
#9  0x00007f4dcdd12058 in ?? () 
#10 0x00007f4dd63d65d0 in ?? () 
#11 0x0000000000002000 in ?? () 
#12 0x0000000000000001 in ?? () 
#13 0x000000000044e026 in ?? () 
#14 0x0000000000001000 in ?? () 
#15 0x0000000000001000 in ?? () 
#16 0x00007f4dd63d50c0 in ?? () 
#17 0x00007f4dbbf0db40 in ?? () 
#18 0x0000000100000001 in ?? () 
#19 0x00007f4dcdd12058 in ?? () 
#20 0x00007f4dd63d65d0 in ?? () 
#21 0x00007f4dcdd0f310 in ?? () 
#22 0x00007f4dcdd0f300 in ?? () 
#23 0x00007f4dd63d6580 in ?? () 
#24 0x00007f4dd63d50c0 in ?? () 
#25 0x00007f4dbc1b0300 in ?? () 
#26 0x0000000000000040 in ?? () 
#27 0x000000000044e963 in ?? () 
#28 0x0000000000004000 in ?? () 
#29 0x0000000000000000 in ?? () 
linux crash gdb coredump
1个回答
1
投票

您可能正在尝试从错误的二进制文件中调试核心转储。
请注意输出中的这些行:

Reading symbols from test...(no debugging symbols found)...done. 

 warning: core file may not match specified executable file. 
[New LWP 31147] 
[New LWP 31149] 
[New LWP 31142] 
[New LWP 31137] 
[New LWP 31141] 
[New LWP 31148] 
[New LWP 31143] 
[New LWP 31139] 
[New LWP 31145] 
[New LWP 31144] 
[New LWP 31146] 
[New LWP 31140] 
Core was generated by `./skynet dreamgame/config_publish/dataserver_patched'. 

尝试用

./skynet dreamgame/config_publish/dataserver_patched
代替
test

sudo gdb ./skynet dreamgame/config_publish/dataserver_patched core.31137   
© www.soinside.com 2019 - 2024. All rights reserved.