From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19532 invoked by alias); 14 Mar 2013 01:46:22 -0000 Received: (qmail 19523 invoked by uid 22791); 14 Mar 2013 01:46:22 -0000 X-SWARE-Spam-Status: No, hits=-4.4 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 14 Mar 2013 01:46:17 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1UFxFG-00048S-IY from Hui_Zhu@mentor.com ; Wed, 13 Mar 2013 18:46:14 -0700 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Wed, 13 Mar 2013 18:46:14 -0700 Received: from [127.0.0.1] (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.1.289.1; Wed, 13 Mar 2013 18:46:12 -0700 Message-ID: <51412BDF.6070001@mentor.com> Date: Thu, 14 Mar 2013 01:46:00 -0000 From: Hui Zhu User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:19.0) Gecko/20130126 Thunderbird/19.0 MIME-Version: 1.0 To: Jan Kratochvil , Pedro Alves CC: Hui Zhu , gdb-patches ml , Joel Brobecker Subject: Re: [patch+7.6] [TUI] Fix scrolling crash 7.6 regression [Re: [PATCH] Fix gdb crash with tui] References: <513F7592.2080902@redhat.com> <20130313185456.GA18563@host2.jankratochvil.net> In-Reply-To: <20130313185456.GA18563@host2.jankratochvil.net> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2013-03/txt/msg00613.txt.bz2 Hi Jan, After patch this patch. My issue is fixed. Thanks. Best, Hui On 03/14/13 02:54, Jan Kratochvil wrote: > On Tue, 12 Mar 2013 19:36:02 +0100, Pedro Alves wrote: >> So before, tui-out had the hack to call tui_show_source >> whenever a string "file" was being output. Are there any >> other cases where we print a "file" string, but not a "filename" > typo: "fullname" >> string? If so, that may have caused a TUI regression. > > I was verifying print_source_lines_base is surprisingly really the only case > from which the output is caught by tui_field_string. tui_field_string > together with tui_field_int required that "line" precedes "file" on the same > line. While every other GDB output normally prints "line" only after "file" > is output. (Currently everything is s/"file"/"fullname"/.) > > >> but the patch also made it so that tui_field_string is called >> twice: once for "file", and another for "filename". And "file", > typo: "fullname" >> having to special handling, causes tui_field_string to reach: >> >> if (fldname && data->line > 0 && strcmp (fldname, "fullname") == 0) >> { >> .,.. >> } >> >> // ... this .... // ###### >> >> data->start_of_line++; >> >> (*cli_ui_out_impl.field_string) (uiout, fldno, >> width, align, >> fldname, string); >> } >> >> And call the cli's field_string output, which goes >> the the console window, which I guess causes the flashes >> I see under valgrind, > > That's true but I expect there has to be output a lot of other garbage like > "\tin " or "\n" so I did not consider "file" to be significant. I guess the > same crash could happen before just after much more scrollings. > > >> and fills up the pagination, ultimately causing the pagination prompt and >> the crash as consequence of that being unexpected. > > I still do not have the crash reproducible, I even tried to tune stty size. > > >> Another bug that this caused (or rather another manifestation >> of the bug), is that when you scroll up/down, you see the >> highlighted line disappear rather than following the scroll. >> Before the patch it worked correctly. > > It is an unrelated bug but regressed by the same patch. Going to post a patch > for it as a second one. > > >> But I don't know what motivated that change in the first place. > > The motivation was to fix incorrect TUI handling of source files with the same > basename but different dirname, as was demonstrated in: > [patchv2 8/11] TUI: source "file" -> "fullname" > http://sourceware.org/ml/gdb-patches/2013-01/msg00665.html > Message-ID: <20130127223625.GI15252@host2.jankratochvil.net> > > > I am unable to test this specific patch, I at least understand how the > original Hui's patch should have worked. But it regressed MI output so I have > fixed that. > > No regressions on {x86_64,x86_64-m32,i686}-fedora19pre-linux-gnu but that does > not say much for TUI. > > > Thanks, > Jan > > > 2013-03-13 Hui Zhu > Jan Kratochvil > > * source.c (print_source_lines_base): Suppress "file" for TUI. > > diff --git a/gdb/source.c b/gdb/source.c > index f5949e6..828d953 100644 > --- a/gdb/source.c > +++ b/gdb/source.c > @@ -1344,11 +1344,15 @@ print_source_lines_base (struct symtab *s, int line, int stopline, > { > ui_out_field_int (uiout, "line", line); > ui_out_text (uiout, "\tin "); > - ui_out_field_string (uiout, "file", > - symtab_to_filename_for_display (s)); > > - /* TUI expects the "fullname" field. While it is > - !ui_out_is_mi_like_p compared to CLI it is !ui_source_list. */ > + /* CLI expects only the "file" field. TUI expects only the > + "fullname" field (and TUI does break if "file" is printed). > + MI expects both the fields. ui_source_list is set only for CLI, > + not for TUI. */ > + if (ui_out_is_mi_like_p (uiout) > + || ui_out_test_flags (uiout, ui_source_list)) > + ui_out_field_string (uiout, "file", > + symtab_to_filename_for_display (s)); > if (ui_out_is_mi_like_p (uiout) > || !ui_out_test_flags (uiout, ui_source_list)) > { > @@ -1356,6 +1360,7 @@ print_source_lines_base (struct symtab *s, int line, int stopline, > > ui_out_field_string (uiout, "fullname", fullname); > } > + > ui_out_text (uiout, "\n"); > } > >