[PATCH] Fix printing flags field

Simon Marchi simon.marchi@polymtl.ca
Mon Mar 12 00:46:00 GMT 2018


On 2018-03-09 11:58, Yao Qi wrote:
> As reported in PR gdb/22938, the field value in flags is not correct.
> It is wrong in bit shift in val_print_type_code_flags, but the field
> value is still correct if field_len is 1.
> 
> This patch also adds a self test to default_print_one_register_info, to
> check that eflags on x86 and cpsr on aarch64 are correctly printed.
> 
> Regression tested on x86_64-linux and aarch64-linux.

Hi Yao,

A question that comes to mind is if this works correctly with a 
bits_big_endian architecture.  The doc for field_location::bitpos says 
that it's relative to the MSB on bits_big_endian arches.  Therefore, I 
would guess that the right shift would be wrong then (just an 
assumption, I can't test right now).

Would it be possible to create a selftest that creates its own flags 
types so we are not dependent on any arch type?  We would have more 
control on scenarios/edge cases we want to test, including testing with 
bits_big_endian arches.

Simon



More information about the Gdb-patches mailing list