简体   繁体   English

gdb信息行:…但不包含任何代码

[英]gdb info line : … but contains no code

I'm getting a strange gdb error off of info line . 我从info line收到一个奇怪的gdb错误。

 gdb) info line
Line 252 of "main.c" is at address 0x7f29e979c987 <main+314> but contains no code.

But on the other hand, I can successfully list code: 但另一方面,我可以成功列出代码:

    (gdb) l main.c:254
249               batch_mode = 1;
250             case 'd':
251               daemon_mode = 1;
252               break;
253             case 'k':
254               keep_kernel_mode = 1;
255               break;
256             case 'C':
257               dryrun = 1;
258               break;
(gdb)

And gdb seems to be clearly aware of the source file: 而且gdb似乎清楚地知道了源文件:

(gdb) info source
Current source file is main.c
Compilation directory is /home/charletr/src/quagga/zebra
Located in /home/charletr/src/quagga/zebra/main.c
Contains 414 lines.
Source language is c.
Compiled with DWARF 2 debugging format.
Does not include preprocessor macro info.

But again, on the other hand, I cannot get info line to say reasonable things: (this is attempting to print info line from the address listed for frame #1 where I am super confident I have source code) 但是,另一方面,我也无法让信息行说出合理的话:(这是尝试从第1帧列出的地址打印信息行,我非常确信我有源代码)

(gdb) bt
#0  0x00007f29e88431f3 in __select_nocancel () from /home/charletr/src/aries-uprevquagga/debug/lib/libc.so.6
#1  0x00007f29e8f309eb in ?? ()
#2  0x00007fffef3b58c0 in ?? ()
#3  0x00007fffef3b5a70 in ?? ()
#4  0x00007fffef3b5a60 in ?? ()
#5  0x00007f29e99d68b8 in ?? ()
#6  0x00007f29e99d6a28 in ?? ()
#7  0x00007f29e99d69a8 in ?? ()
#8  0x00007f29e99d6928 in ?? ()
#9  0x00007f29e99d69a8 in ?? ()
#10 0x00007fffef3b58e0 in ?? ()
#11 0x00007fffef3b5960 in ?? ()
#12 0x0000000000000000 in ?? ()
(gdb) info line *0x00007f29e8f309eb
No line number information available for address 0x7f29e8f309eb

What might be some reasons that gdb:info line can find source but cannot fine line numbers?? gdb:info line可以找到源但不能对行号进行罚款的某些原因可能是什么?

Note: I do have a very odd build system/target system setup. 注意:我确实有一个非常奇怪的构建系统/目标系统设置。 I build on the build system and copy the objects to the target system. 我在构建系统上构建并将对象复制到目标系统。 Then I run gdbserver on the target system. 然后,我在目标系统上运行gdbserver。 Then I run gdb on the build system and use the target remote command to connect to the gdbserver on the target system. 然后,我在构建系统上运行gdb,并使用target remote命令连接到目标系统上的gdbserver。

Hopefully, Ricky 希望瑞奇

I figured it out. 我想到了。 I'll just post here in case it happens to anyone else. 我会在这里发布,以防其他任何人碰到。 So my build system and target system have different linux kernel versions and therfore, different libc (glibc) versions. 因此,我的构建系统和目标系统具有不同的linux内核版本,因此具有不同的libc(glibc)版本。 What I needed to do was instruct my local gdb on the build system to use a differnet sysroot so as to match what would be found on the remote target. 我需要做的是指示构建系统上的本地gdb使用differentnet sysroot,以匹配远程目标上的内容。 I did this through the .gdbinit file like so: 我是通过.gdbinit文件完成此操作的,如下所示:

set sysroot /opt/6WIND/contrib/toolchain/gcc-4.3.2-glibc-2.7/x86_64-pc-l‌​inux-gnu/sys-root/
set sysroot remote:/

– user3101167 – user3101167

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM