Forum > FPC development

more debuggery.

(1/8) > >>

lazer:
Hi,

I'm trying to debug a fairly small project with one main form and one class from a unit.

I build with Dwarf3 debugging and step to this part of the code.


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---function Tpack.fillpack:boolean; var  index,resp,bytecount,maxlen:integer;  suffix,packnumstr:string[5];  msgstr:varstring;    function readpackfile(numrecs:integer):integer;   {attempts to read numrec records from card file -   returns with number of records sucessfully read}   var    f:text;    srec:Tsearchrec;    ii,index:integer;    filename:string[pathlen+1+12];  {path\dosfilename}     function locfexist:boolean;      // why dupe with locfexist ???    begin      xDosError:=sysutils.findfirst(strcon(filename),$3F,srec);      findClose(srec);      locfexist:=(xDosError=0);      if xDosError=2 then IOcode:=3 else IOcode:=xDosError;      IOerr:=IOcode<>0;    end; {locFexist}    begin  {body readpackfile}    index:=0;    IOerr:=false;  {unnecc set by locfex*****}    IOcode:=0;    filename:=cardDir+cardfilepx+packnumstr;   {pathlen+13 char}    if not locfexist then discerrdisp(strcon(strCntOpenWG+#13+'    '+filename)                             ,NIL,mb_OK)    else    begin      assignFile(f,filename);      reset(f);      readln(f,msgstr);IOck;  {process header}      if not IOerr then      begin        msgstr:=copy(msgstr,pos('OM=',msgstr)+3,5);        val(msgstr,bytecount,resp);        if resp=0 then bytecount:=(bytecount-20009)div 7 else bytecount:=0;{err}         if bytecount=srec.size then    {overfl if>32k***}        begin          repeat...           
If I hover bytecount to evaluate it , the hint says "No symbol \BYTECOUNT\ in current context".
msgstr also fails, suggesting I cast it to its original type !

If I try in the eval window it's empty.

ii and index it can manage.   :D

It seems I only have access to the local variables of the fn readpack() and not the outer function to which it is local.

However, it all seems to run fine and on exiting the local fn bytecount does evaluate and contains the correct value established by the code inside that function.

It seems there is a scoping problem in the debugger.



Martin_fr:
FPC 3.3.1 ?

What is the type of "TPack" ? record, class, object?

Does "readpackfile" (in the locals window) has any variable $parentfp ? (or anything with parentfp in it?)
Or does the stack window show such a name in the params?

In case you are paused in "locfexist"
Does "locfexist" have some parentfp too

(Is there a parentfp in each of both locfexist and readpackfile)

Does the stack window show **ALL** callers?

Martin_fr:
Does "objdump --dwarf=info  yourapp" report errors?

Does it contain:
- the name of each such variable
- the word $parentfp

lazer:
Sorry, I should have specified.   laz and fpc from latest tree a couple of days ago.

breaking inside locfexist :

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---$parentfp=0x7fffffffc4d0$result=falseLOCFEXIST=falseRESULT=false It can access globals : IOcode xDosError,  but NOT filename , a local variable  of its caller.


Inside readpackfile $parentfp is present and defined

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---$parentfp=0x7fffffffc850 
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---objdump --dwarf=info hill2 |grep bytecount    <80c6b6>   DW_AT_name        : bytecount
msgstr also present.

FWIW, there are dozens of occurrences of msgstrtable , which seems to be some internal thing.

This is basically what I was reporting about 2 weeks ago on the old version of this program. Stepping into these same routines , some had variable evaluation, others not.

lazer:
can I rebuild lazarus with -gw3 from source?



--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---export FPCOPT=-gw3; make bigide


???

Navigation

[0] Message Index

[#] Next page

Go to full version