aboutsummaryrefslogtreecommitdiff
path: root/gdb/make-init-c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/make-init-c')
-rwxr-xr-xgdb/make-init-c15
1 files changed, 14 insertions, 1 deletions
diff --git a/gdb/make-init-c b/gdb/make-init-c
index 1588760..e3c5985 100755
--- a/gdb/make-init-c
+++ b/gdb/make-init-c
@@ -42,6 +42,7 @@ set -e
echo "/* Do not modify this file. */"
echo "/* It is created automatically by the Makefile. */"
echo "#include \"defs.h\" /* For initialize_file_ftype. */"
+echo "#include <algorithm>"
echo ""
sed -n -e 's/^\(_initialize_[a-zA-Z0-9_]*\) ()$/\1/p' "$@" | while read -r name; do
echo "extern initialize_file_ftype $name;"
@@ -51,7 +52,19 @@ echo "void initialize_all_files ();"
echo "void"
echo "initialize_all_files ()"
echo "{"
+echo " std::vector<initialize_file_ftype *> functions ="
+echo " {"
sed -n -e 's/^\(_initialize_[a-zA-Z0-9_]*\) ()$/\1/p' "$@" | while read -r name; do
- echo " $name ();"
+ echo " $name,"
done
+echo " };"
+echo ""
+echo " /* If GDB_REVERSE_INIT_FUNCTIONS is set (any value), reverse the"
+echo " order in which initialization functions are called. This is"
+echo " used by the testsuite. */"
+echo " if (getenv (\"GDB_REVERSE_INIT_FUNCTIONS\") != nullptr)"
+echo " std::reverse (functions.begin (), functions.end ());"
+echo ""
+echo " for (initialize_file_ftype *function : functions)"
+echo " function ();"
echo "}"