gpt4 book ai didi

c++ - 第一次异常发生在 ... : Access violation reading location . .. 使用 Visual Studio 2010 进行调试时

转载 作者:太空狗 更新时间:2023-10-29 23:18:04 38 4
gpt4 key购买 nike

我非常努力地从遗留代码访问违规中捕获继续获取:

First-chance exception at 0x57e77e1c in YouTubeLocal.exe: 0xC0000005: Access violation reading location 0x0000000c.

我的堆栈看起来像这样:

    Qt5Guid.dll!57e77e1c()  
[Frames below may be incorrect and/or missing, no symbols loaded for Qt5Guid.dll]
Qt5Guid.dll!57e75604()
Qt5Guid.dll!57ed520b()
Qt5Guid.dll!57dcf18b()
> msvcr100d.dll!_unlock(int locknum=0x00000004) Line 375 C
msvcr100d.dll!_heap_alloc_dbg_impl(unsigned int nSize=0x00000040, int nBlockUse=0x00000001, const char * szFileName=0x00000000, int nLine=0x00000000, int * errno_tmp=0x0015cb70) Line 507 + 0x7 bytes C++
msvcr100d.dll!_heap_alloc_dbg_impl(unsigned int nSize=0x00000040, int nBlockUse=0x00000001, const char * szFileName=0x00000000, int nLine=0x00000000, int * errno_tmp=0x0015cb70) Line 504 + 0xc bytes C++
msvcr100d.dll!_nh_malloc_dbg_impl(unsigned int nSize=0x00000040, int nhFlag=0x00000000, int nBlockUse=0x00000001, const char * szFileName=0x00000000, int nLine=0x00000000, int * errno_tmp=0x0015cb70) Line 239 + 0x19 bytes C++
msvcr100d.dll!_nh_malloc_dbg(unsigned int nSize=0x00000002, int nhFlag=0x0015cbdc, int nBlockUse=0x0015cbc8, const char * szFileName=0x0015cbb0, int nLine=0x0015cbc8) Line 302 + 0x1d bytes C++
Qt5Cored.dll!533b0628()
Qt5Cored.dll!53388046()
Qt5Cored.dll!5335f56b()
Qt5Cored.dll!535e74c4()
Qt5Cored.dll!536f7198()
Qt5Widgetsd.dll!53aa4aea()
kernel32.dll!778bc3d4()
msvcr100d.dll!_unlock(int locknum=0x00000004) Line 375 C
msvcr100d.dll!_free_dbg(void * pUserData=0x53a4b300, int nBlockUse=0x019757a0) Line 1270 + 0x7 bytes C++
msvcr100d.dll!_free_dbg(void * pUserData=0x53a4b300, int nBlockUse=0x019757a0) Line 1267 + 0xc bytes C++
01b4bd40()
kernel32.dll!778bc3d4()
msvcr100d.dll!_free_base(void * pBlock=0x0015d060) Line 50 + 0x13 bytes C
018a4a84()
kernel32.dll!778bc3d4()
msvcr100d.dll!_free_base(void * pBlock=0x57c49736) Line 50 + 0x13 bytes C
0015d140()
feeefeee()

调试器在此文件 (mlock.c) 中停止

/***
* _unlock - Release multi-thread lock
*
*Purpose:
* Note that it is legal for a thread to aquire _EXIT_LOCK1
* multiple times.
*
*Entry:
* locknum = number of the lock to release
*
*Exit:
*
*Exceptions:
*
*******************************************************************************/

void __cdecl _unlock (
int locknum
)
{
/*
* leave the critical section.
*/
LeaveCriticalSection( _locktable[locknum].lock );
}

我找不到发生访问冲突的行。如何捕获导致异常的行?

更新:
这是我的解决方案: Microsoft Application Verifier

最佳答案

尝试添加一些宏,在释放内存后立即将指针设置为 NULL。在使用此类指针之前,还可以尝试添加一些断言或类似内容。有了它,您应该能够很快找到错误。

关于c++ - 第一次异常发生在 ... : Access violation reading location . .. 使用 Visual Studio 2010 进行调试时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15050300/

38 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com