Is there is a way for debugging Delphi program in Rad studio with graphic output?
This means even graphic output(the command that has graphic output like print or shows a message and ...) run step by step.
For example inside loop command, we put print or add an item into list view and if we debug this part we can see the result in the form step by step? each turn of the loop show one print or adding to the list separately(by pressing F7 or F8 for debugging)
I hope I have asked my questions correctly.
Thanks
Is it possible to Debug Delphi applications in the way you describe? I'm afraid it is not.
Why not? Both application logic and UI rendering are done within the main thread. And when you set a breakpoint at certain line of code it stop the execution of the entire thread that the code is being executed from.
Since most if not all of your code is ran from main thread setting a breakpoint halts execution of the entire main thread of the application and thus prevents application windows to be redrawn.
In fact since redrawing of windows content is done during idle time of your application it means that running any long loop inside main thread means that the application UI will be updated only when the loop is finished.
You could theoretically force your application to update its UI on each loop cycle by calling Application.ProcessMessages before halting the code on a specific breakpoint.
But using ofApplication.ProcessMessages is not recommended as it could lead to scenarios where messages are not handled in expected order and thus could potentially cause you more problems elsewhere.
Also calling Application.ProcessMesages could seriously affect your application performance so if you decide to use it only use it for Debugging purposes.
Related
I have a following setup:
LuaJIT 64bit in .NET managed, 64bit LuaSocket dll
ZeroBrane 1.80; MobDebug 0.705
Then I have several Lua scripts that are to be launched on specific events and I m trying to debug it.
First script - scripts/OnCreateInstance.lua also starts the MobDebug.
Debugging is working fine in this first script - debugger gets connected on require('mobdebug').start() and also following breakpoints work as expected, but breakpoints in other scripts are never hit.
I've went through the https://studio.zerobrane.com/doc-faq#why-breakpoints-are-not-triggered and haven't found anything suspicious.
debug.getinfo(1,"S").source returns scripts/onstartinstance.lua and scripts/onpushbutton.lua for the second script, which is correct. I am on Windows, so case sensitivity should not apply, and when I've switched the debugger verbose, I've still never seen any info about hitting the breakpoint.
I've also tried listing all the breakpoints in the second script, and all the breakpoints are listed, they just don't hit.
Do someone have any idea, what could be the problem? My only idea is, that it could be because of the second script is run from a different thread that the first script, but that is a thing I cannot avoid and have no idea how to work it around...
Thanks for any help
If the project directory is set correctly and the breakpoints are not triggered from other threads (not individual Lua states), then try adding require('mobdebug').on() calls to those threads/coroutines to enable breakpoints (as described in the first option in the documentation).
occassionally, and without a specific pattern, I run into a situation where the rascal interpreter does not proceed with a debugging session. In the progress window, I get the message:
Reconnecting importers of affected modules: running command.
However, the progress bar remains static. What is causing this to happen? I cannot seem to rid this even if I restart eclipse. It usually starts happening after I start a debug session in a buggy code, then insert a few breakpoints.
Although this is not really a coding question; it may be this is the same UX feedback problem that I've experienced. Since Eclipse Luna and the latest Keppler updates, only when you go into the Debug perspective you see that Rascal is pausing on a breakpoint and the cursor jumps to the right editor. From that view you can then press the Run button to continue finishing the run.
Is there a fast way to search/scan the memory of a process for a specific value,
find the location of this value, edit and save it?
There are examples like Peeping Tom, but it's very slow and has issues with Vista & Win7.
You will have to debug the process (i.e. the equivalent of attaching the process to your custom debugger) and use ReadProcessMemory to read and WriteProcessMemory to write.
This is what the Delphi Code Coverage project is doing to insert breakpoints to track code coverage at runtime.
Look at the class DebugProcess, it has methods to read and write to the memory of the debugged process.
I have a very simple Delphi 2010 dll that I load from a Visiual Studio 2008 C ATL console application (MVF GUI app does not work either). When I debug the console app from the IDE directly - no break points - the output from the application is not correct but when I run the app directly or if I attach to the process with the debugger then it works 100%. Debugging the same dll from a Delphi console app (i.e. running it from the IDE) also works.
The VS debugger seems to break the app depending on how you run it. VS2010 does the same!
I have made 100% sure - several times! - that the data types and calling convention of the dll exports and those in the console app match. I can go into more detail but I don't want to confuse the matter with what may be irrelevant information. Please tell me if I have to go into the specifics of the code if what I have offered is not enough.
Has anyone experienced this sort of thing and know how to fix it?
I've got similar problem once (different behavior in IDE/debugger and in standalone application). It turned out, that I've checked the value of unset variable. Debugger allocated it (always!) in previously used block of memory, such that the value was not empty and the application worked correctly (because only the conditional block was erroneous). However, OS sometimes put the application in empty memory block (filled with 0s), the condition failed and application crashed.
Maybe this is the issue? Try using OutputDebugString()'s to track down values of variables during the library runtime. Without some source code I believe, that it's not easy to say, what might be the reason.
Best regards -- Spook.
It's a silly point, but I haven't been able to find the answer by myself :
In delphi 2009, when I hit the "pause" button ("Suspend program execution") while debugging, the IDE pops the CPU window, and shows me the execution point and stack of the thread which actually stopped the execution, instead of the main thread - which is almost always what I would like to see.
I then have to manually go to the "threads" window, and double click on the "Main" line to have the debugger display the stack I am concerned with.
Is there a setting to tell the IDE "Hey, when I break manually, show me the infos about the main thread, not about the debugger thread"?
This SO question deals with the same issue. Sounds like the best solution is to use "Run/Run to next source line" if that still works in your version of Delphi. It doesn't sounds like the registry edit suggested there (or here) has been a consistent solution, but it's possible that people are using the wrong version number in the registry key. Hope this helps.