Debugger displays useless info on user breaks - delphi

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.

Related

Debug Delphi Project Step by step

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.

Is there a way to switch of the possibility to edit code while debugging but NOT in break mode

In Visual Studio 2019 developing C#.NET I'm able to edit code while debugging even if not in break mode. With earlier versions I used to get the message 'Changes are not allowed while code is running'. Now I can start to write but the code is wavy underlined and I'm not able continue without stopping and recompiling.
I tried to disable Tools->Options->Debugging->General->Enable Edit and Continue but that has no effect. I find this behaviour very annoying.
Hoping for a hint to get it to work like it used to.
Got this answer from Microsoft. May it help someone else too. :-)
In VS 2019 we allowed you to edit files even when the application being debugged is running. This wasn’t possible before as you have observed. These edits can’t be applied until after the application transitions to a break mode (e.g. a breakpoint is hit, or “Break All” command is issued). That’s why a squiggle is displayed on the changed text span to notify you about the fact that the change hasn’t been applied yet. Once the application transitions to a break mode these squiggles should disappear. If the changes are allowed to be made they will be applied once you resume the execution of the application (“Continue”, or “Step” commands are issued). It is not necessary to stop debugging and recompile, unless the changes made are “rude”. In that case the squiggles appear again and will inform you why the particular change can’t be applied.

rascal freezes when I am trying to debug a program

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.

Delphi 6 doesn't trigger breakpoints

After installation of Delphi 6 at new working station I issued problem with breakpoints. In debug mode environment doesn't trigger breakpoints like they are not placed at all...
Have you experienced similar situation? I suppose reason is some setting, but I cannot find which one...
TnX in advance!
Nemanja
Yes, this sometimes happens (not only in 6).
Enable all debug information except debug DCU's unless you want to debug the Borland code. (Don't forget to check for compiler switches in the code).
Disable code optimizer.
Rebuild all code.
If you are using DLL's be sure to enable debug code in all projects and set the host application to the right executable.
If that fails.
Be sure that there are blue dots at the code.
Be sure you have the right source file. You can check this by adding an error (for example dghasgsgd) and recompile, if the compiler accepts, this is not the right source file.
Be sure the code is reached (add a SendMessage statement or a message box so you can be sure the statement is reached.).
Restart the compiler. Or even restart the pc.
If that fails.
Take a break. Have a lunch or get something to drink.
Return and show the problem to a coworker. (preferably a programmer too).
I applied all settings that #Gamecat suggested, so you can look at this answer like short addition to previous answer.
I missed only one more to solve my problem. In Tools>Debugger Options I checked Integrated Debugging which alive my breakpoints. When breakpoints started to work, I got error message 'Project _.exe raised exception class EAccessViolation with message 'Access violation at address 4CDEB080 in module 'IDPDX32.DLL'. ' For solving this issue I just unchecked option 'Stop on Delphi Exceptions' in menu Tools>Debugger Options>Language Exceptions.
Now Delphi works fine and don't need to reinstall it.
Reason for loosing my previous configuration that worked fine might be in copying my files from one folder to another (as well as config and other temp files) when paths became wrong and after that I probably deleted old config files and started with settings from beginning...
+1 Tip: If you get this message: [Error] RLINK32: Unsupported 16bit resource in file ....\estands\estandar_StdFormMainFrm.DFM problem is in Text-DFM option. When you right-click on the form in the IDE, is the menu item "Text-DFM" (or maybe called "Text as DFM") checked? If not, do so, save and try to compile.
If somebody knows reason for this behaviour, detailed explanation would be useful. Until now I found this option is for backwards-compatibility to older Delphi-versions.

Delphi debugger?

I'm finishing an internship at a company and have just been thrown onto this project for the last month where the program is built upon an engine that they "failed" to buy the source code for. Now I've been given the task of finding out why it is failing, on only certain conditions and customer feedback hasn't been great. The main developer for the project is also out on leave for several months.
I have the engine install and know the language it was written in (delphi6?).
note which I have never had to use
I have our products msi.
I'm expected to go through the regular app and pinpoint the problem. I suspect it is something to do with fields not being re-initialized properly.
Is there a way to attach a debugger to the exe to see callstacks and all that hotness?
Any help that would avoid countless use cases would be received gratefully.
You can attach the Delphi debugger to any running process (like all other win32 debuggers out there) but I don't think the experience will be near what you expect. Delphi produces really tight executables which means the info for building human readable callstacks or any kind of "hotness" are simply not there.
Your only chance is in that if your application is a Debug release. In that case, Delphi debugger should help more than a generic debugger.
You might also want to have a look at this thread - Is there a program to decompile Delphi?
In Delphi 2006 (not sure about 6) you can attach the debugger to a running process.
You only get assembler instructions, registers, flags, memory dump and stack (hex). Hope that is enough.
Nice, I tried to attach to the ide/debugger and they disallowed that ;-).

Resources