Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Display configuration details in --help
@ 2013-03-20 17:46 Eli Zaretskii
  2013-03-21 18:00 ` Doug Evans
  0 siblings, 1 reply; 39+ messages in thread
From: Eli Zaretskii @ 2013-03-20 17:46 UTC (permalink / raw)
  To: gdb-patches

GDB has a lot of configuration options, but once you've built and
installed it, it is hard to know which ones where specified and/or
auto-detected, and which weren't.  And if you, like me, keep several
prior versions of GDB around, but not necessarily keep their build
trees, about the only way to find out these configuration details is
by using 'strings' or by running GDB under a debugger, which is really
gross and also inefficient.

So I made a patch to display the important configuration parameters as
part of --help.  The patched GDB produces information like this on my
system:

     This GDB is configured as follows:
	configure --host=i686-pc-mingw32 --target=i686-pc-mingw32
		  --with-auto-load-dir=$debugdir:$datadir/auto-load
		  --with-auto-load-safe-path=$debugdir:$datadir/auto-load
		  --with-expat
		  --with-gdb-datadir=d:/usr/share/gdb (relocatable)
		  --with-jit-reader-dir=d:/usr/lib/gdb (relocatable)
		  --without-libunwind-ia64
		  --with-lzma
		  --with-python=d:/usr/Python26 (relocatable)
		  --with-separate-debug-dir=d:/usr/lib/debug (relocatable)
		  --with-system-gdbinit=d:/usr/etc/gdbinit (relocatable)
		  --with-zlib

I think this will also be useful for when users report problems,
because some solutions depend on how GDB was configured.

Do people think this will be useful?  The patch is below.

2013-03-20  Eli Zaretskii  <eliz@gnu.org>

	* main.c (print_gdb_help): Display configuration details.


--- gdb/main.c~1	2013-03-20 13:15:01.737639100 +0200
+++ gdb/main.c	2013-03-20 19:27:51.103852400 +0200
@@ -48,6 +48,8 @@
 #include "windows-nat.h"
 #endif
 
+#include "version.h"
+
 /* The selected interpreter.  This will be used as a set command
    variable, so it should always be malloc'ed - since
    do_setshow_command will free it.  */
@@ -1142,6 +1144,85 @@
   --write            Set writing into executable and core files.\n\
   --xdb              XDB compatibility mode.\n\
 "), stream);
+  fprintf_unfiltered (stream, _("\n\
+This GDB is configured as follows:\n\
+   configure --host=%s --target=%s\n\
+"), host_name, target_name);
+  fprintf_unfiltered (stream, _("\
+             --with-auto-load-dir=%s\n\
+             --with-auto-load-safe-path=%s\n\
+"), AUTO_LOAD_DIR, AUTO_LOAD_SAFE_PATH);
+#if HAVE_LIBEXPAT
+  fprintf_unfiltered (stream, _("\
+             --with-expat\n\
+"));
+#else
+  fprintf_unfiltered (stream, _("\
+             --without-expat\n\
+"));
+#endif
+  if (GDB_DATADIR[0])
+    fprintf_unfiltered (stream, _("\
+             --with-gdb-datadir=%s%s\n\
+"), GDB_DATADIR, GDB_DATADIR_RELOCATABLE ? " (relocatable)" : "");
+#ifdef ICONV_BIN
+  fprintf_unfiltered (stream, _("\
+             --with-iconv-bin=%s%s\n\
+"), ICONV_BIN, ICONV_BIN_RELOCATABLE ? " (relocatable)" : "");
+#endif
+  if (JIT_READER_DIR[0])
+    fprintf_unfiltered (stream, _("\
+             --with-jit-reader-dir=%s%s\n\
+"), JIT_READER_DIR, JIT_READER_DIR_RELOCATABLE ? " (relocatable)" : "");
+#if HAVE_LIBUNWIND_IA64_H
+  fprintf_unfiltered (stream, _("\
+             --with-libunwind-ia64\n\
+"));
+#else
+  fprintf_unfiltered (stream, _("\
+             --without-libunwind-ia64\n\
+"));
+#endif
+#if HAVE_LIBLZMA
+  fprintf_unfiltered (stream, _("\
+             --with-lzma\n\
+"));
+#else
+  fprintf_unfiltered (stream, _("\
+             --without-lzma\n\
+"));
+#endif
+#ifdef WITH_PYTHON_PATH
+  fprintf_unfiltered (stream, _("\
+             --with-python=%s%s\n\
+"), WITH_PYTHON_PATH, PYTHON_PATH_RELOCATABLE ? " (relocatable)" : "");
+#endif
+#ifdef RELOC_SRCDIR
+  fprintf_unfiltered (stream, _("\
+             --with-relocated-sources=%s\n\
+"), RELOC_SRCDIR);
+#endif
+  if (DEBUGDIR[0])
+    fprintf_unfiltered (stream, _("\
+             --with-separate-debug-dir=%s%s\n\
+"), DEBUGDIR, DEBUGDIR_RELOCATABLE ? " (relocatable)" : "");
+  if (TARGET_SYSTEM_ROOT[0])
+    fprintf_unfiltered (stream, _("\
+             --with-sysroot=%s%s\n\
+"), TARGET_SYSTEM_ROOT, TARGET_SYSTEM_ROOT_RELOCATABLE ? " (relocatable)" : "");
+  if (SYSTEM_GDBINIT[0])
+    fprintf_unfiltered (stream, _("\
+             --with-system-gdbinit=%s%s\n\
+"), SYSTEM_GDBINIT, SYSTEM_GDBINIT_RELOCATABLE ? " (relocatable)" : "");
+#if HAVE_ZLIB_H
+  fprintf_unfiltered (stream, _("\
+             --with-zlib\n\
+"));
+#else
+  fprintf_unfiltered (stream, _("\
+             --without-zlib\n\
+"));
+#endif
   fputs_unfiltered (_("\n\
 At startup, GDB reads the following init files and executes their commands:\n\
 "), stream);


^ permalink raw reply	[flat|nested] 39+ messages in thread

end of thread, other threads:[~2013-07-06  7:35 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-20 17:46 [PATCH] Display configuration details in --help Eli Zaretskii
2013-03-21 18:00 ` Doug Evans
2013-03-21 18:25   ` Pedro Alves
2013-03-21 18:29     ` Joel Brobecker
2013-03-21 18:44     ` Eli Zaretskii
2013-03-21 19:11       ` Joel Brobecker
2013-03-21 20:39         ` Eli Zaretskii
2013-03-21 20:55           ` Joel Brobecker
2013-03-21 21:17             ` Tom Tromey
2013-03-21 22:23               ` Eli Zaretskii
2013-04-09 19:31                 ` Eli Zaretskii
2013-04-09 19:46                   ` Doug Evans
2013-04-09 20:04                     ` Eli Zaretskii
2013-04-09 23:33                       ` Doug Evans
2013-04-10  0:12                         ` Pedro Alves
2013-04-10  0:48                           ` Eli Zaretskii
2013-04-10  2:51                           ` Doug Evans
2013-04-10  4:41                             ` Eli Zaretskii
2013-04-11  2:41                               ` Doug Evans
2013-04-11  1:20                             ` Tom Tromey
2013-04-11  1:24                               ` Pedro Alves
2013-04-11  2:43                                 ` Tom Tromey
2013-04-12 12:50                                   ` Eli Zaretskii
2013-04-12 14:43                                     ` Eli Zaretskii
2013-04-12 16:39                                       ` regroup --help text (was: Re: [PATCH] Display configuration details in --help) Pedro Alves
2013-06-22 11:31                                         ` regroup --help text " Eli Zaretskii
2013-06-25 19:30                                           ` Pedro Alves
2013-07-06  7:35                                             ` Eli Zaretskii
2013-04-12 20:50                                       ` [PATCH] Display configuration details in --help Tom Tromey
2013-04-14 14:17                                       ` Joel Brobecker
2013-04-16  1:34                                       ` Doug Evans
2013-04-16  9:46                                         ` regroup --help text Eli Zaretskii
2013-04-17  8:10                                           ` Doug Evans
2013-04-17 12:28                                             ` Eli Zaretskii
2013-04-14 14:16                                     ` [PATCH] Display configuration details in --help Doug Evans
2013-04-10  0:38                         ` Eli Zaretskii
2013-04-10  3:06                           ` Doug Evans
2013-04-10  4:44                             ` Eli Zaretskii
2013-03-21 18:53   ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox