[PATCH 5/5] gdb: change print format of flag enums with value 0

Simon Marchi simark@simark.ca
Mon Feb 17 19:02:00 GMT 2020


On 2020-02-17 7:08 a.m., Luis Machado wrote:
> On 2/13/20 5:30 PM, Simon Marchi wrote:
>> If a flag enum has value 0 and the enumeration type does not have an
>> enumerator with value 0, we currently print:
>>
>>    $1 = (unknown: 0x0)
>>
>> I don't like the display of "unknown" here, since for flags, 0 is a
>> an expected value.  It just means that no flags are set.  This patch
>> makes it so that we print it as a simple 0 in this situation:
> 
> Should we print "no flags set" alongside the 0 for this case then?

I don't know, I think that 0 is the natural and standard thing to print
here.  If you had a flags variable in your code, you'd initialize it with

  my_flags = 0;

So if GDB prints that, I think it's clear.

Simon



More information about the Gdb-patches mailing list