Author Topic: Edit-and-Continue and Running-Backward in Debug  (Read 7870 times)

Offline lehe

  • Multiple posting newcomer
  • *
  • Posts: 35
Edit-and-Continue and Running-Backward in Debug
« on: February 28, 2009, 04:42:21 am »

Hi,
I got two questions about debugging

1. Does CB has something like "Edit and Continue" as in Visual C++? More specifically, in VC, "Edit and Continue is a time-saving feature that enables you to make changes to your source code while your program is in break mode. When you resume execution of the program by choosing an execution command like Continue or Step, Edit and Continue automatically applies the code changes with some limitations. This allows you to make changes to your code during a debugging session, instead of having to stop, recompile your entire program, and restart the debugging session."

2. Does CB provide the ability to run programs backward? My CB is using gdb. As gdb reference says, "If the target environment supports it, gdb can allow you to “rewind” the program by running it backward". Then how to make my target environment support it in CB?

Thanks in advance!

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5226
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Edit-and-Continue and Running-Backward in Debug
« Reply #1 on: February 28, 2009, 05:11:10 am »

Hi,
I got two questions about debugging

1. Does CB has something like "Edit and Continue" as in Visual C++? More specifically, in VC, "Edit and Continue is a time-saving feature that enables you to make changes to your source code while your program is in break mode. When you resume execution of the program by choosing an execution command like Continue or Step, Edit and Continue automatically applies the code changes with some limitations. This allows you to make changes to your code during a debugging session, instead of having to stop, recompile your entire program, and restart the debugging session."

NO.
By the way, if the linker and gdb can do this, then c::b can.
Edit:
I don't think this feature is necessary.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline lehe

  • Multiple posting newcomer
  • *
  • Posts: 35
Re: Edit-and-Continue and Running-Backward in Debug
« Reply #2 on: February 28, 2009, 05:25:06 am »
It could be handy to me when it has taken so long to get to a point where I want to make a slight change to the code but don't want to wait another long time to get to the same place. If you have alternative strategy in such case, it would be nice!

How about running backwards? Does it require setting up some option during compilation?

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5226
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Edit-and-Continue and Running-Backward in Debug
« Reply #3 on: February 28, 2009, 05:35:51 am »
It could be handy to me when it has taken so long to get to a point where I want to make a slight change to the code but don't want to wait another long time to get to the same place. If you have alternative strategy in such case, it would be nice!

How about running backwards? Does it require setting up some option during compilation?

So, You mean "move the EPC when debugging?".
There are some topics on this forum, just search.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline lehe

  • Multiple posting newcomer
  • *
  • Posts: 35
Re: Edit-and-Continue and Running-Backward in Debug
« Reply #4 on: February 28, 2009, 05:47:49 am »
By running backwards, I mean "When you are debugging a program, it is not unusual to realize that you have gone too far,
and some event of interest has already happened. If the target environment supports it,
gdb can allow you to “rewind” the program by running it backward."
What is  EPC?

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5226
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Edit-and-Continue and Running-Backward in Debug
« Reply #5 on: February 28, 2009, 06:01:48 am »
What is  EPC?
http://en.wikipedia.org/wiki/Program_counter

I haven't used "rewind" before, so, I have no comment on that.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Edit-and-Continue and Running-Backward in Debug
« Reply #6 on: February 28, 2009, 11:23:07 am »

Hi,
I got two questions about debugging

1. Does CB has something like "Edit and Continue" as in Visual C++? More specifically, in VC, "Edit and Continue is a time-saving feature that enables you to make changes to your source code while your program is in break mode. When you resume execution of the program by choosing an execution command like Continue or Step, Edit and Continue automatically applies the code changes with some limitations. This allows you to make changes to your code during a debugging session, instead of having to stop, recompile your entire program, and restart the debugging session."

2. Does CB provide the ability to run programs backward? My CB is using gdb. As gdb reference says, "If the target environment supports it, gdb can allow you to “rewind” the program by running it backward". Then how to make my target environment support it in CB?

Thanks in advance!

1. No, gcc does not (yet?) support incremental compiling.
There is (was?) a project to make gcc compile incremental, see here: http://gcc.gnu.org/wiki/IncrementalCompiler.

2. Also no, even if it can be an intersting feature, but I just tested it on a small wxWidgets-project from commandline, and it seems not to work reliable.