public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
From: Mikhail Teterin <mi+mx@aldan.algebra.com>
To: insight@sourceware.org, gdb-patches@sources.redhat.com
Subject: Single-executable patch
Date: Wed, 17 May 2006 19:03:00 -0000	[thread overview]
Message-ID: <200605171502.18798.mi+mx@aldan.algebra.com> (raw)
In-Reply-To: <446B6AE7.7030200@redhat.com>

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

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

[-- Attachment #2: patch-unified --]
[-- Type: text/x-diff, Size: 661 bytes --]

--- 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 <libgen.h>
 
 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);
 }

  parent reply	other threads:[~2006-05-17 19:03 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-17  2:02 Questioning the withdom of bundling gdb and insight Mikhail Teterin
2006-05-17 14:31 ` Keith Seitz
2006-05-17 17:50   ` Mikhail Teterin
2006-05-17 17:57     ` Dave Korn
     [not found]   ` <200605171330.50762.mi+mx@aldan.algebra.com>
2006-05-17 17:53     ` Does insight work? Keith Seitz
2006-05-17 18:06       ` Mikhail Teterin
2006-05-17 18:08         ` Keith Seitz
2006-05-17 18:15           ` Mikhail Teterin
2006-05-17 18:27             ` Keith Seitz
2006-05-17 18:41               ` Mikhail Teterin
2006-05-17 19:03               ` Mikhail Teterin [this message]
2006-05-17 19:07                 ` Single-executable patch Daniel Jacobowitz
2006-05-17 19:28                   ` Mikhail Teterin
2006-05-17 19:35                     ` Daniel Jacobowitz
2006-05-17 20:32                 ` Eli Zaretskii
     [not found]   ` <200605171337.30938.mi+mx@aldan.algebra.com>
2006-05-17 17:55     ` Questioning the withdom of bundling gdb and insight Keith Seitz
2006-05-17 18:11       ` Mikhail Teterin
2006-05-17 18:20         ` Keith Seitz
2006-05-17 18:31           ` Mikhail Teterin
2007-06-29  0:56   ` Mikhail Teterin

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=200605171502.18798.mi+mx@aldan.algebra.com \
    --to=mi+mx@aldan.algebra.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=insight@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).