]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
2007-02-17 Ulrich Drepper <drepper@redhat.com>
authorJakub Jelinek <jakub@redhat.com>
Thu, 12 Jul 2007 14:55:40 +0000 (14:55 +0000)
committerJakub Jelinek <jakub@redhat.com>
Thu, 12 Jul 2007 14:55:40 +0000 (14:55 +0000)
[BZ #3348]
* malloc/memusage.sh: Cleanups.
* debug/xtrace.sh: Quoting and trap changes.

ChangeLog
debug/xtrace.sh
malloc/memusage.sh

index 3f480904af76c8505707bc225248beb90249487d..f121f4ff4680161e9049344141fda9de6e60d79e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-02-17  Ulrich Drepper  <drepper@redhat.com>
+
+       [BZ #3348]
+       * malloc/memusage.sh: Cleanups.
+       * debug/xtrace.sh: Quoting and trap changes.
+
 2007-02-16  Ulrich Drepper  <drepper@redhat.com>
 
        * locale/iso-3166.def: Add entry for Serbia.
index 082db3f349e44ca8ac086f07d343a768b3d6c4a5..f34ac5c646e045e7db372f54faf6769ef14a2b56 100755 (executable)
@@ -161,32 +161,32 @@ if test -n "$data"; then
   while read fct; do
     read file
     if test "$fct" != '??' -a "$file" != '??:0'; then
-      format_line $fct $file
+      format_line "$fct" "$file"
     fi
   done
 else
-  fifo=$(mktemp -u ${TMPDIR:-/tmp}/xtrace.XXXXXX)
+  fifo=$(mktemp -ut xtrace.XXXXXX) || exit
+  trap 'rm -f "$fifo"; exit 1' HUP INT QUIT TERM PIPE
   mkfifo -m 0600 $fifo || exit 1
-  trap 'rm $fifo; exit 1' SIGINT SIGTERM SIGPIPE
 
   # Now start the program and let it write to the FIFO.
   $TERMINAL_PROG -T "xtrace - $program $*" -e /bin/sh -c "LD_PRELOAD=$pcprofileso PCPROFILE_OUTPUT=$fifo $program $*; read < $fifo" &
   termpid=$!
-  $pcprofiledump -u $fifo |
+  $pcprofiledump -u "$fifo" |
   while read line; do
-     echo $line |
+     echo "$line" |
      sed 's/this = \([^,]*\).*/\1/' |
-     addr2line -fC -e $program
+     addr2line -fC -e "$program"
   done |
   while read fct; do
     read file
     if test "$fct" != '??' -a "$file" != '??:0'; then
-      format_line $fct $file
+      format_line "$fct" "$file"
     fi
   done
   read -p "Press return here to close $TERMINAL_PROG($program)."
-  echo > $fifo
-  rm $fifo
+  echo > "$fifo"
+  rm "$fifo"
 fi
 
 exit 0
index ecc935d0376d138bb77732912091c29fee4d860e..c767b030c4e80ed129403c1f6b9b8defc7111c44 100755 (executable)
@@ -77,6 +77,15 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
   exit 0
 }
 
+# These variables are local
+buffer=
+data=
+memusagestat_args=
+notimer=
+png=
+progname=
+tracemmap=
+
 # Process arguments.  But stop as soon as the program name is found.
 while test $# -gt 0; do
   case "$1" in
@@ -213,15 +222,8 @@ datafile=
 if test -n "$data"; then
   datafile="$data"
 elif test -n "$png"; then
-  datafile=$(mktemp ${TMPDIR:-/tmp}/memusage.XXXXXX 2> /dev/null)
-  if test $? -ne 0; then
-    # Lame, but if there is no `mktemp' program the user cannot expect more.
-    if test "$RANDOM" != "$RANDOM"; then
-      datafile=${TMPDIR:-/tmp}/memusage.$RANDOM
-    else
-      datafile=${TMPDIR:-/tmp}/memusage.$$
-    fi
-  fi
+  datafile=$(mktemp -t memusage.XXXXXX) || exit
+  trap 'rm -f "$datafile"; exit 1' HUP INT QUIT TERM PIPE
 fi
 if test -n "$datafile"; then
   add_env="$add_env MEMUSAGE_OUTPUT=$datafile"