From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 0BR0Aa+KvmpDeSQAWB0awg (envelope-from ) for ; Thu, 01 Oct 2026 12:30:39 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=HOn0fBRu; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id E3C7F1E01F; Thu, 01 Oct 2026 12:30:38 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 0E0DF1E01F for ; Thu, 01 Oct 2026 12:30:38 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C12B44BB1C09 for ; Thu, 1 Oct 2026 16:30:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C12B44BB1C09 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=HOn0fBRu Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 387F64BA2E3D for ; Thu, 1 Oct 2026 16:30:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 387F64BA2E3D Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 387F64BA2E3D Authentication-Results: sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1790872212; cv=none; b=YJj0Tgm5R8WiZ6gZ1Ju5GxfSfEFi4n8i4RfawbAkKpY3Qd0p43AZLciF147uhBKNZjnPRtlycBkb+yzFyZiSJVwBBLjgRQx7PB70JfzmHtpMDmjp1EVx5pLf5aDWCsToz/VNDsIrQXAkltRgVEO4FJeUFcNZsNZ/bMSSC+9KgKY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1790872212; c=relaxed/simple; bh=CblHuyVdb01SMIQs1Y3+GCrSZUehHOI9VczXI3M3qi0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=fQqE+KsedO77Lq+smioDSSFMPBC8TM0ygQ8rrb+QcLcd2bGH8Fdo8/0z4/YhdB72R3GZMazG0n16QFubsU175kynz8EHbIed9xy+5d0aDR24ONwZRrjZd6rT8dhobFP3jLakeqNNeHMyxZSQNaRoh6lNGjS+6vatvnlFAT+8wyk= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=HOn0fBRu DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 387F64BA2E3D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1790872211; 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: in-reply-to:in-reply-to:references:references; bh=h3O82jkz46yhQo/C2bx5mHfrGSTOhOlKIDf6lofPCIs=; b=HOn0fBRuGhvtCj0agiHeU8IfdQkBT7UJA18d6Qjd8QFYGbSvF4OdSvVqG19YsH0eiEXQNk dkog9z2Rj7lHvT72saQ91JlLPrjeNXGtTfRcmszjJs3NrRjXEB5bI0XEUGq0og/VWiQFUI 0psAkVG87KNWhJTy14y7ooQsf1VbwrE= 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.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-164-oCzPH2uoOyiuAmp4IUYgDA-1; Thu, 01 Oct 2026 12:30:09 -0400 X-MC-Unique: oCzPH2uoOyiuAmp4IUYgDA-1 X-Mimecast-MFC-AGG-ID: oCzPH2uoOyiuAmp4IUYgDA_1790872208 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4a004b70f99so27596625e9.2 for ; Thu, 01 Oct 2026 09:30:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790872208; x=1791477008; h=content-type:mime-version:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to:content-type; bh=h3O82jkz46yhQo/C2bx5mHfrGSTOhOlKIDf6lofPCIs=; b=KPsHU0a0OjuYRTVEEVd09nguYTjneKVjJi+eKe912N20vKh93nSwDMRctmt1lvxk/v DklpGHaspg93pKsDQf0Jk2PZ4zIsfOQ2ad8xxmhRzf4D+HXejsStS2K5UUNkWqPg5cb1 TJX/stXnORQiFw4cSWeR/paSW9dL1ReJEGFMf0QT7M6FAaErDYdrqX9sOd5ZK7smp+AU X+bZn2iLdr0xY+yy8CF/R1s/Gm9Zv659QeAckzZXdNv+h52LDoG78VTtlZYGccOjW7iL eAz6B+jaIJysZvqkeDA9VQgWLdMo3gqLmi9VmbGyPxoFS8L73G15za8WMz9RBIPTKJdN Uhfw== X-Forwarded-Encrypted: i=1; AKwUvByR3iajOe5ErrqHvQ6zxPY0ndJ8mULjwpAUxSLmQfzht/q2ibdl8aLkdSum9Ls7gG2hXehDmreSfU+rhA==@sourceware.org X-Gm-Message-State: AFuF++mxC0XnRdRukVdNApN+/uK7whO05T1mKI1xjb81V189k00tGdiY DDH+2py3wKrDsEBzVKzBMoSYukdmrPJox8s5+PBb3t+1GXjBwBQowauVsv2lFfyWhtscxS7n5zN 5kM4YHarr1wYfTDQ6ROQS+iGGzGwdlviqpCqYJnMsfoCmXpYlvT3LTrGoB/32HQM= X-Gm-Gg: AYBFou2vy3atBLsH9auytYv21SPjCImzEi3KzyCArQ/c46j61FMYuAOZ0yLKrGLSLcE kRjwzwIsQBR8ChSN9BdOHX2t9iBXUNVmYeElIleyTnubWIIMk0G9B38a0SWcmLbcvNlDYd2UWsa GgAskSe/pCFcCk3CUV/Tz1MwnM+0s2wz3TYJsNCcQmrdK+ZsIySvj2bBR5xJ/iHOqA3DS48MJgn eZrpmkIdu0OU3bG2eDYoWP5dHW7RIeiyHmyt4dg8LXDPeJmezGGZ+DMYuvUqabnxyNce5O5R/5Z K4crnow0srWwUezMDNxLazNlq6ls/oiHPzQ7/FVu5jfeoLAd0LCsUrA2f7x4U8xmjiV2jg== X-Received: by 2002:a05:600c:a306:b0:49f:e69d:9df9 with SMTP id 5b1f17b1804b1-4a027573a69mr2284205e9.10.1790872208145; Thu, 01 Oct 2026 09:30:08 -0700 (PDT) X-Received: by 2002:a05:600c:a306:b0:49f:e69d:9df9 with SMTP id 5b1f17b1804b1-4a027573a69mr2283715e9.10.1790872207448; Thu, 01 Oct 2026 09:30:07 -0700 (PDT) Received: from localhost ([213.31.44.29]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a027727cecsm1682015e9.9.2026.10.01.09.30.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Oct 2026 09:30:07 -0700 (PDT) From: Andrew Burgess To: Tom Tromey , gdb-patches@sourceware.org Cc: Tom Tromey Subject: Re: [PATCH v2] Add QUIT to inner loop in value_print_array_elements In-Reply-To: <20260930180533.3722413-1-tromey@adacore.com> References: <20260930180533.3722413-1-tromey@adacore.com> Date: Thu, 01 Oct 2026 17:30:05 +0100 Message-ID: <87h5j5xu2a.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: QRi6qiBRyvmYSLdNtHB1n9xVLK0wLEi9dtpPsoWfCSo_1790872208 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org Tom Tromey writes: > When printing an array, some work is done to detect repeated elements. > This work is not interruptible, and it is somewhat slow (see > PR exp/32681). > > This patch adds QUITs to the relevant spots. In v2 this also moves a > QUIT in the string-printing code, pushing it into a more important > loop. > > I am not sure there is a way to write a non-racy test for this. > > Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=17613 I find it odd that your text mentions PR exp/32681, but the bug link is for 17613. I think the body text should mention 17613 and what it's about even if it's just: This work is not interruptible (see PR gdb/17613), and it is somewhat slow (see PR exp/32681). Also, I think that every bug mentioned should get a 'Bug: ...' line as these are super easy to search for in the git log. I agree that testing this would be hard, the last thing we need are more racy tests. Approved-By: Andrew Burgess Thanks, Andrew > --- > gdb/ada-valprint.c | 2 ++ > gdb/char-print.c | 4 ++-- > gdb/f-valprint.c | 5 +++++ > gdb/valprint.c | 2 ++ > 4 files changed, 11 insertions(+), 2 deletions(-) > > diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c > index d66f9f84d52..020478bdf40 100644 > --- a/gdb/ada-valprint.c > +++ b/gdb/ada-valprint.c > @@ -183,6 +183,8 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr, > bitsize, elttype); > while (1) > { > + QUIT; > + > /* Make sure to free any values in the inner loop. */ > scoped_value_mark free_values; > > diff --git a/gdb/char-print.c b/gdb/char-print.c > index f3425ac2cbc..ba1cec4ff9f 100644 > --- a/gdb/char-print.c > +++ b/gdb/char-print.c > @@ -278,6 +278,8 @@ wchar_printer::count_next_character (wchar_iterator *iter, > > while (1) > { > + QUIT; > + > /* Get the next character. */ > d.num_chars = iter->iterate (&d.result, &chars, &d.buf, &d.buflen); > > @@ -526,8 +528,6 @@ wchar_printer::print (struct ui_file *stream, const gdb_byte *string, > { > int r; > > - QUIT; > - > /* Grab the next character and repeat count. */ > r = count_next_character (&iter, &converted_chars); > > diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c > index d0b2030554f..2b54c8bf1c0 100644 > --- a/gdb/f-valprint.c > +++ b/gdb/f-valprint.c > @@ -36,6 +36,7 @@ > #include "cli/cli-style.h" > #include "gdbarch.h" > #include "f-array-walker.h" > +#include "event-top.h" > > static void f77_get_dynamic_length_of_aggregate (struct type *); > > @@ -188,6 +189,8 @@ class fortran_array_printer_impl : public fortran_array_walker_base_impl > struct type *elt_type, LONGEST elt_off, > LONGEST index, bool last_p) > { > + QUIT; > + > size_t dim_indx = m_dimension - 1; > struct type *elt_type_prev = m_elt_type_prev; > LONGEST elt_off_prev = m_elt_off_prev; > @@ -262,6 +265,8 @@ class fortran_array_printer_impl : public fortran_array_walker_base_impl > LONGEST elt_off_prev = m_elt_off_prev; > bool repeated = false; > > + QUIT; > + > if (m_options.repeat_count_threshold < UINT_MAX > && elt_type_prev != nullptr) > { > diff --git a/gdb/valprint.c b/gdb/valprint.c > index 83a442dcef5..7e41943f66f 100644 > --- a/gdb/valprint.c > +++ b/gdb/valprint.c > @@ -2038,6 +2038,8 @@ value_print_array_elements (struct value *val, struct ui_file *stream, > > while (rep1 < len) > { > + QUIT; > + > /* When printing large arrays this spot is called frequently, so > clean up temporary values asap to prevent allocating a large > amount of them. */ > > base-commit: a122bb30358a3aabe314bcc918494e8b50c336fb > -- > 2.55.0