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]

Re: [PATCH 1/5] Code for nds32 target


On 07/10/2013 02:23 AM, Wei-cheng Wang wrote:
    Target description can not describe a enum-typed bit-field.

    If bit-field struct is used, I could not specify the type for
    a bit-field.

      <struct id="id" size="size">
        <field name="name" start="start" end="end"/>
        ...
      </struct>

    If I want to specify field type, I couldn't specify size of a field.

      <struct id="id">
        <field name="name" type="type"/>
        ...
      </struct>


FAOD, this works in general. See testsuite/gdb.xml/extra-regs.xml. However, TYPE can't be flags. For example, I hack 'i386_eflags' in i386/32bit-core.xml, which splits eflags registers into three groups (or types),

  <flags id="i386_eflags_1" size="1">
    <field name="CF" start="0" end="0"/>
    <field name="" start="1" end="1"/>
    <field name="PF" start="2" end="2"/>
    <field name="AF" start="4" end="4"/>
    <field name="ZF" start="6" end="6"/>
    <field name="SF" start="7" end="7"/>
  </flags>

  <flags id="i386_eflags_2" size="1">
    <field name="TF" start="0" end="0"/>
    <field name="IF" start="1" end="1"/>
    <field name="DF" start="2" end="2"/>
    <field name="OF" start="3" end="3"/>
    <field name="NT" start="4" end="4"/>
  </flags>

  <flags id="i386_eflags_3" size="1">
    <field name="RF" start="0" end="0"/>
    <field name="VM" start="1" end="1"/>
    <field name="AC" start="2" end="2"/>
    <field name="VIF" start="3" end="3"/>
    <field name="VIP" start="4" end="4"/>
    <field name="ID" start="5" end="5"/>
  </flags>

  <struct id="i386_eflags" size="4">
    <field name="a" type="i386_eflags_1"/>
    <field name="b" type="i386_eflags_2"/>
    <field name="c" type="i386_eflags_3"/>
  </struct>

Then I get an error:

  Explicitly sized type can not contain non-bitfield "a"

It is a limitation of <struct> and <flags>, which was mentioned in the patch submission.

  [patch] Add support for <struct> and <flags> in target descriptions
  http://sourceware.org/ml/gdb-patches/2010-02/msg00542.html

I can't evaluate how much efforts are needed to fix this limitation.

    All I want is to display a register in such format.

      (gdb) p $cr0
      $1 = {CFGID = [ PERF_EXT 16_EXT PERF_EXT2 COP_EXT STR_EXT ],
      REV = 16, CPUID = N13}

    (cr0 consist of config flags, revision number and CPU ID.)

With some hack (comment out the code which throws error) in xml-tdesc.c:tdesc_start_field, I can get something similar to yours,

(gdb) p $eflags
$1 = {a = [ SF ], b = [ IF ], c = [ ]}

Probably, it is what you want. Looks target description is quite 'friendly' to be extended, but I don't know what to start with or how much work is needed.

--
Yao (éå)


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