From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Berlin To: Eli Zaretskii Cc: zackw@stanford.edu, gdb-patches@sources.redhat.com Subject: Re: Option to elide single-bit bitfields when printing structures Date: Fri, 23 Feb 2001 07:03:00 -0000 Message-id: References: <20010222115633.B11707@wolery.stanford.edu> <200102230756.CAA06304@indy.delorie.com> X-SW-Source: 2001-02/msg00450.html Eli Zaretskii writes: > > From: "Zack Weinberg" > > Date: Thu, 22 Feb 2001 11:56:33 -0800 > > > > (gdb) p decl->common > > $1 = {chain = 0x40253000, type = 0x40253138, code = FUNCTION_DECL, > > side_effects_flag = 0, constant_flag = 0, addressable_flag = 0, > > volatile_flag = 0, readonly_flag = 0, unsigned_flag = 0, > > asm_written_flag = 0, used_flag = 0, nothrow_flag = 0, static_flag = 0, > > public_flag = 1, private_flag = 0, protected_flag = 0, bounded_flag = 0, > > lang_flag_0 = 0, lang_flag_1 = 0, lang_flag_2 = 0, lang_flag_3 = 0, > > lang_flag_4 = 0, lang_flag_5 = 0, lang_flag_6 = 0, dummy = 0} > > > > It's hard to see which are set and which aren't. With this patch, you > > can get it printed like this: > > > > (gdb) set print elide-bitflags on > > (gdb) p decl->common > > $2 = {chain = 0x40253000, type = 0x40253138, code = FUNCTION_DECL, public_flag} > > > > which is, IMHO, much easier to read. > > What if someone wants to know which flags are _reset_? Nobody really does, it wouldn't make sense. You know what isn't set because it's not shown. > What if there > are more than one set flag in your example? There is. > What if the bit fields > span more than one bit? It prints them the normal way. > I don't see how your suggestion would deal > with these cases in a way that the resulting display is > self-explaining. That trailing "public_flag" is already hard to > understand; I stared at it for a few moments without understanding > what's going on here, before it hit me. > > Perhaps we need a special command or a special format that would put > the burden on the user. For example, if the user specifies exactly > what flags (set or unset) does she want to see, the display doesn't > need to explain that, because the user asked for it. Errr, it only elides the display if you set a command specifically. It defaults to the old behavior.