[fpc-devel] assert, and the frame/addr for the exception.
    Martin 
    lazarus at mfriebe.de
       
    Sat May  7 01:18:04 CEST 2011
    
    
  
I was looking at http://bugs.freepascal.org/view.php?id=19113
And also http://bugs.freepascal.org/view.php?id=12528
Looking at the assembler code of assert (without utrace), it seems that 
the "assert" statement, pushes ebp (the current frame) on the argument list.
   assert(false, 'xxx');
004286A8 55                       push   %ebp             // TheAddr
004286A9 b92a000000               mov    $0x2a,%ecx     // LineNo
004286AE ba00455600               mov    $0x564500,%edx     // FN
004286B3 b80c455600               mov    $0x56450c,%eax     //  Msg
004286B8 e8834afeff               call   0x40d140 <fpc_assert>
but then
   Procedure AssertErrorHandler (Const Msg,FN : 
ShortString;LineNo:longint; TheAddr : pointer);
   Var  S : String;
   begin
     If Msg='' then     S:=SAssertionFailed  else     S:=Msg;
     Raise EAssertionFailed.Createfmt(SAssertError,[S,Fn,LineNo]) at 
Pointer(theAddr);
   end;
Seems to hand that over as the address pointer to the code?
So the exception will have a frame of 0x0, and a code pointer to some 
none executable part?
Maybe I am wrong, but something does seem to be incorrect?
Martin
    
    
More information about the fpc-devel
mailing list