From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25501 invoked by alias); 21 Mar 2013 17:54:59 -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 25482 invoked by uid 89); 21 Mar 2013 17:54:49 -0000 X-Spam-SWARE-Status: No, score=-4.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,TW_XD autolearn=ham version=3.3.1 Received: from mail-vc0-f176.google.com (HELO mail-vc0-f176.google.com) (209.85.220.176) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 21 Mar 2013 17:54:46 +0000 Received: by mail-vc0-f176.google.com with SMTP id ib11so2522982vcb.35 for ; Thu, 21 Mar 2013 10:54:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:x-gm-message-state; bh=FH+j2H/dumdIQrhSarlePHYCEYES29bGKTIFwFFD3Ck=; b=UeKW+KCX2E6ZMxgqVynbFi8xxQgoXhCJIFbF1eEizHTrPW+I6QbWnAoVlPgLKVJpKP gFDNPEnMwDaWaPwyeBW6Lhkjd3yLBID+4aY06ojaIYIUihRdY5+fOlz4moqk1VfWHzdv 06wXGZZ8n6WI+LcF4SY7HEChHCxkQfR+2KDCKcDqzV/XfqGrD32K1VJZSu5ytKQyAM6V q8GzkZdhbOBZdTkq3YgfMF/RYjCHdmXuQnnQJr4HDbzhBbJYe4Djcq+MAJQd5WYoNRtZ BAbBPo8dT4mPj2qRrWE3QiMmK9o7mH/k7l6jqtHpLVGKt2PeJS+dTQFZANtzaa33izbe v/5A== MIME-Version: 1.0 X-Received: by 10.58.43.169 with SMTP id x9mr14690248vel.13.1363888484393; Thu, 21 Mar 2013 10:54:44 -0700 (PDT) Received: by 10.220.115.13 with HTTP; Thu, 21 Mar 2013 10:54:44 -0700 (PDT) In-Reply-To: <83r4jaynqq.fsf@gnu.org> References: <83r4jaynqq.fsf@gnu.org> Date: Thu, 21 Mar 2013 18:00:00 -0000 Message-ID: Subject: Re: [PATCH] Display configuration details in --help From: Doug Evans To: Eli Zaretskii Cc: gdb-patches Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQnLRUqHxUwfHgVwKpBeWaODBnd3WZj6zd5eqeCyKw9YwEJ4JitmJkuceU2bMGGs+zaXpoCHLg+ZhKLkk4vk113RJgB9Uwxa8kStAGArJvWwPUiDklJHqvxo9JYtXxxxk+XwtHIlTYJ1m/m8TundxHmwh4RXLFDGy8h/nLXMmReX2y82omef5OkFmnu/3zI3Ac4yln/oNk2g22U/5tbNpDlxQ13dng== X-SW-Source: 2013-03/txt/msg00794.txt.bz2 On Wed, Mar 20, 2013 at 10:39 AM, Eli Zaretskii wrote: > 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); Hi. I like the idea, but the implementation imposes a future maintenance burden. Would it be sufficient to just store the original string somewhere and print that? I believe that's what gcc does (at least it's configure.ac that computes a string and saves that in a global, and gcc just prints that global, instead of a series of #if/#ifdefs).