如何让VS2013调用堆栈显示更多功能

时间:2016-02-24 08:57:48

标签: c++ mfc

在我的MFC程序中,我需要解析一个1.2GB的文件。在调试过程中,每次程序接近完成解析时,都会有如下异常:

  

LogDataTrans.exe中0x522C31CA(msvcr120d.dll)的第一次机会异常:0xC0000005:访问冲突写入位置0x0003FA0C。

这是调用堆栈中的最后一个函数:msvcr120d.dll!memcpy(unsigned char * dst,unsigned char * src,unsigned long count)第188行未知。但是调用堆栈中的其他函数在mfc120d和user32中定义。 dll。我已将代码从memcpy(&_lrs.body[_lrs.lenBody], buf, l);更改为

  try{
    memcpy(&_lrs.body[_lrs.lenBody], buf, l);
  }
  catch (...){
    ofstream f("memcpy.error");
    f << "memcpy.error";
  }

但是发生了同样的问题。此外,这个memcpy函数在异常发生之前已经被多次使用过了。 我无法在其他地方找到我自己的代码是错误的。所以,我想让调用堆栈显示更多的函数让我追溯到我自己的函数,而不仅仅是系统提供的函数。当前的调用堆栈是这个:

  

msvcr120d.dll!memcpy(unsigned char * dst,unsigned char * src,unsigned long count)第188行未知
      LogDataTrans.exe!AfxWinMain(struct HINSTANCE __,struct HINSTANCE __,char *,int)C ++
      mfc120d.dll!_AfxDispatchCmdMsg(CCmdTarget * pTarget,unsigned int nID,int nCode,void(void)* pfn,void * pExtra,unsigned int nSig,AFX_CMDHANDLERINFO * pHandlerInfo)第77行C ++
      mfc120d.dll!CCmdTarget :: OnCmdMsg(unsigned int nID,int nCode,void * pExtra,AFX_CMDHANDLERINFO * pHandlerInfo)373行C ++       mfc120d.dll!CDialog :: OnCmdMsg(unsigned int nID,int nCode,void * pExtra,AFX_CMDHANDLERINFO * pHandlerInfo)第85行C ++
      mfc120d.dll!CWnd :: OnCommand(unsigned int wParam,long lParam)Line 2784 C ++
      mfc120d.dll!CDialogEx :: OnCommand(unsigned int wParam,long lParam)第290行C ++
      mfc120d.dll!CWnd :: OnWndMsg(unsigned int message,unsigned int wParam,long lParam,long * pResult)Line 2108 C ++
      mfc120d.dll!CWnd :: WindowProc(unsigned int message,unsigned int wParam,long lParam)Line 2094 C ++
      mfc120d.dll!AfxCallWndProc(CWnd * pWnd,HWND__ * hWnd,unsigned int nMsg,unsigned int wParam,long lParam)第282行+ C ++       mfc120d.dll!AfxWndProc(HWND__ * hWnd,unsigned int nMsg,unsigned int wParam,long lParam)Line 435 C ++
      mfc120d.dll!AfxWndProcBase(HWND__ * hWnd,unsigned int nMsg,unsigned int wParam,long lParam)第299行C ++
      user32.dll!_InternalCallWinProc@20()未知
      user32.dll!_UserCallWinProcCheckWow@32()未知
      user32.dll!_SendMessageWorker@24()未知
      user32.dll!_SendMessageW@16()未知
      user32.dll!_xxxButtonNotifyParent@12()未知
      user32.dll!_xxxBNReleaseCapture@12()未知
      user32.dll!_ButtonWndProcWorker@24()未知
      user32.dll!_ButtonWndProcA@16()未知
      user32.dll!_InternalCallWinProc@20()未知
      user32.dll!_UserCallWinProcCheckWow@32()未知
      user32.dll!_DispatchMessageWorker@8()未知
      user32.dll!_DispatchMessageW@4()未知
      user32.dll!_IsDialogMessageW@8()未知
      user32.dll!_IsDialogMessageA@8()未知
      mfc120d.dll!CWnd :: IsDialogMessageA(tagMSG * lpMsg)第193行C ++
      mfc120d.dll!CWnd :: PreTranslateInput(tagMSG * lpMsg)Line 4590 C ++
      mfc120d.dll!CDialog :: PreTranslateMessage(tagMSG * pMsg)第80行C ++
      mfc120d.dll!CDialogEx :: PreTranslateMessage(tagMSG * pMsg)第275行C ++
      mfc120d.dll!CWnd :: WalkPreTranslateTree(HWND__ * hWndStop,tagMSG * pMsg)Line 3363 C ++
      mfc120d.dll!AfxInternalPreTranslateMessage(tagMSG * pMsg)第233行C ++
      mfc120d.dll!CWinThread :: PreTranslateMessage(tagMSG * pMsg)777行C ++
      mfc120d.dll!AfxPreTranslateMessage(tagMSG * pMsg)第252行C ++
      mfc120d.dll!AfxInternalPumpMessage()第178行C ++
      mfc120d.dll!CWinThread :: PumpMessage()第900行C ++
      mfc120d.dll!AfxPumpMessage()第190行C ++
      mfc120d.dll!CWnd :: RunModalLoop(unsigned long dwFlags)Line 4644 C ++
      mfc120d.dll!CWnd :: CreateRunDlgIndirect(const DLGTEMPLATE * lpDialogTemplate,CWnd * pParentWnd,HINSTANCE__ * hInst)第470行C ++
      mfc120d.dll!CDialog :: DoModal()第633行C ++
      LogDataTrans.exe!CLogDataTransApp :: InitInstance()第75行C ++
      [外部代码]     LogDataTrans.exe!WinMain(HINSTANCE__ * hInstance,HINSTANCE__ * hPrevInstance,char * lpCmdLine,int nCmdShow)第26行C ++

我没有定义所有这些功能。

0 个答案:

没有答案