This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix DW_OP_bit_piece on big-endian


Hi!

Emitting offset 0 in DW_OP_bit_piece is fine for little-endian
targets and if DW_OP_bit_piece follows DW_OP_reg{N,x} or DW_OP_stack_value
(or for padding DW_OP_bit_piece), but in the (rare) case where
DW_OP_bit_piece follows a memory location descriptor the offset
is usually needed to describe which memory bits should be used.

The attached patch fixes this.

Attached is also a testcase for powerpc*-*-linux* (32-bit or 64-bit)
which at -O2 -g -dA shows DW_OP_bit_piece following memory location
descriptor and a C source and hand-edited powerpc-linux assembly
that should show how the offset should be IMHO treated.  Basically
the offset interpretation should allow representing struct with
bitfields equally using a memory location description for the whole
thing and as a series of DW_OP_bit_piece for the bitfields in it
(so both a and b should have the same content).

offset / 8 should be byte offset, offset % 8 bit offset within byte,
where whether counting from lsb or msb depends on the target
(BITS_BIG_ENDIAN macro in GCC for each target, I assume GDB must
have something similar, as it needs to handle
DW_AT_bit_size/DW_AT_bit_offset/DW_AT_byte_size in DW_TAG_member).

Bootstrapped/regtested on x86_64-linux and i686-linux, tested on
powerpc*-linux.  Ok for trunk?

	Jakub

Attachment: Y694
Description: Text document

Attachment: y.c
Description: Text document

Attachment: z.c
Description: Text document

Attachment: z.s
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]