Blame SOURCES/gdb-upstream-man-gcore-1of2.patch

01917d
http://sourceware.org/ml/gdb-cvs/2013-04/msg00109.html
01917d
01917d
### src/gdb/ChangeLog	2013/04/11 13:14:04	1.15397
01917d
### src/gdb/ChangeLog	2013/04/11 14:13:42	1.15398
01917d
## -1,4 +1,28 @@
01917d
 2013-04-11  Jan Kratochvil  <jan.kratochvil@redhat.com>
01917d
+	    Pedro Alves  <palves@redhat.com>
01917d
+
01917d
+	* Makefile.in (HAVE_NATIVE_GCORE_TARGET): New.
01917d
+	(generated_files): Add gcore.
01917d
+	(install-only, uninstall): Add gcore if HAVE_NATIVE_GCORE_TARGET or
01917d
+	HAVE_NATIVE_GCORE_HOST.
01917d
+	(gcore): New.
01917d
+	* NEWS (Changes since GDB 7.6): Mention newly installed gcore.
01917d
+	* config/alpha/alpha-osf3.mh, config/i386/fbsd.mh,
01917d
+	config/i386/fbsd64.mh, config/i386/i386gnu.mh, config/i386/i386sol2.mh,
01917d
+	config/i386/sol2-64.mh, config/mips/irix5.mh, config/mips/irix6.mh,
01917d
+	config/powerpc/fbsd.mh, config/sparc/fbsd.mh, config/sparc/sol2.mh:
01917d
+	Add HAVE_NATIVE_GCORE_HOST.
01917d
+	* configure: Regenerate.
01917d
+	* configure.ac (HAVE_NATIVE_GCORE_TARGET): New, set it, AC_SUBST it.
01917d
+	New AC_SUBST fir GDB_TRANSFORM_NAME and GCORE_TRANSFORM_NAME.  New
01917d
+	AC_CONFIG_FILES for gcore.
01917d
+	* configure.tgt: Add gdb_have_gcore to the initial comment.  Set
01917d
+	gdb_have_gcore.
01917d
+	* gdb_gcore.sh: Rename to ...
01917d
+	* gcore.in: ... here.  Remove gcore.sh comment.  Use GDB_TRANSFORM_NAME
01917d
+	and GCORE_TRANSFORM_NAME substitutions.
01917d
+
01917d
+2013-04-11  Jan Kratochvil  <jan.kratochvil@redhat.com>
01917d
 
01917d
 	* remote.c (unpush_and_perror): Add output message final dot.
01917d
 
01917d
### src/gdb/doc/ChangeLog	2013/04/10 15:11:12	1.1440
01917d
### src/gdb/doc/ChangeLog	2013/04/11 14:13:44	1.1441
01917d
## -1,3 +1,13 @@
01917d
+2013-04-11  Jan Kratochvil  <jan.kratochvil@redhat.com>
01917d
+
01917d
+	* Makefile.in (MAN1S): Add gcore.1.
01917d
+	Remove "Host, target, and site specific Makefile fragments" comment.
01917d
+	(@host_makefile_frag@, HAVE_NATIVE_GCORE_TARGET): New.
01917d
+	(install-man1, uninstall-man1): Conditionalize gcore.1.
01917d
+	(gcore.1): New.
01917d
+	* gdb.texinfo (Man Pages): Add gcore man.
01917d
+	(gcore man): New node.
01917d
+
01917d
 2013-04-10  Pedro Alves  <palves@redhat.com>
01917d
 
01917d
 	* gdb.texinfo (Process Record and Replay): Document that "set
