2012-05-24 27 views
3

在gdb中,如果我只是返回,它會重複上一條命令。有沒有辦法配置Sun/Oracle/Solaris dbx來做同樣的事情?有沒有辦法將dbx配置爲將空白命令作爲最後一個命令的重複處理?

+0

這是關於dbx的SGI版本的dbx的Solaris/Sun/Oracle版本的問題嗎?我認爲有一種方法可以在Solaris Studio dbx中執行此操作,但我現在沒有辦法解決這個問題。您應該能夠使用谷歌搜索查找參考手冊。 –

回答

2

您可以通過在dbx中啓用「gdb模式」來獲得該行爲。

(dbx) gdb on 
(dbx) step 
stopped in main at line 4 in file "t.c" 
    4  printf("world"); 
(dbx) 
step 
stopped in main at line 5 in file "t.c" 
    5  printf("!"); 
(dbx) 
step 
stopped in main at line 6 in file "t.c" 
    6  printf("\n"); 
(dbx) 
step 
helloworld! 
stopped in main at line 7 in file "t.c" 
    7 } 

以下是最新dbx對gdb模式的幫助。

 
(dbx) help gdb 
gdb (command) 
gdb on | off 
Use `gdb on' to enter the gdb command mode under which dbx will understand 
and accept gdb commands. To exit the gdb command mode and return to the dbx 
command mode, enter "gdb off". Please note that the dbx commands will not 
be accepted while in gdb command mode and vice versa. All debugging settings 
such as breakpoints are preserved across different command modes. The 
following gdb commands are not supported in the current release: 
     - commands  - define 
     - handle  - hbreak 
     - interrupt  - maintenance 
     - printf  - rbreak 
     - return  - signal 
     - tcatch  - until 
2

看起來你可以使用$ repeatmode。 我從dbx-guide

Repeating Commands 

You can execute any of the commands contained in the history list. Each 
history command begins with an exclamation point (!): 

!! Repeats the previous command. If the value of the dbx 
variable $repeatmode is set to 1, then entering a carriage 
return at an empty line is equivalent to executing !!. By 
default, $repeatmode is set to 0. 

下看起來也似乎是另一種選擇「對GDB」這使得dbx的行爲像GDB。我還沒有嘗試過,因爲我現在無法訪問dbx,因此如果這適用於您,可以讓我知道。

相關問題