Re: backtracing
- From: "Yo 'Ric Dude" <ericmit ix netcom com>
- To: Todd Graham Lewis <tlewis mindspring net>
- CC: Paul G Cooper <pgc maths warwick ac uk>, Tom Tromey <tromey cygnus com>, "'gnome-list gnome org'" <gnome-list gnome org>
- Subject: Re: backtracing
- Date: Sat, 24 Oct 1998 11:57:50 -0400
Todd Graham Lewis wrote:
>
> On Sat, 24 Oct 1998, Paul G Cooper wrote:
>
> > I'd like to know how to do this - please could you point me you point me
> > to some docs? I promise not to be rude ;-)
[snip backtrace example]
> This is a little contrived, but the steps are basically the same. I will
> be adding a section on how to do backtraces to the FAQ later today in the
> "How to Report a Bug" section.
Attached is a script I found on the net, which will generate
the backtrace from a core file. Simply type "idcore -l".
This might be a useful thing to add to the faq, or gnome itself.
> --
> Todd Graham Lewis 32°49'N,83°36'W (800) 719-4664, x2804
> ******Linux****** MindSpring Enterprises tlewis@mindspring.net
-- ebm
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+
| __ a.k.a. Eric B. Mitchell |
| |_) . _ _| _| _ ericmit@ix.netcom.com |
| | \ ( (_ (_| (_| (_| (/_ www.netcom.com/~ericmit |
| How's My Programming? Call: 1 - 800 - DEV - NULL |
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+
#!/bin/sh
# name: idcore -- identify which binary caused a core dump
# author: c.l.s. (cspiel@physik.tu-muenchen.de)
# last rev.: 1998-01-22 11:14
# bash ver.: 1.14.7(1)
# $Id$
# display help message
# char* disp_help(void)
function disp_help
{
echo "usage:"
echo " idcore [OPTION] [[COREDUMP] ...]"
echo
echo " If COREDUMP is omitted the core file in the current"
echo " directory is used."
echo
echo " -h, --help display this help message"
echo " -v, --version show version of idcore"
echo " -b, --brief brief format, i.e. filename only"
echo " -l, --long long format, with filename, signal,
user,"
echo " date, and backtrace"
}
# retrieve name binary that caused core dump via gdb
# char* get_name(const char* mode, const char* name)
function get_name
{
case "$1" in
brief)
echo q | gdb --quiet --core="$2" 2>&1 | head -1 | \
sed -ne "s/^.*\`\(.*\)'\.$/\1/p"
;;
standard)
echo q | gdb --quiet --core="$2" 2>&1 | head -2
;;
long)
dump=$(echo -e "where\nq" | \
gdb --quiet --core="$2" 2>&1)
echo "$dump" | head -2 | sed -ne '2,2s/\.$//p'
ls -l "$2" | \
awk '{ print "on", $6, $7, $8, "caused by", $3 }'
echo
echo "backtrace:"
echo "$dump" | sed -ne '/^(gdb) /s/^(gdb) //p'
;;
esac
}
#
# start of main
#
myname=$(basename "$0") # name of shell-script
mode=standard # normal mode of operation
case "$1" in
-h | --help)
disp_help
exit 1
;;
-v | --version)
echo "version 0.1.0"
exit 0
;;
-b | --brief)
mode=brief
shift
;;
-l | --long)
mode=long
shift
;;
-* | --*)
echo "$myname: unknown option $1"
exit 2
;;
esac
if [ -z "$1" ]; then
# no argument -> look at core in the current directory
get_name "$mode" core
else
# process all arguments
for c; do
# echo file we are processing
if [ "$mode" != "brief" ]; then
echo "$c: "
fi
get_name "$mode" "$c"
done
fi
exit 0
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]