01917d
Index: gdb-7.6/gdb/gcore.in
01917d
===================================================================
01917d
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
01917d
+++ gdb-7.6/gdb/gcore.in	2013-04-26 15:33:01.171049247 +0200
01917d
@@ -0,0 +1,69 @@
01917d
+#!/bin/sh
01917d
+
01917d
+#   Copyright (C) 2003-2013 Free Software Foundation, Inc.
01917d
+
01917d
+# This program is free software; you can redistribute it and/or modify
01917d
+# it under the terms of the GNU General Public License as published by
01917d
+# the Free Software Foundation; either version 3 of the License, or
01917d
+# (at your option) any later version.
01917d
+#
01917d
+# This program is distributed in the hope that it will be useful,
01917d
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
01917d
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
01917d
+# GNU General Public License for more details.
01917d
+#
01917d
+# You should have received a copy of the GNU General Public License
01917d
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
01917d
+
01917d
+#
01917d
+# Script to generate a core file of a running program.
01917d
+# It starts up gdb, attaches to the given PID and invokes the gcore command.
01917d
+#
01917d
+
01917d
+if [ "$#" -eq "0" ]
01917d
+then
01917d
+    echo "usage:  @GCORE_TRANSFORM_NAME@ [-o filename] pid"
01917d
+    exit 2
01917d
+fi
01917d
+
01917d
+# Need to check for -o option, but set default basename to "core".
01917d
+name=core
01917d
+
01917d
+if [ "$1" = "-o" ]
01917d
+then
01917d
+    if [ "$#" -lt "3" ]
01917d
+    then
01917d
+	# Not enough arguments.
01917d
+	echo "usage:  @GCORE_TRANSFORM_NAME@ [-o filename] pid"
01917d
+	exit 2
01917d
+    fi
01917d
+    name=$2
01917d
+
01917d
+    # Shift over to start of pid list
01917d
+    shift; shift
01917d
+fi
01917d
+
01917d
+# Initialise return code.
01917d
+rc=0
01917d
+
01917d
+# Loop through pids
01917d
+for pid in $*
01917d
+do
01917d
+	# `
01917d
+	# available but not accessible as GDB would get stopped on SIGTTIN.
01917d
+	@GDB_TRANSFORM_NAME@ 
01917d
+	    -ex "set pagination off" -ex "set height 0" -ex "set width 0" \
01917d
+	    -ex "attach $pid" -ex "gcore $name.$pid" -ex detach -ex quit
01917d
+
01917d
+	if [ -r $name.$pid ] ; then 
01917d
+	    rc=0
01917d
+	else
01917d
+	    echo "@GCORE_TRANSFORM_NAME@: failed to create $name.$pid"
01917d
+	    rc=1
01917d
+	    break
01917d
+	fi
01917d
+
01917d
+
01917d
+done
01917d
+
01917d
+exit $rc
01917d
Index: gdb-7.6/gdb/gdb_gcore.sh
01917d
===================================================================
01917d
--- gdb-7.6.orig/gdb/gdb_gcore.sh	2013-01-01 07:32:42.000000000 +0100
01917d
+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
01917d
@@ -1,70 +0,0 @@
01917d
-#!/bin/sh
01917d
-
01917d
-#   Copyright (C) 2003-2013 Free Software Foundation, Inc.
01917d
-
01917d
-# This program is free software; you can redistribute it and/or modify
01917d
-# it under the terms of the GNU General Public License as published by
01917d
-# the Free Software Foundation; either version 3 of the License, or
01917d
-# (at your option) any later version.
01917d
-#
01917d
-# This program is distributed in the hope that it will be useful,
01917d
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
01917d
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
01917d
-# GNU General Public License for more details.
01917d
-#
01917d
-# You should have received a copy of the GNU General Public License
01917d
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
01917d
-
01917d
-#
01917d
-# gcore.sh
01917d
-# Script to generate a core file of a running program.
01917d
-# It starts up gdb, attaches to the given PID and invokes the gcore command.
01917d
-#
01917d
-
01917d
-if [ "$#" -eq "0" ]
01917d
-then
01917d
-    echo "usage:  gcore [-o filename] pid"
01917d
-    exit 2
01917d
-fi
01917d
-
01917d
-# Need to check for -o option, but set default basename to "core".
01917d
-name=core
01917d
-
01917d
-if [ "$1" = "-o" ]
01917d
-then
01917d
-    if [ "$#" -lt "3" ]
01917d
-    then
01917d
-	# Not enough arguments.
01917d
-	echo "usage:  gcore [-o filename] pid"
01917d
-	exit 2
01917d
-    fi
01917d
-    name=$2
01917d
-
01917d
-    # Shift over to start of pid list
01917d
-    shift; shift
01917d
-fi
01917d
-
01917d
-# Initialise return code.
01917d
-rc=0
01917d
-
01917d
-# Loop through pids
01917d
-for pid in $*
01917d
-do
01917d
-	# `
01917d
-	# available but not accessible as GDB would get stopped on SIGTTIN.
01917d
-	gdb 
01917d
-	    -ex "set pagination off" -ex "set height 0" -ex "set width 0" \
01917d
-	    -ex "attach $pid" -ex "gcore $name.$pid" -ex detach -ex quit
01917d
-
01917d
-	if [ -r $name.$pid ] ; then 
01917d
-	    rc=0
01917d
-	else
01917d
-	    echo gcore: failed to create $name.$pid
01917d
-	    rc=1
01917d
-	    break
01917d
-	fi
01917d
-
01917d
-
01917d
-done
01917d
-
01917d
-exit $rc
01917d
Index: gdb-7.6/gdb/Makefile.in
01917d
===================================================================
01917d
--- gdb-7.6.orig/gdb/Makefile.in	2013-04-26 15:32:58.000000000 +0200
01917d
+++ gdb-7.6/gdb/Makefile.in	2013-04-26 15:33:01.172049246 +0200
01917d
@@ -414,6 +414,7 @@ CONFIG_ALL= @CONFIG_ALL@
01917d
 CONFIG_CLEAN= @CONFIG_CLEAN@
