

core                       File Format                       core




Core dump file format

#include <sys/uproc.h>

When a  process terminates abnormally because  of a process fault
or  because  it  receives  an  asynchronous signal  from  another
process, COHERENT  tries to  write a  memory dump of  the process
into  a file  called core.   This file contains  an image  of the
process code,  data segments, the system  description segment for
the aborted  process.  The following lists  the segment types and
the symbolic names of their locations in the file:


          SSIIUUSSEERRPP   User process description segment
          SSIISSTTAACCKK   User stack segment
          SSIISSTTEEXXTT   Shared text segment
          SSIIPPTTEEXXTT   Private text segment
          SSIISSDDAATTAA   Shared data segment
          SSIIPPDDAATTAA   Private data segment


Not every  dump necessarily contains  all of the  above segments.
Neither shared  text nor shared  data segments are  dumped.  They
are write-protected in memory,  and the load module that was run-
ning when the dump occurred contains shared segment data.

The best way for a program  (such as a debugger) to read the core
file is to first read the user process description segment, which
is always at  the front and has a fixed  size.  It should be read
into an  area UPASIZE bytes long,  but referenced with structured
type UPROC  (somewhat smaller than UPASIZE  because of the system
stack, which contains the user registers and other information in
fixed places).

The u_segl  member of  the UPROC structure  is a list  of segment
reference descriptors that contain the virtual address and length
of  each segment,  which correspond  exactly to  its size  in the
dump.  NUSEG segments are possible; the flag SRFDUMP in the field
sr_flag indicates that a  segment was dumped.  By using the above
method, you can use the entire file to reference program data and
code at the time of the dump.

Other information found in the user process structure may be per-
tinent; the header file sys/uproc.h contains more information.

***** See Also *****

db, file formats, kill, l.out.h, signal(), wait()

***** Diagnostics *****

COHERENT will not write core  if it already exists as a non-ordi-
nary file or if there is  more than one link to it.  The 0200 bit
in the status returned to  the parent process by wait indicates a


COHERENT Lexicon                                           Page 1




core                       File Format                       core



successful dump.
























































COHERENT Lexicon                                           Page 2


