User forums > Using Code::Blocks

Debug: go back to line before

(1/1)

hqt:
I'm using Code::Block nightly built version, and I have a small problem when I debug a program.
for example, I debug at line 10: a function call, and I hit F7, it will goto line 11 (of course, I don't want :( because I want to go through this function to view how it work by Shift+F7) So, I must start again from beginning function, and go through some loop to go here again :(-->and It's too slow.
So, I don't know how can back again 1 line. It mean,it will come back to line 10 again(and of course, no variable change :) )

so who know this problem, please help me please.

ollydbg:
Show us the sample code. Also, Could you use more formal items like "step into" "step" instead of the short-cut key name.
I have different short-cut key mapping, so I event don't know what "F7" means.

hqt:
Oh, I'm sorry so much, because I often use default shortcut, so I rarely think there some people different from me.
So, this is my problem:

--- Code: ---int main(){
            For(i=1;i<=n;i++){
                 ...... some line of code;
                 Function();
               printf();
                ....... some line of code;
            }
}

--- End code ---
I debug at line Function(), and I want to go through this function-> press "step into". But I have pressed "next line" (But I don't want to), so I will go to line "printf" ---> so I cannot see what  "function" do (and most of case, It have wrong answer, so I need to view it carefully).
So, the unique solution that I know is: I will restart debug, and debug again from int main(). It seem easy, but if my program run right from (i=1-->10), and wrong when i=11, so I must go through tenth times :-O

that's my problem, hope that clearer for you.
so, thanks for all :)

ollydbg:

--- Code: ---Menu->debug->Set Next Statement.
--- End code ---
This will help you. Mostly you don't need this command, you can set a bp in the Function body to see whether something is wrong.

BTW: This command may not work correctly or will crash your app, because you directly set the PC pointer. Take care!!!

oBFusCATed:

--- Quote from: hqt on September 09, 2011, 10:08:35 am ---So, I don't know how can back again 1 line. It mean,it will come back to line 10 again(and of course, no variable change :) )

--- End quote ---
"no variable change" <- this is almost impossible.

Probably you can try command line gdb + reversed debugging (I think it works only on linux and it is quite slow)

For other sane usages "set next statements" is quite good, but you need debugger's branch nightly.

Navigation

[0] Message Index

Go to full version