From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id YR74BkELSGr2HyQAWB0awg (envelope-from ) for ; Fri, 03 Jul 2026 15:19:29 -0400 Received: by simark.ca (Postfix, from userid 112) id 197641E024; Fri, 03 Jul 2026 15:19:29 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.3 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.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 8D8001E024 for ; Fri, 03 Jul 2026 15:19:28 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BCC884BA2E3F for ; Fri, 3 Jul 2026 19:19:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BCC884BA2E3F Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) by sourceware.org (Postfix) with ESMTPS id 1479D4BA2E1B for ; Fri, 3 Jul 2026 19:19:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1479D4BA2E1B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1479D4BA2E1B Authentication-Results: sourceware.org; arc=none smtp.remote-ip=209.85.221.46 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783106343; cv=none; b=Eligo0UzxQ2duZb3X/lkebh73DEUigzoOXIG/QSZR1C8KFZK6JmGcss7cucRrTRn/x4+eJ0BzyaZEMtZ7ulTh7sYCWhdj40hwdcoAaGSa+quRQy2nT8IuBBNquRdjnfe9ScywIbE9S8xuPRrqPQdfRXZGPwbiBK4Lmogn4XViFU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783106343; c=relaxed/simple; bh=nVY5yVGjrxpb3ymxF3Jf3GxaMbE4WFXnr5XZWtenoXs=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=nnokbofnZa7LNpJ6hXqQEqlRIWX9M56UtIcm1ky3iBGlQMl1v2mdf87EITNMwCO5HdzNwAMQC6w5EialrTD3JPBRpmmHhS66/pXjd0CGWPFhuN5iPbkVYwbC8gwGUxBea3Btm/vgkjSkrNRC5/0W4vJHyLMoHzpiL/h2y8a1QxE= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1479D4BA2E1B Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-472055b0efaso658934f8f.2 for ; Fri, 03 Jul 2026 12:19:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783106342; x=1783711142; h=content-transfer-encoding:content-type:in-reply-to:content-language :from:references:cc:to:subject:user-agent:mime-version:date :message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=1bsJxUCrAFSEpIOG5E90lFThbfhnI+wfXWBTfBF0SdM=; b=lgqmzURcxJGLpJSLVpGX2UWKJOKzmda6oljqvOeuTQUsWHTAESnnnBnHltyiunXxVp RcoGbdGDNcGbHjmP7Tm06t2Yh9oQ1sQsDdthRYnbskA8GPU3+38o55//gP1Vtn1jN9wZ SU0SX9eu4nRkIJWDyCskyeFD9QhOnbrhC/S9kEUoqSTpiN33I/QKU5rz5wydW/47GMmD uMIiarvcT9HdR8bE8+qPRrG/tN8pVEkLioakytwISdAjMmr5LbyqbRZHQ2aBiVrLE/wn dkQnsx+g2N5ur4AJoaS3UcfmcJ7C6yRL9EqWQ0JsNciP11ffZ1l8jrvLWeKj6+oaTFhd tRFA== X-Forwarded-Encrypted: i=1; AHgh+RpC2jCAtLtIN5spblt6z1W5mu5wSXDm54v0Zlb2Uo/0hRzf/4wkbYcHR3i/E1R2DC4I8/gqrBhXtwJFJQ==@sourceware.org X-Gm-Message-State: AOJu0YyOS9xtEOsR2u7FZwzsmG1RFTlmzipzFi5ZLF0n/eV9753zWHLP +YdwLHPcBVbdn5l+aARnK2O1cVb/tWmuBiSk6hPtlyA9jCwj7ymsvBQ/ X-Gm-Gg: AfdE7cnHOLJQfjpPrG7VLMNzOj4hhYDkuKA9uxZBPB/4EBtm2BqkTs/hem/4VA9aSbj YgVwPm8kGlASSv1cW0MCgBkS5x2Kd2LungBlmtPlq9U7WO8QAGYAWnUVOdoZzL1rt8sDu2MQvfx 0g9hlVhCipD2txBHc8jlECBsMut0l09qs3hY0D6oUuFFJ8c/Ykg7Mfz70xnF0emG2gcxwc6JA1e tRkOrLfDKnxGWitDMuoSTlYc2kbpFkuGH5xGwafRXe+ji9sqS7VgwJcvVgxiHvy3Q28NjB8N5RI dcneWd9aZUwmKq6X8pEx65NR3CiYTYRoXxSJ504PuOAGW/w8XvT/YCIcnYBjP2siq9jamxU9DCf FM7zndc08c1Sg06mNTqyqzlKd9Xl8Az0uQvZgziEp0R/UL7PP79x8Au/Q8gFw/wycMFJuJOXHDa r3aSM5FI9Z8/EADhx4Qqb+RwR640W18boqZBwUWhrRB30YtIas9EQ7i2c= X-Received: by 2002:a05:6000:989:b0:46e:230f:d095 with SMTP id ffacd0b85a97d-47aa92c0678mr737620f8f.7.1783106341608; Fri, 03 Jul 2026 12:19:01 -0700 (PDT) Received: from ?IPV6:2001:8a0:fac2:7700:16ec:3248:805b:c97a? ([2001:8a0:fac2:7700:16ec:3248:805b:c97a]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47aa039b0cesm1491441f8f.22.2026.07.03.12.19.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 03 Jul 2026 12:19:01 -0700 (PDT) Message-ID: Date: Fri, 3 Jul 2026 20:18:53 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] gdb, amd-dbgapi-target: use PRIu64 and PRIu32 To: Tom Tromey Cc: Lancelot SIX , Tankut Baris Aktemur , gdb-patches@sourceware.org References: <20260701142846.2566570-1-tankutbaris.aktemur@amd.com> <6ae6dd2b-9577-4711-a0c8-93663a28e997@amd.com> <87echlf8s5.fsf@tromey.com> <20854a3f-d7ab-4fdb-b694-a12a16315de0@palves.net> <87wlvcgcry.fsf@tromey.com> From: Pedro Alves Content-Language: en-US In-Reply-To: <87wlvcgcry.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 On 2026-07-03 19:15, Tom Tromey wrote: >>>>>> "Pedro" == Pedro Alves writes: > > Pedro> Agreed. And it's also a portability hazard, like other printf > Pedro> formats, as you have to match the printf format to the type of > Pedro> the variable. > > Yeah, I meant to point this out as well. > > For pulongest you really only need to know whether the type is signed; > and we could easily fix that if we cared to. > > Pedro> (std::cout << ... << ... tends to be unreadable too IMHO, but we don't use that, thankfully). > > I thought about this for ui_file but meh. It's kind of i18n-unfriendly > as well. Yeah, like, very unfriendly, similar to how ui_out is unfriendly, with the message split over several calls. BTW, we should look into actually doing i18n, like send the .po files to a translation team. Maybe we can convince one of the new release managers to integrate the flow into the release process. :-) I think Ubuntu had GDB translations at some point. Haven't checked in a long while. > > Pedro> {fmt} would be better, but that's either a new external dependency, or > Pedro> bump to c++20 for std::format, or c++23 for widely available std::print. > > I looked into this but it is also i18n-unfriendly, since as far as I can > tell it requires you to either give up gettext or give up any sort of > format checking. For printf this isn't an issue because GCC understands > that _() is "transparent". > Ah, yeah, if you run the format string via gettext, that returns a runtime string, so we'd need to use std::vformat, which as you say, loses compile-time checking: std::vformat (_("Hello, {0}!"), std::make_format_args (name)); But I think we could make it work, with a wrapper, which is what we'd do anyhow to work with ui_file. But we make the wrapper a template, which itself does the format checking at compile time. Like: template void gdb_format (std::format_string f, Args&&... args) { std::string s = std::vformat (gettext (f.get ()), std::make_format_args (args...)); gdb_stdout->puts (s.c_str ()); } then with: gdb_printf ("stopped at {}\n", addr); the literal "stopped at {}\n" gets bound to the format_string parameter. format_string's ctor parses the literal and checks placeholders against Args..., at compile time, and a mismatch results in a compile error. If that compiles successfully, then we call gettext and use std::vformat without the checking, which we no longer need as it's already validated when we get there. Note, written in email client, completely untested. > Also of course switching to fmt would be a colossal effort. No doubt. Could be incremental, though.