Recent

Author Topic: debug problems  (Read 1414 times)

Paolo

  • Full Member
  • ***
  • Posts: 167
debug problems
« on: March 08, 2021, 12:14:15 pm »
Hello,

i wrote the test-prog attached to show the problem (windows 10-pro), just a fesh project and one button.

Code: Pascal  [Select][+][-]
  1. unit Unit1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls;
  9.  
  10. type
  11.  
  12.   { TForm1 }
  13.  
  14.   TForm1 = class(TForm)
  15.     Button1: TButton;
  16.     procedure Button1Click(Sender: TObject);
  17.   private
  18.  
  19.   public
  20.     function ok : boolean;
  21.   end;
  22.  
  23. var
  24.   Form1: TForm1;
  25.  
  26. implementation
  27.  
  28. {$R *.lfm}
  29.  
  30. { TForm1 }
  31.  
  32. procedure TForm1.Button1Click(Sender: TObject);
  33. begin
  34.   if ok then
  35.     beep;
  36. end;
  37.  
  38. function TForm1.ok: boolean;
  39. begin
  40.   result:=true;
  41. end;
  42.  
  43. end.

with laz 2.0.12 r64642 and a breakpoint on the "ok" with "F7" the debug jump to next line ignoring the breakpoint
with laz 2.0.10 r63526 and a breakpoint on the "ok" with "F7" the debug goes inside the "ok" function (as expected)

at the moment I cannot debug anything with laz 2.0.12 (moreover very often CPU windows pop-up).

Both laz on the same pc and no-different settings among laz versions.

bpranoto

  • Jr. Member
  • **
  • Posts: 84
Re: debug problems
« Reply #1 on: March 08, 2021, 12:30:03 pm »
No problem here with lazarus 2.0.12 SVN:64678 on Linux ubuntu 18.04 64 bits

Paolo

  • Full Member
  • ***
  • Posts: 167
Re: debug problems
« Reply #2 on: March 08, 2021, 12:31:12 pm »
now the problem is dissapeared ! but in my larger application it is still there...

I need to investigate furhter..

Paolo

  • Full Member
  • ***
  • Posts: 167
Re: debug problems
« Reply #3 on: March 08, 2021, 01:21:54 pm »
I have to work with laz 2.0.10, same project but in laz 2.0.12 I cannnot debug it ! :'(

Paolo

  • Full Member
  • ***
  • Posts: 167
Re: debug problems
« Reply #4 on: March 08, 2021, 01:31:08 pm »
I can reproduce the problem also in the above shown "easy" code, see the picture. with laz vers 2.0.10 it is ok, but lax 2.0.12 does not work.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6992
  • Debugger - SynEdit - and more
    • wiki
Re: debug problems
« Reply #5 on: March 08, 2021, 03:51:56 pm »
ok several issues...

All of them assume 64bit IDE / 64bit target.


Quote
moreover very often CPU windows pop-up
It's a known issue together with "F8 sometime steps in, instead of over". Some problem either in fpc or gdb.
If this happens, then 2 things can be done, both in Tools > Option > Debugger
1) Debugger > General: "Automatically close the asm win". Once you step back to source code...
2) Debugger > General (Laz 2.1: Backend): property grid: FixIncorrectStepOver = True

Quote
with "F7" the debug jump to next line ignoring the breakpoint
Actually do you mean "ignoring the "step in"?
because you are already stopped at the breakpoint. You want to step into the function (but in the function "result := true" there is no breakpoint)?

IIRC 2.0.10 came with GDB 8.2 => 2.0.12 switched back to GDB 7.3.50

The reason is that 8.2 only works correct for people with a latin based locale. Any one else gets there entire environment variables scrambled.

Until a few days ago, 7.3.5 was the only build available that would work on other locales.
I did spent some time (about 2 weeks) earlier this year, to get a newer GDB. I uploaded this (8.3.1, and yes that is old...) now, despite not having tested it yet. (Still not got the time to test it).
And yes it takes a lot of time to build gdb (or maybe I have not yet found the instructions how to do that faster).
Usually errors happen about half an hour into the compile. Then you have to do trial and error, how to fix it, and each trial is another half an hour.
- I had to extensively search the sources to find, that it will only work with cygwin.
- I had to then to lots of trial and error on gbd 10 under cygwin, until I got an error that I could trace via google to a report that all gdb over version 9 are broken for cygwin.
- And then it was trial and error to find the settings to compile gdb 8.3.1 (ok, I could have saved some time, and build it none static, and include about 5 or 6 more dll / the cygwin dll itself can not be avoided, unless maybe one uses a real old version of cygwin)
- end of rant on building gdb.

So your choice for Lazarus 2.0.12 is to download a different gdb from
https://sourceforge.net/projects/lazarus/files/Lazarus%20Windows%2064%20bits/Alternative%20GDB/

If 8.2 works for you, go for it.
Or try 8.3.1.

Lazarus 2.2 will have 7.3.5. Unless I find the time to test 8.3.1 (feedback on it will help)



Alternatively, use FpDebug => package LazDebuggerFp / search the wiki
« Last Edit: March 08, 2021, 03:53:30 pm by Martin_fr »

Paolo

  • Full Member
  • ***
  • Posts: 167
Re: debug problems
« Reply #6 on: March 08, 2021, 04:09:49 pm »
thanks Martin,

I'll check what you suggest.

for sake of completeness, also on trunk the same problem

Quote
All of them assume 64bit IDE / 64bit target.

 yes win 64

Quote
Actually do you mean "ignoring the "step in"?
because you are already stopped at the breakpoint. You want to step into the function (but in the function "result := true" there is no breakpoint)?

yes F7 does not go inside the function

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6992
  • Debugger - SynEdit - and more
    • wiki
Re: debug problems
« Reply #7 on: March 08, 2021, 04:12:44 pm »
for sake of completeness, also on trunk the same problem

If it is the gdb version, then it depends where you got your trunk from.

There is a binaries svn, where the current gdb version is stored.

Paolo

  • Full Member
  • ***
  • Posts: 167
Re: debug problems
« Reply #8 on: March 08, 2021, 04:26:50 pm »
I have downloaded the following files from 8.3.1 folder

gdb.exe
gdbserver.exe
cygwin1.dll

now, what should I do ?

Paolo

  • Full Member
  • ***
  • Posts: 167
Re: debug problems
« Reply #9 on: March 08, 2021, 04:43:15 pm »
Aaaarghhhh, solved !

I found that in my "stable" 2.0.10 the F7 and F8 buttons are in different order, I have not noticed that and in 2.0.12 I pressed the wrong button (they look very similar), so everything is ok, I'm so sorry for the generated "noise"  :-[

and thanks again for the support.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6992
  • Debugger - SynEdit - and more
    • wiki
Re: debug problems
« Reply #10 on: March 08, 2021, 05:11:18 pm »
I have downloaded the following files from 8.3.1 folder

gdb.exe
gdbserver.exe
cygwin1.dll

now, what should I do ?

You do not need gdbserver, but no harm.

Put them in a folder, go to Tools > Options Debugger
Edit the path to gdb.exe. (cygwin1.dll just has to be in the same folder).

---
Or replace them in the original folder c:\lazarus\mingw\x86_64\
but keep a copy of the original....

Paolo

  • Full Member
  • ***
  • Posts: 167
Re: debug problems
« Reply #11 on: March 08, 2021, 05:50:40 pm »
thanks a lot.

 

TinyPortal © 2005-2018