This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix GDB build when using --disable-gdbmi


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]