gdb/
authorJan Kratochvil <jan.kratochvil@redhat.com>
Thu, 11 Apr 2013 14:13:44 +0000 (14:13 +0000)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Thu, 11 Apr 2013 14:13:44 +0000 (14:13 +0000)
* 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.

gdb/doc/
* 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.

22 files changed:
gdb/ChangeLog
gdb/Makefile.in
gdb/NEWS
gdb/config/alpha/alpha-osf3.mh
gdb/config/i386/fbsd.mh
gdb/config/i386/fbsd64.mh
gdb/config/i386/i386gnu.mh
gdb/config/i386/i386sol2.mh
gdb/config/i386/sol2-64.mh
gdb/config/mips/irix5.mh
gdb/config/mips/irix6.mh
gdb/config/powerpc/fbsd.mh
gdb/config/sparc/fbsd.mh
gdb/config/sparc/sol2.mh
gdb/configure
gdb/configure.ac
gdb/configure.tgt
gdb/doc/ChangeLog
gdb/doc/Makefile.in
gdb/doc/gdb.texinfo
gdb/gcore.in [new file with mode: 0644]
gdb/gdb_gcore.sh [deleted file]

index 0eb03ce95b371777218d6c7939e6a031dc45ca6f..0e65461591c440e64d1100311b109d8dd4266159 100644 (file)
@@ -1,3 +1,27 @@
+2013-04-11  Jan Kratochvil  <jan.kratochvil@redhat.com>
+           Pedro Alves  <palves@redhat.com>
+
+       * 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  <jan.kratochvil@redhat.com>
 
        * remote.c (unpush_and_perror): Add output message final dot.
index 0814bcb13ff11515d3d09dee9e70ac51716d686b..ebe6eb75948ea32c3d77838d81a8ae02ab847278 100644 (file)
@@ -418,6 +418,7 @@ CONFIG_ALL= @CONFIG_ALL@
 CONFIG_CLEAN= @CONFIG_CLEAN@
 CONFIG_INSTALL = @CONFIG_INSTALL@
 CONFIG_UNINSTALL = @CONFIG_UNINSTALL@
+HAVE_NATIVE_GCORE_TARGET = @HAVE_NATIVE_GCORE_TARGET@
 
 # -I. for config files.
 # -I$(srcdir) for gdb internal headers.
@@ -968,7 +969,7 @@ DISTSTUFF = $(YYFILES)
 
 # All generated files which can be included by another file.
 generated_files = config.h observer.h observer.inc ada-lex.c jit-reader.h \
-       $(GNULIB_H) $(NAT_GENERATED_FILES)
+       $(GNULIB_H) $(NAT_GENERATED_FILES) gcore
 
 .c.o:
        $(COMPILE) $<
@@ -1044,6 +1045,19 @@ install-only: $(CONFIG_INSTALL)
                        $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) ; \
                $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(includedir)/gdb ; \
                $(INSTALL_DATA) jit-reader.h $(DESTDIR)$(includedir)/gdb/jit-reader.h
+       if test "x$(HAVE_NATIVE_GCORE_TARGET)$(HAVE_NATIVE_GCORE_HOST)" != x; \
+       then \
+         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_PROGRAM) gcore \
+                         $(DESTDIR)$(bindir)/$$transformed_name; \
+       fi
        @$(MAKE) DO=install "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do
 
 install-python:
@@ -1059,6 +1073,17 @@ uninstall: force $(CONFIG_UNINSTALL)
                fi ; \
                rm -f $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) \
                      $(DESTDIR)$(man1dir)/$$transformed_name.1
+       if test "x$(HAVE_NATIVE_GCORE_TARGET)$(HAVE_NATIVE_GCORE_HOST)" != x; \
+       then \
+         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; \
+       fi
        @$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do
 
 # The C++ name parser can be built standalone for testing.
@@ -1303,6 +1328,9 @@ data-directory/Makefile: data-directory/Makefile.in config.status @frags@
 jit-reader.h: $(srcdir)/jit-reader.in
        $(SHELL) config.status $@
 
