VS 2005 Code in debugger going to incorrect routine
- From: Edward Diener <eddielee_no_spam_here@xxxxxxxxxxxxxx>
- Date: Mon, 10 Apr 2006 17:51:29 -0400
I have a mixed-mode assembly. A ref class has a private pointer to a native C++ class, which is a sub-class of the ref class. This allows my native C++ class to access functionality in my ref class once it is passed in its constructor the 'this' pointer of my ref class, which it stores in a gcroot type variable in its own native class.
My ref class implements the System::ComponentModel::ISupportInitialize interface. During the BeginInit() I dynamically create the native C++ class and during the EndInit() I attempt to call a function of that class. Tracing the code in the debugger, when the call to that function is made, the code goes to an entirely different function in the native C++ class.
Although this could be a memory problem I can not see where I am doing anything to either corrupt the stack or overwrite program memory. OTOH it seems poor to assume a compiler error when calculating the address of the C++ native class's object's member function to call.
I am trying to approach this problem so that I can somehow find out what is going wrong without having to selectively eliminate functionality in my ref class/native C++ class to the point where the problem is resolved and I can perhaps discover what is causing it.
Is there a good way to see why the address being called is wrong ? I can see the address in the disassembly of the call when it is being made. How can I relate this at run-time to the actual address of my member function within its object which should be called. I am merely trying to understand why the code is going to a completely different area of program memory wheh the call is being made.
Any help working toward a resolution to this problem would be most appreciated. Needless to say if the compiler is actually generating incorrect code in my situation it would be a grievous compiler error but I want to be absolutely certain it is not something I am doing in C++ ..NET programming which is causing it first.
Finally let me add that my code is still in Managed C++ and not yet C++/CLI and that I am debugging design time behavior of a GUI component I have written. I am having the debugger of my GUI comjponent call another invocation of the VS IDE passing it a solution which has a project to allow my component to be tested.
.
- Follow-Ups:
- Re: VS 2005 Code in debugger going to incorrect routine
- From: Oleg Starodumov
- Re: VS 2005 Code in debugger going to incorrect routine
- Prev by Date: Re: Why is debugging is super slow on 1 particular project?
- Next by Date: Re: Why is debugging is super slow on 1 particular project?
- Previous by thread: Re: Writing to the Debug Window
- Next by thread: Re: VS 2005 Code in debugger going to incorrect routine
- Index(es):