Search code examples
delphidelphi-7breakpoints

Delphi 7: Actual reason for a data breakpoint warning


On Delphi 7, I recived a warning message: "Setting a Data Breakpoint on a stack location may cause your program or system to become unstable. Set breakpoint anyway?". The short description of this message does not explain the reason why the program (or system) may become unstable. It only says that it may happen.

I would like to ask you for a concrete explanation with the reason why/when the program (or system) will be unstable.


Solution

  • A Data Breakpoint is triggered by a write operation to memory at a specified location. Detecting these operations, whether by use of a hardware breakpoint or other techniques, cannot - to my knowledge - cause a program, let alone an entire system, to become unstable.

    There are however problems with creating data breakpoints in the stack area. These problems can lead to debugger behaviours which are almost certainly undesirable and could be considered "instability", due to the volume and frequency of breakpoints rendering the debugger unusable.

    But this is the only extent to which the "system" or the "program" can be made unstable.

    The error message is most likely using abbreviated language which is arguably misleading in an attempt to convey this in terms which are suitable for a short, terse error message, since the actual, accurate explanation is both harder to explain and perhaps less likely to be understood by many developers.

    It is also possible that placing a Data Breakpoint in the stack did have the potential to cause wider system problems pre-Win32 (I don't know for sure, but I can imagine it is possible - it was certainly easier for a program failure to crash an entire system under Win16); i.e. that this message is a hang-over from Delphi 1 and was simply not updated to reflect the greater protection that processes enjoy under Win32.