[patch] gdb_gcore man/help/install [+doc]

Jan Kratochvil
2011-04-25T07:42:02Z

Hi,

gcore does not have man page, does not have "-h" help option
https://bugzilla.redhat.com/show_bug.cgi?id=697482 - by Steve Tyler

The ".1.z" rule seems bogus to me, I have found these entries for it:
Wed Nov 13 19:51:11 1991 Steve Chamberlain (sac at cygnus.com)
* Makefile.in, xconfig/delta88 made it install a sysV manual page;
gdb.z into the right place.
Tue Oct 5 15:26:04 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* config/m88k/{delta88.mh,delta88v4.mh}: Remove M_INSTALL and
M_UNINSTALL; it tries to install a non-existent file gdb.z.
I would prefer to just remove it. The only /usr/bin/pack I have is from
allegro which even has a different commandline syntax.

Thanks,
Jan

gdb/
2011-04-25 Jan Kratochvil <jan.kratochvil@redhat.com>

* Makefile.in (INSTALL_SCRIPT): New.
(gdb.z): Rename to ...
(.1.z): ... here and generalize it.
(install-only): Install also gdb_gcore.sh and gdb_gcore.1.
(uninstall): Uninstall also gcore and gcore.1.
* gdb_gcore.1: New file.
* gdb_gcore.sh: Support also -h and --help. Document multiple PIDs.

--- 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 =

@@ -991,10 +992,10 @@ check//%: force
info install-info clean-info dvi pdf install-pdf html install-html: force
@$(MAKE) $(FLAGS_TO_PASS) DO=$@ "DODIRS=$(SUBDIRS)" subdir_do

-gdb.z:gdb.1
- nroff -man $(srcdir)/gdb.1 | col -b > gdb.t
- pack gdb.t ; rm -f gdb.t
- mv gdb.t.z gdb.z
+.1.z:
+ nroff -man $< | col -b > $@.t
+ pack $@.t ; rm -f $@.t
+ mv $@.t.z $@

# Traditionally "install" depends on "all". But it may be useful
# not to; for example, if the user has made some trivial change to a
@@ -1019,6 +1020,20 @@ install-only: $(CONFIG_INSTALL)
$(DESTDIR)$(man1dir) ; \
$(INSTALL_DATA) $(srcdir)/gdb.1 \
$(DESTDIR)$(man1dir)/$$transformed_name.1
+ transformed_name=`t='$(program_transform_name)'; \
+ echo gcore | sed -e "$$t"` ; \
+ if test "x$$transformed_name" = x; then \
+ transformed_name=gcore ; \
+ else \
+ true ; \
+ fi ; \
+ $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(bindir) ; \
+ $(INSTALL_SCRIPT) $(srcdir)/gdb_gcore.sh \
+ $(DESTDIR)$(bindir)/$$transformed_name ; \
+ $(SHELL) $(srcdir)/../mkinstalldirs \
+ $(DESTDIR)$(man1dir) ; \
+ $(INSTALL_DATA) $(srcdir)/gdb_gcore.1 \
+ $(DESTDIR)$(man1dir)/$$transformed_name.1
@$(MAKE) DO=install "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do
.PHONY: install-tui
install-tui:
@@ -1050,6 +1065,15 @@ uninstall: force $(CONFIG_UNINSTALL)
fi ; \
rm -f $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) \
$(DESTDIR)$(man1dir)/$$transformed_name.1
+ transformed_name=`t='$(program_transform_name)'; \
+ echo gcore | sed -e $$t` ; \
+ if test "x$$transformed_name" = x; then \
+ transformed_name=gcore ; \
+ else \
+ true ; \
+ fi ; \
+ rm -f $(DESTDIR)$(bindir)/$$transformed_name \
+ $(DESTDIR)$(man1dir)/$$transformed_name.1
@$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do
.PHONY: uninstall-tui
uninstall-tui:
--- /dev/null
+++ b/gdb/gdb_gcore.1
@@ -0,0 +1,45 @@
+.\"
+.\" gcore manual page.
+.\" Copyright (c) 2011 Red Hat, 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 2, 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; see the file COPYING. If not, write to
+.\" the Free Software Foundation, 59 Temple Place - Suite 330,
+.\" Boston, MA 02111-1307, USA.
+.\"
+.TH GCORE 1 "Apr 25 2011" "Red Hat Linux" "Linux Programmer's Manual"
+
+.SH NAME
+gcore \- generate a core file of a running program
+
+.SH SYNOPSIS
+.B gcore
+[-o \fIfilename\fR] \fIPID1\fR [\fIPID2\fR...]
+
+.SH DESCRIPTION
+.PP
+\f3gcore\f1 starts up \fBgdb\fR, attaches to the given \fIPID\fR and invokes the
+gcore command dumping the cores into files core.\fIPID1\fR, core.\fIPID2\fR
+etc. The programs being dumped remain running unaffected, except for being
+stopped for a short time during the dump.
+
+.SH OPTIONS
+.TP
+\fB\-o\fR \fIfilename\fR
+Alternative core files base name from the default "core".
+
+.SH SEE ALSO
+gdb(1)
+
+.SH AUTHORS
+Jan Kratochvil <jan.kratochvil@redhat.com>
--- a/gdb/gdb_gcore.sh
+++ b/gdb/gdb_gcore.sh
@@ -22,9 +22,9 @@
# It starts up gdb, attaches to the given PID and invokes the gcore command.
#

-if [ "$#" -eq "0" ]
+if [ "$#" -eq "0" -o "$1" = "-h" -o "$1" = "--help" ]
then
- echo "usage: gcore [-o filename] pid"
+ echo "usage: gcore [-o filename] pid1 [pid2...]"
exit 2
fi