* [PATCH] Prevent source file errors in --batch-silent mode
@ 2008-04-21 19:34 Andrew STUBBS
2008-04-28 19:02 ` Andrew STUBBS
2008-05-01 20:34 ` Daniel Jacobowitz
0 siblings, 2 replies; 13+ messages in thread
From: Andrew STUBBS @ 2008-04-21 19:34 UTC (permalink / raw)
To: GDB Patches
[-- Attachment #1: Type: text/plain, Size: 1134 bytes --]
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
[-- Attachment #2: batch-silent-interrupt.patch --]
[-- Type: text/plain, Size: 1091 bytes --]
2008-04-21 Andrew Stubbs <andrew.stubbs@st.com>
* infrun.c (normal_stop): Don't print source location when running in
--batch-silent mode.
Index: src/gdb/infrun.c
===================================================================
--- src.orig/gdb/infrun.c 2008-04-21 18:47:00.000000000 +0100
+++ src/gdb/infrun.c 2008-04-21 18:48:32.000000000 +0100
@@ -3170,6 +3170,11 @@ Further execution is probably impossible
if (!stop_stack_dummy)
{
+ /* If --batch-silent is enabled then there's no need to print the current
+ source location, and to try risks causing an error message about
+ missing source files. */
+ extern int batch_silent;
+
select_frame (get_current_frame ());
/* Print current location without a level number, if
@@ -3178,7 +3183,7 @@ Further execution is probably impossible
bpstat_print() contains the logic deciding in detail
what to print, based on the event(s) that just occurred. */
- if (stop_print_frame)
+ if (stop_print_frame && !batch_silent)
{
int bpstat_ret;
int source_flag;
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH] Prevent source file errors in --batch-silent mode
2008-04-21 19:34 [PATCH] Prevent source file errors in --batch-silent mode Andrew STUBBS
@ 2008-04-28 19:02 ` Andrew STUBBS
2008-05-01 20:34 ` Daniel Jacobowitz
1 sibling, 0 replies; 13+ messages in thread
From: Andrew STUBBS @ 2008-04-28 19:02 UTC (permalink / raw)
To: GDB Patches
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
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH] Prevent source file errors in --batch-silent mode
2008-04-21 19:34 [PATCH] Prevent source file errors in --batch-silent mode Andrew STUBBS
2008-04-28 19:02 ` Andrew STUBBS
@ 2008-05-01 20:34 ` Daniel Jacobowitz
2008-05-02 11:35 ` Andrew STUBBS
1 sibling, 1 reply; 13+ messages in thread
From: Daniel Jacobowitz @ 2008-05-01 20:34 UTC (permalink / raw)
To: Andrew STUBBS; +Cc: GDB Patches
On Mon, Apr 21, 2008 at 07:13:44PM +0100, Andrew STUBBS wrote:
> 2008-04-21 Andrew Stubbs <andrew.stubbs@st.com>
>
> * infrun.c (normal_stop): Don't print source location when running in
> --batch-silent mode.
:REVIEWMAIL:
This is OK, if you will move the extern to a header file.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Prevent source file errors in --batch-silent mode
2008-05-01 20:34 ` Daniel Jacobowitz
@ 2008-05-02 11:35 ` Andrew STUBBS
2008-05-02 13:46 ` Daniel Jacobowitz
0 siblings, 1 reply; 13+ messages in thread
From: Andrew STUBBS @ 2008-05-02 11:35 UTC (permalink / raw)
To: GDB Patches
[-- Attachment #1: Type: text/plain, Size: 196 bytes --]
Daniel Jacobowitz wrote:
> This is OK, if you will move the extern to a header file.
New version attached. There was prior art for this in event-top.c, so
I've fixed that up also.
OK?
Andrew
[-- Attachment #2: batch-silent-interrupt.patch --]
[-- Type: text/plain, Size: 2139 bytes --]
2008-05-02 Andrew Stubbs <andrew.stubbs@st.com>
* main.h (batch_silent): Declare.
* event-top.c: Include main.h.
(gdb_setup_readline): Remove extern batch_silent declaration.
* infrun.c (normal_stop): Don't print source location when running in
--batch-silent mode.
Index: src2/gdb/infrun.c
===================================================================
--- src2.orig/gdb/infrun.c 2008-05-02 10:34:13.000000000 +0100
+++ src2/gdb/infrun.c 2008-05-02 11:26:06.000000000 +0100
@@ -3171,7 +3171,10 @@ Further execution is probably impossible
bpstat_print() contains the logic deciding in detail
what to print, based on the event(s) that just occurred. */
- if (stop_print_frame)
+ /* If --batch-silent is enabled then there's no need to print the current
+ source location, and to try risks causing an error message about
+ missing source files. */
+ if (stop_print_frame && !batch_silent)
{
int bpstat_ret;
int source_flag;
Index: src2/gdb/event-top.c
===================================================================
--- src2.orig/gdb/event-top.c 2008-03-14 19:55:51.000000000 +0000
+++ src2/gdb/event-top.c 2008-05-02 11:24:30.000000000 +0100
@@ -31,6 +31,7 @@
#include <signal.h>
#include "exceptions.h"
#include "cli/cli-script.h" /* for reset_command_nest_depth */
+#include "main.h"
/* For dont_repeat() */
#include "gdbcmd.h"
@@ -1084,8 +1085,6 @@ gdb_setup_readline (void)
that the sync setup is ALL done in gdb_init, and we would only
mess it up here. The sync stuff should really go away over
time. */
- extern int batch_silent;
-
if (!batch_silent)
gdb_stdout = stdio_fileopen (stdout);
gdb_stderr = stdio_fileopen (stderr);
Index: src2/gdb/main.h
===================================================================
--- src2.orig/gdb/main.h 2008-01-01 22:53:12.000000000 +0000
+++ src2/gdb/main.h 2008-05-02 11:24:05.000000000 +0100
@@ -33,5 +33,6 @@ extern int gdb_main (struct captured_mai
/* From main.c. */
extern int return_child_result;
extern int return_child_result_value;
+extern int batch_silent;
#endif
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH] Prevent source file errors in --batch-silent mode
2008-05-02 11:35 ` Andrew STUBBS
@ 2008-05-02 13:46 ` Daniel Jacobowitz
2008-05-02 14:03 ` Andrew STUBBS
0 siblings, 1 reply; 13+ messages in thread
From: Daniel Jacobowitz @ 2008-05-02 13:46 UTC (permalink / raw)
To: Andrew STUBBS; +Cc: GDB Patches
On Fri, May 02, 2008 at 12:35:01PM +0100, Andrew STUBBS wrote:
> 2008-05-02 Andrew Stubbs <andrew.stubbs@st.com>
>
> * main.h (batch_silent): Declare.
> * event-top.c: Include main.h.
> (gdb_setup_readline): Remove extern batch_silent declaration.
> * infrun.c (normal_stop): Don't print source location when running in
> --batch-silent mode.
OK, if you also update Makefile.in(event-top.o).
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Prevent source file errors in --batch-silent mode
2008-05-02 13:46 ` Daniel Jacobowitz
@ 2008-05-02 14:03 ` Andrew STUBBS
2008-05-02 14:10 ` Daniel Jacobowitz
0 siblings, 1 reply; 13+ messages in thread
From: Andrew STUBBS @ 2008-05-02 14:03 UTC (permalink / raw)
To: GDB Patches
[-- Attachment #1: Type: text/plain, Size: 219 bytes --]
Daniel Jacobowitz wrote:
> OK, if you also update Makefile.in(event-top.o).
Thanks, I've attached the version committed.
I think I've been spoilt by makefiles that generate the dependencies
automatically. :)
Andrew
[-- Attachment #2: batch-silent-interrupt.patch --]
[-- Type: text/plain, Size: 2907 bytes --]
2008-05-02 Andrew Stubbs <andrew.stubbs@st.com>
* main.h (batch_silent): Declare.
* event-top.c: Include main.h.
(gdb_setup_readline): Remove extern batch_silent declaration.
* infrun.c (normal_stop): Don't print source location when running in
--batch-silent mode.
* Makefile.in (event-top.o): Add main.h dependency.
Index: src2/gdb/infrun.c
===================================================================
--- src2.orig/gdb/infrun.c 2008-05-02 10:34:13.000000000 +0100
+++ src2/gdb/infrun.c 2008-05-02 11:26:06.000000000 +0100
@@ -3171,7 +3171,10 @@ Further execution is probably impossible
bpstat_print() contains the logic deciding in detail
what to print, based on the event(s) that just occurred. */
- if (stop_print_frame)
+ /* If --batch-silent is enabled then there's no need to print the current
+ source location, and to try risks causing an error message about
+ missing source files. */
+ if (stop_print_frame && !batch_silent)
{
int bpstat_ret;
int source_flag;
Index: src2/gdb/event-top.c
===================================================================
--- src2.orig/gdb/event-top.c 2008-03-14 19:55:51.000000000 +0000
+++ src2/gdb/event-top.c 2008-05-02 11:24:30.000000000 +0100
@@ -31,6 +31,7 @@
#include <signal.h>
#include "exceptions.h"
#include "cli/cli-script.h" /* for reset_command_nest_depth */
+#include "main.h"
/* For dont_repeat() */
#include "gdbcmd.h"
@@ -1084,8 +1085,6 @@ gdb_setup_readline (void)
that the sync setup is ALL done in gdb_init, and we would only
mess it up here. The sync stuff should really go away over
time. */
- extern int batch_silent;
-
if (!batch_silent)
gdb_stdout = stdio_fileopen (stdout);
gdb_stderr = stdio_fileopen (stderr);
Index: src2/gdb/main.h
===================================================================
--- src2.orig/gdb/main.h 2008-01-01 22:53:12.000000000 +0000
+++ src2/gdb/main.h 2008-05-02 14:52:31.000000000 +0100
@@ -33,5 +33,6 @@ extern int gdb_main (struct captured_mai
/* From main.c. */
extern int return_child_result;
extern int return_child_result_value;
+extern int batch_silent;
#endif
Index: src2/gdb/Makefile.in
===================================================================
--- src2.orig/gdb/Makefile.in 2008-05-02 10:32:53.000000000 +0100
+++ src2/gdb/Makefile.in 2008-05-02 14:51:38.000000000 +0100
@@ -2110,7 +2110,7 @@ event-loop.o: event-loop.c $(defs_h) $(e
event-top.o: event-top.c $(defs_h) $(top_h) $(inferior_h) $(target_h) \
$(terminal_h) $(event_loop_h) $(event_top_h) $(interps_h) \
$(exceptions_h) $(cli_script_h) $(gdbcmd_h) $(readline_h) \
- $(readline_history_h)
+ $(readline_history_h) $(main_h)
exceptions.o: exceptions.c $(defs_h) $(exceptions_h) $(breakpoint_h) \
$(target_h) $(inferior_h) $(annotate_h) $(ui_out_h) $(gdb_assert_h) \
$(gdb_string_h) $(serial_h)
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH] Prevent source file errors in --batch-silent mode
2008-05-02 14:03 ` Andrew STUBBS
@ 2008-05-02 14:10 ` Daniel Jacobowitz
2008-05-03 6:23 ` Thiago Jung Bauermann
0 siblings, 1 reply; 13+ messages in thread
From: Daniel Jacobowitz @ 2008-05-02 14:10 UTC (permalink / raw)
To: gdb-patches
On Fri, May 02, 2008 at 03:00:15PM +0100, Andrew STUBBS wrote:
> I think I've been spoilt by makefiles that generate the dependencies
> automatically. :)
Yeah. The next time there's a break in the furious feature
development GDB's seen lately, and I have some time for
infrastructure work, that is on my list.
The other items on that list are "move to bugzilla" and "switch src to
svn 1.5 when it is released", FWIW.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Prevent source file errors in --batch-silent mode
2008-05-02 14:10 ` Daniel Jacobowitz
@ 2008-05-03 6:23 ` Thiago Jung Bauermann
2008-05-03 14:26 ` Christopher Faylor
2008-05-03 15:33 ` Daniel Jacobowitz
0 siblings, 2 replies; 13+ messages in thread
From: Thiago Jung Bauermann @ 2008-05-03 6:23 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches
On Fri, 2008-05-02 at 10:06 -0400, Daniel Jacobowitz wrote:
> On Fri, May 02, 2008 at 03:00:15PM +0100, Andrew STUBBS wrote:
> > I think I've been spoilt by makefiles that generate the dependencies
> > automatically. :)
>
> Yeah. The next time there's a break in the furious feature
> development GDB's seen lately, and I have some time for
> infrastructure work, that is on my list.
Nice.
> The other items on that list are "move to bugzilla"
Nice!
> and "switch src to svn 1.5 when it is released", FWIW.
Hum... any reason in particular for that? It seems everyone keeps their
own version of the GDB source tree. Using a distributed VCS would ease
that work and benefit everybody...
Besides, there are talks of moving gcc to a DVCS also, no?
Or is this flamebait and I've just bitten? :-)
--
[]'s
Thiago Jung Bauermann
Software Engineer
IBM Linux Technology Center
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Prevent source file errors in --batch-silent mode
2008-05-03 6:23 ` Thiago Jung Bauermann
@ 2008-05-03 14:26 ` Christopher Faylor
2008-05-03 20:56 ` Thiago Jung Bauermann
2008-05-03 15:33 ` Daniel Jacobowitz
1 sibling, 1 reply; 13+ messages in thread
From: Christopher Faylor @ 2008-05-03 14:26 UTC (permalink / raw)
To: Thiago Jung Bauermann, gdb-patches, Daniel Jacobowitz
On Sat, May 03, 2008 at 01:47:26AM -0300, Thiago Jung Bauermann wrote:
>On Fri, 2008-05-02 at 10:06 -0400, Daniel Jacobowitz wrote:
>>On Fri, May 02, 2008 at 03:00:15PM +0100, Andrew STUBBS wrote:
>>>I think I've been spoilt by makefiles that generate the dependencies
>>>automatically. :)
>>
>>Yeah. The next time there's a break in the furious feature development
>>GDB's seen lately, and I have some time for infrastructure work, that
>>is on my list.
>
>Nice.
>
>>The other items on that list are "move to bugzilla"
>
>Nice!
>
>>and "switch src to svn 1.5 when it is released", FWIW.
>
>Hum... any reason in particular for that? It seems everyone keeps
>their own version of the GDB source tree. Using a distributed VCS
>would ease that work and benefit everybody...
>
>Besides, there are talks of moving gcc to a DVCS also, no?
>
>Or is this flamebait and I've just bitten? :-)
Maybe a little.
We do have a read-only git mirror of the gcc svn repository now but I
don't think anyone is talking about making it the official repository.
If we wanted to, we could probably make a read-only git copy of the gdb
cvs repo too.
cgf
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Prevent source file errors in --batch-silent mode
2008-05-03 14:26 ` Christopher Faylor
@ 2008-05-03 20:56 ` Thiago Jung Bauermann
0 siblings, 0 replies; 13+ messages in thread
From: Thiago Jung Bauermann @ 2008-05-03 20:56 UTC (permalink / raw)
To: Christopher Faylor; +Cc: gdb-patches, Daniel Jacobowitz
On Sat, 2008-05-03 at 01:13 -0400, Christopher Faylor wrote:
> We do have a read-only git mirror of the gcc svn repository now but I
> don't think anyone is talking about making it the official repository.
Ah, I misunderstood.
> If we wanted to, we could probably make a read-only git copy of the gdb
> cvs repo too.
I think it would be useful to have this, especially if we don't go the
DVCS route in the future.
--
[]'s
Thiago Jung Bauermann
Software Engineer
IBM Linux Technology Center
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Prevent source file errors in --batch-silent mode
2008-05-03 6:23 ` Thiago Jung Bauermann
2008-05-03 14:26 ` Christopher Faylor
@ 2008-05-03 15:33 ` Daniel Jacobowitz
2008-05-03 20:54 ` Thiago Jung Bauermann
1 sibling, 1 reply; 13+ messages in thread
From: Daniel Jacobowitz @ 2008-05-03 15:33 UTC (permalink / raw)
To: Thiago Jung Bauermann; +Cc: gdb-patches
On Sat, May 03, 2008 at 01:47:26AM -0300, Thiago Jung Bauermann wrote:
> > and "switch src to svn 1.5 when it is released", FWIW.
>
> Hum... any reason in particular for that? It seems everyone keeps their
> own version of the GDB source tree. Using a distributed VCS would ease
> that work and benefit everybody...
Because SVN is similar enough to CVS to be an easy transition and
advanced enough that it can gateway to and from other VCS's (svk, git,
presumably hg too) reliably for those who prefer something different.
There's no need to break up everyone's workflow and I refuse to do it.
> Besides, there are talks of moving gcc to a DVCS also, no?
Not seriously that I'm aware of.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Prevent source file errors in --batch-silent mode
2008-05-03 15:33 ` Daniel Jacobowitz
@ 2008-05-03 20:54 ` Thiago Jung Bauermann
2008-05-03 21:48 ` Daniel Jacobowitz
0 siblings, 1 reply; 13+ messages in thread
From: Thiago Jung Bauermann @ 2008-05-03 20:54 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches
On Sat, 2008-05-03 at 10:26 -0400, Daniel Jacobowitz wrote:
> On Sat, May 03, 2008 at 01:47:26AM -0300, Thiago Jung Bauermann wrote:
> > > and "switch src to svn 1.5 when it is released", FWIW.
> >
> > Hum... any reason in particular for that? It seems everyone keeps their
> > own version of the GDB source tree. Using a distributed VCS would ease
> > that work and benefit everybody...
>
> Because SVN is similar enough to CVS to be an easy transition and
When you say easy are you thinking of the similar concepts and usability
they have, or the migration process in itself?
> advanced enough that it can gateway to and from other VCS's (svk, git,
> presumably hg too) reliably for those who prefer something different.
I just read the git-svn manpage and there are some restrictions you
should observe to avoid problems. I never used the tool, but it seems
those restrictions can become annoying, so if the svn route is to be
taken I think having the read-only git mirror cgf mentions would be a
useful thing.
> There's no need to break up everyone's workflow and I refuse to do it.
By this you mean forcing everyone to grok/use the distributed model? If
this is an important consideration, Bazaar can be a good option since it
supports both workflows at the same time in a given repo, i.e., a
developer can choose to do a checkout or a clone.
--
[]'s
Thiago Jung Bauermann
Software Engineer
IBM Linux Technology Center
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Prevent source file errors in --batch-silent mode
2008-05-03 20:54 ` Thiago Jung Bauermann
@ 2008-05-03 21:48 ` Daniel Jacobowitz
0 siblings, 0 replies; 13+ messages in thread
From: Daniel Jacobowitz @ 2008-05-03 21:48 UTC (permalink / raw)
To: Thiago Jung Bauermann; +Cc: gdb-patches
I don't think we should have this discussion again. It's been had
plenty of times in the past; if you want to restart it send me some
mail off-list and I'll answer there. I am completely convinced that
CVS->Subversion is a reasonable migration for the src repository
and that CVS->distributed VC is not.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2008-05-03 20:56 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-21 19:34 [PATCH] Prevent source file errors in --batch-silent mode Andrew STUBBS
2008-04-28 19:02 ` Andrew STUBBS
2008-05-01 20:34 ` Daniel Jacobowitz
2008-05-02 11:35 ` Andrew STUBBS
2008-05-02 13:46 ` Daniel Jacobowitz
2008-05-02 14:03 ` Andrew STUBBS
2008-05-02 14:10 ` Daniel Jacobowitz
2008-05-03 6:23 ` Thiago Jung Bauermann
2008-05-03 14:26 ` Christopher Faylor
2008-05-03 20:56 ` Thiago Jung Bauermann
2008-05-03 15:33 ` Daniel Jacobowitz
2008-05-03 20:54 ` Thiago Jung Bauermann
2008-05-03 21:48 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox