Recent

Author Topic: Problem with fpdebug and savedialog  (Read 837 times)

calebs

  • Full Member
  • ***
  • Posts: 190
Problem with fpdebug and savedialog
« on: December 11, 2022, 10:03:03 pm »
Hello all! I think i've found a bug with fpdebug and savedialog. Maybe it was reported before but cant found it searching savedialog + fpdebug on forum.
Tried with latest windows x64 version from webpage (i think 2.2.4) and fixes 2.2 fixes branch downloaded with fpcupdeluxe. (2.2.5)
Start new project (aplication)
drop a button
drop a label
drop a savedialog
put this code on button
Code: Pascal  [Select][+][-]
  1.  if savedialog1.Execute then
  2.     label1.Caption:=SaveDialog1.FileName;        
set a breakpoint on second line, run and press button.
There the app hangs opening savedialog
if i change the fpdebug to gdb in general options or uncheck "generate info for debugger in project" options or run without debugger enabled application doesn't hangs.
It's strange i remember it was working well in previos versions (2.0?) where lazarus came with gdb as default and i configure manually fpdebug.
Thanks

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: Problem with fpdebug and savedialog
« Reply #1 on: December 11, 2022, 10:26:18 pm »
It works here
- Windows 10 64 bit
- Lazarus 2.2.4 from installer


Have you (re)build your IDE (e.g. when installing packages, or when using fpupdeluxe)?
If so, have you build the IDE with -O1 (or less) ?

The FPC 3.2.2 has a known bug in the optimizer. And while it is insanely hard to trigger, it does affect FpDebug (random hangs/crashes).


Is the breakpoint crucial? Since the described hang happens before, does it happen when no break is set?

Settings used to compile the unit with the code-snippet in it?


SaveDialog (as any file dialog) loads shell-helpers (dll provided by various other apps, such as pdf, zip, tortoisegit, .... and most anti-virus apps). Maybe the latter (if installed) have a dislike.... (it may know gdb...)


wp

  • Hero Member
  • *****
  • Posts: 11858
Re: Problem with fpdebug and savedialog
« Reply #2 on: December 11, 2022, 10:43:32 pm »
Works for me, too. Tested Laz 2.2.4 and main, 64-bit.

Are you sure that the debugger is hanging? Or is it the filedialog which just had openend but is buried behind the editor window? I am seeing this annoying behaviour during the last time more and more, also in non Lazarus applications, and I am afraid this is one of new "features" of Win-11.

dseligo

  • Hero Member
  • *****
  • Posts: 1196
Re: Problem with fpdebug and savedialog
« Reply #3 on: December 12, 2022, 01:48:24 am »
I confirm it. I tried with 2.2.4 on Windows 11.
File dialog is not buried, it is in front, but not fully drawn (you can see it in attached screenshot).
I can recover with 'Reset debugger'.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: Problem with fpdebug and savedialog
« Reply #4 on: December 12, 2022, 02:25:05 am »
Hm, I don't have Win 11. Nor was I planing to get it any time soon.

Can someone test with Lazarus 2.3 (and definitely compiled with -O1 / or with fpc 3.2.2)


If it happens with 2.3 please get a log file

Code: Text  [Select][+][-]
  1. --debug-log=somelogfile.txt  --debug-enable=DBGMI_QUEUE_DEBUG,DBG_VERBOSE,DBG_WARNINGS,DBG_ERRORS,DBG_VERBOSE_BRKPOINT,DBG_STATE,DBG_EVENTS,DBG_BREAKPOINTS,DBG_FPDEBUG_VERBOSE,FPDBG_BREAKPOINT_ERRORS,FPDBG_BREAKPOINTS,FPDBG_COMMANDS,FPDBG_THREADS,FPDBG_QUEUE,FPDBG_FUNCCALL,FPDBG_WINDOWS

dseligo

  • Hero Member
  • *****
  • Posts: 1196
Re: Problem with fpdebug and savedialog
« Reply #5 on: December 12, 2022, 02:58:06 am »
Can someone test with Lazarus 2.3 (and definitely compiled with -O1 / or with fpc 3.2.2)

It works OK with Lazarus 2.3.0 (rev main-2_3-2487-g276c2796de) FPC 3.3.1 i386-win32-win32/win64.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: Problem with fpdebug and savedialog
« Reply #6 on: December 12, 2022, 03:12:03 am »
Ok.... good.

I have a feeling (but that is no more than a gut feeling) it could be https://gitlab.com/freepascal.org/lazarus/lazarus/-/commit/2f4e270270f563e8396d3e762c5042713058bf7a

