This is the mail archive of the gdb-prs@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]

[Bug gdb/21184] New: Unexpected display for flag/struct type in target description


https://sourceware.org/bugzilla/show_bug.cgi?id=21184

            Bug ID: 21184
           Summary: Unexpected display for flag/struct type in target
                    description
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: currygt52 at gmail dot com
  Target Milestone: ---

Hi,

I get unexpected display when using the new target description feature
"multibit flag and enum bitfields".
The issue can be reproduced by explicitly hacking x86 target description as
follow:

1. Modifying gdb/features/i386/64bit-core.xml and adding two new types, and
modifying r14/r15 type.
  <flags id="r14_flags" size="8">
    <field name="BIT0" start="0" end="0"/>
    <field name="BIT1_2" start="1" end="2"/>
  </flags>
  <struct id="r15_flags" size="8">
    <field name="BIT0" start="0" end="0"/>
    <field name="BIT1" start="1" end="1"/>
  </struct>

  <reg name="r14" bitsize="64" type="r14_flags"/>
  <reg name="r15" bitsize="64" type="r15_flags"/>


2. Regenerate gdb/features/i386/amd64-avx-linux.c
rm i386/amd64-avx-linux.c
make GDB=<path/to/gdb> XMLTOC=i386/amd64-avx-linux.xml i386/amd64-avx-linux.c

3. Rebuild gdbserver

4. Launch gdbserver and connect it with gdb

5. Access r14/r15

(gdb) p/x $r14
$1 = 0x0
(gdb) p $r14
$2 = [ BIT1_2=0 ]
(gdb) set (long)$r14=0x2
(gdb) p/x $r14
$3 = 0x2
(gdb) p $r14
$4 = [ BIT1_2=2 ]               <=== I expect [ BIT1_2=1 ]
(gdb) set (long)$r14=0x4
(gdb) p/x $r14
$5 = 0x4
(gdb) p $r14
$6 = [ BIT1_2=0 ]               <=== I expect [ BIT1_2=2 ]
(gdb) p/x $r15
$7 = {BIT0 = 0x0, BIT1 = 0x0}
(gdb) set (long)$r15=0x1
(gdb) p/x $r15
$8 = {BIT0 = 0xff, BIT1 = 0x0}  <=== I expect {BIT0 = 0x1, BIT1 = 0x0}
(gdb) p $r15
$9 = {BIT0 = -1, BIT1 = false}  <=== I expect {BIT0 = true, BIT1 = false}

Please help to check this.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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