Re: Debugging issue to watch variable values
- From: Norbert Unterberg <nunterberg@xxxxxxxxxxxxxxxxx>
- Date: Thu, 25 Sep 2008 22:19:11 +0200
George schrieb:
Thanks Norbert,
You're welcome, but do you ever follow any advice? Did you try to debug the debug version of your service?
Since I think debugger is relying on PDB file, now I am thinking why there is mismatch during debugging even if I supply the same PDB file generated for the exactly the same release binary code.
No that is rubbish. The PDB file is created as the same time as the executable, and they do match.
1.
I think PDB is generated at compile/link time, correct?
Yes.
I listed my confusions in 2 and 3, but I do not know which one is correct. Any comments?
2.
If yes to 1, then during compile/link time, whether variable will be put on stack or in register is still not decided, only during runtime will the location (whether variable on stack or in register) be decided. -- So that
the generated PDB is not matching the exact situation (e.g. PDB may think some variable on stack, but actually it is in register), which cause the wrong variable value during debugging?
That is rubbish. The compiler either generates code to put the variable on the stack or code to put it in a register. Or it might even remove the variable completely if its value is never referenced or it is not needed. IF the variable is in a register it might only be there for a very short sequence of code, so the debugger has little chance to display the correct value.
That is why you use the debug version in the debugger.
3.
If yes to 1, then during compile/link time, whether variable will be put on stack or in register is still be decided, but PDB will completely ignore such information in register. -- So that the generated PDB is not matching the exact situation (e.g. PDB may think some variable on stack, but actually it is in register), which cause the wrong variable value during debugging?
I don't know and don't care. The problem is that the optimizer rearranges the code, so the source code lines and variable no longer match the generated code. What do you expect a debugger to show you?
Norbert
.
- Follow-Ups:
- Re: Debugging issue to watch variable values
- From: George
- Re: Debugging issue to watch variable values
- References:
- Debugging issue to watch variable values
- From: George
- Re: Debugging issue to watch variable values
- From: Norbert Unterberg
- Re: Debugging issue to watch variable values
- From: George
- Debugging issue to watch variable values
- Prev by Date: Re: typelib issue -- GetRecordInfoFromGuids
- Next by Date: WAB (Windows Address Book)
- Previous by thread: Re: Debugging issue to watch variable values
- Next by thread: Re: Debugging issue to watch variable values
- Index(es):
Relevant Pages
|