Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Cc: Sergio Durigan <sdurigan@redhat.com>, Kai Tietz <ktietz@redhat.com>
Subject: [patch 1/2] Make gdbtui a shell script
Date: Wed, 21 Dec 2011 11:47:00 -0000	[thread overview]
Message-ID: <20111221114641.GB25652@host2.jankratochvil.net> (raw)

Hi,

it is discussed for years it is not great to have almost the same gdb and
gdbtui binaries, each ~5MB.  Make gdbtui a shell script.

I am not so sure how well is the shell script portable across Unices.
I assume MinGW is out of question anyway but that may not be a concern.

Fedora has been using gdb<->gdbtui hardlink but according to Tom argv[0]
should not be used.  GNU Coding Standards IMO do not say exactly this thing.


Thanks,
Jan


gdb/
2011-12-21  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Replace gdbtui binary by a shell script.
	* Makefile.in (INSTALL_SCRIPT): New variable.
	(SUBDIR_TUI_OBS): Remove tui-main.o.
	(SUBDIR_TUI_SRCS): Remove tui/tui-main.c.
	(all-tui): Remove its $(TUI)$(EXEEXT) dependency.
	(install-tui): Change INSTALL_PROGRAM to INSTALL_SCRIPT, add .sh to
	source $(TUI) and remove $(EXEEXT) from the target.
	(uninstall-tui): Remove $(EXEEXT) from the target.
	($(TUI)$(EXEEXT)): Remove.
	(clean-tui): Remove its only recipe.
	(tui-main.o): Remove.
	(all_object_files): Remove tui-main.o.
	* gdbtui.sh: New file.
	* tui/tui-main.c: Remove.

--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -59,6 +59,7 @@ LN_S = @LN_S@
 INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
 
 DESTDIR =
 
@@ -237,7 +238,6 @@ SUBDIR_TUI_OBS = \
 	tui-io.o \
 	tui-layout.o \
 	tui-out.o \
-	tui-main.o \
 	tui-regs.o \
 	tui-source.o \
 	tui-stack.o \
@@ -256,7 +256,6 @@ SUBDIR_TUI_SRCS = \
 	tui/tui-interp.c \
 	tui/tui-io.c \
 	tui/tui-layout.c \
-	tui/tui-main.c \
 	tui/tui-out.c \
 	tui/tui-regs.c \
 	tui/tui-source.c \
@@ -961,7 +960,7 @@ generated_files = config.h observer.h observer.inc ada-lex.c jit-reader.h \
 all: gdb$(EXEEXT) $(CONFIG_ALL)
 	@$(MAKE) $(FLAGS_TO_PASS) DO=all "DODIRS=`echo $(SUBDIRS) | sed 's/testsuite//'`" subdir_do
 .PHONY: all-tui
-all-tui: $(TUI)$(EXEEXT)
+all-tui:
 
 installcheck:
 
@@ -1050,8 +1049,8 @@ install-tui:
 		  true ; \
 		fi ; \
 		$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(bindir) ; \
-		$(INSTALL_PROGRAM) $(TUI)$(EXEEXT) \
-			$(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) ; \
+		$(INSTALL_SCRIPT) $(TUI).sh \
+			$(DESTDIR)$(bindir)/$$transformed_name ; \
 		$(SHELL) $(srcdir)/../mkinstalldirs \
 			$(DESTDIR)$(man1dir) ; \
 		$(INSTALL_DATA) $(srcdir)/gdb.1 \
@@ -1080,7 +1079,7 @@ uninstall-tui:
 		else \
 		  true ; \
 		fi ; \
-		rm -f $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) \
+		rm -f $(DESTDIR)$(bindir)/$$transformed_name \
 		      $(DESTDIR)$(man1dir)/$$transformed_name.1
 
 # The C++ name parser can be built standalone for testing.
@@ -1185,12 +1184,6 @@ gdb$(EXEEXT): gdb.o libgdb.a $(ADD_DEPS) $(CDEPS) $(TDEPLIBS)
 		-o gdb$(EXEEXT) gdb.o libgdb.a \
 		$(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS) $(LOADLIBES)
 
