× General discussions, feature requests for CodeTyphon Project and discussions that don't fit in any of the other specific CodeTyphon forum categories.

Question Question about window of debugger

  • superc
  • superc's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
More
11 months 4 days ago - 11 months 4 days ago #13998 by superc
Question about window of debugger was created by superc
Hello,

my version of CT is Typhon 6.9 r61812 FPC 3.3.1 r42912 Platform : x86_64-win64-win32/win64

with this code:
       if not mdb.Active then
        mdb.Active:= true;

      TMemDataset(mdb).Append;
      TMemDataset(mdb).FieldByName('batch').AsVariant:= batch;
      TMemDataset(mdb).FieldByName('codVal').AsVariant:= va;
      TMemDataset(mdb).FieldByName('codTop').AsVariant:= vb;
      TMemDataset(mdb).Post;
      OutcodArt:= tempArt;

      Result := True; 

works fine but when build I receive a warning :
Call to subroutine "operator :=(const source:Variant):AnsiString;" marked as inline is not inlined

If modify code as:
      TMemDataset(mdb).FieldByName('batch').AsString:= batch;
      TMemDataset(mdb).FieldByName('codVal').AsString:= va;
      TMemDataset(mdb).FieldByName('codTop').AsString:= vb;

When debug a window similar to the one in the photo opens




In both case the program run correctly, but
in previous versions of CodeTyphon I didn't have a similar behavior, because now yes?
Attachments:
Last edit: 11 months 4 days ago by superc.

Please Log in or Create an account to join the conversation.

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Away
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
More
11 months 4 days ago - 11 months 4 days ago #13999 by Sternas Stefanos
Replied by Sternas Stefanos on topic Question about window of debugger
It's one of compiler mysterious things :)

Try and LAB CT 7.00 has many compiler fixes and better debugger code

PilotLogic Architect and Core Programmer
Last edit: 11 months 4 days ago by Sternas Stefanos.

Please Log in or Create an account to join the conversation.

  • superc
  • superc's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
More
11 months 4 days ago #14000 by superc
Replied by superc on topic Question about window of debugger
Ok Stefanos,

I thought it was a silent exception,
so using strings in this way is fine....

Thanks you very much

Please Log in or Create an account to join the conversation.

More
11 months 4 days ago - 11 months 4 days ago #14001 by Peter Heckert
Replied by Peter Heckert on topic Question about window of debugger
Please look again to the message window. It should say "Note", not "Warning".

This should not give a "warning" but an informational "Note". It says the compiler decided not to inline a routine that was marked as "inline" in sourcecode.
Instead inlining the routine is called as subroutine. This is harmless.

Under some circumstances the assembly window pops up. This has (probably) nothing to do with inlining or not inlining. It happens while singlestepping.
It seems to me, this happens when RTL routines are hit, that are compiled without debug information.
This is my observation, I do not know if this is the final truth.

The assembly window pops up also in lazarus, when a compiler version > 3.0.4 is used. Possibly the debug information in newer compilers is different and GDB or Lazarus doesnt fully understand it.
This is, what I think about it, not what I know.

Addendum:
Possibly this happens when a RTL-routine is inlined, that has no debug information and we step over it?
This is just an unproven quick hypothetic idea, I hopefully can try to test it. But first I happily install LAB 7.0.
Last edit: 11 months 4 days ago by Peter Heckert.

Please Log in or Create an account to join the conversation.

  • superc
  • superc's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
More
11 months 4 days ago #14004 by superc
Replied by superc on topic Question about window of debugger
Thanks for the reply,

what is meant for "inline"?

Thank you in advance

Please Log in or Create an account to join the conversation.

More
11 months 3 days ago #14005 by Peter Heckert
Replied by Peter Heckert on topic Question about window of debugger
You cited this message:

"Call to subroutine "operator :=(const source:Variant):AnsiString;" marked as inline is not inlined"

This means somewhere in the fpc runtime library there is an operator ":=" and this has the attribute "inline", this means, the compiler should not call the code of this operator, but copy the code to the location where the operator is used.

This is a method to speedup the code. If the code of a routine is copied this is faster than to call it.
Probably -in this case- the compiler did not copy the code of "operator :=(const source:Variant):AnsiString;" but instead compiled a procedure call.
The reason for this is probably, because code with variants is too slow and too large and so inlining the code would not have any advantage.
We dont know why, let us hope the compiler knows! :-)

In any case, if a "inline" procedure is not compiled inline, this is not an error and not a warning. Then the procedure will be called as subroutine.
It is just a note. It can be ignored and is only of interest for highly speed optimized code or compiler writers.
The following user(s) said Thank You: superc

Please Log in or Create an account to join the conversation.

  • superc
  • superc's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
More
11 months 3 days ago #14006 by superc
Replied by superc on topic Question about window of debugger
Interesting response;

you're a experienced pascal-programmer of old school :laugh:

Thank you very much for the reply

Please Log in or Create an account to join the conversation.

More
11 months 3 days ago - 11 months 3 days ago #14007 by Peter Heckert
Replied by Peter Heckert on topic Question about window of debugger
@Sternas

I currently use Typhon 7.0 r62062 FPC 3.3.1 r43202 Platform : x86_64-win64-win32/win64
But these are not new things, it was the same in previous versions.
And -so far I know- the same happens in Lazarus, when a compiler > 3.0.4 is used

So far I found, the assembly window appears while single stepping over a RTL procedure call that has overloads.
procedure TMyThread.Execute;
var
  newStatus : string;
begin
  fStatusText := 'TMyThread Starting ...';
  Sleep(10);                                             //Here Assembly Window does NOT appear. Sleep() is in the RTL and has no Overloads
  Synchronize(@Showstatus);                //Here the Window appears. Synchronize is in the RTL and has Overloads
  fStatusText := 'TMyThread Running ...';
  while (not Terminated) and (true {any condition required}) do begin

    //here goes the code of the main thread loop
    newStatus:='TMyThread Time: ' + FormatDateTime('YYYY-MM-DD HH:NN:SS',Now);            //Assembly window appears for the Operator "+". This operator is probably in the RTL and has probably overloads.
    
    if NewStatus <> fStatusText then begin                          //Window appears for the operator "<>" which probably overloads in the RTL
      fStatusText := newStatus;
      Synchronize(@Showstatus);                                        //Window appears for Synchronize()
    end;
  end;

@superc
Thankyou!
My last professional experience was with TP7 and lateron with ANSI C. But programming never was my main job.
Nowadays I am retired and try to have some fun with learning FPC and Delphi (Community version)
Last edit: 11 months 3 days ago by Peter Heckert.

Please Log in or Create an account to join the conversation.