Recent

Author Topic: debugger hangs  (Read 428 times)

Pfc

  • Newbie
  • Posts: 4
debugger hangs
« on: September 19, 2020, 09:04:23 pm »
If I get a runtime error the debugger hangs and if want to quit, it just hangs and there's no way of getting out. What's wrong? (I'm a newcomer to Lazarus). Can anyone help? Thank you

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6677
  • Debugger - SynEdit - and more
    • wiki
Re: debugger hangs
« Reply #1 on: September 19, 2020, 09:51:04 pm »
Hi, I'll need a bit more detailed description.
Unfortunately/ from what you describe I can not even take a guess what may be the problem.

First of all:
- Your Lazarus version?
   Did you install from our download page, or (in case of Linux) from your OS repository?
   In case (unlikely) you did install FPC separately, the FPC version?

- Your OS / version
- 64 or 32 bit PC/OS?
   In case of a 64bit system, do you compile your apps to 64 bits (you do, unless you deliberately took steps to change this)

- Does your app has a GUI (that is do you have any Forms)? Or do you have a console app (readln/writeln / no mouse)


Can you try to do a screenshot (of the dialog that says run-time error), when/before it hangs?

Are there any other popups following? (if they have a "more" button, what text is revealed by the "more" button?)

Does the error happen immediately when you start your app (i.e. before any window/form opens OR before any writeln output is made)?
Or at what time does the error happen?


"The debugger hangs"
- But the rest of the IDE does still react?
- Your app is stopped/paused by the debugger? (Your app does not react / The IDE shows the green arrow "run" button as enabled (not grayed out)?)
- Pressing F7/F8/F9 does nothing?




If you do get the error, you may want to try "reset debugger" from the "run" menu.
This should allow the IDE to work or exit.
But it does not solve the problem, as it will shut down your debug session.


Pfc

  • Newbie
  • Posts: 4
Re: debugger hangs
« Reply #2 on: September 19, 2020, 10:13:16 pm »
Hi, thank you for the reply.
Lazarus downloaded from Lazarus web site
vers. 2.0.10
2020-07-07
FPC vers.:3.2.0
x86_64-win64-win32/win64
computer running on Windows 10 64bit
Yes, mouse
I'm not running executable files, just writing/testing code
-If there's an error (for instance, attempt to read inappropriate file for the specified file type) app is stopped/paused by the debugger; if I quit, the pop up asks if I want to cancel debugging or continue -- it doesn't cancel and I get stuck. Didn't try F7/F8/F9.
I wonder if this description helps.
Many thanks,
Pfc

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6677
  • Debugger - SynEdit - and more
    • wiki
Re: debugger hangs
« Reply #3 on: September 19, 2020, 10:50:44 pm »
Quote
-If there's an error (for instance, attempt to read inappropriate file for the specified file type) app is stopped/paused by the debugger; if I quit, the pop up asks if I want to cancel debugging or continue

Ok, I see.

So you test your code by pressing F9 (or choosing "run" from the run-menu? Or pressing the little green arrow in the IDE toolbar? (All 3 do the same)).
That means your code is compiled, and then it is executed.


Now if your code has an error, then the debugger "pauses" your code.
Your code is still running, just kept on hold in the debugger. (you probably see the blue dots, on the left of your code?)

Sometimes there is an error you can/want to ignore, then you can continue execution.
Other errors will just keep failing, in which case there is no point to continue.

The Debugger does not make the decision if the execution can be continued.
The debugger tells you about the error, and shows the line on which it happened.
Then it holds your code paused on this line.

If you do not want to continue, then you can press the red square "stop" button (or select "stop" from the run menu).

If you want to continue, then you can press F9 (or select "run" again).
In case of a "wrong file" this will probably keep reporting errors, and stop in the end... But if you have a "try except" to catch the error, then that will work.

(( F7/F8 allow you to execute your code line by line.  // I am not sure where to find any good debugger first steps tutorial. Stepping and breakpoints are debug features that are supported by debuggers for any programming language. ))



If you did not "stop" the execution, then indeed when you try to exit the IDE, it will ask you if you want to "stop/cancel debugging".

- IF you "continue", then nothing should happen. (You keep the debugger running, therefore the IDE does not exit => the IDE should keep working)
- IF you "stop" the debugger, then the IDE should exit.

I have to check, if "stop => exit" works. It should, but your description sounds as if it does not.




Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6677
  • Debugger - SynEdit - and more
    • wiki
Re: debugger hangs
« Reply #4 on: September 19, 2020, 10:54:00 pm »
So when you exit, you should get this dialog.

"Stop" => Stop debugger, and exit IDE
"Continue" => Keep debugging, and do NOT exit IDE.

Pfc

  • Newbie
  • Posts: 4
Re: debugger hangs
« Reply #5 on: September 19, 2020, 11:14:39 pm »
Thank you Martin_fr, the image you attached shows the point where I get stuck; if I choose 'stop', it doesn't. I had no problems with compilation errors, it works well; only when it is running it may hang.
Regards
Pfc

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6677
  • Debugger - SynEdit - and more
    • wiki
Re: debugger hangs
« Reply #6 on: September 20, 2020, 01:15:39 am »
Strange, it works for me.
But it may depend on what error caused the debugger to pause your app before.

If you get stuck there again, try the "reset debugger" from the run menu.


Also, if you can: When it is stuck, menu: view > Ide Internals >Debug output.
Copy the entire content of that window, and post it here. Maybe it will have some hint.

Alternatively: https://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Log_info_for_debug_session
If you can get a log like this, that would be great.

Pfc

  • Newbie
  • Posts: 4
Re: debugger hangs
« Reply #7 on: September 23, 2020, 09:21:59 am »
Hi. Thank you Martin_fr.
I've been away for a couple of days, thus my late reply.
I guess it has been sorted out now.
For the past couple of weeks I had noticed some instability and other erratic problems in my computer. It occurred to me that a recently installed program (nothing to do with programming) might be causing problems, including slowness; so, I uninstalled it and, apparently, things came back to normal. Lazarus is not hanging anymore...
This is how I do: firstly I compile; If success, then F9. If the program hangs due to run time error, I click STOP which is now working properly. On attempting the following compilation, the pop up then asks if I want to cancel debugging and it's fine.
I'm afraid will never understand what was causing the problem. If I get problems again, I'll follow your diagnose instructions and post the contents here.
Thank you.

 

TinyPortal © 2005-2018