Recent

Author Topic: [solved]Debug as Dll failed ? Why I cannot set variabiles integer =0  (Read 2494 times)

d2010

  • Sr. Member
  • ****
  • Posts: 257
Even I forced to initilalize with three methods,
All 3 methods, the  "PsizeWizInc36" still remain 998521728 and not 000000
Code: [Select]
    fillchar(PsizeWizInc36,sizeof(PsizeWizInc36),0);
    asm mov eax,PsizeWizInc36
        xor eax,eax
        mov PsizeWizInc36,eax
    end;
    PsizeWizInc36:=000;
C:Q1=Stil remain eCannot Calculate the address of  PsizeWizInc36?
At Line 55 and 56, I need dynamic array of integer; and PsizeWizInc36 is
--incremental index for fill PsizeWizRes with length(1c).
When PsizeWizInc36> length(PsizeWizRes) then I try resize to bigger sizeof PsizeWizRes.

Code: Pascal  [Select][+][-]
  1. Library cozipinc;
  2. {$IFDEF FPC}
  3.   {$MODE Delphi}
  4. {..$optimization autoInline}
  5. {..$inline on}
  6. {$modeswitch advancedrecords}
  7.   {$H+}
  8. {$ENDIF}
  9. {$UNDEFINE base64nop}
  10. uses  windows,sysutils,classes,
  11.      fphttpclient,
  12.      h_types in 'D:\Vlaxcompil\Srcincpa\h_types.pas',
  13.      h_aduiport in 'D:\Vlaxcompil\Srcincpa\h_aduiport.pas',
  14.      hc_exprecon in 'D:\vlaxcompil\srcincpa\hc_exprecon.pas',
  15.      hc_Masks in 'D:\Vlaxcompil\srcincpa\hc_Masks.pas',
  16.      LazFileUtils,
  17.      md5, Clipbrd,
  18.      FileUtil,
  19.      zipper;
  20. (* assert_cod(090,'0');
  21.    assert_cod(036,'0');
  22. *)
  23. Const RTSkipBat=5300;
  24.       RT3DONE  =5203;
  25. Var cpkunzip_han_openttd:Thandle=00;
  26.     nccdos:array[0..7] of char='B0000='#00#00;
  27.     odutWcMatch:shortstring='*';
  28.     sumo:integer=0;
  29.     AdCharFmt2c:Ansistring='rem:comtine toate sursele Bats';
  30.     AdCharFmt1c:string='rem:contine .DFN';
  31.     AllttRootNames:string='';
  32.     AllttBatsNames:string='(prompt "Fara subdir si cucuBats")';
  33.     WRegio5AllNames:string='(prompt "contine toate numele fisiere , trebuie pastrat pentru disk32add")';
  34.     WCount5AllNames:record root,deep:integer;end;
  35.     AcZipBoot16Han:handwait=0;
  36.     ABrchiveFileName:String='';
  37.     kVerbatim_endfmt1c:integer=00;
  38.     netdrv:integer=000; //(<000.You set libCValx from NetDrvPath);
  39.     scho_a:string='';
  40.     cntCozipinc_disk32add:integer=RTCAN;
  41.     cntlbop:record x,y,z:integer;end;
  42.     cntBatmeter:tpoint;
  43.     extmin:tpoint_xyz;
  44.     ret_disk32add:string='';
  45.     ret_base64dec:string='';
  46.     typ_base64dec:char=#00;
  47.     regtokenames:string='';
  48.     ret_prefixtoken:tap_char255psicnt;
  49.     libPK:record hostname,namef1,namef2:shortstring;
  50.                  name_of_library:string;
  51.                  han32:handwait;
  52.                  maskingset:word;
  53.           end;
  54. Var PFeedWizRes3:array of record x10,y13:integer;end;
  55.     PsizeWizInc36:integer;
  56.     PsizeWizRes3:array of integer;
  57.     CancelFeedBack:array[char] of integer;
  58.     cntDoIteratorEachFilezip3Stream:integer=00;
  59.  
