gdb: add .flake8 file
[deliverable/binutils-gdb.git] / gdb / gdbarch.sh
index 5fe37e0abc0942edc1035960d06d8914edfd5dc2..d9332c2103e29fc6fec60de398b5f802b3457982 100755 (executable)
@@ -2,7 +2,7 @@
 
 # Architecture commands for GDB, the GNU debugger.
 #
-# Copyright (C) 1998-2020 Free Software Foundation, Inc.
+# Copyright (C) 1998-2021 Free Software Foundation, Inc.
 #
 # This file is part of GDB.
 #
@@ -189,7 +189,7 @@ do
        #   hiding something from the ``struct info'' object
        # m -> multi-arch function
        #   hiding a multi-arch function (parameterised with the architecture)
-        # M -> multi-arch function + predicate
+       # M -> multi-arch function + predicate
        #   hiding a multi-arch function + predicate to test function validity
 
     returntype ) : ;;
@@ -605,6 +605,31 @@ m;CORE_ADDR;addr_bits_remove;CORE_ADDR addr;addr;;core_addr_identity;;0
 # additional data associated with the address.
 v;int;significant_addr_bit;;;;;;0
 
+# Return a string representation of the memory tag TAG.
+m;std::string;memtag_to_string;struct value *tag;tag;;default_memtag_to_string;;0
+
+# Return true if ADDRESS contains a tag and false otherwise.
+m;bool;tagged_address_p;struct value *address;address;;default_tagged_address_p;;0
+
+# Return true if the tag from ADDRESS matches the memory tag for that
+# particular address.  Return false otherwise.
+m;bool;memtag_matches_p;struct value *address;address;;default_memtag_matches_p;;0
+
+# Set the tags of type TAG_TYPE, for the memory address range
+# [ADDRESS, ADDRESS + LENGTH) to TAGS.
+# Return true if successful and false otherwise.
+m;bool;set_memtags;struct value *address, size_t length, const gdb::byte_vector \&tags, memtag_type tag_type;address, length, tags, tag_type;;default_set_memtags;;0
+
+# Return the tag of type TAG_TYPE associated with the memory address ADDRESS,
+# assuming ADDRESS is tagged.
+m;struct value *;get_memtag;struct value *address, memtag_type tag_type;address, tag_type;;default_get_memtag;;0
+
+# memtag_granule_size is the size of the allocation tag granule, for
+# architectures that support memory tagging.
+# This is 0 for architectures that do not support memory tagging.
+# For a non-zero value, this represents the number of bytes of memory per tag.
+v;CORE_ADDR;memtag_granule_size;;;;;;0
+
 # FIXME/cagney/2001-01-18: This should be split in two.  A target method that
 # indicates if the target needs software single step.  An ISA method to
 # implement it.
@@ -715,7 +740,7 @@ F;CORE_ADDR;fetch_pointer_argument;struct frame_info *frame, int argi, struct ty
 M;void;iterate_over_regset_sections;iterate_over_regset_sections_cb *cb, void *cb_data, const struct regcache *regcache;cb, cb_data, regcache
 
 # Create core file notes
-M;char *;make_corefile_notes;bfd *obfd, int *note_size;obfd, note_size
+M;gdb::unique_xmalloc_ptr<char>;make_corefile_notes;bfd *obfd, int *note_size;obfd, note_size
 
 # Find core file memory regions
 M;int;find_memory_regions;find_memory_region_ftype func, void *data;func, data
@@ -783,18 +808,17 @@ V;ULONGEST;max_insn_length;;;0;0
 # If the instruction cannot execute out of line, return NULL.  The
 # core falls back to stepping past the instruction in-line instead in
 # that case.
-M;displaced_step_closure_up;displaced_step_copy_insn;CORE_ADDR from, CORE_ADDR to, struct regcache *regs;from, to, regs
+M;displaced_step_copy_insn_closure_up;displaced_step_copy_insn;CORE_ADDR from, CORE_ADDR to, struct regcache *regs;from, to, regs
 
-# Return true if GDB should use hardware single-stepping to execute
-# the displaced instruction identified by CLOSURE.  If false,
-# GDB will simply restart execution at the displaced instruction
-# location, and it is up to the target to ensure GDB will receive
-# control again (e.g. by placing a software breakpoint instruction
-# into the displaced instruction buffer).
+# Return true if GDB should use hardware single-stepping to execute a displaced
+# step instruction.  If false, GDB will simply restart execution at the
+# displaced instruction location, and it is up to the target to ensure GDB will
+# receive control again (e.g. by placing a software breakpoint instruction into
+# the displaced instruction buffer).
 #
-# The default implementation returns false on all targets that
-# provide a gdbarch_software_single_step routine, and true otherwise.
-m;int;displaced_step_hw_singlestep;struct displaced_step_closure *closure;closure;;default_displaced_step_hw_singlestep;;0
+# The default implementation returns false on all targets that provide a
+# gdbarch_software_single_step routine, and true otherwise.
+m;bool;displaced_step_hw_singlestep;void;;;default_displaced_step_hw_singlestep;;0
 
 # Fix up the state resulting from successfully single-stepping a
 # displaced instruction, to give the result we would have gotten from
@@ -812,16 +836,22 @@ m;int;displaced_step_hw_singlestep;struct displaced_step_closure *closure;closur
 #
 # For a general explanation of displaced stepping and how GDB uses it,
 # see the comments in infrun.c.
-M;void;displaced_step_fixup;struct displaced_step_closure *closure, CORE_ADDR from, CORE_ADDR to, struct regcache *regs;closure, from, to, regs;;NULL
+M;void;displaced_step_fixup;struct displaced_step_copy_insn_closure *closure, CORE_ADDR from, CORE_ADDR to, struct regcache *regs;closure, from, to, regs;;NULL
 
-# Return the address of an appropriate place to put displaced
-# instructions while we step over them.  There need only be one such
-# place, since we're only stepping one thread over a breakpoint at a
-# time.
+# Prepare THREAD for it to displaced step the instruction at its current PC.
 #
-# For a general explanation of displaced stepping and how GDB uses it,
-# see the comments in infrun.c.
-m;CORE_ADDR;displaced_step_location;void;;;NULL;;(! gdbarch->displaced_step_location) != (! gdbarch->displaced_step_copy_insn)
+# Throw an exception if any unexpected error happens.
+M;displaced_step_prepare_status;displaced_step_prepare;thread_info *thread, CORE_ADDR &displaced_pc;thread, displaced_pc
+
+# Clean up after a displaced step of THREAD.
+m;displaced_step_finish_status;displaced_step_finish;thread_info *thread, gdb_signal sig;thread, sig;;NULL;;(! gdbarch->displaced_step_finish) != (! gdbarch->displaced_step_prepare)
+
+# Return the closure associated to the displaced step buffer that is at ADDR.
+F;const displaced_step_copy_insn_closure *;displaced_step_copy_insn_closure_by_addr;inferior *inf, CORE_ADDR addr;inf, addr
+
+# PARENT_INF has forked and CHILD_PTID is the ptid of the child.  Restore the
+# contents of all displaced step buffers in the child's address space.
+f;void;displaced_step_restore_all_in_ptid;inferior *parent_inf, ptid_t child_ptid;parent_inf, child_ptid
 
 # Relocate an instruction to execute at a different address.  OLDLOC
 # is the address in the inferior memory where the instruction to
@@ -989,7 +1019,7 @@ M;int;stap_is_single_operand;const char *s;s
 # if the token was not recognized as a special token (in this case, returning
 # zero means that the special parser is deferring the parsing to the generic
 # parser), and should advance the buffer pointer (p->arg).
-M;int;stap_parse_special_token;struct stap_parse_info *p;p
+M;expr::operation_up;stap_parse_special_token;struct stap_parse_info *p;p
 
 # Perform arch-dependent adjustments to a register name.
 #
@@ -1020,7 +1050,7 @@ M;std::string;stap_adjust_register;struct stap_parse_info *p, const std::string
 
 # The expression to compute the NARTGth+1 argument to a DTrace USDT probe.
 # NARG must be >= 0.
-M;void;dtrace_parse_probe_argument;struct expr_builder *builder, int narg;builder, narg
+M;expr::operation_up;dtrace_parse_probe_argument;int narg;narg
 
 # True if the given ADDR does not contain the instruction sequence
 # corresponding to a disabled DTrace is-enabled probe.
@@ -1179,7 +1209,7 @@ m;ULONGEST;type_align;struct type *type;type;;default_type_align;;0
 f;std::string;get_pc_address_flags;frame_info *frame, CORE_ADDR pc;frame, pc;;default_get_pc_address_flags;;0
 
 # Read core file mappings
