gdb: move displaced stepping logic to gdbarch, allow starting concurrent displaced...
[deliverable/binutils-gdb.git] / gdb / gdbarch.sh
index f1b9276775e313910a7215d511a9577cc227534c..4c3b21bc0a9253a20f85fd7bfc69c138a2aa8530 100755 (executable)
 LANG=C ; export LANG
 LC_ALL=C ; export LC_ALL
 
-
-compare_new ()
-{
-    file=$1
-    if test ! -r "${file}"
-    then
-       echo "${file} missing? cp new-${file} ${file}" 1>&2
-    elif diff -u "${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 returntype function formal actual staticdefault predefault postdefault invalid_p print garbage_at_eol"
 
@@ -50,6 +34,7 @@ do_read ()
     # On some SH's, 'read' trims leading and trailing whitespace by
     # default (e.g., bash), while on others (e.g., dash), it doesn't.
     # Set IFS to empty to disable the trimming everywhere.
+    # shellcheck disable=SC2162
     while IFS='' read line
     do
        if test "${line}" = ""
@@ -75,7 +60,7 @@ ${line}
 EOF
            IFS="${OFS}"
 
-           if test -n "${garbage_at_eol}"
+           if test -n "${garbage_at_eol:-}"
            then
                echo "Garbage at end-of-line in ${line}" 1>&2
                kill $$
@@ -93,19 +78,19 @@ EOF
            done
 
            case "${class}" in
-               m ) staticdefault="${predefault}" ;;
+               m ) staticdefault="${predefault:-}" ;;
                M ) staticdefault="0" ;;
                * ) test "${staticdefault}" || staticdefault=0 ;;
            esac
 
            case "${class}" in
            F | V | M )
-               case "${invalid_p}" in
+               case "${invalid_p:-}" in
                "" )
                    if test -n "${predefault}"
                    then
                        #invalid_p="gdbarch->${function} == ${predefault}"
-                       predicate="gdbarch->${function} != ${predefault}"
+                       predicate="gdbarch->${function:-} != ${predefault}"
                    elif class_is_variable_p
                    then
                        predicate="gdbarch->${function} != 0"
@@ -122,23 +107,6 @@ EOF
                esac
            esac
 
-           # PREDEFAULT is a valid fallback definition of MEMBER when
-           # multi-arch is not enabled.  This ensures that the
-           # default value, when multi-arch is the same as the
-           # default value when not multi-arch.  POSTDEFAULT is
-           # always a valid definition of MEMBER as this again
-           # ensures consistency.
-
-           if [ -n "${postdefault}" ]
-           then
-               fallbackdefault="${postdefault}"
-           elif [ -n "${predefault}" ]
-           then
-               fallbackdefault="${predefault}"
-           else
-               fallbackdefault="0"
-           fi
-
            #NOT YET: See gdbarch.log for basic verification of
            # database
 
@@ -156,8 +124,8 @@ EOF
 
 fallback_default_p ()
 {
-    ( [ -n "${postdefault}" ] && [ "x${invalid_p}" != "x0" ] ) \
-       || ( [ -n "${predefault}" ] && [ "x${invalid_p}" = "x0" ] )
+    { [ -n "${postdefault:-}" ] && [ "x${invalid_p}" != "x0" ]; } \
+       || { [ -n "${predefault}" ] && [ "x${invalid_p}" = "x0" ]; }
 }
 
 class_is_variable_p ()
@@ -799,9 +767,7 @@ V;ULONGEST;max_insn_length;;;0;0
 # not the copy at TO.  The caller should update it to point at TO later.
 #
 # Return a pointer to data of the architecture's choice to be passed
-# to gdbarch_displaced_step_fixup.  Or, return NULL to indicate that
-# the instruction's effects have been completely simulated, with the
-# resulting state written back to REGS.
+# to gdbarch_displaced_step_fixup.
 #
 # For a general explanation of displaced stepping and how GDB uses it,
 # see the comments in infrun.c.
@@ -816,7 +782,7 @@ 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,
@@ -827,7 +793,7 @@ M;displaced_step_closure_up;displaced_step_copy_insn;CORE_ADDR from, CORE_ADDR t
 #
 # 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
+m;int;displaced_step_hw_singlestep;struct displaced_step_copy_insn_closure *closure;closure;;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
@@ -845,7 +811,7 @@ 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
@@ -854,7 +820,10 @@ M;void;displaced_step_fixup;struct displaced_step_closure *closure, CORE_ADDR fr
 #
 # 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)
+#m;CORE_ADDR;displaced_step_location;thread_info *;thread;;NULL;;(! gdbarch->displaced_step_location) != (! gdbarch->displaced_step_copy_insn)
+#m;CORE_ADDR;displaced_step_release_location;CORE_ADDR;addr;;NULL;;(! gdbarch->displaced_step_location) != (! gdbarch->displaced_step_copy_insn)
+m;displaced_step_prepare_status;displaced_step_prepare;thread_info *thread;thread;;NULL;;(! gdbarch->displaced_step_prepare) != (! gdbarch->displaced_step_copy_insn)
+m;displaced_step_finish_status;displaced_step_finish;thread_info *thread, gdb_signal sig;thread, sig;;NULL;;(! gdbarch->displaced_step_finish) != (! gdbarch->displaced_step_copy_insn)
 
 # Relocate an instruction to execute at a different address.  OLDLOC
 # is the address in the inferior memory where the instruction to
