From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 87607 invoked by alias); 22 Dec 2019 00:58:00 -0000 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 Received: (qmail 87598 invoked by uid 89); 22 Dec 2019 00:57:59 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.8 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=convinced, bisect, UD:event-top.c, refs X-HELO: mail-wm1-f65.google.com Received: from mail-wm1-f65.google.com (HELO mail-wm1-f65.google.com) (209.85.128.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 22 Dec 2019 00:57:58 +0000 Received: by mail-wm1-f65.google.com with SMTP id p17so12823393wmb.0 for ; Sat, 21 Dec 2019 16:57:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=MoNRZV1aaJfiG76yjw7WsSwagl7gGSvyd2Slrp83uqs=; b=WtbIM4qkiqakQBin4+ckI9psC5XD2T5iS2nBcDC3yjacXvZS6BRHSVhcbjNlNcQtlr foUOFUuGZkAqbCinOXBRvSvIvxxljvCbIP8RbzjDYrVZQaN5gtIzl5R4KyAwxZ7jdG9U kFYl4Awu16R77D02ZujM6tvSNS9Uy93UJr3Wx4lA5ISPdsE4fvJx86AEODCI3GcR02Z/ BpwvejfJdoT83adkGDOE60jKuRNRXKkButbhhw2wIVj65hvwWUAm88SiEB/xfoZq4smy OWn5pX+tnjpqoNnDHEGt08AytR2OGUXIkeEnOAQtJbpX6pUZME9tmIik7QtNINcJR5Uv jsmw== Return-Path: Received: from localhost (host86-186-80-236.range86-186.btcentralplus.com. [86.186.80.236]) by smtp.gmail.com with ESMTPSA id r5sm14636203wrt.43.2019.12.21.16.57.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Dec 2019 16:57:55 -0800 (PST) Date: Sun, 22 Dec 2019 00:58:00 -0000 From: Andrew Burgess To: Hannes Domani Cc: gdb-patches@sourceware.org, Tom Tromey Subject: Re: [RFC][PATCH] Call tui_before_prompt in do_scroll_vertical Message-ID: <20191222005754.GF3865@embecosm.com> References: <20191221153325.6961-1-ssbssa.ref@yahoo.de> <20191221153325.6961-1-ssbssa@yahoo.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191221153325.6961-1-ssbssa@yahoo.de> X-Fortune: People are like onions -- you cut them up, and they make you cry. X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] User-Agent: Mutt/1.9.2 (2017-12-15) X-IsSubscribed: yes X-SW-Source: 2019-12/txt/msg00949.txt.bz2 * Hannes Domani via gdb-patches [2019-12-21 16:33:25 +0100]: > Without this call scrolling in the src window does not work at all. Thanks for spotting this and starting work on a fix. When fixing regressions like this its always useful to track down the commit that introduced the failure and add a link to it. This is not about blaming others, but just adds a really useful historical log. In this case, it was this commit that caused the breakage in scrolling: commit b4b49dcbff6b437fa8b4e2fc0c3f27b457f11310 (refs/bisect/bad) Date: Wed Nov 13 16:47:58 2019 -0700 Don't call tui_show_source from tui_ui_out > > First I tried it with tui_update_source_windows_with_line, but this didn't > reset from_source_symtab (which was set deep in print_source_lines), > which resulted in some weird behavior when switching from "layout split" > to "layout asm" after scrolling down in the src window (the asm window > was then overwritten by the src window). I was able to reproduce the layout split -> layout asm issue you describe, but, I'm not convinced that the solution below is the right way to go. Tom might suggest a better solution quicker, but if not I'll try to review this code properly soon. However, the questions/observations I have are: - It doesn't feel like calling a before prompt hook is the right way to go, and even if this is basically the right solution, we should split the important part of the hook into a separate function with a suitable name and call that instead. - I also don't understand why calling this hook in tui_souce_window::do_scroll_vertical changes what happens when we switch to tui_disasm_window. Stepping through from the 'layout asm' seems to show that we do correctly change to the asm window, and its only when we later call display_gdb_prompt (from event-top.c) that we overwrite the asm window with the source for some reason. I'd like to understand what's going on there more as it feels like if we could fix that as almost a separate issue then we should go back to calling tui_update_source_windows_with_line as you tried first, which feels like a better solution. - On coding style within GDB, we declare functions in header files, and define them in source files. Also declarations are marked extern and include return type and function name on one line, so it would be: extern void tui_before_prompt (const char *current_gdb_prompt); But like I said, I'll need convincing that this is the right approach to fix this. Thanks, Andrew > > gdb/ChangeLog: > > 2019-12-21 Hannes Domani > > * tui/tui-hooks.c (tui_before_prompt): Remove static. > * tui/tui-source.c (tui_before_prompt): Add prototype. > (tui_source_window::do_scroll_vertical): Add tui_before_prompt call. > --- > gdb/tui/tui-hooks.c | 2 +- > gdb/tui/tui-source.c | 5 +++++ > 2 files changed, 6 insertions(+), 1 deletion(-) > > diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c > index 8576bb8fcc..8b9e70316f 100644 > --- a/gdb/tui/tui-hooks.c > +++ b/gdb/tui/tui-hooks.c > @@ -179,7 +179,7 @@ tui_inferior_exit (struct inferior *inf) > > /* Observer for the before_prompt notification. */ > > -static void > +void > tui_before_prompt (const char *current_gdb_prompt) > { > tui_refresh_frame_and_register_information (); > diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c > index 0728263b8c..dfe5721edf 100644 > --- a/gdb/tui/tui-source.c > +++ b/gdb/tui/tui-source.c > @@ -39,6 +39,9 @@ > #include "tui/tui-source.h" > #include "gdb_curses.h" > > +void > +tui_before_prompt (const char *current_gdb_prompt); > + > /* Function to display source in the source window. */ > bool > tui_source_window::set_contents (struct gdbarch *arch, > @@ -158,6 +161,8 @@ tui_source_window::do_scroll_vertical (int num_to_scroll) > l.u.line_no = 1; > > print_source_lines (s, l.u.line_no, l.u.line_no + 1, 0); > + > + tui_before_prompt (""); > } > } > > -- > 2.24.1 >