-$(TUI)$(EXEEXT): tui-main.o libgdb.a $(ADD_DEPS) $(CDEPS) $(TDEPLIBS)
-	rm -f $(TUI)$(EXEEXT)
-	$(CC_LD) $(INTERNAL_LDFLAGS) $(WIN32LDAPP) \
-		-o $(TUI)$(EXEEXT) tui-main.o libgdb.a \
-		$(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS) $(LOADLIBES)
-
 # Convenience rule to handle recursion.
 $(LIBGNU) $(GNULIB_H): all-lib
 all-lib: gnulib/Makefile
@@ -1253,7 +1246,6 @@ clean mostlyclean: $(CONFIG_CLEAN)
 
 .PHONY: clean-tui
 clean-tui:
-	rm -f $(TUI)$(EXEEXT)
 
 # This used to depend on c-exp.c m2-exp.c TAGS
 # I believe this is wrong; the makefile standards for distclean just
@@ -2020,10 +2012,6 @@ tui-layout.o: $(srcdir)/tui/tui-layout.c
 	$(COMPILE) $(srcdir)/tui/tui-layout.c
 	$(POSTCOMPILE)
 
-tui-main.o: $(srcdir)/tui/tui-main.c
-	$(COMPILE) $(srcdir)/tui/tui-main.c
-	$(POSTCOMPILE)
-
 tui-out.o: $(srcdir)/tui/tui-out.c
 	$(COMPILE) $(srcdir)/tui/tui-out.c
 	$(POSTCOMPILE)
@@ -2205,7 +2193,7 @@ py-value.o: $(srcdir)/python/py-value.c
 
 # A list of all the objects we might care about in this build, for
 # dependency tracking.
-all_object_files = gdb.o tui-main.o $(LIBGDB_OBS) gdbtk-main.o \
+all_object_files = gdb.o $(LIBGDB_OBS) gdbtk-main.o \
 	test-cp-name-parser.o
 
 # Ensure that generated files are created early.  Use order-only
--- /dev/null
+++ b/gdb/gdbtui.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+#
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# 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/>.
+
+if [ "${0%/*}" != "$0" ]
+then
+  exec "${0%/*}/gdb" --tui "$@"
+else
+  exec gdb --tui "$@"
+fi
--- a/gdb/tui/tui-main.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Main function for TUI gdb.
-
-   Copyright (C) 2002, 2004, 2007, 2008, 2009, 2010, 2011
-   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 "main.h"
-#include "gdb_string.h"
-#include "interps.h"
-
-int
-main (int argc, char **argv)
-{
-  struct captured_main_args args;
-
-  memset (&args, 0, sizeof args);
-  args.argc = argc;
-  args.argv = argv;
-  args.use_windows = 0;
-  args.interpreter_p = INTERP_TUI;
-  return gdb_main (&args);
-}


             reply	other threads:[~2011-12-21 11:47 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-21 11:47 Jan Kratochvil [this message]
2011-12-21 12:53 ` Joel Brobecker
2011-12-21 14:25   ` Jan Kratochvil
2011-12-21 14:32     ` Pierre Muller
2011-12-21 14:39       ` Jan Kratochvil
2011-12-21 17:11         ` Joel Brobecker
2011-12-21 18:37         ` Tom Tromey
2011-12-21 23:11           ` [patch 1/2] Drop gdbtui [+doc changes] Jan Kratochvil
2011-12-22  8:11             ` Eli Zaretskii
2011-12-22  9:53               ` Jan Kratochvil
2011-12-22 11:33                 ` Eli Zaretskii
2011-12-22 17:15                   ` Jan Kratochvil
2012-01-02  2:30             ` [commit] " Jan Kratochvil
2012-01-02 13:03               ` Pedro Alves
2012-01-02 13:32                 ` [commit] Fix/revert insight build regression by me [Re: [commit] [patch 1/2] Drop gdbtui [+doc changes]] Jan Kratochvil
2011-12-21 23:39   ` [patch 1/2] Make gdbtui a shell script Stan Shebs
2011-12-22  6:26     ` Joel Brobecker
2011-12-22 10:16       ` [NEWS patch] " Jan Kratochvil
2012-01-01 21:52         ` [commit 7.4] " Jan Kratochvil
2011-12-21 17:26 ` Tom Tromey

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=20111221114641.GB25652@host2.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=ktietz@redhat.com \
    --cc=sdurigan@redhat.com \
    /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