This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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]

[commit/Ada] field of PAD structure is a non-scalar bitfield


Hello,

We have noticed a problem in the debugger when trying to print a record
containing a packed array.  What happened is that the compiler wrapped
our variable into a PAD type.  These wrapper are often used to handle
alignment and packing.  exp_dbug.ads says, among other things:

      --  When the debugger sees an object of a type whose name has a
      --  suffix of ___PAD or ___JM, the type will be a record containing
      --  a single field, and the name of that field will be all upper case.
      --  In this case, it should look inside to get the value of the inner
      --  field, and neither the outer structure name, nor the field name
      --  should appear when the value is printed.

The problem appeared because the field inside the PAD record was
defined as a bit-field in the debugging info:

        .uleb128 0x24   # (DIE (0xf40) DW_TAG_member)
        .ascii "F\0"    # DW_AT_name
        .byte   0x9     # DW_AT_decl_file
        .byte   0x15    # DW_AT_decl_line
        .long   0xf50   # DW_AT_type
        .byte   0x4     # DW_AT_byte_size
        .byte   0x18    # DW_AT_bit_size
        .byte   0x8     # DW_AT_bit_offset
        .byte   0x2     # DW_AT_data_member_location
        .byte   0x23    # DW_OP_plus_uconst
        .uleb128 0x0

I just learned that Ada makes frequent uses of non-scalar bitfields.
And indeed, we have a function in ada-lang.c that we use to get
record fields which also happens to handle the case of bit-field
components as well (the function handles other cases such as
tagged types, variant records, etc).

So I fixed the problem by using that function to get the "F" field
inside our PAD type.

2008-05-02  Joel Brobecker  <brobecker@adacore.com>

        * ada-lang.c (unwrap_value): Handle the case where the "F" field
        inside a PAD type is a bitfield.

Tested on x86-linux, no regression.  Checked in.

-- 
Joel

Attachment: ada-lang.c.diff
Description: Text document


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