01917d
 CONFIG_INSTALL = @CONFIG_INSTALL@
01917d
 CONFIG_UNINSTALL = @CONFIG_UNINSTALL@
01917d
+HAVE_NATIVE_GCORE_TARGET = @HAVE_NATIVE_GCORE_TARGET@
01917d
 
01917d
 # -I. for config files.
01917d
 # -I$(srcdir) for gdb internal headers.
01917d
@@ -963,7 +964,7 @@ DISTSTUFF = $(YYFILES)
01917d
 
01917d
 # All generated files which can be included by another file.
01917d
 generated_files = config.h observer.h observer.inc ada-lex.c jit-reader.h \
01917d
-	$(GNULIB_H) $(NAT_GENERATED_FILES)
01917d
+	$(GNULIB_H) $(NAT_GENERATED_FILES) gcore
01917d
 
01917d
 .c.o:
01917d
 	$(COMPILE) $<
01917d
@@ -1039,6 +1040,19 @@ install-only: $(CONFIG_INSTALL)
01917d
 			$(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) ; \
01917d
 		$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(includedir)/gdb ; \
01917d
 		$(INSTALL_DATA) jit-reader.h $(DESTDIR)$(includedir)/gdb/jit-reader.h
01917d
+	if test "x$(HAVE_NATIVE_GCORE_TARGET)$(HAVE_NATIVE_GCORE_HOST)" != x; \
01917d
+	then \
01917d
+	  transformed_name=`t='$(program_transform_name)'; \
01917d
+			    echo gcore | sed -e "$$t"` ; \
01917d
+		  if test "x$$transformed_name" = x; then \
01917d
+		    transformed_name=gcore ; \
01917d
+		  else \
01917d
+		    true ; \
01917d
+		  fi ; \
01917d
+		  $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(bindir) ; \
01917d
+		  $(INSTALL_PROGRAM) gcore \
01917d
+			  $(DESTDIR)$(bindir)/$$transformed_name; \
01917d
+	fi
01917d
 	@$(MAKE) DO=install "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do
01917d
 
01917d
 install-python:
01917d
@@ -1054,6 +1068,17 @@ uninstall: force $(CONFIG_UNINSTALL)
01917d
 		fi ; \
01917d
 		rm -f $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) \
01917d
 		      $(DESTDIR)$(man1dir)/$$transformed_name.1
01917d
+	if test "x$(HAVE_NATIVE_GCORE_TARGET)$(HAVE_NATIVE_GCORE_HOST)" != x; \
01917d
+	then \
01917d
+	  transformed_name=`t='$(program_transform_name)'; \
01917d
+			    echo gcore | sed -e "$$t"` ; \
01917d
+		  if test "x$$transformed_name" = x; then \
01917d
+		    transformed_name=gcore ; \
01917d
+		  else \
01917d
+		    true ; \
01917d
+		  fi ; \
01917d
+		  rm -f $(DESTDIR)$(bindir)/$$transformed_name; \
01917d
+	fi
01917d
 	@$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do
01917d
 
01917d
 # The C++ name parser can be built standalone for testing.
01917d
@@ -1298,6 +1323,9 @@ data-directory/Makefile: data-directory/
01917d
 jit-reader.h: $(srcdir)/jit-reader.in
01917d
 	$(SHELL) config.status $@
01917d
 
01917d
+gcore: $(srcdir)/gcore.in
01917d
+	$(SHELL) config.status $@
01917d
+
01917d
 config.h: stamp-h ; @true
01917d
 stamp-h: $(srcdir)/config.in config.status
01917d
 	CONFIG_HEADERS=config.h:config.in \
01917d
Index: gdb-7.6/gdb/NEWS
01917d
===================================================================
01917d
--- gdb-7.6.orig/gdb/NEWS	2013-04-26 13:43:30.000000000 +0200
01917d
+++ gdb-7.6/gdb/NEWS	2013-04-26 15:33:19.784032404 +0200
01917d
@@ -1,6 +1,9 @@
01917d
 		What has changed in GDB?
01917d
 	     (Organized release by release)
01917d
 
01917d
+* Newly installed $prefix/bin/gcore acts as a shell interface for the
01917d
+  GDB command gcore.
01917d
+
01917d
 *** Changes in GDB 7.6
01917d
 
01917d
 * Target record has been renamed to record-full.
01917d
Index: gdb-7.6/gdb/configure
01917d
===================================================================
01917d
--- gdb-7.6.orig/gdb/configure	2013-03-12 23:25:32.000000000 +0100
01917d
+++ gdb-7.6/gdb/configure	2013-04-26 15:33:01.179049240 +0200
01917d
@@ -591,6 +591,8 @@ ac_includes_default="\
01917d
 enable_option_checking=no
01917d
 ac_subst_vars='LTLIBOBJS
01917d
 LIBOBJS
01917d
+GCORE_TRANSFORM_NAME
01917d
+GDB_TRANSFORM_NAME
01917d
 GDB_NM_FILE
01917d
 frags
01917d
 target_subdir
01917d
@@ -681,6 +683,7 @@ AWK
01917d
 REPORT_BUGS_TEXI
01917d
 REPORT_BUGS_TO
01917d
 PKGVERSION
01917d
+HAVE_NATIVE_GCORE_TARGET
01917d
 TARGET_OBS
01917d
 subdirs
01917d
 GDB_DATADIR
01917d
@@ -5075,6 +5078,7 @@ fi
01917d
 
01917d
 TARGET_OBS=
01917d
 all_targets=
01917d
+HAVE_NATIVE_GCORE_TARGET=
01917d
 
01917d
 for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'`
01917d
 do
01917d
@@ -5109,6 +5113,12 @@ fi
01917d
     if test x${want64} = xfalse; then
01917d
       . ${srcdir}/../bfd/config.bfd
01917d
     fi
01917d
+
01917d
+    # Check whether this target is native and supports gcore.
01917d
+    if test $gdb_native = yes -a "$targ_alias" = "$target_alias" \
01917d
+       && $gdb_have_gcore; then
01917d
+      HAVE_NATIVE_GCORE_TARGET=1
01917d
+    fi
01917d
   fi
01917d
 done
01917d
 
01917d
@@ -5171,6 +5181,7 @@ fi
01917d
 
01917d
 
01917d
 
01917d
+
01917d
 # For other settings, only the main target counts.
01917d
 gdb_sim=
01917d
 gdb_osabi=
01917d
@@ -14131,6 +14142,21 @@ ac_config_links="$ac_config_links $ac_co
01917d
 $as_echo "#define GDB_DEFAULT_HOST_CHARSET \"UTF-8\"" >>confdefs.h
01917d
 
01917d
 
01917d
+# Undo the $ec_script escaping suitable for Makefile.
01917d
+transform=`echo "$program_transform_name" | sed -e 's/\\$\\$/\\$/g'`
01917d
+GDB_TRANSFORM_NAME=`echo gdb | sed -e "$transform"`
01917d
+if test "x$GDB_TRANSFORM_NAME" = x; then
01917d
+  GDB_TRANSFORM_NAME=gdb
01917d
+fi
01917d
+
01917d
+GCORE_TRANSFORM_NAME=`echo gcore | sed -e "$transform"`
01917d
+if test "x$GCORE_TRANSFORM_NAME" = x; then
01917d
+  GCORE_TRANSFORM_NAME=gcore
01917d
+fi
01917d
+
01917d
+ac_config_files="$ac_config_files gcore"
01917d
+
01917d
+
01917d
 ac_config_files="$ac_config_files Makefile gdb-gdb.gdb doc/Makefile data-directory/Makefile"
01917d
 
01917d
 ac_config_commands="$ac_config_commands default"
01917d
@@ -14841,6 +14867,7 @@ do
01917d
     "depdir") CONFIG_COMMANDS="$CONFIG_COMMANDS depdir" ;;
01917d
     "jit-reader.h") CONFIG_FILES="$CONFIG_FILES jit-reader.h:jit-reader.in" ;;
01917d
     "$ac_config_links_1") CONFIG_LINKS="$CONFIG_LINKS $ac_config_links_1" ;;
01917d
+    "gcore") CONFIG_FILES="$CONFIG_FILES gcore" ;;
01917d
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
01917d
     "gdb-gdb.gdb") CONFIG_FILES="$CONFIG_FILES gdb-gdb.gdb" ;;
01917d
     "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
01917d
@@ -15462,6 +15489,7 @@ $as_echo "$as_me: executing $ac_file com
01917d
 
01917d
   case $ac_file$ac_mode in
01917d
     "depdir":C) $SHELL $ac_aux_dir/mkinstalldirs $DEPDIR ;;
01917d
+    "gcore":F) chmod +x gcore ;;
01917d
     "default":C)
01917d
 case x$CONFIG_HEADERS in
01917d
 xconfig.h:config.in)
01917d
Index: gdb-7.6/gdb/configure.ac
01917d
===================================================================
01917d
--- gdb-7.6.orig/gdb/configure.ac	2013-03-12 23:25:32.000000000 +0100
01917d
+++ gdb-7.6/gdb/configure.ac	2013-04-26 15:33:01.180049239 +0200
01917d
@@ -203,6 +203,7 @@ fi
01917d
 
01917d
 TARGET_OBS=
01917d
 all_targets=
01917d
+HAVE_NATIVE_GCORE_TARGET=
01917d
 
01917d
 for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'`
01917d
 do