-m;void;read_core_file_mappings;struct bfd *cbfd,gdb::function_view<void (ULONGEST count)> pre_loop_cb,gdb::function_view<void (int num, ULONGEST start, ULONGEST end, ULONGEST file_ofs, const char *filename, const void *other)> loop_cb;cbfd, pre_loop_cb, loop_cb;;default_read_core_file_mappings;;0
+m;void;read_core_file_mappings;struct bfd *cbfd, gdb::function_view<void (ULONGEST count)> pre_loop_cb, gdb::function_view<void (int num, ULONGEST start, ULONGEST end, ULONGEST file_ofs, const char *filename)> loop_cb;cbfd, pre_loop_cb, loop_cb;;default_read_core_file_mappings;;0
 
 EOF
 }
@@ -1233,7 +1263,7 @@ cat <<EOF
 
 /* Dynamic architecture support for GDB, the GNU debugger.
 
-   Copyright (C) 1998-2020 Free Software Foundation, Inc.
+   Copyright (C) 1998-2021 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -1271,6 +1301,7 @@ cat <<EOF
 #include "gdb_obstack.h"
 #include "infrun.h"
 #include "osabi.h"
+#include "displaced-stepping.h"
 
 struct floatformat;
 struct ui_file;
@@ -1297,6 +1328,7 @@ struct mem_range;
 struct syscalls_info;
 struct thread_info;
 struct ui_out;
+struct inferior;
 
 #include "regcache.h"
 
@@ -1355,6 +1387,18 @@ enum function_call_return_method
   return_method_struct,
 };
 
+enum class memtag_type
+{
+  /* Logical tag, the tag that is stored in unused bits of a pointer to a
+     virtual address.  */
+  logical = 0,
+
+  /* Allocation tag, the tag that is associated with every granule of memory in
+     the physical address space.  Allocation tags are used to validate memory
+     accesses via pointers containing logical tags.  */
+  allocation,
+};
+
 EOF
 
 # function typedef's
@@ -1489,24 +1533,22 @@ struct gdbarch_list
 
 struct gdbarch_info
 {
-  /* Use default: NULL (ZERO).  */
-  const struct bfd_arch_info *bfd_arch_info;
+  gdbarch_info ()
+    /* Ensure the union is zero-initialized.  Relies on the fact that there's
+       no member larger than TDESC_DATA.  */
+    : tdesc_data ()
+  {}
 
-  /* Use default: BFD_ENDIAN_UNKNOWN (NB: is not ZERO).  */
-  enum bfd_endian byte_order;
+  const struct bfd_arch_info *bfd_arch_info = nullptr;
 
-  enum bfd_endian byte_order_for_code;
+  enum bfd_endian byte_order = BFD_ENDIAN_UNKNOWN;
 
-  /* Use default: NULL (ZERO).  */
-  bfd *abfd;
+  enum bfd_endian byte_order_for_code = BFD_ENDIAN_UNKNOWN;
+
+  bfd *abfd = nullptr;
 
-  /* Use default: NULL (ZERO).  */
   union
     {
-      /* Architecture-specific information.  The generic form for targets
-        that have extra requirements.  */
-      struct gdbarch_tdep_info *tdep_info;
-
       /* Architecture-specific target description data.  Numerous targets
         need only this, so give them an easy way to hold it.  */
       struct tdesc_arch_data *tdesc_data;
@@ -1517,11 +1559,9 @@ struct gdbarch_info
       int *id;
     };
 
-  /* Use default: GDB_OSABI_UNINITIALIZED (-1).  */
-  enum gdb_osabi osabi;
+  enum gdb_osabi osabi = GDB_OSABI_UNKNOWN;
 
-  /* Use default: NULL (ZERO).  */
-  const struct target_desc *target_desc;
+  const struct target_desc *target_desc = nullptr;
 };
 
 typedef struct gdbarch *(gdbarch_init_ftype) (struct gdbarch_info info, struct gdbarch_list *arches);
