From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15795 invoked by alias); 21 Dec 2011 11:47:10 -0000 Received: (qmail 15786 invoked by uid 22791); 21 Dec 2011 11:47:09 -0000 X-SWARE-Spam-Status: No, hits=-7.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_BT,TW_DB X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 21 Dec 2011 11:46:47 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id pBLBklVJ008447 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 21 Dec 2011 06:46:47 -0500 Received: from host2.jankratochvil.net (ovpn-116-60.ams2.redhat.com [10.36.116.60]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id pBLBkgbQ010881 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Wed, 21 Dec 2011 06:46:44 -0500 Date: Wed, 21 Dec 2011 11:47:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Cc: Sergio Durigan , Kai Tietz Subject: [patch 1/2] Make gdbtui a shell script Message-ID: <20111221114641.GB25652@host2.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-12/txt/msg00716.txt.bz2 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 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 . + +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 . */ - -#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); -}