On Saturday, April 25, 2015 7:42:30 PM cov...@ccs.covici.com wrote:
> > (gdb) list mount.c:123
> > 118                 else
> > 119                         fputc(*p, stdout);
> > 120         }
> > 121 }
> > 122 
> > 123 static void print_all(struct libmnt_context *cxt, char *pattern, int 
show_label)
> > 124 {
> > 125         struct libmnt_table *tb;
> > 126         struct libmnt_iter *itr = NULL;
> > 127         struct libmnt_fs *fs;
> > (gdb) 
> > 
> > 
> > This seems to me to be very buggy behavior, but I'd like to get opinions 
from
> > people who really know gdb, which I don't.
> 
> I think it wants to put you on the first real statement of the function.
> 

Yes. Also, if you compiled with any optimizations compile again with none. 
That way the compiler will try to generate code that matches the order of your 
C statements. It doesn't guarantees that this won't happen but with 
optimizations if you try to step through the source it'll definitely be jumping 
back and forth. The first statement here is line 126 but it may be optimized 
away or out of order. Also for source code debugging it'll be much easier to 
use a graphical frontend (ddd,kdbg,kdevelop,etc).

-- 
Fernando Rodriguez

Reply via email to