@@ -874,8 +843,6 @@ F;void;overlay_update;struct obj_section *osect;osect
 
 M;const struct target_desc *;core_read_description;struct target_ops *target, bfd *abfd;target, abfd
 
-# Handle special encoding of static variables in stabs debug info.
-F;const char *;static_transform_name;const char *name;name
 # Set if the address in N_SO or N_FUN stabs may be zero.
 v;int;sofun_address_maybe_missing;;;0;0;;0
 
@@ -1219,11 +1186,11 @@ EOF
 #
 # The .log file
 #
-exec > new-gdbarch.log
+exec > gdbarch.log
 function_list | while do_read
 do
     cat <<EOF
-${class} ${returntype} ${function} ($formal)
+${class} ${returntype:-} ${function} (${formal:-})
 EOF
     for r in ${read}
     do
@@ -1255,7 +1222,6 @@ EOF
 done
 
 exec 1>&2
-compare_new gdbarch.log
 
 
 copyright ()
@@ -1283,17 +1249,7 @@ cat <<EOF
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-/* This file was created with the aid of \`\`gdbarch.sh''.
-
-   The Bourne shell script \`\`gdbarch.sh'' creates the files
-   \`\`new-gdbarch.c'' and \`\`new-gdbarch.h and then compares them
-   against the existing \`\`gdbarch.[hc]''.  Any differences found
-   being reported.
-
-   If editing this file, please also run gdbarch.sh and merge any
-   changes into that script. Conversely, when making sweeping changes
-   to this file, modifying gdbarch.sh and using its output may prove
-   easier.  */
+/* This file was created with the aid of \`\`gdbarch.sh''.  */
 
 EOF
 }
@@ -1314,6 +1270,7 @@ cat <<EOF
 #include "gdb_obstack.h"
 #include "infrun.h"
 #include "osabi.h"
+#include "displaced-stepping.h"
 
 struct floatformat;
 struct ui_file;
@@ -1677,9 +1634,6 @@ typedef void *(gdbarch_data_pre_init_ftype) (struct obstack *obstack);
 extern struct gdbarch_data *gdbarch_data_register_pre_init (gdbarch_data_pre_init_ftype *init);
 typedef void *(gdbarch_data_post_init_ftype) (struct gdbarch *gdbarch);
 extern struct gdbarch_data *gdbarch_data_register_post_init (gdbarch_data_post_init_ftype *init);
-extern void deprecated_set_gdbarch_data (struct gdbarch *gdbarch,
-                                         struct gdbarch_data *data,
-                                        void *pointer);
 
 extern void *gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *);
 
@@ -1711,8 +1665,8 @@ gdbarch_num_cooked_regs (gdbarch *arch)
 #endif
 EOF
 exec 1>&2
-#../move-if-change new-gdbarch.h gdbarch.h
-compare_new gdbarch.h
+../move-if-change new-gdbarch.h gdbarch.h
+rm -f new-gdbarch.h
 
 
 #
@@ -2136,7 +2090,7 @@ do
        fi
        printf "  if (gdbarch_debug >= 2)\n"
        printf "    fprintf_unfiltered (gdb_stdlog, \"gdbarch_%s called\\\\n\");\n" "$function"
-       if [ "x${actual}" = "x-" ] || [ "x${actual}" = "x" ]
+       if [ "x${actual:-}" = "x-" ] || [ "x${actual:-}" = "x" ]
        then
            if class_is_multiarch_p
            then
@@ -2284,20 +2238,6 @@ alloc_gdbarch_data (struct gdbarch *gdbarch)
   gdbarch->data = GDBARCH_OBSTACK_CALLOC (gdbarch, gdbarch->nr_data, void *);
 }
 
-/* Initialize the current value of the specified per-architecture
-   data-pointer.  */
-
-void
-deprecated_set_gdbarch_data (struct gdbarch *gdbarch,
-                            struct gdbarch_data *data,
-                            void *pointer)
-{
-  gdb_assert (data->index < gdbarch->nr_data);
-  gdb_assert (gdbarch->data[data->index] == NULL);
-  gdb_assert (data->pre_init == NULL);
-  gdbarch->data[data->index] = pointer;
-}
-
 /* Return the current value of the specified per-architecture
    data-pointer.  */
 
@@ -2327,11 +2267,9 @@ gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *data)
          data->init_p = 1;
        }
       else
-       /* The architecture initialization hasn't completed - punt -
-        hope that the caller knows what they are doing.  Once
-        deprecated_set_gdbarch_data has been initialized, this can be
-        changed to an internal error.  */
-       return NULL;
+       internal_error (__FILE__, __LINE__,
+                       _("gdbarch post-init data field can only be used "
+                         "after gdbarch is fully initialised"));
       gdb_assert (gdbarch->data[data->index] != NULL);
     }
   return gdbarch->data[data->index];
@@ -2621,5 +2559,5 @@ EOF
 
 # close things off
 exec 1>&2
-#../move-if-change new-gdbarch.c gdbarch.c
-compare_new gdbarch.c
+../move-if-change new-gdbarch.c gdbarch.c
+rm -f new-gdbarch.c
This page took 0.028279 seconds and 4 git commands to generate.