public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* GDB ui word wrapping broken/interferes with 'set style'  ?
@ 2018-12-30 14:51 Philippe Waroquiers
  2018-12-30 20:26 ` Tom Tromey
  0 siblings, 1 reply; 12+ messages in thread
From: Philippe Waroquiers @ 2018-12-30 14:51 UTC (permalink / raw)
  To: gdb-patches

Since some days, it looks like the word wrapping of GDB
is broken.
I have not investigated where it comes from,
but it looks related to the 'set style' patch.

When setting a breakpoint at cli-out.c:174 in a recent GDB master,
this is what I see in emacs/gud-gdb buffer top-gdb (master) to
debug itself:

(top-gdb) c
Continuing.

Breakpoint 3, cli_ui_out::do_field_string (this=0x55cb92eaf4
    20, fldno=<optimized out>, width=<optimiz
    ed out>, align=ui_noalign, fldname=<optim
    ized out>, string=0x7ffdadedc6c8 "#0  proc_in_
    c", style=ui_out_style_kind
    ::FUNCTION) at ../../binutils-gdb/gdb/cli-out.
   c:174

(the above is obtained by debugging gdb.ada/info_auto_lang/proc_in_ada,
setting a breakpoint in proc_in_c, continue, and then doing backtrace).
So, wrapping happens in the middle of words/addresses/filenames/funnames.

After using set style enabled off in the top-gdb, no change:
word wrapping is still done at strange places.

When debugging with GDB 8.2, a similar gud-gdb/top-gdb gives:
(top-gdb) c
Continuing.

Breakpoint 3, cli_ui_out::do_field_string (this=0x55cb92eaf420, 
    fldno=<optimized out>, width=<optimized out>, align=ui_noalign, 
    fldname=<optimized out>, string=0x7ffdadedc6c8 "#0  proc_in_c", 
    style=ui_out_style_kind::FUNCTION) at ../../binutils-gdb/gdb/cli-out.c:174

In a terminal (xfce4-terminal), the layout in a top-gdb (master)
is similarly strange:
(top-gdb) c
Continuing.

Breakpoint 3, cli_ui_out::do_field_string (this=0x55
    cb92eaf420, fldno=<optimized out>, widt
    h=<optimized out>, align=ui_noalign, fl
    dname=<optimized out>, string=0x55cb92f59c
    d0 "#1  \033[34m0x0000555555555477\033[m in proc_in_ada", style=ui_out_style_kind::FUNCTION) at ../../binu
   tils-gdb/gdb/cli-out.c:174
174		  fstyle = function_name_style.style ();


Note that in the above, 'Breakpoint 3, cli_ui_out::do_field_string',
this, fldno, widt, h, align, fl, dname, string, style,
../../binu, tils-gdb/gdb/cli-out.c are all colored.


In the same terminal, after 'set style enabled off' in the top-gdb,
same strange wrapping, but no color anymore.

When playing with 'set width', it looks like the wrapping
interferes with the coloring:
Breakpoint 3, cli_ui_out::do_field_string (this=0x55cb92eaf420, fldno=
    <optimized out>, width=<optimized out>, align=ui_noalign, f
    ldname=<optimized out>, string=0x7ffdadedc6c8 "#0  proc_in_c", style
^[[    m=ui_out_style_kind::FUNCTION) at ../../binutils-gdb/gdb/cli-out.c:174
174		  fstyle = function_name_style.style ();

In the above, there is a new line after style, then a strange character
(I think from the color control sequence broken by wrapping),
and the blue color used for 'style' continues till and including the 'at',
when the filename is colored in green.

Philippe


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: GDB ui word wrapping broken/interferes with 'set style'  ?
  2018-12-30 14:51 GDB ui word wrapping broken/interferes with 'set style' ? Philippe Waroquiers
@ 2018-12-30 20:26 ` Tom Tromey
  2018-12-30 23:45   ` Tom Tromey
  0 siblings, 1 reply; 12+ messages in thread
From: Tom Tromey @ 2018-12-30 20:26 UTC (permalink / raw)
  To: Philippe Waroquiers; +Cc: gdb-patches

>>>>> "Philippe" == Philippe Waroquiers <philippe.waroquiers@skynet.be> writes:

Philippe> Since some days, it looks like the word wrapping of GDB
Philippe> is broken.
Philippe> I have not investigated where it comes from,
Philippe> but it looks related to the 'set style' patch.

Seems very likely.  Thanks for the report, I will look into it.

Tom

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: GDB ui word wrapping broken/interferes with 'set style'  ?
  2018-12-30 20:26 ` Tom Tromey
@ 2018-12-30 23:45   ` Tom Tromey
  2018-12-31  8:13     ` Philippe Waroquiers
  0 siblings, 1 reply; 12+ messages in thread
From: Tom Tromey @ 2018-12-30 23:45 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Philippe Waroquiers, gdb-patches

Tom> Seems very likely.  Thanks for the report, I will look into it.

Please try this.  I think it fixes both of the styling problems you
reported, but it's better if you check it too.  If it works for you I
will write a test case.

thanks,
Tom

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 7be4360e62..0d1fcb79f1 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2018-12-30  Tom Tromey  <tom@tromey.com>
+
+	* utils.c (flush_wrap_buffer): Only flush gdb_stdout.
+
 2018-12-30  Tom Tromey  <tom@tromey.com>
 
 	* event-top.h (command_line_handler): Update.
diff --git a/gdb/utils.c b/gdb/utils.c
index 3a6f796f2b..753eb14280 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -1589,7 +1589,7 @@ reinitialize_more_filter (void)
 static void
 flush_wrap_buffer (struct ui_file *stream)
 {
-  if (!wrap_buffer.empty ())
+  if (stream == gdb_stdout && !wrap_buffer.empty ())
     {
       fputs_unfiltered (wrap_buffer.c_str (), stream);
       wrap_buffer.clear ();

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: GDB ui word wrapping broken/interferes with 'set style'  ?
  2018-12-30 23:45   ` Tom Tromey
@ 2018-12-31  8:13     ` Philippe Waroquiers
  2019-01-06 23:40       ` Tom Tromey
  0 siblings, 1 reply; 12+ messages in thread
From: Philippe Waroquiers @ 2018-12-31  8:13 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On Sun, 2018-12-30 at 16:45 -0700, Tom Tromey wrote:
> Tom> Seems very likely.  Thanks for the report, I will look into it.
> 
> Please try this.  I think it fixes both of the styling problems you
> reported, but it's better if you check it too.  If it works for you I
> will write a test case.
Function and address colors are now as expected in the backtrace.

For word wrapping, I could not make it split addresses anymore,
but I still see differences with the 8.2 behaviour,
where the new gdb git+patch still splits filenames or some values.

8.2:
 (gdb) bt
#0  proc_in_c () at /bd/home/philippe/gdb/git/smallthing/gdb/testsuite/gdb.ada/info_auto_lang/some_c.c:26
#1  0x0000555555555477 in proc_in_ada ()
    at /bd/home/philippe/gdb/git/smallthing/gdb/testsuite/gdb.ada/info_auto_lang/proc_in_ada.adb:22
(gdb) 

git+patch:
(gdb) bt
#0  proc_in_c () at /bd/home/philippe/gdb/git/smallthing/gdb/testsuite/gdb.ada/info_auto_lang/some_c.c:26
#1  0x0000555555555477 in proc_in_ada () at /bd/home/philippe/gdb/git/smallthing/gdb/testsuite/gdb.ada/info_auto_lan
   g/proc_in_ada.adb:22
(gdb) 

(in both cases, 'show width' shows 116).

In a top-gdb debugging itself, I e.g. got the 'style' value which is split after FUNCTIO:
Breakpoint 3, cli_ui_out::do_field_string (this=0x562a4563f010, fldno=<optimized out>, width=<optimized out>, align=
    ui_noalign, fldname=<optimized out>, string=0x7ffd643d1ac8 "proc_in_ada", style=ui_out_style_kind::FUNCTIO
    N) at ../../smallthing/gdb/cli-out.c:174
174		  fstyle = function_name_style.style ();
(top-gdb) show width
Number of characters gdb thinks are in a line is 116.


If I change the width, the new gdb gives:
(gdb) set width 40
(gdb) bt
#0  proc_in_c () at /bd/home/philippe/gd
   b/git/smallthing/gdb/testsuite/gdb.ada/info_auto_lang/some_c.c:26
#1  0x0000555555555477 in proc_in_ada ()
    at /bd/home/philippe/gdb/git/smal
   lthing/gdb/testsuite/gdb.ada/info_auto_lang/proc_in_ada.adb:22
(gdb)
 
while 8.2 gives:
(gdb) set width 40
(gdb) bt
#0  proc_in_c ()
    at /bd/home/philippe/gdb/git/smallthing/gdb/testsuite/gdb.ada/info_auto_lang/some_c.c:26
#1  0x0000555555555477 in proc_in_ada
    ()
    at /bd/home/philippe/gdb/git/smallthing/gdb/testsuite/gdb.ada/info_auto_lang/proc_in_ada.adb:22
(gdb) 


Playing further with smaller width, git+patch:
<et width 15     
(gdb) bt
#0  proc_in_c (
   ) at /bd/h
   ome/philippe/gdb/git/smallthing/gdb/testsuite/gdb.ada/info_auto_lang/some_c.c:26
#1  0x0000555555555477 in proc_in_ada () at /
   bd/home/philippe/gdb/git/smallthing/gdb/testsuite/gdb.ada/info_auto_lang/proc_in_ada.adb:22
<idth 14
(gdb) bt
#0  proc_in_c 
   () at /bd/
   home/philippe/gdb/git/smallthing/gdb/testsuite/gdb.ada/info_auto_lang/some_c.c:26
#1  0x0000555555555477 in proc_in_ada () a
   t /bd/home/philippe/gdb/git/smallthing/gdb/testsuite/gdb.ada/info_auto_lang/proc_in_ada.adb:22
<idth 13
(gdb) bt
#0  proc_in_c () at /bd/ho
   me/philippe/gdb/git/smallthing/gdb/testsuite/gdb.ada/info_auto_lang/some_c.c:26
#1  0x0000555555555477 in proc_in_ada (
   ) at /bd
   /home/philippe/gdb/git/smallthing/gdb/testsuite/gdb.ada/info_auto_lang/proc_in_ada.adb:22
(gdb) 

8.2:
(gdb) set width 15
(gdb) bt
#0  proc_in_c
    ()
    at /bd/home/philippe/gdb/git/smallthing/gdb/testsuite/gdb.ada/info_auto_lang/some_c.c:26
#1  0x0000555555555477 in proc_in_ada ()
    at /bd/home/philippe/gdb/git/smallthing/gdb/testsuite/gdb.ada/info_auto_lang/proc_in_ada.adb:22
<idth 14    
(gdb) bt
#0  proc_in_c
    ()
    at /bd/home/philippe/gdb/git/smallthing/gdb/testsuite/gdb.ada/info_auto_lang/some_c.c:26
#1  0x0000555555555477 in proc_in_ada ()
    at /bd/home/philippe/gdb/git/smallthing/gdb/testsuite/gdb.ada/info_auto_lang/proc_in_ada.adb:22
< width 13 
(gdb) bt
#0  proc_in_c ()
    at /bd/home/philippe/gdb/git/smallthing/gdb/testsuite/gdb.ada/info_auto_lang/some_c.c:26
#1  0x0000555555555477 in proc_in_ada
    ()
    at /bd/home/philippe/gdb/git/smallthing/gdb/testsuite/gdb.ada/info_auto_lang/proc_in_ada.adb:22
(gdb) 


Note that the behaviour of 8.2 is not always consistent for all commands.
E.g. info breaks in top-gdb gives:
(top-gdb) info break
Num     Type           Disp Enb Address            What
1       breakpoint     keep y   0x0000562a43bbbdd0 in internal_error(char const*, int, char const*, ...) 
                                                   at ../../smallthing/gdb/common/errors.c:51
2       breakpoint     keep y   0x0000562a43ba3510 in info_command(char const*, int) 
                                                   at ../../smallthing/gdb/cli/cli-cmds.c:199
        silent
        return
3       breakpoint     keep y   0x0000562a43ba2610 in cli_ui_out::do_field_string(int, int, ui_align, char const*, char const*, ui_out_style_kind) at ../../smallthing/gdb/cli-out.c:174
	breakpoint already hit 2 times
(top-gdb) 

So, it splits before the ' at' in the first 2, but uses one single line
for the 3rd breakpoint.

gdb+patch gives:
(top-gdb) info break
Num     Type           Disp Enb Address            What
1       breakpoint     keep y   0x0000562a43bbbdd0 in internal_error(char const*, int, char const*, ...) at ../../sm
                                                   allthing/gdb/common/errors.c:51
2       breakpoint     keep y   0x0000562a43ba3510 in info_command(char const*, int) at ../../smallthing/gdb/cli/cli
                                                   -cmds.c:199
        silent
        return
3       breakpoint     keep y   0x0000562a43ba2610 in cli_ui_out::do_field_string(int, int, ui_align, char const*, char const*, ui_out_style_kind) at ../../smallthing/gdb/cli-out.c:174
	breakpoint already hit 4 times
(top-gdb) detach

So, splits in the middle of filenames for the first 2 breakpoints,
and does not split for the 3rd.


> 
> thanks,
> Tom
> 
> diff --git a/gdb/ChangeLog b/gdb/ChangeLog
> index 7be4360e62..0d1fcb79f1 100644
> --- a/gdb/ChangeLog
> +++ b/gdb/ChangeLog
> @@ -1,3 +1,7 @@
> +2018-12-30  Tom Tromey  <tom@tromey.com>
> +
> +	* utils.c (flush_wrap_buffer): Only flush gdb_stdout.
> +
>  2018-12-30  Tom Tromey  <tom@tromey.com>
>  
>  	* event-top.h (command_line_handler): Update.
> diff --git a/gdb/utils.c b/gdb/utils.c
> index 3a6f796f2b..753eb14280 100644
> --- a/gdb/utils.c
> +++ b/gdb/utils.c
> @@ -1589,7 +1589,7 @@ reinitialize_more_filter (void)
>  static void
>  flush_wrap_buffer (struct ui_file *stream)
>  {
> -  if (!wrap_buffer.empty ())
> +  if (stream == gdb_stdout && !wrap_buffer.empty ())
>      {
>        fputs_unfiltered (wrap_buffer.c_str (), stream);
>        wrap_buffer.clear ();

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: GDB ui word wrapping broken/interferes with 'set style'  ?
  2018-12-31  8:13     ` Philippe Waroquiers
@ 2019-01-06 23:40       ` Tom Tromey
  2019-01-07 13:46         ` Philippe Waroquiers
  0 siblings, 1 reply; 12+ messages in thread
From: Tom Tromey @ 2019-01-06 23:40 UTC (permalink / raw)
  To: Philippe Waroquiers; +Cc: Tom Tromey, gdb-patches

>>>>> "Philippe" == Philippe Waroquiers <philippe.waroquiers@skynet.be> writes:

Philippe> For word wrapping, I could not make it split addresses anymore,
Philippe> but I still see differences with the 8.2 behaviour,
Philippe> where the new gdb git+patch still splits filenames or some values.
[...]

Ok, I think I finally found this.  I have a patch that works for me.
I still have to write a test case.

I looked into writing a unit test, but that is pretty complicated given
the many conditions at the top of fputs_maybe_filtered.  I suppose I'd
have to install a new top level interpreter to make it possible, among
other things.  (It seems to me that maybe this should check some
property of the ui_file and not the interpreter, but that's a much
larger patch...)

Tom

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: GDB ui word wrapping broken/interferes with 'set style'  ?
  2019-01-06 23:40       ` Tom Tromey
@ 2019-01-07 13:46         ` Philippe Waroquiers
  2019-01-07 14:49           ` Tom Tromey
  0 siblings, 1 reply; 12+ messages in thread
From: Philippe Waroquiers @ 2019-01-07 13:46 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On Sun, 2019-01-06 at 16:40 -0700, Tom Tromey wrote:
> > > > > > "Philippe" == Philippe Waroquiers <philippe.waroquiers@skynet.be> writes:
> 
> Philippe> For word wrapping, I could not make it split addresses anymore,
> Philippe> but I still see differences with the 8.2 behaviour,
> Philippe> where the new gdb git+patch still splits filenames or some values.
> [...]
> 
> Ok, I think I finally found this.  I have a patch that works for me.
> I still have to write a test case.
> 
> I looked into writing a unit test, but that is pretty complicated given
> the many conditions at the top of fputs_maybe_filtered.  I suppose I'd
> have to install a new top level interpreter to make it possible, among
> other things.  (It seems to me that maybe this should check some
> property of the ui_file and not the interpreter, but that's a much
> larger patch...)
> 
> Tom
Thanks for the investigations.  If you deem it useful, I can do
some manual validation of the patch, waiting for the test case and/or
unit test.

Philippe

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: GDB ui word wrapping broken/interferes with 'set style'  ?
  2019-01-07 13:46         ` Philippe Waroquiers
@ 2019-01-07 14:49           ` Tom Tromey
  2019-01-07 16:56             ` Philippe Waroquiers
  0 siblings, 1 reply; 12+ messages in thread
From: Tom Tromey @ 2019-01-07 14:49 UTC (permalink / raw)
  To: Philippe Waroquiers; +Cc: Tom Tromey, gdb-patches

>>>>> "Philippe" == Philippe Waroquiers <philippe.waroquiers@skynet.be> writes:

Philippe> Thanks for the investigations.  If you deem it useful, I can do
Philippe> some manual validation of the patch, waiting for the test case and/or
Philippe> unit test.

It's in crude form on my github, branch submit/fix-pager.

Tom

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: GDB ui word wrapping broken/interferes with 'set style'  ?
  2019-01-07 14:49           ` Tom Tromey
@ 2019-01-07 16:56             ` Philippe Waroquiers
  2019-01-12 17:03               ` Tom Tromey
  0 siblings, 1 reply; 12+ messages in thread
From: Philippe Waroquiers @ 2019-01-07 16:56 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On Mon, 2019-01-07 at 07:48 -0700, Tom Tromey wrote:
> > > > > > "Philippe" == Philippe Waroquiers <philippe.waroquiers@skynet.be> writes:
> 
> Philippe> Thanks for the investigations.  If you deem it useful, I can do
> Philippe> some manual validation of the patch, waiting for the test case and/or
> Philippe> unit test.
> 
> It's in crude form on my github, branch submit/fix-pager.
> 
> Tom
Seems to work much better, but I still found 2 strange things:

I debugged gdb with this gdb, did various commands, and then a bt full
which was ok:
(top-gdb) bt full
#0  0x00007f0b1ff97660 in __poll_nocancel () at ../sysdeps/unix/syscall-template.S:84
No locals.
#1  0x000055bd7edc2af1 in poll (__timeout=-1, __nfds=<optimized out>, __fds=<optimized out>)
    at /usr/include/x86_64-linux-gnu/bits/poll2.h:46
No locals.
#2  gdb_wait_for_event (block=block@entry=1) at ../../binutils-gdb/gdb/event-loop.c:772
        timeout = -1
        file_ptr = <optimized out>
        num_found = 0
        __PRETTY_FUNCTION__ = "int gdb_wait_for_event(int)"


I changed the width to 40, and then there were a few lines and spaces before the  #0 
(I am not completely sure how to reproduce the below.  You might need to quit or C-c
a previous paged command.  So maybe this is the same problem as the next one
(maybe some data that stays in a buffer after a quit or C-c).

(top-gdb) set width 40
(top-gdb) bt full

          #0  0x00007f0b1ff97660 in __poll_nocancel ()
    at ../sysdeps/unix/syscall-template.S:84
No locals.
#1  0x000055bd7edc2af1 in poll (
    __timeout=-1, 
    __nfds=<optimized out>, 
    __fds=<optimized out>)
    at /usr/include/x86_64-linux-gnu/bits/poll2.h:46
No locals.
#2  gdb_wait_for_event (
    block=block@entry=1)
...


Also, when doing q (to stop paging):
...
#3  0x000055bd7edc2c54 in gdb_do_one_event ()
    at ../../binutils-gdb/gdb/event-loop.c:347
        number_of_sources = <optimized out>
        current = 3
        event_source_head = 2
        res = <optimized out>
#4  0x000055bd7edc2de5 in gdb_do_one_event ()
<continue without paging--q
 at ../../binutils-gdb/gdb/common/cQuit
(top-gdb) help
List of classes of commands:

aliases -- Aliases of other commands
breakpoints -- Making program stop at certain points
data -- Examining data
...

We still have the ' at ../../binutils-gdb/gdb/common/cQuit'
shown after the quit. It is shown in green, and then (top-gdb)
and all what follows (the help command, and its output) is in
green.
The color goes back to normal as soon as a command produces
some styled output (e.g.  p $sp).


Also, the msg at the end of each page also appears at different columns,
e.g.

...
#14 0x000055bd7edc37a9 in gdb_rl_callback_read_char_wrapper (
    client_data=<optimized out>)
    at ../../binutils-gdb/gdb/event-top.c:192
        gdb_expt = <optimized out>
<continue without paging--
#15 0x000055bd7edc3d50 in stdin_event_handler (error=<optimized out>, 
    client_data=0x55bd813aa840)
    at ../../binutils-gdb/gdb/event-top.c:511
        ui = 0x55bd813aa840
...
        exception_try_scope_instance = <optimized out>
        ex = <optimized out>
#22 gdb_main (args=<optimized out>)
    at ../../binutils-gdb/gdb/main.c:1193
        exception_try_scope_instance = {<continue without paging--
...


So, maybe something colored is still in a buffer, that is flushed
at various moments ?

Note that I also produced the above symptoms by playing
with set height 8, and quitting or C-c at various 'continue msg'.

Philippe

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: GDB ui word wrapping broken/interferes with 'set style'  ?
  2019-01-07 16:56             ` Philippe Waroquiers
@ 2019-01-12 17:03               ` Tom Tromey
  2019-01-12 17:55                 ` Philippe Waroquiers
  0 siblings, 1 reply; 12+ messages in thread
From: Tom Tromey @ 2019-01-12 17:03 UTC (permalink / raw)
  To: Philippe Waroquiers; +Cc: Tom Tromey, gdb-patches

>>>>> "Philippe" == Philippe Waroquiers <philippe.waroquiers@skynet.be> writes:

Philippe> I changed the width to 40, and then there were a few lines and spaces before the  #0 
Philippe> (I am not completely sure how to reproduce the below.  You might need to quit or C-c
Philippe> a previous paged command.  So maybe this is the same problem as the next one
Philippe> (maybe some data that stays in a buffer after a quit or C-c).

I think I've figured this out and I pushed a new patch to my WIP branch
to address it.  Could you try it out?  I still haven't written the test
case but hopefully this weekend.

Tom

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: GDB ui word wrapping broken/interferes with 'set style'  ?
  2019-01-12 17:03               ` Tom Tromey
@ 2019-01-12 17:55                 ` Philippe Waroquiers
  2019-01-12 21:08                   ` Philippe Waroquiers
  0 siblings, 1 reply; 12+ messages in thread
From: Philippe Waroquiers @ 2019-01-12 17:55 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On Sat, 2019-01-12 at 10:03 -0700, Tom Tromey wrote:
> > > > > > "Philippe" == Philippe Waroquiers <philippe.waroquiers@skynet.be> writes:
> 
> Philippe> I changed the width to 40, and then there were a few lines and spaces before the  #0 
> Philippe> (I am not completely sure how to reproduce the below.  You might need to quit or C-c
> Philippe> a previous paged command.  So maybe this is the same problem as the next one
> Philippe> (maybe some data that stays in a buffer after a quit or C-c).
> 
> I think I've figured this out and I pushed a new patch to my WIP branch
> to address it.  Could you try it out?  I still haven't written the test
> case but hopefully this weekend.

I have tested the last version.

Just two minor things found with the pager prompt:


Using (this patched) gdb to debug itself:
(top-gdb) show height
Number of lines gdb thinks are in a page is 24.
(top-gdb) show width
Number of characters gdb thinks are in a line is 80.
(top-gdb) 

Put a breakpoint in the style function:
(top-gdb) break style

In the inferior gdb, do
(gdb) info breakpoints

When the style breakpoint is encountered, do
(top-gdb) bt full

The 4th page prompt is not at the first column:
...
#9  0x000055b36e50b6f1 in execute_command (p=<optimized out>, 
    p@entry=0x55b36f6d4230 "info breakp", from_tty=1)
    at ../../gdb/gdb/top.c:630
        without_whitespace = {static npos = 18446744073709551615, 
          _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No
data fields>}, <No data fields>}, _M_p = 0x7ffd285ad140 ""}, 
          _M_string_length = 0, {
            --Type <RET> for more, q to quit, c to continue without paging--



For the same test, GDB 8.2 gives:
#9  0x000055b36e50b6f1 in execute_command (p=<optimized out>, 
    p@entry=0x55b36f6d4230 "info breakp", from_tty=1)
    at ../../gdb/gdb/top.c:630
        without_whitespace = {static npos = 18446744073709551615, 
          _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No
data fields>}, <No data fields>}, _M_p = 0x7ffd285ad140 ""}, 
--Type <RET> for more, q to quit, c to continue without paging--


Note that this behaviour is not very easy to produce.  You might be
more (un-)lucky by using e.g.
   set height 3
and then do bt full,
so as to have more page prompts.




The second thing:
-----------------

(top-gdb) set height 3
(top-gdb) info var some
All variables matching regular expression "some":

--Type <RET> for more, q to quit, c to continue without paging--
File ./complete.c:
344:	rl_compignore_func_t *rl_ignore_some_completions_function;
--Type <RET> for more, q to quit, c to continue without paging--

Non-debugging symbols:
--Type <RET> for more, q to quit, c to continue without paging--
--Type <RET> for more, q to quit, c to continue without paging--
0x000055b36e7bbc20  iterate_over_some_symtabs(char const*, char const*, compunit_symtab*,
compunit_symtab*, gdb::function_view<bool (symtab*)>)::__PRETTY_FUNCTION__
(top-gdb) 

As you can see, we have 2 successive pager prompts, but no
info in between.
GDB 8.2 does not show such behaviour.

Thanks

Philippe

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: GDB ui word wrapping broken/interferes with 'set style'  ?
  2019-01-12 17:55                 ` Philippe Waroquiers
@ 2019-01-12 21:08                   ` Philippe Waroquiers
  2019-01-14  3:55                     ` Tom Tromey
  0 siblings, 1 reply; 12+ messages in thread
From: Philippe Waroquiers @ 2019-01-12 21:08 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

Another thing:

(top-gdb) bt
#0  0x00007f6a9f44c660 in __poll_nocancel () at ../sysdeps/unix/syscall-template.S:84
#1  0x0000562224a0fe51 in poll (__timeout=-1, __nfds=<optimized out>, __fds=<optimized out>) at /usr/include/x86_64-linux-gnu/bits/poll2.h:46

In the above, the 'at' in the first line is black, and the filename is green,
as expected.

When doing
(top-gdb) set width 60
(top-gdb) bt
#0  0x00007f6a9f44c660 in __poll_nocancel ()
    at ../sysdeps/unix/syscall-template.S:84
#1  0x0000562224a0fe51 in poll (__timeout=-1, 
    __nfds=<optimized out>, __fds=<optimized out>)
    at /usr/include/x86_64-linux-gnu/bits/poll2.h:46

then the 'at' becomes also green.

Philippe

On Sat, 2019-01-12 at 18:55 +0100, Philippe Waroquiers wrote:
> On Sat, 2019-01-12 at 10:03 -0700, Tom Tromey wrote:
> > > > > > > "Philippe" == Philippe Waroquiers <philippe.waroquiers@skynet.be> writes:
> > 
> > Philippe> I changed the width to 40, and then there were a few lines and spaces before the  #0 
> > Philippe> (I am not completely sure how to reproduce the below.  You might need to quit or C-c
> > Philippe> a previous paged command.  So maybe this is the same problem as the next one
> > Philippe> (maybe some data that stays in a buffer after a quit or C-c).
> > 
> > I think I've figured this out and I pushed a new patch to my WIP branch
> > to address it.  Could you try it out?  I still haven't written the test
> > case but hopefully this weekend.
> 
> I have tested the last version.
> 
> Just two minor things found with the pager prompt:
> 
> 
> Using (this patched) gdb to debug itself:
> (top-gdb) show height
> Number of lines gdb thinks are in a page is 24.
> (top-gdb) show width
> Number of characters gdb thinks are in a line is 80.
> (top-gdb) 
> 
> Put a breakpoint in the style function:
> (top-gdb) break style
> 
> In the inferior gdb, do
> (gdb) info breakpoints
> 
> When the style breakpoint is encountered, do
> (top-gdb) bt full
> 
> The 4th page prompt is not at the first column:
> ...
> #9  0x000055b36e50b6f1 in execute_command (p=<optimized out>, 
>     p@entry=0x55b36f6d4230 "info breakp", from_tty=1)
>     at ../../gdb/gdb/top.c:630
>         without_whitespace = {static npos = 18446744073709551615, 
>           _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No
> data fields>}, <No data fields>}, _M_p = 0x7ffd285ad140 ""}, 
>           _M_string_length = 0, {
>             --Type <RET> for more, q to quit, c to continue without paging--
> 
> 
> 
> For the same test, GDB 8.2 gives:
> #9  0x000055b36e50b6f1 in execute_command (p=<optimized out>, 
>     p@entry=0x55b36f6d4230 "info breakp", from_tty=1)
>     at ../../gdb/gdb/top.c:630
>         without_whitespace = {static npos = 18446744073709551615, 
>           _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No
> data fields>}, <No data fields>}, _M_p = 0x7ffd285ad140 ""}, 
> --Type <RET> for more, q to quit, c to continue without paging--
> 
> 
> Note that this behaviour is not very easy to produce.  You might be
> more (un-)lucky by using e.g.
>    set height 3
> and then do bt full,
> so as to have more page prompts.
> 
> 
> 
> 
> The second thing:
> -----------------
> 
> (top-gdb) set height 3
> (top-gdb) info var some
> All variables matching regular expression "some":
> 
> --Type <RET> for more, q to quit, c to continue without paging--
> File ./complete.c:
> 344:	rl_compignore_func_t *rl_ignore_some_completions_function;
> --Type <RET> for more, q to quit, c to continue without paging--
> 
> Non-debugging symbols:
> --Type <RET> for more, q to quit, c to continue without paging--
> --Type <RET> for more, q to quit, c to continue without paging--
> 0x000055b36e7bbc20  iterate_over_some_symtabs(char const*, char const*, compunit_symtab*,
> compunit_symtab*, gdb::function_view<bool (symtab*)>)::__PRETTY_FUNCTION__
> (top-gdb) 
> 
> As you can see, we have 2 successive pager prompts, but no
> info in between.
> GDB 8.2 does not show such behaviour.
> 
> Thanks
> 
> Philippe
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: GDB ui word wrapping broken/interferes with 'set style'  ?
  2019-01-12 21:08                   ` Philippe Waroquiers
@ 2019-01-14  3:55                     ` Tom Tromey
  0 siblings, 0 replies; 12+ messages in thread