01917d
@@ -236,6 +237,12 @@ do
01917d
     if test x${want64} = xfalse; then
01917d
       . ${srcdir}/../bfd/config.bfd
01917d
     fi
01917d
+
01917d
+    # Check whether this target is native and supports gcore.
01917d
+    if test $gdb_native = yes -a "$targ_alias" = "$target_alias" \
01917d
+       && $gdb_have_gcore; then
01917d
+      HAVE_NATIVE_GCORE_TARGET=1
01917d
+    fi
01917d
   fi
01917d
 done
01917d
 
01917d
@@ -264,6 +271,7 @@ if test x${all_targets} = xtrue; then
01917d
 fi
01917d
 
01917d
 AC_SUBST(TARGET_OBS)
01917d
+AC_SUBST(HAVE_NATIVE_GCORE_TARGET)
01917d
 
01917d
 # For other settings, only the main target counts.
01917d
 gdb_sim=
01917d
@@ -2349,6 +2357,20 @@ dnl  At the moment, we just assume it's
01917d
 AC_DEFINE(GDB_DEFAULT_HOST_CHARSET, "UTF-8",
01917d
           [Define to be a string naming the default host character set.])
01917d
 
01917d
+# Undo the $ec_script escaping suitable for Makefile.
01917d
+transform=`echo "$program_transform_name" | sed -e 's/[\\$][\\$]/\\$/g'`
01917d
+GDB_TRANSFORM_NAME=`echo gdb | sed -e "$transform"`
01917d
+if test "x$GDB_TRANSFORM_NAME" = x; then
01917d
+  GDB_TRANSFORM_NAME=gdb
01917d
+fi
01917d
+AC_SUBST(GDB_TRANSFORM_NAME)
01917d
+GCORE_TRANSFORM_NAME=`echo gcore | sed -e "$transform"`
01917d
+if test "x$GCORE_TRANSFORM_NAME" = x; then
01917d
+  GCORE_TRANSFORM_NAME=gcore
01917d
+fi
01917d
+AC_SUBST(GCORE_TRANSFORM_NAME)
01917d
+AC_CONFIG_FILES([gcore], [chmod +x gcore])
01917d
+
01917d
 AC_OUTPUT(Makefile gdb-gdb.gdb doc/Makefile data-directory/Makefile,
01917d
 [
01917d
 case x$CONFIG_HEADERS in
01917d
Index: gdb-7.6/gdb/configure.tgt
01917d
===================================================================
01917d
--- gdb-7.6.orig/gdb/configure.tgt	2013-03-05 14:37:10.000000000 +0100
01917d
+++ gdb-7.6/gdb/configure.tgt	2013-04-26 15:33:01.180049239 +0200
01917d
@@ -6,6 +6,7 @@
01917d
 #  gdb_sim		simulator library for target
01917d
 #  gdb_osabi		default OS ABI to use with target
01917d
 #  build_gdbserver	set to "yes" if gdbserver supports target
01917d
+#  gdb_have_gcore	set to "true"/"false" if this target can run gcore
01917d
 
01917d
 # NOTE: Every file added to a gdb_target_obs variable for any target here
01917d
 #       must also be added to either ALL_TARGET_OBS or ALL_64_TARGET_OBS
01917d
@@ -703,3 +704,14 @@ m68*-*-openbsd* | m88*-*-openbsd* | vax-
01917d
 *-*-symbianelf*)
01917d
 		gdb_osabi=GDB_OSABI_SYMBIAN ;;
01917d
 esac
01917d
+
01917d
+# Check whether this target supports gcore.
01917d
+# Such target has to call set_gdbarch_find_memory_regions.
01917d
+case " ${gdb_target_obs} " in
01917d
+  *" linux-tdep.o "*)
01917d
+    gdb_have_gcore=true
01917d
+    ;;
01917d
+  *)
01917d
+    gdb_have_gcore=false
01917d
+    ;;
01917d
+esac
01917d
Index: gdb-7.6/gdb/config/alpha/alpha-osf3.mh
01917d
===================================================================
01917d
--- gdb-7.6.orig/gdb/config/alpha/alpha-osf3.mh	2012-01-10 17:30:44.000000000 +0100
01917d
+++ gdb-7.6/gdb/config/alpha/alpha-osf3.mh	2013-04-26 15:33:01.181049238 +0200
01917d
@@ -3,4 +3,5 @@ NAT_FILE= nm-osf3.h
01917d
 NATDEPFILES= alpha-nat.o fork-child.o \
01917d
 	solib-osf.o procfs.o proc-api.o proc-events.o proc-flags.o \
01917d
 	proc-why.o dec-thread.o
01917d
+HAVE_NATIVE_GCORE_HOST = 1
01917d
 NAT_CLIBS= -lpthreaddebug
