Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2011-05

assert, and the frame/addr for the exception.

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Martin

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

Reply by email