How to find out what command caused an memory exception?

Hi,

I have the following question.

My application is working when I start the release exe from the inside of the VS (MFC, C++).

But when I start the exe from the windows explorer I get an unhandled Win32 exception and the JIT debugger shows me address 0x10032B4A in an assembly language window. How can I find out, what command in my C++ source code matches to this address (especially in release mode)

Thank you,

Bernd



Answer this question

How to find out what command caused an memory exception?

  • CorneVR

    Hi,

    Just compile your code in release mode and start debuginig release mode exe. Then it will stop on the line that has excepted. This works for VS2005. I am not sure about other versions, specify which one are you using.

    Max



  • ECHS BACHS

    Now I build all DLLs using the Program Database (/Zi) switch. When it crashes I chose the open instance of my programm, but I always get the message "No symbols are loaded for any call stack frame. The source code cannot be displayed."

    Then I try to manually select the Program Database I get the message "The symbol file vc80.pdb does not match the module."

    Bernd


  • vbjunkie

    My point is that event when you build in release mode you do have debug information, you cannot see values of variables, but you can see where is the crash.

    Max



  • Eng. Habeeli

    Yes, my DLL is on the lowerst stack level, and I get the current PC address. But the DLL is very large, and I have no idea, what happened, when I just see the address inside my DLL.

    Bernd


  • ION T

    What exactly do you mean by you "don't have any debug information". Do you mean that you don't have the pdb file Or just that you've compiled with optimizations

    Normally, you should still have a pdb file for optimized / retail code. The pdb has the assembly --> source mappings. If you don't have a pdb file, you can't find the source mapping for an assembly instruction. But if you do have the pdb, then you can, even if you attach jit-attach a debugger to retail code.

    You can ensure that the pdbs are loaded via the Module window (under Debug menu)

    If you have PDBs, you can use the .ln command from VS's immediate window (see http://msdn2.microsoft.com/en-us/library/ms171364.aspx) to lookup an address. eg:

    .ln 0x10032B4A



  • Ashish Chawla

    Can you at least check the call stack and see if your dll on the callstack at all

    Max



  • Argenta

    But the problem is, I don't have any debug information.

    What I need is to find out, what statement is placed at the crash address. When in debug mode you can view source code and inline assembly together, but is there any view, that shows the assembly code combined with the source code in release mode

    The exception window only tells you the logical address. Nothing more.

    Bernd


  • MrZap

    I'm using Visual Studio Standard Edition 2005.

    There must be a difference between starting the release exe from the inside of the VS and from the Windows Explorer. When I compile the release version and stard debugging, everything is working fine. But without VS it evokes the JIT telling me that there was an unhandled exception.

    Do you know, if there is a way to find out the corresponding C++ statement, when you get the address that causes the exception

    Bernd


  • AngelOfPirate

    I have tried the following: open solution, compilie in release, run without debugging, once crash occurs I choose debug, and VS instance with my solution in it

    This has brought me to the crash point in my code

    Max



  • How to find out what command caused an memory exception?