This fixes an issue were fpdebug could mess "stepping" up. Stepping here is not F8/F7, but internal moving through parts of the debugged code.
The file dialog with all the shell handlers will most likely have multiple threads, so that would match too.

calebs

  • Full Member
  • ***
  • Posts: 190
Re: Problem with fpdebug and savedialog
« Reply #7 on: December 12, 2022, 08:06:17 pm »
It works here
- Windows 10 64 bit
- Lazarus 2.2.4 from installer


Have you (re)build your IDE (e.g. when installing packages, or when using fpupdeluxe)?
If so, have you build the IDE with -O1 (or less) ?

The FPC 3.2.2 has a known bug in the optimizer. And while it is insanely hard to trigger, it does affect FpDebug (random hangs/crashes).


Is the breakpoint crucial? Since the described hang happens before, does it happen when no break is set?

Settings used to compile the unit with the code-snippet in it?


SaveDialog (as any file dialog) loads shell-helpers (dll provided by various other apps, such as pdf, zip, tortoisegit, .... and most anti-virus apps). Maybe the latter (if installed) have a dislike.... (it may know gdb...)

Hi. Im using windows 11x64, i always install the same extra packages (from ide or external repo)
autosave 0.1
eccontrols 0.9.58
lazbarcodes 1.0.4
lazreport 1.0
lazreportpdfexport 0.9
lnetvisual 0.6.6
messagecomposerpkg 0.0
onlinepackagemanager 1.0.1.2
pack_powerpdf 0.9.16
printer4lazarus 0.5
printers4lazide 0.0
scrolltext 1.1.3
uniqueinstancepackage 1.1
virtualtreeview_package 5.5.3.1
zcomponent 7.2.14

(sometimes lnet and virtualtreeview not installed)

it really doesn't matter if the breakpoint is where i post originally, if there is any breakpoint in the same procedure after the messagedialog is called hangs.
sometimes i can see half drawed savedialog on top

lazarus is freezed, app is freezed to. If i reset debugger lazarus work again
If remove the breakpoint the dialog opens normally



Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: Problem with fpdebug and savedialog
« Reply #8 on: December 12, 2022, 08:27:08 pm »
Have you tried with 2.3? Could you?

Because, if it is already fixed, then that's it.

The commit that I pointed out might be the one, is to complex to be merged. And for other fixes, 2.3 had to many changes since, so it is highly unlikely that anything can be done in the fixes branch.
So 2.2.5 is not enough, and wont get those fixes.

Hi. Im using windows 11x64, i always install the same extra packages (from ide or external repo)
It's not about any particular packages. It is only about the -O level in "Tools > Configure build Lazarus"

The requirement to build with -O1 also exists for Lazarus 2.3.
This is required by FPC 3.2.2 and fixed in 3.2.3


Quote
it really doesn't matter if the breakpoint is where i post originally, if there is any breakpoint in the same procedure after the messagedialog is called hangs.
sometimes i can see half drawed savedialog on top

lazarus is freezed, app is freezed to. If i reset debugger lazarus work again
If remove the breakpoint the dialog opens normally
Ok.

If it does still happen, I will at the very least need that log (produced by Lazarus 2.3).

calebs

  • Full Member
  • ***
  • Posts: 190
Re: Problem with fpdebug and savedialog
« Reply #9 on: December 13, 2022, 02:04:18 am »
Have you tried with 2.3? Could you?

Because, if it is already fixed, then that's it.

The commit that I pointed out might be the one, is to complex to be merged. And for other fixes, 2.3 had to many changes since, so it is highly unlikely that anything can be done in the fixes branch.
So 2.2.5 is not enough, and wont get those fixes.

Hi. Im using windows 11x64, i always install the same extra packages (from ide or external repo)
It's not about any particular packages. It is only about the -O level in "Tools > Configure build Lazarus"

The requirement to build with -O1 also exists for Lazarus 2.3.
This is required by FPC 3.2.2 and fixed in 3.2.3


Quote
it really doesn't matter if the breakpoint is where i post originally, if there is any breakpoint in the same procedure after the messagedialog is called hangs.
sometimes i can see half drawed savedialog on top

lazarus is freezed, app is freezed to. If i reset debugger lazarus work again
If remove the breakpoint the dialog opens normally
Ok.

If it does still happen, I will at the very least need that log (produced by Lazarus 2.3).

