From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10592 invoked by alias); 20 Mar 2013 17:40:22 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 10575 invoked by uid 89); 20 Mar 2013 17:40:13 -0000 X-Spam-SWARE-Status: No, score=-3.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_SOFTFAIL,TW_XD autolearn=no version=3.3.1 Received: from mtaout23.012.net.il (HELO mtaout23.012.net.il) (80.179.55.175) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 20 Mar 2013 17:40:07 +0000 Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0MJY00M00Y9ID600@a-mtaout23.012.net.il> for gdb-patches@sourceware.org; Wed, 20 Mar 2013 19:39:12 +0200 (IST) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MJY00M9AZPBB9C0@a-mtaout23.012.net.il> for gdb-patches@sourceware.org; Wed, 20 Mar 2013 19:39:12 +0200 (IST) Date: Wed, 20 Mar 2013 17:46:00 -0000 From: Eli Zaretskii Subject: [PATCH] Display configuration details in --help To: gdb-patches@sourceware.org Reply-to: Eli Zaretskii Message-id: <83r4jaynqq.fsf@gnu.org> X-SW-Source: 2013-03/txt/msg00758.txt.bz2 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 * 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);