* Always disable pagination with MI?
@ 2010-03-03 21:39 Pedro Alves
2010-03-03 21:40 ` Pedro Alves
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Pedro Alves @ 2010-03-03 21:39 UTC (permalink / raw)
To: gdb-patches
A customer noted that sometimes, when GDB failed to evaluate
a watchpoint's condition, GDB would leave the inferior
stopped, but would forget to output a *stopped notification.
Something like this:
gdb -i=mi ...
...
(gdb)
&"Error in testing breakpoint condition:\n"
&"Cannot access memory at address 0x0\n"
~"Hardware watchpoint 2: global2\n"
~"\n"
~"Old value = 1\n"
~"New value = 2\n"
And nothing else came out. What was really happening, is
that pagination kicked in at this point, because no pagination
prompt is visible. If one presses enter when this happens,
the rest of the expected output, along with *stopped actually
comes out:
gdb -i=mi ...
...
(gdb)
&"Error in testing breakpoint condition:\n"
&"Cannot access memory at address 0x0\n"
~"Hardware watchpoint 2: global2\n"
~"\n"
~"Old value = 1\n"
~"New value = 2\n"
<ENTER>
~"main () at ../../../src/gdb/testsuite/gdb.base/watch-cond.c:42\n"
~"42\t func(&q);\n"
*stopped,frame={addr="0x000000000040058e",func="main",args=[],file="../../../src/gdb/testsuite/gdb.base/watch- cond.c",fullname="/home/pedro/gdb/baseline/src/gdb/testsuite/gdb.base/watch-cond.c",line="42"},thread-id="1",stopped-threads="all",core="1"
(gdb)
Pagination kicks in because that output is going to
gdb_stdout.
Obviously, this is lame. You can actually reproduce this
MI + pagination badness simply by issuing enough CLI
commands to fill a page, like this for example:
$ ./gdb -i=mi ./gdb
=thread-group-added,id="i1"
(gdb)
ib
&"ib\n"
~"Num Type Disp Enb Address What\n"
~"1 breakpoint keep y 0x00000000004645e4 in internal_error at ../../src/gdb/utils.c:1048\n"
~"2 breakpoint keep y 0x00000000004d7895 in info_command at ../../src/gdb/cli/cli-cmds.c:223\n"
~" silent\n"
~" return\n"
^done
<repeat "info break" a few times, and then:>
(gdb)
ib
&"ib\n"
~"Num Type Disp Enb Address What\n"
~"1 breakpoint keep y 0x00000000004645e4 in internal_error at ../../src/gdb/utils.c:1048\n"
<ENTER>
$ Segmentation fault
Whoops. I tried this on 6.8 and 7.0 and they behave
the same. This was probably never right, and I gather that
most frontends must be disabling pagination
already: either by explicit "set height 0"/"set pagination off",
or implicitly by running GDB from a non-tty, and, those that
want pagination handle it themselves.
Any objections to this?
--
Pedro Alves
2010-03-03 Pedro Alves <pedro@codesourcery.com>
gdb/
* utils.c (fputs_maybe_filtered): Always disable pagination if the
top level interpreter is MI.
---
gdb/utils.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
Index: src/gdb/utils.c
===================================================================
--- src.orig/gdb/utils.c 2010-03-03 20:55:57.000000000 +0000
+++ src/gdb/utils.c 2010-03-03 20:56:49.000000000 +0000
@@ -71,6 +71,7 @@
#include <time.h>
#include "gdb_usleep.h"
+#include "interps.h"
#if !HAVE_DECL_MALLOC
extern PTR malloc (); /* ARI: PTR */
@@ -2209,8 +2210,10 @@ fputs_maybe_filtered (const char *linebu
return;
/* Don't do any filtering if it is disabled. */
- if ((stream != gdb_stdout) || !pagination_enabled
- || (lines_per_page == UINT_MAX && chars_per_line == UINT_MAX))
+ if (stream != gdb_stdout
+ || !pagination_enabled
+ || (lines_per_page == UINT_MAX && chars_per_line == UINT_MAX)
+ || ui_out_is_mi_like_p (interp_ui_out (top_level_interpreter ())))
{
fputs_unfiltered (linebuffer, stream);
return;
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: Always disable pagination with MI?
2010-03-03 21:39 Always disable pagination with MI? Pedro Alves
@ 2010-03-03 21:40 ` Pedro Alves
2010-03-03 21:53 ` Tom Tromey
2010-03-03 22:09 ` Vladimir Prus
2 siblings, 0 replies; 7+ messages in thread
From: Pedro Alves @ 2010-03-03 21:40 UTC (permalink / raw)
To: gdb-patches
On Wednesday 03 March 2010 21:38:54, Pedro Alves wrote:
> And nothing else came out. What was really happening, is
> that pagination kicked in at this point, because no pagination
^
" but isn't obvious"
> prompt is visible. If one presses enter when this happens,
--
Pedro Alves
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: Always disable pagination with MI?
2010-03-03 21:39 Always disable pagination with MI? Pedro Alves
2010-03-03 21:40 ` Pedro Alves
@ 2010-03-03 21:53 ` Tom Tromey
2010-03-04 5:19 ` Joel Brobecker
2010-03-03 22:09 ` Vladimir Prus
2 siblings, 1 reply; 7+ messages in thread
From: Tom Tromey @ 2010-03-03 21:53 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
>>>>> "Pedro" == Pedro Alves <pedro@codesourcery.com> writes:
Pedro> Any objections to this?
Pedro> 2010-03-03 Pedro Alves <pedro@codesourcery.com>
Pedro> gdb/
Pedro> * utils.c (fputs_maybe_filtered): Always disable pagination if the
Pedro> top level interpreter is MI.
FWIW, it seems reasonable to me.
There is a related PR about disabling pagination when using --batch.
I wonder whether anybody would object to that?
Tom
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Always disable pagination with MI?
2010-03-03 21:39 Always disable pagination with MI? Pedro Alves
2010-03-03 21:40 ` Pedro Alves
2010-03-03 21:53 ` Tom Tromey
@ 2010-03-03 22:09 ` Vladimir Prus
2010-03-04 17:15 ` Marc Khouzam
2 siblings, 1 reply; 7+ messages in thread
From: Vladimir Prus @ 2010-03-03 22:09 UTC (permalink / raw)
To: gdb-patches
Pedro Alves wrote:
> A customer noted that sometimes, when GDB failed to evaluate
> a watchpoint's condition, GDB would leave the inferior
> stopped, but would forget to output a *stopped notification.
> Something like this:
>
> gdb -i=mi ...
> ...
> (gdb)
> &"Error in testing breakpoint condition:\n"
> &"Cannot access memory at address 0x0\n"
> ~"Hardware watchpoint 2: global2\n"
> ~"\n"
>
> ~"Old value = 1\n"
> ~"New value = 2\n"
>
> And nothing else came out. What was really happening, is
> that pagination kicked in at this point, because no pagination
> prompt is visible. If one presses enter when this happens,
> the rest of the expected output, along with *stopped actually
> comes out:
...
> Whoops. I tried this on 6.8 and 7.0 and they behave
> the same. This was probably never right, and I gather that
> most frontends must be disabling pagination
> already: either by explicit "set height 0"/"set pagination off",
> or implicitly by running GDB from a non-tty, and, those that
> want pagination handle it themselves.
Yes, I think that's what frontends do.
>
> Any objections to this?
>
Seems reasonable, FWIW.
- Volodya
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: Always disable pagination with MI?
2010-03-03 22:09 ` Vladimir Prus
@ 2010-03-04 17:15 ` Marc Khouzam
2010-03-04 17:33 ` Pedro Alves
0 siblings, 1 reply; 7+ messages in thread
From: Marc Khouzam @ 2010-03-04 17:15 UTC (permalink / raw)
To: Vladimir Prus, gdb-patches
> > Whoops. I tried this on 6.8 and 7.0 and they behave the
> same. This
> > was probably never right, and I gather that most frontends must be
> > disabling pagination
> > already: either by explicit "set height 0"/"set pagination off", or
> > implicitly by running GDB from a non-tty, and, those that want
> > pagination handle it themselves.
>
> Yes, I think that's what frontends do.
Just a clarification on what a front-end must do.
DSF-GDB only turns off pagination with non-stop mode.
And we don't current "set height 0" (CDI-GDB does)
But I believe we run from a non-tty.
Should I be safe and always turn off pagination,
or am I safe already?
Thanks
Marc
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-03-04 17:33 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-03 21:39 Always disable pagination with MI? Pedro Alves
2010-03-03 21:40 ` Pedro Alves
2010-03-03 21:53 ` Tom Tromey
2010-03-04 5:19 ` Joel Brobecker
2010-03-03 22:09 ` Vladimir Prus
2010-03-04 17:15 ` Marc Khouzam
2010-03-04 17:33 ` Pedro Alves
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox