Recent

Author Topic: [SOLVED] Breakpoints don't work on a old Lazarus project  (Read 1458 times)

Odacir

  • Jr. Member
  • **
  • Posts: 53
[SOLVED] Breakpoints don't work on a old Lazarus project
« on: May 09, 2024, 08:51:32 pm »
Hello, i have an old lazarus project, and at this moment i'm running Lazarus 3.0.

If i create a new project, add some breakpoint, works fine. But on this old project i can't put working the breakpoints, its like don't have any breakpoint.


My debugging configs: https://prnt.sc/yZ2fFX7VFlEk

Any idea, what i need check/set to solve this?

Thanks!!!
« Last Edit: May 19, 2024, 03:20:38 pm by Odacir »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10001
  • Debugger - SynEdit - and more
    • wiki
Re: Breakpoints don't work on a old Lazarus project
« Reply #1 on: May 09, 2024, 09:22:53 pm »
Are the breakpoints shown in the source editor?

Once you run, what color do they turn, and do they show some icon (check-mark,  question-mark, two-vertical-bars, ...)?

Also check for breakpoints in the "breakpoint window" => menu: View > Debug Windows > Breakpoints.
- Do they have "break" in the action column?
- No condition set?

Have you tried to remove them, and set them again?

Do you have optimization disabled?



From the image: This is on Windows?

Do you compile for 32 bit or 64 bit?
Is your IDE 32 or 64 bit?

In menu: Tools > Options
Page: Debugger > Debugger Backend

What debugger is selected? FpDebug or Gdb

If there is some red text "The project uses a different debugger" then check in project options too.

Odacir

  • Jr. Member
  • **
  • Posts: 53
Re: Breakpoints don't work on a old Lazarus project
« Reply #2 on: May 18, 2024, 06:50:59 pm »
Hi Martin, Thanks a lot for your repply and sorry for delay to return here about my problem.

On i compile OTHER projects (and the debug works) i see the points on the lines of code, sample:

https://prnt.sc/cKzAxs3RMUzX

