Did madExcept cause this exception?

delphi package - automated exception handling
Post Reply
lizhengdao
Posts: 1
Joined: Wed Jul 25, 2018 5:51 am

Did madExcept cause this exception?

Post by lizhengdao »

It's quite strange that the except thread is madExcept itself.
What can I do to avoid this from happening?

Code: Select all

exception number   : 1
exception class    : EAccessViolation
exception message  : Access violation at address 753DA078 in module 'msvcrt.dll'. Read of address 12AA6000.

thread $22c4:
753da078 +04a msvcrt.dll
753da006 +1ac msvcrt.dll             memmove
004a90a9 +00d MPTool.exe   madExcept CallThreadProcSafe
004a910e +032 MPTool.exe   madExcept ThreadExceptFrame
76d8343b +010 kernel32.dll           BaseThreadInitThunk
>> created by thread $198c at:
753e139c +06e msvcrt.dll             _beginthreadex
Attachments
bugreport.zip
full bug report madExcept generated
(8.7 KiB) Downloaded 302 times
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: Did madExcept cause this exception?

Post by madshi »

It's not strange at all. madExcept will be listed as part of every thread callstack. The reason for that is that madExcept has to hook itself into every thread, to be able to catch and report the exceptions properly. This is not (at all) an indication that madExcept would be causing the exception.
wpostma
Posts: 23
Joined: Fri Oct 12, 2012 4:09 pm

Re: Did madExcept cause this exception?

Post by wpostma »

What would cause Madexcepts' line 17490 to raise at the cmp ebx, esp?

Code: Select all

  function CallThreadProcSafe(threadProc, param: pointer) : dword; stdcall;
  // protect the stack, just in case the thread function is incorrect
  asm
    push ebx
    mov ebx, esp
    mov eax, [ebp+$c]
    push eax
    mov eax, [ebp+$8]
    call eax
    // if everything is alright, we should have "esp = ebp" here
    cmp ebx, esp   ; <-- access violation raises here!


madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: Did madExcept cause this exception?

Post by madshi »

Could be a thread function which has an incorrect calling convention, or an incorrect number of parameters, maybe? Or a thread function which has somehow overwritten its own stack (e.g. due to a buffer overrun on a local variable).
Post Reply