This is the mail archive of the 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: [PATCH] Prevent source file errors in --batch-silent mode

1 week ping :)

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

:ADDPATCH infrun.c:

Andrew STUBBS wrote:

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
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>


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