dejagnu
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2] Add a helper for board entries that are lists


From: Maciej W. Rozycki
Subject: [PATCH v2] Add a helper for board entries that are lists
Date: Wed, 9 Jul 2014 21:27:53 +0100
User-agent: Alpine 1.10 (DEB 962 2008-03-14)

Hi,

 This change in conjunction with the GDB test suite stuff posted here:

http://sourceware.org/ml/gdb-patches/2014-06/msg00426.html

has been used successfully since 2005.  It adds a helper for easy 
maintenance of board entries that are lists, e.g. you'd use:

add_board_info gdb_init_commands "set remotetimeout 5"
add_board_info gdb_init_commands "set debug remote 2"

to have a two-element `gdb_init_commands' list.  This is especially useful 
in cases where individual list elements are added in different scripts.

 This update removes redundant semicolons and adds documentation changes 
requested, including pieces for `set_board_info' and `unset_board_info' 
whose descriptions were lacking.  I also took the opportunity and rather 
than making a new `gdb_init_commands' example I reused a duplicate 
`gdb_init_command' entry (the `print/x \$fsr = 0x0' command used does not 
seem realistic BTW as these commands are issued to GDB before a target has 
been opened and therefore processor registers cannot be accessed and also 
the backslash looks wrong -- perhaps long ago the semantics was different; 
I decided to leave it as it is though).  I verified updated documentation 
to render correctly as Info and PDF output.

 Further comments or questions?  Otherwise please apply.

2014-07-09  Maciej W. Rozycki  <address@hidden>
            Maciej W. Rozycki  <address@hidden>

        * lib/targetdb.exp (add_board_info): New procedure.
        * doc/ref.xml (Add_board_info Procedure): New section.
        (Set_board_info Procedure): Add description.
        (Unset_board_info Procedure): Likewise.
        * doc/user.xml (Board Config File Values): Add `add_board_info'
        reference.  Reorder `gdb_init_command' table rows and remove a
        duplicate entry, reusing it for `gdb_init_commands'.

  Maciej

dejagnu-add-board-info.diff
Index: dejagnu/doc/ref.xml
===================================================================
--- dejagnu.orig/doc/ref.xml
+++ dejagnu/doc/ref.xml
@@ -3104,7 +3104,9 @@
        <sect4 id="setboardinfo" xreflabel="set_board_info procedure">
          <title>Set_board_info Procedure</title>
 
-         <para></para>
+         <para>This checks if <symbol>board_info</symbol> array's field
+         <emphasis>entry</emphasis> has been set already and if not, then
+         sets it to <emphasis>value</emphasis>.</para>
 
        <funcsynopsis role="tcl">
           <funcprototype>
@@ -3116,15 +3118,43 @@
        <variablelist>
           <varlistentry>
            <term><parameter>entry</parameter></term>
-           <listitem><para></para></listitem>
+           <listitem><para>The name of a <symbol>board_info</symbol> field
+           to operate on.</para></listitem>
           </varlistentry>
           <varlistentry>
            <term><parameter>value</parameter></term>
-           <listitem><para></para></listitem>
+           <listitem><para>The value to set the field to.</para></listitem>
           </varlistentry>
        </variablelist>
        </sect4>
 
+       <sect4 id="addboardinfo" xreflabel="add_board_info procedure">
+         <title>Add_board_info Procedure</title>
+
+         <para>This treats <symbol>board_info</symbol> array's field
+         <emphasis>entry</emphasis> as a TCL list and adds
+         <emphasis>value</emphasis> at the end.</para>
+
+       <funcsynopsis role="tcl">
+         <funcprototype>
+           <funcdef><function>add_board_info</function></funcdef>
+           <paramdef><parameter>entry</parameter>
+           <parameter>value</parameter></paramdef>
+          </funcprototype>
+       </funcsynopsis>
+       <variablelist>
+         <varlistentry>
+           <term><parameter>entry</parameter></term>
+           <listitem><para>The name of a <symbol>board_info</symbol> field
+           to operate on.</para></listitem>
+         </varlistentry>
+         <varlistentry>
+           <term><parameter>value</parameter></term>
+           <listitem><para>The value to add to the field.</para></listitem>
+         </varlistentry>
+       </variablelist>
+       </sect4>
+
        <sect4 id="setcurrtargetinfo" xreflabel="set_currtarget_info
        procedure">
          <title>Set_currtarget_info Procedure</title>
@@ -3177,7 +3207,9 @@
        <sect4 id="unsetboardinfo" xreflabel="unset_board_info procedure">
          <title>Unset_board_info Procedure</title>
 
-         <para></para>
+         <para>This checks if <symbol>board_info</symbol> array's field
+         <emphasis>entry</emphasis> has been set and if so, then removes
+         it.</para>
 
        <funcsynopsis role="tcl">
           <funcprototype>
@@ -3188,7 +3220,8 @@
        <variablelist>
           <varlistentry>
            <term><parameter>entry</parameter></term>
-           <listitem><para></para></listitem>
+           <listitem><para>The name of a <symbol>board_info</symbol> field
+           to operate on.</para></listitem>
           </varlistentry>
        </variablelist>
        </sect4>
Index: dejagnu/doc/user.xml
===================================================================
--- dejagnu.orig/doc/user.xml
+++ dejagnu/doc/user.xml
@@ -2505,10 +2505,11 @@ powerpc-linux-gcc -g -O2 -o calc calc.o
     <sect2 id="boarddefs" xreflabel="Board File Values">
       <title>Board Config File Values</title>
 
-      <para>These fields are all in the <symbol>board_info</symbol> These are
-      all set by using the <function>set_board_info</function> procedure. The
-      parameters are the field name, followed by the value to set the field
-      to.</para>
+      <para>These fields are all in the <symbol>board_info</symbol> array.
+      These are all set by using the <function>set_board_info</function>
+      and <function>add_board_info</function> procedures as required. The
+      parameters are the field name, followed by the value that the field
+      is set to or is added to the field, respectively.</para>
 
        <table frame="all" rowsep="0" colsep="0">
          <title>Common Board Info Fields</title>
@@ -2667,11 +2668,6 @@ powerpc-linux-gcc -g -O2 -o calc calc.o
          </row>
 
          <row>
-           <entry>gdb_init_command</entry>
-           <entry>"set mipsfpu none"</entry>
-         </row>
-
-         <row>
            <entry>gdb,cannot_call_functions</entry>
            <entry>1</entry>
            <entry>Whether GDB can call functions on the target,</entry>
@@ -2714,7 +2710,16 @@ powerpc-linux-gcc -g -O2 -o calc calc.o
 
          <row>
            <entry>gdb_init_command</entry>
+           <entry>"set mipsfpu none"</entry>
+           <entry>A single command to send to GDB before the program being
+           debugged is started.</entry>
+         </row>
+
+         <row>
+           <entry>gdb_init_commands</entry>
            <entry>"print/x \$fsr = 0x0"</entry>
+           <entry>Same as <emphasis>gdb_init_command</emphasis>, except
+           that this is a list, more commands can be added.</entry>
          </row>
 
          <row>
Index: dejagnu/lib/targetdb.exp
===================================================================
--- dejagnu.orig/lib/targetdb.exp
+++ dejagnu/lib/targetdb.exp
@@ -73,6 +73,15 @@ proc set_board_info { entry value } {
     }
 }
 
+#
+# Add VALUE to ENTRY for the current board being defined.
+#
+proc add_board_info { entry value } {
+    global board_info board
+
+    lappend board_info($board,$entry) $value
+}
+
 # Fill in ENTRY with VALUE for the current target.
 #
 proc set_currtarget_info { entry value } {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]