views:

29

answers:

2

Hi all,

I'm converting a Linux program to a Windows program using Visual Studio .NET 2003. The code was written using pthread.

I have a "First-chance exception at 0x100084c8 in project.exe: 0xC0000005: Access violation reading location 0x000001dc" error that is causing my program to crash, and all but one thread "has exited with code 0 (0x0)." The one thread (0xfe4) exited with code -1073741819 (0xc0000005). I read that if threads exited with code 0, then everything is fine. I'm guessing the one thread that did not caused the error, especially the same code 0xC0000005 showed up.

As there are groups of threads doing different tasks, I wish to track down the thread that did not exit correctly, so as to debug the program. Is there a way to identify which thread it is, like using the (0xfe4) value?

Thank you.

Regards, Rayne

+1  A: 

Go to Debug->Windows->Threads in the menu.

You can also go to Debug->Exceptions... Then open the Win32 Exceptions sub tree and click the text box next to "c0000005 Access violation" and it should break when the violation occurs.

Goz
A: 

I found it useful to also name threads to make it easier to distinguish them in the debugger: When you create new threads (using the Thread class) you can set the Name property. This name will show up when you debug in Visual Studio.

Isak Savo