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

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