[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: strange behavior of executables



On Wed, 2002-03-20 at 14:30, Carlo U. Segre wrote:
> 
> Hello All:
> 
> I have been coming across a strange behavior with a compiled FORTRAN
> program.
> 
> I use g77 to compile it (version doesn't matter) and when I try to run the
> executable on some machines it works fine.  On other machines, it stops
> with a segfault immediately.  The two machines are both running the
> woody/testing distribution and I can't see the difference between them.
> 
> I use the file and the ldd commands on the executables on both the
> machines and I get the following:
> 
> working machine:
> 
> $ file feff828_g77O3
> feff828_g77O3: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
> dynamically linked (uses shared libs), not stripped
> 
> $ ldd feff828_g77O3
> 	libm.so.6 => /lib/libm.so.6 (0x40022000)
> 	libc.so.6 => /lib/libc.so.6 (0x40044000)
> 	/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
> 
> 
> non-working machine:
> 
> $ file feff828_g77O3
> feff828_g77O3: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
> dynamically linked (uses shared libs), not stripped
> 
> $ ldd feff828_g77O3
> ldd: /lib/ld-linux.so.2 exited with unknown exit code (139)
> 
> 
> This is the same executable file on both machines but the problem occurs
> even if I compile it directly on the non-working machine.  The compilation
> works but the executable does not.
> 
> Any ideas?

Compile with the debug flag (-g). Try and get a core dump. Make sure
ulimit -c is set to unlimited. Get it to crash. Then use gdb to load in
the core file. Use back trace to see where it dies.

In fact if you compile with debugging support, just run it so it runs
inside gdb. Then theres no need for a core file at all.

The debugger is your friend. Its tricky at first because of the new
commands. But once you start experimenting, you'll be pleasantly
surprised.

Crispin Wellington



Reply to: