尽管有 debuginfod,gdb 仍不显示符号

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

我正在尝试使用 gdb 在服务启动时调试 sigsegv。我已经配置了 debuginfod,它甚至正在下载 debuginfo 但仍然显示?而不是符号。这是相关输出:

GNU gdb (GDB) 15.1
Copyright (C) 2024 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-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://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 ./build/dns-wrapper...
(gdb) r
Starting program: /home/ncd/git/dns-wrapper/build/dns-wrapper --config-file config/config.ini
Downloading separate debug info for /lib64/ld-linux-x86-64.so.2
Downloading separate debug info for system-supplied DSO at 0x7ffff7fc5000                                                                                                    
Downloading separate debug info for /usr/lib/libboost_system.so.1.86.0                                                                                                       
Downloading separate debug info for /usr/lib/libboost_program_options.so.1.86.0                                                                                              
Downloading separate debug info for /usr/lib/libboost_log_setup.so.1.86.0                                                                                                    
Downloading separate debug info for /usr/lib/libboost_log.so.1.86.0                                                                                                          
Downloading separate debug info for /usr/lib/libboost_thread.so.1.86.0                                                                                                       
Downloading separate debug info for /usr/lib/libboost_atomic.so.1.86.0                                                                                                       
Downloading separate debug info for /usr/lib/libboost_chrono.so.1.86.0                                                                                                       
Downloading separate debug info for /usr/lib/libboost_filesystem.so.1.86.0                                                                                                   
Downloading separate debug info for /usr/lib/libm.so.6                                                                                                                       
Downloading separate debug info for /usr/lib/libc.so.6                                                                                                                       
[Thread debugging using libthread_db enabled]                                                                                                                                
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Upstream server identified as: udp://1.1.1.1:53
Upstream server identified as: udp://8.8.8.8:53
[2024-09-28 18:53:39.662405] [0x00007ffff7d39940] [trace] [0x0008a1ea] [1] Dns Wrapper v0.0.0.1
[2024-09-28 18:53:39.662521] [0x00007ffff7d39940] [trace] [0x0008a1ea] [2] Git branch: win_raw_socket, Version: 01b16b2e-dirty, Commit: 01b16b2e-dirty, Date: 2024-09-28 10:24:37 +0530
[2024-09-28 18:53:39.662533] [0x00007ffff7d39940] [trace] [0x0008a1ea] [3] Current User: root
[2024-09-28 18:53:39.662540] [0x00007ffff7d39940] [trace] [0x0008a1ea] [4] Compiled for x86_64 (compiled locally) using cc (GCC) 14.2.1 20240910
[2024-09-28 18:53:39.662760] [0x00007ffff7d39940] [info] [0x0008a1ea] [5] Successfully read rules from file: ./rules.txt
[2024-09-28 18:53:39.662997] [0x00007ffff7d39940] [debug] [0x0008a1ea] [6] Skipping entering into daemon mode as per user request
[2024-09-28 18:53:39.663053] [0x00007ffff7d39940] [trace] [0x0008a1ea] [7] Daemon started on port: 10053

Program received signal SIGSEGV, Segmentation fault.
0x00005555555f43ed in boost::asio::detail::socket_ops::call_recvfrom<unsigned int> (s=8, data=0x7ffffffeab80, size=65535, flags=0, addr=0x7fffffffa740, 
    addrlen=0x7fffffffa890) at /usr/include/boost/asio/detail/impl/socket_ops.ipp:1130
1130    }
(gdb) where
#0  0x00005555555f43ed in boost::asio::detail::socket_ops::call_recvfrom<unsigned int> (s=8, data=0x7ffffffeab80, size=65535, flags=0, addr=0x7fffffffa740, 
    addrlen=0x7fffffffa890) at /usr/include/boost/asio/detail/impl/socket_ops.ipp:1130
#1  0x2851232006040001 in ?? ()
#2  0x00007fff0000fe51 in ?? ()
#3  0x0000000000000000 in ?? ()
(gdb) show debuginfod enabled
Debuginfod functionality is currently set to "on".
(gdb) show debuginfod urls
Debuginfod URLs are currently set to:
https://debuginfod.archlinux.org
(gdb) bt full
#0  0x00005555555f43ed in boost::asio::detail::socket_ops::call_recvfrom<unsigned int> (s=8, data=0x7ffffffeab80, size=65535, flags=0, addr=0x7fffffffa740, 
    addrlen=0x7fffffffa890) at /usr/include/boost/asio/detail/impl/socket_ops.ipp:1130
        tmp_addrlen = 20
        result = 561
#1  0x2851232006040001 in ?? ()
No symbol table info available.
#2  0x00007fff0000fe51 in ?? ()
No symbol table info available.
#3  0x0000000000000000 in ?? ()
No symbol table info available.

如您所见,gdb 下载了符号并且没有错误。但我还是看到了?? () 在堆栈跟踪中。我的身边缺少什么吗?如何让 gdb 显示符号?

我像这样运行 gdb:

sudo DEBUGINFOD_URLS=https://debuginfod.archlinux.org gdb --args ./build/dns-wrapper --config-file config/config.ini

以 root 身份运行它,因为服务需要 root 权限。

gdb debug-information
1个回答
0
投票

#0  0x00005555555f43ed in boost::asio::detail::socket_ops::call_recvfrom<unsigned int> (s=8, data=0x7ffffffeab80, size=65535, flags=0, addr=0x7fffffffa740,  addrlen=0x7fffffffa890) at /usr/include/boost/asio/detail/impl/socket_ops.ipp:1130

#1  0x2851232006040001 in ?? ()

这通常意味着堆栈溢出(在

call_recvfrom()
或它所称的东西中)导致堆栈上的返回地址被覆盖。

有什么建议如何进一步调试吗?

使用

-fsanitize=address
构建带有地址清理程序的程序——它可能会直接指出错误。

© www.soinside.com 2019 - 2024. All rights reserved.