On i run the project that have the problem (don't debug), i don't see the "points" on every line of code, on run. Sample:

Nothing change on run: https://prnt.sc/K7MCCHIUVk5H


The breakpoint is set  to break without condition:
https://prnt.sc/5HxJ406UbOpg

Yes i removed and put again in different units, debug don't enabled but i don't know why.... :(


I tryed without optimizations and on level 1, don't work:

https://prnt.sc/JGsHa5NMwJbk

Yes i'm running Lazarus on windows, this project i compile to OSX and windows, at this moment on 64 bits, on windows and 64bits on MAC but on years ago, i compile only to 32bits on Mac.

I think can be something related to the project options, because in OSX i can't debug too (exclusively this project) on Mac OS, if i enable some debuger, on Debugger Backend, the app don't run. Elabing the GDB the error on run is:
https://prnt.sc/fg4ZjuziGHxR

On windows i don't receive any message, only don't debug using GDB or FpDebug.

About the red text, on compile i don't have any red message.




Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10001
  • Debugger - SynEdit - and more
    • wiki
Re: Breakpoints don't work on a old Lazarus project
« Reply #3 on: May 18, 2024, 08:22:25 pm »
The gdb error is probably something else (afaik todo with gdb not codesigned on Mac, but I am not a Mac expert). If you have an up to date Mac, it is recommended to use "lldb + fpdebug" on Mac. (lldb comes with MacOs, and fpdebug is part of the IDE).




On Windows, the image with the breakpoint: red breakpoint with two yellow "bars" (like the pause symbol on a CD player). And also the absence of any blue dots. That means there was no debug info found for that code (probably the whole unit).

I have to double check, but I think if the unit had been found by the debugger, then the breakpoint would have gone orange with a cross "x" on it, to say that line had no debug info.

So the question now is why is there no debug info...

Is that unit part of a package? Or is it in your project?

=> If it is in a package, then open that package, and go to the options of that package, and enable "dwarf debug info" for that package.

=> If it is in your project, is it in the same folder than all the other sources in your project?

Quote
and at this moment i'm running Lazarus 3.0.
To be sure: From the official installer, with the version of FPC that came with it? Or build yourself with a different Fpc?

Does the code use generics?
Does the code use "type TFoo = object ..." ("object" instead of class or record)?




If none of the above helps

See the image on this page https://wiki.lazarus.freepascal.org/Debugger_Setup#Project_Options
- Are the highlighted options set (or "not set") in your project?
- On the pages "Custom options" (field "custom options") and "Additions and overrides" are there any settings?

And, if a package is involved, same questions for that package.
Also, if the settings are correct for such a package, from the package window, in the drop-down menu at the very right of the toolbar, chose "recompile clean".




And if still none of that helps: In the bin folder in the fpc directory is a objdump.exe

Run:
  objdump.exe --info=dwarf  yourproject.exe > log.txt

- Does it print any warnings ?
- if you search in the "log.txt" for the unit name of the unit that does not work, is that unit name found?



And if even then still none of that helps:
Is the project available public, or can it be shared privately?

Odacir

  • Jr. Member
  • **
  • Posts: 53
Re: Breakpoints don't work on a old Lazarus project
« Reply #4 on: May 18, 2024, 10:52:27 pm »
None of the project units works the debug. Its for entire project and the Unit of the print, yes its a project unit, not a package and on the same folder of all other project files.

I installed Lazarus and FPC with the official installer FPC version 3.2.2

The code dont use generics.

Here a print of my debug setup:

https://prnt.sc/TQBnbIUdXNSV

The comand   objdump.exe --info=dwarf  yourproject.exe > log.txt
Have some sintax error, the --info don't allow an argument.
I run it without argument "dwarf" but i think don't produce what we need of informations. I will attach the file.

If its important, i can share privately the project, no problem. Thanks a lot for your help on try solve this.


Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10001
  • Debugger - SynEdit - and more
    • wiki
Re: Breakpoints don't work on a old Lazarus project
« Reply #5 on: May 19, 2024, 01:03:39 am »
The comand   objdump.exe --info=dwarf  yourproject.exe > log.txt
Have some sintax error, the --info don't allow an argument.


Ouch, my bad:
 objdump.exe --dwarf=info  yourproject.exe > log.txt




Another idea, in the "custom options" specify -Xe
This changes the linker. Just in case (I don't really think it matters, but ...)

Also what is the path/folder in which you store your project (and or the project name). Do any of those contain "special" chars? (e.g. accented, or other non a-z?)

What is the size of the exe? It should be big (a few MB at least) if it has debug info. You should see a difference in size, if you disable debug info.
« Last Edit: May 19, 2024, 01:05:35 am by Martin_fr »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10001
  • Debugger - SynEdit - and more
    • wiki
Re: Breakpoints don't work on a old Lazarus project
« Reply #6 on: May 19, 2024, 01:17:02 am »
You can also start lazarus from cmd.com with the following command line.

Code: Text  [Select][+][-]
  1. lazarus.exe --debug-log=C:\log.txt  --debug-enable=DBG_STATE,FPDBG_DWARF_ERRORS,FPDBG_DWARF_WARNINGS,FPDBG_DWARF_VERBOSE_LOAD,FPDBG_DWARF_DATA_WARNINGS,DBG_VERBOSE,DBG_WARNINGS,DBG_STATE,DBG_EVENTS,DBG_THREAD_AND_FRAME,DBG_ERRORS,DBG_VERBOSE_BRKPOINT,FPDEBUG_VERBOSE
     
Maybe the log will have some info.

Odacir

  • Jr. Member
  • **
  • Posts: 53
Re: Breakpoints don't work on a old Lazarus project
« Reply #7 on: May 19, 2024, 02:13:21 pm »
Some updates

Returnf of the  objdebug, only this line:

Code: Pascal  [Select][+][-]
  1. M:\Photomovie\Horus\Controle de produção\ctrl_producao.exe:     file format pei-x86-64

Have some special caracters on the path but i tryed short and without specials and nothing change.

Buuuuut, some progres: The EXE have about 13MB and i changed the optimization level, on Compiler Options -> Compilation and LInking From zero to 4 and NOTHING CHANGED IN THE SIZE OF THE EXE....

I used the "cleanup and build" to confirm all be rebuild but nothing change in the EXE size....   :o   %)

And now we have a big log and more infos (log from lazarus, i will attach the file!
But i think this is important: DebuggerState: Setting to dsStop, from dsIdle

Thanks a lot for your time in help-me on this!

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10001
  • Debugger - SynEdit - and more
    • wiki
Re: Breakpoints don't work on a old Lazarus project
« Reply #8 on: May 19, 2024, 02:43:48 pm »
It does indeed look like the compiler does not add debug info.

13MB is too small for that. For comparison, an empty project with just a form has 30MB with debug info. 
The log also states that the exe does not have debug info.



Starting with a possible silly question, but: The exe has been recreated? The modified time has changed (or better, if you delete the exe before compiling, then a new exe will be created)?

Also, there isn't somewhere a 2nd exe? (like in the lib folder?)

You may want to
- delete/rename the lib folder (rename in case you have anything in there you still need / making sure the IDE can not find the folder anymore)
- delete/move-away all *.o *.ppu *.dbg files that you can find in your project folder and sub-folders  (*.dbg shouldn't be there, but if....)
- then compile it again



Please open the "Project options" (from project menu). The dialog has a button "show options" => if you click it a window opens and shows "command line parameters" => can you copy and paste it here?



Also in the project options, go to the page "Custom options" and in the "custom options" text field, enter the following (replacing anything that may be in there, unless you put it in there and you know what it is for).

-O- -g- -gw3

And see if that changes anything.

If not then in that field add
   -va
and build your project again, then after building right click the messages window and select from the submenu "copy" => "Copy all/original messages to clipboard".
This may be a lot of text. Save the text to a file, and attach it here.  (or sent in private)

Odacir

  • Jr. Member
  • **
  • Posts: 53
Re: Breakpoints don't work on a old Lazarus project
« Reply #9 on: May 19, 2024, 03:12:12 pm »
Bingooooo!!!!

Solved!!!!!

Now debuging:
https://prnt.sc/jsv-udZXYYY6

The solution was "simple" (after know how to solve), add the custom options.


My Project Options:


Quote
C:\lazarus\fpc\3.2.2\bin\x86_64-win64\fpc.exe
-MObjFPC
-Scghi
-gw3
-gl
-WG
-l
-vewnhibq
-Filib\x86_64-win64
-FuC:\Users\odacr\AppData\Local\lazarus\onlinepackagemanager\packages\VirtualTreeViewV5\Source\lib\x86_64-win64-win32
-FuC:\lazarus\components\tachart\lib\x86_64-win64\win32
-FuC:\lazarus\components\memds\lib\x86_64-win64\win32
-FuC:\Users\odacr\AppData\Local\lazarus\onlinepackagemanager\packages\fortes4lazarus 3.24\lib\x86_64-win64
-FuC:\lazarus\components\printers\lib\x86_64-win64\win32
-FuC:\lazarus\components\ideintf\units\x86_64-win64\win32
-FuC:\lazarus\components\lclextensions\lib\x86_64-win64-win32
-FuC:\lazarus\components\lazcontrols\lib\x86_64-win64\win32
-FuC:\Users\odacr\AppData\Local\lazarus\onlinepackagemanager\packages\jujiboutils\lib\x86_64-win64
-FuC:\lazarus\components\cairocanvas\lib\x86_64-win64\win32
-FuC:\Users\odacr\AppData\Local\lazarus\onlinepackagemanager\packages\zeosdbo\packages\lazarus\lib\zcomponent\x86_64-win64
-FuC:\lazarus\lcl\units\x86_64-win64\win32
-FuC:\Users\odacr\AppData\Local\lazarus\onlinepackagemanager\packages\zeosdbo\packages\lazarus\lib\zdbc\x86_64-win64
-FuC:\lazarus\lcl\units\x86_64-win64
-FuC:\Users\odacr\AppData\Local\lazarus\onlinepackagemanager\packages\zeosdbo\packages\lazarus\lib\zplain\x86_64-win64
-FuC:\Users\odacr\AppData\Local\lazarus\onlinepackagemanager\packages\zeosdbo\packages\lazarus\lib\zparsesql\x86_64-win64
-FuC:\lazarus\components\freetype\lib\x86_64-win64
-FuC:\lazarus\components\buildintf\units\x86_64-win64
-FuC:\Users\odacr\AppData\Local\lazarus\onlinepackagemanager\packages\zeosdbo\packages\lazarus\lib\zcore\x86_64-win64
-FuC:\lazarus\components\lazutils\lib\x86_64-win64
-FuC:\lazarus\packager\units\x86_64-win64
-Fu.
-FUlib\x86_64-win64
-FE.
-octrl_producao.exe
-dLCL
-dLCLwin32
-g-

I deleted the lib folder (o does a copy of the project to "test") and no changed nothing in exe size.

Well, thanks a lot for all help to understand and solve my problem!

A very good weekend to you!

Odacir

  • Jr. Member
  • **
  • Posts: 53
Re: [SOLVED] Breakpoints don't work on a old Lazarus project
« Reply #10 on: May 19, 2024, 03:29:44 pm »
On the MAC stay with error, but like you talked about this in some past post repply, the problem is other (debugger), and if i can't solve, i will open other topic about this.


Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10001
  • Debugger - SynEdit - and more
    • wiki
Re: [SOLVED] Breakpoints don't work on a old Lazarus project
« Reply #11 on: May 19, 2024, 06:25:40 pm »
Ok, still strange that it did not pick up the option from the normal settings....

the -g-   resets all options  that start with -g => so you can decide/test if to keep that. I.e, if you have stuff like -gh then you don't wont -g- undoing it.

-gw3 adds the debug info.

Odacir

  • Jr. Member
  • **
  • Posts: 53
Re: [SOLVED] Breakpoints don't work on a old Lazarus project
« Reply #12 on: May 19, 2024, 06:58:58 pm »
Ok, thanks for more this infos!

 

TinyPortal © 2005-2018