Re: Access Violation Debugging in Visual C++

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

From: John A. Byerly (jbyerly_at_ess-quality_remove.com)
Date: 06/16/04

  • Next message: John A. Byerly: "Re: Access Violation Debugging in Visual C++"
    Date: Wed, 16 Jun 2004 19:18:20 GMT
    
    

    "pdxphil" <pdxphil@discussions.microsoft.com> wrote in message
    news:33C2C16C-D8A7-44D9-AB82-A573F61674D8@microsoft.com...
    > Hello,
    >
    > I am running into an unhandled exception (access violation) when debugging
    an application i've taken over at work. I've looked for table overruns,
    improper ptr handling, and those sorts of things. The crash occurs on a
    line where the value of variable defined as enum type is checked(see below
    is checked against an enum.
    >
    > typedef enum {
    > eTMOTid_UnloadCass,
    > eTMOTid_ReadCarrierID
    > } _eTMOTid;
    >
    > _eTMOTid m_eTMOTidCurrent;
    >
    > if (m_eTMOTidCurrent == eTMOTid_UnloadCass)...
    >
    > In the method that is checking, the value, m_eTMOTidCurrent shows up as
    'CXX0030 Error:
    > Expression cannot be evaluated'. I've followed the stack and can't see
    anything obvious, but
    > my debugging skills are a bit rusty. Try/catch with ellipses works, but
    i'm not sure what to
    > check once making it to the catch block - CException does not work. Any
    help would be
    > greatly appreciated.

    It sounds as if the object containing m_eTMOTidCurrent is not valid. Check
    your 'this' pointer in the variables window. Look at the pointer value
    itself. Make sure it is not NULL, or 0xcdcdcdcd, or something that looks
    suspicious. If it is not NULL, but the value looks suspicious, the object
    has probably been deleted somewhere. Of course, if it is NULL, that is a
    problem.

    If everything looks fine with the 'this' pointer, expand it and look at its
    member data. If there is garbage in many of the data items, you may have a
    partially constructed object, or one that has been overwritten.

    Hope this helps!

    JAB

    -- 
    --------------------------------------------------------
    John A. Byerly
    Engineered Software Solutions, Ltd.
    http://www.ess-quality.com
    

  • Next message: John A. Byerly: "Re: Access Violation Debugging in Visual C++"
  • Quantcast