Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Subject: [patch] gdb_gcore.sh updates
Date: Fri, 23 Jul 2010 17:33:00 -0000	[thread overview]
Message-ID: <20100723173312.GA17869@host1.dyn.jankratochvil.net> (raw)

Hi,

the /dev/null redirection is from an existing Fedora patch.
	http://cvs.fedoraproject.org/viewvc/rpms/gdb/devel/gdb-6.6-bz229517-gcore-without-terminal.patch?revision=1.2&content-type=text%2Fplain&view=co
	(the testcase there is unreliable for some unknown reasons)

The rest are some obvious changes.

There exists no testcase for this shell script.

Tested the changes by hand on x86_64-fedora13-linux-gnu.

OK to check-in?


Thanks,
Jan


2010-07-23  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb_gcore.sh (tmpfile): Remove the variable, its initialization,
	cleanup and generating of gdb script to it.
	(gdb): Use redirection from /dev/null.  Use --nx.  Turn off pagination
	and terminal size.  Convert $tmpfile to a series of -ex-es.

--- a/gdb/gdb_gcore.sh
+++ b/gdb/gdb_gcore.sh
@@ -45,32 +45,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


             reply	other threads:[~2010-07-23 17:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-23 17:33 Jan Kratochvil [this message]
2010-07-23 17:36 ` Tom Tromey
2010-07-23 21:11   ` Jan Kratochvil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100723173312.GA17869@host1.dyn.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox