No announcement yet.

PB/DLL Debugger

  • Filter
  • Time
  • Show
Clear All
new posts

    PB/DLL Debugger

    I tried to use the debugger in PB/DLL to find out why the subway stop program that was created using DDT was not running properly but after stepping through the code in the PBMAIN function, the debugger got stuck at the "dialog show modal hdlg01" line. In the select case/end case loop, the program skips over the code that give me alternate routes by itself. The program is too big to be posted on this forum. Jeffrey.

    When the DIALOG SHOW MODAL statement is executed, the statement does appear to complete until a matching DIALOG END statement is executed elsewhere in your code. If you trigger an event in the application window (ie, click a button, etc), then the debugger will take you to the relevant callback ready to continue stepping through the code.

    How is this possible I hear you ask? The answer is that sections of your code are executing in a "reenterant" or "recursive" fashion. This means that your callbacks are executing in response to user events such as button clicks, etc, but the 'main' code gives the appearance of being stalled.

    For example, in a Win32 GUI application, it is possible for code in a Callback to send a message (using DIALOG SEND and CONTROL SEND or SendMessage(), etc) to itself, which causes the same callback code to execute and process the latest message and (usually) return a result back whereupon the 1st message processing will continue.

    So, how do you get to debug a callback function? The answer is to set breakpoints in your callback function(s) so that the debugger can be halted where you really want to start single-stepping the code.

    If you wish to see the effect of "recursive" code execution in your callback functions, set the debugger to Animate, and bring your application window to the foreground. As you click buttons, you can watch the callback code being executed by the debugger. Because it takes some time to process each click message, don't queue up too many events at once as it can become difficult to 'visualize' which callback event is being processed at any one instant.

    Clear as mud? This is a difficult concept to explain, but it is an integral part of how Windows code executes. DOS programmers often struggle with these concepts as they move to GUI programming because the concepts are so different to how things work in DOS.

    If you still get stuck, Jeffrey, post you email address and if you are lucky, some helpful person may offer to help you debug your code via email.

    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    mailto:[email protected]


      Lance, Thanks for telling me to set the debugger to Animate. I made a mistake of removing "buttonpressed=1" from the callback function for "Next Station" button and that was why the program was not running properly. I put the line back and the program ran properly. Jeffrey.