[ LUGOS ] coredumpu

Jernej Kovse jernej.kovse na uni-mb.si
Sob Dec 27 15:30:04 CET 1997


Glede uporabe fork()a pri coredumpu lahko po mojem
poskusis torej z necim takim

int main()
{
  // ... Koda, ki naj se izvrsi pred coredump ... //
  int ret = fork()
  if( ret )
  {
    // Starsevski proces
    // Sem napisi kodo, ki naj se izvaja po tocki, ob kateri
    // zelis izvesti coredump.
  }
  else
  {
    // Sin
    coredump(); // Klic tvojega coredumpu & exit iz
                // iz sinovega procesa
  }
  return( 0 );
}

Mislim, da bo delalo. Ce prav razumem, zelis ti preko coredumpa
odkriti kaksno napako, ki se zgodi v doloceni tocki tvojega programa.
Po mojem mora delati, saj sta oba procesa ob izvedbi forka identicna,
po forku pa se izvajata neodvisno. 

Tole je iz Curt Schimmel: Symmetric Multiprocessing and Caching for Kernel
Programmers (UNIX Systems for Modern Architectures), ISBN 0-201-63338-8

The child process is created with a single thread of control that is
identical to the thread within the parent that invoked the fork. Once
created, the child process executes independently of the parent. At the
completion od fork, both processes are identical. The only difference 
between the contexts of the two processesis the return value of the fork
system call itself.

Ce bos v sinovo kodo pred coredump dal se kaj kode, ne pozabi, da
moras z debuggerjem opazovati oba procesa.

Res me zanima, ce tole dela, zato prosim za feedback.

Jernej




Dodatne informacije o seznamu Starilist