This is the mail archive of the gdb-patches@sourceware.org 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: GDB ui word wrapping broken/interferes with 'set style' ?


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 ();


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