This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: GDB as a loader 2/3: return child result


Eli Zaretskii wrote:
The "error occurs" part is not clear enough, IMO.  Could you please
state more clearly what kinds of error could cause this ``unless''
clause to kick in?  Also, if such an error does occur, what will GDB
return as its exit status in that case?

I think we should spell out all this information, since this option is
meant to be used by people who write shell scripts that invoke GDB in
batch mode.  If I'd need to write such a script, I'd wish to know
exactly what kinds of exit codes I will see and under what
circumstances.

Ok. How about the attached?


Andrew
2005-10-28  Andrew Stubbs  <andrew.stubbs@st.com>

	* gdb.texinfo (Choosing modes): Add --return-child-result.


Index: src/gdb/doc/gdb.texinfo
===================================================================
--- src.orig/gdb/doc/gdb.texinfo	2005-10-28 14:04:49.000000000 +0100
+++ src/gdb/doc/gdb.texinfo	2005-10-28 14:39:29.000000000 +0100
@@ -1006,6 +1006,27 @@ This is particularly useful when using t
 Note that targets that give their output via @value{GDBN}, as opposed to
 writing directly to @code{stdout}, will also be made silent.
 
+@item -return-child-result
+@cindex @code{--return-child-result}
+The return code from @value{GDBN} will be the return code from the child
+process (the process being debugged), with the following exceptions:
+
+@itemize @bullet
+@item
+@value{GDBN} exits abnormally.  E.g. due to an incorrect argument or an
+internal error.  In this case the exit code is the same as it would have been
+without @samp{-return-child-result}.
+@item
+The user quits with an explicit value.  E.g. @samp{quit 1}.
+@item
+The child process never runs, or is not allowed to terminate, in which case
+the exit code will be -1.
+@end itemize
+
+This option is useful in conjunction with @samp{-batch} or @samp{-batch-silent},
+when @value{GDBN} is being used as a remote program loader or simulator
+interface.
+
 @item -nowindows
 @itemx -nw
 @cindex @code{--nowindows}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]