From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id NUdKOq0wdGrAPwwAWB0awg (envelope-from ) for ; Thu, 06 Aug 2026 02:58:53 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=Nb45Zpmv; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=J9iY9aHM; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=a7igD/jq; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=ODcpgZ1B; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id C6F191E166; Thu, 06 Aug 2026 02:58:53 -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.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, 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 16AAB1E033 for ; Thu, 06 Aug 2026 02:58:52 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 185A04BB588C for ; Thu, 6 Aug 2026 06:58:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 185A04BB588C Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=Nb45Zpmv; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=J9iY9aHM; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=a7igD/jq; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=ODcpgZ1B Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by sourceware.org (Postfix) with ESMTPS id 1399F4BB3BC3 for ; Thu, 6 Aug 2026 06:58:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1399F4BB3BC3 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1399F4BB3BC3 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1785999491; cv=none; b=tIFfcVLJa/gYE5GmD2usndxDQvNHuMqouxEj++tJIIhy28ZVsPn+dxzlYqJDZyhvLs/hgQuv4z8UMkZDUFLV/C2oqpk7Jp9a6eZCwCNzeQ/N3eyh8GtFgD0kdxG89uT3ZgnfflvR1M0TrRCO2dVKVtU0MWAqhcuk6AwxcPCb1f0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1785999491; c=relaxed/simple; bh=Nw+aNV2JLg68WxGT/2NvbXltfzPgglQaZYur8EGL0Aw=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature: Message-ID:Date:MIME-Version:Subject:To:From; b=nVxjB/hSWlhzimgs25VRwpWB1WkaKelqSTWfx357kMerkHpty58ce95Pb0bKjkcrMn7kR0d95bDenDS42JSLJtXUDSvfqyD53PzuWbrShNGMBamvnJFnwrf8NDzdPQ8aH3f+kw7SAQ9Fv0r78t29UtSvq/2x/fCI6O6XqWPr8G0= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=Nb45Zpmv; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=J9iY9aHM; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=a7igD/jq; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=ODcpgZ1B DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1399F4BB3BC3 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id BA1AB3E00; Thu, 6 Aug 2026 06:58:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1785999485; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=filtC2e0xQFZ9UhIidw2Rd6id0P6kqL5G5rpV+D9u5A=; b=Nb45ZpmvjkZs5F60vQQOBb2HJHKy+j5Rwuqjn2VPFEdTzvSMspApowcuGEP1esciNqirsu upQG9zKBT25a7QxkYR5Ixf2MbfY2O+kE4iyk/fG4BuD2dLs26M/1r9gJ9uOwLIkMqKZlDf oqiMj/K5tGPvjc8ZD6zikWLwqgzA6vw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1785999485; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=filtC2e0xQFZ9UhIidw2Rd6id0P6kqL5G5rpV+D9u5A=; b=J9iY9aHMUMrdEDXP+7AA79riNM7iv8SwB8EiBoxf5OsSMZuTfHKTHC4lsfdHtuGvzf2kKn 8YzPVzqRCyTWsQCw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1785999481; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=filtC2e0xQFZ9UhIidw2Rd6id0P6kqL5G5rpV+D9u5A=; b=a7igD/jquDOEC4Aja8/WJqF7yX8rTPf8JV+PUnNC4o7eRMht3WWUS2WefQmyDBkA9HJnQj x5hWoP8frzV+Mpge/CmgxwM+lXbKueStfGcforeUYbx6V9Wa8I+/56yechzkPnCzUiYxop +LE9g4ZW0i3pkqyw4Ml+4Em2Vug8ACA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1785999481; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=filtC2e0xQFZ9UhIidw2Rd6id0P6kqL5G5rpV+D9u5A=; b=ODcpgZ1BmmtvyP9Ehn8porHW/gKx0IgWiwPqqly0ZVRJNjGQUOgGouoqIUudeLbSq5c9v/ +B/16sQDv/IzIhBg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id A3E86779B6; Thu, 6 Aug 2026 06:58:01 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id P0ynJnkwdGo/FAAAD6G6ig (envelope-from ); Thu, 06 Aug 2026 06:58:01 +0000 Message-ID: Date: Thu, 6 Aug 2026 08:58:01 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] Minor 'debug_*' function improvements To: Tom Tromey , gdb-patches@sourceware.org References: <20260805192422.3038043-1-tromey@adacore.com> Content-Language: en-US From: Tom de Vries In-Reply-To: <20260805192422.3038043-1-tromey@adacore.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spamd-Result: default: False [-4.25 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.15)[-0.738]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; MID_RHS_MATCH_FROM(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo, suse.de:mid, suse.de:email] 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 8/5/26 9:24 PM, Tom Tromey wrote: > I wanted to get a summary of a type in gdb and then realized I had > forgotten the function name, so I had to dig around to find it. This > made me think that perhaps renaming the debug_* functions to all just > be named 'debug' would be an improvement, since it's easier to > remember. > > Then I noticed that debug_type and debug_val don't print a trailing > newline. > > Finally, I needed to be able to see the contents of a gdb_mpz. Hi, this LGTM. FWIW, I did a Claude Code review that pointed out that there's an inconsistency in using ATTRIBUTE_USED vs. ATTRIBUTE_UNUSED (which I introduced). It recommended ATTRIBUTE_UNUSED (which just suppresses a warning), but the way I intended this originally fits ATTRIBUTE_USED better: "When attached to a function, this attribute means that code must be emitted for the function even if it appears that the function is not referenced". So perhaps it would be a good moment to fix this as well. Approved-By: Tom de Vries Thanks, - Tom > --- > gdb/expprint.c | 4 ++-- > gdb/gmp-utils.c | 12 ++++++++++++ > gdb/typeprint.c | 5 +++-- > gdb/valprint.c | 5 +++-- > 4 files changed, 20 insertions(+), 6 deletions(-) > > diff --git a/gdb/expprint.c b/gdb/expprint.c > index bc1929b1a1b..4859d48f6a4 100644 > --- a/gdb/expprint.c > +++ b/gdb/expprint.c > @@ -35,13 +35,13 @@ > > > /* Meant to be used in debug sessions, so don't export it in a header file. */ > -extern void ATTRIBUTE_USED debug_exp (struct expression *exp); > +extern void ATTRIBUTE_USED debug (struct expression *exp); > > /* Print EXP. */ > > void > ATTRIBUTE_USED > -debug_exp (struct expression *exp) > +debug (struct expression *exp) > { > exp->dump (gdb_stdlog); > gdb_flush (gdb_stdlog); > diff --git a/gdb/gmp-utils.c b/gdb/gmp-utils.c > index 168479c50df..f681752a956 100644 > --- a/gdb/gmp-utils.c > +++ b/gdb/gmp-utils.c > @@ -39,6 +39,18 @@ gmp_string_printf (const char *fmt, ...) > return str; > } > > +/* Meant to be used in debug sessions, so don't export it in a header file. */ > +extern void ATTRIBUTE_UNUSED debug (const gdb_mpz &); > + > +/* Print VAL. */ > + > +void ATTRIBUTE_UNUSED > +debug (const gdb_mpz &val) > +{ > + gdb_printf (gdb_stdlog, "%s\n", val.str ().c_str ()); > + gdb_flush (gdb_stdlog); > +} > + > /* See gmp-utils.h. */ > > void > diff --git a/gdb/typeprint.c b/gdb/typeprint.c > index 31a9c1814a3..9177f5808f7 100644 > --- a/gdb/typeprint.c > +++ b/gdb/typeprint.c > @@ -516,14 +516,15 @@ ptype_command (const char *type_name, int from_tty) > } > > /* Meant to be used in debug sessions, so don't export it in a header file. */ > -extern void ATTRIBUTE_UNUSED debug_type (struct type *type); > +extern void ATTRIBUTE_UNUSED debug (struct type *type); > > /* Print TYPE. */ > > void ATTRIBUTE_UNUSED > -debug_type (struct type *type) > +debug (struct type *type) > { > type_print (type, "", gdb_stdlog, 1); > + gdb_printf (gdb_stdlog, "\n"); > gdb_flush (gdb_stdlog); > } > > diff --git a/gdb/valprint.c b/gdb/valprint.c > index 50a4663ca3b..dbfcbf8fad4 100644 > --- a/gdb/valprint.c > +++ b/gdb/valprint.c > @@ -1232,14 +1232,15 @@ value_print (struct value *val, struct ui_file *stream, > } > > /* Meant to be used in debug sessions, so don't export it in a header file. */ > -extern void ATTRIBUTE_UNUSED debug_val (struct value *val); > +extern void ATTRIBUTE_UNUSED debug (struct value *val); > > /* Print VAL. */ > > void ATTRIBUTE_UNUSED > -debug_val (struct value *val) > +debug (struct value *val) > { > value_print (val, gdb_stdlog, &user_print_options); > + gdb_printf (gdb_stdlog, "\n"); > gdb_flush (gdb_stdlog); > } > > > base-commit: b7da195b94b423e5cfd27a14c636ffe9f7380cdd