From: Yao Qi <yao@codesourcery.com>
To: Wei-cheng Wang <cole945@gmail.com>
Cc: <gdb-patches@sourceware.org>
Subject: Re: [PATCH 1/5] Code for nds32 target
Date: Thu, 25 Jul 2013 02:35:00 -0000 [thread overview]
Message-ID: <51F08ECA.4060301@codesourcery.com> (raw)
In-Reply-To: <51DC552D.3060900@gmail.com>
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 (é½å°§)
next prev parent reply other threads:[~2013-07-25 2:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-08 9:28 Wei-cheng Wang
2013-07-08 23:58 ` Joseph S. Myers
2013-07-09 16:18 ` Wei-cheng Wang
2013-07-09 4:10 ` Yao Qi
2013-07-09 18:23 ` Wei-cheng Wang
2013-07-25 2:35 ` Yao Qi [this message]
2013-07-10 5:38 ` Yao Qi
2013-07-11 14:06 ` Wei-cheng Wang
2013-07-11 14:26 ` Wei-cheng Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51F08ECA.4060301@codesourcery.com \
--to=yao@codesourcery.com \
--cc=cole945@gmail.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox