From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sonic309-25.consmr.mail.ir2.yahoo.com (sonic309-25.consmr.mail.ir2.yahoo.com [77.238.179.83]) by sourceware.org (Postfix) with ESMTPS id C4E79385DC00 for ; Sun, 31 May 2020 16:33:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C4E79385DC00 X-YMail-OSG: j1lLJHgVM1k_8L94iglaYEbb_gDwz1O.VUQJ_MRIGnmMcDmDJh8oFdBPCBdf7SI VsAVcQcn74a4vmO174He0ICfmx0Hjtl2KBJ2GgeVC1UgC4RQ3zQv1KSxXvk2z2dq5bHERtLH1qms CrOdOSaSOfO.4b0eE_LCZlGp9J5bztUYDixbjmMahKf8r_7bEVFQ9wFlDp0aUk2M4Fv061e0F.xp SsWmbxxuCc3XZf95benU4sZoVwSCHeC0qcMWl0dll7cjyc4UNRVf0dJEk7RtpadPmcQOPesdv8vg CX80b4PiDR.0b09BlxvrhzLMe1BEbT0m6Rp1m8Spc3Jxc_b03J.x8C7jJWYzxbsjJpA2iIuuBwDj kodEHAtNAiyIbUwd3QtwdI3lbhqEqclve8cMYjNAHDBND9fh9La24DDL3dU2wSsRgGO0fyjKo1SA VdkPQj7oIHPymBJlh6LAujD6oL9M6XWkIoIUDQRyKGydWkJ.avYgqP9Dhg32QHwzcVWUmTTL9v4r dn8ZY0_cfp.vEma0_z5xm91meMuBE9GlcjJ_QkCEq7lLzrc9QqNEsNz7RHI.HripSmYPUGaJvt3f OFKSkvjkPPssJtZTehjVi5xSspyieDzMhrm_7FIXK0eqyxQ7yQ2OpL3oEfW.aZCRJTLKKMGkAjMs k2yXSkZesmTGy3EMwl.Vlv5ayqTFhgAw7pcSGunTwCdWPo0xeYnRLJHnsF58vQKXRhOqia8Ulwm2 iu6Z1D9n54C8t0MmddIF1BmH9tv0jOkZmJw1zef_TV69wN.f6c4e7po_o4FQmpKB2jL2rNhZ9jdI y__ii.kRzVIT3bpvD3xkilhnyqJVyxLTO_uWoKcfJ6fVE2jJuF7wdGfRNB1yFybr52iZFBRBpedX WBjunRn2xOjfmlsbt6lrQSYlNMjLeSXZuhGSOqYaYZELXPkULrywiKgzD20Ptue.TM0f.b1vqnS1 _tqsW0jwL7d33Son7vLKpkG0mh1YgVzOPM9xwuu5F6WwgJu4aCzHQHj1hCIf0l8sNDfoal4aIMBt rqjdk0wJwekQL0pHGnXM3zKkUunzew2uEFuTEZ.sbMYLQh12Z2jnWhYpkUORF5ZG6r0x3Fg0z1yJ sisP3zDpQx66V95M82PX7vX44yhF4eO1KZcKh4BTlnYHFA9ZXvYpSIE4rz2Dr_oxi32q6_Kp0GTh 2ZrXy0nnGO4uqPs1HAdtrFac4pl4NbUrAcaKt0L11ktGrJYP4oJ2.VhDkRF_C.Eu0LREToBc18ka qLI9Dw6Ao4hZr3k.d.a8E6slzYsuOy3fiHd_lpISdY37RzRzaqJN64SJ9mljRZmoJzBSHLRTWf7c wNq_mdcZ0wByXZyY4 Received: from sonic.gate.mail.ne1.yahoo.com by sonic309.consmr.mail.ir2.yahoo.com with HTTP; Sun, 31 May 2020 16:33:42 +0000 Date: Sun, 31 May 2020 16:33:40 +0000 (UTC) From: Hannes Domani To: Gdb-patches Message-ID: <728076575.828289.1590942820579@mail.yahoo.com> In-Reply-To: References: <20200530161253.61299-1-ssbssa.ref@yahoo.de> <20200530161253.61299-1-ssbssa@yahoo.de> <1980167901.498897.1590883592361@mail.yahoo.com> <235118837.781199.1590937122739@mail.yahoo.com> Subject: Re: [PATCH v2][PR gdb/24052] Implement 'set print zero-values on|off' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Mailer: WebService/1.1.16037 YMailNorrin Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:76.0) Gecko/20100101 Firefox/76.0 X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Sun, 31 May 2020 16:33:58 -0000 Am Sonntag, 31. Mai 2020, 17:21:16 MESZ hat Pedro Alves Folgendes geschrieben: > On 5/31/20 3:58 PM, Hannes Domani via Gdb-patches wrote: > >=C2=A0 Am Sonntag, 31. Mai 2020, 15:39:05 MESZ hat Pedro Alves Folgendes geschrieben: > > >> The thing is that an enum does not measure a quantity or offset. > >> "0" has no usual particular significance compared to > >> other enumerators.=C2=A0 While with pointers and integrals, usually > >> "0" has significance, meaning no quantity, no offset or no object, > >> or in general absence of the property being measured by the variable. > >> > >> For example, here's GDB's auto_boolean: > >> > >> /* * A generic, not quite boolean, enumeration.=C2=A0 This is used for > >>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 set/show commands in which the options a= re on/off/automatic.=C2=A0 */ > >> enum auto_boolean > >> { > >>=C2=A0=C2=A0=C2=A0 AUTO_BOOLEAN_TRUE, > >>=C2=A0=C2=A0=C2=A0 AUTO_BOOLEAN_FALSE, > >>=C2=A0=C2=A0=C2=A0 AUTO_BOOLEAN_AUTO > >> }; > >> > >> I'd think it confusing that "zero-values off" would hide > >> AUTO_BOOLEAN_TRUE, but not AUTO_BOOLEAN_FALSE. > >> > >> Here: > >> > >> extern enum language_mode > >>=C2=A0=C2=A0=C2=A0 { > >>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 language_mode_auto, language_mode_manual > >>=C2=A0=C2=A0=C2=A0 } > >> language_mode; > >> > >> What's the significance of hiding auto but not manual? > >> > >> Here: > >> > >> /* alignment enum */ > >> enum ui_align > >>=C2=A0=C2=A0=C2=A0 { > >>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ui_left =3D -1, > >>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ui_center, > >>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ui_right, > >>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ui_noalign > >>=C2=A0=C2=A0=C2=A0 }; > >> > >> Why hide ui_center, instead of the other enumerators? > >> > >> Etc. > > > > It seems we have very different views about this. > > I don't think it's confusing at all to hide AUTO_BOOLEAN_TRUE/ > > language_mode_auto/ui_center in these cases. > > > > OK, if such different views are both reasonable, then this > normally means that the larger set of users will also contain > people with such opposing views, which calls for making it > optional.=C2=A0 Maybe: > > set print zero-values all / non-enums / none > > > (For me it's more confusing that AUTO_BOOLEAN_TRUE is first in this enu= m.) > > > > If you don't want to hide it, just don't use -zero-values off. > > > > Even the original reporter in the PR suggested only removing > zero enums under an option: > > "Optionally also removing those enums which evaluate to zero would > save even more unneeded information." > > >> (gdb) p g_out > >> $1 =3D {pad1 =3D {c =3D 0 '\000', i =3D 0}, pad2 =3D {c =3D 0 '\000', = i =3D 0}} > >> (gdb) p out > >> $2 =3D {pad1 =3D {c =3D 0 '\000', i =3D 0}, pad2 =3D {c =3D 0 '\000', = i =3D 0}} > >> > >> (gdb) p -zero-values off -- g_out > >> $3 =3D {} > >> (gdb) p -zero-values off -- out > >> $4 =3D {pad1 =3D {}, pad2 =3D {}} > >> > >> As you see, $3 and $4 gave different outputs, due to the padding. > > > > I agree that this might be weird, but I kinda see this as a feature. > > What's the value of the feature?=C2=A0 I think it's a hard to justify fea= ture, > because garbage in padding happens randomly, and naturally, and doesn't > affect the value at the language level.=C2=A0 I very much question the va= lue > in wanting a different output here, and I hazard a guess that you were > initially surprised with this case too.=C2=A0 IMO it's just a bug not to > consider it. > > >> Why print "static_field =3D 0" when zero-values is off? > > > > When printing structures, I usually don't care about the static members= . > > > > And with -zero-values off it should just display the parts that have so= me kind > > of value. > > So now I kinda want to hide all static members when -zero-values off, n= o > > matter what their real value is. > > NAK.=C2=A0 Let's keep options orthogonal. OK. I will first try to fix the padding and static members. Once I got that, enums. But I have no idea how python pretty printers could be handled. Hannes