[SOVED] Debugger use on OBJECT type lazarus / 12-Debugger ---------------------------------------------------------------------- Richard Marriott · 2025-07-16 03:00 Hi, I have a lot of old Turbo Pascal code using the OBJECT type (fields and methods). I have built a Lazarus IDE interface to use it but I can't get the Debugger to show any of the field values. I can set break points and the debugger will stop OK. When I hover the cursor over any variable (say NumData in the following example) I get an error like this (TParser is an OBJECT type): NumData = public var TParser.NumData: Int32 = Longint Is there a debugger setting or compiler directive (I use {$mode objfpc} ) that I am missing, or does the debugger only support Class types (In which case I will have to change all my code). Thanks if you can help. ---------------------------------------------------------------------- Martin_fr · 2025-07-16 07:14 It's a bug in FPC. It's fixed but only in FPC 3.3.1. You can use FpcUpDeluxe to install this. Then use 331 for debugging, and 3.2.2 for release builds. IIRC with FPC 3.2.2 you can workaround, but it's rather awkward... If you are in an "object" then it wont work. But, if the caller has the object in a local (or global) var. e.g. the caller did    FooObject.SomeMethod And you are in SomeMethod, then you can select the caller in the callstack window. And FooObject can be inspected. ---------------------------------------------------------------------- Marc · 2025-07-16 08:54 Thanks for the tip (I've tons of object which I couln't inspect) ---------------------------------------------------------------------- 440bx · 2025-07-16 09:18 Quote from: Martin_fr on July 16, 2025, 09:14:31 amThen use 331 for debugging, and 3.2.2 for release builds. Is there some "reasonably simple" way of having a Lazarus installation (the same installation) switch from using v3.3.1 to v3.2.2 back and forth upon user request ? ---------------------------------------------------------------------- marcov · 2025-07-16 09:55 What is the status with 3.2.4RC1 ? ---------------------------------------------------------------------- cdbc · 2025-07-16 10:30 Hi QuoteIs there some "reasonably simple" way of having a Lazarus installation (the same installation) switch from using v3.3.1 to v3.2.2 back and forth upon user request ?Well, I'm on linux, but maybe you can do something like my setup on your 'winders'... I simply have a "system-installed-from-pclos-repo" fpc-release / laz- release ...and A "FpcUpDeluxe-installed-from-source-in-home-directory" fpc-trunk / laz-trunk It's no hassle at all, to switch between them, on the same project =^  Regards Benny ---------------------------------------------------------------------- Martin_fr · 2025-07-16 11:07 Quote from: 440bx on July 16, 2025, 11:18:48 amQuote from: Martin_fr on July 16, 2025, 09:14:31 amThen use 331 for debugging, and 3.2.2 for release builds. Is there some "reasonably simple" way of having a Lazarus installation (the same installation) switch from using v3.3.1 to v3.2.2 back and forth upon user request ? Assuming you have both versions installed (such that they don't conflict / easy on Windows / needs care of the fpc.cfg on Linux, but there are several ways).... You can switch either in - Menu: Tools > Options - Project Options > Compiler commands In the latter you can specify an fpc to be used just for the project. And the project options follows "build mode". So you can set it up per build mode and then toggle via that. ---------------------------------------------------------------------- Martin_fr · 2025-07-16 11:09 Quote from: cdbc on July 16, 2025, 12:30:53 pmA "FpcUpDeluxe- installed-from-source-in-home-directory" fpc-trunk / laz-trunk It's no hassle at all, to switch between them, on the same project =^  Should be possible via the build mode. Afaik fpcupdeluxe wraps the fpc installs into a script (to deal with fpc.cfg locations). So you need to specify the full path to that script, if you want to use that fpc. ---------------------------------------------------------------------- 440bx · 2025-07-16 12:24 Quote from: Martin_fr on July 16, 2025, 01:07:38 pmIn the latter you can specify an fpc to be used just for the project. And the project options follows "build mode". So you can set it up per build mode and then toggle via that. Maybe I'm missing the obvious but, I don't see where I can tell Lazarus which FPC compiler to use. Please refer to the attachment.  I've gone through every option on the right and corresponding possibility on the left without seeing which one is the one that allows me to select a FPC installation. If you could point out where/what I'm supposed to change/set I'd appreciate that. ---------------------------------------------------------------------- Martin_fr · 2025-07-16 13:13 Quote from: 440bx on July 16, 2025, 02:24:32 pmMaybe I'm missing the obvious but, I don't see where I can tell Lazarus which FPC compiler to use. "Compiler commands" Then the block in the middle "Compiler" (not before, not after), in that block "command" which defaults to: $(CompPath) ---------------------------------------------------------------------- 440bx · 2025-07-16 16:24 got it.  Thank you Martin. ---------------------------------------------------------------------- Martin_fr · 2025-07-16 16:52 I just revisited the old reports on the topic https://gitlab.com/freepascal.org/fpc/source/-/issues/36017 https://gitlab.com/freepascal.org/fpc/source/-/issues/37661 It may be that this is a DWARF-3 issue only. You can actually debug them with FPC 3.2.2 when using DWARF-2 Quote from: marcov on July 16, 2025, 11:55:38 amWhat is the status with 3.2.4RC1 ? Only tested with 3.2.3  420f7af213  With that and DWARF-3 objects do not have "self" => so not fixed. ---------------------------------------------------------------------- Martin_fr · 2025-07-16 18:16 Anyone who is aware of noticeable differences between versions of DWARF, please mention them. So that they can be added to the table here: https://wiki.freepascal.org/DWARF#DWARF_version_comparison ---------------------------------------------------------------------- marcov · 2025-07-17 08:00 Perhaps: 88cf633b973ba2002e8f392ad0748b614bf1f1c9 florian Mon Sep 26 21:28:39 2022 * use append_object_struct also for dwarf-3 when creating dwarf debug info for objects, resolves gitlab 0039920 Commit consists out of     M compiler/dbgdwarf.pas ---------------------------------------------------------------------- Richard Marriott · 2025-07-19 03:14 Thanks for the help. It looks a bit tricky to implement for a newbie. It is not a big deal to convert Objects to Class so maybe that is the way to go. ---------------------------------------------------------------------- Martin_fr · 2025-07-19 06:29 Quote from: Richard Marriott on July 19, 2025, 05:14:40 amThanks for the help. It looks a bit tricky to implement for a newbie. It is not a big deal to convert Objects to Class so maybe that is the way to go. If anything then "Advanced records", not "class"? (well except if you need inheritance) But have you tried changing your settings to "DWARF-2 with sets"? That should be enough. (In "Project Options" > "Debugging") ---------------------------------------------------------------------- 440bx · 2025-07-19 11:19 It would be nice to correct the [SOVED] typo, make it [SOLVED] in case someone ever looks for [SOLVED] problems.