+gcore: $(srcdir)/gcore.in
+       $(SHELL) config.status $@
+
 config.h: stamp-h ; @true
 stamp-h: $(srcdir)/config.in config.status
        CONFIG_HEADERS=config.h:config.in \
index 86716e0f866250bed8542bf3af9ca5fdcde02b1e..43f41dc5d0f426aa7d65182af5551e46e07d91cf 100644 (file)
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -19,6 +19,9 @@ show remote trace-status-packet
 * The command 'tsave' can now support new option '-ctf' to save trace
   buffer in Common Trace Format.
 
+* Newly installed $prefix/bin/gcore acts as a shell interface for the
+  GDB command gcore.
+
 * MI changes
 
   ** The -trace-save MI command can optionally save trace buffer in Common
index 483ef7827683c2de86be77d4d36a8790c096dfb3..aa63dc465e9e0ed051068ee406d136f4854ef63a 100644 (file)
@@ -3,4 +3,5 @@ NAT_FILE= nm-osf3.h
 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
index 05ac5bbad260b1a16ce8c894add0fafae4eb8f97..2c9cd9af4ee66baebb581ce4e7f85cb16cffda3d 100644 (file)
@@ -3,5 +3,6 @@ NATDEPFILES= fork-child.o inf-ptrace.o \
        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
index 3f43727311fcada27c5542608b0ef5a0033d8a69..c719a17b208451a4ec74b7fbf63f6dc402b1a500 100644 (file)
@@ -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
index d85744b4f0a00b36c093f0643f222e6b7e0fb2cd..a3ea122b6d7e79c2ea960ee570182bcf4192fcdd 100644 (file)
@@ -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
index dcf5a79c1e6e6d5c7d212ce07f753a0690390130..2f7c3c5f0895ab544078ff20dcaef39792b0b5d7 100644 (file)
@@ -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
index bfb69801eb695bb63571270b7cbc7de6dfefbad6..7a8304d6dfef906c8b9881c51a612a25aebb1f4d 100644 (file)
@@ -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
index 7ab5e111699a5289bfbcb2492e9b8d2c43afb097..d5740d0e4691ba7a2e4704b1ccb1fed2ddf2e45d 100644 (file)
@@ -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
index 28a67eb4888b79c38d3107ac7f85ef54012cb41e..098df2e42f47280d7cb7f5cdb78189ca51a28683 100644 (file)
@@ -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
index 746b2869985beefecbaf980d7a7cb5b8ef7b1732..48ea90298041c7c90a9c5b52fa2bb4d0bd5ad239 100644 (file)
@@ -18,6 +18,7 @@
 #  along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 NATDEPFILES= fbsd-nat.o fork-child.o inf-ptrace.o ppcfbsd-nat.o bsd-kvm.o
+HAVE_NATIVE_GCORE_HOST = 1
 
 LOADLIBES= -lkvm
 
index ad36ee6c81d8a6315ad7dacd7113ef3be1c5e5c5..2774efb6403efcc212ab85bc1c81968b468518f6 100644 (file)
@@ -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
index 9f91583313542d9e7837b26c56bb8949f7023b0d..c6cabd2439f7a1a8d1a82575c5877ab533f0ff53 100644 (file)
@@ -3,3 +3,4 @@ NAT_FILE= nm-sol2.h
 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
index 6588c72882352e26399382b857f50d2e864e3735..f9d9a1745b4d97170d19694426eac1b888c91840 100755 (executable)
@@ -591,6 +591,8 @@ ac_includes_default="\
 enable_option_checking=no
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
+GCORE_TRANSFORM_NAME
+GDB_TRANSFORM_NAME
 GDB_NM_FILE
 LTLIBBABELTRACE
 LIBBABELTRACE
@@ -684,6 +686,7 @@ AWK
 REPORT_BUGS_TEXI
 REPORT_BUGS_TO
 PKGVERSION
+HAVE_NATIVE_GCORE_TARGET
 TARGET_OBS
 subdirs
 GDB_DATADIR
