From 216722984fec8aa76e2d97d7b8fcc2fb1608825b Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 17 Feb 2022 00:35:31 -0500 Subject: [PATCH] sim: gdbinit: hoist setup to common code This was left in subdirs because of the dynamic cgen usage. However, we can move this breakpoint call to runtime and let gdb detect whether the symbol exists. --- sim/Makefile.in | 4 +++- sim/bpf/configure | 9 --------- sim/common/Make-common.in | 7 ++----- sim/configure | 3 ++- sim/configure.ac | 2 +- sim/{common => }/gdbinit.in | 4 +++- sim/m4/sim_ac_output.m4 | 7 ------- sim/mips/configure | 9 --------- sim/mn10300/configure | 9 --------- sim/or1k/configure | 9 --------- sim/riscv/configure | 9 --------- sim/v850/configure | 9 --------- 12 files changed, 11 insertions(+), 70 deletions(-) rename sim/{common => }/gdbinit.in (60%) diff --git a/sim/Makefile.in b/sim/Makefile.in index 49a3c0b80db..6df800a7b78 100644 --- a/sim/Makefile.in +++ b/sim/Makefile.in @@ -208,7 +208,7 @@ CONFIG_CLEAN_FILES = Make-common.sim aarch64/Makefile.sim \ microblaze/Makefile.sim moxie/Makefile.sim msp430/Makefile.sim \ pru/Makefile.sim rl78/Makefile.sim rx/Makefile.sim \ sh/Makefile.sim erc32/Makefile.sim \ - example-synacor/Makefile.sim arch-subdir.mk + example-synacor/Makefile.sim arch-subdir.mk .gdbinit CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) ARFLAGS = cru @@ -1278,6 +1278,8 @@ example-synacor/Makefile.sim: $(top_builddir)/config.status $(top_srcdir)/exampl cd $(top_builddir) && $(SHELL) ./config.status $@ arch-subdir.mk: $(top_builddir)/config.status $(srcdir)/arch-subdir.mk.in cd $(top_builddir) && $(SHELL) ./config.status $@ +.gdbinit: $(top_builddir)/config.status $(srcdir)/gdbinit.in + cd $(top_builddir) && $(SHELL) ./config.status $@ clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) diff --git a/sim/bpf/configure b/sim/bpf/configure index f44ea707755..bd22472d68c 100755 --- a/sim/bpf/configure +++ b/sim/bpf/configure @@ -587,7 +587,6 @@ LIBOBJS SIM_COMMON_BUILD_FALSE SIM_COMMON_BUILD_TRUE sim_float -cgen_breaks target_alias host_alias build_alias @@ -1734,17 +1733,10 @@ fi fi -cgen_breaks="" -if grep CGEN_MAINT $srcdir/Makefile.in >/dev/null; then -cgen_breaks="break cgen_rtx_error"; -fi - ac_config_files="$ac_config_files Makefile.sim:Makefile.in" ac_config_files="$ac_config_files Make-common.sim:../common/Make-common.in" -ac_config_files="$ac_config_files .gdbinit:../common/gdbinit.in" - ac_config_commands="$ac_config_commands Makefile" ac_config_commands="$ac_config_commands stamp-h" @@ -2469,7 +2461,6 @@ do case $ac_config_target in "Makefile.sim") CONFIG_FILES="$CONFIG_FILES Makefile.sim:Makefile.in" ;; "Make-common.sim") CONFIG_FILES="$CONFIG_FILES Make-common.sim:../common/Make-common.in" ;; - ".gdbinit") CONFIG_FILES="$CONFIG_FILES .gdbinit:../common/gdbinit.in" ;; "Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS Makefile" ;; "stamp-h") CONFIG_COMMANDS="$CONFIG_COMMANDS stamp-h" ;; diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in index 57b45a7b427..74e5dad3049 100644 --- a/sim/common/Make-common.in +++ b/sim/common/Make-common.in @@ -250,7 +250,7 @@ RUNTESTFLAGS = callback_h = $(srcroot)/include/sim/callback.h remote_sim_h = $(srcroot)/include/sim/sim.h -all: libsim.a run$(EXEEXT) .gdbinit +all: libsim.a run$(EXEEXT) libsim.a: $(LIB_OBJS) $(SILENCE) rm -f libsim.a @@ -504,7 +504,7 @@ mostlyclean clean: $(SIM_EXTRA_CLEAN) distclean maintainer-clean realclean: clean $(SIM_EXTRA_DISTCLEAN) rm -f TAGS - rm -f Makefile config.cache config.log config.status .gdbinit + rm -f Makefile config.cache config.log config.status .c.o: $(COMPILE) $< @@ -521,9 +521,6 @@ Makefile: Makefile.in $(srccom)/Make-common.in $(config.status) @SIM_COMMON_BUILD_FALSE@config.status: configure @SIM_COMMON_BUILD_FALSE@ $(ECHO_GEN) $(SHELL) ./config.status --recheck -.gdbinit: # config.status $(srccom)/gdbinit.in -@SIM_COMMON_BUILD_FALSE@ $(ECHO_GEN) CONFIG_FILES=$@:../common/gdbinit.in CONFIG_HEADERS= $(SHELL) ./config.status - # CGEN support diff --git a/sim/configure b/sim/configure index 019c2f41cf4..02a3fa5bb3c 100755 --- a/sim/configure +++ b/sim/configure @@ -16287,7 +16287,7 @@ fi -ac_config_files="$ac_config_files arch-subdir.mk Makefile" +ac_config_files="$ac_config_files arch-subdir.mk Makefile .gdbinit:gdbinit.in" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -17540,6 +17540,7 @@ do "depdir-example-synacor") CONFIG_COMMANDS="$CONFIG_COMMANDS depdir-example-synacor" ;; "arch-subdir.mk") CONFIG_FILES="$CONFIG_FILES arch-subdir.mk" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + ".gdbinit") CONFIG_FILES="$CONFIG_FILES .gdbinit:gdbinit.in" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac diff --git a/sim/configure.ac b/sim/configure.ac index 0c14b1da79e..40a1efb96d3 100644 --- a/sim/configure.ac +++ b/sim/configure.ac @@ -187,5 +187,5 @@ dnl Some arches have unique configure flags. m4_include([frv/acinclude.m4]) m4_include([rx/acinclude.m4]) -AC_CONFIG_FILES([arch-subdir.mk Makefile]) +AC_CONFIG_FILES([arch-subdir.mk Makefile .gdbinit:gdbinit.in]) AC_OUTPUT diff --git a/sim/common/gdbinit.in b/sim/gdbinit.in similarity index 60% rename from sim/common/gdbinit.in rename to sim/gdbinit.in index ab9d7b3d548..f9cd5f32d2f 100644 --- a/sim/common/gdbinit.in +++ b/sim/gdbinit.in @@ -1,6 +1,8 @@ break sim_io_error break sim_core_signal -@cgen_breaks@ +# This symbol won't exist for non-cgen ports, but shouldn't be a big deal +# (other than gdb showing a warning on startup). +break cgen_rtx_error define dump set sim_debug_dump () diff --git a/sim/m4/sim_ac_output.m4 b/sim/m4/sim_ac_output.m4 index 22888bf214c..9eaeeff99f2 100644 --- a/sim/m4/sim_ac_output.m4 +++ b/sim/m4/sim_ac_output.m4 @@ -21,15 +21,8 @@ dnl one afterwards. The two pieces of the common fragment are inserted into dnl the target's fragment at the appropriate points. AC_DEFUN([SIM_AC_OUTPUT], [dnl -dnl Make @cgen_breaks@ non-null only if the sim uses CGEN. -cgen_breaks="" -if grep CGEN_MAINT $srcdir/Makefile.in >/dev/null; then -cgen_breaks="break cgen_rtx_error"; -fi -AC_SUBST(cgen_breaks) AC_CONFIG_FILES(Makefile.sim:Makefile.in) AC_CONFIG_FILES(Make-common.sim:../common/Make-common.in) -AC_CONFIG_FILES(.gdbinit:../common/gdbinit.in) AC_CONFIG_COMMANDS([Makefile], [echo "Merging Makefile.sim+Make-common.sim into Makefile ..." rm -f Makesim1.tmp Makesim2.tmp Makefile diff --git a/sim/mips/configure b/sim/mips/configure index 956b967a0b6..2f635a50e10 100755 --- a/sim/mips/configure +++ b/sim/mips/configure @@ -586,7 +586,6 @@ ac_subst_vars='LTLIBOBJS LIBOBJS SIM_COMMON_BUILD_FALSE SIM_COMMON_BUILD_TRUE -cgen_breaks sim_multi_obj sim_multi_src sim_multi_igen_configs @@ -2182,17 +2181,10 @@ sim_micromips_flags=" -F ${sim_micromips_filter} ${sim_micromips_machine} ${si -cgen_breaks="" -if grep CGEN_MAINT $srcdir/Makefile.in >/dev/null; then -cgen_breaks="break cgen_rtx_error"; -fi - ac_config_files="$ac_config_files Makefile.sim:Makefile.in" ac_config_files="$ac_config_files Make-common.sim:../common/Make-common.in" -ac_config_files="$ac_config_files .gdbinit:../common/gdbinit.in" - ac_config_commands="$ac_config_commands Makefile" ac_config_commands="$ac_config_commands stamp-h" @@ -2917,7 +2909,6 @@ do case $ac_config_target in "Makefile.sim") CONFIG_FILES="$CONFIG_FILES Makefile.sim:Makefile.in" ;; "Make-common.sim") CONFIG_FILES="$CONFIG_FILES Make-common.sim:../common/Make-common.in" ;; - ".gdbinit") CONFIG_FILES="$CONFIG_FILES .gdbinit:../common/gdbinit.in" ;; "Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS Makefile" ;; "stamp-h") CONFIG_COMMANDS="$CONFIG_COMMANDS stamp-h" ;; diff --git a/sim/mn10300/configure b/sim/mn10300/configure index 46e30c1cff0..569d09ba18e 100755 --- a/sim/mn10300/configure +++ b/sim/mn10300/configure @@ -587,7 +587,6 @@ LIBOBJS SIM_COMMON_BUILD_FALSE SIM_COMMON_BUILD_TRUE sim_float -cgen_breaks target_alias host_alias build_alias @@ -1734,17 +1733,10 @@ fi fi -cgen_breaks="" -if grep CGEN_MAINT $srcdir/Makefile.in >/dev/null; then -cgen_breaks="break cgen_rtx_error"; -fi - ac_config_files="$ac_config_files Makefile.sim:Makefile.in" ac_config_files="$ac_config_files Make-common.sim:../common/Make-common.in" -ac_config_files="$ac_config_files .gdbinit:../common/gdbinit.in" - ac_config_commands="$ac_config_commands Makefile" ac_config_commands="$ac_config_commands stamp-h" @@ -2469,7 +2461,6 @@ do case $ac_config_target in "Makefile.sim") CONFIG_FILES="$CONFIG_FILES Makefile.sim:Makefile.in" ;; "Make-common.sim") CONFIG_FILES="$CONFIG_FILES Make-common.sim:../common/Make-common.in" ;; - ".gdbinit") CONFIG_FILES="$CONFIG_FILES .gdbinit:../common/gdbinit.in" ;; "Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS Makefile" ;; "stamp-h") CONFIG_COMMANDS="$CONFIG_COMMANDS stamp-h" ;; diff --git a/sim/or1k/configure b/sim/or1k/configure index 46e30c1cff0..569d09ba18e 100755 --- a/sim/or1k/configure +++ b/sim/or1k/configure @@ -587,7 +587,6 @@ LIBOBJS SIM_COMMON_BUILD_FALSE SIM_COMMON_BUILD_TRUE sim_float -cgen_breaks target_alias host_alias build_alias @@ -1734,17 +1733,10 @@ fi fi -cgen_breaks="" -if grep CGEN_MAINT $srcdir/Makefile.in >/dev/null; then -cgen_breaks="break cgen_rtx_error"; -fi - ac_config_files="$ac_config_files Makefile.sim:Makefile.in" ac_config_files="$ac_config_files Make-common.sim:../common/Make-common.in" -ac_config_files="$ac_config_files .gdbinit:../common/gdbinit.in" - ac_config_commands="$ac_config_commands Makefile" ac_config_commands="$ac_config_commands stamp-h" @@ -2469,7 +2461,6 @@ do case $ac_config_target in "Makefile.sim") CONFIG_FILES="$CONFIG_FILES Makefile.sim:Makefile.in" ;; "Make-common.sim") CONFIG_FILES="$CONFIG_FILES Make-common.sim:../common/Make-common.in" ;; - ".gdbinit") CONFIG_FILES="$CONFIG_FILES .gdbinit:../common/gdbinit.in" ;; "Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS Makefile" ;; "stamp-h") CONFIG_COMMANDS="$CONFIG_COMMANDS stamp-h" ;; diff --git a/sim/riscv/configure b/sim/riscv/configure index 577d4cd32e7..d3f0d47e26e 100755 --- a/sim/riscv/configure +++ b/sim/riscv/configure @@ -587,7 +587,6 @@ LIBOBJS SIM_COMMON_BUILD_FALSE SIM_COMMON_BUILD_TRUE sim_float -cgen_breaks target_alias host_alias build_alias @@ -1740,17 +1739,10 @@ fi fi -cgen_breaks="" -if grep CGEN_MAINT $srcdir/Makefile.in >/dev/null; then -cgen_breaks="break cgen_rtx_error"; -fi - ac_config_files="$ac_config_files Makefile.sim:Makefile.in" ac_config_files="$ac_config_files Make-common.sim:../common/Make-common.in" -ac_config_files="$ac_config_files .gdbinit:../common/gdbinit.in" - ac_config_commands="$ac_config_commands Makefile" ac_config_commands="$ac_config_commands stamp-h" @@ -2475,7 +2467,6 @@ do case $ac_config_target in "Makefile.sim") CONFIG_FILES="$CONFIG_FILES Makefile.sim:Makefile.in" ;; "Make-common.sim") CONFIG_FILES="$CONFIG_FILES Make-common.sim:../common/Make-common.in" ;; - ".gdbinit") CONFIG_FILES="$CONFIG_FILES .gdbinit:../common/gdbinit.in" ;; "Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS Makefile" ;; "stamp-h") CONFIG_COMMANDS="$CONFIG_COMMANDS stamp-h" ;; diff --git a/sim/v850/configure b/sim/v850/configure index 46e30c1cff0..569d09ba18e 100755 --- a/sim/v850/configure +++ b/sim/v850/configure @@ -587,7 +587,6 @@ LIBOBJS SIM_COMMON_BUILD_FALSE SIM_COMMON_BUILD_TRUE sim_float -cgen_breaks target_alias host_alias build_alias @@ -1734,17 +1733,10 @@ fi fi -cgen_breaks="" -if grep CGEN_MAINT $srcdir/Makefile.in >/dev/null; then -cgen_breaks="break cgen_rtx_error"; -fi - ac_config_files="$ac_config_files Makefile.sim:Makefile.in" ac_config_files="$ac_config_files Make-common.sim:../common/Make-common.in" -ac_config_files="$ac_config_files .gdbinit:../common/gdbinit.in" - ac_config_commands="$ac_config_commands Makefile" ac_config_commands="$ac_config_commands stamp-h" @@ -2469,7 +2461,6 @@ do case $ac_config_target in "Makefile.sim") CONFIG_FILES="$CONFIG_FILES Makefile.sim:Makefile.in" ;; "Make-common.sim") CONFIG_FILES="$CONFIG_FILES Make-common.sim:../common/Make-common.in" ;; - ".gdbinit") CONFIG_FILES="$CONFIG_FILES .gdbinit:../common/gdbinit.in" ;; "Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS Makefile" ;; "stamp-h") CONFIG_COMMANDS="$CONFIG_COMMANDS stamp-h" ;; -- 2.30.2