From patchwork Fri Nov 11 11:24:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 60399 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4D4133858D3C for ; Fri, 11 Nov 2022 11:25:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4D4133858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1668165925; bh=TcrULN/QOSRk8LhI8mO3BGJJlwiVrlpG2VwP1QdEPJY=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=HljqZSV34pKAqrLkkPClFScExw0qFm2GlaazGC4LMyPD0u/8iIlQauwtqahqQLNn0 G+XGGpu7O74UkAfZea7o6FH+QsUisse/Eha2w68+IDtNOmxpVyXys/6xX8jYSIjAmZ jFwkVV5wrddAsk8+G2b9lwHFYXXLbtX+HtxUoUIc= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 124B33858D39 for ; Fri, 11 Nov 2022 11:24:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 124B33858D39 Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-527-7P1CbcAmPye7sTjRJeXCOQ-1; Fri, 11 Nov 2022 06:24:56 -0500 X-MC-Unique: 7P1CbcAmPye7sTjRJeXCOQ-1 Received: by mail-qv1-f72.google.com with SMTP id q17-20020a056214019100b004b1d3c9f3acso3513734qvr.0 for ; Fri, 11 Nov 2022 03:24:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=TcrULN/QOSRk8LhI8mO3BGJJlwiVrlpG2VwP1QdEPJY=; b=y7u4XKuC2WyOipMRp0bl7MIteoScZVoLDzT3vZxRugVHQzg4POnUN3a7TPXCO0ds1j aqSJtPQrKocHi/ObMupDsTCG5XX4gXB6KOiiXbdl66OYt39E8ajAu3xbTV1fDmIYZhwQ gIUtzHPHe83v7AwxK4xzWjcZfL4XxW1NbvJjF2iN2Qs7b8WDCcRxv83AKDzRD5lBiMDH uZZlXiM8JFnrxWvbxnW+boYlZ8ypG14w4oagqNWlXKnqUc5c50zV7uWRXrLzRR1xQLgw g9Xt55X6deT1d6HalByMCzoBGcsUfg5zglDYpauIRHZmM2MW+YLWRXlnt9H+7yL2NIqP QXTQ== X-Gm-Message-State: ANoB5pkQkVLbopT2atRZP8R8QczoMHRCw2sh3kbbLOhJ6PdOH/bswf98 WfGx0oCZ+rwk0IdTT328W7dId5mrU9R9TQjK5Qd7R3shnTRCfEqYCirdMlbFFa7GFn5Wtd/VYdd CJcMmjNU4uLa2ju49I4NWKCl7kcWvQ+kAiuYEZc/iK2S34Mw07Mo6ftw6p6q20iFAYgawJuZCEg == X-Received: by 2002:a37:8082:0:b0:6cf:5ed3:f993 with SMTP id b124-20020a378082000000b006cf5ed3f993mr638933qkd.106.1668165895772; Fri, 11 Nov 2022 03:24:55 -0800 (PST) X-Google-Smtp-Source: AA0mqf5DJntry0fS76MfYnB+hx5fGpUbPXLRZ1xRjDVg7HXdPKMG4H8GA8TS28A3wuTDzV/vl7saDw== X-Received: by 2002:a37:8082:0:b0:6cf:5ed3:f993 with SMTP id b124-20020a378082000000b006cf5ed3f993mr638913qkd.106.1668165895322; Fri, 11 Nov 2022 03:24:55 -0800 (PST) Received: from localhost ([31.111.84.238]) by smtp.gmail.com with ESMTPSA id v10-20020a05620a440a00b006fab416015csm1314260qkp.25.2022.11.11.03.24.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 03:24:55 -0800 (PST) To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH] gdb: new --with-pkgversion-suffix configure option Date: Fri, 11 Nov 2022 11:24:52 +0000 Message-Id: <86a03c4f56f167a7c08ce40200425d92a2ac39e8.1668165880.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_ASCII_DIVIDERS, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Andrew Burgess via Gdb-patches From: Andrew Burgess Reply-To: Andrew Burgess Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Once GDB 13.1 is released, then the version string, for a build of GDB made from the release branch should look like this: $ gdb --version GNU gdb (GDB) 13.1 We provide a configure option, --with-pkgversion, which allows control over the 'GDB' string within '(GDB) ', and so, if we configure like this: $ ../src/configure --with-pkgversion="My Distro" then the final GDB's version string would look like this: $ gdb --version GNU gdb (My Distro) 13.1 It is not unreasonable to think that somebody building a distribution specific version of GDB like this might want to also augment the version number (13.1) in order to indicate a local patch level. Now, the existing configure option, --with-pkgversion, clearly seems to indicate that the package specific version number should be included here, however, I don't find this result satisfactory. Here are some possibilities. I could include the full version number, including my local patch number, like this: GNU gdb (My Distro 13.1.5) 13.1 I don't like this because of the duplication. I could drop the upstream version number, like this: GNU gdb (My Distro 5) 13.1 But I don't like this because it (IMHO) can lead to confusion, is this GDB version 5? Version 13.1? I think this can potentially cause confusion for a user. I propose that a far better solution is to add a new configure option that will allow me to attach additional content at the end of the version string, like this: GNU gdb (My Distro) 13.1.5 This, I think, is much clearer. To support this I propose adding a new configure option, --with-pkgversion-suffix. This option takes a string, which is then appended to the version number. And so, we now configure like this: $ ../src/configure --with-pkgversion="My Distro" \ --with-pkgversion-suffix=".xx.yy" And we now get the desired version output from both GDB and GDBServer: $ gdb --version GNU gdb (My Distro) 13.1.xx.yy $ gdbserver --version GNU gdbserver (My Distro) 13.1.xx.yy Obviously, the new configure option is optional. When it is not used the suffix defaults to the empty string, so GDB's output will be unchanged. --- gdb/acinclude.m4 | 3 +++ gdb/config.in | 3 +++ gdb/configure | 27 +++++++++++++++++++++++++-- gdb/configure.ac | 2 ++ gdb/top.c | 3 ++- gdbserver/acinclude.m4 | 3 +++ gdbserver/config.in | 3 +++ gdbserver/configure | 23 +++++++++++++++++++++++ gdbserver/configure.ac | 2 ++ gdbserver/server.cc | 4 ++-- gdbsupport/pkgversion-suffix.m4 | 33 +++++++++++++++++++++++++++++++++ 11 files changed, 101 insertions(+), 5 deletions(-) create mode 100644 gdbsupport/pkgversion-suffix.m4 base-commit: db2e277d1a840091f56185d94f9d39c6736d2556 diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4 index 62fa66c7af3..f9812c182eb 100644 --- a/gdb/acinclude.m4 +++ b/gdb/acinclude.m4 @@ -21,6 +21,9 @@ m4_include(../gdbsupport/compiler-type.m4) # This gets AM_GDB_WARNINGS. m4_include(../gdbsupport/warning.m4) +dnl This gets GDB_PKGVERSION_SUFFIX. +m4_include(../gdbsupport/pkgversion-suffix.m4) + # AM_GDB_UBSAN m4_include(sanitize.m4) diff --git a/gdb/config.in b/gdb/config.in index 736e6be1c48..163e780aa7f 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -642,6 +642,9 @@ /* Additional package description */ #undef PKGVERSION +/* A string to append to the version number */ +#undef PKGVERSION_SUFFIX + /* Define to 1 if the "%H, %D and %DD" formats work to print decfloats. */ #undef PRINTF_HAS_DECFLOAT diff --git a/gdb/configure b/gdb/configure index b54ac671fe3..65caca4bdf5 100755 --- a/gdb/configure +++ b/gdb/configure @@ -923,6 +923,7 @@ enable_profiling enable_codesign with_pkgversion with_bugurl +with_pkgversion_suffix with_system_zlib with_zstd enable_rpath @@ -1682,6 +1683,8 @@ Optional Packages: library --with-pkgversion=PKG Use PKG in the version string in place of "GDB" --with-bugurl=URL Direct users to URL to report a bug + --with-pkgversion-suffix=STRING + Append STRING to the end of the version number --with-system-zlib use installed libz --with-zstd support zstd compressed debug sections (default=auto) @@ -11451,7 +11454,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11454 "configure" +#line 11457 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11557,7 +11560,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11560 "configure" +#line 11563 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -16997,6 +17000,26 @@ cat >>confdefs.h <<_ACEOF _ACEOF + + +# Check whether --with-pkgversion-suffix was given. +if test "${with_pkgversion_suffix+set}" = set; then : + withval=$with_pkgversion_suffix; case "$withval" in + yes) as_fn_error $? "version suffix not specified" "$LINENO" 5 ;; + no) PKGVERSION_SUFFIX= ;; + *) PKGVERSION_SUFFIX="$withval" ;; + esac +else + PKGVERSION_SUFFIX="" +fi + + +cat >>confdefs.h <<_ACEOF +#define PKGVERSION_SUFFIX "$PKGVERSION_SUFFIX" +_ACEOF + + + # --------------------- # # Checks for programs. # # --------------------- # diff --git a/gdb/configure.ac b/gdb/configure.ac index 12561d4d2de..eaa79c6701a 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -427,6 +427,8 @@ ACX_BUGURL([https://www.gnu.org/software/gdb/bugs/]) AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"], [Additional package description]) AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"], [Bug reporting address]) +GDB_PKGVERSION_SUFFIX + # --------------------- # # Checks for programs. # # --------------------- # diff --git a/gdb/top.c b/gdb/top.c index e9794184f07..9ead29be033 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -1444,7 +1444,8 @@ print_gdb_version (struct ui_file *stream, bool interactive) program to parse, and is just canonical program name and version number, which starts after last space. */ - std::string v_str = string_printf ("GNU gdb %s%s", PKGVERSION, version); + std::string v_str = string_printf ("GNU gdb %s%s%s", PKGVERSION, version, + PKGVERSION_SUFFIX); gdb_printf (stream, "%ps\n", styled_string (version_style.style (), v_str.c_str ())); diff --git a/gdbserver/acinclude.m4 b/gdbserver/acinclude.m4 index 32d5d14ca6e..d49e606a88f 100644 --- a/gdbserver/acinclude.m4 +++ b/gdbserver/acinclude.m4 @@ -13,6 +13,9 @@ m4_include(../gdbsupport/compiler-type.m4) dnl This gets AM_GDB_WARNINGS. m4_include(../gdbsupport/warning.m4) +dnl This gets GDB_PKGVERSION_SUFFIX. +m4_include(../gdbsupport/pkgversion-suffix.m4) + dnl codeset.m4 is needed for common.m4, but not for dnl anything else in gdbserver. m4_include(../config/codeset.m4) diff --git a/gdbserver/config.in b/gdbserver/config.in index 39ddc7c0edb..14414ff4ffa 100644 --- a/gdbserver/config.in +++ b/gdbserver/config.in @@ -402,6 +402,9 @@ /* Additional package description */ #undef PKGVERSION +/* A string to append to the version number */ +#undef PKGVERSION_SUFFIX + /* Define to 1 if the "%ll" format works to print long longs. */ #undef PRINTF_HAS_LONG_LONG diff --git a/gdbserver/configure b/gdbserver/configure index 050264ed7da..0644a058d76 100755 --- a/gdbserver/configure +++ b/gdbserver/configure @@ -761,6 +761,7 @@ enable_build_warnings enable_gdb_build_warnings with_pkgversion with_bugurl +with_pkgversion_suffix with_libthread_db enable_inprocess_agent ' @@ -1425,6 +1426,8 @@ Optional Packages: --with-ust-lib=PATH Specify the directory for the installed UST library --with-pkgversion=PKG Use PKG in the version string in place of "GDB" --with-bugurl=URL Direct users to URL to report a bug + --with-pkgversion-suffix=STRING + Append STRING to the end of the version number --with-libthread-db=PATH use given libthread_db directly @@ -10276,6 +10279,26 @@ cat >>confdefs.h <<_ACEOF _ACEOF + + +# Check whether --with-pkgversion-suffix was given. +if test "${with_pkgversion_suffix+set}" = set; then : + withval=$with_pkgversion_suffix; case "$withval" in + yes) as_fn_error $? "version suffix not specified" "$LINENO" 5 ;; + no) PKGVERSION_SUFFIX= ;; + *) PKGVERSION_SUFFIX="$withval" ;; + esac +else + PKGVERSION_SUFFIX="" +fi + + +cat >>confdefs.h <<_ACEOF +#define PKGVERSION_SUFFIX "$PKGVERSION_SUFFIX" +_ACEOF + + + # Check for various supplementary target information (beyond the # triplet) which might affect the choices in configure.srv. case "${target}" in diff --git a/gdbserver/configure.ac b/gdbserver/configure.ac index dc33f1a235b..d53ea96316f 100644 --- a/gdbserver/configure.ac +++ b/gdbserver/configure.ac @@ -194,6 +194,8 @@ ACX_BUGURL([http://www.gnu.org/software/gdb/bugs/]) AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"], [Additional package description]) AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"], [Bug reporting address]) +GDB_PKGVERSION_SUFFIX + # Check for various supplementary target information (beyond the # triplet) which might affect the choices in configure.srv. case "${target}" in diff --git a/gdbserver/server.cc b/gdbserver/server.cc index aaef38e0062..c76edae08f2 100644 --- a/gdbserver/server.cc +++ b/gdbserver/server.cc @@ -3412,12 +3412,12 @@ handle_status (char *own_buf) static void gdbserver_version (void) { - printf ("GNU gdbserver %s%s\n" + printf ("GNU gdbserver %s%s%s\n" "Copyright (C) 2022 Free Software Foundation, Inc.\n" "gdbserver is free software, covered by the " "GNU General Public License.\n" "This gdbserver was configured as \"%s\"\n", - PKGVERSION, version, host_name); + PKGVERSION, version, PKGVERSION_SUFFIX, host_name); } static void diff --git a/gdbsupport/pkgversion-suffix.m4 b/gdbsupport/pkgversion-suffix.m4 new file mode 100644 index 00000000000..f05ac495ab3 --- /dev/null +++ b/gdbsupport/pkgversion-suffix.m4 @@ -0,0 +1,33 @@ +dnl Autoconf configure script for GDB, the GNU debugger. +dnl Copyright (C) 2022 Free Software Foundation, Inc. +dnl +dnl This file is part of GDB. +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 . + +dnl Add support for the --with-pkgversion-suffix configure option. Allows +dnl the user to specify a string that is appended to the version number. +AC_DEFUN([GDB_PKGVERSION_SUFFIX],[ + AC_ARG_WITH(pkgversion-suffix, + AS_HELP_STRING([--with-pkgversion-suffix=STRING], + [Append STRING to the end of the version number]), + [case "$withval" in + yes) AC_MSG_ERROR([version suffix not specified]) ;; + no) PKGVERSION_SUFFIX= ;; + *) PKGVERSION_SUFFIX="$withval" ;; + esac], + PKGVERSION_SUFFIX="") + AC_DEFINE_UNQUOTED([PKGVERSION_SUFFIX], ["$PKGVERSION_SUFFIX"], + [A string to append to the version number]) +])