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 3122B3858D28 for ; Wed, 25 Jan 2023 11:29:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3122B3858D28 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=1674646186; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=V8S3y/NkU3uwnUTMknEuZyeBqwDNiAqQqXkII2qmfLs=; b=O58AI9OioKJoJ90XtbVxWLeRjLTSPaBGIvEitAsDcO+ZIj9M8v/ZxwAa+93RjopPCoYvAX g/es3U7he/6/SU+Dzo+02HTOmDyAnoE+rqB2K0gJi5iRxR60FiwIB8Fky3KzwP3Kd5G2vH NlptjN0JYmt1VlpNiM06LgnFxu4oVG0= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-446-a0Y2zmeXNYyRROoheoUCPA-1; Wed, 25 Jan 2023 06:29:45 -0500 X-MC-Unique: a0Y2zmeXNYyRROoheoUCPA-1 Received: by mail-qv1-f70.google.com with SMTP id r10-20020ad4522a000000b004d28fcbfe17so9096719qvq.4 for ; Wed, 25 Jan 2023 03:29:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=V8S3y/NkU3uwnUTMknEuZyeBqwDNiAqQqXkII2qmfLs=; b=4O10y/5++k2hVb3T4rX31cEBTVZN79F5sPTISrq3bgtIKrXSwyJYlxu3P/s3LEoDBF w67m08MkE50GWVHSzUfre36GOS+WF7He2Nn+JkHiDWioUa+HYxTxGSntx4ZgBz4GxDCq qw8DLD15CoUpdW0svFciQdjOIjQ86a7HficgxRWu7o3Xgkd8q+CKhjgGa0ckBpeVARrc cxqje3acZ5r478fGYdqWd49eVv/cfknC+d9aM6aCCSk1jwQeTR1EwlQq1rPVJVg+Hkt4 JMRyaBqK30SmZ1zhZ7F4EbQmywRvE0Dxgp2XvxOCprNi3rspc/fJkLdMMl84RPa10ATg Bjkw== X-Gm-Message-State: AFqh2kqK4X2YIoTtFCfy7zyYum42eDC+OLB38/AdPjOOyUwXZCS1dKiK fU9YOyEY6RquzBN4dKFFH1G1qFD6mFspoYQDUUCGBgmgBcBJogtbFCz7vxr14BkJiOUpl5E68EX wra7CtWr4kKuGfNecQJitsR88jPUjXmrLTyph3d5AupymJ+kbXv2ayTu7zmbSpHBvHWa8acyGPg == X-Received: by 2002:ac8:750e:0:b0:3b5:7af4:87b3 with SMTP id u14-20020ac8750e000000b003b57af487b3mr44599017qtq.38.1674646185051; Wed, 25 Jan 2023 03:29:45 -0800 (PST) X-Google-Smtp-Source: AMrXdXuPQA41isd+13N9JZyATm4rM5nRWRw/nOX5keug+O35hDn1phlyO9J0S4S/l6AnoVqiXiEsWw== X-Received: by 2002:ac8:750e:0:b0:3b5:7af4:87b3 with SMTP id u14-20020ac8750e000000b003b57af487b3mr44598998qtq.38.1674646184664; Wed, 25 Jan 2023 03:29:44 -0800 (PST) Received: from localhost (95.72.115.87.dyn.plus.net. [87.115.72.95]) by smtp.gmail.com with ESMTPSA id f14-20020a05622a114e00b003a5430ee366sm3124272qty.60.2023.01.25.03.29.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 03:29:44 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Subject: Re: [PATCH 02/15] gdb/testsuite: update gdb.tui/tui-disasm-long-lines.exp In-Reply-To: References: Date: Wed, 25 Jan 2023 11:29:42 +0000 Message-ID: <87mt66x36h.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-11.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,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP 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: Andrew Burgess writes: > Following on from the previous commit, in this commit I am updating > the test script gdb.tui/tui-disasm-long-lines.exp to take account of > the changes in commit: > > commit 9162a27c5f5828240b53379d735679e2a69a9f41 > Date: Tue Nov 13 11:59:03 2018 -0700 > > Change gdb test suite's TERM setting > > In the above commit the TERM environment variable was changed to be > 'dumb' by default, which means that tests, that previously activated > tui mode, no longer do unless TERM is set to 'ansi'. > > As the gdb.tui/tui-disasm-long-lines.exp script didn't do this, the > test stopped working. As the expect patterns in this script were > pretty generic no tests actually started failing, and we never > noticed. > > In this commit I update the script to use Term::clean_restart, which > correctly sets TERM to 'ansi'. I've also added a check that the asm > box does appear on the screen, which should indicate that tui mode has > correctly activated. > > However, I also notice that GDB doesn't appear to fully work > correctly. The test should display the disassembly for the test > program, but it doesn't. > > The test is trying to disassemble some code that (deliberately) uses a > very long symbol name, this eventually results in GDB entering > tui_source_window_base::show_source_content and trying to allocate an > ncurses pad in order to hold the current page of disassembler output. > > Unfortunately, due to the very long line, the call to newpad fails, > meaning that tui_source_window_base::m_pad is nullptr. Luckily non of > the following calls appear to crash when passed a nullptr, however, > all the output that is written to the pad is lost, which is why we > don't see any assembly code written to the screen. > > As the test history indicates that the script was originally checking > for a crash in GDB when the long identifier was encountered, I think > there is value in just leaving the test as it is for now, I'll see if > I can come up with a solution to the long line problem in a later > commit. I've gone ahead and pushed this patch. The final version that I pushed is included below. Thanks, Andrew --- commit 843a1a4f735e77147710b307db29a1b5f4e1c707 Author: Andrew Burgess Date: Tue Dec 20 16:25:33 2022 +0000 gdb/testsuite: update gdb.tui/tui-disasm-long-lines.exp Following on from the previous commit, in this commit I am updating the test script gdb.tui/tui-disasm-long-lines.exp to take account of the changes in commit: commit 9162a27c5f5828240b53379d735679e2a69a9f41 Date: Tue Nov 13 11:59:03 2018 -0700 Change gdb test suite's TERM setting In the above commit the TERM environment variable was changed to be 'dumb' by default, which means that tests, that previously activated tui mode, no longer do unless TERM is set to 'ansi'. As the gdb.tui/tui-disasm-long-lines.exp script didn't do this, the test stopped working. As the expect patterns in this script were pretty generic no tests actually started failing, and we never noticed. In this commit I update the script to use Term::clean_restart, which correctly sets TERM to 'ansi'. I've also added a check that the asm box does appear on the screen, which should indicate that tui mode has correctly activated. However, I also notice that GDB doesn't appear to fully work correctly. The test should display the disassembly for the test program, but it doesn't. The test is trying to disassemble some code that (deliberately) uses a very long symbol name, this eventually results in GDB entering tui_source_window_base::show_source_content and trying to allocate an ncurses pad in order to hold the current page of disassembler output. Unfortunately, due to the very long line, the call to newpad fails, meaning that tui_source_window_base::m_pad is nullptr. Luckily non of the following calls appear to crash when passed a nullptr, however, all the output that is written to the pad is lost, which is why we don't see any assembly code written to the screen. As the test history indicates that the script was originally checking for a crash in GDB when the long identifier was encountered, I think there is value in just leaving the test as it is for now, I have a fix for the issue of the newpad call failing, which I'll post in a follow up commit later. diff --git a/gdb/testsuite/gdb.tui/tui-disasm-long-lines.exp b/gdb/testsuite/gdb.tui/tui-disasm-long-lines.exp index 7e3cff3950b..ae19f2e69cb 100644 --- a/gdb/testsuite/gdb.tui/tui-disasm-long-lines.exp +++ b/gdb/testsuite/gdb.tui/tui-disasm-long-lines.exp @@ -16,6 +16,10 @@ # Test that the logic for displaying the TUI disassembly window # handles very long lines. +require allow_tui_tests + +tuiterm_env + standard_testfile set ccopts {debug quiet} @@ -31,13 +35,16 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "$binfile" \ } } -clean_restart "$binfile" - -if {![allow_tui_tests]} { - # TUI support is disabled. Check for error message. - gdb_test "layout asm" "Undefined command: \"layout\". Try \"help\"." +Term::clean_restart 24 80 $binfile +if {![Term::prepare_for_tui]} { + unsupported "TUI not supported" return } -# Just check the command does not cause gdb to crash. -gdb_test "layout asm" +# Just check the command does not cause gdb to crash. It is worth +# noting that the asm window does infact fail to correctly display the +# disassembler output at this point, but initially we are just +# checking that GDB doesn't crash, fixing the asm display will come +# later. +Term::command_no_prompt_prefix "layout asm" +Term::check_box "asm box" 0 0 80 15