public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [patch] gdb_gcore man/help/install [+doc]
@ 2011-04-25  7:42 Jan Kratochvil
  2011-04-25  8:37 ` Andreas Schwab
  2011-04-25 15:36 ` Tom Tromey
  0 siblings, 2 replies; 8+ messages in thread
From: Jan Kratochvil @ 2011-04-25  7:42 UTC (permalink / raw)
  To: gdb-patches

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
 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] gdb_gcore man/help/install [+doc]
  2011-04-25  7:42 [patch] gdb_gcore man/help/install [+doc] Jan Kratochvil
@ 2011-04-25  8:37 ` Andreas Schwab
  2011-04-25  8:43   ` Jan Kratochvil
  2011-04-25 15:36 ` Tom Tromey
  1 sibling, 1 reply; 8+ messages in thread
From: Andreas Schwab @ 2011-04-25  8:37 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb-patches

Jan Kratochvil <jan.kratochvil@redhat.com> writes:

> --- 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...]"
  +    echo "Usage:  gcore [-o FILENAME] PID..."
>      exit 2

--help should exit successfully.  Also, test .. -o .. should be avoided.

case $#$1 in 0|1-h|1--help) ...

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] gdb_gcore man/help/install [+doc]
  2011-04-25  8:37 ` Andreas Schwab
@ 2011-04-25  8:43   ` Jan Kratochvil
  0 siblings, 0 replies; 8+ messages in thread
From: Jan Kratochvil @ 2011-04-25  8:43 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: gdb-patches

On Mon, 25 Apr 2011 10:32:02 +0200, Andreas Schwab wrote:
> --help should exit successfully.  Also, test .. -o .. should be avoided.
> 
> case $#$1 in 0|1-h|1--help) ...

OK, 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,11 +22,16 @@
 # It starts up gdb, attaches to the given PID and invokes the gcore command.
 #
 
-if [ "$#" -eq "0" ]
-then
-    echo "usage:  gcore [-o filename] pid"
-    exit 2
-fi
+case $#$1 in
+  0|1-h|1--help)
+    echo "usage:  gcore [-o filename] pid1 [pid2...]"
+    if [ "$#" -eq "0" ]
+    then
+      exit 2
+    fi
+    exit 0
+    ;;
+esac
 
 # Need to check for -o option, but set default basename to "core".
 name=core

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] gdb_gcore man/help/install [+doc]
  2011-04-25  7:42 [patch] gdb_gcore man/help/install [+doc] Jan Kratochvil
  2011-04-25  8:37 ` Andreas Schwab
@ 2011-04-25 15:36 ` Tom Tromey
  2011-04-26 20:00   ` Tom Tromey
  2011-12-06  0:54   ` [patch] gdb_gcore man/help/install [+doc] #2 Jan Kratochvil
  1 sibling, 2 replies; 8+ messages in thread
From: Tom Tromey @ 2011-04-25 15:36 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb-patches

>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:

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

I wonder if we could use the same texi->man rules that gcc uses.

Jan> The ".1.z" rule seems bogus to me, I have found these entries for it:
[...]
Jan> I would prefer to just remove it.  The only /usr/bin/pack I have is from
Jan> allegro which even has a different commandline syntax.

Yes, nuke it.

Tom

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] gdb_gcore man/help/install [+doc]
  2011-04-25 15:36 ` Tom Tromey
@ 2011-04-26 20:00   ` Tom Tromey
  2011-12-06  0:54   ` [patch] gdb_gcore man/help/install [+doc] #2 Jan Kratochvil
  1 sibling, 0 replies; 8+ messages in thread
From: Tom Tromey @ 2011-04-26 20:00 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb-patches

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

Tom> I wonder if we could use the same texi->man rules that gcc uses.

I found out today that binutils uses this, too, and that the texi2pod
code is already in src/etc/.

Tom

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [patch] gdb_gcore man/help/install [+doc] #2
  2011-04-25 15:36 ` Tom Tromey
  2011-04-26 20:00   ` Tom Tromey
@ 2011-12-06  0:54   ` Jan Kratochvil
  2011-12-20 14:42     ` Tom Tromey
  1 sibling, 1 reply; 8+ messages in thread
From: Jan Kratochvil @ 2011-12-06  0:54 UTC (permalink / raw)
  To: gdb-patches; +Cc: Eli Zaretskii, Tom Tromey

On Mon, 25 Apr 2011 17:36:03 +0200, Tom Tromey wrote:
> Jan> The ".1.z" rule seems bogus to me, I have found these entries for it:
> 
> Yes, nuke it.

Done.