01917d
Index: gdb-7.6/gdb/config/i386/fbsd.mh
01917d
===================================================================
01917d
--- gdb-7.6.orig/gdb/config/i386/fbsd.mh	2009-10-26 19:28:13.000000000 +0100
01917d
+++ gdb-7.6/gdb/config/i386/fbsd.mh	2013-04-26 15:33:01.181049238 +0200
01917d
@@ -3,5 +3,6 @@ NATDEPFILES= fork-child.o inf-ptrace.o \
01917d
 	fbsd-nat.o i386-nat.o i386bsd-nat.o i386fbsd-nat.o \
01917d
 	bsd-kvm.o
01917d
 NAT_FILE= nm-fbsd.h
01917d
+HAVE_NATIVE_GCORE_HOST = 1
01917d
 
01917d
 LOADLIBES= -lkvm
01917d
Index: gdb-7.6/gdb/config/i386/fbsd64.mh
01917d
===================================================================
01917d
--- gdb-7.6.orig/gdb/config/i386/fbsd64.mh	2012-02-09 17:06:44.000000000 +0100
01917d
+++ gdb-7.6/gdb/config/i386/fbsd64.mh	2013-04-26 15:33:01.181049238 +0200
01917d
@@ -2,5 +2,6 @@
01917d
 NATDEPFILES= fork-child.o inf-ptrace.o \
01917d
 	fbsd-nat.o amd64-nat.o amd64bsd-nat.o amd64fbsd-nat.o \
01917d
 	bsd-kvm.o i386-nat.o
01917d
+HAVE_NATIVE_GCORE_HOST = 1
01917d
 
01917d
 LOADLIBES= -lkvm
01917d
Index: gdb-7.6/gdb/config/i386/i386gnu.mh
01917d
===================================================================
01917d
--- gdb-7.6.orig/gdb/config/i386/i386gnu.mh	2012-01-10 17:30:44.000000000 +0100
01917d
+++ gdb-7.6/gdb/config/i386/i386gnu.mh	2013-04-26 15:33:01.181049238 +0200
01917d
@@ -2,6 +2,7 @@
01917d
 NATDEPFILES= i386gnu-nat.o gnu-nat.o core-regset.o fork-child.o \
01917d
 	     notify_S.o process_reply_S.o msg_reply_S.o \
01917d
 	     msg_U.o exc_request_U.o exc_request_S.o
01917d
+HAVE_NATIVE_GCORE_HOST = 1
01917d
 
01917d
 NAT_FILE= nm-i386gnu.h
01917d
 MH_CFLAGS = -D_GNU_SOURCE
01917d
Index: gdb-7.6/gdb/config/i386/i386sol2.mh
01917d
===================================================================
01917d
--- gdb-7.6.orig/gdb/config/i386/i386sol2.mh	2010-04-26 15:53:56.000000000 +0200
01917d
+++ gdb-7.6/gdb/config/i386/i386sol2.mh	2013-04-26 15:33:01.181049238 +0200
01917d
@@ -1,3 +1,4 @@
01917d
 # Host: Solaris x86
01917d
 NATDEPFILES= fork-child.o i386v4-nat.o i386-sol2-nat.o \
01917d
 	procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o
01917d
+HAVE_NATIVE_GCORE_HOST = 1
01917d
Index: gdb-7.6/gdb/config/i386/sol2-64.mh
01917d
===================================================================
01917d
--- gdb-7.6.orig/gdb/config/i386/sol2-64.mh	2010-04-26 15:53:57.000000000 +0200
01917d
+++ gdb-7.6/gdb/config/i386/sol2-64.mh	2013-04-26 15:33:01.182049237 +0200
01917d
@@ -1,3 +1,4 @@
01917d
 # Host: Solaris x86_64
01917d
 NATDEPFILES= fork-child.o amd64-nat.o i386v4-nat.o i386-sol2-nat.o \
01917d
 	procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o
01917d
+HAVE_NATIVE_GCORE_HOST = 1
01917d
Index: gdb-7.6/gdb/config/mips/irix5.mh
01917d
===================================================================
01917d
--- gdb-7.6.orig/gdb/config/mips/irix5.mh	2012-01-10 17:30:45.000000000 +0100
01917d
+++ gdb-7.6/gdb/config/mips/irix5.mh	2013-04-26 15:33:01.182049237 +0200
01917d
@@ -1,3 +1,4 @@
01917d
 # Host: SGI Iris running irix 5.x
01917d
 NATDEPFILES= fork-child.o irix5-nat.o procfs.o \
01917d
 	proc-api.o proc-events.o proc-flags.o proc-why.o
