public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: gdb-patches@sourceware.org
Subject: [PATCH 4/7] sim: split debug/stdio/trace/profile options into dedicated m4 files
Date: Mon,  7 Jun 2021 01:33:52 -0400	[thread overview]
Message-ID: <20210607053355.9965-4-vapier@gentoo.org> (raw)
In-Reply-To: <20210607053355.9965-1-vapier@gentoo.org>

This follows existing organizational structure with one configure option
per m4 file, and will make it easier to move to the common configure dir.
---
 sim/bfin/aclocal.m4             |   4 ++
 sim/m4/sim_ac_common.m4         | 101 ++------------------------------
 sim/m4/sim_ac_option_debug.m4   |  35 +++++++++++
 sim/m4/sim_ac_option_profile.m4 |  48 +++++++++++++++
 sim/m4/sim_ac_option_stdio.m4   |  32 ++++++++++
 sim/m4/sim_ac_option_trace.m4   |  46 +++++++++++++++
 6 files changed, 171 insertions(+), 95 deletions(-)
 create mode 100644 sim/m4/sim_ac_option_debug.m4
 create mode 100644 sim/m4/sim_ac_option_profile.m4
 create mode 100644 sim/m4/sim_ac_option_stdio.m4
 create mode 100644 sim/m4/sim_ac_option_trace.m4

diff --git a/sim/m4/sim_ac_common.m4 b/sim/m4/sim_ac_common.m4
index 7bad1486c5cc..353855707ad7 100644
--- a/sim/m4/sim_ac_common.m4
+++ b/sim/m4/sim_ac_common.m4
@@ -66,102 +66,13 @@ dnl --enable-maintainer-mode.
 AM_MAINTAINER_MODE
 
 
-dnl --enable-sim-debug is for developers of the simulator
-dnl the allowable values are work-in-progress
-AC_MSG_CHECKING([for sim debug setting])
-sim_debug="0"
-AC_ARG_ENABLE(sim-debug,
-[AS_HELP_STRING([--enable-sim-debug=opts],
-		[Enable debugging flags (for developers of the sim itself)])],
-[case "${enableval}" in
-  yes) sim_debug="7";;
-  no)  sim_debug="0";;
-  *)   sim_debug="($enableval)";;
-esac])dnl
-if test "$sim_debug" != "0"; then
-  AC_DEFINE_UNQUOTED([DEBUG], [$sim_debug], [Sim debug setting])
-fi
-AC_DEFINE_UNQUOTED([WITH_DEBUG], [$sim_debug], [Sim debug setting])
-AC_MSG_RESULT($sim_debug)
-
-
-dnl --enable-sim-stdio is for users of the simulator
-dnl It determines if IO from the program is routed through STDIO (buffered)
-AC_MSG_CHECKING([for sim stdio debug behavior])
-sim_stdio="0"
-AC_ARG_ENABLE(sim-stdio,
-[AS_HELP_STRING([--enable-sim-stdio],
-		[Specify whether to use stdio for console input/output])],
-[case "${enableval}" in
-  yes)	sim_stdio="DO_USE_STDIO";;
-  no)	sim_stdio="DONT_USE_STDIO";;
-  *)	AC_MSG_ERROR([Unknown value $enableval passed to --enable-sim-stdio]);;
-esac])dnl
-AC_DEFINE_UNQUOTED([WITH_STDIO], [$sim_stdio], [How to route I/O])
-AC_MSG_RESULT($sim_stdio)
-
-
-dnl --enable-sim-trace is for users of the simulator
-dnl The argument is either a bitmask of things to enable [exactly what is
-dnl up to the simulator], or is a comma separated list of names of tracing
-dnl elements to enable.  The latter is only supported on simulators that
-dnl use WITH_TRACE.  Default to all tracing but internal debug.
-AC_MSG_CHECKING([for sim trace settings])
-sim_trace="~TRACE_debug"
-AC_ARG_ENABLE(sim-trace,
-[AS_HELP_STRING([--enable-sim-trace=opts],
-		[Enable tracing of simulated programs])],
-[case "${enableval}" in
-  yes)	sim_trace="-1";;
-  no)	sim_trace="0";;
-  [[-0-9]]*)
-	sim_trace="'(${enableval})'";;
-  [[[:lower:]]]*)
-	sim_trace=""
-	for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
-	  if test x"$sim_trace" = x; then
-	    sim_trace="(TRACE_$x"
-	  else
-	    sim_trace="${sim_trace}|TRACE_$x"
-	  fi
-	done
-	sim_trace="$sim_trace)" ;;
-esac])dnl
-AC_DEFINE_UNQUOTED([WITH_TRACE], [$sim_trace], [Sim trace settings])
-AC_MSG_RESULT($sim_trace)
-
-
-dnl --enable-sim-profile
-dnl The argument is either a bitmask of things to enable [exactly what is
-dnl up to the simulator], or is a comma separated list of names of profiling
-dnl elements to enable.  The latter is only supported on simulators that
-dnl use WITH_PROFILE.
-AC_MSG_CHECKING([for sim profile settings])
-profile="1"
-sim_profile="-1"
-AC_ARG_ENABLE(sim-profile,
-[AS_HELP_STRING([--enable-sim-profile=opts], [Enable profiling flags])],
-[case "${enableval}" in
-  yes)	profile="1" sim_profile="-1";;
-  no)	profile="0" sim_profile="0";;
-  [[-0-9]]*)
-	profile="(${enableval})" sim_profile="(${enableval})";;
-  [[a-z]]*)
-    profile="1"
-	sim_profile=""
-	for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
-	  if test x"$sim_profile" = x; then
-	    sim_profile="(PROFILE_$x"
-	  else
-	    sim_profile="${sim_profile}|PROFILE_$x"
-	  fi
-	done
-	sim_profile="$sim_profile)" ;;
-esac])dnl
-AC_DEFINE_UNQUOTED([PROFILE], [$profile], [Sim profile settings])
-AC_DEFINE_UNQUOTED([WITH_PROFILE], [$sim_profile], [Sim profile settings])
-AC_MSG_RESULT($sim_profile)
+SIM_AC_OPTION_DEBUG
 