On Tue, 26 Apr 2011 21:59:44 +0200, Tom Tromey wrote:
> Tom> I wonder if we could use the same texi->man rules that gcc uses.
> 
> I found out today that binutils uses this, too, and that the texi2pod
> code is already in src/etc/.

I have found they generate man page from the main as.texinfo file itself.

gdb_gcore.sh (gcore) shell script has no entry in gdb.texinfo so far.

From the practical point of view with the goal to generate only the nroff .1
format I think the choice is clear from nroff, pod and texinfo.
The most simple format for maintenance is pod.  Therefore I did not use
texi2pod at all.

Therefore I have written gdb_gcore.pod.  With this checked-in I would like to
convert gdb.1 also to gdb.pod.  There are various outstanding requests to
document this or that in gdb.1 but it is not too feasible IMHO in nroff.

Another approach would be some reorganization of gdb.texinfo to generate also
some huge man page from it but I do not plan to do so myself.

Tested some basic install/uninstall/install-man/uninstall-man.
The gdb_gcore.1 man page gets installed during default `make install',
together with the other existing man pages like gdb.1.

That rule to call pod2man looks weird, it seems to still workaround pod2man
bugs described in:
	http://sourceware.org/ml/binutils/2001-03/msg00453.html
It also produces empty output if pod2man is missing on the host system.
But the man-page should be pregenerated in .tar.gz (I did not test this part)
so the case of missing pod2man should not be a concern in the current style of
gdb.tar.gz.


Thanks,
Jan


gdb/
2011-12-06  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* Makefile.in (INSTALL_SCRIPT, install-man): New.
	(gdb.z): Remove.
	(install-only): Add gdb_gcore.sh installed as gcore.
	(uninstall): Add gcore.
	* data-directory/Makefile.in (.PHONY): Add install-man.
	(install-man): New.

gdb/doc/
2011-12-06  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* Makefile.in (program_transform_name, mandir, man1dir, POD2MAN)
	(MANFILES, man): New.
	(all-doc): Add man.
	(diststuff): Add man.
	(STAGESTUFF): Add *.1.
	(install-man, install-man1, uninstall-man, uninstall-man1, gdb_gcore.1):
	New.
	(maintainer-clean realclean): Add *.1.
	(install): Add install-man.
	(uninstall): Add uninstall-man.
	* gdb_gcore.pod: New file.
	* gdb_gcore.sh: Support also -h and --help.  Document multiple PIDs.

gdb/gdbserver/
2011-12-06  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* Makefile.in (install-man): New.

gdb/testsuite/
2011-12-06  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* Makefile.in (install-man): New.

--- 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 =
 
@@ -1006,14 +1007,9 @@ check//%: force
 	    "$$target"; \
 	else true; fi
 
-info install-info clean-info dvi pdf install-pdf html install-html: force
+info install-info clean-info dvi pdf install-pdf html install-html install-man: 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
-
 # Traditionally "install" depends on "all".  But it may be useful
 # not to; for example, if the user has made some trivial change to a
 # source file and doesn't care about rebuilding or just wants to save the
@@ -1039,6 +1035,16 @@ install-only: $(CONFIG_INSTALL)
 			$(DESTDIR)$(man1dir)/$$transformed_name.1 ; \
 		$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(includedir)/gdb ; \
 		$(INSTALL_DATA) jit-reader.h $(DESTDIR)$(includedir)/gdb/jit-reader.h
+	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
 	@$(MAKE) DO=install "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do
 .PHONY: install-tui
 install-tui:
@@ -1070,6 +1076,14 @@ 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
 	@$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do
 .PHONY: uninstall-tui
 uninstall-tui:
--- a/gdb/data-directory/Makefile.in
+++ b/gdb/data-directory/Makefile.in
@@ -200,10 +200,10 @@ maintainer-clean realclean distclean: clean
 	rm -f Makefile
 
 .PHONY: check installcheck info dvi pdf html
-.PHONY: install-info install-pdf install-html clean-info
+.PHONY: install-info install-pdf install-html install-man clean-info
 check installcheck:
 info dvi pdf html:
-install-info install-pdf install-html:
+install-info install-pdf install-html install-man:
 clean-info:
 
 # GNU Make has an annoying habit of putting *all* the Makefile variables
--- a/gdb/doc/Makefile.in
+++ b/gdb/doc/Makefile.in
@@ -27,6 +27,8 @@ datarootdir = @datarootdir@
 docdir = @docdir@
 pdfdir = @pdfdir@
 htmldir = @htmldir@
+program_transform_name = @program_transform_name@
+mandir = @mandir@
 
 SHELL = @SHELL@
 
@@ -37,6 +39,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 
 mkinstalldirs = $(SHELL) $(srcdir)/../../mkinstalldirs
+man1dir = $(mandir)/man1
 
 # main GDB source directory
 gdbdir = $(srcdir)/..
@@ -59,6 +62,10 @@ TEXI2ROFF=texi2roff
 # where to find texi2dvi, ditto
 TEXI2DVI=texi2dvi
 
+# pod2man is used for man pages formatting.
+POD2MAN = pod2man --center="GNU Development Tools" \
+		  --release="gdb-`sed q $(srcdir)/../version.in`" --section=1
+
 # Package version and bug-reporting URL.
 PKGVERSION = @PKGVERSION@
 BUGURL_TEXI = @REPORT_BUGS_TEXI@
@@ -83,6 +90,9 @@ PDFFILES = gdb.pdf gdbint.pdf stabs.pdf refcard.pdf annotate.pdf
 HTMLFILES =  gdb/index.html gdbint/index.html stabs/index.html annotate/index.html
 HTMLFILES_INSTALL = gdb gdbint stabs annotate
 
+# Files to generate for man pages.
+MANFILES = gdb_gcore.1
+
 # There may be alternate predefined collections of switches to configure
 # the GDB manual.  Normally this is not done in synch with the software
 # config system, since this choice tends to be independent; most people
@@ -171,8 +181,9 @@ dvi: gdb.dvi gdbint.dvi stabs.dvi refcard.dvi annotate.dvi
 ps: gdb.ps gdbint.ps stabs.ps refcard.ps annotate.ps
 html: $(HTMLFILES)
 pdf: $(PDFFILES)
-all-doc: info dvi ps # pdf
-diststuff: info
+man: $(MANFILES)
+all-doc: info dvi ps man # pdf
+diststuff: info man
 	rm -f gdb-cfg.texi GDBvn.texi
 
 install-info: $(INFO_DEPS)
@@ -243,7 +254,35 @@ install-pdf: $(PDFFILES)
 	  $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/$$f"; \
 	done
 
-STAGESTUFF = *.info* gdb-all.texi GDBvn.texi *.ps *.dvi *.pdf
+install-man: install-man1
+
+install-man1: $(MANFILES)
+	-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) $(gdbdir)/../mkinstalldirs \
+			$(DESTDIR)$(man1dir) ; \
+		$(INSTALL_DATA) $(srcdir)/gdb_gcore.1 \
+			$(DESTDIR)$(man1dir)/$$transformed_name.1
+
+uninstall-man: uninstall-man1
+
+uninstall-man1:
+	$(NORMAL_UNINSTALL)
+	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)$(man1dir)/$$transformed_name.1
+
+STAGESTUFF = *.info* gdb-all.texi GDBvn.texi *.ps *.dvi *.pdf *.1
 
 # Copy the object files from a particular stage into a subdirectory.
 stage1: force
@@ -524,6 +563,16 @@ annotate.info: $(ANNOTATE_DOC_FILES)
 annotate/index.html: $(ANNOTATE_DOC_FILES)
 	$(MAKEHTML) $(MAKEHTMLFLAGS) -I $(srcdir) $(srcdir)/annotate.texinfo
 
+# Build the man page from the texinfo file.
+# The sed command removes the no-adjust Nroff command so that
+# the man output looks standard.
+gdb_gcore.1: $(srcdir)/gdb_gcore.pod
+	touch $@
+	-($(POD2MAN) gdb_gcore.pod | \
+		sed -e '/^.if n .na/d' > $@.T$$$$ && \
+		mv -f $@.T$$$$ $@) || \
+		(rm -f $@.T$$$$ && exit 1)
+
 force:
 
 Makefile: Makefile.in $(host_makefile_frag) ../config.status
@@ -552,8 +601,8 @@ distclean: clean
 # "clean" or "distclean".  Use maintainer-clean to remove them.
 
 maintainer-clean realclean: distclean
-	rm -f GDBvn.texi *.info* *.dvi *.ps *.html *.pdf
+	rm -f GDBvn.texi *.info* *.dvi *.ps *.html *.pdf *.1
 
-install: install-info
+install: install-info install-man
 
-uninstall: uninstall-info
+uninstall: uninstall-info uninstall-man
--- /dev/null
+++ b/gdb/doc/gdb_gcore.pod
@@ -0,0 +1,43 @@
+=head1 NAME
+
+gcore - generate a core file of a running program
+
+=head1 SYNOPSIS
+
+gcore [B<-o> I<filename>] I<PID1> [I<PID2>...]
+
+=head1 DESCRIPTION
+
+B<gcore> starts up B<gdb>, attaches to the given I<PID> and invokes the gcore
+command dumping the cores into files core.I<PID1>, core.I<PID2> etc.
+The programs being dumped remain running unaffected, except for being stopped
+for a short time during the dump.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<-o> I<filename>
+
+Alternative core files base name from the default "core".
+
+=back
+
+=head1 SEE ALSO
+
+gdb(1)
+
+=head1 AUTHOR
+
+Jan Kratochvil <jan.kratochvil@redhat.com>
+
+=head1 COPYRIGHT
+
+Copyright (c) 2011 Free Software Foundation, Inc.
+
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.3
+or any later version published by the Free Software Foundation;
+with no Invariant Sections, with no Front-Cover Texts, and with no
+Back-Cover Texts.  A copy of the license is included in the
+section entitled "GNU Free Documentation License".
--- a/gdb/gdb_gcore.sh
+++ b/gdb/gdb_gcore.sh
@@ -22,11 +22,16 @@
 # It starts up gdb, attaches to the given PID and invokes the gcore command.
 #
 
-if [ "$#" -eq "0" ]
-then
-    echo "usage:  gcore [-o filename] pid"
-    exit 2
-fi
+case $#$1 in
+  0|1-h|1--help)
+    echo "usage:  gcore [-o filename] pid1 [pid2...]"
+    if [ "$#" -eq "0" ]
+    then
+      exit 2
+    fi
+    exit 0
+    ;;
+esac
 
 # Need to check for -o option, but set default basename to "core".
 name=core
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -227,6 +227,7 @@ install-pdf:
 html:
 install-html:
 clean-info:
+install-man:
 
 gdbserver$(EXEEXT): $(OBS) ${ADD_DEPS} ${CDEPS}
 	rm -f gdbserver$(EXEEXT)
--- a/gdb/testsuite/Makefile.in
+++ b/gdb/testsuite/Makefile.in
@@ -97,6 +97,7 @@ pdf:
 install-pdf:
 html:
 install-html:
+install-man:
 
 install:
 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] gdb_gcore man/help/install [+doc] #2
  2011-12-06  0:54   ` [patch] gdb_gcore man/help/install [+doc] #2 Jan Kratochvil
