Tom Tromey writes: > This changes the Modula-2 code to use generic_emit_char and > generic_printstr. I have no way to test this. Hi Tom and gdb developers, here is a proposed patch for gdb and some new files which enable testing of binaries generated from Modula-2 source files. breakpointm2 and printformatted are included as a start. These patches and new files have been tested against the gdb git repro of Tue Mar 15 08:53:27 2022 and no new failures occur after the patches have been applied and new files added. It was tested on a Debian Bullseye amd64 machine with regular packages (gcc-10 and gm2-10 etc). 2022-03-16 Gaius Mulley Adding some modula-2 test cases and the tcl infastructure to support modula-2. * configure.ac (GM2_FOR_BUILD): Added. (GM2_FOR_TARGET): Added. * gdb/testsuite/lib/gdb.exp (skip_modula2_tests): New function. * gdb/testsuite/lib/modula2.exp: New file. * gdb/testsuite/gdb.modula2/breakpointm2.mod: New file. * gdb/testsuite/gdb.modula2/breakpointm2.exp: New file. * gdb/testsuite/gdb.modula2/printformattedm2.exp: New file. * gdb/testsuite/gdb.modula2/printformattedm2.mod: New file. diff --git a/configure.ac b/configure.ac index da4e41d7247..351d3f9655b 100644 --- a/configure.ac +++ b/configure.ac @@ -1270,6 +1270,7 @@ if test "${build}" != "${host}" ; then CC_FOR_BUILD=${CC_FOR_BUILD-gcc} CXX_FOR_BUILD=${CXX_FOR_BUILD-g++} GFORTRAN_FOR_BUILD=${GFORTRAN_FOR_BUILD-gfortran} + GM2_FOR_BUILD=${GM2_FOR_BUILD-gccm2} GOC_FOR_BUILD=${GOC_FOR_BUILD-gccgo} DLLTOOL_FOR_BUILD=${DLLTOOL_FOR_BUILD-dlltool} LD_FOR_BUILD=${LD_FOR_BUILD-ld} @@ -1283,6 +1284,7 @@ else CC_FOR_BUILD="\$(CC)" CXX_FOR_BUILD="\$(CXX)" GFORTRAN_FOR_BUILD="\$(GFORTRAN)" + GM2_FOR_BUILD="\$(GM2)" GOC_FOR_BUILD="\$(GOC)" DLLTOOL_FOR_BUILD="\$(DLLTOOL)" LD_FOR_BUILD="\$(LD)" @@ -3374,6 +3376,7 @@ AC_SUBST(CXXFLAGS_FOR_BUILD) AC_SUBST(CXX_FOR_BUILD) AC_SUBST(DLLTOOL_FOR_BUILD) AC_SUBST(GFORTRAN_FOR_BUILD) +AC_SUBST(GM2_FOR_BUILD) AC_SUBST(GOC_FOR_BUILD) AC_SUBST(LDFLAGS_FOR_BUILD) AC_SUBST(LD_FOR_BUILD) @@ -3501,6 +3504,7 @@ NCN_STRICT_CHECK_TARGET_TOOLS(CC_FOR_TARGET, cc gcc) NCN_STRICT_CHECK_TARGET_TOOLS(CXX_FOR_TARGET, c++ g++ cxx gxx) NCN_STRICT_CHECK_TARGET_TOOLS(GCC_FOR_TARGET, gcc, ${CC_FOR_TARGET}) NCN_STRICT_CHECK_TARGET_TOOLS(GFORTRAN_FOR_TARGET, gfortran) +NCN_STRICT_CHECK_TARGET_TOOLS(GM2_FOR_TARGET, gccm2) NCN_STRICT_CHECK_TARGET_TOOLS(GOC_FOR_TARGET, gccgo) ACX_CHECK_INSTALLED_TARGET_TOOL(AR_FOR_TARGET, ar) @@ -3533,6 +3537,8 @@ GCC_TARGET_TOOL(dlltool, DLLTOOL_FOR_TARGET, DLLTOOL, [binutils/dlltool]) GCC_TARGET_TOOL(gcc, GCC_FOR_TARGET, , [gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/]) GCC_TARGET_TOOL(gfortran, GFORTRAN_FOR_TARGET, GFORTRAN, [gcc/gfortran -B$$r/$(HOST_SUBDIR)/gcc/], fortran) +GCC_TARGET_TOOL(gccm2, GM2_FOR_TARGET, GM2, + [gcc/gm2 -B$$r/$(HOST_SUBDIR)/gcc/], modula-2) GCC_TARGET_TOOL(gccgo, GOC_FOR_TARGET, GOC, [gcc/gccgo -B$$r/$(HOST_SUBDIR)/gcc/], go) GCC_TARGET_TOOL(ld, LD_FOR_TARGET, LD, [ld/ld-new]) diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index a35d08a05de..e368a0dfccb 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -2295,6 +2295,12 @@ proc skip_d_tests {} { return 0 } +# Return a 1 if I don't even want to try to test Modula2. + +proc skip_modula2_tests {} { + return 0 +} + # Return 1 to skip Rust tests, 0 to try them. proc skip_rust_tests {} { if { ![isnative] } { new Modula-2 source tests and associated tcl driver scripts: