[comp.unix.programmer] Improving on "memory fault - core dumped"

ian@cs.man.ac.uk (Ian Cottam) (06/21/91)

I have found that many users here, and elsewhere, are reluctant to
learn dbx, dbxtool, xdbx or whatever your preferred debugger is called
on your UNIX system.  Students often want to delay learning about such
arcane beasts until they have mastered the programming language
of choice.

I have written a sh script that drives dbx automatically to produce
what on some other systems is called a post-mortem dump - hence the
command script's name: pmd.

Suppose running

testprog S3--C/TESTS/kmt_data_module

produces

Memory fault - core dumped

Below is what running

pmd testprog S3--C/TESTS/kmt_data_module

produces

Script started on Fri Jun 21 09:53:24 1991
$ pmd testprog S3--C/TESTS/kmt_data_module
/arch/ian/bin/pmd: 24595 Memory fault - core dumped
(testprog S3--C/TESTS/kmt_data_module) -- fault on or about line 434
testprog.c
skipPragma
  431                   return;
  432           }
  433           ++ cp;  
  434           while (ch= f[cp-100000], ch != '\0') {
  435                   ++ cp;
  436                   if (ch == '>' && f[cp] == ')')
  437                           break;
ch = 0

Called from function: skipWCPS
  465                   skipPragma();
testprog.c
pos = 27
ch = 40

Called from function: process
  149             skipWCPS();
testprog.c
word = "KMT_DATA_M"
startword2 = 11553
startword = 7
len = 10

Called from function: main
  130           process();
testprog.c
argv = 0xefffdc8
argc = 2

$ ^D

script done on Fri Jun 21 09:53:33 1991


I find  pmd  quite convenient, even though I am an experienced *dbx* user.
(For example, typing cont.-\ at a looping program gives you some useful
info as to why the loop has not terminated.)

Would anyone be interested in a free copy of this script, or is it
too trivial to be useful?
Should it be posted, and if so what is the appropriate news group?

--
Ian Cottam, Room IT209, Department of Computer Science,
University of Manchester, Oxford Road, Manchester, M13 9PL, U.K.
Tel: (+44) 61-275 6157         FAX: (+44) 61-275-6236
Internet: ian%cs.man.ac.uk;  JANET: ian@uk.ac.man.cs