Re: A more accurate System.map, including modules

Keith Owens (kaos@ocs.com.au)
Tue, 23 Sep 1997 00:25:27 +1000


On Mon, 22 Sep 1997 22:49:13 +1000,
Richard Gooch <rgooch@atnf.CSIRO.AU> wrote:
>> I think the best option is
>> regular and/or exception capture of /proc/ksyms to an external file.
>
>Yes, although I would also like to see a mode where you use and old
>logfile and ignore /proc/ksyms entirely, so you can do offline
>debugging.

Instead of patching insmod/rmmod to write to syslog, coding a program
to extract the syslog data and worrying if you have all the syslog
entries, try this wrapper. It saves /proc/ksyms whenever insmod or
rmmod are run, then you pick the saved ksyms you want to feed into the
oops decoder.

#!/bin/bash
#
# Wrapper around insmod and rmmod to save /proc/ksyms for later
# input to make_System_map. To install this wrapper :-
#
# mkdir /var/ksyms
# chmod 644 /var/ksyms
# mv /sbin/insmod /sbin/insmod.real
# mv /sbin/rmmod /sbin/rmmod.real
# mv this.script /sbin/insmod
# ln /sbin/insmod /sbin/rmmod
#
# Keith Owens <kaos@ocs.com.au> Mon Sep 22 1997

case "$0" in
*insmod*) /sbin/insmod.real "$@" || exit $?;;
*rmmod*) /sbin/rmmod.real "$@" || exit $?;;
*) echo invoked as unexpected name "$0" ; exit 1;;
esac

# Tweakable parameters
logdir=/var/ksyms
filename=$logdir/`date +%Y%m%d%H%M%S`
keepmin=1440 # minutes to keep, 1440 = 24 hours

# save current ksyms as a timestamped filename
/bin/cat /proc/ksyms > $filename || ( echo "cannot save /proc/ksyms to $filename"; exit 1 )

# Clean up old versions
/usr/bin/find $logdir -mmin +$keepmin -exec rm {} \;