From patchwork Fri Dec 27 23:50:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 37110 Received: (qmail 98962 invoked by alias); 27 Dec 2019 23:50:39 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 98853 invoked by uid 89); 27 Dec 2019 23:50:38 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:2602 X-HELO: gateway20.websitewelcome.com Received: from gateway20.websitewelcome.com (HELO gateway20.websitewelcome.com) (192.185.50.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 27 Dec 2019 23:50:37 +0000 Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway20.websitewelcome.com (Postfix) with ESMTP id B2701400C46C0 for ; Fri, 27 Dec 2019 16:39:22 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id kzNLil4iYqNtvkzNLiQXVe; Fri, 27 Dec 2019 17:50:35 -0600 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=n5K1qUnvFprHXMvfKHnbK7HM+VUbt24e9rSjbgxIiCs=; b=bOqzNAtZTNtcea0biwyc6jr/dd DjhaJNlYrXlDvaL87lsObd1NEf7fia4B6etHUcLK52JO/1vY2O60v0Tg9ihQpBORxFtUYzw3gcxdP vSYOaq5YsL94sTtRRhVQDdi6B; Received: from 75-166-123-50.hlrn.qwest.net ([75.166.123.50]:38936 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1ikzNL-004GrV-O8; Fri, 27 Dec 2019 16:50:35 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 2/3] Make "disassemble" always use TUI disassembly window Date: Fri, 27 Dec 2019 16:50:33 -0700 Message-Id: <20191227235034.5453-3-tom@tromey.com> In-Reply-To: <20191227235034.5453-1-tom@tromey.com> References: <20191227235034.5453-1-tom@tromey.com> Currently the "disassemble" command will use the TUI disassembly window if it is already showing. I think it makes more sense to unconditionally switch to it. This patch implements this. gdb/ChangeLog 2019-12-27 Tom Tromey * cli/cli-cmds.c (print_disassembly): Just check tui_active. gdb/testsuite/ChangeLog 2019-12-27 Tom Tromey * gdb.tui/disasm.exp: New file. Change-Id: I3bf3a93f618b2138c49c28156cf6c6f5ca0fa762 --- gdb/ChangeLog | 4 ++++ gdb/cli/cli-cmds.c | 2 +- gdb/testsuite/ChangeLog | 4 ++++ gdb/testsuite/gdb.tui/disasm.exp | 36 ++++++++++++++++++++++++++++++++ 4 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 gdb/testsuite/gdb.tui/disasm.exp diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index e1410690aaf..b2ef904ff60 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -1338,7 +1338,7 @@ print_disassembly (struct gdbarch *gdbarch, const char *name, gdb_disassembly_flags flags) { #if defined(TUI) - if (tui_is_window_visible (DISASSEM_WIN)) + if (tui_active) tui_show_assembly (gdbarch, low); else #endif diff --git a/gdb/testsuite/gdb.tui/disasm.exp b/gdb/testsuite/gdb.tui/disasm.exp new file mode 100644 index 00000000000..362aa7087ec --- /dev/null +++ b/gdb/testsuite/gdb.tui/disasm.exp @@ -0,0 +1,36 @@ +# Copyright 2019 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Test that "disassemble" shows the disassembly window. + +load_lib "tuiterm.exp" + +standard_testfile tui-layout.c + +if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} { + return -1 +} + +Term::clean_restart 24 80 $testfile +if {![Term::enter_tui]} { + unsupported "TUI not supported" +} + +set text [Term::get_all_lines] +gdb_assert {![string match "No Source Available" $text]} \ + "initial source listing" + +Term::command "disassemble main" +Term::check_contents "asm window is showing" "$hex
"