PR c++/15116:
[deliverable/binutils-gdb.git] / gdb / gdb_gcore.sh
index 8a2dbf039cf481c240466723a992bc51f24d6460..38548f2ad69f054a7ac5e46cb1ad2b18b3b17916 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-#   Copyright (C) 2003, 2005, 2007 Free Software Foundation, Inc.
+#   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
@@ -44,32 +44,17 @@ then
     shift; shift
 fi
 
-# Create a temporary file.  Use mktemp if available, but cope if it is not.
-tmpfile=`mktemp ${name}.XXXXXX 2>/dev/null` || {
-  tmpfile=${name}.$$
-  if test -e $tmpfile; then
-    echo "Could not create temporary file $tmpfile"
-    exit 1
-  fi
-  touch $tmpfile
-}
-trap "rm -f $tmpfile" EXIT
-
 # Initialise return code.
 rc=0
 
 # Loop through pids
 for pid in $*
 do
-       # Write gdb script for pid $pid.  
-       cat >>$tmpfile <<EOF
-attach $pid
-gcore $name.$pid
-detach
-quit
-EOF
-
-       gdb -x $tmpfile -batch
+       # `</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
This page took 0.025529 seconds and 4 git commands to generate.