X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fgdbarch.sh;h=7d61a510af4afbef0d157bd984803737a1e661bf;hb=5514706f739978e0897d01ec9fa25fa61861c263;hp=d4170c9822357f78e6e2b4b7d39b1c2db6039667;hpb=e8217e61f5952ccfdabb0c4ee0c237a363e9bd99;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index d4170c9822..7d61a510af 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -24,22 +24,6 @@ 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}" = "" @@ -67,15 +52,15 @@ ${line}" # The semantics of IFS varies between different SH's. Some # treat ``;;' as three fields while some treat it as just two. # Work around this by eliminating ``;;'' .... - line="`echo "${line}" | sed -e 's/;;/; ;/g' -e 's/;;/; ;/g'`" + line="$(echo "${line}" | sed -e 's/;;/; ;/g' -e 's/;;/; ;/g')" OFS="${IFS}" ; IFS="[;]" - eval read ${read} <&2 kill $$ @@ -86,26 +71,26 @@ EOF # that ended up with just that space character. for r in ${read} do - if eval test \"\${${r}}\" = \"\ \" + if eval test "\"\${${r}}\" = ' '" then - eval ${r}="" + eval "${r}=" fi 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}" -a "x${invalid_p}" != "x0" ] \ - || [ -n "${predefault}" -a "x${invalid_p}" = "x0" ] + { [ -n "${postdefault:-}" ] && [ "x${invalid_p}" != "x0" ]; } \ + || { [ -n "${predefault}" ] && [ "x${invalid_p}" = "x0" ]; } } class_is_variable_p () @@ -816,7 +784,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;std::unique_ptr;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 +795,7 @@ M;std::unique_ptr;displaced_step_copy_insn;CORE_ADDR fro # # 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 +813,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 +822,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 +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) # Relocate an instruction to execute at a different address. OLDLOC # is the address in the inferior memory where the instruction to @@ -1219,15 +1190,15 @@ EOF # # The .log file # -exec > new-gdbarch.log +exec > gdbarch.log function_list | while do_read do cat <&2 kill $$ @@ -1255,7 +1226,6 @@ EOF done exec 1>&2 -compare_new gdbarch.log copyright () @@ -1283,17 +1253,7 @@ cat <. */ -/* 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 } @@ -1312,6 +1272,9 @@ cat <&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 # @@ -1831,7 +1793,7 @@ function_list | while do_read do if class_is_info_p then - printf " ${returntype} ${function};\n" + printf " %s %s;\n" "$returntype" "$function" fi done printf "\n" @@ -1872,10 +1834,10 @@ function_list | while do_read do if class_is_variable_p then - printf " ${returntype} ${function};\n" + printf " %s %s;\n" "$returntype" "$function" elif class_is_function_p then - printf " gdbarch_${function}_ftype *${function};\n" + printf " gdbarch_%s_ftype *%s;\n" "$function" "$function" fi done printf "};\n" @@ -1911,7 +1873,7 @@ function_list | while do_read do if class_is_info_p then - printf " gdbarch->${function} = info->${function};\n" + printf " gdbarch->%s = info->%s;\n" "$function" "$function" fi done printf "\n" @@ -1920,9 +1882,9 @@ function_list | while do_read do if class_is_function_p || class_is_variable_p then - if [ -n "${predefault}" -a "x${predefault}" != "x0" ] + if [ -n "${predefault}" ] && [ "x${predefault}" != "x0" ] then - printf " gdbarch->${function} = ${predefault};\n" + printf " gdbarch->%s = %s;\n" "$function" "$predefault" fi fi done @@ -1995,31 +1957,31 @@ do then if [ "x${invalid_p}" = "x0" ] then - printf " /* Skip verify of ${function}, invalid_p == 0 */\n" + printf " /* Skip verify of %s, invalid_p == 0 */\n" "$function" elif class_is_predicate_p then - printf " /* Skip verify of ${function}, has predicate. */\n" + printf " /* Skip verify of %s, has predicate. */\n" "$function" # FIXME: See do_read for potential simplification - elif [ -n "${invalid_p}" -a -n "${postdefault}" ] + elif [ -n "${invalid_p}" ] && [ -n "${postdefault}" ] then - printf " if (${invalid_p})\n" - printf " gdbarch->${function} = ${postdefault};\n" - elif [ -n "${predefault}" -a -n "${postdefault}" ] + printf " if (%s)\n" "$invalid_p" + printf " gdbarch->%s = %s;\n" "$function" "$postdefault" + elif [ -n "${predefault}" ] && [ -n "${postdefault}" ] then - printf " if (gdbarch->${function} == ${predefault})\n" - printf " gdbarch->${function} = ${postdefault};\n" + printf " if (gdbarch->%s == %s)\n" "$function" "$predefault" + printf " gdbarch->%s = %s;\n" "$function" "$postdefault" elif [ -n "${postdefault}" ] then - printf " if (gdbarch->${function} == 0)\n" - printf " gdbarch->${function} = ${postdefault};\n" + printf " if (gdbarch->%s == 0)\n" "$function" + printf " gdbarch->%s = %s;\n" "$function" "$postdefault" elif [ -n "${invalid_p}" ] then - printf " if (${invalid_p})\n" - printf " log.puts (\"\\\\n\\\\t${function}\");\n" + printf " if (%s)\n" "$invalid_p" + printf " log.puts (\"\\\\n\\\\t%s\");\n" "$function" elif [ -n "${predefault}" ] then - printf " if (gdbarch->${function} == ${predefault})\n" - printf " log.puts (\"\\\\n\\\\t${function}\");\n" + printf " if (gdbarch->%s == %s)\n" "$function" "$predefault" + printf " log.puts (\"\\\\n\\\\t%s\");\n" "$function" fi fi done @@ -2055,15 +2017,15 @@ do if class_is_predicate_p then printf " fprintf_unfiltered (file,\n" - printf " \"gdbarch_dump: gdbarch_${function}_p() = %%d\\\\n\",\n" - printf " gdbarch_${function}_p (gdbarch));\n" + printf " \"gdbarch_dump: gdbarch_%s_p() = %%d\\\\n\",\n" "$function" + printf " gdbarch_%s_p (gdbarch));\n" "$function" fi # Print the corresponding value. if class_is_function_p then printf " fprintf_unfiltered (file,\n" - printf " \"gdbarch_dump: ${function} = <%%s>\\\\n\",\n" - printf " host_address_to_string (gdbarch->${function}));\n" + printf " \"gdbarch_dump: %s = <%%s>\\\\n\",\n" "$function" + printf " host_address_to_string (gdbarch->%s));\n" "$function" else # It is a variable case "${print}:${returntype}" in @@ -2080,8 +2042,8 @@ do ;; esac printf " fprintf_unfiltered (file,\n" - printf " \"gdbarch_dump: ${function} = %s\\\\n\",\n" "${fmt}" - printf " ${print});\n" + printf " \"gdbarch_dump: %s = %s\\\\n\",\n" "$function" "$fmt" + printf " %s);\n" "$print" fi done cat <${function} != NULL);\n" + printf " gdb_assert (gdbarch->%s != NULL);\n" "$function" if class_is_predicate_p && test -n "${predefault}" then # Allow a call to a function with a predicate. - printf " /* Do not check predicate: ${predicate}, allow call. */\n" + printf " /* Do not check predicate: %s, allow call. */\n" "$predicate" fi printf " if (gdbarch_debug >= 2)\n" - printf " fprintf_unfiltered (gdb_stdlog, \"gdbarch_${function} called\\\\n\");\n" - if [ "x${actual}" = "x-" -o "x${actual}" = "x" ] + printf " fprintf_unfiltered (gdb_stdlog, \"gdbarch_%s called\\\\n\");\n" "$function" + if [ "x${actual:-}" = "x-" ] || [ "x${actual:-}" = "x" ] then if class_is_multiarch_p then @@ -2153,58 +2115,58 @@ do fi if [ "x${returntype}" = "xvoid" ] then - printf " gdbarch->${function} (${params});\n" + printf " gdbarch->%s (%s);\n" "$function" "$params" else - printf " return gdbarch->${function} (${params});\n" + printf " return gdbarch->%s (%s);\n" "$function" "$params" fi printf "}\n" printf "\n" printf "void\n" - printf "set_gdbarch_${function} (struct gdbarch *gdbarch,\n" - printf " `echo ${function} | sed -e 's/./ /g'` gdbarch_${function}_ftype ${function})\n" + printf "set_gdbarch_%s (struct gdbarch *gdbarch,\n" "$function" + printf " %s gdbarch_%s_ftype %s)\n" "$(echo "$function" | sed -e 's/./ /g')" "$function" "$function" printf "{\n" - printf " gdbarch->${function} = ${function};\n" + printf " gdbarch->%s = %s;\n" "$function" "$function" printf "}\n" elif class_is_variable_p then printf "\n" - printf "${returntype}\n" - printf "gdbarch_${function} (struct gdbarch *gdbarch)\n" + printf "%s\n" "$returntype" + printf "gdbarch_%s (struct gdbarch *gdbarch)\n" "$function" printf "{\n" printf " gdb_assert (gdbarch != NULL);\n" if [ "x${invalid_p}" = "x0" ] then - printf " /* Skip verify of ${function}, invalid_p == 0 */\n" + printf " /* Skip verify of %s, invalid_p == 0 */\n" "$function" elif [ -n "${invalid_p}" ] then printf " /* Check variable is valid. */\n" - printf " gdb_assert (!(${invalid_p}));\n" + printf " gdb_assert (!(%s));\n" "$invalid_p" elif [ -n "${predefault}" ] then printf " /* Check variable changed from pre-default. */\n" - printf " gdb_assert (gdbarch->${function} != ${predefault});\n" + printf " gdb_assert (gdbarch->%s != %s);\n" "$function" "$predefault" fi printf " if (gdbarch_debug >= 2)\n" - printf " fprintf_unfiltered (gdb_stdlog, \"gdbarch_${function} called\\\\n\");\n" - printf " return gdbarch->${function};\n" + printf " fprintf_unfiltered (gdb_stdlog, \"gdbarch_%s called\\\\n\");\n" "$function" + printf " return gdbarch->%s;\n" "$function" printf "}\n" printf "\n" printf "void\n" - printf "set_gdbarch_${function} (struct gdbarch *gdbarch,\n" - printf " `echo ${function} | sed -e 's/./ /g'` ${returntype} ${function})\n" + printf "set_gdbarch_%s (struct gdbarch *gdbarch,\n" "$function" + printf " %s %s %s)\n" "$(echo "$function" | sed -e 's/./ /g')" "$returntype" "$function" printf "{\n" - printf " gdbarch->${function} = ${function};\n" + printf " gdbarch->%s = %s;\n" "$function" "$function" printf "}\n" elif class_is_info_p then printf "\n" - printf "${returntype}\n" - printf "gdbarch_${function} (struct gdbarch *gdbarch)\n" + printf "%s\n" "$returntype" + printf "gdbarch_%s (struct gdbarch *gdbarch)\n" "$function" printf "{\n" printf " gdb_assert (gdbarch != NULL);\n" printf " if (gdbarch_debug >= 2)\n" - printf " fprintf_unfiltered (gdb_stdlog, \"gdbarch_${function} called\\\\n\");\n" - printf " return gdbarch->${function};\n" + printf " fprintf_unfiltered (gdb_stdlog, \"gdbarch_%s called\\\\n\");\n" "$function" + printf " return gdbarch->%s;\n" "$function" printf "}\n" fi done @@ -2620,5 +2582,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