public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/28104] New: Incorrect extraction of boolean fields in target description "struct" data type
@ 2021-07-19 14:41 shahab.vahedi at gmail dot com
  2021-07-19 14:41 ` [Bug gdb/28104] " shahab.vahedi at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: shahab.vahedi at gmail dot com @ 2021-07-19 14:41 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 28104
           Summary: Incorrect extraction of boolean fields in target
                    description "struct" data type
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: shahab.vahedi at gmail dot com
  Target Milestone: ---

Affected versions are HEAD, 11, 10, ...

This is a more elaborated bug report of 21184. That report actually mentions
two bugs. This report is only about one of those.

============================================================

Assume there is an XML target description as follows:
---------------- [ target description xml ] ----------------
<?xml version="1.0"?>

<!DOCTYPE feature SYSTEM "gdb-target.dtd">
<feature name="org.gnu.gdb.arc.fpu">
  <struct id="struct_type" size="4">
    <field name="version" start="0"  end="7"  type="int" />
    <field name="g"       start="8"  end="8"  type="bool"/>
    <field name="u"       start="9"  end="9"  type="bool"/>
    <field name="b"       start="10" end="10" type="bool"/>
    <field name=""        start="11" end="31"            />
  </struct>
  <reg name="s_reg" bitsize="32" type="struct_type"/>
</feature>
------------------------------------------------------------

This corresponds to an "s_reg" register like below:
---------------- [ s_reg register format ] -----------------
      ,-----------------.---.---.---.---------.
      | dont_care_field | b | u | g | version |
      `-----------------^---^---^---^---------'
bit:   31     ...     11  10  9   8  7  ...  0
------------------------------------------------------------

When the reported value of "s_reg" is 0x1337:
------- [ s_reg instance with 0x1337 as its value ] --------
  0  x   1    3    3    7
       0001 0011 0011 0111
             bug  version
------------------------------------------------------------ 

GDB prints incorrect information regarding the boolean fields
that are set:
--------------------------- [gdb] --------------------------
(gdb) info reg $s_reg
s_reg          {
  version = 0x37,
  g = 0xff,
  u = 0xff,
  b = 0x0
} {
  version = 55,
  g = -1,
  u = -1,
  b = false
}
------------------------------------------------------------ 

As you can see, the "version" field is interpreted correctly,
but the "g" and "u" fields are represented by "0xff" or "-1"
instead of "1" or "true". The "b" field is fine though.

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-08-02 11:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-19 14:41 [Bug gdb/28104] New: Incorrect extraction of boolean fields in target description "struct" data type shahab.vahedi at gmail dot com
2021-07-19 14:41 ` [Bug gdb/28104] " shahab.vahedi at gmail dot com
2021-07-26 13:55 ` shahab.vahedi at gmail dot com
2021-07-26 13:56 ` shahab.vahedi at gmail dot com
2021-08-02 11:03 ` andrew.burgess at embecosm dot com
2021-08-02 11:07 ` cvs-commit at gcc dot gnu.org
2021-08-02 11:20 ` shahab.vahedi at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).