martin-pabst / Online-IDE-new-compiler

Online-IDE with new compiler
GNU General Public License v3.0
1 stars 0 forks source link

Feature Request: Compile while debugging, move instruction pointer #15

Open fjf2002 opened 1 month ago

fjf2002 commented 1 month ago

At work I am currently dealing with good old VBA. The VBA IDE can do some things other, more modern IDEs can't, when debugging.

For example, edit the function while debugging it. At least within some limits. Or move the instruction pointer backwards. At least within the current stack frame.

The user must do this responsibly. Think of side effects like setting variables or something like file.readNextLine().

But in principal, when a statement fails, often it is very satisfying to be able to edit the code, move the instruction pointer and continue execution.

How about that? (Can the online-ide already do things in that direction?)

martin-pabst commented 4 weeks ago
  1. Edit function while debugging: This goal is very difficult to achieve because the compiler currently always builds entire executables and is not able to identify individual program changes and incorporate them into an existing executable. For me it's a miracle that other systems (e.g. Java hot swap) can do this at runtime.

  2. Move instruction pointer backwards If this is limited to the current method we could make snapshots of the uppermost stackframe in single step mode to rollback changes of local variables/method parameters. It's also possible to make snapshots of all fields of the current object. All data structures beyond that are nearly impossible to rollback.

fjf2002 commented 4 weeks ago
  1. Yes, it probably is difficult.
  2. VBA does not care about variable contents. In VBA you can set the instruction pointer backward (or forward), and the variables keep their value. Even if you would implement some magic here, you CANNOT rollback all side effects, for example I/O (files, dbs, HTTP posts, ...).
fjf2002 commented 4 weeks ago

What about changing variables in the debugger? Quite many IDEs can do that.

martin-pabst commented 3 weeks ago

Changing variables in the debugger -> Good idea! I have implemented this now. Please check it out!