01917d
+HAVE_NATIVE_GCORE_HOST = 1
01917d
Index: gdb-7.6/gdb/config/mips/irix6.mh
01917d
===================================================================
01917d
--- gdb-7.6.orig/gdb/config/mips/irix6.mh	2012-01-10 17:30:45.000000000 +0100
01917d
+++ gdb-7.6/gdb/config/mips/irix6.mh	2013-04-26 15:33:01.182049237 +0200
01917d
@@ -1,3 +1,4 @@
01917d
 # Host: SGI Iris running irix 6.x
01917d
 NATDEPFILES= fork-child.o irix5-nat.o procfs.o \
01917d
 	proc-api.o proc-events.o proc-flags.o proc-why.o
01917d
+HAVE_NATIVE_GCORE_HOST = 1
01917d
Index: gdb-7.6/gdb/config/powerpc/fbsd.mh
01917d
===================================================================
01917d
--- gdb-7.6.orig/gdb/config/powerpc/fbsd.mh	2013-02-04 21:48:53.000000000 +0100
01917d
+++ gdb-7.6/gdb/config/powerpc/fbsd.mh	2013-04-26 15:33:01.182049237 +0200
01917d
@@ -18,6 +18,7 @@
01917d
 #  along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
01917d
 
01917d
 NATDEPFILES= fbsd-nat.o fork-child.o inf-ptrace.o ppcfbsd-nat.o bsd-kvm.o
01917d
+HAVE_NATIVE_GCORE_HOST = 1
01917d
 
01917d
 LOADLIBES= -lkvm
01917d
 
01917d
Index: gdb-7.6/gdb/config/sparc/fbsd.mh
01917d
===================================================================
01917d
--- gdb-7.6.orig/gdb/config/sparc/fbsd.mh	2009-10-26 19:28:15.000000000 +0100
01917d
+++ gdb-7.6/gdb/config/sparc/fbsd.mh	2013-04-26 15:33:01.182049237 +0200
01917d
@@ -2,5 +2,6 @@
01917d
 NATDEPFILES= fork-child.o inf-ptrace.o \
01917d
 	fbsd-nat.o sparc-nat.o sparc64-nat.o sparc64fbsd-nat.o \
01917d
 	bsd-kvm.o
01917d
+HAVE_NATIVE_GCORE_HOST = 1
01917d
 
01917d
 LOADLIBES= -lkvm
01917d
Index: gdb-7.6/gdb/config/sparc/sol2.mh
01917d
===================================================================
01917d
--- gdb-7.6.orig/gdb/config/sparc/sol2.mh	2012-01-10 17:30:49.000000000 +0100
01917d
+++ gdb-7.6/gdb/config/sparc/sol2.mh	2013-04-26 15:33:01.182049237 +0200
01917d
@@ -3,3 +3,4 @@ NAT_FILE= nm-sol2.h
01917d
 NATDEPFILES= sparc-sol2-nat.o \
01917d
 	core-regset.o fork-child.o \
01917d
 	procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o
01917d
+HAVE_NATIVE_GCORE_HOST = 1
01917d
Index: gdb-7.6/gdb/doc/Makefile.in
01917d
===================================================================
01917d
--- gdb-7.6.orig/gdb/doc/Makefile.in	2013-04-26 15:32:58.000000000 +0200
01917d
+++ gdb-7.6/gdb/doc/Makefile.in	2013-04-26 15:33:01.183049235 +0200
01917d
@@ -177,11 +177,15 @@ POD2MAN5 = pod2man --center="GNU Develop
01917d
 		   --release="gdb-`sed q $(srcdir)/../version.in`" --section=5
01917d
 
01917d
 # List of man pages generated from gdb.texi
01917d
-MAN1S = gdb.1 gdbserver.1
01917d
+MAN1S = gdb.1 gdbserver.1 gcore.1
01917d
 MAN5S = gdbinit.5
01917d
 MANS = $(MAN1S) $(MAN5S)
01917d
 
01917d
-#### Host, target, and site specific Makefile fragments come in here.
01917d
+# Host-dependent makefile fragment comes in here.
01917d
+@host_makefile_frag@
01917d
+# End of host-dependent makefile fragment
01917d
+HAVE_NATIVE_GCORE_TARGET = @HAVE_NATIVE_GCORE_TARGET@
01917d
+
01917d
 ###
01917d
 
01917d
 all:
01917d
@@ -269,6 +273,10 @@ install-man: install-man1 install-man5
01917d
 install-man1: $(MAN1S)
01917d
 	test -z "$(man1dir)" || $(mkinstalldirs) "$(DESTDIR)$(man1dir)"
01917d
 	@list='$(MAN1S)'; for p in $$list; do \
01917d
+	  if test "x$(HAVE_NATIVE_GCORE_TARGET)$(HAVE_NATIVE_GCORE_HOST)" = x \
01917d
+		  -a "$$p" = gcore.1; then \
01917d
+	    continue; \
01917d
+	  fi; \
01917d
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
01917d
 	  f=`echo $$p | sed -e 's|^.*/||'`; \
