From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11289 invoked by alias); 11 Apr 2013 15:24:00 -0000 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 Received: (qmail 11239 invoked by uid 89); 11 Apr 2013 15:23:59 -0000 X-Spam-SWARE-Status: No, score=-7.5 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 11 Apr 2013 15:23:57 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3BFNuUQ014121 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 11 Apr 2013 11:23:56 -0400 Received: from host2.jankratochvil.net (ovpn-116-44.ams2.redhat.com [10.36.116.44]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r3BETwCn014386 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 11 Apr 2013 10:30:01 -0400 Date: Thu, 11 Apr 2013 22:59:00 -0000 From: Jan Kratochvil To: Pedro Alves Cc: Tom Tromey , gdb-patches@sourceware.org Subject: [commit] [patch 2/2+rfc+doc] Install gcore by default (+new man page) Message-ID: <20130411142957.GA22567@host2.jankratochvil.net> References: <20130407185443.GB15389@host2.jankratochvil.net> <83r4ilawlx.fsf@gnu.org> <20130408172841.GA28868@host2.jankratochvil.net> <87hajgua2o.fsf@fleche.redhat.com> <516424FE.4050307@redhat.com> <20130409165525.GA29570@host2.jankratochvil.net> <51654DF0.3090101@redhat.com> <20130410194910.GA3941@host2.jankratochvil.net> <51669166.5060007@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <51669166.5060007@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2013-04/txt/msg00334.txt.bz2 On Thu, 11 Apr 2013 12:33:10 +0200, Pedro Alves wrote: > I see what happened. While doing my several tests, and switching > configurations, I deleted the generated "gcore" from the build dir. > "make" alone is not triggering a regeneration of gcore. Only the > configure step is generating it. This fixes it: OK, thanks, I did not notice generated_files. > > FYI there is also archer.git branch: jankratochvil/man > > Thanks. > > (I find it much better for review when test branches > are rebased versions on top of upstream, just containing > the proposed patches though.) I probably should not have mentioned it, I did not put too much attention to the branch, I also did not consider it for reviewing but rather just for practical testing, sorry for your time. > > +@node gdb-add-index man > > + > > This whole node looks unrelated ? That branch had an unrelated patch merged inside. I have not even posted the other (gdb-add-index) part. For more background /usr/bin/gdb-add-index was originally checked in FSF GDB HEAD by Tom and later removed due to various issues. As it is going to say shipped in Fedora also the gdb-add-index man page has to stay shipped only in Fedora. > Otherwise looks good to me. Checked in. Thanks, Jan http://sourceware.org/ml/gdb-cvs/2013-04/msg00109.html --- src/gdb/ChangeLog 2013/04/11 13:14:04 1.15397 +++ src/gdb/ChangeLog 2013/04/11 14:13:42 1.15398 @@ -1,4 +1,28 @@ 2013-04-11 Jan Kratochvil + Pedro Alves + + * Makefile.in (HAVE_NATIVE_GCORE_TARGET): New. + (generated_files): Add gcore. + (install-only, uninstall): Add gcore if HAVE_NATIVE_GCORE_TARGET or + HAVE_NATIVE_GCORE_HOST. + (gcore): New. + * NEWS (Changes since GDB 7.6): Mention newly installed gcore. + * config/alpha/alpha-osf3.mh, config/i386/fbsd.mh, + config/i386/fbsd64.mh, config/i386/i386gnu.mh, config/i386/i386sol2.mh, + config/i386/sol2-64.mh, config/mips/irix5.mh, config/mips/irix6.mh, + config/powerpc/fbsd.mh, config/sparc/fbsd.mh, config/sparc/sol2.mh: + Add HAVE_NATIVE_GCORE_HOST. + * configure: Regenerate. + * configure.ac (HAVE_NATIVE_GCORE_TARGET): New, set it, AC_SUBST it. + New AC_SUBST fir GDB_TRANSFORM_NAME and GCORE_TRANSFORM_NAME. New + AC_CONFIG_FILES for gcore. + * configure.tgt: Add gdb_have_gcore to the initial comment. Set + gdb_have_gcore. + * gdb_gcore.sh: Rename to ... + * gcore.in: ... here. Remove gcore.sh comment. Use GDB_TRANSFORM_NAME + and GCORE_TRANSFORM_NAME substitutions. + +2013-04-11 Jan Kratochvil * remote.c (unpush_and_perror): Add output message final dot. --- src/gdb/doc/ChangeLog 2013/04/10 15:11:12 1.1440 +++ src/gdb/doc/ChangeLog 2013/04/11 14:13:44 1.1441 @@ -1,3 +1,13 @@ +2013-04-11 Jan Kratochvil + + * Makefile.in (MAN1S): Add gcore.1. + Remove "Host, target, and site specific Makefile fragments" comment. + (@host_makefile_frag@, HAVE_NATIVE_GCORE_TARGET): New. + (install-man1, uninstall-man1): Conditionalize gcore.1. + (gcore.1): New. + * gdb.texinfo (Man Pages): Add gcore man. + (gcore man): New node. + 2013-04-10 Pedro Alves * gdb.texinfo (Process Record and Replay): Document that "set --- src/gdb/gcore.in +++ src/gdb/gcore.in 2013-04-11 14:15:23.866456268 +0000 @@ -0,0 +1,69 @@ +#!/bin/sh + +# Copyright (C) 2003-2013 Free Software Foundation, 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 3 of the License, 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. If not, see . + +# +# Script to generate a core file of a running program. +# It starts up gdb, attaches to the given PID and invokes the gcore command. +# + +if [ "$#" -eq "0" ] +then + echo "usage: @GCORE_TRANSFORM_NAME@ [-o filename] pid" + exit 2 +fi + +# Need to check for -o option, but set default basename to "core". +name=core + +if [ "$1" = "-o" ] +then + if [ "$#" -lt "3" ] + then + # Not enough arguments. + echo "usage: @GCORE_TRANSFORM_NAME@ [-o filename] pid" + exit 2 + fi + name=$2 + + # Shift over to start of pid list + shift; shift +fi + +# Initialise return code. +rc=0 + +# Loop through pids +for pid in $* +do + # `. - -# -# gcore.sh -# Script to generate a core file of a running program. -# 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 - -# Need to check for -o option, but set default basename to "core". -name=core - -if [ "$1" = "-o" ] -then - if [ "$#" -lt "3" ] - then - # Not enough arguments. - echo "usage: gcore [-o filename] pid" - exit 2 - fi - name=$2 - - # Shift over to start of pid list - shift; shift -fi - -# Initialise return code. -rc=0 - -# Loop through pids -for pid in $* -do - # `>confdefs.h +# Undo the $ec_script escaping suitable for Makefile. +transform=`echo "$program_transform_name" | sed -e 's/\\$\\$/\\$/g'` +GDB_TRANSFORM_NAME=`echo gdb | sed -e "$transform"` +if test "x$GDB_TRANSFORM_NAME" = x; then + GDB_TRANSFORM_NAME=gdb +fi + +GCORE_TRANSFORM_NAME=`echo gcore | sed -e "$transform"` +if test "x$GCORE_TRANSFORM_NAME" = x; then + GCORE_TRANSFORM_NAME=gcore +fi + +ac_config_files="$ac_config_files gcore" + + ac_config_files="$ac_config_files Makefile gdb-gdb.gdb doc/Makefile data-directory/Makefile" ac_config_commands="$ac_config_commands default" @@ -15358,6 +15384,7 @@ "depdir") CONFIG_COMMANDS="$CONFIG_COMMANDS depdir" ;; "jit-reader.h") CONFIG_FILES="$CONFIG_FILES jit-reader.h:jit-reader.in" ;; "$ac_config_links_1") CONFIG_LINKS="$CONFIG_LINKS $ac_config_links_1" ;; + "gcore") CONFIG_FILES="$CONFIG_FILES gcore" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "gdb-gdb.gdb") CONFIG_FILES="$CONFIG_FILES gdb-gdb.gdb" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; @@ -15979,6 +16006,7 @@ case $ac_file$ac_mode in "depdir":C) $SHELL $ac_aux_dir/mkinstalldirs $DEPDIR ;; + "gcore":F) chmod +x gcore ;; "default":C) case x$CONFIG_HEADERS in xconfig.h:config.in) --- src/gdb/configure.ac 2013/04/10 09:42:56 1.198 +++ src/gdb/configure.ac 2013/04/11 14:13:43 1.199 @@ -203,6 +203,7 @@ TARGET_OBS= all_targets= +HAVE_NATIVE_GCORE_TARGET= for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'` do @@ -236,6 +237,12 @@ if test x${want64} = xfalse; then . ${srcdir}/../bfd/config.bfd fi + + # Check whether this target is native and supports gcore. + if test $gdb_native = yes -a "$targ_alias" = "$target_alias" \ + && $gdb_have_gcore; then + HAVE_NATIVE_GCORE_TARGET=1 + fi fi done @@ -264,6 +271,7 @@ fi AC_SUBST(TARGET_OBS) +AC_SUBST(HAVE_NATIVE_GCORE_TARGET) # For other settings, only the main target counts. gdb_sim= @@ -2390,6 +2398,20 @@ AC_DEFINE(GDB_DEFAULT_HOST_CHARSET, "UTF-8", [Define to be a string naming the default host character set.]) +# Undo the $ec_script escaping suitable for Makefile. +transform=`echo "$program_transform_name" | sed -e 's/[\\$][\\$]/\\$/g'` +GDB_TRANSFORM_NAME=`echo gdb | sed -e "$transform"` +if test "x$GDB_TRANSFORM_NAME" = x; then + GDB_TRANSFORM_NAME=gdb +fi +AC_SUBST(GDB_TRANSFORM_NAME) +GCORE_TRANSFORM_NAME=`echo gcore | sed -e "$transform"` +if test "x$GCORE_TRANSFORM_NAME" = x; then + GCORE_TRANSFORM_NAME=gcore +fi +AC_SUBST(GCORE_TRANSFORM_NAME) +AC_CONFIG_FILES([gcore], [chmod +x gcore]) + AC_OUTPUT(Makefile gdb-gdb.gdb doc/Makefile data-directory/Makefile, [ case x$CONFIG_HEADERS in --- src/gdb/configure.tgt 2013/04/10 00:47:32 1.272 +++ src/gdb/configure.tgt 2013/04/11 14:13:43 1.273 @@ -6,6 +6,7 @@ # gdb_sim simulator library for target # gdb_osabi default OS ABI to use with target # build_gdbserver set to "yes" if gdbserver supports target +# gdb_have_gcore set to "true"/"false" if this target can run gcore # NOTE: Every file added to a gdb_target_obs variable for any target here # must also be added to either ALL_TARGET_OBS or ALL_64_TARGET_OBS @@ -703,3 +704,14 @@ *-*-symbianelf*) gdb_osabi=GDB_OSABI_SYMBIAN ;; esac + +# Check whether this target supports gcore. +# Such target has to call set_gdbarch_find_memory_regions. +case " ${gdb_target_obs} " in + *" linux-tdep.o "*) + gdb_have_gcore=true + ;; + *) + gdb_have_gcore=false + ;; +esac --- src/gdb/config/alpha/alpha-osf3.mh 2012/01/10 16:30:44 1.10 +++ src/gdb/config/alpha/alpha-osf3.mh 2013/04/11 14:13:43 1.11 @@ -3,4 +3,5 @@ NATDEPFILES= alpha-nat.o fork-child.o \ solib-osf.o procfs.o proc-api.o proc-events.o proc-flags.o \ proc-why.o dec-thread.o +HAVE_NATIVE_GCORE_HOST = 1 NAT_CLIBS= -lpthreaddebug --- src/gdb/config/i386/fbsd.mh 2009/10/26 18:28:13 1.20 +++ src/gdb/config/i386/fbsd.mh 2013/04/11 14:13:43 1.21 @@ -3,5 +3,6 @@ fbsd-nat.o i386-nat.o i386bsd-nat.o i386fbsd-nat.o \ bsd-kvm.o NAT_FILE= nm-fbsd.h +HAVE_NATIVE_GCORE_HOST = 1 LOADLIBES= -lkvm --- src/gdb/config/i386/fbsd64.mh 2012/02/09 16:06:44 1.13 +++ src/gdb/config/i386/fbsd64.mh 2013/04/11 14:13:43 1.14 @@ -2,5 +2,6 @@ NATDEPFILES= fork-child.o inf-ptrace.o \ fbsd-nat.o amd64-nat.o amd64bsd-nat.o amd64fbsd-nat.o \ bsd-kvm.o i386-nat.o +HAVE_NATIVE_GCORE_HOST = 1 LOADLIBES= -lkvm --- src/gdb/config/i386/i386gnu.mh 2012/01/10 16:30:44 1.14 +++ src/gdb/config/i386/i386gnu.mh 2013/04/11 14:13:43 1.15 @@ -2,6 +2,7 @@ NATDEPFILES= i386gnu-nat.o gnu-nat.o core-regset.o fork-child.o \ notify_S.o process_reply_S.o msg_reply_S.o \ msg_U.o exc_request_U.o exc_request_S.o +HAVE_NATIVE_GCORE_HOST = 1 NAT_FILE= nm-i386gnu.h MH_CFLAGS = -D_GNU_SOURCE --- src/gdb/config/i386/i386sol2.mh 2010/04/26 13:53:56 1.13 +++ src/gdb/config/i386/i386sol2.mh 2013/04/11 14:13:43 1.14 @@ -1,3 +1,4 @@ # Host: Solaris x86 NATDEPFILES= fork-child.o i386v4-nat.o i386-sol2-nat.o \ procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o +HAVE_NATIVE_GCORE_HOST = 1 --- src/gdb/config/i386/sol2-64.mh 2010/04/26 13:53:57 1.3 +++ src/gdb/config/i386/sol2-64.mh 2013/04/11 14:13:44 1.4 @@ -1,3 +1,4 @@ # Host: Solaris x86_64 NATDEPFILES= fork-child.o amd64-nat.o i386v4-nat.o i386-sol2-nat.o \ procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o +HAVE_NATIVE_GCORE_HOST = 1 --- src/gdb/config/mips/irix5.mh 2012/01/10 16:30:45 1.6 +++ src/gdb/config/mips/irix5.mh 2013/04/11 14:13:44 1.7 @@ -1,3 +1,4 @@ # Host: SGI Iris running irix 5.x NATDEPFILES= fork-child.o irix5-nat.o procfs.o \ proc-api.o proc-events.o proc-flags.o proc-why.o +HAVE_NATIVE_GCORE_HOST = 1 --- src/gdb/config/mips/irix6.mh 2012/01/10 16:30:45 1.7 +++ src/gdb/config/mips/irix6.mh 2013/04/11 14:13:44 1.8 @@ -1,3 +1,4 @@ # Host: SGI Iris running irix 6.x NATDEPFILES= fork-child.o irix5-nat.o procfs.o \ proc-api.o proc-events.o proc-flags.o proc-why.o +HAVE_NATIVE_GCORE_HOST = 1 --- src/gdb/config/powerpc/fbsd.mh 2013/02/04 20:48:53 1.1 +++ src/gdb/config/powerpc/fbsd.mh 2013/04/11 14:13:44 1.2 @@ -18,6 +18,7 @@ # along with this program. If not, see . */ NATDEPFILES= fbsd-nat.o fork-child.o inf-ptrace.o ppcfbsd-nat.o bsd-kvm.o +HAVE_NATIVE_GCORE_HOST = 1 LOADLIBES= -lkvm --- src/gdb/config/sparc/fbsd.mh 2009/10/26 18:28:15 1.10 +++ src/gdb/config/sparc/fbsd.mh 2013/04/11 14:13:44 1.11 @@ -2,5 +2,6 @@ NATDEPFILES= fork-child.o inf-ptrace.o \ fbsd-nat.o sparc-nat.o sparc64-nat.o sparc64fbsd-nat.o \ bsd-kvm.o +HAVE_NATIVE_GCORE_HOST = 1 LOADLIBES= -lkvm --- src/gdb/config/sparc/sol2.mh 2012/01/10 16:30:49 1.5 +++ src/gdb/config/sparc/sol2.mh 2013/04/11 14:13:44 1.6 @@ -3,3 +3,4 @@ NATDEPFILES= sparc-sol2-nat.o \ core-regset.o fork-child.o \ procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o +HAVE_NATIVE_GCORE_HOST = 1 --- src/gdb/doc/Makefile.in 2013/04/07 06:20:19 1.61 +++ src/gdb/doc/Makefile.in 2013/04/11 14:13:44 1.62 @@ -177,11 +177,15 @@ --release="gdb-`sed q $(srcdir)/../version.in`" --section=5 # List of man pages generated from gdb.texi -MAN1S = gdb.1 gdbserver.1 +MAN1S = gdb.1 gdbserver.1 gcore.1 MAN5S = gdbinit.5 MANS = $(MAN1S) $(MAN5S) -#### Host, target, and site specific Makefile fragments come in here. +# Host-dependent makefile fragment comes in here. +@host_makefile_frag@ +# End of host-dependent makefile fragment +HAVE_NATIVE_GCORE_TARGET = @HAVE_NATIVE_GCORE_TARGET@ + ### all: @@ -269,6 +273,10 @@ install-man1: $(MAN1S) test -z "$(man1dir)" || $(mkinstalldirs) "$(DESTDIR)$(man1dir)" @list='$(MAN1S)'; for p in $$list; do \ + if test "x$(HAVE_NATIVE_GCORE_TARGET)$(HAVE_NATIVE_GCORE_HOST)" = x \ + -a "$$p" = gcore.1; then \ + continue; \ + fi; \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=`echo $$p | sed -e 's|^.*/||'`; \ echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(man1dir)/$$f'"; \ @@ -288,7 +296,13 @@ uninstall-man1: @test -n "$(man1dir)" || exit 0; \ - files=`{ l2='$(MAN1S)'; for i in $$l2; do echo "$$i"; done | \ + files=`{ l2='$(MAN1S)'; for i in $$l2; do \ + if test "x$(HAVE_NATIVE_GCORE_TARGET)$(HAVE_NATIVE_GCORE_HOST)" = x \ + -a "$$i" = gcore.1; then \ + continue; \ + fi; \ + echo "$$i"; \ + done | \ sed -n '/\.1[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ @@ -605,6 +619,13 @@ mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) rm -f gdbserver.pod +gcore.1: $(GDB_DOC_FILES) + touch $@ + -$(TEXI2POD) $(MANCONF) -Dgcore < $(srcdir)/gdb.texinfo > gcore.pod + -($(POD2MAN1) gcore.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \ + mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) + rm -f gcore.pod + gdbinit.5: $(GDB_DOC_FILES) touch $@ -$(TEXI2POD) $(MANCONF) -Dgdbinit < $(srcdir)/gdb.texinfo > gdbinit.pod --- src/gdb/doc/gdb.texinfo 2013/04/10 15:11:12 1.1074 +++ src/gdb/doc/gdb.texinfo 2013/04/11 14:13:44 1.1075 @@ -41652,6 +41652,7 @@ @menu * gdb man:: The GNU Debugger man page * gdbserver man:: Remote Server for the GNU Debugger man page +* gcore man:: Generate a core file of a running program * gdbinit man:: gdbinit scripts @end menu @@ -42177,6 +42178,53 @@ @end ifset @c man end +@node gcore man +@heading gcore + +@c man title gcore Generate a core file of a running program + +@format +@c man begin SYNOPSIS gcore +gcore [-o @var{filename}] @var{pid} +@c man end +@end format + +@c man begin DESCRIPTION gcore +Generate a core dump of a running program with process ID @var{pid}. +Produced file is equivalent to a kernel produced core file as if the process +crashed (and if @kbd{ulimit -c} were used to set up an appropriate core dump +limit). Unlike after a crash, after @command{gcore} the program remains +running without any change. +@c man end + +@c man begin OPTIONS gcore +@table @env +@item -o @var{filename} +The optional argument +@var{filename} specifies the file name where to put the core dump. +If not specified, the file name defaults to @file{core.@var{pid}}, +where @var{pid} is the running program process ID. +@end table +@c man end + +@c man begin SEEALSO gcore +@ifset man +The full documentation for @value{GDBN} is maintained as a Texinfo manual. +If the @code{info} and @code{gdb} programs and @value{GDBN}'s Texinfo +documentation are properly installed at your site, the command + +@smallexample +info gdb +@end smallexample + +@noindent +should give you access to the complete manual. + +@cite{Using GDB: A Guide to the GNU Source-Level Debugger}, +Richard M. Stallman and Roland H. Pesch, July 1991. +@end ifset +@c man end + @node gdbinit man @heading gdbinit