@ 2011-12-20 14:42     ` Tom Tromey
  2011-12-21 21:20       ` Jan Kratochvil
  0 siblings, 1 reply; 8+ messages in thread
From: Tom Tromey @ 2011-12-20 14:42 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb-patches, Eli Zaretskii

>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:

Jan> From the practical point of view with the goal to generate only the
Jan> nroff .1 format I think the choice is clear from nroff, pod and
Jan> texinfo.  The most simple format for maintenance is pod.  Therefore
Jan> I did not use texi2pod at all.

Thanks.  I think it seems fine.

We still need an info node for invoking gcore.

Jan> Another approach would be some reorganization of gdb.texinfo to
Jan> generate also some huge man page from it but I do not plan to do so
Jan> myself.

I looked a little at using texi2pod but it seemed a bit daunting, as the
organization is pretty different.  (The man page wouldn't have to be
enormous, but it does require extra markup and I think the ordering
might have to change.)

Tom

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] gdb_gcore man/help/install [+doc] #2
  2011-12-20 14:42     ` Tom Tromey
@ 2011-12-21 21:20       ` Jan Kratochvil
  0 siblings, 0 replies; 8+ messages in thread
From: Jan Kratochvil @ 2011-12-21 21:20 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches, Eli Zaretskii

On Tue, 20 Dec 2011 15:38:27 +0100, Tom Tromey wrote:
> >>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
> 
> Jan> From the practical point of view with the goal to generate only the
> Jan> nroff .1 format I think the choice is clear from nroff, pod and
> Jan> texinfo.  The most simple format for maintenance is pod.  Therefore
> Jan> I did not use texi2pod at all.
> 
> Thanks.  I think it seems fine.
> 
> We still need an info node for invoking gcore.

In such case we have to drop the pod idea and write the man page in texinfo.
(Unless we want to write it twice - in texinfo and in pod - but that does not
make sense.)


Thanks,
Jan

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-12-21 20:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-25  7:42 [patch] gdb_gcore man/help/install [+doc] Jan Kratochvil
2011-04-25  8:37 ` Andreas Schwab
2011-04-25  8:43   ` Jan Kratochvil
2011-04-25 15:36 ` Tom Tromey
2011-04-26 20:00   ` Tom Tromey
2011-12-06  0:54   ` [patch] gdb_gcore man/help/install [+doc] #2 Jan Kratochvil
2011-12-20 14:42     ` Tom Tromey
2011-12-21 21:20       ` Jan Kratochvil

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).