From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 95434 invoked by alias); 11 Dec 2017 22:42:32 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 95419 invoked by uid 89); 11 Dec 2017 22:42:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Hx-languages-length:1969, simons, argue X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 11 Dec 2017 22:42:30 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C1D577AE8B; Mon, 11 Dec 2017 22:42:29 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id AF13B4145; Mon, 11 Dec 2017 22:42:23 +0000 (UTC) Subject: Re: [PATCH v2] Implement pahole-like 'ptype /o' option To: Sergio Durigan Junior , Simon Marchi References: <20171121160709.23248-1-sergiodj@redhat.com> <20171128212137.15655-1-sergiodj@redhat.com> <87o9n5drbn.fsf@redhat.com> <99286acb-ce9f-42f0-41c3-ef10e03171ff@ericsson.com> <87tvwxc6t9.fsf@redhat.com> Cc: GDB Patches , Tom Tromey , Eli Zaretskii From: Pedro Alves Message-ID: <964bae42-6e60-4e9d-048c-ef570c1d3a5b@redhat.com> Date: Mon, 11 Dec 2017 22:42:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <87tvwxc6t9.fsf@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-12/txt/msg00252.txt.bz2 On 12/11/2017 09:07 PM, Sergio Durigan Junior wrote: >>> This is actually on purpose. If I indent the line, it will have more >>> than 80 chars. I believe this is a well known method for avoiding this >>> problem...? >> >> I am not aware of that. In this case I would put the parameter list on the next, >> I'm not sure if it's 100% GNU-style approved, but nobody complained when I did it >> so far :) >> >> static void >> print_spaces_filtered_with_print_options >> (int level, struct ui_file *stream, const struct type_print_options *flags); >> >> It helps with long function names. In this case, I would probably just drop the >> "struct" to save a few chars, because C++. > > Fair enough. I use this trick for function prototypes, but not for the > definitions. Simon's format is what I've been using for a long while too. >> But I don't mind it, it just stuck out as a little inconsistency. > > I don't see the inconsistency. > > If a field is inside a struct, it has its offset *and* size printed. No > matter if the field is an int, another struct, or an union. > > If a field is inside an union, it has only its size printed. > > In the case above, it makes sense to have the offsets printed for the > fields inside the two structs (inside the union), because there might be > holes to report (well, one can argue that it doesn't matter if there are > holes or not in this case, because if the other struct is bigger then > the union size will stay the same). However, it doesn't make sense to > print the offsets for the two structs themselves, because they are > members of the union. > > I hope it makes more sense now. But why do we need the special case? Does it help anything? So far, it seems it only added confusion. The option is "/o" for "print offsets". Why not print offsets always? BTW, shouldn't the documentation in the manual include an example of GDB's output? Thanks, Pedro Alves