gdb: include --enable-targets in 'show configuration' output

Message ID f94315f344459583a001f35189f0d9cd7d48ad02.1728239574.git.aburgess@redhat.com
State New
Headers
Series gdb: include --enable-targets in 'show configuration' output |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Test passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed

Commit Message

Andrew Burgess Oct. 6, 2024, 6:33 p.m. UTC
  Include the value of configuration flag --enable-targets in the output
of GDB command 'show configuration' and also in the output printed for
'gdb --configuration'.  This will make it easier to see how GDB was
built.

No tests added or updated as we can't really check for a specific flag
appearing or not appearing on the configuration output.  But we do
print the configuration within lib/gdb.exp to check which features are
built into GDB, so if this change broke configuration printing then
plenty of tests should stop working (they don't).
---
 gdb/config.in    |  3 +++
 gdb/configure    | 10 +++++++++-
 gdb/configure.ac |  7 ++++++-
 gdb/top.c        |  5 +++++
 4 files changed, 23 insertions(+), 2 deletions(-)


base-commit: bcb92f7ba7b22ac882c000cabfd7ca8bea47c184
  

Comments

Tom Tromey Oct. 7, 2024, 4:46 p.m. UTC | #1
>>>>> "Andrew" == Andrew Burgess <aburgess@redhat.com> writes:

Andrew> Include the value of configuration flag --enable-targets in the output
Andrew> of GDB command 'show configuration' and also in the output printed for
Andrew> 'gdb --configuration'.  This will make it easier to see how GDB was
Andrew> built.

Andrew> No tests added or updated as we can't really check for a specific flag
Andrew> appearing or not appearing on the configuration output.  But we do
Andrew> print the configuration within lib/gdb.exp to check which features are
Andrew> built into GDB, so if this change broke configuration printing then
Andrew> plenty of tests should stop working (they don't).

Seems reasonable to me.
Approved-By: Tom Tromey <tom@tromey.com>

Tom
  
Andrew Burgess Oct. 8, 2024, 1:25 p.m. UTC | #2
Tom Tromey <tom@tromey.com> writes:

>>>>>> "Andrew" == Andrew Burgess <aburgess@redhat.com> writes:
>
> Andrew> Include the value of configuration flag --enable-targets in the output
> Andrew> of GDB command 'show configuration' and also in the output printed for
> Andrew> 'gdb --configuration'.  This will make it easier to see how GDB was
> Andrew> built.
>
> Andrew> No tests added or updated as we can't really check for a specific flag
> Andrew> appearing or not appearing on the configuration output.  But we do
> Andrew> print the configuration within lib/gdb.exp to check which features are
> Andrew> built into GDB, so if this change broke configuration printing then
> Andrew> plenty of tests should stop working (they don't).
>
> Seems reasonable to me.
> Approved-By: Tom Tromey <tom@tromey.com>

Pushed.

Thanks,
Andrew
  

Patch

diff --git a/gdb/config.in b/gdb/config.in
index 57be033802e..59a5da39553 100644
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -46,6 +46,9 @@ 
    language is requested. */
 #undef ENABLE_NLS
 
+/* Additional targets configured into GDB. */
+#undef ENABLE_TARGETS
+
 /* The .gdbearlyinit filename. */
 #undef GDBEARLYINIT
 
diff --git a/gdb/configure b/gdb/configure
index 53eaad4f0e2..ec9bbd3a842 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -24828,11 +24828,19 @@  if test "${enable_targets+set}" = set; then :
   yes | "") as_fn_error $? "enable-targets option must specify target names or 'all'" "$LINENO" 5
             ;;
   no)       enable_targets= ;;
-  *)        enable_targets=$enableval ;;
+  *)
+	enable_targets=$enableval
+
+cat >>confdefs.h <<_ACEOF
+#define ENABLE_TARGETS "$enable_targets"
+_ACEOF
+
+	;;
 esac
 fi
 
 
+
 # Check whether --enable-64-bit-bfd was given.
 if test "${enable_64_bit_bfd+set}" = set; then :
   enableval=$enable_64_bit_bfd; case $enableval in #(
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 8368fea0423..21f5dc8dd30 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -184,9 +184,14 @@  AS_HELP_STRING([--enable-targets=TARGETS], [alternative target configurations]),
   yes | "") AC_MSG_ERROR(enable-targets option must specify target names or 'all')
             ;;
   no)       enable_targets= ;;
-  *)        enable_targets=$enableval ;;
+  *)
+	enable_targets=$enableval
+	AC_DEFINE_UNQUOTED(ENABLE_TARGETS, "$enable_targets",
+			   Additional targets configured into GDB. )
+	;;
 esac])
 
+
 BFD_64_BIT
 
 # Provide defaults for some variables set by the per-host and per-target
diff --git a/gdb/top.c b/gdb/top.c
index eae54aae1ff..d34e733eb0f 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1379,6 +1379,11 @@  This GDB was configured as follows:\n\
    configure --host=%s --target=%s\n\
 "), host_name, target_name);
 
+#ifdef ENABLE_TARGETS
+  gdb_printf (stream, _("\
+	     --enable-targets=%s\n"), ENABLE_TARGETS);
+#endif
+
   gdb_printf (stream, _("\
 	     --with-auto-load-dir=%s\n\
 	     --with-auto-load-safe-path=%s\n\