From patchwork Fri May 10 18:35:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 32638 Received: (qmail 43062 invoked by alias); 10 May 2019 18:35:34 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 43052 invoked by uid 89); 10 May 2019 18:35:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=HDKIM-Filter:v2.10.3, H*r:sk:mail02. X-HELO: mail.efficios.com Received: from mail.efficios.com (HELO mail.efficios.com) (167.114.142.138) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 10 May 2019 18:35:24 +0000 Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id DD73E1E2BD2; Fri, 10 May 2019 14:35:21 -0400 (EDT) Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id 07_ZrjqwzBa6; Fri, 10 May 2019 14:35:19 -0400 (EDT) Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id 2502F1E2BCE; Fri, 10 May 2019 14:35:19 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 2502F1E2BCE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1557513319; bh=bAT+xCgLYg0x4azGQQnsM0fOMTok14MtHET/moqqBtE=; h=From:To:Date:Message-Id:MIME-Version; b=jbXdsA78B/a9rud9ZDMxtI9HGg+jN6WPDP01TQuH2oGP2asSGBJz3Jfm7IEkQ/yRs vK5duF80k4f8H4y4WZfzh0AmsRDdscbZqcU9SFbsLPjQUTnluXNa1HN165wa3xRWjt QN7Gjo10xt60beeJ9k8kt863vCX/obZG68jvEPxQW5MudmAyoho+FSCOC7mkjF+k/a 53ST7n29czYFvUMc4xJo4S5H/BGL9ZbgU5XVJwlRDQKgwWq5aIBGiCqo1bjyLzmSAX nvaGYr1lwIqHqkYoyaLvOD6ANagPz7SK73+7NsH0R0Fyc7H9tCXQsBO7gadYL2PTw/ fdL2VbyXyoJwg== Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10026) with ESMTP id QCA5TFUmMMRd; Fri, 10 May 2019 14:35:19 -0400 (EDT) Received: from smarchi-efficios.internal.efficios.com (192-222-157-41.qc.cable.ebox.net [192.222.157.41]) by mail.efficios.com (Postfix) with ESMTPSA id 014001E2BC9; Fri, 10 May 2019 14:35:18 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Tom de Vries , Simon Marchi Subject: [PATCH] Fix GDB build when using --disable-gdbmi Date: Fri, 10 May 2019 14:35:12 -0400 Message-Id: <20190510183512.9955-1-simon.marchi@efficios.com> MIME-Version: 1.0 Since commit b4be1b064860 ("Fix MI output for multi-location breakpoints") we get this error when building with --disable-gdbmi: CXXLD gdb /home/smarchi/src/binutils-gdb/gdb/breakpoint.c:6358: error: undefined reference to 'mi_multi_location_breakpoint_output_fixed(ui_out*)' This is due to breakpoint.c using a function defined in mi/mi-main.c, even though mi/mi-main.c isn't included in the build. To fix it, I added a config.h macro, HAVE_GDBMI, defined if we build with GDB/MI support. We can then use it in breakpoint.c to conditionally use mi_multi_location_breakpoint_output_fixed. If building without GDB/MI, the value of use_fixed_output is not really important, as it is only used to fix an issue when printing breakpoints in MI. gdb/ChangeLog: * configure.ac: Define HAVE_GDBMI if building with GDB/MI support. * configure, config.in: Re-generate. * breakpoint.c (print_one_breakpoint): Use mi_multi_location_breakpoint_output_fixed only if HAVE_GDBMI is defined. --- gdb/breakpoint.c | 7 ++++++- gdb/config.in | 3 +++ gdb/configure | 3 +++ gdb/configure.ac | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index f6d2f36d0a40..8f75c7658080 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -6355,7 +6355,12 @@ print_one_breakpoint (struct breakpoint *b, int allflag) { struct ui_out *uiout = current_uiout; - bool use_fixed_output = mi_multi_location_breakpoint_output_fixed (uiout); + bool use_fixed_output +#ifdef HAVE_GDBMI + = mi_multi_location_breakpoint_output_fixed (uiout); +#else + = true; +#endif gdb::optional bkpt_tuple_emitter (gdb::in_place, uiout, "bkpt"); print_one_breakpoint_location (b, NULL, 0, last_loc, allflag); diff --git a/gdb/config.in b/gdb/config.in index c0291fbd9c53..e5a19bda6bd6 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -174,6 +174,9 @@ /* Define if has fpregset_t. */ #undef HAVE_FPREGSET_T +/* Define to 1 if building with GDB/MI support. */ +#undef HAVE_GDBMI + /* Define to 1 if you have the `getauxval' function. */ #undef HAVE_GETAUXVAL diff --git a/gdb/configure b/gdb/configure index 15a96afcca8a..ca797473bfc1 100755 --- a/gdb/configure +++ b/gdb/configure @@ -6825,6 +6825,9 @@ if test x"$enable_gdbmi" = xyes; then CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_MI_DEPS)" CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_MI_SRCS)" ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_MI_CFLAGS)" + +$as_echo "#define HAVE_GDBMI 1" >>confdefs.h + fi fi diff --git a/gdb/configure.ac b/gdb/configure.ac index 1318c8d00873..66f72c5158d4 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -315,6 +315,7 @@ if test x"$enable_gdbmi" = xyes; then CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_MI_DEPS)" CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_MI_SRCS)" ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_MI_CFLAGS)" + AC_DEFINE([HAVE_GDBMI], 1, [Define to 1 if building with GDB/MI support.]) fi fi