Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Andreas Schwab <schwab@linux-m68k.org>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch] gdb_gcore man/help/install [+doc]
Date: Mon, 25 Apr 2011 08:43:00 -0000	[thread overview]
Message-ID: <20110425084327.GA10506@host1.jankratochvil.net> (raw)
In-Reply-To: <m2tydm91fh.fsf@linux-m68k.org>

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


  reply	other threads:[~2011-04-25  8:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-25  7:42 Jan Kratochvil
2011-04-25  8:37 ` Andreas Schwab
2011-04-25  8:43   ` Jan Kratochvil [this message]
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

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=20110425084327.GA10506@host1.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=schwab@linux-m68k.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