This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: Patch: rename to `insight'
- To: tromey at cygnus dot com
- Subject: Re: Patch: rename to `insight'
- From: Eli Zaretskii <eliz at delorie dot com>
- Date: Wed, 29 Nov 2000 03:38:05 -0500 (EST)
- CC: gdb-patches at sources dot redhat dot com
- References: <87u28r7niz.fsf@creche.cygnus.com>
- Reply-to: Eli Zaretskii <eliz at is dot elta dot co dot il>
> From: Tom Tromey <tromey@cygnus.com>
> Date: 28 Nov 2000 15:13:56 -0700
>
> Instead of a pure rename, I came up with the appended patch. If
> Insight is enabled, this will create a small shell script named
> `insight' which will run insight.
I would suggest to consider a short C program instead of a shell
script, for portability's sake. Shell scripts are not very portable
to non-Posix platforms. See below.
> --- Makefile.in 2000/11/10 23:02:56 1.47
> +++ Makefile.in 2000/11/28 21:59:12
> @@ -1308,7 +1314,7 @@
> # FIXME: cagney/2000-03-27: Post 5.0 this link code can be removed.
> # It should now be possible to run GDBtk from the build directory
> # without the link in place.
> -all-gdbtk:
> +all-gdbtk: insight
> @if test ! -d gdbtcl/images ; then \
> if test "$(LN_S)" = "ln -s" ; then \
> echo linking ${srcdir}/gdbtk/library to gdbtcl ; \
> @@ -1334,11 +1340,32 @@
> $(SHELL) $(srcdir)/../mkinstalldirs $(datadir)/gdbtcl/help \
> $(datadir)/gdbtcl/help/images \
> $(datadir)/gdbtcl/help/trace ; \
> + $(SHELL) $(srcdir)/../mkinstalldirs $(bindir)
Shouldn't this say "-$(SHELL)", in case $(bindir) already exists?
> +insight: $(srcdir)/insight.in
> + transformed_name=`t='$(program_transform_name)'; \
> + echo gdb | sed -e $$t` ; \
> + if test "x$$transformed_name" = x; then \
> + transformed_name=gdb ; \
> + else \
> + true ; \
> + fi ; \
> + sed -e "s,\@gdb\@,$$transformed_name," -e 's,\@bindir\@,$(bindir),' \
> + < $(srcdir)/insight.in > insight \
> + && chmod +x insight
This assumes that the distribution is not moved once installed. That
might be true on a typical Unix system (even there you might have
problems with CD-ROM distributions), but it will make lots of problems
on DOS/Windows systems, where a precompiled binary is usually
installed into a directory that has nothing to do with the original
installation at "make install" time.
Why not simply invoke "gdb" and let PATH do its thing? Or at least
try that before falling back on the installation directory?
> +# Try to pick up gdb from the same directory as insight.
> +path="`echo $0 | sed -e 's,/[^/]*$,,'`"
This doesn't work with DOS/Windows-style file names with backslashes.
> +if test -n "$path"; then
> + exe="$path/$gdb"
> +else
> + exe="$bindir/$gdb"
> +fi
> +exec $exe -w ${1+"$@"}
I'm not sure this will DTRT with all DOS/Windows ports of Unixy
shells. I suggest to use "gdb.exe" on those platfrms (better safe
than sorry).
Writing a short C program would eliminate all these problems (and also
avoid requiring users to have a ported shell on their machines).
That's why I suggested that in the first place.