目前在檢視android原始碼時候發現有很多shell指令碼,由於方便我自己去除錯指令碼,就去查詢了下指令碼除錯工具bashdb,如果大家之前使用過gdb的除錯工具可以很容易的掌握,下面是我對常用命令的使用心得分享,更詳細的內容可以檢視文章末尾提供的鏈結,有官網的參考文件可以給大家學習。
這裡我的環境是mac的安裝步驟,其他平台安裝請自行google。
bashdb<0> show alias
cont: continue | fin: finish | list>: list | h: help
q!: quit | !: history | x: examine | ev: eval
bash: shell | exit: quit | ed: edit | eval?: eval
?: help | w: watch | s: step | d: clear
where: backtrace | t: backtrace | sh: shell | c: continue
s-: step- | r: run | q: quit | b: break
s+: step+ | pr: print | n: next | a: action
bt: backtrace | restart: run | l: list
l>: list | ev?: eval | i: info
#!/bin/bash
function print
function getdate
echo
"hello $user,"
echo
"today is $(getdate)
"
bashdb 《除錯檔案》
martindemacbook-pro:android_shell martin$ bashdb debug.sh
bash debugger, bashdb, release 4.4-0.94
this is free software, covered by the gnu general public license, and you are
welcome to change it and/or distribute copies of it under certain conditions.
(/users/martin/workspace/linux/android_shell/debug.sh:13):
13: echo "hello $user,"
bashdb<0>
bashdb<0> l 行號
bashdb<1> l 1
1: #!/bin/bash
2: function print
3:
9: function getdate
10:
9: function getdate
10: {
bashdb<3> b 6 if$test==alabama
breakpoint 1 set in file /users/martin/workspace/linux/android_shell/debug.sh, line 6.
bashdb<4> d 2
bashdb<8> i b
num type disp enb what
2 breakpoint keep y /users/martin/workspace/linux/android_shell/debug.sh:2
3 breakpoint keep y /users/martin/workspace/linux/android_shell/debug.sh:10
bashdb<9> d 10
removed 1 breakpoint(s).
bashdb<10> i b
num type disp enb what
2 breakpoint keep y /users/martin/workspace/linux/android_shell/debug.sh:2
bashdb<1> run
bashdb<9> run
restarting with: /usr/local/bin/bashdb debug.sh
bash debugger, bashdb, release 4.4-0.94
this is free software, covered by the gnu general public license, and you are
welcome to change it and/or distribute copies of it under certain conditions.
(/users/martin/workspace/linux/android_shell/debug.sh:13):
13: echo "hello $user,"
bashdb<0> c
bashdb<0> c
hello martin,
today is date +%y-%m-%d
debugged program terminated normally. use q to quit or r to restart.
bashdb<1> q
bashdb<1> q
bashdb: that's all, folks...
step over:如果正在呼叫乙個子函式,不會跟到函式內部
bashdb<0> n
bashdb<0> n
hello martin,
(/users/martin/workspace/linux/android_shell/debug.sh:14):
14: echo "today is $(getdate)"
step into:如果正在呼叫乙個子函式,不會跟到函式內部
bashdb<0> s
bashdb<1> s
(/users/martin/workspace/linux/android_shell/debug.sh:14):
14: echo "today is $(getdate)"
getdate
step return:如果正在呼叫乙個子函式,並且進入函式內部,會退出到喊出。
bashdb<(2)> finish
bashdb<(2)> finish
today is date +%y-%m-%d
debugged program terminated normally. use q to quit or r to restart.
用於列印當前變數的值
bashdb<6> pr 《列印的變數》
hello martin,
(/users/martin/workspace/linux/android_shell/debug.sh:14):
14: echo "today is $(getdate)"
bashdb<6> pr $user
martin
監控當前變數的值,當有值發生改變的時候,就改變值。
bashdb<1> watch 《變數名稱不帶$號》
bashdb<1> watch user
0: ($user)==martin arith: 0
bashdb<2> n
shell 指令碼除錯工具
bashdb 是乙個類似gdb的指令碼除錯軟體,具有斷點 單步執行 觀察變數等功能 安裝方法 sudo apt get install bashdbbashdb 使用方法 bashdb options script name script options options h 列印命令的幫助資訊 a ...
Python指令碼除錯工具安裝過程
好的學習是離不開乙個好的工具,今天分享一下一款用於python指令碼編寫以及除錯的工具 pycharm community edition。正常情況下我們可以從官網 或者從電腦管家的軟體管理中搜尋 這裡提供一下官網 位址 安裝完成後涉及授權期限 不過國內破解版很多,小夥伴們可以自行 1 首先我們把 ...
vue devtools除錯工具的安裝
在進行vue devtools工具安裝時,折騰好幾遍才安裝好。遇到的問題 下面是綜合了下得到的安裝方法 3.進入到vue devtools master資料夾 cd vue devtools master 4.安裝配套的包 npm install 5.壓縮檔案 npm run build 6.修改 ...