[patch] make --disable-gdbmi work

Aleksandar Ristovski
2008-01-31T20:51:02Z

[-- Attachment #1: Type: text/plain, Size: 1031 bytes --]

Hello,

I have attempted to create a 'minimal' gdb. I used the following configure
options (linux host, native):

--disable-gdbmi --disable-sim --disable-tui --disable-gdbtk

but it fails to build due to some unnecessary dependencies.

The attached patch fixes the problem.

There are other possible decoupling to be done. For example, there are a few
changes needed to make REMOTE_OBS optional (or at least some of the files listed
in it).

Thanks,
Aleksandar Ristovski
QNX Software Systems

ChangeLog:

2008-01-31 Aleksandar Ristovski <aristovski@qnx.com>

* Makefile.in (SUBDIR_MI_OBJS): Removed mi-common.o from the list.
(SUBDIR_MI_SRCS): Removed mi-common.c from the list.
(async_h, async.o): Added.
(mi_common_h, mi-common-o): Removed.
(COMMON_OBS): Added async.o.
* async.c: New file. Content is copied from mi-common.c.
* async.h: New file. Content is copied from mi-common.h.
* breakpoint.c: Include async.h instead mi-common.h.
* infrun.c: Likewise.
* mi-common.c: Removed.
* mi-common.h: Removed.

[-- Attachment #2: disable-gdbmi.diff --]
[-- Type: text/plain, Size: 10250 bytes --]

diff -x CVS -up -N -r clean/gdb/Makefile.in src/gdb/Makefile.in
--- clean/gdb/Makefile.in 2008-01-30 02:17:31.000000000 -0500
+++ src/gdb/Makefile.in 2008-01-31 10:31:17.000000000 -0500
@@ -186,14 +186,14 @@ SUBDIR_MI_OBS = \
mi-cmds.o mi-cmd-env.o mi-cmd-var.o mi-cmd-break.o mi-cmd-stack.o \
mi-cmd-file.o mi-cmd-disas.o mi-symbol-cmds.o mi-cmd-target.o \
mi-interp.o \
- mi-main.o mi-parse.o mi-getopt.o mi-common.o
+ mi-main.o mi-parse.o mi-getopt.o
SUBDIR_MI_SRCS = \
mi/mi-out.c mi/mi-console.c \
mi/mi-cmds.c mi/mi-cmd-env.c \
mi/mi-cmd-var.c mi/mi-cmd-break.c mi/mi-cmd-stack.c \
mi/mi-cmd-file.c mi/mi-cmd-disas.c mi/mi-symbol-cmds.c \
mi/mi-cmd-target.c mi/mi-interp.c \
- mi/mi-main.c mi/mi-parse.c mi/mi-getopt.c mi/mi-common.c
+ mi/mi-main.c mi/mi-parse.c mi/mi-getopt.c
SUBDIR_MI_DEPS =
SUBDIR_MI_LDFLAGS=
SUBDIR_MI_CFLAGS= \
@@ -588,6 +588,7 @@ TARGET_FLAGS_TO_PASS = \

SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c \
addrmap.c \
+ async.c \
auxv.c ax-general.c ax-gdb.c \
bcache.c \
bfd-target.c \
@@ -729,6 +730,7 @@ annotate_h = annotate.h $(symtab_h) $(gd
arch_utils_h = arch-utils.h
arm_linux_tdep_h = arm-linux-tdep.h
arm_tdep_h = arm-tdep.h
+async_h = async.h
auxv_h = auxv.h
ax_gdb_h = ax-gdb.h
ax_h = ax.h $(doublest_h)
@@ -932,7 +934,6 @@ mi_getopt_h = $(srcdir)/mi/mi-getopt.h
mi_main_h = $(srcdir)/mi/mi-main.h
mi_out_h = $(srcdir)/mi/mi-out.h
mi_parse_h = $(srcdir)/mi/mi-parse.h
-mi_common_h = $(srcdir)/mi/mi-common.h

#
# gdb/tui/ headers
@@ -1072,7 +1073,8 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $
tramp-frame.o \
solib.o solib-null.o \
prologue-value.o memory-map.o xml-support.o \
- target-descriptions.o target-memory.o xml-tdesc.o xml-builtin.o
+ target-descriptions.o target-memory.o xml-tdesc.o xml-builtin.o \
+ async.o

TSOBS = inflow.o

@@ -1921,6 +1923,7 @@ arm-tdep.o: arm-tdep.c $(defs_h) $(frame
arm-wince-tdep.o: arm-wince-tdep.c $(defs_h) $(osabi_h) \
$(gdbcore_h) $(target_h) $(solib_h) $(solib_target_h) \
$(gdb_string_h) $(arm_tdep_h)
+async.o: async.c $(defs_h) $(gdb_assert_h) $(async_h)
auxv.o: auxv.c $(defs_h) $(target_h) $(gdbtypes_h) $(command_h) \
$(inferior_h) $(valprint_h) $(gdb_assert_h) $(auxv_h) \
$(elf_common_h)
@@ -3235,8 +3238,6 @@ mi-parse.o: $(srcdir)/mi/mi-parse.c $(de
mi-symbol-cmds.o: $(srcdir)/mi/mi-symbol-cmds.c $(defs_h) $(mi_cmds_h) \
$(symtab_h) $(ui_out_h)
$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-symbol-cmds.c
-mi-common.o: $(srcdir)/mi/mi-common.c $(defs_h) $(mi_common_h)
- $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-common.c

#
# gdb/signals/ dependencies
diff -x CVS -up -N -r clean/gdb/async.c src/gdb/async.c
--- clean/gdb/async.c 1969-12-31 19:00:00.000000000 -0500
+++ src/gdb/async.c 2008-01-31 10:33:51.000000000 -0500
@@ -0,0 +1,46 @@
+/* Implementation of common async functions.
+ Copyright (C) 2005, 2007, 2008 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include "defs.h"
+#include "async.h"
+#include "gdb_assert.h"
+
+static const char * const async_reason_string_lookup[] =
+{
+ "breakpoint-hit",
+ "watchpoint-trigger",
+ "read-watchpoint-trigger",
+ "access-watchpoint-trigger",
+ "function-finished",
+ "location-reached",
+ "watchpoint-scope",
+ "end-stepping-range",
+ "exited-signalled",
+ "exited",
+ "exited-normally",
+ "signal-received",
+ NULL
+};
+
+const char *
+async_reason_lookup (enum async_reply_reason reason)
+{
+ gdb_assert (ARRAY_SIZE (async_reason_string_lookup) == EXEC_ASYNC_LAST + 1);
+ return async_reason_string_lookup[reason];
+}
+
diff -x CVS -up -N -r clean/gdb/async.h src/gdb/async.h
--- clean/gdb/async.h 1969-12-31 19:00:00.000000000 -0500
+++ src/gdb/async.h 2008-01-31 10:34:15.000000000 -0500
@@ -0,0 +1,44 @@
+/* Interface for common async routines.
+ Copyright (C) 2005, 2007, 2008 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef ASYNC_H
+#define ASYNC_H
+
+/* Represents the reason why GDB is sending an asynchronous command to the
+ front end. NOTE: When modifing this, don't forget to update gdb.texinfo! */
+enum async_reply_reason
+{
+ EXEC_ASYNC_BREAKPOINT_HIT = 0,
+ EXEC_ASYNC_WATCHPOINT_TRIGGER,
+ EXEC_ASYNC_READ_WATCHPOINT_TRIGGER,
+ EXEC_ASYNC_ACCESS_WATCHPOINT_TRIGGER,
+ EXEC_ASYNC_FUNCTION_FINISHED,
+ EXEC_ASYNC_LOCATION_REACHED,
+ EXEC_ASYNC_WATCHPOINT_SCOPE,
+ EXEC_ASYNC_END_STEPPING_RANGE,
+ EXEC_ASYNC_EXITED_SIGNALLED,
+ EXEC_ASYNC_EXITED,
+ EXEC_ASYNC_EXITED_NORMALLY,
+ EXEC_ASYNC_SIGNAL_RECEIVED,
+ /* This is here only to represent the number of enums. */
+ EXEC_ASYNC_LAST
+};
+
+const char *async_reason_lookup (enum async_reply_reason reason);
+
+#endif
diff -x CVS -up -N -r clean/gdb/breakpoint.c src/gdb/breakpoint.c
--- clean/gdb/breakpoint.c 2008-01-29 12:52:47.000000000 -0500
+++ src/gdb/breakpoint.c 2008-01-31 09:24:26.000000000 -0500
@@ -56,7 +56,7 @@
#include "top.h"

#include "gdb-events.h"
-#include "mi/mi-common.h"
+#include "async.h"

/* Prototypes for local functions. */

diff -x CVS -up -N -r clean/gdb/infrun.c src/gdb/infrun.c
--- clean/gdb/infrun.c 2008-01-29 17:47:19.000000000 -0500
+++ src/gdb/infrun.c 2008-01-31 09:24:42.000000000 -0500
@@ -47,7 +47,7 @@
#include "main.h"

#include "gdb_assert.h"
-#include "mi/mi-common.h"
+#include "async.h"

/* Prototypes for local functions */

diff -x CVS -up -N -r clean/gdb/mi/mi-common.c src/gdb/mi/mi-common.c
--- clean/gdb/mi/mi-common.c 2008-01-01 17:53:14.000000000 -0500
+++ src/gdb/mi/mi-common.c 1969-12-31 19:00:00.000000000 -0500
@@ -1,51 +0,0 @@
-/* Interface for common GDB/MI data
- Copyright (C) 2005, 2007, 2008 Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include "defs.h"
-#include "mi-common.h"
-
-static const char * const async_reason_string_lookup[] =
-{
- "breakpoint-hit",
- "watchpoint-trigger",
- "read-watchpoint-trigger",
- "access-watchpoint-trigger",
- "function-finished",
- "location-reached",
- "watchpoint-scope",
- "end-stepping-range",
- "exited-signalled",
- "exited",
- "exited-normally",
- "signal-received",
- NULL
-};
-
-const char *
-async_reason_lookup (enum async_reply_reason reason)
-{
- return async_reason_string_lookup[reason];
-}
-
-void
-_initialize_gdb_mi_common (void)
-{
- if (ARRAY_SIZE (async_reason_string_lookup) != EXEC_ASYNC_LAST + 1)
- internal_error (__FILE__, __LINE__,
- _("async_reason_string_lookup is inconsistent"));
-}
diff -x CVS -up -N -r clean/gdb/mi/mi-common.h src/gdb/mi/mi-common.h
--- clean/gdb/mi/mi-common.h 2008-01-01 17:53:14.000000000 -0500
+++ src/gdb/mi/mi-common.h 1969-12-31 19:00:00.000000000 -0500
@@ -1,44 +0,0 @@
-/* Interface for common GDB/MI data
- Copyright (C) 2005, 2007, 2008 Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef MI_COMMON_H
-#define MI_COMMON_H
-
-/* Represents the reason why GDB is sending an asynchronous command to the
- front end. NOTE: When modifing this, don't forget to update gdb.texinfo! */
-enum async_reply_reason
-{
- EXEC_ASYNC_BREAKPOINT_HIT = 0,
- EXEC_ASYNC_WATCHPOINT_TRIGGER,
- EXEC_ASYNC_READ_WATCHPOINT_TRIGGER,
- EXEC_ASYNC_ACCESS_WATCHPOINT_TRIGGER,
- EXEC_ASYNC_FUNCTION_FINISHED,
- EXEC_ASYNC_LOCATION_REACHED,
- EXEC_ASYNC_WATCHPOINT_SCOPE,
- EXEC_ASYNC_END_STEPPING_RANGE,
- EXEC_ASYNC_EXITED_SIGNALLED,
- EXEC_ASYNC_EXITED,
- EXEC_ASYNC_EXITED_NORMALLY,
- EXEC_ASYNC_SIGNAL_RECEIVED,
- /* This is here only to represent the number of enums. */
- EXEC_ASYNC_LAST
-};
-
-const char *async_reason_lookup (enum async_reply_reason reason);
-
-#endif