IDE does not wait for debugger to "really" stop, if re-compilation is requested
Original Reporter info from Mantis: Martin @martin_frb
-
Reporter name: Martin Friebe
Original Reporter info from Mantis: Martin @martin_frb
- Reporter name: Martin Friebe
Description:
See http://forum.lazarus.freepascal.org/index.php/topic,19725.msg112843.html#msg112843
Steps to reproduce:
If the debugger is:
- running,
- and the debugged app is NOT paused (not at a breakpoint or stepping)
- and you choose "build" or "compile"
=> then a dialog will pop up "Can't compile while debugging. Stop Debugger?".
If you press:
- yes,
- and then press F9 (or run), right after the compiler finishes (F9 is ignored, while the compiler runs),
=> then you will hang the debugger.
Additional information:
Before compiling the IDE asks the debugger to stop. The debugger returns true, if it successfully stopped the debuggee.
But the debugger may still need time to clean up. The ToolStatus will still be itDebugger.
The IDE will not check the ToolStatus, it will start the cempiler, and when finished set the ToolStatus to itNone.
The debugger is not yet done, But due to itNone the IDE thinks otherwise, and will send a new Run request.
This will fail and leave an incorrect state.
-----
The debugger can not finish the stop, because the IDE is running in a ProcessMessages that was called by the debugger. The debugger can only finish, when this returns.
Since the debuggee is already stopped, it is save for the IDE to call the compiler. But it must restore the ToolStatus.
Mantis conversion info:
- Mantis ID: 23800
- OS: win
- OS Build: vista
- Platform: w32
- Version: 1.1 (SVN)
- Fixed in version: 1.1 (SVN)
- Fixed in revision: 40097 (#2e47a308)
- Target version: 1.2.0
- LazTarget: 1.2