From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2044.outbound.protection.outlook.com [40.107.92.44]) by sourceware.org (Postfix) with ESMTPS id 0A1B73858D20 for ; Thu, 17 Feb 2022 11:19:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0A1B73858D20 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N9FniPmqdgo4jdCpPDChlJHB3UNnWQJbDnYiBnca6EdeWeI5627TVIlLuLYLlBwcCPYBNmotp6Qgwj/zUlMH6j+y1Uma4j3ZJnR5QF49on7XmNF7y2IHX3qUy5YF4zA13dhhgw903L0dha9H3UHtelXblK5XP8jDPg8MDpMCqQw105T9r0lWoKk078aJdLlEe2ljOl32XXHWWE5YMumOWs9xKqYc8dr9vCgNcQSn1ZerGVFqrV4YHsoVicGmIS7/ktlfQLKKu5skAXBrKu5wFHbZ2gFFhHPf/sAKOD+ZxoEuZaRFNf74QIuvefJ8TOZfy48zFrq8R4geC6alWwHjOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7AR786jTvbKYlecoo79DfFwzgh86AfrbismGTHxA1oE=; b=PLSdyREpjScRg6WOlurhQ+FalVxpzdaMXbgxbJMaXw/mbzpMYupbn3lMjqTJan/INpSBndd4ysVwFqaMOBfBsY0i6pyqRgmZqjiVvbzFRveNSVDn2vUJrw0ZgTYqIhug/tslSoG3P9G0AGBqaseoO4UZ7T239mhD8XDTDacrrORGNEvb5G+DFNsONGVK8iA/B+cYYHylb5dfwH5XGUzKjRwkTRehYo9gm7HO1BjTyUOETP2EaOeYMv6zvYzDfFXJbqdBK9b2YocfSLk/4rzvt6cBFRwXhRV2kwW73t83e/wYz7weYpQ+Olz5ZA1QPbyl6i/Au8pPForZc4xv0RVQoA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=sourceware.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none Received: from BN9PR03CA0869.namprd03.prod.outlook.com (2603:10b6:408:13d::34) by BN8PR12MB3572.namprd12.prod.outlook.com (2603:10b6:408:47::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.14; Thu, 17 Feb 2022 11:19:35 +0000 Received: from BN8NAM11FT033.eop-nam11.prod.protection.outlook.com (2603:10b6:408:13d:cafe::df) by BN9PR03CA0869.outlook.office365.com (2603:10b6:408:13d::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.14 via Frontend Transport; Thu, 17 Feb 2022 11:19:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT033.mail.protection.outlook.com (10.13.177.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4995.15 via Frontend Transport; Thu, 17 Feb 2022 11:19:35 +0000 Received: from khazad-dum.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.18; Thu, 17 Feb 2022 05:19:33 -0600 From: Lancelot SIX To: CC: , Lancelot SIX Subject: [PATCH] gdb: Only paginate for filtered output in fputs_maybe_filtered Date: Thu, 17 Feb 2022 11:19:04 +0000 Message-ID: <20220217111904.3623848-1-lancelot.six@amd.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b667847d-a3e2-438b-b2df-08d9f20760eb X-MS-TrafficTypeDiagnostic: BN8PR12MB3572:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2276; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Qtjydo01wwDMldwwg1WhZ7+SmFWrH13CSSqOTe7ijnJ85Bx36lE/YnJUbQNfGAaQ6dEu+2Bu963KoQV6T9h8Im5s4yCT4F/TOQeDOPDURa6VmsmL1fUxkGkMxwj7AWnFlfXriKR9E8Gq8KvsTR8cBhI71Q7LMj3+1QJRsyFIr5aJLEwHVjJsktXEEX1SXmAiRx1TJwihepiEUs57bVHn7DGi5Fy0UqkuhWCbhX6tTt0BFKsQr/0b5UzW5wiYgXku4Sm8UFR8tvfuQ7OqfeZgDzuHEpPiFJ+OH0P/GiAw7QlfTK1ZNK+jr3RCaMtcrhIAAIJr7eqFh3cCTksdkdTU0GkPDf0XElpMGYqYjtJrH7ibeQAMPHAIw7z+zEoWAvHrJs4LF14QAZTIZV55DTFa2xquzkZ/GzmiKKR8XQj4dooFlLzwhDrW5Xncj1MkmsKLBtUznQxszh6tWmqfRdxOBOpJKWLMZQec1C2avSwgSl8+Yj3I0iNfn0iVHp8kObmqksggM+sXn4N6ELHTvEE4n5oL2+fgcsOuaTR9Esdocgjhl5PvgjInHWSyUGrJipZgR9/Ai03ht9wsRPH3xp3IE5ev+C3+WSEllQZ7PM7DDSQbd5Ok25jD5JQKBGAQg8FDDLLcDI6GjHc6q70Kuoda2+AScEMS36VYdDlPS7ihs2HJdci2/OdFBo/FdDCaadi1xj23sMZxeTwPB5I4psYjOw== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230001)(4636009)(46966006)(40470700004)(36840700001)(40460700003)(82310400004)(8936002)(5660300002)(7696005)(86362001)(26005)(356005)(83380400001)(81166007)(336012)(426003)(186003)(6666004)(2616005)(16526019)(2906002)(316002)(1076003)(8676002)(47076005)(70206006)(508600001)(36756003)(4326008)(36860700001)(54906003)(6916009)(70586007)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Feb 2022 11:19:35.3607 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b667847d-a3e2-438b-b2df-08d9f20760eb X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT033.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB3572 X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, WEIRD_PORT 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: Thu, 17 Feb 2022 11:19:40 -0000 A have had situation where a unfiltered output (done using fputs_unfiltered) ended up triggering pagination. The backtrace for this was: ... #24 0x000055839377ee4e in check_async_event_handlers () at ../../gdb/async-event.c:335 #25 0x0000558394b67b57 in gdb_do_one_event () at ../../gdbsupport/event-loop.cc:216 #26 0x0000558394587454 in gdb_readline_wrapper (prompt=0x7ffd907712d0 "--Type for more, q to quit, c to continue without paging--") at ../../gdb/top.c:1148 #27 0x0000558394707270 in prompt_for_continue () at ../../gdb/utils.c:1438 #28 0x00005583947088b3 in fputs_maybe_filtered (linebuffer=0x60c0000f4000 " [...quite big message...]", stream=0x60300028e9d0, filter=0) at ../../gdb/utils.c:1752 #29 0x0000558394708e57 in fputs_unfiltered (linebuffer=0x60c0000f4000 " [...quite big message...]", stream=0x60300028e9d0) at ../../gdb/utils.c:1811 ... This comes from what appears to be a oversight in fputs_maybe_filtered. This function has a FILTER parameter which if true makes the function pause after every screenful (i.e. triggers pagination). The filter parameter is correctly used to guard the first place where prompt_for_continue. There is a second place in the function which can call prompt_for_continue, but is currently unguarded. I believe that this is an oversight, this patch fixes that. Tested on Linux-x86_64, no regression observed. Change-Id: Iad8ffd50a87cf20077500878e2564b5a7dc81ece --- gdb/utils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gdb/utils.c b/gdb/utils.c index dcb42138d39..505a88aa1cd 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -1744,7 +1744,8 @@ fputs_maybe_filtered (const char *linebuffer, struct ui_file *stream, /* Possible new page. Note that PAGINATION_DISABLED_FOR_COMMAND might be set during this loop, so we must continue to check it here. */ - if (lines_printed >= lines_per_page - 1 + if (filter + && lines_printed >= lines_per_page - 1 && !pagination_disabled_for_command) { prompt_for_continue (); base-commit: fb583cfc0936554a1f8d86ef2b6649bf511d6df8 -- 2.25.1