From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8666 invoked by alias); 25 Apr 2011 08:43:52 -0000 Received: (qmail 8657 invoked by uid 22791); 25 Apr 2011 08:43:51 -0000 X-SWARE-Spam-Status: No, hits=-6.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 25 Apr 2011 08:43:31 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p3P8hUNg010560 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 25 Apr 2011 04:43:31 -0400 Received: from host1.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p3P8hSZd018723 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 25 Apr 2011 04:43:30 -0400 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p3P8hStS010684; Mon, 25 Apr 2011 10:43:28 +0200 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p3P8hRxF010677; Mon, 25 Apr 2011 10:43:27 +0200 Date: Mon, 25 Apr 2011 08:43:00 -0000 From: Jan Kratochvil To: Andreas Schwab Cc: gdb-patches@sourceware.org Subject: Re: [patch] gdb_gcore man/help/install [+doc] Message-ID: <20110425084327.GA10506@host1.jankratochvil.net> References: <20110425074138.GA5408@host1.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-04/txt/msg00438.txt.bz2 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 * 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 --- 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