我有一个简单的gdb命令文件:
set pagination off
set logging file ../log/buildlog.txt
set logging on
info breakpoints
set remotetimeout 3
target extended-remote localhost:3333 arg1
load
monitor reset
set logging off
quit
我想添加以下内容:
set pagination off
set logging file ../log/buildlog.txt
set logging on
info breakpoints
set remotetimeout 3
if ("target extended-remote localhost:3333 arg1")
echo Succeeded
else
quit
end
load
monitor reset
set logging off
quit
我尝试通过bash这样操作:
if [ $(arm-none-eabi-gdb -x "../build/gdbcfg.gdb" --args $1) ];then
echo "Upload success"
else
echo "Failed to upload. Is openocd connected?"
exit -1
fi
但是这并没有实现任何事情,因为我不知道发生故障时arm-none-eabi-gdb会返回什么,并且我在任何文档中都找不到。