+SIM_AC_OPTION_STDIO
+
+SIM_AC_OPTION_TRACE
+
+SIM_AC_OPTION_PROFILE
 
 SIM_AC_OPTION_INLINE
 
diff --git a/sim/m4/sim_ac_option_debug.m4 b/sim/m4/sim_ac_option_debug.m4
new file mode 100644
index 000000000000..41faef927fce
--- /dev/null
+++ b/sim/m4/sim_ac_option_debug.m4
@@ -0,0 +1,35 @@
+dnl   Copyright (C) 1997-2021 Free Software Foundation, Inc.
+dnl
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 3 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
+dnl
+dnl --enable-sim-debug is for developers of the simulator
+dnl the allowable values are work-in-progress
+AC_DEFUN([SIM_AC_OPTION_DEBUG],
+[dnl
+AC_MSG_CHECKING([for sim debug setting])
+sim_debug="0"
+AC_ARG_ENABLE(sim-debug,
+[AS_HELP_STRING([--enable-sim-debug=opts],
+		[Enable debugging flags (for developers of the sim itself)])],
+[case "${enableval}" in
+  yes) sim_debug="7";;
+  no)  sim_debug="0";;
+  *)   sim_debug="($enableval)";;
+esac])dnl
+if test "$sim_debug" != "0"; then
+  AC_DEFINE_UNQUOTED([DEBUG], [$sim_debug], [Sim debug setting])
+fi
+AC_DEFINE_UNQUOTED([WITH_DEBUG], [$sim_debug], [Sim debug setting])
+AC_MSG_RESULT($sim_debug)
+])
diff --git a/sim/m4/sim_ac_option_profile.m4 b/sim/m4/sim_ac_option_profile.m4
new file mode 100644
index 000000000000..07f8d958eefc
--- /dev/null
+++ b/sim/m4/sim_ac_option_profile.m4
@@ -0,0 +1,48 @@
+dnl   Copyright (C) 1997-2021 Free Software Foundation, Inc.
+dnl
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 3 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
+dnl
+dnl --enable-sim-profile
+dnl The argument is either a bitmask of things to enable [exactly what is
+dnl up to the simulator], or is a comma separated list of names of profiling
+dnl elements to enable.  The latter is only supported on simulators that
+dnl use WITH_PROFILE.
+AC_DEFUN([SIM_AC_OPTION_PROFILE],
+[dnl
+AC_MSG_CHECKING([for sim profile settings])
+profile="1"
+sim_profile="-1"
+AC_ARG_ENABLE(sim-profile,
+[AS_HELP_STRING([--enable-sim-profile=opts], [Enable profiling flags])],
+[case "${enableval}" in
+  yes)	profile="1" sim_profile="-1";;
+  no)	profile="0" sim_profile="0";;
+  [[-0-9]]*)
+	profile="(${enableval})" sim_profile="(${enableval})";;
+  [[a-z]]*)
+    profile="1"
+	sim_profile=""
+	for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
+	  if test x"$sim_profile" = x; then
+	    sim_profile="(PROFILE_$x"
+	  else
+	    sim_profile="${sim_profile}|PROFILE_$x"
+	  fi
+	done
+	sim_profile="$sim_profile)" ;;
+esac])dnl
+AC_DEFINE_UNQUOTED([PROFILE], [$profile], [Sim profile settings])
+AC_DEFINE_UNQUOTED([WITH_PROFILE], [$sim_profile], [Sim profile settings])
+AC_MSG_RESULT($sim_profile)
+])
diff --git a/sim/m4/sim_ac_option_stdio.m4 b/sim/m4/sim_ac_option_stdio.m4
new file mode 100644
index 000000000000..f4ae3081ee7b
--- /dev/null
+++ b/sim/m4/sim_ac_option_stdio.m4
@@ -0,0 +1,32 @@
+dnl   Copyright (C) 1997-2021 Free Software Foundation, Inc.
+dnl
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 3 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
+dnl
+dnl --enable-sim-stdio is for users of the simulator
+dnl It determines if IO from the program is routed through STDIO (buffered)
+AC_DEFUN([SIM_AC_OPTION_STDIO],
+[dnl
+AC_MSG_CHECKING([for sim stdio debug behavior])
+sim_stdio="0"
+AC_ARG_ENABLE(sim-stdio,
+[AS_HELP_STRING([--enable-sim-stdio],
+		[Specify whether to use stdio for console input/output])],
+[case "${enableval}" in
+  yes)	sim_stdio="DO_USE_STDIO";;
+  no)	sim_stdio="DONT_USE_STDIO";;
+  *)	AC_MSG_ERROR([Unknown value $enableval passed to --enable-sim-stdio]);;
+esac])dnl
+AC_DEFINE_UNQUOTED([WITH_STDIO], [$sim_stdio], [How to route I/O])
+AC_MSG_RESULT($sim_stdio)
+])
diff --git a/sim/m4/sim_ac_option_trace.m4 b/sim/m4/sim_ac_option_trace.m4
new file mode 100644
index 000000000000..d7dfead45a81
--- /dev/null
+++ b/sim/m4/sim_ac_option_trace.m4
@@ -0,0 +1,46 @@
+dnl   Copyright (C) 1997-2021 Free Software Foundation, Inc.
+dnl
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 3 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
+dnl
+dnl --enable-sim-trace is for users of the simulator
+dnl The argument is either a bitmask of things to enable [exactly what is
+dnl up to the simulator], or is a comma separated list of names of tracing
+dnl elements to enable.  The latter is only supported on simulators that
+dnl use WITH_TRACE.  Default to all tracing but internal debug.
+AC_DEFUN([SIM_AC_OPTION_TRACE],
+[dnl
+AC_MSG_CHECKING([for sim trace settings])
+sim_trace="~TRACE_debug"
+AC_ARG_ENABLE(sim-trace,
+[AS_HELP_STRING([--enable-sim-trace=opts],
+		[Enable tracing of simulated programs])],
+[case "${enableval}" in
+  yes)	sim_trace="-1";;
+  no)	sim_trace="0";;
+  [[-0-9]]*)
+	sim_trace="'(${enableval})'";;
+  [[[:lower:]]]*)
+	sim_trace=""
+	for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
+	  if test x"$sim_trace" = x; then
+	    sim_trace="(TRACE_$x"
+	  else
+	    sim_trace="${sim_trace}|TRACE_$x"
+	  fi
+	done
+	sim_trace="$sim_trace)" ;;
+esac])dnl
+AC_DEFINE_UNQUOTED([WITH_TRACE], [$sim_trace], [Sim trace settings])
+AC_MSG_RESULT($sim_trace)
+])
-- 
2.31.1


  parent reply	other threads:[~2021-06-07  5:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-07  5:33 [PATCH 1/7] sim: unify platform function & header tests Mike Frysinger
2021-06-07  5:33 ` [PATCH 2/7] sim: unify assert build settings Mike Frysinger
2021-06-07  5:33 ` [PATCH 3/7] sim: unify environment " Mike Frysinger
2021-06-12 17:17   ` [PATCH/committed] sim: ppc: unify env settings too Mike Frysinger
2021-06-07  5:33 ` Mike Frysinger [this message]
2021-06-07  5:33 ` [PATCH 5/7] sim: unify debug/stdio/trace/profile build settings Mike Frysinger
2021-06-13  0:09   ` [PATCH 5/7 v2] " Mike Frysinger
2021-06-07  5:33 ` [PATCH 6/7] sim: unify bug & package settings Mike Frysinger
2021-06-13  0:25   ` [PATCH 6/7 v2] " Mike Frysinger
2021-06-07  5:33 ` [PATCH 7/7] sim: overhaul alignment settings management Mike Frysinger
2021-06-13  1:19   ` [PATCH 7/7 v2] " Mike Frysinger
2021-06-12 18:40 ` [PATCH/committed] sim: ppc: unify header & function & type tests too Mike Frysinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210607053355.9965-4-vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).