But if I step into it by gdb ,then the program often hangs when I step
over a function from SDL.
and in what exactly state your program is then? (hint: try ps axl)
It's un-believable that a GUI library is written just through the
tiring process
( write , compile , execute ,print debug_message ) again & again .
Not sure of GUI libraries, but all of my projects go this way. It takes
quite an effort to lock up SDL and X11 to the point where you’re unable
to kill the program or X server. If you managed that, you’ve likely
got major problems in critical piece of code, which had to be debugged
as the very first thing to do, and debugged to the state of bullet-proofness,
no matter how much compile/exec/analyse_output cycles it is going to take.
After that, an xterm with gdb is sufficient, and even not necessary if you
put enough printfs (syslogs) into your code.