溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

gdb+gdbserver找不到符號(hào)文件的問題

發(fā)布時(shí)間:2020-07-26 07:16:52 來源:網(wǎng)絡(luò) 閱讀:1255 作者:zhegaozhouji 欄目:開發(fā)技術(shù)

遠(yuǎn)端gdbserver已經(jīng)起來,本地使用gdb已經(jīng)連接上gdbserver,但是本地提示找不到符號(hào)文件:

warning: Could not load vsyscall page because no executable was specified

try using the "file" command first.

那么使用file命令,指定被調(diào)試的可執(zhí)行文件即可:

file /opt/linuxshare/helloworld/main


這里要注意一下,file指定的main已經(jīng)是一個(gè)ELF可執(zhí)行文件,也就是正在被調(diào)試的程序,另外,這個(gè)文件其實(shí)是存在于遠(yuǎn)端磁盤上,但是已經(jīng)被mount到了本地機(jī)器上。


file成功后即可看到源碼:

(gdb) file /opt/linuxshare/helloworld/main

A program is being debugged already.

Are you sure you want to change the file? (y or n) y

Reading symbols from /opt/linuxshare/helloworld/main...done.

(gdb) b main

Breakpoint 1 at 0x40055c: file main.c, line 3.

(gdb) info b

Num     Type           Disp Enb Address            What

1       breakpoint     keep y   0x000000000040055c in main at main.c:3

(gdb) l

1 #include <stdio.h>

2 int main() {

3    printf("Hello World\n");

4

5    int i = 0;

6    while(1)

7    {

8 sleep(3);

9 printf("time: %d\n", ++i);

10    }


向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI