#!/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
copyright ()
{
cat <<EOF
+/* *INDENT-OFF* */ /* THIS FILE IS GENERATED */
+
/* Dynamic architecture support for GDB, the GNU debugger.
Copyright 1998-1999, Free Software Foundation, Inc.
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
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.
#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);
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
#
}
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 ""
gdbarch_tdep (struct gdbarch *gdbarch)
{
if (gdbarch_debug >= 2)
- /* FIXME: gdb_std??? */
fprintf_unfiltered (gdb_stdlog, "gdbarch_tdep called\n");
return gdbarch->tdep;
}
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" ]
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 "}"
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 "}"
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);
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