Lazarus debugger fail in Ubuntu 13.04 lazarus / 12-Debugger ---------------------------------------------------------------------- miguel-laz · 2013-04-29 19:07 Just installed Lazarus 1.0.8 on Ubuntu 13.04 (64bit) and trying to debug a simple program, the debugger stops at the breakpoint marked but when you stop debugging (red square button) displays a debugger error window indicating "The debugger entered into a failed state." In windows7 32bit works perfectly. This is the simple program: Code: [Select]unit Unit1; {$mode objfpc}{$H+} interface uses   Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls; type   { TForm1 }   TForm1 = class(TForm)     Edit1: TEdit;     procedure Edit1Enter(Sender: TObject);   private     { private declarations }   public     { public declarations }   end; var   Form1: TForm1; implementation {$R *.lfm} { TForm1 } procedure TForm1.Edit1Enter(Sender: TObject); var str:string; begin      str:='Un texto';      TEdit(Sender).Text:=str; end; end. The breaking point is on the line that says "str:='Un texto';": The version of gdb is GNU gdb (GDB) 7.5.91.20130417-cvs-ubuntu Has anyone tried Lazarus on Ubuntu 13.04 (64bit)? Can anyone reproduce the error? Thanks in advance ---------------------------------------------------------------------- Martin_fr · 2013-04-29 19:22 Can you try to produce a log and attach it: http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Log_info_for_debu g_session ---------------------------------------------------------------------- marcov · 2013-04-29 21:27 Btw, gdb 7.6 came out in recent days. Listed some MII improvements. ---------------------------------------------------------------------- miguel-laz · 2013-04-30 16:00 As the text exceeds 20000 characters the whole message is in the attachment: OK, The following text corresponds to the output of the debugger until the breakpoint corresponding to the line "str:='Un texto';": Code: [Select]=thread-group-added,id="i1" (gdb) <-gdb-set confirm off> ^done (gdb) <-gdb-set new-console off> ^error,msg="No hay tabla de s\303\255mbolos cargada. Use la orden \302\253file\302\273." (gdb) &"set width 50000\n" =cmd-param-changed,param="width",value="50000" ^done (gdb) <-gdb-version> ~"GNU gdb (GDB) 7.5.91.20130417-cvs-ubuntu\n" ~"Copyright (C) 2013 Free Software Foundation, Inc.\n" ~"License GPLv3+: GNU GPL version 3 or later \nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.  Type \"show copying\"\nand \"show warranty\" for details.\n" ~"This GDB was configured as \"x86_64-linux-gnu\".\nPara las instrucciones de informe de errores, vea:\n" ~".\n" ^done (gdb) <-gdb-set env COMPIZ_BIN_PATH=/usr/bin/> ^done " "      "Text in file" " (gdb) <-stack-list-frames 0 4> ^done,stack=[frame={level="0",addr="0x0000000000485316",func="EDIT1ENT ER",file="unit1.pas",fullname="/home/miguel/Programacion/LazarusTest1/ unit1.pas",line="35"},frame={level="1",addr="0x000000000061b77d",func= "CONTROLS_TWINCONTROL_$__DOENTER"},frame={level="2",addr="0x00007ffff7 fbfbd0",func="??"},frame={level="3",addr="0x000000000064f1c3",func="ST DCTRLS_TCUSTOMEDIT_$__DOENTER"},frame={level="4",addr="0x0000000000620 dc3",func="CONTROLS_TWINCONTROL_$__CMENTER$TLMESSAGE"}] (gdb) <-stack-list-arguments 1 0 0> ^done,stack-args=[frame={level="0",args=[{name="this",value="0x7ffff7f be5d0"},{name="SENDER",value="0x7ffff7fbfbd0"}]}] (gdb) <-stack-list-locals 1> ^done,locals=[{name="STR",value="0x0"}] (gdb) The following text corresponds to the output of the debugger when debugging stop (red square button) and show the window debugger error. Code: [Select] &"kill\n" =thread-exited,id="3",group-id="i1" =thread-exited,id="2",group-id="i1" =thread-exited,id="1",group-id="i1" =thread-group-exited,id="i1" ^done (gdb) &"info program\n" ~"El programa que ha sido depurado no estaba corriendo.\n" ^done (gdb) ---------------------------------------------------------------------- miguel-laz · 2013-04-30 16:07 The first error message says something like: ^error,msg="No hay tabla de s\303\255mbolos cargada. Use la orden \302\253file\302\273." which in English means something like: ^error,msg="No symbol table loaded. Use the command?. ". ---------------------------------------------------------------------- Martin_fr · 2013-04-30 17:17 Yes, but IIRC that error msg can occur. I will need the entire log file. Also, I see that you use a translated gdb (not English). I have see similar cases, and some messages that the IDE looks for in English, are also translated. Then the IDE can not work with that gdb. ---------------------------------------------------------------------- macmike · 2013-04-30 17:55 I've been using Lazarus since v9.3 on Ubuntu without problems until I upgraded to Ubuntu 13.04 (32-bit) on the weekend and now I get this problem too ---------------------------------------------------------------------- Martin_fr · 2013-04-30 18:03 Again: log file please. Lazarus is currently tested with gdb (english) from 6.3 to 7.5 I will hopefully be able to test tests for 7.6 soon But I don't know how soon. GDB 7.6 (even english) may have changes, in the response output of some commands. Then the IDE does not understand it. In addition. If gdb is translated, it may or may not work. I have seen translated gdb working, because the IDE used fallbacks, if it got replies that it could not read (and luckily the fallbacks had enough keywords to be understood). But beeing already forced to fallbacks makes it more likely to fail on other changes. ---------------------------------------------------------------------- macmike · 2013-04-30 18:09 I'm using the English versions. Where can I find the log file? (sorry for the dumb question!) ---------------------------------------------------------------------- Martin_fr · 2013-04-30 18:23 Quote from: macmike on April 30, 2013, 08:09:24 pmI'm using the English versions. Where can I find the log file? (sorry for the dumb question!) As I wrote earlier in this thread: http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Log_info_for_debu g_session ---------------------------------------------------------------------- miguel-laz · 2013-04-30 19:19 OK, this is the log file Code: [Select]TMainIDE.ParseCmdLineOptions:   PrimaryConfigPath="/home/miguel/.lazarus"   SecondaryConfigPath="/etc/lazarus" TIDEAnchorDockMaster.MakeIDEWindowDockSite MainIDE:TMainIDEBar TIDEAnchorDockMaster.LoadUserLayout anchordocklayout.xml TIDEAnchorDockMaster.LoadUserLayout restoring ... TMainIDE.DoLoadLFM Creating designer for hidden component of /home/miguel/Programacion/LazarusTest1/unit1.pas TMainIDE.DoOpenProjectFile select form in designer: Form1:TForm1 TDesigner [TMainIDE.DoRunProject] A TMainIDE.DoInitProjectRun A True 0 TMainIDE.DoInitProjectRun B TLazPackageGraph.CheckIfCurPkgOutDirNeedsCompile  Compiler custom params changed for FCL 1.0.1   Old=" -MObjFPC -Scghi -O1 -g -gl fcllaz.pas"   Now=" -MObjFPC -Scghi -O1 -g -gl -O2 -g- -Xs fcllaz.pas"   State file="/usr/share/lazarus/1.0.8/packager/units/x86_64- linux/FCL.compiled" TLazPackageGraph.CheckIfPackageNeedsCompilation normal output dir is not writable: /usr/share/lazarus/1.0.8/packager/units/x86_64-linux/ TLazPackageGraph.GetFallbackOutputDir  FCL: /home/miguel/.lazarus/lib/units/x86_64-linux TParsedCompilerOptions.SetOutputDirectoryOverride New=/home/miguel/.lazarus/lib/units/x86_64-linux TLazPackageGraph.CheckIfCurPkgOutDirNeedsCompile  Compiler custom params changed for LazUtils 1.0   Old=" -MObjFPC -Scghi -O1 -g -gl lazutils.pas"   Now=" -MObjFPC -Scghi -O1 -g -gl -O2 -g- -Xs lazutils.pas"   State file="/usr/share/lazarus/1.0.8/components/lazutils/lib/x86_64- linux/LazUtils.compiled" TLazPackageGraph.CheckIfPackageNeedsCompilation normal output dir is not writable: /usr/share/lazarus/1.0.8/components/lazutils/lib/x86_64-linux/ TLazPackageGraph.GetFallbackOutputDir  LazUtils: /home/miguel/.lazarus/lib/LazUtils/lib/x86_64-linux TParsedCompilerOptions.SetOutputDirectoryOverride New=/home/miguel/.lazarus/lib/LazUtils/lib/x86_64-linux TLazPackageGraph.CheckIfCurPkgOutDirNeedsCompile  Compiler custom params changed for LCLBase 1.0.8   Old=" -MObjFPC -Scghi -O1 -g -gl alllclunits.pp"   Now=" -MObjFPC -Scghi -O1 -g -gl -O2 -g- -Xs alllclunits.pp"   State file="/usr/share/lazarus/1.0.8/lcl/units/x86_64- linux/LCLBase.compiled" TLazPackageGraph.CheckIfPackageNeedsCompilation normal output dir is not writable: /usr/share/lazarus/1.0.8/lcl/units/x86_64-linux/ TLazPackageGraph.GetFallbackOutputDir  LCLBase: /home/miguel/.lazarus/lib/LCLBase/units/x86_64-linux TParsedCompilerOptions.SetOutputDirectoryOverride New=/home/miguel/.lazarus/lib/LCLBase/units/x86_64-linux TLazPackageGraph.CheckIfCurPkgOutDirNeedsCompile  Compiler custom params changed for LCL 1.0.8   Old=" -MObjFPC -Scghi -O1 -g -gl lcl.pas"   Now=" -MObjFPC -Scghi -O1 -g -gl -O2 -g- -Xs lcl.pas"   State file="/usr/share/lazarus/1.0.8/lcl/units/x86_64- linux/gtk2/LCL.compiled" TLazPackageGraph.CheckIfPackageNeedsCompilation normal output dir is not writable: /usr/share/lazarus/1.0.8/lcl/units/x86_64-linux/gtk2/ TLazPackageGraph.GetFallbackOutputDir  LCL: /home/miguel/.lazarus/lib/units/x86_64-linux/gtk2 TParsedCompilerOptions.SetOutputDirectoryOverride New=/home/miguel/.lazarus/lib/units/x86_64-linux/gtk2 TMainIDE.DoInitProjectRun ProgramFilename=/home/miguel/Programacion/LazarusTest1/project1 [TCmdLineDebugger] Debug PID: 5117 TGDBMIDebugger.ProcessResult Error: ,msg="No hay tabla de s\303\255mbolos cargada. Use la orden \302\253file\302\273." [Debugger] Log output: &"set width 50000\n" [WARNING] Debugger: Unexpected async-record: =cmd-param- changed,param="width",value="50000" [Debugger] Running GDB version: GDB [TDebugger.SetFileName] "/home/miguel/Programacion/LazarusTest1/project1" [TMainIDE.DoRunProject] B TGDBMIDebugger [TMainIDE.DoRunProject] END TGDBMIDebugger.StartDebugging WorkingDir="/home/miguel/Programacion/LazarusTest1/" TGDBMIDebugger.ProcessResult Error: ,msg="El s\303\255mbolo \302\253FPC_THREADVAR_RELOCATE_PROC\302\273 no est\303\241 en el contexto actual." [Debugger] Log output: &"info functions FPC_CPUINIT\n" [WARNING] Debugger: Unexpected async-record: =cmd-param- changed,param="args",value="" [Debugger] Log output: &"set inferior-tty /dev/pts/1\n" [WARNING] Debugger: Unexpected async-record: =cmd-param- changed,param="inferior-tty",value="/dev/pts/1" [Debugger] Log output: &"ptype TObject\n" [Debugger] Log output: &"ptype Exception\n" [Debugger] Log output: &"El s\303\255mbolo \302\253Exception\302\273 no est\303\241 en el contexto actual.\n" TGDBMIDebugger.ProcessResult Error: ,msg="El s\303\255mbolo \302\253Exception\302\273 no est\303\241 en el contexto actual." [Debugger] Log output: &"ptype Shortstring\n" [Debugger] Log output: &"ptype pointer\n" [Debugger] Log output: &"ptype byte\n" [Debugger] Log output: &"info file\n" [Debugger] File type: [Debugger] Entry point: [WARNING] [Debugger.TargetInfo] Unknown FileType: , using GDB cpu [Debugger] Log output: &"Funci\303\263n \302\253foo\302\273 no definida.\n" [Debugger] Console output: ~"[Depuraci\303\263n de hilo usando libthread_db enabled]\n" [Debugger] Console output: ~"Using host libthread_db library \"/lib/x86_64-linux-gnu/libthread_db.so.1\".\n" [Debugger] Console output: ~"[Nuevo Thread 0x7fffed2fa700 (LWP 5123)]\n" [DBGTGT] * [DBGTGT] running,thread-id="all" [Debugger] Console output: ~"[Nuevo Thread 0x7fffecaf9700 (LWP 5124)]\n" [DBGTGT] * [DBGTGT] running,thread-id="all" [WARNING] Debugger: Unexpected async-record: =breakpoint-modified,bkpt ={number="2",type="breakpoint",disp="keep",enabled="y",addr="0x0000000 000446e19",func="main",file="project1.lpr",fullname="/home/miguel/Prog ramacion/LazarusTest1/project1.lpr",line="16",thread- groups=["i1"],times="1",original-location="main"} [WARNING] Debugger: Unexpected async-record: =breakpoint-modified,bkpt ={number="3",type="breakpoint",disp="keep",enabled="y",addr="0x0000000 000446e19",func="main",file="project1.lpr",fullname="/home/miguel/Prog ramacion/LazarusTest1/project1.lpr",line="5",thread- groups=["i1"],times="1",original- location="/home/miguel/Programacion/LazarusTest1/project1.lpr:+0"} [Debugger] Log output: &"info program\n" [Debugger] Target PID: 5119 [Debugger] Log output: &"info address FPC_RAISEEXCEPTION\n" [Debugger] Log output: &"info address FPC_BREAK_ERROR\n" [Debugger] Log output: &"info address FPC_RUNERROR\n" [Debugger] Log output: &"info line \"/home/miguel/Programacion/LazarusTest1/unit1.pas\":35\n" [WARNING] Debugger: Unexpected async-record: =breakpoint-modified,bkpt ={number="7",type="breakpoint",disp="keep",enabled="y",addr="0x0000000 000485316",func="EDIT1ENTER",file="unit1.pas",fullname="/home/miguel/P rogramacion/LazarusTest1/unit1.pas",line="35",thread- groups=["i1"],times="1",original-location="unit1.pas:35"} [Debugger] Log output: &"kill\n" [Debugger] Log output: &"info program\ ---------------------------------------------------------------------- miguel-laz · 2013-04-30 19:26 The terminal displays the following message: (lazarus:5110): LIBDBUSMENU-GLIB-WARNING **: Translation has an invalid value 'I-->D' for default text direction.  Defaulting to left- to-right. ---------------------------------------------------------------------- Martin_fr · 2013-04-30 19:43 Sorry, I dint see the attachment on the post earlier. reading that now ---------------------------------------------------------------------- Martin_fr · 2013-04-30 20:01 Quote from: miguel-laz on April 29, 2013, 09:07:15 pmJust installed Lazarus 1.0.8 on Ubuntu 13.04 (64bit) and trying to debug a simple program, the debugger stops at the breakpoint marked but when you stop debugging (red square button) displays a debugger error window indicating "The debugger entered into a failed state." In windows7 32bit works perfectly. Ok, I went to through the log file (from the attachment. It looks like everithing went correct. When you stop (rud square) then the app is killed. The IDE verifies that the app really is killed, by sending "info program" An English gdb will reply with a phrase containing "not being run" (as the program is not being run), and the IDE checks for this text. Your gdb responds  (as you actually pointed out correct) Code: [Select]&"info program\n" ~"El programa que ha sido depurado no estaba corriendo.\n" The IDE does not understand this, and assumes something went wrong. Maybe this message was not translated in previous versions of gdb. (you will notice, that some messages by your gdb are still English) --- Another thing I spotted is, that the response to "info file" is not English. This does not cause an error right away. But it does mean, that the IDE may not show you the type and msg of an "raise exception" I know this problem also exists in older gdb, if they are translated. ---- and ""[Nuevo Thread 0x7fffecaf9700" may mean that your thread window does not always update ---------------------------------------------------------------------- Martin_fr · 2013-04-30 20:02 Quote from: macmike on April 30, 2013, 07:55:22 pmI've been using Lazarus since v9.3 on Ubuntu without problems until I upgraded to Ubuntu 13.04 (32-bit) on the weekend and now I get this problem too If yours is not translated, then there must be yet another issue. It is possible the gdb team changed some of the english messages too. ---------------------------------------------------------------------- macmike · 2013-04-30 20:30 Quote from: Martin_fr on April 30, 2013, 08:23:35 pmQuote from: macmike on April 30, 2013, 08:09:24 pmI'm using the English versions. Where can I find the log file? (sorry for the dumb question!) As I wrote earlier in this thread: http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Log_info_for_debu g_session Sorry, I need to read more and type less  I'm using Laz 1.0.8 (which is awesome cakes) FPC: 2.6.2 on i386-linux- gtk 2 I set a breakpoint on some code and then when it gets invoked I'm hovering over a variable, at that point a tooltip shows saying the var=??? which is not surprising as it's a property with an accessor. More importantly though the debugger appears to crash in that I can't move in or over the next statement (F7,F8) or out of the method. In fact pressing run F9 doesn't do anything either. Pressing the stop button doesn't stop the debugging app and the breakpoint no longer stops execution. Here's what I think is the relevant bit of the log? ---------------------------------------------------------------------- Martin_fr · 2013-04-30 21:25 Quote from: macmike on April 30, 2013, 10:30:06 pm. More importantly though the debugger appears to crash in that I can't move in or over the next statement (F7,F8) or out of the method. In fact pressing run F9 doesn't do anything either. Pressing the stop button doesn't stop the debugging app and the breakpoint no longer stops execution. Here's what I think is the relevant bit of the log? Indeed seems you found a bug in gdb. And gdb crashed: Code: [Select] << TCmdLineDebugger.ReadLn "&"/build/buildd/gdb-7.6~20130417/gdb/parse.c:588: internal-error: mark_struct_expression: Assertion `parse_completion && expout_tag_completion_type == TYPE_CODE_UNDEF' failed.\nA problem internal to GDB has been detected,\nfurther debugging may prove unreliable.""   [Debugger] Log output: &"/build/buildd/gdb-7.6~20130417/gdb/parse.c:588: internal-error: mark_struct_expression: Assertion `parse_completion && expout_tag_completion_type == TYPE_CODE_UNDEF' failed.\nA problem internal to GDB has been detected,\nfurther debugging may prove unreliable."   << TCmdLineDebugger.ReadLn "&"\n""   [Debugger] Log output: &"\n" GDb may be able to recover and continue, after this crash (may be, or may not be.) The problem is that gdb does not print the prompt, that it is ready for the next command. So the IDE waits indefinitely. You may want to try, and change between stabs and dwarf (whatever you currently use). Maybe that will fix the error. If you do, ensure you do for *ALL* packages, that have debug info. If it doesn't help, you can try and configure a timeout. In the debugger page of the option dialog is a property grid. This has an entry "TimeOutForEval" set it to 50. (And disable the "WarnOnTimeOut" if you like.) ---------------------------------------------------------------------- miguel-laz · 2013-05-01 10:07 QuoteAn English gdb will reply with a phrase containing "not being run" (as the program is not being run), and the IDE checks for this text. Your gdb responds  (as you actually pointed out correct) Code: [Select] &"info program\n" ~"El programa que ha sido depurado no estaba corriendo.\n" The IDE does not understand this, and assumes something went wrong. I can not understand that the answer is a text and not a numeric identifier unique to the gdb reply message, do not understand!. Not a criticism to the work done by the developers of Lazarus, is a thought. I searched a parameter to force "gdb" to work internally with the English language for message, but I have not found. Could this be a workaround? Should I report this bug somewhere else that Lazarus developers it fixed in future revisions? What I can do to fix the problem? Any solution? ---------------------------------------------------------------------- BigChimp · 2013-05-01 10:29 Quote from: miguel-laz on May 01, 2013, 12:07:05 pmI can not understand that the answer is a text and not a numeric identifier unique to the gdb reply message, do not understand!. Not a criticism to the work done by the developers of Lazarus, is a thought. Quote from: miguel-laz on May 01, 2013, 12:07:05 pmShould I report this bug somewhere else that Lazarus developers it fixed in future revisions? What I can do to fix the problem? Any solution? You could report it at the gdb bugtracker so they build in numeric result codes, I'd say... ---------------------------------------------------------------------- Martin_fr · 2013-05-01 11:32 GDB provides a "machine readable" interface -mi And Lazarus uses this. But not all commands are available in this. So Lazarus still needs to use some of the human commands. Over the years GDB responses (English) from many platforms, and lots of gdb versions have been collected. There are already many differences there (last gdb 7.5 changed some spacing, and fooled the IDE). It will be near impossible to collect all that info, in dozens of extra languages. And even if, it will be a maintenance issue. One could add translation files, which the IDE can load, and which the user(s) can maintain. That would actually be a good idea. But I do not know if or when I would have time for that. ---- For now: you can search      debugger\gdbmidebugger.pp It has all the text fragments. Search for "info program", "info file" You will find several bits like this or similar Code: [Select]  if CmdRes   then CmdRes := ExecuteCommand('info program', R, [], 1500); // Hardcoded timeout   if (not CmdRes)   or (Pos('not being run', R.Values) <= 0)   then begin You need to change the  (Pos('not being run', R.Values) <= 0) to Code: [Select](    (Pos('not being run', R.Values) <= 0) and    (Pos('sido depurado no estaba corriendo', R.Values) <= 0) ) or similar Note: it is "and" here, because it is an error, only if both fail. In other cases below, it may be "or" Otherwise use your language only. But I advice to keep the english, in case the text exists in more than one message, and is not always translated. ---- The following is OK / IT is NOT yet translated Code: [Select]    if ExecuteCommand('info program', [], R, [cfCheckState])     then begin       s := GetPart(['child process ', 'child thread ', 'lwp '], [' ', '.', ')'], ---- For info file Code: [Select]    if ExecuteCommand('info file', R)     then begin       if rfNoMI in R.Flags       then begin         FileType := GetPart('file type ', '.', R.Values);         EntryPoint := GetPart(['Entry point: '], [#10, #13, '\t'], R.Values); use "tipo de archivo " and "Punto de entrada: " Note spaces at end Quote"S\303\255mbolos desde \302\253/home/miguel/Programacion/LazarusTest1/project1\302\273.\n" ~"Local exec file:\n" ~"\t`/home/miguel/Programacion/LazarusTest1/project1', tipo de archivo elf64-x86-64.\n" ~"\tPunto de entrada: 0x446cb0\n" ---- If you want threads to update *while* running (it is no problem to skip that) also search for thread-created', 'thread-exited' ""[Nuevo Thread 0x7fffecaf9700" ---------------------------------------------------------------------- BigChimp · 2013-05-01 11:36 Quote from: Martin_fr on May 01, 2013, 01:32:32 pmGDB provides a "machine readable" interface -mi And Lazarus uses this. But not all commands are available in this. So Lazarus still needs to use some of the human commands. Over the years GDB responses (English) from many platforms, and lots of gdb versions have been collected. There are already many differences there (last gdb 7.5 changed some spacing, and fooled the IDE). It will be near impossible to collect all that info, in dozens of extra languages. And even if, it will be a maintenance issue. One could add translation files, which the IDE can load, and which the user(s) can maintain. That would actually be a good idea. But I do not know if or when I would have time for that. Wouldn't it be much better to raise a bug with gdb that the -mi interface needs to be extended? ---- ---------------------------------------------------------------------- Martin_fr · 2013-05-01 11:45 Quote from: BigChimp on May 01, 2013, 01:36:03 pm Wouldn't it be much better to raise a bug with gdb that the -mi interface needs to be extended? You can go and report them... I actually need to check. Seems there are some new ones (maybe already for a while) which the IDE does not yet use. But the IDE also must maintain the old stuff, because on some platforms only old GDB are available (Mac is is still at 6.3.50) ---------------------------------------------------------------------- BigChimp · 2013-05-01 12:53 Quote from: Martin_fr on May 01, 2013, 01:45:31 pmQuote from: BigChimp on May 01, 2013, 01:36:03 pm Wouldn't it be much better to raise a bug with gdb that the -mi interface needs to be extended? You can go and report them... I'll leave that to Miguel as he has the actual problems... Quote from: Martin_fr on May 01, 2013, 01:45:31 pmBut the IDE also must maintain the old stuff, because on some platforms only old GDB are available (Mac is is still at 6.3.50) I understand. ---------------------------------------------------------------------- miguel-laz · 2013-05-01 16:20 QuoteYou could report it at the gdb bugtracker so they build in numeric result codes, I'd say... I do not feel able to report a problem I really do not understand well, besides my English is basic, I use google-translator, I can hardly express something so complex. I think the problem should be addressed by the easy way, I think it'll force "gdb" to that uses only English message strings. I will continue looking for a solution this way. ---------------------------------------------------------------------- Martin_fr · 2013-05-01 16:58 You do not need to report them.  At the moment it would not benefit us much. Lot me know if the change to gdbmidebugger are helping you. Or lets see if we can add info, how to get an english gdb. But that would have to come from some one who knows the linux distro very good. ---------------------------------------------------------------------- miguel-laz · 2013-05-01 17:26 Finally I tried to send an email to gdb-patches@sourceware.org for help, but it's not possible, "Invalid mime type" text / html "detected in message text or attachment. Please send plain text messages only." I do not understand anything. ---------------------------------------------------------------------- exdatis · 2013-05-01 17:32 Just set your mail client to send text messages? ---------------------------------------------------------------------- Martin_fr · 2013-05-01 17:41 Quote from: miguel-laz on May 01, 2013, 07:26:26 pmFinally I tried to send an email to gdb-patches@sourceware.org for help, but it's not possible, "Invalid mime type" text / html "detected in message text or attachment. Please send plain text messages only." I do not understand anything. They have a web based bug tracker. But without a list of thinks that we need, nothing will happen. Even then, some one on their team would need to be interested to do the work, or patches need to be supplied. Trying to change gdb would be a very lengthy process. Unless we can sent them patches. ---------------------------------------------------------------------- miguel-laz · 2013-05-01 17:51 Quote from: exdatis on May 01, 2013, 07:32:28 pmJust set your mail client to send text messages? I use Gmail, I've pasted the text as "plain text" and I marked the message as "plain text" .... It seems that this time it was sent, fingers crossed! and to wait for the answer ... ---------------------------------------------------------------------- Martin_fr · 2013-05-01 18:06 gdb-patches is for patches not general question... But besides that: I do not *know* how to change the gdb language. But I *believe* it is an installation issue.  The language is probably compiled in. So you need to re-install re-compile gdb. How exactly to do that is probably something that depends on your linux distro (but I do not know). ---------------------------------------------------------------------- Martin_fr · 2013-05-02 11:53 I saw the response on the gdb list. QuoteIf Lazarus is depending on the language used by GDB to be English, it sounds like Lazarus should override the user's environment in terms of i18n. Typically, the language is determined via the LANG and/or LC_* environment variables, so it should be able to force English by setting LANG/LC_ALL et al to Eg. "C" before starting GDB. The quickest way to test this, is for you to set this before starting lazarus. If Lazarus gets the modified value, it should pass it on to gdb. (afaik) You can set Lazarus to force using your language in the IDE, even if the environment is diff. ---------------------------------------------------------------------- miguel-laz · 2013-05-02 16:26 Quote from: Martin_fr on May 02, 2013, 01:53:08 pmI saw the response on the gdb list. QuoteIf Lazarus is depending on the language used by GDB to be English, it sounds like Lazarus should override the user's environment in terms of i18n. Typically, the language is determined via the LANG and/or LC_* environment variables, so it should be able to force English by setting LANG/LC_ALL et al to Eg. "C" before starting GDB. The quickest way to test this, is for you to set this before starting lazarus. If Lazarus gets the modified value, it should pass it on to gdb. (afaik) You can set Lazarus to force using your language in the IDE, even if the environment is diff. Right, this is the solution. I modified the environment variable "LANG" to "export LANG = C" and debugging worked well, no errors. Now we just need to automate the process, I thought of using "Project Options-> Compilation-> (Execute Before: Conmand & Execute After: Conmand)" but I'm not sure this works. Do these commands correspond to terminal commands?Seems not! How could I run "export LANG = C" before debugging and "export LANG = es_ES.UTF-8" after debugging from Lazarus? Any idea? ---------------------------------------------------------------------- Martin_fr · 2013-05-02 16:56 It will need to be set to TProcess.Environment. But all the other env may have to be copied, or it may be lost to gdb. Also I am not sure if C is always the right choice. And this needs to be tested, how it affects other platforms.... Probably it will become, an option. You can report it on mantis, so it will not be forgotten. ---------------------------------------------------------------------- miguel-laz · 2013-05-02 21:41 QuoteIt will need to be set to TProcess.Environment. But all the other env may have to be copied, or it may be lost to gdb. This solution is very interesting, I understand that the Lazarus  creates process "gdb" and before starting the process "gdb" set environment variables (copy of Lazarus + LANG modified process). When finished debugging do nothing. What Lazarus source file manages the creation and completion of the process "gdb"? Try to modify the source code to do some tests! ---------------------------------------------------------------------- macmike · 2013-05-02 21:56 Quote from: Martin_fr on April 30, 2013, 11:25:06 pmQuote from: macmike on April 30, 2013, 10:30:06 pm. More importantly though the debugger appears to crash in that I can't move in or over the next statement (F7,F8) or out of the method. In fact pressing run F9 doesn't do anything either. Pressing the stop button doesn't stop the debugging app and the breakpoint no longer stops execution. Here's what I think is the relevant bit of the log? Indeed seems you found a bug in gdb. And gdb crashed: Code: [Select] << TCmdLineDebugger.ReadLn "&"/build/buildd/gdb-7.6~20130417/gdb/parse.c:588: internal-error: mark_struct_expression: Assertion `parse_completion && expout_tag_completion_type == TYPE_CODE_UNDEF' failed.\nA problem internal to GDB has been detected,\nfurther debugging may prove unreliable.""   [Debugger] Log output: &"/build/buildd/gdb-7.6~20130417/gdb/parse.c:588: internal-error: mark_struct_expression: Assertion `parse_completion && expout_tag_completion_type == TYPE_CODE_UNDEF' failed.\nA problem internal to GDB has been detected,\nfurther debugging may prove unreliable."   << TCmdLineDebugger.ReadLn "&"\n""   [Debugger] Log output: &"\n" GDb may be able to recover and continue, after this crash (may be, or may not be.) The problem is that gdb does not print the prompt, that it is ready for the next command. So the IDE waits indefinitely. You may want to try, and change between stabs and dwarf (whatever you currently use). Maybe that will fix the error. If you do, ensure you do for *ALL* packages, that have debug info. If it doesn't help, you can try and configure a timeout. In the debugger page of the option dialog is a property grid. This has an entry "TimeOutForEval" set it to 50. (And disable the "WarnOnTimeOut" if you like.) Thanks for this. Changing from dwarf to stabs didn't appear to do anything so I went back to dwarf. Now if I hover (after applying the suggested timeout settings) and then try to step I get the Debugger Stopping errors message and then: Code: [Select]The debugger experienced and unknown condition: Press "Ignore" to continue debugging. This may NOT be safe. Press "Abort" to stop the debugger. Exception: EAccessViolation with message "Access violation" Context: TGDBMIDebuggerCommandEvaluate. State: Error   $08060570   $088F85F7  TGDBMIDEBUGGERCOMMANDEVALUATE__DOEXECUTE,  line 12357 of /usr/share/lazarus/1.0.8/debugger/gdbmidebugger.pp   $088F655B  TGDBMIDEBUGGERCOMMAND__EXECUTE,  line 10832 of /usr/share/lazarus/1.0.8/debugger/gdbmidebugger.pp   $088E54EA  TGDBMIDEBUGGER__RUNQUEUE,  line 6557 of /usr/share/lazarus/1.0.8/debugger/gdbmidebugger.pp   $088E3B24  TGDBMIDEBUGGER__UNLOCKCOMMANDPROCESSING,  line 6270 of /usr/share/lazarus/1.0.8/debugger/gdbmidebugger.pp   $088E57D0  TGDBMIDEBUGGER__RUNQUEUE,  line 6614 of /usr/share/lazarus/1.0.8/debugger/gdbmidebugger.pp ---------------------------------------------------------------------- Martin_fr · 2013-05-02 22:07 debugger\cmdlinedebugger.pp the gdb stuff is in debugger\gdbmidebugger.pp  so it will be called from there. IIRC cmdlinedebugger.pp is also used for running projects if the debugger is disabled (the unit for that is processdebugger , which is not a real debugger) ---- Note that you will find environemntstuff, but that is nod for gdb. It is stuff passed VIA gdb to the project (if set in Menu>Run>"run parameters") ---- function TCmdLineDebugger.CreateDebugProcess(const AOptions: String): Boolean; This must also be fixed, because the current used CommandLine is deprecated. exe-name and arguments must in future be separated. For your own testing, you can set environment here. But the final solution must ass a param to the function (maybe TStrings) from gdbmidebugger ---------------------------------------------------------------------- Martin_fr · 2013-05-02 22:19 Quote from: macmike on May 02, 2013, 11:56:01 pm Changing from dwarf to stabs didn't appear to do anything so I went back to dwarf. Now if I hover (after applying the suggested timeout settings) and then try to step I get the Debugger Stopping errors message and then: Code: [Select]The debugger experienced and unknown condition: Press "Ignore" to continue debugging. This may NOT be safe. Press "Abort" to stop the debugger. Exception: EAccessViolation with message "Access violation" Context: TGDBMIDebuggerCommandEvaluate. State: Error   $08060570   $088F85F7  TGDBMIDEBUGGERCOMMANDEVALUATE__DOEXECUTE,  line 12357 of /usr/share/lazarus/1.0.8/debugger/gdbmidebugger.pp   $088F655B  TGDBMIDEBUGGERCOMMAND__EXECUTE,  line 10832 of /usr/share/lazarus/1.0.8/debugger/gdbmidebugger.pp  [/quote] Ok, that is a bug in the Lazarus code. I will need a new log from you please, so I can see which commands the IDE sends to gdb before the IDE fails. Also the log may tell me, if gdb is still reacting same, or if it has taken damage to the debug session. ---------------------------------------------------------------------- macmike · 2013-05-02 23:00 Here you go: Code: [Select]  OnIdle: UnLock   TGDBMIDebugger.UnLockCommandProcessing: Execute RunQueue     Executing (Recurse-Count=0) queued= 15 CmdPrior=0 CmdMinRunLvl=-1 : "TGDBMIDebuggerCommandEvaluate: n Thread=1, Frame=0" State=Pause PauseWaitState=0       >>Enter: TGDBType.ProcessExpression: state = gtpsInitial   Expression="n"       <> TCmdLineDebugger.SendCmdLn "ptype n"       << TCmdLineDebugger.ReadLn "&"ptype n\n""       [Debugger] Log output: &"ptype n\n"       << TCmdLineDebugger.ReadLn "&"No symbol \"n\" in current context.\n""       [Debugger] Log output: &"No symbol \"n\" in current context.\n"       << TCmdLineDebugger.ReadLn "^error,msg="No symbol \"n\" in current context.""       TGDBMIDebugger.ProcessResult Error: ,msg="No symbol \"n\" in current context."       << TCmdLineDebugger.ReadLn "(gdb) "       >>Enter: TGDBType.ProcessExpression: state = gtpsInitialSimple   Expression="n"         ERROR: detected state loop in ProcessExpression       <> TCmdLineDebugger.SendCmdLn "-data-evaluate-expression parentfp"       << TCmdLineDebugger.ReadLn "^error,msg="No symbol \"parentfp\" in current context.""       TGDBMIDebugger.ProcessResult Error: ,msg="No symbol \"parentfp\" in current context."       >> TCmdLineDebugger.SendCmdLn "-data-evaluate-expression 7"       >> TCmdLineDebugger.SendCmdLn "-data-evaluate-expression 1"       << TCmdLineDebugger.ReadLn "(gdb) "       [WARNING] TGDBMIDebugger:  ExecuteCommand "-data-evaluate- expression parentfp" failed.       DebuggerState: Setting to Error, from Pause         DebugDataMonitor: >>ENTER: TGDBMIThreads.DoStateChange  New- State=Error         DebugDataMonitor: <>ENTER: TGDBMICallStack.DoStateChange  New- State=Error         DebugDataMonitor: <>ENTER: TGDBMILocals.DoStateChange  New- State=Error         DebugDataMonitor: <>ENTER: TGDBMIWatches.DoStateChange  New- State=Error         DebugDataMonitor: <> TCmdLineDebugger.SendCmdLn "kill"         DebugDataMonitor: >>ENTER: TSnapshotManager.DoStateChange  New-State=Error         DebugDataMonitor: <>ENTER: TGDBMIThreads.DoStateChange  New- State=None         DebugDataMonitor: <>ENTER: TGDBMICallStack.DoStateChange  New- State=None         DebugDataMonitor: <>ENTER: TGDBMILocals.DoStateChange  New- State=None         DebugDataMonitor: <>ENTER: TGDBMIWatches.DoStateChange  New- State=None         DebugDataMonitor: <>ENTER: TSnapshotManager.DoStateChange  New-State=None         DebugDataMonitor: < 0 then     begin       for cont:=1 to envCount do       begin            envValue:=SysUtils.GetEnvironmentString(cont);            checkLang:=StrUtils.AnsiStartsText('LANG=en', envValue);            if checkLang = True then            begin               envValue:='LANG=C';               setLangValid:=True;            end;            FDbgProcess.Environment.Add(envValue);       end;     end;     if setLangValid = False then        FDbgProcess.Environment.Add('LANG=C');     // end LANG case     "     " How I can debug Lazarus himself? ---------------------------------------------------------------------- Martin_fr · 2013-05-03 12:09 Quote from: miguel-laz on May 03, 2013, 01:43:41 pm How I can debug Lazarus himself? Open: ide/lazarus.lpi ---------------------------------------------------------------------- miguel-laz · 2013-05-03 16:03 Quote from: Martin_fr on May 03, 2013, 02:09:10 pmQuote from: miguel- laz on May 03, 2013, 01:43:41 pm How I can debug Lazarus himself? Open: ide/lazarus.lpi I tried to debug Lazarus "ide/lazarus.lpi" from a portable version (usb pen drive) Lazarus and does not work, now on a version installed everything worked properly ... thanks It is really hard to debug Lazarus itself! In Ubuntu, I had to create a local installation from the sources that the original location "usr/share/lazarus" I have permission problems. When you start debugging an error "in dir EReadError 8A6463" debugging options step-to-step all disabled on the primary IDE, the debugger stops at the breakpoint selected but does not show the values ​​of the variables. Does the IDE in debug runs before leaving TCmdLineDebugger.CreateDebugProcess ()? Can more than one process? Developers Lazarus! Like what are you doing? ---------------------------------------------------------------------- miguel-laz · 2013-05-03 18:19 It seems the problem has been resolved.  The debugger error window no longer appears at the end of debugging with the stop button (red square), the method TCmdLineDebugger.CreateDebugProcess () looks like this: Code: [Select]function TCmdLineDebugger.CreateDebugProcess(const AOptions: String): Boolean; var   envCount: integer;   cont:integer;   envValue:string;   checkLang:boolean;   setLangValid:boolean; begin   if FDbgProcess = nil   then begin     setLangValid:=False;     FDbgProcess := TProcess.Create(nil);     FDbgProcess.CommandLine := UTF8ToSys(ExternalDebugger + ' ' + AOptions);     // TODO: under win9x and winMe should be created with console,     // otherwise no break can be sent.     FDbgProcess.Options:= [poUsePipes, poNoConsole, poStdErrToOutPut, poNewProcessGroup];     FDbgProcess.ShowWindow := swoNone;     AssignUTF8ListToAnsi(DebuggerEnvironment,FDbgProcess.Environment);   end;   if not FDbgProcess.Running   then begin     // Get all environment variables ¿current application process?     // and add to FDbgProcess.Environment     envCount := SysUtils.GetEnvironmentVariableCount;     if envCount > 0 then     begin       for cont:=1 to envCount do       begin            envValue:=SysUtils.GetEnvironmentString(cont);            checkLang:=StrUtils.AnsiStartsText('LANG=', envValue);         if checkLang = True AND            StrUtils.AnsiStartsText('LANG=en', envValue) = False then            begin               envValue:='LANG=C';               setLangValid:=True;            end;            FDbgProcess.Environment.Add(envValue);       end;     end;     if setLangValid = False then        FDbgProcess.Environment.Add('LANG=C');     // end LANG case     FDbgProcess.Execute;     DebugLn('[TCmdLineDebugger] Debug PID: ', IntToStr(FDbgProcess.Handle));   end;   Result := FDbgProcess.Running; end; this is the new log file "laz.log" (attached), everything seems fine. In short I will create a new entry error report "bugtracker". ---------------------------------------------------------------------- Martin_fr · 2013-05-03 18:38 Good, but as I explained: To make it into the official lazarus, it must be optional, and it must be limited to gdb based debuggers. Anyway, glad it works for you now. ---------------------------------------------------------------------- miguel-laz · 2013-05-06 19:11 Just wanted to mention that I received an email from "Tom Tromey" of "Redhat" says: Code: [Select]I just wanted to mention that it would be even better to change Lazarus to use MI.  This is what MI was made for. To solve this problem Do I need to create an entry in Bugtracker? Is it enough grounds here? ---------------------------------------------------------------------- Martin_fr · 2013-05-06 20:08 We use MI. But not all commands work in MI . And even those that do, we still need to support old ones. Though to be fair, some more commands could get MI fallback. But it's a lot of work... You can create a bug report, for the setting of LANG=C ---------------------------------------------------------------------- Martin_fr · 2013-05-09 22:47 @macmike The problem you have may be the same as referenced here: http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Issues_with_GDB_7 .5.9_or_7.6 ---------------------------------------------------------------------- macmike · 2013-05-10 00:34 Thanks for the link - sorry I've not come back to this I've just bought a mac so I've been a bit focussed on getting that set up with Lazarus (which was easy and the results are brilliant). I've had a bit of luck stabilising the debugger by fiddling with the options... for some reason I had -gh (heaptrc for memleaks) and -pg (gprof) on. I've noticed for a while that the memleak report was always showing 0 even if I tried to deliberately cause a leak so I was fiddling around with these settings. Long story short, memleak reporting is now working and the debugger can step on but it still crashes after hovering over (almost) any value. I tried removing all of my watches and hiding the local vars window but it didn't help. My code's heavily instrumented so I'm kind of getting away with it at the moment. Also, I'm building on Linux, Win and Mac so I've got a choice of platforms to play with. I had a theory it could be do to with my code somehow so I created the following test app which causes the crash after hovering over OpenDialog1.FileName (hovering over "blah" is ok): Code: [Select]procedure TForm1.Button1Click(Sender : TObject); var blah : string; begin   blah := 'hello';   OpenDialog1.Execute;   if OpenDialog1.FileName = blah then     Exit; end;      Full log for the session attached. ---------------------------------------------------------------------- Martin_fr · 2013-05-10 00:49 The logfile starts with Quote"GNU gdb (GDB) 7.5.91.20130417-cvs-ubuntu\n"" And due to the bug in GDB this version of GDB can not be used. You will need to install an older version of GDB. Or if you build it yourself, you can try the patch from the gdb bug report. ---------------------------------------------------------------------- macmike · 2013-05-10 11:01 Edit: Spoke to soon.... Reinstalling gdb made it a bit more stable but didn't fix the problems entirely. Off I go to downgrade gdb. ---------------------------------------------------------------------- macmike · 2013-05-10 12:56 I've downgraded gdb to 7.5-ubuntu and now debugging seems stable again. Thanks for your help