Add myself to gdb/MAINTAINERS
[deliverable/binutils-gdb.git] / gdb / regformats / regdat.sh
index 3de9ed9f464e9de9c8147081fc5d4ae57018fe08..1839a881213c0603fb88a3e54bd7139a2777fb78 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh -u
 
 # Register protocol definitions for GDB, the GNU debugger.
-# Copyright 2001, 2002, 2007 Free Software Foundation, Inc.
+# Copyright (C) 2001-2020 Free Software Foundation, Inc.
 #
 # This file is part of GDB.
 #
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-move_if_change ()
-{
-    file=$1
-    if test -r ${file} && cmp -s "${file}" new-"${file}"
-    then
-       echo "${file} unchanged." 1>&2
-    else
-       mv new-"${file}" "${file}"
-       echo "${file} updated." 1>&2
-    fi
-}
-
 # Format of the input files
 read="type entry"
 
@@ -94,13 +82,13 @@ cat <<EOF
 /* *INDENT-OFF* */ /* THIS FILE IS GENERATED */
 
 /* A register protocol for GDB, the GNU debugger.
-   Copyright 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 2001-2013 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
@@ -109,9 +97,7 @@ cat <<EOF
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* This file was created with the aid of \`\`regdat.sh'' and \`\`$1''.  */
 
@@ -121,48 +107,94 @@ EOF
 
 exec > new-$2
 copyright $1
+echo '#include "server.h"'
 echo '#include "regdef.h"'
-echo '#include "regcache.h"'
+echo '#include "tdesc.h"'
 echo
 offset=0
 i=0
 name=x
+xmltarget=x
+xmlarch=x
+xmlosabi=x
 expedite=x
+feature=x
 exec < $1
 while do_read
 do
   if test "${type}" = "name"; then
     name="${entry}"
-    echo "struct reg regs_${name}[] = {"
+
+    echo "const struct target_desc *tdesc_${name};"
+    echo ""
+    echo "void"
+    echo "init_registers_${name} (void)"
+    echo "{"
+    echo "  static struct target_desc tdesc_${name}_s;"
+    echo "  struct target_desc *result = &tdesc_${name}_s;"
+    echo "  struct tdesc_feature *feature = tdesc_create_feature (result, \"${name}\");"
+    continue
+  elif test "${type}" = "xmltarget"; then
+    xmltarget="${entry}"
+    continue
+  elif test "${type}" = "xmlarch"; then
+    xmlarch="${entry}"
+    continue
+  elif test "${type}" = "osabi"; then
+    xmlosabi="${entry}"
     continue
   elif test "${type}" = "expedite"; then
     expedite="${entry}"
     continue
+  elif test "${type}" = "feature"; then
+    feature="${entry}"
+    continue
   elif test "${name}" = x; then
     echo "$0: $1 does not specify \`\`name''." 1>&2
     exit 1
   else
-    echo "  { \"${entry}\", ${offset}, ${type} },"
+    echo "  tdesc_create_reg (feature, \"${entry}\","
+    echo "  0, 0, NULL, ${type}, NULL);"
+
     offset=`expr ${offset} + ${type}`
     i=`expr $i + 1`
   fi
 done
 
-echo "};"
 echo
-echo "const char *expedite_regs_${name}[] = { \"`echo ${expedite} | sed 's/,/", "/g'`\", 0 };"
+echo "static const char *expedite_regs_${name}[] = { \"`echo ${expedite} | sed 's/,/", "/g'`\", 0 };"
+
+echo "#ifndef IN_PROCESS_AGENT"
+if test "${feature}" != x; then
+  echo "static const char *xmltarget_${name} = 0;"
+elif test "${xmltarget}" = x; then
+  if test "${xmlarch}" = x && test "${xmlosabi}" = x; then
+    echo "static const char *xmltarget_${name} = 0;"
+  else
+    echo "static const char *xmltarget_${name} = \"@<target>\\"
+    if test "${xmlarch}" != x; then
+      echo "<architecture>${xmlarch}</architecture>\\"
+    fi
+    if test "${xmlosabi}" != x; then
+      echo "<osabi>${xmlosabi}</osabi>\\"
+    fi
+    echo "</target>\";"
+  fi
+else
+  echo "static const char *xmltarget_${name} = \"${xmltarget}\";"
+fi
 echo
 
 cat <<EOF
-void
-init_registers ()
-{
-    set_register_cache (regs_${name},
-                       sizeof (regs_${name}) / sizeof (regs_${name}[0]));
-    gdbserver_expedite_regs = expedite_regs_${name};
+  result->xmltarget = xmltarget_${name};
+#endif
+
+  init_target_desc (result, expedite_regs_${name});
+
+  tdesc_${name} = result;
 }
 EOF
 
 # close things off
 exec 1>&2
-move_if_change $2
+mv -- "new-$2" "$2"
This page took 0.027791 seconds and 4 git commands to generate.