2014-10-02 37 views
1

我是GDB的新手,無法獲取命令歷史記錄(自動完成/向上箭頭到舊命令工作)。GDB - 無法獲取命令歷史工作

在我的根我有一個.gbd_init文件(我也有我的工作目錄中相同的文件):

set history save 

set history filename ~/.gbd_history 

set history on 

set history expansion on 

我也有一個空.gbd_history文件在我的根。

在GBD「查看歷史」得出:

(gdb) show history 

expansion: History expansion on command input is on. 

filename: The filename in which to record the command history is  
"/home/jenny/C_Programs/CS575_Algorithms/HW3/Problem1/.gdb_history". 

save: Saving of the history record on exit is on. 

size: The size of the command history is unlimited. 

(gdb) 

但是GBD命令「show命令」產量沒有和向上箭頭和標籤沒有做任何事情。

.gbd_history文件存在但是爲空。

[email protected] ~/C_Programs/CS575_Algorithms/HW3/Problem1 $ ls -ls .gbd* 

0 -rwxrwxrwx 1 jenny jenny 0 Oct 1 22:16 .gbd_history 

4 -rwxrwxrwx 1 jenny jenny 94 Oct 1 22:01 .gbdinit 

我錯過了什麼?

感謝您的任何幫助。每個命令的打字速度都很快。

珍妮

回答

0

你.gdbinit腳本顯然不執行,你可以從你的gdb_history的文件名,它有它的默認值(gdb_history在當前目錄)看到。

嘗試使用gdb -x .gdbinit在當前目錄中執行此init腳本,因爲它可能在默認情況下被禁用。至少我的gdb希望我設置某種類型的自動加載安全路徑,然後才允許加載駐留在主目錄之外的init腳本。看詳情here

如果您正在尋找使用歷史纔不會有重複的命令,你應該只寫與所有這些命令的腳本,並用gdb -x腳本等

,肯定檢查this SO thread上執行它如何輕鬆啓用命令歷史記錄。

+0

非常感謝。現在正在工作。 我更新了我的.gdbinit文件,以「設置自動加載安全路徑/」 ,然後調用gdb和 「gdb -q -iex」set auto-load safe-path/home/jenny「program -tui 「 現在命令歷史/向上箭頭正在工作。 – Excelsior1024 2014-10-04 02:06:00

0

在我的根我有一個.gbd_init文件(我也有我的工作目錄相同的文件 ):

您有拼寫錯誤GDB初始化文件名​​。它應該被命名爲.gdbinit。 gdb不會執行.gbd_init,並且未啓用歷史記錄保存。