From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id AE31A3858D20 for ; Wed, 31 May 2023 14:18:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AE31A3858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685542689; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=grDPv++wMgqVM17Hrw0kw/i+/b/4gLDGbyd8FV8gGWY=; b=W8huympTzqIn2k7652QjdlxwJH4zqOToFe0GAKeF68ZFlnLQisYYxWy109PSDETij3VWLj CeD7smk6QPYthzsbdFJh9vzRw1+GXYPAx2aHfE8HfribWgchMQC08LwmE6PiqRlWQwSycq H3X1/q4EzhhxpzBzxSb0i9HfOefwnlo= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-330-XlsGfWYBP12eO6ZBq0b87Q-1; Wed, 31 May 2023 10:18:08 -0400 X-MC-Unique: XlsGfWYBP12eO6ZBq0b87Q-1 Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-3f81be02832so50921301cf.0 for ; Wed, 31 May 2023 07:18:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685542686; x=1688134686; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=grDPv++wMgqVM17Hrw0kw/i+/b/4gLDGbyd8FV8gGWY=; b=DEMwbYgaO5b3dvnyqlohnSk45Z8afGRaq9VyHqPdFrJj7ZfzemlkvDJ2OH41mMa3Dv WMlI9YIo1Jp9+V0JE7rBcO0m2401fglLSsfB9EQqxKPuYkSJXiBQgaPs+y7/6WyFzUOF 4pUG1A1hYnC/VDf7f3g7chITNGc3U7eg8qSASYvz68VcjKHl5sff4VA46vnWE1p69Psu 88j+lgyopTlehCJ0ctGUhE3N9K0YpselHamPCqZi0maXaFpDC85hPHnE8TlN/cm2dOjW kzVINEjC+sbLbNZ4B0efMWcX07Bax8m93DyalhjtARhW7pNzdKUw5NfgNlbFp80RDpRV mxdQ== X-Gm-Message-State: AC+VfDy37JBjsIB1dLd1UYNMDBZOlyc4p3eEwl01+8DD2HEBaTQ0wamO 9LyUicF0WTZVp1t6IPiA4a84nLRAojZDhfCNEq7/zVWM+wh3I+NnZ6NmExZOlZ8T3ESOx6w0IW1 PtTadbpnj55++XcbEGXRDqagGDPQytg== X-Received: by 2002:ac8:594d:0:b0:3f3:9240:3265 with SMTP id 13-20020ac8594d000000b003f392403265mr6453243qtz.49.1685542686328; Wed, 31 May 2023 07:18:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7huBkH3WuvlWpFxCehXEq4gmI5pWLfObR41lfhb43ZXtiTE8V8osW2fdmYyiDlR6PBgpfgKg== X-Received: by 2002:ac8:594d:0:b0:3f3:9240:3265 with SMTP id 13-20020ac8594d000000b003f392403265mr6453221qtz.49.1685542685970; Wed, 31 May 2023 07:18:05 -0700 (PDT) Received: from [192.168.0.129] (ip-94-112-225-44.bb.vodafone.cz. [94.112.225.44]) by smtp.gmail.com with ESMTPSA id bs15-20020ac86f0f000000b003ef2db16e72sm5904809qtb.94.2023.05.31.07.18.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 31 May 2023 07:18:05 -0700 (PDT) Message-ID: Date: Wed, 31 May 2023 16:18:03 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH 3/3] [gdb/tui] Refresh on target_terminal_state::is_ours To: Tom de Vries , gdb-patches@sourceware.org Cc: Tom Tromey References: <20230530105324.23089-1-tdevries@suse.de> <20230530105324.23089-4-tdevries@suse.de> From: Bruno Larsen In-Reply-To: <20230530105324.23089-4-tdevries@suse.de> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-9.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,NICE_REPLY_A,RCVD_IN_BARRACUDACENTRAL,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 30/05/2023 12:53, Tom de Vries via Gdb-patches wrote: > Consider a hello world compiled with -g into an a.out: > ... > int main (void) { > printf ("hello\n"); > return 0; > } > ... > > After starting TUI like this: > ... > $ gdb -q a.out -ex start -ex "tui enable" > ... > we do "echo \n" and type enter until the prompt is at the bottom of the screen. > > After doing next to execute the printf, we have: > ... > (gdb) next > hello > (gdb) > ... > but the entire screen scrolled, so: > - the src window is missing the top border > - the updates in the src and status window are misaligned with the current > screen. > > We can fix this by doing ^L. > > Fix this by doing ^L automatically when gdb_tty_state changes to > target_terminal_state::is_ours. > > Tested on x86_64-linux. This is a nice cleanup after patch #1. Once the issue I outlined in my comment to that patch is solved, this will be a nice cleanup for the functionality, and the series as a whole does not add any regressions. Reviewed-By: Bruno Larsen > --- > gdb/testsuite/gdb.tui/hello.exp | 3 --- > gdb/tui/tui-hooks.c | 11 +++++++++++ > 2 files changed, 11 insertions(+), 3 deletions(-) > > diff --git a/gdb/testsuite/gdb.tui/hello.exp b/gdb/testsuite/gdb.tui/hello.exp > index 9634d9d8059..641b3b0c48e 100644 > --- a/gdb/testsuite/gdb.tui/hello.exp > +++ b/gdb/testsuite/gdb.tui/hello.exp > @@ -47,9 +47,6 @@ Term::check_box "before next: source box" 0 0 80 15 > # Make the inferior print "hello". > Term::command "next" > > -# Refresh to redraw the screen. > -Term::command "refresh" > - > # Check the source box again. > Term::check_box "after next: source box" 0 0 80 15 > > diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c > index d67c3d7f353..d1d307cf9ce 100644 > --- a/gdb/tui/tui-hooks.c > +++ b/gdb/tui/tui-hooks.c > @@ -211,6 +211,15 @@ tui_symtab_changed () > from_source_symtab = true; > } > > +/* Observer for terminal_owner_changed. */ > + > +static void > +tui_terminal_owner_changed (target_terminal_state gdb_tty_state, bool active) > +{ > + if (active && gdb_tty_state == target_terminal_state::is_ours) > + tui_refresh_all_win (false); > +} > + > /* Token associated with observers registered while TUI hooks are > installed. */ > static const gdb::observers::token tui_observers_token {}; > @@ -250,6 +259,8 @@ tui_attach_detach_observers (bool attach) > tui_context_changed, attach); > attach_or_detach (gdb::observers::current_source_symtab_and_line_changed, > tui_symtab_changed, attach); > + attach_or_detach (gdb::observers::terminal_owner_changed, > + tui_terminal_owner_changed, attach); > } > > /* Install the TUI specific hooks. */