跳过导航链接 | |
退出打印视图 | |
![]() |
Oracle Solaris Studio 12.3:使用 dbx 调试程序 Oracle Solaris Studio 12.3 Information Library (简体中文) |
如果程序出现段故障 (SIGSEGV),便会引用其可用内存外的内存地址。
导致段故障的最常见原因:
使用程序来生成段故障:
demo% cat WhereSEGV.f INTEGER a(5) j = 2000000 DO 9 i = 1,5 a(j) = (i * 10) 9 CONTINUE PRINT *, a END demo%
demo% f95 -g -silent WhereSEGV.f demo% a.out Segmentation fault 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)