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.129.124]) by sourceware.org (Postfix) with ESMTPS id 3C2713857830 for ; Mon, 7 Mar 2022 22:13:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3C2713857830 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-657-9vpbW-UzMy2C1vohEXlWMA-1; Mon, 07 Mar 2022 17:13:56 -0500 X-MC-Unique: 9vpbW-UzMy2C1vohEXlWMA-1 Received: by mail-wm1-f70.google.com with SMTP id 3-20020a05600c230300b00384e15ceae4so215595wmo.7 for ; Mon, 07 Mar 2022 14:13:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UaGTvPegbhRxo7MNKp91vn1+uZZojBuIDE45eDItpUU=; b=2nWeih2ET5U/ryUbf7XSWpmPOYBiRCSfqMIRs7HtI7esrS1zmmTVDOO8NccJAJ4IMG 4fYdXP7qiwFD8KMGjvEp3ihuAQxsNAUfG82Z/xajA90og6cvlZ5JnxDUhuiSsDO+OMdn 5RIbTW27/rCPQIAJ+gGxlzwR940jyO/KZoB1sjdPhPbHfssLkl58hUPfHoShTJF9IILW 94dZV5d/W2hq5F4FrNV5lZQGZjaBoudLDeUib/iLoO2q1dOjDoejliogId+XRspELo6v Ho4FANtLNkMMvmbcYymXaWWAgYalRzNN8K1XapJOUOxgIiLFh7HmJkJVXzC1cKfARb7m aWLQ== X-Gm-Message-State: AOAM533rSPvfUgm1ZDp8tNpcuHdCApDLQaVzOAchaBIVDmkJ1wHBa2JM M9F1v0GsXMwa7oQgIwPe1+Z8T5K5jkFTLRVSFskXl2DVwQP2ipiu5h2/+8SBRCyEclh14jHtf94 CYrmwbtzeAhJ17rmbhV18NG/mRxq4ARMHdzHBc/xenabrjb1QMADygE87jAAtPCbMfDWlP4W3rg == X-Received: by 2002:a05:600c:4f16:b0:389:98fd:e973 with SMTP id l22-20020a05600c4f1600b0038998fde973mr885877wmq.166.1646691235486; Mon, 07 Mar 2022 14:13:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJyEGo/LQy3ZNRUszkptF5Aw/fowWr1Yc/aaHRV6Jebg3oSAjxmUO+VeqiCmgaWbeIe1LzIP8g== X-Received: by 2002:a05:600c:4f16:b0:389:98fd:e973 with SMTP id l22-20020a05600c4f1600b0038998fde973mr885855wmq.166.1646691235065; Mon, 07 Mar 2022 14:13:55 -0800 (PST) Received: from localhost (host86-134-151-205.range86-134.btcentralplus.com. [86.134.151.205]) by smtp.gmail.com with ESMTPSA id g6-20020a05600c4ec600b0037bf934bca3sm590960wmq.17.2022.03.07.14.13.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 14:13:54 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv3 04/15] gdb/testing/tui: add new functionality to tuiterm.exp Date: Mon, 7 Mar 2022 22:13:36 +0000 Message-Id: X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Mar 2022 22:14:00 -0000 While working on later patches in this series, I was running into csi control codes being emitted from ncurses that are not currently handled by out gdb/testsuite/lib/tuiterm.exp. This commit adds support for these additional control sequences. The new sequences are 'Insert Line', 'Delete Characters', and 'Scroll Down'. There are no new tests in this commit, but I was running into these sequences while developing later patches in this series. However, which control sequences ncurses emits can vary wildly depending on the screen contents. It is possible that I only hit some of these sequences while debugging the later patches (i.e. printing extra content to the terminal), some of these might no longer be needed given the tests as now written. Still, I think it is worth merging these to improve tuiterm.exp. Additionally, I noticed a bug in 'Erase in Line' that this commit fixes; in mode 1 the erase should be from the start of the line through to the cursor, not to the character before the cursor. This bug would mean that random characters would sometimes be left in the terminal output. --- gdb/testsuite/lib/tuiterm.exp | 82 ++++++++++++++++++++++++++++++++++- 1 file changed, 81 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp index 38948015e96..06d2e091ca5 100644 --- a/gdb/testsuite/lib/tuiterm.exp +++ b/gdb/testsuite/lib/tuiterm.exp @@ -317,13 +317,40 @@ namespace eval Term { # From cursor to end. _clear_in_line $_cur_col $_cols $_cur_row } elseif {$arg == 1} { - _clear_in_line 0 $_cur_col $_cur_row + _clear_in_line 0 [expr $_cur_col + 1] $_cur_row } elseif {$arg == 2} { _clear_in_line 0 $_cols $_cur_row } } } + # Insert Line + # + # https://vt100.net/docs/vt510-rm/IL.html + proc _csi_L {args} { + set arg [_default [lindex $args 0] 1] + + _log_cur "Insert Line ($arg)" { + variable _cur_col + variable _cur_row + variable _rows + variable _cols + variable _chars + + set y [expr $_rows - 2] + set next_y [expr $y + 1] + while {$y >= $_cur_row} { + for {set x 0} {$x < $_cols} {incr x} { + set _chars($x,$next_y) $_chars($x,$y) + } + incr y -1 + incr next_y -1 + } + + _clear_lines $_cur_row $_rows + } + } + # Delete line. # # https://vt100.net/docs/vt510-rm/DL.html @@ -349,6 +376,59 @@ namespace eval Term { } } + # Delete Characters + # + # https://vt100.net/docs/vt510-rm/DCH.html + proc _csi_P {args} { + set count [_default [lindex $args 0] 1] + + _log_cur "Delete Character ($count)" { + variable _cur_col + variable _cur_row + variable _cols + variable _chars + + set dx [expr $_cur_col + 1] + set sx [expr $_cur_col + 1 + $count] + set y $_cur_row + + while {$sx < $_cols} { + set _chars($dx,$y) $_chars($sx,$y) + incr sx + incr dx + } + _clear_in_line $dx $sx $y + } + } + + # Pan Down + # + # https://vt100.net/docs/vt510-rm/SU.html + proc _csi_S {args} { + set count [_default [lindex $args 0] 1] + + _log_cur "Pan Down ($count)" { + variable _cur_col + variable _cur_row + variable _cols + variable _rows + variable _chars + + set dy 0 + set y $count + + while {$y < $_rows} { + for {set x 0} {$x < $_cols} {incr x} { + set _chars($x,$dy) $_chars($x,$y) + } + incr y 1 + incr dy 1 + } + + _clear_lines $dy $_rows + } + } + # Erase chars. # # https://vt100.net/docs/vt510-rm/ECH.html -- 2.25.4