Recent

Author Topic: Breakpoints in units does not work  (Read 12580 times)

radioman

  • New Member
  • *
  • Posts: 33
Breakpoints in units does not work
« on: April 16, 2011, 02:02:20 am »
Hello!

I'm new to Lazarus, and I'm being attracted by its 64 bit and multiplatform capabilities. I have also some Delphi skills.

I installed lazarus-0.9.30-fpc-2.4.2-win64.exe into a Windows 7 64 bit and I having many problems for realize many simple tasks.

First, I created a single form with a counter and two buttons, up and down. It builds nicely (and run standalone) but does not run / debug inside the IDE.

Yesterday I discovered that checking project options -> Linking -> Generate dwarf debug information allow me to run the program, but the problem now is I can't set breakpoints in units, only in the project file.

When I mark a line to add a breakpoint, it becomes marked in red with an exclamation sign ( ? ). If I use, run, step into, step over, etc, the breakpoint becomes green with a X symbol (unreachable code?).

The only place where breakpoints can be set, and work, is in the project file: Application.Initialize, Application.CreateForm(TForm1, Form1) and Application.Run lines.

I'm also having problems importing Delphi projects (just for become familiar with Lazarus). The import procedure "seems" to work, but I'm not able to see / edit the Forms, only the code. Using view form does not display anything. I don't know if the program runs: compilation fails because there are too many missing functions, procedures and controls.

I searched this forum and asked google the last 5 days with no luck.

Am I missing something?

Thank you in advance!

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12345
  • Debugger - SynEdit - and more
    • wiki
Re: Breakpoints in units does not work
« Reply #1 on: April 16, 2011, 02:20:40 am »
It is a known bug.
http://bugs.freepascal.org/view.php?id=16297

I *believe* there is somewhere a version of fpc, which may work (apparently not 2.4.2 which comes with the0.9.30 installer).
I don't know if it is/was pre 2.4.2, trunk, or something in between.

At some time it will be necessary to test a lot of gdb and fpc versions to see which combination (if any at all, as I believe) works. I hadn't had the time to do it yet.

radioman

  • New Member
  • *
  • Posts: 33
Re: Breakpoints in units does not work
« Reply #2 on: April 16, 2011, 02:37:57 am »
Thnak you for your quick response. I guess I must play with the 32 bit version until a new version is released.


bobo

  • Full Member
  • ***
  • Posts: 171
Re: Breakpoints in units does not work
« Reply #3 on: April 16, 2011, 11:16:27 pm »
You do not need to give up compiling 64 bit programs even if you are using a 32bit Lazarus though.

It is possible to just recompile your project for 64bit in the command line if you have have the compiled the 64bit units for FPC/Lazarus and not just the 32bit ones. I'm sure there are steps in the Wiki to help set up such an FPC/Lazarus environment.

radioman

  • New Member
  • *
  • Posts: 33
Re: Breakpoints in units does not work
« Reply #4 on: April 17, 2011, 08:37:08 pm »
Yes, I readed the wiki, but I feel there is a problem.

The wiki is written by an experienced Lazarus user, and written to be readed by an experienced Lazarus user, so for a newbe is quite confusing, I mean impossible to follow because the first or second step always fails. It is focused in unix systems, like Linux, but doing the same in Windows is quite different, for example, a complete PATH set up must be done to get FPC to work from command line.

There should be a concise and complete step by step guide (for each platform) so anyone without experience in Lazarus could install all the needed compilers so he could start to produce multiplatform programs in just few minutes.

Just my two cents.

bobo

  • Full Member
  • ***
  • Posts: 171
Re: Breakpoints in units does not work
« Reply #5 on: April 17, 2011, 09:15:09 pm »
I agree with you. Maybe you should even send an email to the Lazarus mailing list about this, so the developers get another note on this issue.

However, unlike FPC (the compiler), Lazarus (the IDE) is still in Beta (since a decade or so), so you should not expect a 100% full feature set yet, not to mention detailed documentation.

Unfortunately, at the moment if someone wants to do cross compiling or multiple target compiling with Lazarus they usually need to be non-beginners. Also, in my experience the best to use the latest SVN versions of both FPC and Lazarus because the releases are too far apart compared to the pace of development/fixes, recompiling both at least once a month from the latest sources. This is also not necessarily doable by beginners.

As for debugging and breakpoints, etc. from within the IDE, that is probably the worst part of Lazarus compared to Delphi. There are multiple reasons for this, one being is that there are not enough developers/motivation to develop a native Lazarus debugger, as well as the cross-platform difficulties of such undertaking. Therefore, the current best solution is an external debugger (GDB) that is not developed to debug object pascal programs. There are a ton of restrictions which makes debugging within the IDE worse than Delphi even 15 years ago. A lot of things you can not see from the debugger unless your code is developed in a favorable way for it, have to use some hacks and tricks to see certain properties, or you can not even do any debugging for many things. Sometimes you have to use a lot more code to implement logging or debugging messages (like debugserver, etc.).
« Last Edit: April 17, 2011, 09:17:05 pm by bobo »

radioman

  • New Member
  • *
  • Posts: 33
Re: Breakpoints in units does not work
« Reply #6 on: April 17, 2011, 10:45:03 pm »
Unfortunately, at the moment if someone wants to do cross compiling or multiple target compiling with Lazarus they usually need to be non-beginners.

I mean begginer with Lazarus. Of course some experience in programming is needed.

I see Lazarus as the next step for a Delphi programmer. And a Delphi programmer does not know Lazarus/FPC deep enough to install/configure  everything needed to do cross compilation. A good document is needed for this.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12345
  • Debugger - SynEdit - and more
    • wiki
Re: Breakpoints in units does not work
« Reply #7 on: April 17, 2011, 11:03:45 pm »
It's a wiki, everyone can add.

Ask on the mailinglist, more than likely it will be explained to you. Then add it to the wiki for the next person

 

TinyPortal © 2005-2018