01917d
 	  echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(man1dir)/$$f'"; \
01917d
@@ -288,7 +296,13 @@ uninstall-man: uninstall-man1 uninstall-
01917d
 
01917d
 uninstall-man1:
01917d
 	@test -n "$(man1dir)" || exit 0; \
01917d
-	files=`{ l2='$(MAN1S)'; for i in $$l2; do echo "$$i"; done | \
01917d
+	files=`{ l2='$(MAN1S)'; for i in $$l2; do \
01917d
+	  if test "x$(HAVE_NATIVE_GCORE_TARGET)$(HAVE_NATIVE_GCORE_HOST)" = x \
01917d
+		  -a "$$i" = gcore.1; then \
01917d
+	    continue; \
01917d
+	  fi; \
01917d
+	  echo "$$i"; \
01917d
+	done | \
01917d
 	  sed -n '/\.1[a-z]*$$/p'; \
01917d
 	} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
01917d
 	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
01917d
@@ -605,6 +619,13 @@ gdbserver.1: $(GDB_DOC_FILES)
01917d
 		mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
01917d
 	rm -f gdbserver.pod
01917d
 
01917d
+gcore.1: $(GDB_DOC_FILES)
01917d
+	touch $@
01917d
+	-$(TEXI2POD) $(MANCONF) -Dgcore < $(srcdir)/gdb.texinfo > gcore.pod
01917d
+	-($(POD2MAN1) gcore.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
01917d
+		mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
01917d
+	rm -f gcore.pod
01917d
+
01917d
 gdbinit.5: $(GDB_DOC_FILES)
01917d
 	touch $@
01917d
 	-$(TEXI2POD) $(MANCONF) -Dgdbinit < $(srcdir)/gdb.texinfo > gdbinit.pod
01917d
Index: gdb-7.6/gdb/doc/gdb.texinfo
01917d
===================================================================
01917d
--- gdb-7.6.orig/gdb/doc/gdb.texinfo	2013-04-26 15:32:58.000000000 +0200
01917d
+++ gdb-7.6/gdb/doc/gdb.texinfo	2013-04-26 15:33:01.191049229 +0200
01917d
@@ -41709,6 +41709,7 @@ switch (die->tag)
01917d
 @menu
01917d
 * gdb man::                     The GNU Debugger man page
01917d
 * gdbserver man::               Remote Server for the GNU Debugger man page
01917d
+* gcore man::                   Generate a core file of a running program
01917d
 * gdbinit man::                 gdbinit scripts
01917d
 @end menu
01917d
 
01917d
@@ -42230,6 +42231,53 @@ info gdb
01917d
 should give you access to the complete manual.
01917d
 
01917d
 @cite{Using GDB: A Guide to the GNU Source-Level Debugger},
01917d
+Richard M. Stallman and Roland H. Pesch, July 1991.
01917d
+@end ifset
01917d
+@c man end
01917d
+
01917d
+@node gcore man
01917d
+@heading gcore
01917d
+
01917d
+@c man title gcore Generate a core file of a running program
01917d
+
01917d
+@format
01917d
+@c man begin SYNOPSIS gcore
01917d
+gcore [-o @var{filename}] @var{pid}
01917d
+@c man end
01917d
+@end format
01917d
+
01917d
+@c man begin DESCRIPTION gcore
01917d
+Generate a core dump of a running program with process ID @var{pid}.
01917d
+Produced file is equivalent to a kernel produced core file as if the process
01917d
+crashed (and if @kbd{ulimit -c} were used to set up an appropriate core dump
01917d
+limit).  Unlike after a crash, after @command{gcore} the program remains
01917d
+running without any change.
01917d
+@c man end
01917d
+
01917d
+@c man begin OPTIONS gcore
01917d
+@table @env
01917d
+@item -o @var{filename}
01917d
+The optional argument
01917d
+@var{filename} specifies the file name where to put the core dump.
01917d
+If not specified, the file name defaults to @file{core.@var{pid}},
01917d
+where @var{pid} is the running program process ID.
01917d
+@end table
01917d
+@c man end
01917d
+
01917d
+@c man begin SEEALSO gcore
01917d
+@ifset man
01917d
+The full documentation for @value{GDBN} is maintained as a Texinfo manual.
01917d
+If the @code{info} and @code{gdb} programs and @value{GDBN}'s Texinfo
01917d
+documentation are properly installed at your site, the command
01917d
+
01917d
+@smallexample
01917d
+info gdb
01917d
+@end smallexample
01917d
+
01917d
+@noindent
01917d
+should give you access to the complete manual.
01917d
+
01917d
+@cite{Using GDB: A Guide to the GNU Source-Level Debugger},
01917d
 Richard M. Stallman and Roland H. Pesch, July 1991.
01917d
 @end ifset
01917d
 @c man end