@@ -5083,6 +5086,7 @@ fi
 
 TARGET_OBS=
 all_targets=
+HAVE_NATIVE_GCORE_TARGET=
 
 for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'`
 do
@@ -5117,6 +5121,12 @@ fi
     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
 
@@ -5179,6 +5189,7 @@ fi
 
 
 
+
 # For other settings, only the main target counts.
 gdb_sim=
 gdb_osabi=
@@ -14648,6 +14659,21 @@ ac_config_links="$ac_config_links $ac_config_links_1"
 $as_echo "#define GDB_DEFAULT_HOST_CHARSET \"UTF-8\"" >>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 @@ do
     "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 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
 
   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)
index 149ac37c83cf30775aeeea708e3f02002c5fe151..ce6fa7a8a7e6a553fc95e7e8293ac2fb7964e405 100644 (file)
@@ -203,6 +203,7 @@ fi
 
 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 @@ do
     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 @@ if test x${all_targets} = xtrue; then
 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 @@ dnl  At the moment, we just assume it's UTF-8.
 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
index c6357d2a3a06f89d1ee782dcf8fe1a672633801b..51fe87c620f2525a490b01ab26dfba55fd85ecee 100644 (file)
@@ -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 @@ m68*-*-openbsd* | m88*-*-openbsd* | vax-*-openbsd*) ;;
 *-*-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
index e55b219ea059f81ea56e11cdad8606a4e496ce5e..d62a5a69c409501e66c3b949ce8c40d312f3931b 100644 (file)
@@ -1,3 +1,13 @@
+2013-04-11  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       * 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  <palves@redhat.com>
 
        * gdb.texinfo (Process Record and Replay): Document that "set
index 70086a31e8144a4f54779c93d52d4f6ee7704146..fdd57d65516dfca909a25182a4b4d371c869d6de 100644 (file)
@@ -177,11 +177,15 @@ POD2MAN5 = pod2man --center="GNU Development Tools" \
                   --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-man: install-man1 install-man5
 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-man: uninstall-man1 uninstall-man5
 
 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 @@ gdbserver.1: $(GDB_DOC_FILES)
                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
index 15a889491f2c223fdd6d4947285eda7776a12ae1..97d88ec6c314eb8bb763dba35b5d56f8e85ff2ae 100644 (file)
@@ -41652,6 +41652,7 @@ switch (die->tag)
 @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 @@ Richard M. Stallman and Roland H. Pesch, July 1991.
 @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
 
diff --git a/gdb/gcore.in b/gdb/gcore.in
new file mode 100644 (file)
index 0000000..9c5b14d
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+
+#
+# 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
+       # `</dev/null' to avoid touching interactive terminal if it is
+       # available but not accessible as GDB would get stopped on SIGTTIN.
+       @GDB_TRANSFORM_NAME@ </dev/null --nx --batch \
+           -ex "set pagination off" -ex "set height 0" -ex "set width 0" \
+           -ex "attach $pid" -ex "gcore $name.$pid" -ex detach -ex quit
+
+       if [ -r $name.$pid ] ; then 
+           rc=0
+       else
+           echo "@GCORE_TRANSFORM_NAME@: failed to create $name.$pid"
+           rc=1
+           break
+       fi
+
+
+done
+
+exit $rc
diff --git a/gdb/gdb_gcore.sh b/gdb/gdb_gcore.sh
deleted file mode 100755 (executable)
index 38548f2..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/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 <http://www.gnu.org/licenses/>.
-
-#
-# 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
-       # `</dev/null' to avoid touching interactive terminal if it is
-       # available but not accessible as GDB would get stopped on SIGTTIN.
-       gdb </dev/null --nx --batch \
-           -ex "set pagination off" -ex "set height 0" -ex "set width 0" \
-           -ex "attach $pid" -ex "gcore $name.$pid" -ex detach -ex quit
-
-       if [ -r $name.$pid ] ; then 
-           rc=0
-       else
-           echo gcore: failed to create $name.$pid
-           rc=1
-           break
-       fi
-
-
-done
-
-exit $rc