Downloaded lazarus 2.3.0 with fpc 3.2.2 with fpcupdeluxe, installed the same components i've mentioned before, leave all other options as default, made the same project with the same code and it worked!
Debugger stops in label line after succesfully opened savedialog window and choose any file.
So it must be solved for next 2.4 version.
It is safe 2.3 for production? I've had some bad experiencies with even versions before if my memory doesn't fail


Thanks for everything!

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: Problem with fpdebug and savedialog
« Reply #10 on: December 13, 2022, 02:29:57 am »
It is safe 2.3 for production? I've had some bad experiences with even versions before if my memory doesn't fail

2.3 isn't really "one" version. Some 2.3 are good, other less.

Usually have a glance at the git log. If there weren't any recent single big commits (ignoring docs, and non code), then it often is good.
Problems likely occur with either new features (when they change existing code), or bigger bug fixes (if they change to much)

recent => because if changes become older, and if they had caused issues, those are likely found and fixed.

There are a few recent changes in the /ide folder => they don't impact your apps. If anything they could affect stability of the IDE.
You would mostly want to see what happened in the LCL and components folders.




You can have both installed. (using a 2ndary install, each has its own config).

Then you can develop and debug under 2.3
And compile releases with 2.2.4

Only make sure, not to use new properties / functions in the LCL => they wouldn't compile in 2.2.4




You can use 2.2.4 and configure it using gdb. That will work and be perfectly save.
Of course debugging quality will be at gdb level.

There also is a mixed (gdb + fpdebug) LazDebuggerFpGdbmi package/debugger, that can give you the best of both worlds (it is a while since I last tested it, but it should work)
And it should not expose the problem, since the part in question would be done by gdb.




calebs

  • Full Member
  • ***
  • Posts: 190
Re: Problem with fpdebug and savedialog
« Reply #11 on: December 13, 2022, 04:06:08 am »
It is safe 2.3 for production? I've had some bad experiences with even versions before if my memory doesn't fail

2.3 isn't really "one" version. Some 2.3 are good, other less.

Usually have a glance at the git log. If there weren't any recent single big commits (ignoring docs, and non code), then it often is good.
Problems likely occur with either new features (when they change existing code), or bigger bug fixes (if they change to much)

recent => because if changes become older, and if they had caused issues, those are likely found and fixed.

There are a few recent changes in the /ide folder => they don't impact your apps. If anything they could affect stability of the IDE.
You would mostly want to see what happened in the LCL and components folders.




You can have both installed. (using a 2ndary install, each has its own config).

Then you can develop and debug under 2.3
And compile releases with 2.2.4

Only make sure, not to use new properties / functions in the LCL => they wouldn't compile in 2.2.4




You can use 2.2.4 and configure it using gdb. That will work and be perfectly save.
Of course debugging quality will be at gdb level.

There also is a mixed (gdb + fpdebug) LazDebuggerFpGdbmi package/debugger, that can give you the best of both worlds (it is a while since I last tested it, but it should work)
And it should not expose the problem, since the part in question would be done by gdb.
Thanks martin, i like a lot 2.3 version, it looks more polished than 2.2 and im not sure, it seems faster for everything but i think i will stay under 2.2 or fixes for stability and less surprises.
About using gdb ihad to use it again to debug when i found the problem with the savedialog and that situation only makes me miss more your fpdebug project. I remember when i read the post in the forum of your request to beta test it and from the moment i taste the speed of debug with fp it makes me save much much time and i dont think i want to go back to gdb so i thing i will keep the 2.3 at most default options and use it only to debug when 2.2 fails to do so.
Cant wait for stable 2.4 if its so fast like 2.3 and so much polished.
Thanks for everything.

dseligo

  • Hero Member
  • *****
  • Posts: 1196
Re: Problem with fpdebug and savedialog
« Reply #12 on: December 13, 2022, 09:13:03 am »
Since I was able to recreate OP's problem I was playing with this a little more (and because I also experience some stability problems with 2.2.x Lazarus versions so this is interesting for me).

All these below is done with Lazarus 2.2.4 on Windows 11.

When Lazarus is compiled as Optimized IDE or Normal IDE, program freezes after opening dialog even when there is no break points in program.
When I compiled program as win32/i386 then program works.

After that I built Lazarus as Debug IDE and then the program works.

Then I built Lazarus as Optimized IDE + heaptrace (-O3 -g- -Xs -gh). Program worked but Lazarus crashes immediately (and often and repeatedly).

Finally I built Lazarus with these options: -O1 -g- -Xs -gh. Example works, stops on break point and Lazarus looks stable now. Drawback is that lazarus.exe is huge (254MB).

 

TinyPortal © 2005-2018