]> Git Repo - binutils.git/blobdiff - gdb/gdbarch.sh
2000-04-02 Mark Kettenis <[email protected]>
[binutils.git] / gdb / gdbarch.sh
index 68c44521a162557e0c7575cad337a8b58e00ca54..01520d6756ab61aaedc57682c7af5188d101c6f7 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/local/bin/bash
 
 # Architecture commands for GDB, the GNU debugger.
-# Copyright 1998-1999 Free Software Foundation, Inc.
+# Copyright 1998-2000 Free Software Foundation, Inc.
 #
 # This file is part of GDB.
 #
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
+compare_new ()
+{
+    file=$1
+    if ! test -r ${file}
+    then
+       echo "${file} missing? cp new-${file} ${file}" 1>&2
+    elif diff -c ${file} new-${file}
+    then
+       echo "${file} unchanged" 1>&2
+    else
+       echo "${file} has changed? cp new-${file} ${file}" 1>&2
+    fi
+}
+
+
+# Format of the input table
 read="class level macro returntype function formal actual attrib default init invalid_p fmt print print_p description"
 
 # dump out/verify the doco
@@ -259,6 +275,8 @@ fi
 copyright ()
 {
 cat <<EOF
+/* *INDENT-OFF* */ /* THIS FILE IS GENERATED */
+
 /* Dynamic architecture support for GDB, the GNU debugger.
    Copyright 1998-1999, Free Software Foundation, Inc.
 
@@ -279,8 +297,6 @@ cat <<EOF
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/* *INDENT-OFF* */ /* \`\`typedef (f)();'' confuses indent */
-
 /* This file was created with the aid of \`\`gdbarch.sh''.
 
    The bourn shell script \`\`gdbarch.sh'' creates the files
@@ -512,6 +528,10 @@ extern struct gdbarch_list *gdbarch_list_lookup_by_info (struct gdbarch_list *ar
 extern struct gdbarch *gdbarch_alloc (const struct gdbarch_info *info, struct gdbarch_tdep *tdep);
 
 
+/* Helper function.  Free a partially-constructed \`\`struct gdbarch''.  */
+extern void gdbarch_free (struct gdbarch *);
+
+
 /* Helper function. Force an update of the current architecture.  Used
    by legacy targets that have added their own target specific
    architecture manipulation commands.
@@ -637,7 +657,7 @@ extern int (*target_architecture_hook) (const struct bfd_arch_info *);
 #include "dis-asm.h"           /* Get defs for disassemble_info */
 
 extern int dis_asm_read_memory (bfd_vma memaddr, bfd_byte *myaddr,
-                               int len, disassemble_info *info);
+                               unsigned int len, disassemble_info *info);
 
 extern void dis_asm_memory_error (int status, bfd_vma memaddr,
                                  disassemble_info *info);
@@ -738,15 +758,7 @@ extern void gdbarch_dump (void);
 EOF
 exec 1>&2
 #../move-if-change new-gdbarch.h gdbarch.h
-if ! test -r gdbarch.h
-then
-  echo "gdbarch.h missing? cp new-gdbarch.h gdbarch.h" 1>&2
-elif diff -c gdbarch.h new-gdbarch.h
-then
-  echo "gdbarch.h unchanged" 1>&2
-else
-  echo "gdbarch.h has changed? cp new-gdbarch.h gdbarch.h" 1>&2
-fi
+compare_new gdbarch.h
 
 
 #
@@ -961,6 +973,23 @@ cat <<EOF
 }
 EOF
 
+# Free a gdbarch struct.
+echo ""
+echo ""
+cat <<EOF
+/* Free a gdbarch struct.  This should never happen in normal
+   operation --- once you've created a gdbarch, you keep it around.
+   However, if an architecture's init function encounters an error
+   building the structure, it may need to clean up a partially
+   constructed gdbarch.  */
+void
+gdbarch_free (struct gdbarch *arch)
+{
+  /* At the moment, this is trivial.  */
+  free (arch);
+}
+EOF
+
 # verify a new architecture
 echo ""
 echo ""
