https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122968

--- Comment #7 from Ben Woodard <woodard at redhat dot com> ---

> Note, this is unfinished, for the !want_address && bitoff case it needs
> either also to punt or handle non-zero bitoff later on
> by shifting the value (depending on endianity?).
> Except this doesn't work, neither in gdb nor in lldb.
>  <2><ea>: Abbrev Number: 1 (DW_TAG_variable)
>     <eb>   DW_AT_name        : d
>     <ed>   DW_AT_decl_file   : 1
>     <ed>   DW_AT_decl_line   : 25
>     <ee>   DW_AT_decl_column : 10
>     <ef>   DW_AT_type        : <0x140>
>     <f3>   DW_AT_location    : 2 byte block: 91 5c      (DW_OP_fbreg: -36)
>  <2><f6>: Abbrev Number: 1 (DW_TAG_variable)
>     <f7>   DW_AT_name        : e
>     <f9>   DW_AT_decl_file   : 1
>     <f9>   DW_AT_decl_line   : 25
>     <fa>   DW_AT_decl_column : 13
>     <fb>   DW_AT_type        : <0x146>
>     <ff>   DW_AT_location    : 5 byte block: 91 5c 9d 1a 5     
> (DW_OP_fbreg: -36; DW_OP_bit_piece: size: 26 offset: 5 )
>  <2><105>: Abbrev Number: 1 (DW_TAG_variable)
>     <106>   DW_AT_name        : f
>     <108>   DW_AT_decl_file   : 1
>     <108>   DW_AT_decl_line   : 25
>     <109>   DW_AT_decl_column : 16
>     <10a>   DW_AT_type        : <0x14c>
>     <10e>   DW_AT_location    : 5 byte block: 91 5c 9d 1 1f    
> (DW_OP_fbreg: -36; DW_OP_bit_piece: size: 1 offset: 31 )
> So, perhaps we can't use DW_OP_bit_piece and have to live with the read-only
> (i.e. DW_OP_stack_value) way with shifts.

Specifically regarding:
 "Except this doesn't work, neither in gdb nor in lldb."
...
 "So, perhaps we can't use DW_OP_bit_piece and have to live with the read-only"

Why is this not a bug in both gdb and lldb, from a DWARF perspective it seems
fine to me.

re:
 "Note, this is unfinished, for the !want_address && bitoff case it needs
either also to punt or handle non-zero bitoff later on by shifting the value
(depending on endianity?)."

While working on DWARF6 one of the complaints that we had with DW_OP_bit_piece
is its sensitivity to endian. There were some calls to even remove DW_OP_piece
and DW_OP_bit_piece but it was decidied that it would be better to keep them in
DWARF6 for backward compatibilikty even if DW_OP_overlay is a better solution
in almost all cases.

Reply via email to