c - Problem in GDB debugging -


i use gdb debug c program, find gdb execute codes twice.

for example,

 ....     stream_t *s = stream_commonnew( vlc_object(p_access) );     stream_sys_t *p_sys;     if( !s )     return null;     s->p_input = p_access->p_input;     s->psz_path = strdup( p_access->psz_path );   .... 

gdb debugging,

292     stream_t *s = stream_commonnew( vlc_object(p_access) ); missing separate debuginfos, use: debuginfo-install dbus-libs-1.2.16-9.fc12.i686 libcap-ng-0.6.2-3.fc12.i686 (gdb) next 295     if( !s ) (gdb)  292     stream_t *s = stream_commonnew( vlc_object(p_access) ); (gdb)  295     if( !s ) (gdb)  298     s->p_input = p_access->p_input; (gdb)  299     s->psz_path = strdup( p_access->psz_path ); (gdb)  298     s->p_input = p_access->p_input; (gdb)  299     s->psz_path = strdup( p_access->psz_path ); 

i confused. explain why?

thanks

it not executing same code twice. compiler optimizations can cause machine instructions reordered, such instructions generated second source line placed before last instruction first source line. gdb's "next" command stops when source line corresponding instruction changes, though may executing rest of source line not finished yet.


Comments