Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F140144180
D7218.id18467.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D7218.id18467.diff
View Options
Index: usr.sbin/crashinfo/crashinfo.sh
===================================================================
--- usr.sbin/crashinfo/crashinfo.sh
+++ usr.sbin/crashinfo/crashinfo.sh
@@ -35,6 +35,22 @@
exit 1
}
+# Run a single gdb command against a kernel file in batch mode.
+# The kernel file is specified as the first argument and the command
+# is given in the remaining arguments.
+gdb_command()
+{
+ local k
+
+ k=$1 ; shift
+
+ if [ -x /usr/local/bin/gdb ]; then
+ /usr/local/bin/gdb -batch -ex "$@" $k
+ else
+ echo -e "$@" | /usr/bin/gdb -x /dev/stdin -batch $k
+ fi
+}
+
find_kernel()
{
local ivers k kvers
@@ -55,8 +71,8 @@
# Look for a matching kernel version.
for k in `sysctl -n kern.bootfile` $(ls -t /boot/*/kernel); do
- kvers=$(echo 'printf " Version String: %s", version' | \
- gdb -x /dev/stdin -batch $k 2>/dev/null)
+ kvers=$(gdb_command $k 'printf " Version String: %s", version' \
+ 2>/dev/null)
if [ "$ivers" = "$kvers" ]; then
KERNEL=$k
break
@@ -151,11 +167,10 @@
umask 077
# Simulate uname
-ostype=$(echo -e printf '"%s", ostype' | gdb -x /dev/stdin -batch $KERNEL)
-osrelease=$(echo -e printf '"%s", osrelease' | gdb -x /dev/stdin -batch $KERNEL)
-version=$(echo -e printf '"%s", version' | gdb -x /dev/stdin -batch $KERNEL | \
- tr '\t\n' ' ')
-machine=$(echo -e printf '"%s", machine' | gdb -x /dev/stdin -batch $KERNEL)
+ostype=$(gdb_command $KERNEL 'printf "%s", ostype')
+osrelease=$(gdb_command $KERNEL 'printf "%s", osrelease')
+version=$(gdb_command $KERNEL 'printf "%s", version' | tr '\t\n' ' ')
+machine=$(gdb_command $KERNEL 'printf "%s", machine')
exec > $FILE 2>&1
@@ -174,7 +189,11 @@
if [ $? -eq 0 ]; then
echo "bt" >> $file
echo "quit" >> $file
- kgdb $KERNEL $VMCORE < $file
+ if [ -x /usr/local/bin/kgdb ]; then
+ /usr/local/bin/kgdb $KERNEL $VMCORE < $file
+ else
+ kgdb $KERNEL $VMCORE < $file
+ fi
rm -f $file
echo
fi
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 21, 7:40 PM (3 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27116127
Default Alt Text
D7218.id18467.diff (1 KB)
Attached To
Mode
D7218: Update crashinfo to work with newer gdb from ports.
Attached
Detach File
Event Timeline
Log In to Comment