cannot get hint about class variable from within class method while debugging lazarus / 12-Debugger ---------------------------------------------------------------------- kalixo · 2014-06-25 08:10 Hello, I have been able to reproduce this error on lazarus 1.2.2 and 1.2.4 with  Free Pascal Compiler version 2.6.4 [2014/04/20] for i386 and GNU gdb (Ubuntu 7.7-0ubuntu3.1) 7.7 Setting a breakpoint on ' yourage := 5;' I can hover over self.yourage and get a correct value in the tooltip but not over 'yourage' solo, when it says 'Type TMYOBJECT = class  has no component named yourage', but I'm quite sure it has . It seems like gdb can't infer the scope of the variable when the 'self' is missing. Why is that? I was trying to compile a bigger legacy project and will not be able to debug it?! Some hints appreciated... the log file is a start of lazarus with debug enabled. Code: [Select]unit Unit1; {$mode Delphi} interface uses   Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls; type   { TForm1 }   TForm1 = class(TForm)     Button1: TButton;     procedure Button1Click(Sender: TObject);   private     { private declarations }   public     { public declarations }   end; type   tvector = array[0..1] of double; type   tmyobject = class(TObject)     yourage: integer;     thething: array[0..1] of tvector;   public     constructor Create();     procedure doblu();   end; var   Form1: TForm1; implementation {$R *.lfm} { TForm1 } procedure TForm1.Button1Click(Sender: TObject); var   myobj: tmyobject; begin   myobj := tmyobject.Create();   myobj.yourage := 2;   myobj.doblu(); end; procedure tmyobject.doblu(); begin   self.yourage := 1; //hover over this and it is right   yourage := 5; //impossible   thething[1][1] := 3; end; constructor tmyobject.Create(); begin   yourage := 4;   thething[0][0] := 1;   thething[0][1] := 2; end; end. ---------------------------------------------------------------------- Blaazen · 2014-06-25 09:26 I cannot reproduce, I tried with Linux, Laz. 2.7.1 + GDB 7.5.1 and Wine, Laz. 1.2.4, FPC 2.6.4 + unknown GDB (its the version that comes with Laz.). Note that program break is before line, i.e.: Code: [Select]    self.yourage := 1; //hover over this and it is right (!) yourage := 5; //impossiblewill show both yourage or self.yourage = 1. I've never saw Quote'Type TMYOBJECT = class  has no component named yourage' with your demo. ---------------------------------------------------------------------- kalixo · 2014-06-25 10:40 I think I have a pretty standard setup. As is documented in the log attached above, gdb returns Code: [Select] << TCmdLineDebugger.ReadLn "^error,msg="Type TMYOBJECT = class  has no component named yourage.""upon 'ptype yourage'. The flaw mus be here. Blaazen, as you have tried with an older gdb version, do you think it is worth installing an old package like yours? I have tried on another machine, this tim 64bit, but the same... Code: [Select]<< Run OnIdle OnIdle: Finished Executing (Recurse-Count=0) queued= 0 CmdPrior=999 CmdMinRunLvl=-1 : "TGDBMIDebuggerCommandEvaluate: Self.yourage" State=Pause PauseWaitState=0   >>Enter: TGDBType.ProcessExpression: Expr="Self.yourage", Flags=[gtcfClassIsPointer, gtcfExprEvaluate, gtcfExprEvalStrFixed, gtcfAutoCastClass], State=gtpsInitial   <> TCmdLineDebugger.SendCmdLn "ptype Self.yourage"   << TCmdLineDebugger.ReadLn "&"ptype Self.yourage\n""   << TCmdLineDebugger.ReadLn "&"warning: can't find linker symbol for virtual table for `' value\n""   << TCmdLineDebugger.ReadLn "~"type = LONGINT\n""   << TCmdLineDebugger.ReadLn "^done"   << TCmdLineDebugger.ReadLn "(gdb) "   ParseTypeFromGdb: Flags= Kind=ptprkSimple Name="LONGINT"   >>Enter: TGDBType.ProcessExpression: Expr="Self.yourage", Flags=[gtcfClassIsPointer, gtcfExprEvaluate, gtcfExprEvalStrFixed, gtcfAutoCastClass], State=gtpsInitialSimple   <> TCmdLineDebugger.SendCmdLn "whatis Self.yourage"   << TCmdLineDebugger.ReadLn "&"whatis Self.yourage\n""   << TCmdLineDebugger.ReadLn "&"warning: can't find linker symbol for virtual table for `' value\n""   << TCmdLineDebugger.ReadLn "~"type = LONGINT\n""   << TCmdLineDebugger.ReadLn "^done"   << TCmdLineDebugger.ReadLn "(gdb) "   ParseTypeFromGdb: Flags= Kind=ptprkSimple Name="LONGINT"   >>Enter: TGDBType.ProcessExpression: Expr="Self.yourage", Flags=[gtcfClassIsPointer, gtcfExprEvaluate, gtcfExprEvalStrFixed, gtcfAutoCastClass], State=gtpsInitialSimple   <> TCmdLineDebugger.SendCmdLn "-data-evaluate-expression Self.yourage"   << TCmdLineDebugger.ReadLn "&"warning: can't find linker symbol for virtual table for `' value\n""   << TCmdLineDebugger.ReadLn "^done,value="5""   << TCmdLineDebugger.ReadLn "(gdb) "   >>Enter: TGDBType.ProcessExpression: Expr="Self.yourage", Flags=[gtcfClassIsPointer, gtcfExprEvaluate, gtcfExprEvalStrFixed, gtcfAutoCastClass], State=gtpsEvalExpr   <> Run OnIdle   DebugDataMonitor: >>ENTER: TSnapshotManager.DoDebuggerIdle  New- State=Pause   DebugDataMonitor: <>Enter: TGDBType.ProcessExpression: Expr="yourage", Flags=[gtcfClassIsPointer, gtcfExprEvaluate, gtcfExprEvalStrFixed, gtcfAutoCastClass], State=gtpsInitial   <> TCmdLineDebugger.SendCmdLn "ptype yourage"   << TCmdLineDebugger.ReadLn "&"ptype yourage\n""   << TCmdLineDebugger.ReadLn "&"Type TMYOBJECT = class  has no component named yourage.\n""   << TCmdLineDebugger.ReadLn "^error,msg="Type TMYOBJECT = class  has no component named yourage.""   << TCmdLineDebugger.ReadLn "(gdb) "   >>Enter: TGDBType.ProcessExpression: Expr="yourage", Flags=[gtcfClassIsPointer, gtcfExprEvaluate, gtcfExprEvalStrFixed, gtcfAutoCastClass], State=gtpsInitialSimple   <> TCmdLineDebugger.SendCmdLn "-data-evaluate-expression parentfp"   << TCmdLineDebugger.ReadLn "^error,msg="No symbol \"parentfp\" in current context.""   << TCmdLineDebugger.ReadLn "(gdb) " Exec done ---------------------------------------------------------------------- Blaazen · 2014-06-25 10:51 QuoteThe flaw mus be here. Blaazen, as you have tried with an older gdb version, do you think it is worth installing an old package like yours? Wait for Martin_fr, or send him private message. He is the most involved with debugger here. ---------------------------------------------------------------------- kalixo · 2014-06-25 11:35 wow. So this seems to be some kind of regression in gdb? I just built GNU gdb (GDB) 7.5.1  (and others) from source  and it works fine. so, my tests as well show: gdb version 7.7.1 - broken 7.7 - broken 7.6.2 - fine 7.5.1 - fine So should there be opened a bug? Please advise... ---------------------------------------------------------------------- Martin_fr · 2014-06-25 15:03 It is either gdb, your linker, or fpc dwarf generator.   >> TCmdLineDebugger.SendCmdLn "ptype Self.yourage"   << TCmdLineDebugger.ReadLn "&"ptype Self.yourage\n""   << TCmdLineDebugger.ReadLn "&"warning: can't find linker symbol for virtual table for `' value\n"" There is a warning there too. One thing: some gdb get irritated, if other units use stabs (while you used dwarf / recommended). So maybe recompile the LCL (and other ...) with either no debug, or dwarf. (afaik it has stabs by default) --- If you look at the "Locals" does it show this $this self $self ? EDIT: Actually found in the log "this" which afaik is ok... ---------------------------------------------------------------------- kalixo · 2014-06-25 15:21 the warning also appears with the gdb 7.6.2 version, which works fine Code: [Select]  >> TCmdLineDebugger.SendCmdLn "-data-evaluate- expression yourage"   << TCmdLineDebugger.ReadLn "&"warning: can't find linker symbol for virtual table for `' value\n""   << TCmdLineDebugger.ReadLn "^done,value="5""   << TCmdLineDebugger.ReadLn "(gdb) "   >>Enter: TGDBType.ProcessExpression: Expr="yourage", Flags=[gtcfClassIsPointer, gtcfExprEvaluate, gtcfExprEvalStrFixed, gtcfAutoCastClass], State=gtpsEvalExpr I recompiled the ide in profile 'normal', nothing. As for production use, I might stick to 7.6.2, but if I can do something to help nail down the bug, feel free to ask.