c - Stopping gdb while loop when receiving signal -
i'm trying find segmentation fault in program doesn't happen time. i'm trying run program in loop in gdb until segmentation fault happens.
my problem gdb continues while loop after receiving seg fault , doesn't prompt me gdb shell.
when run gdb use:
set $i=0 while($i<100) set $i = $i+1 r end
anybody know how make gdb stop @ first segfault , not run 100 times??
thanks!
you can script gdb interaction using expect.
but solution this answer should need here.
break on exit didn't work me
it's possible program calls _exit
instead of exit
, may need set breakpoint there.
it's possible program executes direct sys_exit
system call without going through either exit
or _exit
.
on linux, can catch with:
catch syscall exit catch syscall exit_group
at least 1 4 variants should fire (just run program hand). once know variant fires, attach commands corresponding breakpoint, , use solution above.
Comments
Post a Comment