At Line=27, bellow, I cannot set 00, still remain at PsizeWizInc36 is 88585885.
Already I reset him to 000, but nothing.
 PFeedWizRes3[PsizeWizInc36]
 8-)
Code: Pascal  [Select][+][-]
  1. Var ret_DoIteratorEachFilezip3Stream:integer=000;
  2. procedure Tform1.DoIteratorEachFilezip3Stream(Sender: TObject; var AStream:TStream;  AItem: TFullZipFileEntry);
  3. Var lena,addc:integer; Astr:string; kRegionBatFile:char;
  4.    Asho:AnsiSTring;
  5.    dwg,nth,cnt:integer;
  6.  begin  dwg:=00; nth:=00; cnt:=00;
  7.     assert_adu(068,'0');
  8.     AStream.Position:=0;
  9.     lena:=length(AdCharFmt1c);
  10.     if (lena<01) then lena:=01;
  11.     inc(cntDoIteratorEachFilezip3Stream);
  12.     Astr:='';
  13.     addc:=000;
  14.     astr:=lowercase(Aitem.ArchiveFileName);
  15.     Asho:=extractfileext(astr);
  16.     if (asho='.bat') then kRegionBatFile:='b' else kRegionBatFile:='a';
  17.    Case kRegionBatFile of
  18. 'a':   with Tstringlist.Create do
  19.         Begin
  20.           LoadFromStream(Astream);
  21.           Add(''); Add('');
  22.           Add(''); Add('');
  23.           Add(''); Add('');
  24.           Add(''); Add('');
  25.           inc(CancelFeedBack[#13],08);
  26.           inc(CancelFeedBack[#10],08);
  27.           PFeedWizRes3[PsizeWizInc36].y13:=CancelFeedBack[#13];
  28.           PFeedWizRes3[PsizeWizInc36].x10:=CancelFeedBack[#10];
  29.           Astr:=GetText;
  30.           Addc:=Astream.Size;
  31.           Free;
  32.           dwg:=length(AdCharFmt1c);
  33.           AdCharFmt1c:=AdCharFmt1c+Astr;
  34.           for nth:=01 to length(Astr) do inc(CancelFeedBack[astr[nth]]);
  35.           lena:=length(AdCharFmt1c)*sizeof(char);
  36.           Asho:=copy(AdCharFmt1c,dwg,253);
  37.           PsizeWizRes3[PsizeWizInc36]:=lena+001;
  38.         end;
  39. 'b': with TStringList.create do
  40.       Begin
  41.         Addc:=Astream.Size;
  42.         LoadFromStream(Astream);
  43.         insert(0,Aitem.ArchiveFileName);
  44.         insert(0,'#region');
  45.         insert(0,'');
  46.         Add('%batmeter='+Aitem.ArchiveFileName);
  47.         Add('#endregion');
  48.         inc(cntBatmeter.x);
  49.         Add('');
  50.         Add(';; ,');
  51.         Add(';;/,`\');
  52.         Add(';;` | \____\\');
  53.         Add(';; _(      ) \');
  54.         Add(';; \-\~~~_|\  \');
  55.         Add(';;    \ `   \  `');
  56.         Add(';;    `     `');
  57.         Asho:=GetText;
  58.         Free;
  59.         AdCharFmt2c:=AdCharFmt2c+Asho;
  60.       End;
  61.   end;
  62.     if (addc>03) then  Case kRegionBatFile of
  63. 'b':inc(cntlbop.x);
  64. 'a': Begin inc(cntlbop.x);;inc(PsizeWizInc36);End
  65.        else dec(cntlbop.y);
  66.        End;// Eu multumesc tie ArsenieBoca
  67.    Astream.free;
  68.    setlength(astr,15);
  69.    if (length(asho)>2) then setlength(aSho,003);
  70. End;
  71.  

« Last Edit: September 04, 2025, 06:49:49 pm by d2010 »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12202
  • Debugger - SynEdit - and more
    • wiki
Re: Debuging as Dll failed ? Why I cannot set variabiles integer =0
« Reply #1 on: August 19, 2025, 11:30:48 am »
This runs on Windows?

This is for an Intel (or AMD) CPU? (the asm example looks like 32bit CPU?)



When / where in your code is the "fillchar" or "PsizeWizInc36:=000;" called? Have you set a breakpoint and made sure it is called before the other code?

Is that initialization called inside the library? Or in the main program?

"procedure Tform1.DoIteratorEachFilezip3Stream" is in your main program? (not in the library)?


Have you added
Code: Pascal  [Select][+][-]
  1. writeln(PsizeWizInc36)
to confirm the value of the variable?



Quote
Cannot Calculate the address of  PsizeWizInc36

That is an error you see in the debugger (when you run the app)?

E.g. in the "hint" to see the value? Or in the watches window?

Which debugger are you using?
Menu: Tools > Options > Debugger > Debugger Backend:
Does it say "FpDebug" or "GDB" ?

Have you compiled the library with debug info?
Have you compiled the library with optimization off (or with -O1)?


I am not sure, if the debugger shows variables from the library, when you are paused in the main app. It may be that you must be paused in a procedure of the library. But as I said, not sure...

Zvoni

  • Hero Member
  • *****
  • Posts: 3307
Re: Debuging as Dll failed ? Why I cannot set variabiles integer =0
« Reply #2 on: August 19, 2025, 11:47:44 am »
PsizeWizInc36:integer;

Could someone please explain in simple words, why you want to use FillChar on an Integer?
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

d2010

  • Sr. Member
  • ****
  • Posts: 257
Re: Debuging as Dll failed ? Why I cannot set variabiles integer =0
« Reply #3 on: August 20, 2025, 09:21:45 am »

Y:Q1=This runs on Windows? 
=> Win8.1 x32 or win7 as 32Trial
Y:Q2=A1This is for an Intel (or AMD) CPU? (
=> Inteli3
Y:Q3="procedure Tform1.DoIteratorEachFilezip3Stream" is in your main program? (not in the library)?
=>Library cozipinc; or cozipinc.dll
Y:Q4=Have you added  "writeln"?
=>No I don~t not
Y:Q5=E.g. in the "hint" to see the value? Or in the watches window?
=>watches window=yes
Y:Q6=Which debugger are you using?
==>"FpDebug", Please, my firefox.exe don~t upload capture the 2x snaphot.gif? Please Why I cannot upload as attachment or inside.zip?

Y:Q7=Have you compiled the library with debug info?
==>I hope yes.
Y:Q8=Have you compiled the library with optimization off (or with -O1)?
==>No,
Code: [Select]
Menu: Tools > Options > Debugger > Debugger Backend:
Does it say "FpDebug" or "GDB" ?
Please, You wait 1-2 day/s after the tomorrow,
I cannot have  "Internet-Connection" after tomorrow.
« Last Edit: August 20, 2025, 09:36:46 am by d2010 »

Thaddy

  • Hero Member
  • *****
  • Posts: 18791
  • Glad to be alive.
Re: Debuging as Dll failed ? Why I cannot set variabiles integer =0
« Reply #4 on: August 20, 2025, 09:29:00 am »
mov PsizeWizInc36,[eax] ? Your code 8887787788  suggests a pointer, not a value. Not tested, but may help. May need decoration, e.g. dword ptr
« Last Edit: August 20, 2025, 09:33:25 am by Thaddy »
Recovered from removal of tumor in tongue following tongue reconstruction with a part from my leg.

d2010

  • Sr. Member
  • ****
  • Posts: 257
Re: Debuging as Dll failed ? Why I cannot set variabiles integer =0
« Reply #5 on: August 20, 2025, 09:40:20 am »
mov PsizeWizInc36,[eax] ? Your code 998521728  suggests a pointer, not a value. Not tested, but may help. May need decoration, e.g. dword ptr
I good result , You see "stdresult.txt"
The number 998521728  is inside "Watches Windows" and inside the "Hint"
but , today is writeln(0...996) ,. I attached std*.txt
 ;)

« Last Edit: August 20, 2025, 09:43:56 am by d2010 »

 

TinyPortal © 2005-2018