problem gdb13.1 with lazarus2.2.6 Raspberry5/Debian12 lazarus / 12-Debugger ---------------------------------------------------------------------- spearman · 2025-05-12 10:52 Hello, Problem with Debuger GDB in IDE Lazarus. Perhaps GDB13.1 no compatible with Lazarus2.2.6 ? But i have also errors with fpdebug/Dwarf internal dwarf- debugger(don't starting process ). i can't dowgrade gdb in version10 because others programs depends on it. i can't upgrade Lazarus because Lazarus V2.2.6 is the stable version. Thank you for your help. ==================== 1)with GDB, at the 1st stopping point: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i GDB a rencontre une erreur interne:Pendant l'exécution de la commande : "TGDBMIDebuggerInstruction: "-data-evaluate-expression SELF^", [ifRequiresThread, ifRequiresStackFrame, ifRequiresMemLimit, ifRequiresArrayLimit] Thr=1 Frm=0"GDB a signalé : "&"A fatal error internal to GDB has been detected, further\ndebugging is not possible.  GDB will now terminate.\n\n"&"This is a bug, please report it.""  With DWARF: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i "Error starting process"   Config: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i pi@pi51:~ $ lsb_release -aNo LSB modules are available.Distributor ID: DebianDescription:    Debian GNU/Linux 12 (bookworm)Release:        12Codename:       bookwormpi@pi51:~/dev/domsrvcliv16/domsrvlazv16 $ gdb -version GNU gdb (Debian 13.1-3) 13.1       fpc est déjà la version la plus récente (3.2.2+dfsg-20).lazarus-ide est déjà la version la plus récente (2.2.6+dfsg2-2). ---------------------------------------------------------------------- Martin_fr · 2025-05-12 11:59 Quote from: spearman on May 12, 2025, 12:52:28 pmBut i have also errors with fpdebug/Dwarf internal dwarf-debugger(don't starting process ). FpDebug indeed does not work on Raspberry. FpDebug is i386/x86 only. Raspberry is arm. So you have to use gdb. Well there is a package for LLDB, but LLDB without FpDebug is alpha, so you not get any good of it / but if gdb does not work at all, then its better than nothing). I don't think "LLDB + FpDebug" will work. That is only for Apple M1,M2,... -- Unless arm on Raspberry has the same registernames as M1. Then maybe...  (that is if you have a working lldb). As for GDB. Upgrading Lazarus will likely not help much. While GDB is still supported, that currently means: If there is time, then it will receive attention. And there simple had not been time. One thing you can look at, is in Project settings. When using gdb you should use "Dwarf with sets". Do not use Dwarf-3. This has a way bigger likelihood of causing issues. You may also get better results with FPC 3.2.3 (or 3.2.4 once that is released), as it has a few fixes in the Dwarf generator. ---------------------------------------------------------------------- Fred vS · 2025-05-12 12:16 Hello. Last gdb source/release > 10.0 have a feature to download all C dependencies debug files (their new default feature). This feature is mainly for C programs and not really needed for fpc and using that new gdb with Lazarus will make problem because gdb is waiting for a command when asking if debug-infos should be downloaded. There are no parameter for gdb to disable debuginfod, disable it is only possible when compiling gdb with --disable-debuginfod (sad but they dont want add one). There are pre-compiled gdb with --disable-debuginfod ( but not yet for arm, so you will need to compile gdb from source with  --disable- debuginfod parameter ). https://github.com/fredvs/gdb_nodebuginfod/releases ---------------------------------------------------------------------- Martin_fr · 2025-05-12 12:26 Quote from: Fred vS on May 12, 2025, 02:16:47 pmLast gdb source/release > 10.0 have a feature to download all C dependencies debug files (their new default feature). This feature is mainly for C programs and not really needed for fpc and using that new gdb with Lazarus will make problem because gdb is waiting for a command when asking if debug-infos should be downloaded. I am not sure but I think that the IDE (not sure which version) deals with that.... Anyway his error is QuoteCode: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i TGDBMIDebuggerInstruction: "-data-evaluate-expression SELF^"Which happens when the debugger already runs. And which is in my experience more likely with DWARF-3. But may or may not happen with older Dwarf too. Btw, when changing DWARF settings => make sure any packages with debug info are also set to the same dwarf setting as the project. And if your fpc / rtl is compiled with dwarf => it should match too. ---------------------------------------------------------------------- Fred vS · 2025-05-12 12:35 Quote from: Martin_fr on May 12, 2025, 02:26:12 pmI am not sure but I think that the IDE (not sure which version) deals with that.... Ooops, you are right, I just tested with Lazarus 3.6 and gdb 15.0 and indeed it deals it. Sorry for the noise. ---------------------------------------------------------------------- spearman · 2025-05-12 15:11 Quote from: Martin_fr on May 12, 2025, 01:59:15 pmQuote from: spearman on May 12, 2025, 12:52:28 pmBut i have also errors with fpdebug/Dwarf internal dwarf-debugger(don't starting process ). As for GDB. Upgrading Lazarus will likely not help much. While GDB is still supported, that currently means: If there is time, then it will receive attention. And there simple had not been time. One thing you can look at, is in Project settings. When using gdb you should use "Dwarf with sets". Do not use Dwarf-3. This has a way bigger likelihood of causing issues. thanks for response. i tried with GDB and option "Dwarf with sets" but same error. Note that it's surprising that it works with gdb on the command line. As you say that a Lazarus upgrade won't change anything, I'll try an FPC upgrade. ---------------------------------------------------------------------- Martin_fr · 2025-05-12 15:27 For starters, on the command line, did you do Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i -data- evaluate-expression SELF^or Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i -data- evaluate-expression SELF Older versions of GDB did not handle the build in pointer. But also some versions of GDB had problems only in certain sequences of commands. Most likely (I don't know the internals) they have a cache, and then maybe depending on that the succeed or fail. Btw, the code you are debugging: is "self" a subclass of TObject? Or are you inside an (advanced) record? or "type TFoo = object ... end"? As I said: if you did build the RTL with dwarf-3 => then changing the project settings will not help. Even if you debug inside a project unit. Because the base TObject is declared in the RTL. ---------------------------------------------------------------------- spearman · 2025-05-12 20:09 After testing, tforms created under an older Lazarus version (16RC2) are contributing to the problem. The temporary solution is to recreate the forms with the current Lazarus version. This greatly limits GDB crashes. If you have any other ideas, I'm all ears. Otherwise, I'll close this post. Thanks again. ---------------------------------------------------------------------- Martin_fr · 2025-05-12 21:01 Sorry no ideas right now. Well you can try "stabs", but - on many platforms fpc wont support it - its old, outdated, and get you bare minimum debug info With dwarf the problem are many fold. - older fpc wrote incorrect dwarf / but that is afaik fixed in 3.2.3 - some gdb version made incorrect asserts, and crashed on valid dwarf (with an assert error) - most gdb versions crash on some of the fpc generated dwarf (even if that dwarf is correct) The last item is complex. Dwarf is very powerful, but that means the same debug info can be encoded in dozenz of ways. Gdb developers don't seem to test against fpc. Additionally the IDE changes watches into expressions, that are (or were) needed (by older gdb) to get the correct result. That means the debugger must do more processing, and has more chances to run into bugs (bugs in the debugger). If nothing else works, maybe try the LLDB variant. I don't know all the arm architectures. So I don't know if ASM wise the Apple M1 and your ARM CPU have the same registers. If they have then you could use the LLDB+FpDebug. (If yes, that may be relatively stable / If not it may be possible to add that...) Both LLDB variants are packages that must first be installed. If you use the "LLDB alpha" (without fpdebug) you can step, and you can watch variables. But any expression would need to be C-style. So MyObj.FField would be MyObj->FField  (if it works at all / don't know). ---------------------------------------------------------------------- spearman · 2025-05-13 11:28 Hello again, False joy yesterday. The problem remains. Even if debug mode runs without crashing after recreating old Tforms, the crash appears the first time a variable is tracked. I'll try your suggestions. ---------------------------------------------------------------------- Fred vS · 2025-05-13 11:41 Quote from: spearman on May 13, 2025, 01:28:41 pmHello again, False joy yesterday. The problem remains. Even if debug mode runs without crashing after recreating old Tforms, the crash appears the first time a variable is tracked. I'll try your suggestions. Hum, if I may, did you try to use GDB compiled with --disable- debuginfod like proposed in my reply #2? https://github.com/fredvs/gdb_nodebuginfod/releases ---------------------------------------------------------------------- Fred vS · 2025-05-13 12:11 Oooops, sorry, I forgot that you use ARM32 Rpi and I did compile GDB only for x86_64. [EDIT] If you want to compile GDB by yourself, it is easy, download source and in the source-directory: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i $ ../configure --disable-debuginfod --prefix=~/gdb-custom$ make$ make install ---------------------------------------------------------------------- Fred vS · 2025-05-13 12:54 Quote from: spearman on May 12, 2025, 12:52:28 pmi can't dowgrade gdb in version10 because others programs depends on it. i can't upgrade Lazarus because Lazarus V2.2.6 is the stable version. OK, but if you use fpcupdeluxe, it will not touch to your current installation, all will be inside /home/you/fpcupdeluxe. And you may choose old lazarus 2.2.6 if you want. ---------------------------------------------------------------------- spearman · 2025-05-13 13:40 Hello, I initially used fpc deluxe, but not knowing how to uninstall a version, I preferred "apt-get install...". After installing fcp3.2.3+lazarus4.0 arm64.deb, the gdb errors are the same. Regarding "-debuginfod," I haven't tested it yet, but I applied what I read in "https://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#gdb.exe _has_stopped_working," i.e., the parameter "set DisableLoadSymbolsForLibraries=True." This once again improves things enormously. Lazarus is usable again, even if there are some crashes depending on the variable (pointer, etc.) to be detailed (Ctrlf7). ---------------------------------------------------------------------- spearman · 2025-05-13 13:53 Example: Bug GDB with message "..ptype r.ftabmots..." I think the problem appears depending on the type of variable being scanned (in this case, a dynamic array, etc.). Perhaps another debugger option needs to be modified, but which one? This is beyond my expertise. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i  type Tarraystr      =array of string;                             type rMotsExec=record    FtabMots                  :Tarraystr;    FValAvecParam             :boolean;    FValTypeobjet             :typeobjet;//typeobjet int pour eviter appel unit domogenbase    FValObjectcle             :tcle;    FValObjectMot             :string;        //Mot reconnaissance parametre Objet    FValObject              :Tobject;    FValTfuncAutomateExec     :tfuncautomateExec;    FValTfuncAutomateMENUExec :tfuncautomateMENUExec;    end; ---------------------------------------------------------------------- Fred vS · 2025-05-13 14:00 Quote from: spearman on May 13, 2025, 03:40:21 pmHello, I initially used fpc deluxe, but not knowing how to uninstall a version, I preferred "apt-get install...". After installing fcp3.2.3+lazarus4.0 arm64.deb, the gdb errors are the same. Sorry, not sure to understand, so you are using the deb packages from debian server using "apt-get install..."? And not the one from fpc sourceforge? To uninstall fpcupdeluxe and install a new version, simply delete the directory /home/you/fpcupdeluxe and fpcup.ini, fpcupdeluxe.ini then reload the binary fpcupdeluxe to re-create a new version. ---------------------------------------------------------------------- Martin_fr · 2025-05-13 14:13 Quote from: spearman on May 13, 2025, 03:53:03 pmBug GDB with message "..ptype r.ftabmots..." I think the problem appears depending on the type of variable being scanned (in this case, a dynamic array, etc.). There aren't any settings for that. GDB has a very very limited understanding of Pascal types. In order to get better results, years and years of work went into the IDE tweaking the input to GDB (e.g. appending ^ if necessary) in order to get as much info as possible. But then in each GDB version different issue arose were GDB itself would crash. I used to test with combination of more than 10 gdb versions versus 3 or 4 fpc versions and with different debug info settings.... Very time consuming. Since a couple of years my focus moved to FpDebug (but that does only support i386/x86). I still want to update the gdb backend of the IDE again. But I simply hadn't had time in a few years. I had never gotten it 100% stable with the old gdb versions (can't workaround every gdb bug), and the newer gdb versions haven't always improved it. As I said LLDB should work (and likely be more stable) on your platform. IIRC the package is called LazDebuggerLLDB  (there MUST NOT be any "FP" in the name). Well if you install it, install both: the one with and the one without "FP" in the name. You can then test "LLDB alpha" and "LLDB+FpDebug" as debugger backends. **IF** "LLDB+FpDebug" works, then great => that should give you a really good experience (though it be a a little bit slower showing watches) Otherwise the "LLDB alpha" should work. (Use only "Dwarf 2"). However watches need to be entered C-style: obj->field Unfortunately that are currently all the options. ---------------------------------------------------------------------- Fred vS · 2025-05-13 14:39 Quote from: spearman on May 13, 2025, 03:53:03 pmBug GDB with message "..ptype r.ftabmots..." I think the problem appears depending on the type of variable being scanned (in this case, a dynamic array, etc.). Could you give a demo program/code that produces that kind of message? ---------------------------------------------------------------------- Thaddy · 2025-05-13 16:41 At least, build from source there aren't any issues I am aware of. ---------------------------------------------------------------------- Fred vS · 2025-05-13 18:52 Quote from: Thaddy on May 13, 2025, 06:41:47 pmAt least, build from source there aren't any issues I am aware of. Same here, and if you dont want to touch to your system configuration, install it in your favorite custom folder:  Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i     $ ../configure --prefix=~/gdb-custom    $ make    $ make install If you are not fan (like me) that GDB try to connect to the network, use --disable-debuginfod parameter in configure (Last Lazarus can deal to no download C debuginfo files but not to prevent gdb from connecting to the network). Once you have the new GDB binary, also to not touch at your system, replace the old gdb in /fpcupdeluxe/fpcbootstrap/gdb/arm-linux/gdb  (that is a copy of /usr/bin/gdb in fact) with the new one. And use fpc-Lazarus from /fpcupdeluxe/. So all will be centralized in /fpcupdeluxe.