Re: Mysteriously changing variable
From: Oleg Starodumov (com-dot-debuginfo-at-oleg)
Date: 12/03/04
- Previous message: Peteroid: "Re: Why does reading from a std::map not considered const?"
- In reply to: Altman: "Re: Mysteriously changing variable"
- Next in thread: Altman: "Re: Mysteriously changing variable"
- Reply: Altman: "Re: Mysteriously changing variable"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 3 Dec 2004 10:35:20 +0200
> Actually com dll is the only programing I have done in C++ so I have never
> used breakpoints. But in the other languages I've used you can only use
> breakpoints in the IDE. So how do you run the dll in your IDE?
>
How to debug a DLL:
http://msdn.microsoft.com/library/en-us/vccore98/html/_core_methods_for_debugging_dlls.asp
Then, after you have reproduced the problem again,
set a data breakpoint on the variable that changes unexpectedly:
1. Set a normal breakpoint in the function that contains the variable.
Wait until this breakpoint is hit.
2. Obtain the address of the variable (e.g. by entering "&l_MyVariable"
in Watch window).
3. Open Data tab in Breakpoints window
(Edit | Breakpoints | Data)
4. Enter the address of the variable into "Enter the expression to be evaluated" field,
and enter 4 into "... the number of elements to watch ..." field.
5. Step through the function and wait until the data breakpoint is hit.
If it is hit, the debugger can stop at the line that wrote into the variable,
or on the next line after it.
Note that after the function with the local variable returns, you should deactivate
the data breakpoint, because its location on the stack will be reused
and something else can be stored there, thus triggering the breakpoint again,
which will be a "false alarm".
Also compile the DLL with /GZ compiler option.
Regards,
Oleg
- Previous message: Peteroid: "Re: Why does reading from a std::map not considered const?"
- In reply to: Altman: "Re: Mysteriously changing variable"
- Next in thread: Altman: "Re: Mysteriously changing variable"
- Reply: Altman: "Re: Mysteriously changing variable"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|