From: Tom Tromey @ 2019-01-14  3:55 UTC (permalink / raw)
  To: Philippe Waroquiers; +Cc: Tom Tromey, gdb-patches

>>>>> "Philippe" == Philippe Waroquiers <philippe.waroquiers@skynet.be> writes:

Philippe> When doing
Philippe> (top-gdb) set width 60
Philippe> (top-gdb) bt
Philippe> #0  0x00007f6a9f44c660 in __poll_nocancel ()
Philippe>     at ../sysdeps/unix/syscall-template.S:84
Philippe> #1  0x0000562224a0fe51 in poll (__timeout=-1, 
Philippe>     __nfds=<optimized out>, __fds=<optimized out>)
Philippe>     at /usr/include/x86_64-linux-gnu/bits/poll2.h:46

Philippe> then the 'at' becomes also green.

I fixed this one on my branch.  I haven't researched the other two
problems yet.

Tom

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-01-14  3:55 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-30 14:51 GDB ui word wrapping broken/interferes with 'set style' ? Philippe Waroquiers
2018-12-30 20:26 ` Tom Tromey
2018-12-30 23:45   ` Tom Tromey
2018-12-31  8:13     ` Philippe Waroquiers
2019-01-06 23:40       ` Tom Tromey
2019-01-07 13:46         ` Philippe Waroquiers
2019-01-07 14:49           ` Tom Tromey
2019-01-07 16:56             ` Philippe Waroquiers
2019-01-12 17:03               ` Tom Tromey
2019-01-12 17:55                 ` Philippe Waroquiers
2019-01-12 21:08                   ` Philippe Waroquiers
2019-01-14  3:55                     ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).