Hi. I'm using Codelite v15.0.0 with MinGW, writing C and C++ code in two projects in one workspace.
In my code, I have a conditional compilation value called pm_Hxx_On.
I also have a variable defined as a Microsoft CRITICAL_SECTION.
These variables have nothing whatsoever to do with each other.
During initialization, I declare and initialize Thrd_A_CriticalSection. There are times in the program where it runs perfectly fine.
If pm_Hxx_On is defined, all is well and the program runs fine, beginning to end.
But if I change the declaration to undefine, I have problems. At first, the critical section code runs just fine. Then there comes a point where the Thrd_A_CriticalSection unintentionally and mysteriously gets set to NULL. The program dies the next time it tries to execute the critical section.
A rough overview of the flow of control looks like this, although each chunk of code is in a different procedure.
Code: Select all
// #define pm_Hxx_On
#undef pm_Hxx_On
...
// declaration
CRITICAL_SECTION Thrd_A_CriticalSection;
...
// initialization
rc = gbs_Initialize_Critical_Section (&Thrd_A_CriticalSection, "Thrd_A_CriticalSection");
...
// Used here.
EnterCriticalSection (&Thrd_A_CriticalSection);
n = thrd_A_Thrd_A_Index;
LeaveCriticalSection (&Thrd_A_CriticalSection);
...
// And is deleted here.
gbs_Delete_Critical_Section (&Thrd_A_CriticalSection, "Thrd_A_CriticalSection");
This is all in C.
I have tried setting breakpoints at all places where Thrd_A_CriticalSection is set or used and looking at its values. That didn't tell me anything.
So the reason I'm writing is to ask, is there is a way in CodeLite to set up a trap when a value in memory is changed? I would set it to Thrd_A_CriticalSection's address and run the program, and when the value changes, I could check the call stack to find out where the write took place.
Also, how do I find out the address of a variable?
Thanks!
Colleen