gdbserver target description: info reg displays or not according to group presence ???

Philippe Waroquiers
Thu Aug 12 19:08:00 GMT 2010

Thanks for the reply/help.

> The problem with letting people specify random strings as group is
> that GDB might grab those strings for a specific purpose in some
> future version.  There's no registry or namespace.
Is this really a problem ? 
>From what I understand, a group is (only?) useful to (in the future)
allow to do 'info register <group>".
If there is really some behaviour linked with a register group,
then it is enough to specify something like:  
"general", "all", "float", "vector", "save"  and group names starting 
with "g" are standard group names reserved for gdb usage.

> Turns out there's a better fix too.  Does this work?
It does not work according to the doc, but it provides
a consistent behaviour. The behaviour is: 
   if *no* group is given, then 'info reg' shows the registers.

With the patch, the behaviour is:
   * if no group is specified, then a register belongs to the general group.
   * the general group is shown by 'info reg'
   * other (gdb known) groups are shown by 'info reg <group>'
   * info all-reg shows all registers
    * and in the future, we could have
         info reg <non standard group name> shows the registers of this group.

Here is some more detailed info about the behaviour with the patch:

With the below (extract of) target description file:
    <field name="VIP" start="20" end="20"/>
    <field name="ID" start="21" end="21"/>

  <reg name="eaxs1" bitsize="32" type="int32" group="float"/>
  <reg name="ecxs1" bitsize="32" type="int32" group="groupecxs1"/>
  <reg name="edxs1" bitsize="32" type="int32"/>
  <reg name="ebxs1" bitsize="32" type="int32"/>

info register gives
  es             0x0 0
  fs             0x0 0
  gs             0x7b0000 8060928
  edxs1          0x0 0
  ebxs1          0x0 0
  esps1          0x0 0x0

So, specifying either a standard (float) or unknown (groupecxs1)
group makes these registers not shown.
But having no group at all (e.g. edxs1) still shows them.

maint print register-groups gives:
 orig_eax     49   49    308       4 long            save,restore,system
 eaxs1        50   50    312       4 int32_t         float,all,save,restore
 ecxs1        51   51    316       4 int32_t         all,save,restore
 edxs1        52   52    320       4 int32_t         general,all,save,restore


More information about the Gdb mailing list