Lazarus

Using the Lazarus IDE => Debugger => Topic started by: af0815 on August 10, 2018, 06:33:23 pm

Title: Lazarus 1.8.5 sometimes Debugger F7,F8 not working
Post by: af0815 on August 10, 2018, 06:33:23 pm
Win10 64/Pro, Laz Win32 actual fixes brach with fpc trunk svn39507 or actual stable, gdb 7.7.1

Sometimes i cannot Debug step by step. F9 and the breakpoints work as expected. Buit if i want to step with F7 or F8 i got no reaction.
 If i place breakpoints on every line in a procedure, i can step with F9 from brerakpoint to breakepoint and can also evaluate the information. I seems GDB is working correctly, only F7 and F8 are not sendet bny the IDE.

Questions
A) Am i alone with this problem ?
B) How can i solve this ?

Edit: It looks working, if i switch to Dwarf2 instead of Dwarf with sets.
Title: Re: Lazarus 1.8.5 sometimes Debugger F7,F8 not working
Post by: Martin_fr on August 10, 2018, 07:51:38 pm
Quote
It looks working, if i switch to Dwarf2 instead of Dwarf with sets.
Not yet heard of this one.

There is an issue with 64bit (possible only if fpc 3.0.4 is used, not sure) where step over, will step in.

But yours I have not yet seen.
Well unless you need to inspect sets, you can just use Dwarf2.

If you need sets, you can try dwarf3. Dwarf3 also keeps the case (upper/lower) of locals, so they look nicer). But gdb may be less stable. You have to try for yourself.

You can also try to compile with -Xe (external linker). That sometimes makes a diff.
And make sure you do NOT use smartlinking.

You can also try fpdebug (depends on what features you need). Install package LazDebuggerFp, which is part of the distribution.

While I cannot promise anything, could you supply a log file:
http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Log_info_for_debug_session
Title: Re: Lazarus 1.8.5 sometimes Debugger F7,F8 not working
Post by: Pascal on August 10, 2018, 08:04:12 pm
There is an issue with 64bit (possible only if fpc 3.0.4 is used, not sure) where step over, will step in.

This also is in latest trunk. Very aanoying  :(
Title: Re: Lazarus 1.8.5 sometimes Debugger F7,F8 not working
Post by: Martin_fr on August 10, 2018, 09:24:41 pm
There is an issue with 64bit (possible only if fpc 3.0.4 is used, not sure) where step over, will step in.
This also is in latest trunk. Very aanoying  :(

Afaik it does not depend on the Lazarus version, but on the version of fpc. But not sure. (Older Lazarus, came with older FPC)
Title: Re: Lazarus 1.8.5 sometimes Debugger F7,F8 not working
Post by: af0815 on August 10, 2018, 09:33:40 pm
I have this problems in the past only if i use Dialogs, like FileOpendialog. After using the dialogs i have seen this. ANd i use the debugger every day :-) for my work.

I will go ahead with the tips from Martin_fr.

One question more, what did automatic do :-) ? 

Title: Re: Lazarus 1.8.5 sometimes Debugger F7,F8 not working
Post by: Martin_fr on August 10, 2018, 09:43:14 pm
One question more, what did automatic do :-) ?

"Automatic" leaves the choice to fpc.

FPC chooses depending on the target. (OS, bitness,...). Different fpc versions may make diff choices.
I am not aware of any list, what defaults fpc uses.
Title: Re: Lazarus 1.8.5 sometimes Debugger F7,F8 not working
Post by: Martin_fr on August 10, 2018, 09:44:40 pm
Btw, if you have the problem, check the "Thread" window.

Maybe you are in the wrong thread, then in that thread there may be no info how to step.
Title: Re: Lazarus 1.8.5 sometimes Debugger F7,F8 not working
Post by: Pascal on August 11, 2018, 05:42:54 am
There is an issue with 64bit (possible only if fpc 3.0.4 is used, not sure) where step over, will step in.
This also is in latest trunk. Very aanoying  :(

Afaik it does not depend on the Lazarus version, but on the version of fpc. But not sure. (Older Lazarus, came with older FPC)

And with 64bit  breakpoints are only transmitted to the debugger while program is paused (F12).
Title: Re: Lazarus 1.8.5 sometimes Debugger F7,F8 not working
Post by: af0815 on August 11, 2018, 10:33:01 am
i am using on Windows only win32 Lazarus.
Title: Re: Lazarus 1.8.5 sometimes Debugger F7,F8 not working
Post by: Martin_fr on August 11, 2018, 12:29:55 pm
And with 64bit  breakpoints are only transmitted to the debugger while program is paused (F12).

Another one that is news to me. No one reported yet.

Can you please supply a logfile?
http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Log_info_for_debug_session

--
Edit:
It works for me.
That is local debugger. This issue is known for some remote debugger ("over ssh"). DebugServer *should* deal with it, but depends on gdb.
Title: Re: Lazarus 1.8.5 sometimes Debugger F7,F8 not working
Post by: Martin_fr on August 13, 2018, 05:10:41 pm
Off topic from the original post.
Related only to the following issue reported later in this thread:

There is an issue with 64bit (possible only if fpc 3.0.4 is used, not sure) where step over, will step in.

This also is in latest trunk. Very aanoying  :(

Try the following.

You need an "objcopy" for win 64 bit apps. The only one I could find is in the fpc-build repository, with the tools for cross compiling to 64 bits (but it works fine).
The one that comes with fpc 32 bit, will not work.

Code: [Select]
\FPC\SVN-build\install\crossbinw64\x86_64-win64-objcopy.exe -R .debug_frame  project1.exe  project1n.exeIf you do it right, it shrinks by just a few MB (an empty form1 goes from 27MB to 26MB)

then copy project1n.exe back to the original, or set "run parameters" to use the new one.


It may be possible to add this to project opitons "compiler commands"
Title: Re: Lazarus 1.8.5 sometimes Debugger F7,F8 not working
Post by: Pascal on August 13, 2018, 09:26:36 pm
Off topic from the original post.
Related only to the following issue reported later in this thread:

There is an issue with 64bit (possible only if fpc 3.0.4 is used, not sure) where step over, will step in.

This also is in latest trunk. Very annoying  :(

Try the following.

You need an "objcopy" for win 64 bit apps. The only one I could find is in the fpc-build repository, with the tools for cross compiling to 64 bits (but it works fine).
The one that comes with fpc 32 bit, will not work.

Code: [Select]
\FPC\SVN-build\install\crossbinw64\x86_64-win64-objcopy.exe -R .debug_frame  project1.exe  project1n.exeIf you do it right, it shrinks by just a few MB (an empty form1 goes from 27MB to 26MB)

then copy project1n.exe back to the original, or set "run parameters" to use the new one.


It may be possible to add this to project opitons "compiler commands"

Yes! Works great. I found a newer one here https://svn.freepascal.org/svn/fpcbuild/binaries/i386-win32 (https://svn.freepascal.org/svn/fpcbuild/binaries/i386-win32)
Many thanks, Martin!
Title: Re: Lazarus 1.8.5 sometimes Debugger F7,F8 not working
Post by: Pascal on August 13, 2018, 10:17:06 pm
Shouldn't there be a compiler switch to prevent generating debug_frame section?
Title: Re: Lazarus 1.8.5 sometimes Debugger F7,F8 not working
Post by: Martin_fr on August 14, 2018, 12:13:36 am
Not that I know of.
Title: Re: Lazarus 1.8.5 sometimes Debugger F7,F8 not working
Post by: Pascal on August 14, 2018, 05:37:31 am
If there isn't , it should be implemented!
Title: Re: Lazarus 1.8.5 sometimes Debugger F7,F8 not working
Post by: af0815 on August 14, 2018, 07:23:52 am
Back to my original problem with F7 and F8. I have cleared the whole projectgroup. Recompiled anything with automatic and now it is working (for me).

If the problem araise i will have a look on the debugging-windows and make a trace of it.
Title: Re: Lazarus 1.8.5 sometimes Debugger F7,F8 not working
Post by: af0815 on August 14, 2018, 09:50:30 am
I have it again, the problem with F7 and F8.
Lazarus 1.8.5 r58495 FPC 3.1.1 i386-win32-win32/win64
F7 in Debuggerwindow
Quote
<-data-evaluate-expression $fp>
^done,value="0x195f8d8"
(gdb)
<-exec-step>
^error,msg="Warning:\nCannot insert breakpoint -233.\nCannot access memory at address 0x72d54ef4\n"
(gdb)
F8 in Debuggerwindow
Quote
<-break-enable 10>
^done
(gdb)
<-break-enable 9>
^done
(gdb)
<-data-evaluate-expression $fp>
^done,value="0x195f8d8"
(gdb)
<-exec-next>
^error,msg="Warning:\nCannot insert breakpoint -236.\nCannot access memory at address 0x72d54ef4\n"
(gdb)
Comandlineparameters (from Projectoptions - Show Options) without the -F !
Quote
-MObjFPC -Scaghi -CirotR -O1 -g -gl -gh -Xg -gt -WG -l -vewnhibq

The program is not using Threads.

Edit: It look actual for me, if i use not 'Use external gdb debug symbols file (-Xg)' it works. If i recompile with -Xg it doesnt work.

Title: Re: Lazarus 1.8.5 sometimes Debugger F7,F8 not working
Post by: Martin_fr on August 14, 2018, 12:48:00 pm
Quote
Code: Pascal  [Select][+][-]
  1. ^error,msg="Warning:\nCannot insert breakpoint -233.\nCannot access memory at address 0x72d54ef4\n"

The above means gdb has an internal problem. Something went wrong in GDB when GDB tried to find out where the step should end (where the next line is).

I dont know why it is related to Xg.
Though one danger of Xg is, that the file may for some reason not be updated on every compile (verify it has the same date as the exe).
Or there may be an old one around in addition to the new one (I do not know all the locations that gdb searches.).
If gdb had an outdate file, then that would cause problems.

Generally I recommend not to use Xg.
Set up build modes for debug and release. Then it is easy to recompile your release version without debug info.
Or use strip.exe to generate your release.
Title: Re: Lazarus 1.8.5 sometimes Debugger F7,F8 not working
Post by: af0815 on August 14, 2018, 01:49:23 pm
The date/time is similar to the exe. If i set breakpoint by breakpoint i can step wit F9 :-) So the dbg file it looks not corrupt.

But i have no problem now, because i look for the Xg switch and set it off, if i want to debug.

BTW i use buildmodes very extensive. This was one of my problem to find the logic of the issue.
Title: Re: Lazarus 1.8.5 sometimes Debugger F7,F8 not working
Post by: Pascal on August 14, 2018, 03:41:30 pm
Yes! Works great. I found a newer one here https://svn.freepascal.org/svn/fpcbuild/binaries/i386-win32 (https://svn.freepascal.org/svn/fpcbuild/binaries/i386-win32)
Many thanks, Martin!

Well, after using this the whole day, i must say that i have problems with F7 now  %)
Sometimes it works like F9 and sometime the IDE says the program is running while it isn't reacting anymore.
Title: Re: Lazarus 1.8.5 sometimes Debugger F7,F8 not working
Post by: Martin_fr on August 14, 2018, 03:46:12 pm
Yes! Works great. I found a newer one here https://svn.freepascal.org/svn/fpcbuild/binaries/i386-win32 (https://svn.freepascal.org/svn/fpcbuild/binaries/i386-win32)
Many thanks, Martin!

Well, after using this the whole day, i must say that i have problems with F7 now  %)
Sometimes it works like F9 and sometime the IDE says the program is running while it isn't reacting anymore.

logfile?
Title: Re: Lazarus 1.8.5 sometimes Debugger F7,F8 not working
Post by: Martin_fr on August 21, 2018, 03:30:07 pm
There is an issue with 64bit (possible only if fpc 3.0.4 is used, not sure) where step over, will step in.

This also is in latest trunk. Very aanoying  :(

Anyone with a good way to reproduce, can you add to https://bugs.freepascal.org/view.php?id=34159
TinyPortal © 2005-2018