Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Mark Kettenis <mark.kettenis@xs4all.nl>,
	qpan@mvista.com, gdb-patches@sources.redhat.com,
	qunyingpan@gmail.com
Subject: Re: Patch: fix gdb_gcore.sh failure in ash/dash
Date: Mon, 26 Sep 2005 01:52:00 -0000	[thread overview]
Message-ID: <20050926015218.GH22284@nevyn.them.org> (raw)
In-Reply-To: <20050917222649.GK8777@nevyn.them.org>

On Sat, Sep 17, 2005 at 06:26:49PM -0400, Daniel Jacobowitz wrote:
> 2005-09-17  Daniel Jacobowitz  <dan@codesourcery.com>
> 
> 	* gdb_gcore.sh: Use a temporary file.  Use gdb from $PATH.

Did you have any comments on the revised patch, Mark?  Otherwise I'll
check this in.

> Index: gdb_gcore.sh
> ===================================================================
> RCS file: /big/fsf/rsync/src/src/gdb/gdb_gcore.sh,v
> retrieving revision 1.1
> diff -u -p -r1.1 gdb_gcore.sh
> --- gdb_gcore.sh	17 Apr 2003 20:33:09 -0000	1.1
> +++ gdb_gcore.sh	17 Sep 2005 22:26:10 -0000
> @@ -1,6 +1,6 @@
>  #!/bin/sh
>  
> -#   Copyright 2003  Free Software Foundation, Inc.
> +#   Copyright 2003, 2005  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
> @@ -16,9 +16,6 @@
>  # along with this program; if not, write to the Free Software
>  # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
>  
> -# Please email any bugs, comments, and/or additions to this file to:
> -# bug-gdb@prep.ai.mit.edu
> -
>  #
>  # gcore.sh
>  # Script to generate a core file of a running program.
> @@ -48,6 +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
>  
> @@ -55,17 +63,15 @@ rc=0
>  for pid in $*
>  do
>  	# Write gdb script for pid $pid.  
> -
> -	# Avoid need for temporary files by using funky "here
> -	# document" feature of sh.
> -
> -	/usr/bin/gdb > /dev/null << EOF
> -	attach $pid
> -	gcore $name.$pid
> -	detach
> -	quit
> +	cat >>$tmpfile <<EOF
> +attach $pid
> +gcore $name.$pid
> +detach
> +quit
>  EOF
>  
> +	gdb -x $tmpfile -batch
> +
>  	if [ -r $name.$pid ] ; then 
>  	    rc=0
>  	else
> @@ -78,4 +84,3 @@ EOF
>  done
>  
>  exit $rc
> -
> 

-- 
Daniel Jacobowitz
CodeSourcery, LLC


  reply	other threads:[~2005-09-26  1:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-10  2:18 Qunying Pan
2005-09-11  1:12 ` Michael Snyder
2005-09-11  4:35   ` Daniel Jacobowitz
2005-09-11 21:37     ` Qunying Pan
2005-09-11 21:19 ` Mark Kettenis
2005-09-11 23:08   ` Daniel Jacobowitz
2005-09-17 21:58 ` Daniel Jacobowitz
2005-09-17 22:18   ` Mark Kettenis
2005-09-17 22:27     ` Daniel Jacobowitz
2005-09-26  1:52       ` Daniel Jacobowitz [this message]
2005-09-26  7:20         ` Mark Kettenis
2005-10-02 23:01           ` Daniel Jacobowitz

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=20050926015218.GH22284@nevyn.them.org \
    --to=drow@false.org \
    --cc=gdb-patches@sources.redhat.com \
    --cc=mark.kettenis@xs4all.nl \
    --cc=qpan@mvista.com \
    --cc=qunyingpan@gmail.com \
    /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