Re: Problem in finding source code line number from ExceptionAddress

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance




I have created an class for exception handling, it is derived from
CException abstract class. This exception handler is capable of
catching all asynchromous exceptions, so no no need of using dirty
catch(...). It contains an overloaded function GetErrorMessage() which
returns the exact exception type and exception-address.

I tried to use the compiler generated .MAP file to find the exact
source line number from exception-address. But I could't find any
formula to do so. I tried to use following formula, but it seems to
work only in case of address found when application crashes :
<crash_addr> - <Preferred_load_address> - 1000h


The formula is correct (assuming that the module was not relocated,
otherwise you would have to also compensate for the difference between
the real and preferred load addresses, and also assuming that the exception
has occurred in the given module).

Could you please provide the sample data for the situation when
the formula does not work? (Exception address, preferred load address,
real load address of the module, the relevant contents of .MAP file
(list of sections, snippet of function list, snippet of line number list)).

Also take a look at minidumps. It is a modern post-mortem debugging technique,
much more efficient than .MAP files:
http://www.codeproject.com/debug/postmortemdebug_standalone1.asp

Regards,
Oleg
[VC++ MVP http://www.debuginfo.com/]





.



Relevant Pages

  • Re: Thread crashing on return instruction...
    ... Thanks for replying Bruce! ... just check the checkbox "Generate map file"! ... > exception, but I have not done this with eVC. ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: Practical error/exception handling...
    ... catch the exception, display its message, and continue on as though ... Also, given that code, the try-finally block should go inside the ... If you have a catch-all exception handler, ... the map file on the Linker tab of the project-options dialog. ...
    (alt.comp.lang.borland-delphi)
  • Re: Thread crashing on return instruction...
    ... It is possible to track that exception to the line that caused the ... look for the addresses in the map file that are around the PC ... Do have an opinion on the effectiveness of Microsoft Windows Mobile and ... "Jean-Francois Goulet" wrote in message ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: Catch(...)
    ... error handling in an instance where there really should be error ... use it to find an unhandled exception that I already know where it is. ... I subtract the base address from the exception's address to yield an offset. ... can scan a map file for the line nearest the offset to pinpoint the error. ...
    (microsoft.public.vc.language)
  • Re: Catch(...)
    ... Let me start by explaining I started this to debug a crash on a users ... use it to find an unhandled exception that I already know where it is. ... generated the MAP file for MY.DLL and I do not see where any of the ...
    (microsoft.public.vc.language)