From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4983 invoked by alias); 17 May 2006 19:03:39 -0000 Received: (qmail 4932 invoked by uid 22791); 17 May 2006 19:03:37 -0000 X-Spam-Check-By: sourceware.org Received: from aldan.algebra.com (HELO aldan.algebra.com) (216.254.65.224) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 17 May 2006 19:03:10 +0000 Received: from corbulon.video-collage.com (static-151-204-231-237.bos.east.verizon.net [151.204.231.237]) by aldan.algebra.com (8.13.6/8.13.6) with ESMTP id k4HJ2T5g046790 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 17 May 2006 15:02:30 -0400 (EDT) (envelope-from mi+mx@aldan.algebra.com) Received: from [172.21.130.86] (mx-broadway [38.98.68.18]) by corbulon.video-collage.com (8.13.6/8.13.6) with ESMTP id k4HJ2OaE025864 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 17 May 2006 15:02:24 -0400 (EDT) (envelope-from mi+mx@aldan.algebra.com) From: Mikhail Teterin To: insight@sourceware.org, gdb-patches@sources.redhat.com Subject: Single-executable patch Date: Wed, 17 May 2006 19:03:00 -0000 User-Agent: KMail/1.9.1 References: <200605162201.33772.mi+mx@aldan.algebra.com> <200605171415.24053.mi+mx@aldan.algebra.com> <446B6AE7.7030200@redhat.com> In-Reply-To: <446B6AE7.7030200@redhat.com> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_6M3aEBS/JqZeXJl" Message-Id: <200605171502.18798.mi+mx@aldan.algebra.com> X-Virus-Status: Clean Mailing-List: contact insight-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: insight-owner@sourceware.org X-SW-Source: 2006-q2/txt/msg00038.txt.bz2 --Boundary-00=_6M3aEBS/JqZeXJl Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 640 It seems, all three of the gdb, gdbtui, and insight executables are the same except for their (tiny) main() functions. The attached sample patch allows to install just the gdb and link it to gdbtui and insight -- the program will behave differently depending on the name, under which it is invoked. This saves not only the disk space (3.2Mb per executable here on FreeBSD/amd64 despite using shared -ltcl, -ltk, -litcl, and -litk), but the more precious RAM at runtime too -- when different users run different interfaces on a shared system, the OS will be able to efficiently share the read-only pages between them. Yours, -mi --Boundary-00=_6M3aEBS/JqZeXJl Content-Type: text/x-diff; charset="iso-8859-1"; name="patch-unified" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="patch-unified" Content-length: 661 --- gdb/gdb.c Thu Feb 13 13:07:24 2003 +++ gdb/gdb.c Wed May 17 00:24:39 2006 @@ -23,4 +23,5 @@ #include "gdb_string.h" #include "interps.h" +#include int @@ -31,6 +32,14 @@ args.argc = argc; args.argv = argv; - args.use_windows = 0; - args.interpreter_p = INTERP_CONSOLE; + if (strncmp(basename(argv[0]), "insight", 7) == 0) { + args.use_windows = 1; + args.interpreter_p = "insight"; + } else if (strncmp(basename(argv[0]), "gdbtui", 6) == 0) { + args.use_windows = 0; + args.interpreter_p = INTERP_TUI; + } else { + args.use_windows = 0; + args.interpreter_p = INTERP_CONSOLE; + } return gdb_main (&args); } --Boundary-00=_6M3aEBS/JqZeXJl--