home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.sources.wanted:4280 comp.unix.questions:10891 comp.windows.x:16457
- Newsgroups: comp.sources.wanted,comp.unix.questions,comp.windows.x
- Path: sparky!uunet!cs.utexas.edu!torn!cunews!nrcnet0!bnrgate!bcars267!bmdhh243!agc
- From: agc@bmdhh298.bnr.ca (Alan Carter)
- Subject: Re: Stack Traceback program wanted
- Message-ID: <1992Sep10.094948.3497@bnr.uk>
- Sender: news@bnr.uk (News Administrator)
- Nntp-Posting-Host: bmdhh298
- Organization: BNR-Europe-Limited, Maidenhead, England
- References: <1992Sep9.143656.20352@kocrsv01.delcoelect.com> <1992Sep09.172755.17887@bnr.uk> <1992Sep9.193434.2713@kocrsv01.delcoelect.com>
- Date: Thu, 10 Sep 1992 09:49:48 GMT
- Lines: 64
-
- In article <1992Sep9.193434.2713@kocrsv01.delcoelect.com>, c23st@kocrsv01.delcoelect.com (Spiros Triantafyllopoulos) writes:
- |> In article <1992Sep09.172755.17887@bnr.uk> agc@bmdhh298.bnr.ca (Alan Carter) writes:
- |> >In article <1992Sep9.143656.20352@kocrsv01.delcoelect.com>, c23st@kocrsv01.delcoelect.com (Spiros Triantafyllopoulos) writes:
- |> >|> we're looking for a program to do stack a trace before it coredumps. We
- |> >|> would like to see, for example, the sequences of calls that resulted
- |> >|> in the program to bomb.
- |> >
- |> >The compiler will do this for you. Compile your code
- |> >
- |> > cc -g -o spiros spiros.c
- |> >
- |> >Then after you have got your coredump, use adb,
- |> >
- |> > adb spiros
- |> >
- |> >and give the command
- |> >
- |> > $c
- |> >
- |> (judging from my weight, adb would probably go out of memory :-). But
- |> seriously, what we have in mind is really to compile such a function in
- |> our program and do it 'on demand' every time it crashes, so we can have
- |> a log of what happened.
- |>
- |> We can always ask the users to run a utility on the core file and see
- |> what happens afterwards... maybe a little script to examine core and
- |> do the $c command.
- |>
- |> Is the core format published anywhere?
-
- What about
-
- cd prog_pwd
- var=0
- while true
- do
- if test -f core
- then
- mv core logcore$var
- var=`expr $var + 1`
- fi
- sleep 300
- done
-
- Which will keep your core files as logcore0, logcore1 etc. You can then
- analyse them at your convenience. Trapping the signal and interpreting
- your stack in the handler would be far more awkward, and inherently
- non-portable. You'll probably have to interpret your stack frames
- yourself - the format in core files is normally interpreted by the adb
- like tools and is not usually published. Programs are not supposed to
- play around with their own stacks at all :-) The useful thing about
- saving the whole cores is that you will be able to do more investigation,
- like examining variables.
-
- Alan
-
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Maidenhead itself is too snobby to be pleasant. It is the haunt of the
- river swell and his overdressed female companion. It is the town of showy
- hotels, patronized chiefly by dudes and ballet girls.
-
- Three Men In A Boat, Jerome K. Jerome, 1889
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-