This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[patch] fix gdbarch.sh VS sh; Was: gdbarch.sh -- sh vs bash
- To: David Taylor <taylor at cygnus dot com>
- Subject: [patch] fix gdbarch.sh VS sh; Was: gdbarch.sh -- sh vs bash
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Mon, 04 Sep 2000 22:33:47 +1100
- CC: gdb-patches at sourceware dot cygnus dot com
- References: <200008212131.RAA29172@texas.cygnus.com>
David Taylor wrote:
>
> gdbarch.sh used to have the line:
>
> #!/usr/local/bin/bash -u
>
> but it was recently changed to:
>
> #!/bin/sh -u
>
> Unfortunately, sh doesn't currently work for this script.
FYI,
I've checked in the attatched. The script now appears to work with both
ASH and Solaris's SH (well 2.5.1).
Andrew
Mon Sep 4 16:21:31 2000 Andrew Cagney <cagney@amy.cygnus.com>
* gdbarch.sh: Use printf instead of echo.
(do_read): During read, pad ``::'' with spaces and then strip out
those spaces. Avoid problems with IFS=:.
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.42
diff -p -r1.42 gdbarch.sh
*** gdbarch.sh 2000/09/02 00:02:54 1.42
--- gdbarch.sh 2000/09/04 09:29:45
*************** do_read ()
*** 54,65 ****
comment="${comment}
${line}"
else
! OFS="${IFS}" ; IFS=":"
eval read ${read} <<EOF
${line}
EOF
IFS="${OFS}"
test "${staticdefault}" || staticdefault=0
# NOT YET: Breaks BELIEVE_PCC_PROMOTION and confuses non-
# multi-arch defaults.
--- 54,81 ----
comment="${comment}
${line}"
else
!
! # The semantics of IFS varies between different SH's. Some
! # treat ``::' as three fields while some treat it as just too.
! # Work around this by eliminating ``::'' ....
! line="`echo "${line}" | sed -e 's/::/: :/g' -e 's/::/: :/g'`"
!
! OFS="${IFS}" ; IFS="[:]"
eval read ${read} <<EOF
${line}
EOF
IFS="${OFS}"
+ # .... and then going back through each field and strip out those
+ # that ended up with just that space character.
+ for r in ${read}
+ do
+ if eval test \"\${${r}}\" = \"\ \"
+ then
+ eval ${r}=""
+ fi
+ done
+
test "${staticdefault}" || staticdefault=0
# NOT YET: Breaks BELIEVE_PCC_PROMOTION and confuses non-
# multi-arch defaults.
*************** f::TARGET_WRITE_SP:void:write_sp:CORE_AD
*** 346,353 ****
v:2:NUM_REGS:int:num_regs::::0:-1
# This macro gives the number of pseudo-registers that live in the
# register namespace but do not get fetched or stored on the target.
! # These pseudo-registers may be aliases for other registers,
! # combinations of other registers, or they may be computed by GDB.
v:2:NUM_PSEUDO_REGS:int:num_pseudo_regs::::0:0::0:::
v:2:SP_REGNUM:int:sp_regnum::::0:-1
v:2:FP_REGNUM:int:fp_regnum::::0:-1
--- 362,369 ----
v:2:NUM_REGS:int:num_regs::::0:-1
# This macro gives the number of pseudo-registers that live in the
# register namespace but do not get fetched or stored on the target.
! # These pseudo-registers may be aliases for other registers,
! # combinations of other registers, or they may be computed by GDB.
v:2:NUM_PSEUDO_REGS:int:num_pseudo_regs::::0:0::0:::
v:2:SP_REGNUM:int:sp_regnum::::0:-1
v:2:FP_REGNUM:int:fp_regnum::::0:-1
*************** do
*** 468,485 ****
cat <<EOF
${class} ${macro}(${actual})
${returntype} ${function} ($formal)${attrib}
- level=${level}
- staticdefault=${staticdefault}
- predefault=${predefault}
- postdefault=${postdefault}
- #fallbackdefault=${fallbackdefault}
- invalid_p=${invalid_p}
- #valid_p=${valid_p}
- fmt=${fmt}
- print=${print}
- print_p=${print_p}
- description=${description}
EOF
if class_is_predicate_p && fallback_default_p
then
echo "Error: predicate function ${macro} can not have a non- multi-arch default" 1>&2
--- 484,497 ----
cat <<EOF
${class} ${macro}(${actual})
${returntype} ${function} ($formal)${attrib}
EOF
+ for r in ${read}
+ do
+ eval echo \"\ \ \ \ ${r}=\${${r}}\"
+ done
+ # #fallbackdefault=${fallbackdefault}
+ # #valid_p=${valid_p}
+ #EOF
if class_is_predicate_p && fallback_default_p
then
echo "Error: predicate function ${macro} can not have a non- multi-arch default" 1>&2
*************** EOF
*** 492,497 ****
--- 504,510 ----
kill $$
exit 1
fi
+ echo ""
done
exec 1>&2
*************** extern struct gdbarch *current_gdbarch;
*** 572,599 ****
EOF
# function typedef's
! echo ""
! echo ""
! echo "/* The following are pre-initialized by GDBARCH. */"
function_list | while do_read
do
if class_is_info_p
then
! echo ""
! echo "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch);"
! echo "/* set_gdbarch_${function}() - not applicable - pre-initialized. */"
! echo "#if GDB_MULTI_ARCH"
! echo "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (${macro})"
! echo "#define ${macro} (gdbarch_${function} (current_gdbarch))"
! echo "#endif"
! echo "#endif"
fi
done
# function typedef's
! echo ""
! echo ""
! echo "/* The following are initialized by the target dependent code. */"
function_list | while do_read
do
if [ "${comment}" ]
--- 585,612 ----
EOF
# function typedef's
! printf "\n"
! printf "\n"
! printf "/* The following are pre-initialized by GDBARCH. */\n"
function_list | while do_read
do
if class_is_info_p
then
! printf "\n"
! printf "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch);\n"
! printf "/* set_gdbarch_${function}() - not applicable - pre-initialized. */\n"
! printf "#if GDB_MULTI_ARCH\n"
! printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (${macro})\n"
! printf "#define ${macro} (gdbarch_${function} (current_gdbarch))\n"
! printf "#endif\n"
! printf "#endif\n"
fi
done
# function typedef's
! printf "\n"
! printf "\n"
! printf "/* The following are initialized by the target dependent code. */\n"
function_list | while do_read
do
if [ "${comment}" ]
*************** do
*** 605,686 ****
fi
if class_is_predicate_p
then
! echo ""
! echo "#if defined (${macro})"
! echo "/* Legacy for systems yet to multi-arch ${macro} */"
! # echo "#if (GDB_MULTI_ARCH <= GDB_MULTI_ARCH_PARTIAL) && defined (${macro})"
! echo "#define ${macro}_P() (1)"
! echo "#endif"
! echo ""
! echo "/* Default predicate for non- multi-arch targets. */"
! echo "#if (!GDB_MULTI_ARCH) && !defined (${macro}_P)"
! echo "#define ${macro}_P() (0)"
! echo "#endif"
! echo ""
! echo "extern int gdbarch_${function}_p (struct gdbarch *gdbarch);"
! echo "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (${macro}_P)"
! echo "#define ${macro}_P() (gdbarch_${function}_p (current_gdbarch))"
! echo "#endif"
fi
if class_is_variable_p
then
if fallback_default_p || class_is_predicate_p
then
! echo ""
! echo "/* Default (value) for non- multi-arch platforms. */"
! echo "#if (!GDB_MULTI_ARCH) && !defined (${macro})"
echo "#define ${macro} (${fallbackdefault})" \
| sed -e 's/\([^a-z_]\)\(gdbarch[^a-z_]\)/\1current_\2/g'
! echo "#endif"
fi
! echo ""
! echo "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch);"
! echo "extern void set_gdbarch_${function} (struct gdbarch *gdbarch, ${returntype} ${function});"
! echo "#if GDB_MULTI_ARCH"
! echo "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (${macro})"
! echo "#define ${macro} (gdbarch_${function} (current_gdbarch))"
! echo "#endif"
! echo "#endif"
fi
if class_is_function_p
then
if fallback_default_p || class_is_predicate_p
then
! echo ""
! echo "/* Default (function) for non- multi-arch platforms. */"
! echo "#if (!GDB_MULTI_ARCH) && !defined (${macro})"
if [ "${fallbackdefault}" = "0" ]
then
! echo "#define ${macro}(${actual}) (internal_error (\"${macro}\"), 0)"
else
# FIXME: Should be passing current_gdbarch through!
echo "#define ${macro}(${actual}) (${fallbackdefault} (${actual}))" \
| sed -e 's/\([^a-z_]\)\(gdbarch[^a-z_]\)/\1current_\2/g'
fi
! echo "#endif"
fi
! echo ""
! echo "typedef ${returntype} (gdbarch_${function}_ftype) (${formal});"
if [ "${formal}" = "void" ]
then
! echo "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch);"
else
! echo "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch, ${formal});"
fi
! echo "extern void set_gdbarch_${function} (struct gdbarch *gdbarch, gdbarch_${function}_ftype *${function});"
! echo "#if GDB_MULTI_ARCH"
! echo "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (${macro})"
if [ "${actual}" = "" ]
then
! echo "#define ${macro}() (gdbarch_${function} (current_gdbarch))"
elif [ "${actual}" = "-" ]
then
! echo "#define ${macro} (gdbarch_${function} (current_gdbarch))"
else
! echo "#define ${macro}(${actual}) (gdbarch_${function} (current_gdbarch, ${actual}))"
fi
! echo "#endif"
! echo "#endif"
fi
done
--- 618,699 ----
fi
if class_is_predicate_p
then
! printf "\n"
! printf "#if defined (${macro})\n"
! printf "/* Legacy for systems yet to multi-arch ${macro} */\n"
! # printf "#if (GDB_MULTI_ARCH <= GDB_MULTI_ARCH_PARTIAL) && defined (${macro})\n"
! printf "#define ${macro}_P() (1)\n"
! printf "#endif\n"
! printf "\n"
! printf "/* Default predicate for non- multi-arch targets. */\n"
! printf "#if (!GDB_MULTI_ARCH) && !defined (${macro}_P)\n"
! printf "#define ${macro}_P() (0)\n"
! printf "#endif\n"
! printf "\n"
! printf "extern int gdbarch_${function}_p (struct gdbarch *gdbarch);\n"
! printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (${macro}_P)\n"
! printf "#define ${macro}_P() (gdbarch_${function}_p (current_gdbarch))\n"
! printf "#endif\n"
fi
if class_is_variable_p
then
if fallback_default_p || class_is_predicate_p
then
! printf "\n"
! printf "/* Default (value) for non- multi-arch platforms. */\n"
! printf "#if (!GDB_MULTI_ARCH) && !defined (${macro})\n"
echo "#define ${macro} (${fallbackdefault})" \
| sed -e 's/\([^a-z_]\)\(gdbarch[^a-z_]\)/\1current_\2/g'
! printf "#endif\n"
fi
! printf "\n"
! printf "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch);\n"
! printf "extern void set_gdbarch_${function} (struct gdbarch *gdbarch, ${returntype} ${function});\n"
! printf "#if GDB_MULTI_ARCH\n"
! printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (${macro})\n"
! printf "#define ${macro} (gdbarch_${function} (current_gdbarch))\n"
! printf "#endif\n"
! printf "#endif\n"
fi
if class_is_function_p
then
if fallback_default_p || class_is_predicate_p
then
! printf "\n"
! printf "/* Default (function) for non- multi-arch platforms. */\n"
! printf "#if (!GDB_MULTI_ARCH) && !defined (${macro})\n"
if [ "${fallbackdefault}" = "0" ]
then
! printf "#define ${macro}(${actual}) (internal_error (\"${macro}\"), 0)\n"
else
# FIXME: Should be passing current_gdbarch through!
echo "#define ${macro}(${actual}) (${fallbackdefault} (${actual}))" \
| sed -e 's/\([^a-z_]\)\(gdbarch[^a-z_]\)/\1current_\2/g'
fi
! printf "#endif\n"
fi
! printf "\n"
! printf "typedef ${returntype} (gdbarch_${function}_ftype) (${formal});\n"
if [ "${formal}" = "void" ]
then
! printf "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch);\n"
else
! printf "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch, ${formal});\n"
fi
! printf "extern void set_gdbarch_${function} (struct gdbarch *gdbarch, gdbarch_${function}_ftype *${function});\n"
! printf "#if GDB_MULTI_ARCH\n"
! printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (${macro})\n"
if [ "${actual}" = "" ]
then
! printf "#define ${macro}() (gdbarch_${function} (current_gdbarch))\n"
elif [ "${actual}" = "-" ]
then
! printf "#define ${macro} (gdbarch_${function} (current_gdbarch))\n"
else
! printf "#define ${macro}(${actual}) (gdbarch_${function} (current_gdbarch, ${actual}))\n"
fi
! printf "#endif\n"
! printf "#endif\n"
fi
done
*************** int gdbarch_debug = GDBARCH_DEBUG;
*** 1047,1077 ****
EOF
# gdbarch open the gdbarch object
! echo ""
! echo "/* Maintain the struct gdbarch object */"
! echo ""
! echo "struct gdbarch"
! echo "{"
! echo " /* basic architectural information */"
function_list | while do_read
do
if class_is_info_p
then
! echo " ${returntype} ${function};"
fi
done
! echo ""
! echo " /* target specific vector. */"
! echo " struct gdbarch_tdep *tdep;"
! echo " gdbarch_dump_tdep_ftype *dump_tdep;"
! echo ""
! echo " /* per-architecture data-pointers */"
! echo " int nr_data;"
! echo " void **data;"
! echo ""
! echo " /* per-architecture swap-regions */"
! echo " struct gdbarch_swap *swap;"
! echo ""
cat <<EOF
/* Multi-arch values.
--- 1060,1090 ----
EOF
# gdbarch open the gdbarch object
! printf "\n"
! printf "/* Maintain the struct gdbarch object */\n"
! printf "\n"
! printf "struct gdbarch\n"
! printf "{\n"
! printf " /* basic architectural information */\n"
function_list | while do_read
do
if class_is_info_p
then
! printf " ${returntype} ${function};\n"
fi
done
! printf "\n"
! printf " /* target specific vector. */\n"
! printf " struct gdbarch_tdep *tdep;\n"
! printf " gdbarch_dump_tdep_ftype *dump_tdep;\n"
! printf "\n"
! printf " /* per-architecture data-pointers */\n"
! printf " int nr_data;\n"
! printf " void **data;\n"
! printf "\n"
! printf " /* per-architecture swap-regions */\n"
! printf " struct gdbarch_swap *swap;\n"
! printf "\n"
cat <<EOF
/* Multi-arch values.
*************** function_list | while do_read
*** 1104,1135 ****
do
if class_is_variable_p
then
! echo " ${returntype} ${function};"
elif class_is_function_p
then
! echo " gdbarch_${function}_ftype *${function}${attrib};"
fi
done
! echo "};"
# A pre-initialized vector
! echo ""
! echo ""
cat <<EOF
/* The default architecture uses host values (for want of a better
choice). */
EOF
! echo ""
! echo "extern const struct bfd_arch_info bfd_default_arch_struct;"
! echo ""
! echo "struct gdbarch startup_gdbarch ="
! echo "{"
! echo " /* basic architecture information */"
function_list | while do_read
do
if class_is_info_p
then
! echo " ${staticdefault},"
fi
done
cat <<EOF
--- 1117,1148 ----
do
if class_is_variable_p
then
! printf " ${returntype} ${function};\n"
elif class_is_function_p
then
! printf " gdbarch_${function}_ftype *${function}${attrib};\n"
fi
done
! printf "};\n"
# A pre-initialized vector
! printf "\n"
! printf "\n"
cat <<EOF
/* The default architecture uses host values (for want of a better
choice). */
EOF
! printf "\n"
! printf "extern const struct bfd_arch_info bfd_default_arch_struct;\n"
! printf "\n"
! printf "struct gdbarch startup_gdbarch =\n"
! printf "{\n"
! printf " /* basic architecture information */\n"
function_list | while do_read
do
if class_is_info_p
then
! printf " ${staticdefault},\n"
fi
done
cat <<EOF
*************** function_list | while do_read
*** 1143,1149 ****
do
if class_is_function_p || class_is_variable_p
then
! echo " ${staticdefault},"
fi
done
cat <<EOF
--- 1156,1162 ----
do
if class_is_function_p || class_is_variable_p
then
! printf " ${staticdefault},\n"
fi
done
cat <<EOF
*************** struct gdbarch *current_gdbarch = &start
*** 1154,1166 ****
EOF
# Create a new gdbarch struct
! echo ""
! echo ""
cat <<EOF
/* Create a new \`\`struct gdbarch'' based on information provided by
\`\`struct gdbarch_info''. */
EOF
! echo ""
cat <<EOF
struct gdbarch *
gdbarch_alloc (const struct gdbarch_info *info,
--- 1167,1179 ----
EOF
# Create a new gdbarch struct
! printf "\n"
! printf "\n"
cat <<EOF
/* Create a new \`\`struct gdbarch'' based on information provided by
\`\`struct gdbarch_info''. */
EOF
! printf "\n"
cat <<EOF
struct gdbarch *
gdbarch_alloc (const struct gdbarch_info *info,
*************** gdbarch_alloc (const struct gdbarch_info
*** 1171,1193 ****
gdbarch->tdep = tdep;
EOF
! echo ""
function_list | while do_read
do
if class_is_info_p
then
! echo " gdbarch->${function} = info->${function};"
fi
done
! echo ""
! echo " /* Force the explicit initialization of these. */"
function_list | while do_read
do
if class_is_function_p || class_is_variable_p
then
if [ "${predefault}" != "" -a "${predefault}" != "0" ]
then
! echo " gdbarch->${function} = ${predefault};"
fi
fi
done
--- 1184,1206 ----
gdbarch->tdep = tdep;
EOF
! printf "\n"
function_list | while do_read
do
if class_is_info_p
then
! printf " gdbarch->${function} = info->${function};\n"
fi
done
! printf "\n"
! printf " /* Force the explicit initialization of these. */\n"
function_list | while do_read
do
if class_is_function_p || class_is_variable_p
then
if [ "${predefault}" != "" -a "${predefault}" != "0" ]
then
! printf " gdbarch->${function} = ${predefault};\n"
fi
fi
done
*************** cat <<EOF
*** 1199,1206 ****
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.
--- 1212,1219 ----
EOF
# Free a gdbarch struct.
! printf "\n"
! printf "\n"
cat <<EOF
/* Free a gdbarch struct. This should never happen in normal
operation --- once you've created a gdbarch, you keep it around.
*************** gdbarch_free (struct gdbarch *arch)
*** 1217,1226 ****
EOF
# verify a new architecture
! echo ""
! echo ""
! echo "/* Ensure that all values in a GDBARCH are reasonable. */"
! echo ""
cat <<EOF
static void
verify_gdbarch (struct gdbarch *gdbarch)
--- 1230,1239 ----
EOF
# verify a new architecture
! printf "\n"
! printf "\n"
! printf "/* Ensure that all values in a GDBARCH are reasonable. */\n"
! printf "\n"
cat <<EOF
static void
verify_gdbarch (struct gdbarch *gdbarch)
*************** do
*** 1241,1273 ****
then
if [ "${invalid_p}" = "0" ]
then
! echo " /* Skip verify of ${function}, invalid_p == 0 */"
elif class_is_predicate_p
then
! echo " /* Skip verify of ${function}, has predicate */"
# FIXME: See do_read for potential simplification
elif [ "${invalid_p}" -a "${postdefault}" ]
then
! echo " if (${invalid_p})"
! echo " gdbarch->${function} = ${postdefault};"
elif [ "${predefault}" -a "${postdefault}" ]
then
! echo " if (gdbarch->${function} == ${predefault})"
! echo " gdbarch->${function} = ${postdefault};"
elif [ "${postdefault}" ]
then
! echo " if (gdbarch->${function} == 0)"
! echo " gdbarch->${function} = ${postdefault};"
elif [ "${invalid_p}" ]
then
! echo " if ((GDB_MULTI_ARCH >= ${level})"
! echo " && (${invalid_p}))"
! echo " internal_error (\"gdbarch: verify_gdbarch: ${function} invalid\");"
elif [ "${predefault}" ]
then
! echo " if ((GDB_MULTI_ARCH >= ${level})"
! echo " && (gdbarch->${function} == ${predefault}))"
! echo " internal_error (\"gdbarch: verify_gdbarch: ${function} invalid\");"
fi
fi
done
--- 1254,1286 ----
then
if [ "${invalid_p}" = "0" ]
then
! printf " /* Skip verify of ${function}, invalid_p == 0 */\n"
elif class_is_predicate_p
then
! printf " /* Skip verify of ${function}, has predicate */\n"
# FIXME: See do_read for potential simplification
elif [ "${invalid_p}" -a "${postdefault}" ]
then
! printf " if (${invalid_p})\n"
! printf " gdbarch->${function} = ${postdefault};\n"
elif [ "${predefault}" -a "${postdefault}" ]
then
! printf " if (gdbarch->${function} == ${predefault})\n"
! printf " gdbarch->${function} = ${postdefault};\n"
elif [ "${postdefault}" ]
then
! printf " if (gdbarch->${function} == 0)\n"
! printf " gdbarch->${function} = ${postdefault};\n"
elif [ "${invalid_p}" ]
then
! printf " if ((GDB_MULTI_ARCH >= ${level})\n"
! printf " && (${invalid_p}))\n"
! printf " internal_error (\"gdbarch: verify_gdbarch: ${function} invalid\");\n"
elif [ "${predefault}" ]
then
! printf " if ((GDB_MULTI_ARCH >= ${level})\n"
! printf " && (gdbarch->${function} == ${predefault}))\n"
! printf " internal_error (\"gdbarch: verify_gdbarch: ${function} invalid\");\n"
fi
fi
done
*************** cat <<EOF
*** 1276,1283 ****
EOF
# dump the structure
! echo ""
! echo ""
cat <<EOF
/* Print out the details of the current architecture. */
--- 1289,1296 ----
EOF
# dump the structure
! printf "\n"
! printf "\n"
cat <<EOF
/* Print out the details of the current architecture. */
*************** function_list | while do_read
*** 1298,1349 ****
do
if [ "${returntype}" = "void" ]
then
! echo "#if defined (${macro}) && GDB_MULTI_ARCH"
! echo " /* Macro might contain \`[{}]' when not multi-arch */"
else
! echo "#ifdef ${macro}"
fi
if class_is_function_p
then
! echo " fprintf_unfiltered (file,"
! echo " \"gdbarch_dump: %s # %s\\n\","
! echo " \"${macro}(${actual})\","
! echo " XSTRING (${macro} (${actual})));"
else
! echo " fprintf_unfiltered (file,"
! echo " \"gdbarch_dump: ${macro} # %s\\n\","
! echo " XSTRING (${macro}));"
fi
! echo "#endif"
done
function_list | while do_read
do
! echo "#ifdef ${macro}"
if [ "${print_p}" = "()" ]
then
! echo " gdbarch_dump_${function} (current_gdbarch);"
elif [ "${print_p}" = "0" ]
then
! echo " /* skip print of ${macro}, print_p == 0. */"
elif [ "${print_p}" ]
then
! echo " if (${print_p})"
! echo " fprintf_unfiltered (file,"
! echo " \"gdbarch_dump: ${macro} = ${fmt}\\n\","
! echo " ${print});"
elif class_is_function_p
then
! echo " if (GDB_MULTI_ARCH)"
! echo " fprintf_unfiltered (file,"
! echo " \"gdbarch_dump: ${macro} = 0x%08lx\\n\","
! echo " (long) current_gdbarch->${function}"
! echo " /*${macro} ()*/);"
else
! echo " fprintf_unfiltered (file,"
! echo " \"gdbarch_dump: ${macro} = ${fmt}\\n\","
! echo " ${print});"
fi
! echo "#endif"
done
cat <<EOF
if (current_gdbarch->dump_tdep != NULL)
--- 1311,1362 ----
do
if [ "${returntype}" = "void" ]
then
! printf "#if defined (${macro}) && GDB_MULTI_ARCH\n"
! printf " /* Macro might contain \`[{}]' when not multi-arch */\n"
else
! printf "#ifdef ${macro}\n"
fi
if class_is_function_p
then
! printf " fprintf_unfiltered (file,\n"
! printf " \"gdbarch_dump: %%s # %%s\\\\n\",\n"
! printf " \"${macro}(${actual})\",\n"
! printf " XSTRING (${macro} (${actual})));\n"
else
! printf " fprintf_unfiltered (file,\n"
! printf " \"gdbarch_dump: ${macro} # %%s\\\\n\",\n"
! printf " XSTRING (${macro}));\n"
fi
! printf "#endif\n"
done
function_list | while do_read
do
! printf "#ifdef ${macro}\n"
if [ "${print_p}" = "()" ]
then
! printf " gdbarch_dump_${function} (current_gdbarch);\n"
elif [ "${print_p}" = "0" ]
then
! printf " /* skip print of ${macro}, print_p == 0. */\n"
elif [ "${print_p}" ]
then
! printf " if (${print_p})\n"
! printf " fprintf_unfiltered (file,\n"
! printf " \"gdbarch_dump: ${macro} = %s\\\\n\",\n" "${fmt}"
! printf " ${print});\n"
elif class_is_function_p
then
! printf " if (GDB_MULTI_ARCH)\n"
! printf " fprintf_unfiltered (file,\n"
! printf " \"gdbarch_dump: ${macro} = 0x%%08lx\\\\n\",\n"
! printf " (long) current_gdbarch->${function}\n"
! printf " /*${macro} ()*/);\n"
else
! printf " fprintf_unfiltered (file,\n"
! printf " \"gdbarch_dump: ${macro} = %s\\\\n\",\n" "${fmt}"
! printf " ${print});\n"
fi
! printf "#endif\n"
done
cat <<EOF
if (current_gdbarch->dump_tdep != NULL)
*************** EOF
*** 1353,1454 ****
# GET/SET
! echo ""
cat <<EOF
struct gdbarch_tdep *
gdbarch_tdep (struct gdbarch *gdbarch)
{
if (gdbarch_debug >= 2)
! fprintf_unfiltered (gdb_stdlog, "gdbarch_tdep called\n");
return gdbarch->tdep;
}
EOF
! echo ""
function_list | while do_read
do
if class_is_predicate_p
then
! echo ""
! echo "int"
! echo "gdbarch_${function}_p (struct gdbarch *gdbarch)"
! echo "{"
if [ "${valid_p}" ]
then
! echo " return ${valid_p};"
else
! echo "#error \"gdbarch_${function}_p: not defined\""
fi
! echo "}"
fi
if class_is_function_p
then
! echo ""
! echo "${returntype}"
if [ "${formal}" = "void" ]
then
! echo "gdbarch_${function} (struct gdbarch *gdbarch)"
else
! echo "gdbarch_${function} (struct gdbarch *gdbarch, ${formal})"
fi
! echo "{"
! echo " if (gdbarch->${function} == 0)"
! echo " internal_error (\"gdbarch: gdbarch_${function} invalid\");"
! echo " if (gdbarch_debug >= 2)"
! echo " fprintf_unfiltered (gdb_stdlog, \"gdbarch_${function} called\n\");"
test "${actual}" = "-" && actual=""
if [ "${returntype}" = "void" ]
then
! echo " gdbarch->${function} (${actual});"
else
! echo " return gdbarch->${function} (${actual});"
fi
! echo "}"
! echo ""
! echo "void"
! echo "set_gdbarch_${function} (struct gdbarch *gdbarch,"
! echo " `echo ${function} | sed -e 's/./ /g'` gdbarch_${function}_ftype ${function})"
! echo "{"
! echo " gdbarch->${function} = ${function};"
! echo "}"
elif class_is_variable_p
then
! echo ""
! echo "${returntype}"
! echo "gdbarch_${function} (struct gdbarch *gdbarch)"
! echo "{"
if [ "${invalid_p}" = "0" ]
then
! echo " /* Skip verify of ${function}, invalid_p == 0 */"
elif [ "${invalid_p}" ]
then
! echo " if (${invalid_p})"
! echo " internal_error (\"gdbarch: gdbarch_${function} invalid\");"
elif [ "${predefault}" ]
then
! echo " if (gdbarch->${function} == ${predefault})"
! echo " internal_error (\"gdbarch: gdbarch_${function} invalid\");"
fi
! echo " if (gdbarch_debug >= 2)"
! echo " fprintf_unfiltered (gdb_stdlog, \"gdbarch_${function} called\n\");"
! echo " return gdbarch->${function};"
! echo "}"
! echo ""
! echo "void"
! echo "set_gdbarch_${function} (struct gdbarch *gdbarch,"
! echo " `echo ${function} | sed -e 's/./ /g'` ${returntype} ${function})"
! echo "{"
! echo " gdbarch->${function} = ${function};"
! echo "}"
elif class_is_info_p
then
! echo ""
! echo "${returntype}"
! echo "gdbarch_${function} (struct gdbarch *gdbarch)"
! echo "{"
! echo " if (gdbarch_debug >= 2)"
! echo " fprintf_unfiltered (gdb_stdlog, \"gdbarch_${function} called\n\");"
! echo " return gdbarch->${function};"
! echo "}"
fi
done
--- 1366,1467 ----
# GET/SET
! printf "\n"
cat <<EOF
struct gdbarch_tdep *
gdbarch_tdep (struct gdbarch *gdbarch)
{
if (gdbarch_debug >= 2)
! fprintf_unfiltered (gdb_stdlog, "gdbarch_tdep called\\n");
return gdbarch->tdep;
}
EOF
! printf "\n"
function_list | while do_read
do
if class_is_predicate_p
then
! printf "\n"
! printf "int\n"
! printf "gdbarch_${function}_p (struct gdbarch *gdbarch)\n"
! printf "{\n"
if [ "${valid_p}" ]
then
! printf " return ${valid_p};\n"
else
! printf "#error \"gdbarch_${function}_p: not defined\"\n"
fi
! printf "}\n"
fi
if class_is_function_p
then
! printf "\n"
! printf "${returntype}\n"
if [ "${formal}" = "void" ]
then
! printf "gdbarch_${function} (struct gdbarch *gdbarch)\n"
else
! printf "gdbarch_${function} (struct gdbarch *gdbarch, ${formal})\n"
fi
! printf "{\n"
! printf " if (gdbarch->${function} == 0)\n"
! printf " internal_error (\"gdbarch: gdbarch_${function} invalid\");\n"
! printf " if (gdbarch_debug >= 2)\n"
! printf " fprintf_unfiltered (gdb_stdlog, \"gdbarch_${function} called\\\\n\");\n"
test "${actual}" = "-" && actual=""
if [ "${returntype}" = "void" ]
then
! printf " gdbarch->${function} (${actual});\n"
else
! printf " return gdbarch->${function} (${actual});\n"
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 "{\n"
! printf " gdbarch->${function} = ${function};\n"
! printf "}\n"
elif class_is_variable_p
then
! printf "\n"
! printf "${returntype}\n"
! printf "gdbarch_${function} (struct gdbarch *gdbarch)\n"
! printf "{\n"
if [ "${invalid_p}" = "0" ]
then
! printf " /* Skip verify of ${function}, invalid_p == 0 */\n"
elif [ "${invalid_p}" ]
then
! printf " if (${invalid_p})\n"
! printf " internal_error (\"gdbarch: gdbarch_${function} invalid\");\n"
elif [ "${predefault}" ]
then
! printf " if (gdbarch->${function} == ${predefault})\n"
! printf " internal_error (\"gdbarch: gdbarch_${function} invalid\");\n"
fi
! printf " if (gdbarch_debug >= 2)\n"
! printf " fprintf_unfiltered (gdb_stdlog, \"gdbarch_${function} called\\\\n\");\n"
! printf " return gdbarch->${function};\n"
! 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 "{\n"
! printf " gdbarch->${function} = ${function};\n"
! printf "}\n"
elif class_is_info_p
then
! printf "\n"
! printf "${returntype}\n"
! printf "gdbarch_${function} (struct gdbarch *gdbarch)\n"
! printf "{\n"
! printf " if (gdbarch_debug >= 2)\n"
! printf " fprintf_unfiltered (gdb_stdlog, \"gdbarch_${function} called\\\\n\");\n"
! printf " return gdbarch->${function};\n"
! printf "}\n"
fi
done
*************** gdbarch_update_p (struct gdbarch_info in
*** 1794,1825 ****
if (rego == NULL)
{
if (gdbarch_debug)
! fprintf_unfiltered (gdb_stdlog, "gdbarch_update: No matching architecture\n");
return 0;
}
if (gdbarch_debug)
{
fprintf_unfiltered (gdb_stdlog,
! "gdbarch_update: info.bfd_architecture %d (%s)\n",
info.bfd_architecture,
bfd_lookup_arch (info.bfd_architecture, 0)->printable_name);
fprintf_unfiltered (gdb_stdlog,
! "gdbarch_update: info.bfd_arch_info %s\n",
(info.bfd_arch_info != NULL
? info.bfd_arch_info->printable_name
: "(null)"));
fprintf_unfiltered (gdb_stdlog,
! "gdbarch_update: info.byte_order %d (%s)\n",
info.byte_order,
(info.byte_order == BIG_ENDIAN ? "big"
: info.byte_order == LITTLE_ENDIAN ? "little"
: "default"));
fprintf_unfiltered (gdb_stdlog,
! "gdbarch_update: info.abfd 0x%lx\n",
(long) info.abfd);
fprintf_unfiltered (gdb_stdlog,
! "gdbarch_update: info.tdep_info 0x%lx\n",
(long) info.tdep_info);
}
--- 1807,1838 ----
if (rego == NULL)
{
if (gdbarch_debug)
! fprintf_unfiltered (gdb_stdlog, "gdbarch_update: No matching architecture\\n");
return 0;
}
if (gdbarch_debug)
{
fprintf_unfiltered (gdb_stdlog,
! "gdbarch_update: info.bfd_architecture %d (%s)\\n",
info.bfd_architecture,
bfd_lookup_arch (info.bfd_architecture, 0)->printable_name);
fprintf_unfiltered (gdb_stdlog,
! "gdbarch_update: info.bfd_arch_info %s\\n",
(info.bfd_arch_info != NULL
? info.bfd_arch_info->printable_name
: "(null)"));
fprintf_unfiltered (gdb_stdlog,
! "gdbarch_update: info.byte_order %d (%s)\\n",
info.byte_order,
(info.byte_order == BIG_ENDIAN ? "big"
: info.byte_order == LITTLE_ENDIAN ? "little"
: "default"));
fprintf_unfiltered (gdb_stdlog,
! "gdbarch_update: info.abfd 0x%lx\\n",
(long) info.abfd);
fprintf_unfiltered (gdb_stdlog,
! "gdbarch_update: info.tdep_info 0x%lx\\n",
(long) info.tdep_info);
}
*************** gdbarch_update_p (struct gdbarch_info in
*** 1830,1836 ****
if (new_gdbarch == NULL)
{
if (gdbarch_debug)
! fprintf_unfiltered (gdb_stdlog, "gdbarch_update: Target rejected architecture\n");
return 0;
}
--- 1843,1849 ----
if (new_gdbarch == NULL)
{
if (gdbarch_debug)
! fprintf_unfiltered (gdb_stdlog, "gdbarch_update: Target rejected architecture\\n");
return 0;
}
*************** gdbarch_update_p (struct gdbarch_info in
*** 1838,1844 ****
if (current_gdbarch == new_gdbarch)
{
if (gdbarch_debug)
! fprintf_unfiltered (gdb_stdlog, "gdbarch_update: Architecture 0x%08lx (%s) unchanged\n",
(long) new_gdbarch,
new_gdbarch->bfd_arch_info->printable_name);
return 1;
--- 1851,1857 ----
if (current_gdbarch == new_gdbarch)
{
if (gdbarch_debug)
! fprintf_unfiltered (gdb_stdlog, "gdbarch_update: Architecture 0x%08lx (%s) unchanged\\n",
(long) new_gdbarch,
new_gdbarch->bfd_arch_info->printable_name);
return 1;
*************** gdbarch_update_p (struct gdbarch_info in
*** 1856,1862 ****
{
if (gdbarch_debug)
fprintf_unfiltered (gdb_stdlog,
! "gdbarch_update: Previous architecture 0x%08lx (%s) selected\n",
(long) new_gdbarch,
new_gdbarch->bfd_arch_info->printable_name);
current_gdbarch = new_gdbarch;
--- 1869,1875 ----
{
if (gdbarch_debug)
fprintf_unfiltered (gdb_stdlog,
! "gdbarch_update: Previous architecture 0x%08lx (%s) selected\\n",
(long) new_gdbarch,
new_gdbarch->bfd_arch_info->printable_name);
current_gdbarch = new_gdbarch;
*************** gdbarch_update_p (struct gdbarch_info in
*** 1875,1881 ****
if (gdbarch_debug)
{
fprintf_unfiltered (gdb_stdlog,
! "gdbarch_update: New architecture 0x%08lx (%s) selected\n",
(long) new_gdbarch,
new_gdbarch->bfd_arch_info->printable_name);
}
--- 1888,1894 ----
if (gdbarch_debug)
{
fprintf_unfiltered (gdb_stdlog,
! "gdbarch_update: New architecture 0x%08lx (%s) selected\\n",
(long) new_gdbarch,
new_gdbarch->bfd_arch_info->printable_name);
}
*************** _initialize_gdbarch (void)
*** 1926,1939 ****
class_maintenance,
var_zinteger,
(char *)&gdbarch_debug,
! "Set architecture debugging.\n\\
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");
--- 1939,1952 ----
class_maintenance,
var_zinteger,
(char *)&gdbarch_debug,
! "Set architecture debugging.\\n\\
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");