GDB return code and batch mode

Michel METZGER michel.metzger@st.com
Tue Jul 12 21:08:00 GMT 2011


Hi,

I'm probably missing something here, the question is: what is it? ;)

According to the documentation, -batch has the following effect: 
"Exit with status 0 after processing all the command files specified with `-x' (and all commands from initialization files, if not inhibited with `-n'). Exit with nonzero status if an error occurs in executing the gdb commands in the command files."

A quick test:
$ gdb -batch -x "gdb.script"

with a file gdb.script containing the line:
file toto

(of course toto doesn't exist, to raise an error).

The output is:
gdb.script:1: Error in sourced command file:
toto: No such file or directory.
$ echo $?
0

Ideas? 

Regards,

Michel Metzger.



More information about the Gdb mailing list