@@ -1531,8 +1571,8 @@ typedef void (gdbarch_dump_tdep_ftype) (struct gdbarch *gdbarch, struct ui_file
 extern void register_gdbarch_init (enum bfd_architecture architecture, gdbarch_init_ftype *);
 
 extern void gdbarch_register (enum bfd_architecture architecture,
-                              gdbarch_init_ftype *,
-                              gdbarch_dump_tdep_ftype *);
+                             gdbarch_init_ftype *,
+                             gdbarch_dump_tdep_ftype *);
 
 
 /* Return a freshly allocated, NULL terminated, array of the valid
@@ -1597,8 +1637,8 @@ extern int gdbarch_update_p (struct gdbarch_info info);
 
 /* Helper function.  Find an architecture matching info.
 
-   INFO should be initialized using gdbarch_info_init, relevant fields
-   set, and then finished using gdbarch_info_fill.
+   INFO should have relevant fields set, and then finished using
+   gdbarch_info_fill.
 
    Returns the corresponding architecture, or NULL if no matching
    architecture was found.  */
@@ -1707,7 +1747,7 @@ static void alloc_gdbarch_data (struct gdbarch *);
 unsigned int gdbarch_debug = GDBARCH_DEBUG;
 static void
 show_gdbarch_debug (struct ui_file *file, int from_tty,
-                    struct cmd_list_element *c, const char *value)
+                   struct cmd_list_element *c, const char *value)
 {
   fprintf_filtered (file, _("Architecture debugging is %s.\\n"), value);
 }
@@ -1845,7 +1885,7 @@ printf "\n"
 cat <<EOF
 struct gdbarch *
 gdbarch_alloc (const struct gdbarch_info *info,
-               struct gdbarch_tdep *tdep)
+              struct gdbarch_tdep *tdep)
 {
   struct gdbarch *gdbarch;
 
@@ -1981,8 +2021,8 @@ done
 cat <<EOF
   if (!log.empty ())
     internal_error (__FILE__, __LINE__,
-                    _("verify_gdbarch: the following are invalid ...%s"),
-                    log.c_str ());
+                   _("verify_gdbarch: the following are invalid ...%s"),
+                   log.c_str ());
 }
 EOF
 
@@ -2001,8 +2041,8 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
   gdb_nm_file = GDB_NM_FILE;
 #endif
   fprintf_unfiltered (file,
-                      "gdbarch_dump: GDB_NM_FILE = %s\\n",
-                      gdb_nm_file);
+                     "gdbarch_dump: GDB_NM_FILE = %s\\n",
+                     gdb_nm_file);
 EOF
 function_list | sort '-t;' -k 3 | while do_read
 do
@@ -2027,13 +2067,13 @@ do
                print="core_addr_to_string_nz (gdbarch->${function})"
                ;;
            :* )
-               fmt="%s"
+               fmt="%s"
                print="plongest (gdbarch->${function})"
                ;;
            * )
-               fmt="%s"
+               fmt="%s"
                ;;
-        esac
+       esac
        printf "  fprintf_unfiltered (file,\n"
        printf "                      \"gdbarch_dump: %s = %s\\\\n\",\n" "$function" "$fmt"
        printf "                      %s);\n" "$print"
@@ -2066,7 +2106,7 @@ do
        printf "bool\n"
        printf "gdbarch_%s_p (struct gdbarch *gdbarch)\n" "$function"
        printf "{\n"
-        printf "  gdb_assert (gdbarch != NULL);\n"
+       printf "  gdb_assert (gdbarch != NULL);\n"
        printf "  return %s;\n" "$predicate"
        printf "}\n"
     fi
@@ -2081,7 +2121,7 @@ do
          printf "gdbarch_%s (struct gdbarch *gdbarch, %s)\n" "$function" "$formal"
        fi
        printf "{\n"
-        printf "  gdb_assert (gdbarch != NULL);\n"
+       printf "  gdb_assert (gdbarch != NULL);\n"
        printf "  gdb_assert (gdbarch->%s != NULL);\n" "$function"
        if class_is_predicate_p && test -n "${predefault}"
        then
@@ -2105,7 +2145,7 @@ do
            else
                params="${actual}"
            fi
-        fi
+       fi
                if [ "x${returntype}" = "xvoid" ]
        then
          printf "  gdbarch->%s (%s);\n" "$function" "$params"
@@ -2126,7 +2166,7 @@ do
        printf "%s\n" "$returntype"
        printf "gdbarch_%s (struct gdbarch *gdbarch)\n" "$function"
        printf "{\n"
-        printf "  gdb_assert (gdbarch != NULL);\n"
+       printf "  gdb_assert (gdbarch != NULL);\n"
        if [ "x${invalid_p}" = "x0" ]
        then
            printf "  /* Skip verify of %s, invalid_p == 0 */\n" "$function"
@@ -2156,7 +2196,7 @@ do
        printf "%s\n" "$returntype"
        printf "gdbarch_%s (struct gdbarch *gdbarch)\n" "$function"
        printf "{\n"
-        printf "  gdb_assert (gdbarch != NULL);\n"
+       printf "  gdb_assert (gdbarch != NULL);\n"
        printf "  if (gdbarch_debug >= 2)\n"
        printf "    fprintf_unfiltered (gdb_stdlog, \"gdbarch_%s called\\\\n\");\n" "$function"
        printf "  return gdbarch->%s;\n" "$function"
@@ -2191,7 +2231,7 @@ struct gdbarch_data_registry
   struct gdbarch_data_registration *registrations;
 };
 
-struct gdbarch_data_registry gdbarch_data_registry =
+static struct gdbarch_data_registry gdbarch_data_registry =
 {
   0, NULL,
 };
@@ -2313,13 +2353,13 @@ gdbarch_printable_names (void)
       const struct bfd_arch_info *ap;
       ap = bfd_lookup_arch (rego->bfd_architecture, 0);
       if (ap == NULL)
-        internal_error (__FILE__, __LINE__,
-                        _("gdbarch_architecture_names: multi-arch unknown"));
+       internal_error (__FILE__, __LINE__,
+                       _("gdbarch_architecture_names: multi-arch unknown"));
       do
-        {
-          append_name (&arches, &nr_arches, ap->printable_name);
-          ap = ap->next;
-        }
+       {
+         append_name (&arches, &nr_arches, ap->printable_name);
+         ap = ap->next;
+       }
       while (ap != NULL);
     }
   append_name (&arches, &nr_arches, NULL);
@@ -2329,7 +2369,7 @@ gdbarch_printable_names (void)
 
 void
 gdbarch_register (enum bfd_architecture bfd_architecture,
-                  gdbarch_init_ftype *init,
+                 gdbarch_init_ftype *init,
                  gdbarch_dump_tdep_ftype *dump_tdep)
 {
   struct gdbarch_registration **curr;
@@ -2340,9 +2380,9 @@ gdbarch_register (enum bfd_architecture bfd_architecture,
   if (bfd_arch_info == NULL)
     {
       internal_error (__FILE__, __LINE__,
-                      _("gdbarch: Attempt to register "
+                     _("gdbarch: Attempt to register "
                        "unknown architecture (%d)"),
-                      bfd_architecture);
+                     bfd_architecture);
     }
   /* Check that we haven't seen this architecture before.  */
   for (curr = &gdbarch_registry;
@@ -2351,9 +2391,9 @@ gdbarch_register (enum bfd_architecture bfd_architecture,
     {
       if (bfd_architecture == (*curr)->bfd_architecture)
        internal_error (__FILE__, __LINE__,
-                        _("gdbarch: Duplicate registration "
+                       _("gdbarch: Duplicate registration "
                          "of architecture (%s)"),
-                       bfd_arch_info->printable_name);
+                       bfd_arch_info->printable_name);
     }
   /* log it */
   if (gdbarch_debug)
@@ -2381,7 +2421,7 @@ register_gdbarch_init (enum bfd_architecture bfd_architecture,
 
 struct gdbarch_list *
 gdbarch_list_lookup_by_info (struct gdbarch_list *arches,
-                             const struct gdbarch_info *info)
+                            const struct gdbarch_info *info)
 {
   for (; arches != NULL; arches = arches->next)
     {
@@ -2435,9 +2475,6 @@ gdbarch_find_by_info (struct gdbarch_info info)
       fprintf_unfiltered (gdb_stdlog,
                          "gdbarch_find_by_info: info.abfd %s\n",
                          host_address_to_string (info.abfd));
-      fprintf_unfiltered (gdb_stdlog,
-                         "gdbarch_find_by_info: info.tdep_info %s\n",
-                         host_address_to_string (info.tdep_info));
     }
 
   /* Find the tdep code that knows about this architecture.  */
@@ -2551,9 +2588,9 @@ _initialize_gdbarch ()
 Set architecture debugging."), _("\\
 Show architecture debugging."), _("\\
 When non-zero, architecture debugging is enabled."),
-                            NULL,
-                            show_gdbarch_debug,
-                            &setdebuglist, &showdebuglist);
+                           NULL,
+                           show_gdbarch_debug,
+                           &setdebuglist, &showdebuglist);
 }
 EOF
 
This page took 0.029641 seconds and 4 git commands to generate.