Debugging a Program With dbx

Using dbx to Locate Problems

Use dbx to find the source code line where a segmentation fault occurred.

Use a program to generate a segmentation fault:


demo% cat WhereSEGV.f
	INTEGER a(5)
	j = 2000000 
	DO 9 i = 1,5 
		a(j) = (i * 10)
9	CONTINUE 
	PRINT *, a
	END 
demo%

Use dbx to find the line number of a dbx segmentation fault:


demo% f77 -g -silent WhereSEGV.f
demo% a.out
*** TERMINATING a.out
*** Received signal 11 (SIGSEGV)
Segmentation fault (core dumped)
demo% dbx a.out
Reading symbolic information for a.out
program terminated by signal SEGV (segmentation violation)
(dbx) run
Running: a.out 
signal SEGV (no mapping at the fault address) 
    in MAIN at line 4 in file "WhereSEGV.f"
    4                   a(j) = (i * 10)
(dbx)