[PATCH] Prevent source file errors in --batch-silent mode

Andrew STUBBS andrew.stubbs@st.com
Mon Apr 28 19:02:00 GMT 2008


1 week ping :)

And let's see if I can add it to the tracker properly this time ...

:ADDPATCH infrun.c:

Andrew STUBBS wrote:
> Hi,

> The --batch-silent option disables all output on stdout, thus silencing 
> GDB with no impact on the rest of the source base. However, it does 
> *not* silence stderr.

> Most of the time this is the right thing to do, but it can lead to a 
> little unnecessary noise.

> Specifically, given the following trivial test file:

> int main()
> {
>   while (1)
>     ;
>   return 0;
> }

> Compiled with debug info, but with the source file *taken away*, the 
> debugger will produce an irritating error message if the running program 
> is interrupted with Ctrl-C:

> $ gdb -ex run a.out -batch-silent
> <Ctrl-C>
> 3       t.c: No such file or directory.

> In this example the user is irritated, but in typical real world 
> examples the error message refers to some OS source file they've never 
> heard of (with a scary name like kernel.c), which may lead the user to 
> think there is a real problem.

> The attached patch prevents GDB attempting to print the source reference 
> when in --batch-silent mode. The only outward evidence of this feature 
> was the error message, so nothing is lost. If anything it's a little 
> more efficient now.

> <ADDPATCH infrun.c>

> Andrew




More information about the Gdb-patches mailing list