Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] gdb_gcore.sh updates
@ 2010-07-23 17:33 Jan Kratochvil
  2010-07-23 17:36 ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kratochvil @ 2010-07-23 17:33 UTC (permalink / raw)
  To: gdb-patches

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] gdb_gcore.sh updates
  2010-07-23 17:33 [patch] gdb_gcore.sh updates Jan Kratochvil
@ 2010-07-23 17:36 ` Tom Tromey
  2010-07-23 21:11   ` Jan Kratochvil
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2010-07-23 17:36 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb-patches

>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:

Jan> OK to check-in?

Jan> 2010-07-23  Jan Kratochvil  <jan.kratochvil@redhat.com>
Jan> 	* gdb_gcore.sh (tmpfile): Remove the variable, its initialization,
Jan> 	cleanup and generating of gdb script to it.
Jan> 	(gdb): Use redirection from /dev/null.  Use --nx.  Turn off pagination
Jan> 	and terminal size.  Convert $tmpfile to a series of -ex-es.

This is ok.  Thanks.

Tom


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] gdb_gcore.sh updates
  2010-07-23 17:36 ` Tom Tromey
@ 2010-07-23 21:11   ` Jan Kratochvil
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Kratochvil @ 2010-07-23 21:11 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On Fri, 23 Jul 2010 19:36:25 +0200, Tom Tromey wrote:
> >>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
> Jan> 2010-07-23  Jan Kratochvil  <jan.kratochvil@redhat.com>
> Jan> 	* gdb_gcore.sh (tmpfile): Remove the variable, its initialization,
> Jan> 	cleanup and generating of gdb script to it.
> Jan> 	(gdb): Use redirection from /dev/null.  Use --nx.  Turn off pagination
> Jan> 	and terminal size.  Convert $tmpfile to a series of -ex-es.
> 
> This is ok.  Thanks.

Checked-in:
	http://sourceware.org/ml/gdb-cvs/2010-07/msg00138.html


Thanks,
Jan


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-07-23 21:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-23 17:33 [patch] gdb_gcore.sh updates Jan Kratochvil
2010-07-23 17:36 ` Tom Tromey
2010-07-23 21:11   ` Jan Kratochvil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox