PDA

View Full Version : Add special entry for ExceptAddr in call stack.


Yams
10-Nov-2008, 09:54 AM
Hello, Fabio.

Sometimes in my applications I get the following log files:

EAccessViolation: Access violation at address 10CC7EC2 in module 'UniProxy.lpl'. Read of address 00000000
--------------------------------------------------------------------------
|Адрес |Библиотека |Модуль |Класс|Процедура |Строка |
--------------------------------------------------------------------------
|10CC7FE8|UniProxy.lpl|ProxyTools.pas| |CreateOneObj |2264[425]|
|7C90EAF5|ntdll.dll | | |KiUserApcDispatcher| |
|7E41F658|USER32.dll | | |CallWindowProcA | |
|10CC5F60|UniProxy.lpl|ProxyTools.pas| |CreateOneObj |1839[0] |
|10CC7D68|UniProxy.lpl|ProxyTools.pas| |CreateOneObj |2223[384]|
|10CC7BFA|UniProxy.lpl|ProxyTools.pas| |CreateOneObj |2218[379]|
|10CC5F60|UniProxy.lpl|ProxyTools.pas| |CreateOneObj |1839[0] |
|10CC9594|UniProxy.lpl|ProxyTools.pas| |CreateObjInModel |2375[2] |
|10CC9520|UniProxy.lpl|ProxyTools.pas| |CreateObjInModel |2373[0] |
|10CCB904|UniProxy.lpl|Proxy.pas | |Read |325[44] |
|10CCB580|UniProxy.lpl|Proxy.pas | |Read |281[0] |
|10CCC63A|UniProxy.lpl|Plugin.pas | |fRead |231[10] |
--------------------------------------------------------------------------


The first line is Exception.Message property and below is standart call stack log from EurekaLog.

Please note, that actual error address is 10CC7EC2 (as specified in Exception.Message property). The problem is that first line in call stack (10CC7FE8) refers to routine that calls routine that raises exception. I.e. the more "real" call stack should be "10CC7EC2, 10CC7FE8, etc". The application is rather complex and call stacks are not always as it is here. It is more often that call stack contains reference to actual line that raises exception. But in some cases call stack starts too far away from place of exception (as it is in the above example).

I suggest to add 1 special line to the beggining of the stack trace. You should pick ExceptAddr (or may be GetLastExceptionAddress?) and compare it to first line of the stack:
- If ExceptAddr matches first address in call stack then you do nothing (proceed as it is now).
- If ExceptAddr doesn't match first address in call stack then you insert it as first item to call stack.

P.S.
BTW, at the current moment I manually do the same thing by using GetSourceInfoByAddr from http://news.eurekalog.com/showthread.php?t=2117

admin
05-Dec-2008, 03:43 PM
Hi Yams,

I think you have found a bug because EurekaLog just does this.

Can you send to me the .ELF file that show your problem or (if possible,
but I understand that probably is not easy) can you create and send to
me a source demo able to reproduce it, please?

Yams
08-Dec-2008, 08:50 AM
I think you have found a bug because EurekaLog just does this.

Then if you don't mind I'll try to investigate the problem myself. I'll post results in bugreport section, ok?

Yams
08-Dec-2008, 09:38 AM
Ooops.
Looks like this is entirely my mistake. I'm sorry.

P.S. I messed up a little in my implementation of http://news.eurekalog.com/showthread.php?t=2032