@@ -1055,7 +1084,6 @@ struct gdbarch_tdep *
 gdbarch_tdep (struct gdbarch *gdbarch)
 {
   if (gdbarch_debug >= 2)
-    /* FIXME: gdb_std??? */
     fprintf_unfiltered (gdb_stdlog, "gdbarch_tdep called\n");
   return gdbarch->tdep;
 }
@@ -1077,7 +1105,6 @@ do
         echo "  if (gdbarch->${function} == 0)"
         echo "    internal_error (\"gdbarch: gdbarch_${function} invalid\");"
        echo "  if (gdbarch_debug >= 2)"
-       echo "    /* FIXME: gdb_std??? */"
        echo "    fprintf_unfiltered (gdb_stdlog, \"gdbarch_${function} called\n\");"
         test "${actual}" = "-" && actual=""
                if [ "${returntype}" = "void" ]
@@ -1110,7 +1137,6 @@ do
          echo "    internal_error (\"gdbarch: gdbarch_${function} invalid\");"
        fi
        echo "  if (gdbarch_debug >= 2)"
-       echo "    /* FIXME: gdb_std??? */"
        echo "    fprintf_unfiltered (gdb_stdlog, \"gdbarch_${function} called\n\");"
        echo "  return gdbarch->${function};"
        echo "}"
@@ -1128,7 +1154,6 @@ do
        echo "gdbarch_${function} (struct gdbarch *gdbarch)"
        echo "{"
        echo "  if (gdbarch_debug >= 2)"
-       echo "    /* FIXME: gdb_std??? */"
        echo "    fprintf_unfiltered (gdb_stdlog, \"gdbarch_${function} called\n\");"
        echo "  return gdbarch->${function};"
        echo "}"
@@ -1944,6 +1969,8 @@ extern void _initialize_gdbarch (void);
 void
 _initialize_gdbarch ()
 {
+  struct cmd_list_element *c;
+
   add_prefix_cmd ("endian", class_support, set_endian,
                  "Set endianness of target.",
                  &endianlist, "set endian ", 0, &setlist);
@@ -1970,25 +1997,26 @@ _initialize_gdbarch ()
   tm_print_insn_info.memory_error_func = dis_asm_memory_error;
   tm_print_insn_info.print_address_func = dis_asm_print_address;
 
-  add_show_from_set (add_set_cmd ("archdebug",
+  add_show_from_set (add_set_cmd ("arch",
                                  class_maintenance,
                                  var_zinteger,
                                  (char *)&gdbarch_debug,
                                  "Set architecture debugging.\n\\
-When non-zero, architecture debugging is enabled.", &setlist),
-                    &showlist);
+When non-zero, architecture debugging is enabled.", &setdebuglist),
+                    &showdebuglist);
+  c = add_set_cmd ("archdebug",
+                  class_maintenance,
+                  var_zinteger,
+                  (char *)&gdbarch_debug,
+                  "Set architecture debugging.\n\\
+When non-zero, architecture debugging is enabled.", &setlist);
+
+  deprecate_cmd (c, "set debug arch");
+  deprecate_cmd (add_show_from_set (c, &showlist), "show debug arch");
 }
 EOF
 
 # close things off
 exec 1>&2
 #../move-if-change new-gdbarch.c gdbarch.c
-if ! test -r gdbarch.c
-then
-  echo "gdbarch.c missing? cp new-gdbarch.c gdbarch.c" 1>&2
-elif diff -c gdbarch.c new-gdbarch.c
-then
-  echo "gdbarch.c unchanged" 1>&2
-else
-  echo "gdbarch.c has changed? cp new-gdbarch.c gdbarch.c" 1>&2
-fi
+compare_new gdbarch.c
This page took 0.030922 seconds and 4 git commands to generate.