android - Why is GDB "jumping back" when debugging with c source codes -



android - Why is GDB "jumping back" when debugging with c source codes -

i'm debugging goldfish android kernel (version 3.4), kernel sources.

now found gdb jump , forth between lines, e.g consider c source code following:

char *xxx; int a; ... if (...) { }

when reached if clause, type in n , jump int a part. why that?

if execute command again, come in brackets in if.

if possible, want avoid part, , come in if straight (of course, if status matches)

when reached if clause, type in n , jump int part. why that?

because code compiled optimization on, , compiler can (and does) re-arrange instructions of programme in such way instructions "belonging" different source lines interleaved (code motion optimizations effort (among other things) move load instructions long before results needed; helps hide memory latency).

if using gcc-4.8 or later, build sources -og. else, see this answer.

android debugging gdb kernel

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -