From: Simon Marchi <simon.marchi@efficios.com>
To: gdb-patches@sourceware.org
Cc: Tom de Vries <tdevries@suse.de>,
Simon Marchi <simon.marchi@efficios.com>
Subject: [PATCH] Fix GDB build when using --disable-gdbmi
Date: Fri, 10 May 2019 18:35:00 -0000 [thread overview]
Message-ID: <20190510183512.9955-1-simon.marchi@efficios.com> (raw)
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<ui_out_emit_tuple> 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 <sys/procfs.h> 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
--
2.21.0
next reply other threads:[~2019-05-10 18:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-10 18:35 Simon Marchi [this message]
2019-05-10 18:48 ` Tom Tromey
2019-05-10 18:57 ` Simon Marchi
2019-05-10 19:11 ` Tom Tromey
2019-05-10 20:19 ` Simon Marchi
2019-05-10 21:16 ` Tom Tromey
2019-05-10 22:07 ` Simon Marchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190510183512.9955-1-simon.marchi@efficios.com \
--to=simon.marchi@efficios.com \
--cc=gdb-patches@sourceware.org \
--cc=tdevries@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox