为什么我的 GDB 批处理模式退出状态总是 0?
Why is my GDB batch mode exit status always 0?
GDB docs 说:
-batch
Run in batch mode. Exit with status 0
after processing all the command files specified with ‘-x
’ ... Exit with nonzero status if an error occurs in executing the gdb commands in the command files.
但即使出现错误,我的退出状态也是零。例如:
$ cat gdbscript
foo
$ gdb -batch -x gdbscript
gdbscript:1: Error in sourced command file:
Undefined command: "foo". Try "help".
$ echo $?
0
如果我在脚本中使用 quit 1
,GDB 程序状态是正确的。
为什么这会发生在我身上?有办法解决吗?我正在尝试刷新远程目标,我真的希望 GDB 在失败时以错误状态退出。
我的GDB版本,应该是重要的:
GNU gdb (GNU Tools for ARM Embedded Processors) 7.8.0.20150604-cvs
Why is this happening to me? Is there a way around it?
从 Bug 13000 中得知 gdb Bug 13000. You can apply experimental patch 并重建 gdb 可能对你有用。
GDB docs 说:
-batch
Run in batch mode. Exit with status
0
after processing all the command files specified with ‘-x
’ ... Exit with nonzero status if an error occurs in executing the gdb commands in the command files.
但即使出现错误,我的退出状态也是零。例如:
$ cat gdbscript
foo
$ gdb -batch -x gdbscript
gdbscript:1: Error in sourced command file:
Undefined command: "foo". Try "help".
$ echo $?
0
如果我在脚本中使用 quit 1
,GDB 程序状态是正确的。
为什么这会发生在我身上?有办法解决吗?我正在尝试刷新远程目标,我真的希望 GDB 在失败时以错误状态退出。
我的GDB版本,应该是重要的:
GNU gdb (GNU Tools for ARM Embedded Processors) 7.8.0.20150604-cvs
Why is this happening to me? Is there a way around it?
从 Bug 13000 中得知 gdb Bug 13000. You can apply experimental patch 并重建 gdb 可能对你有用。