Re: Debugging issue to watch variable values

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




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
.



Relevant Pages

  • Re: Debugging issue to watch variable values
    ... Since I think debugger is relying on PDB file, now I am thinking why there ... location (whether variable on stack or in register) be decided. ... wrong variable value during debugging? ...
    (microsoft.public.vc.language)
  • Re: [RFC][GIT PULL][PATCH 0/10 -tip] cpu_debug patches 20090613
    ... developer who is porting/developing the kernel or drivers. ... Which is perfectly fine to do low level debugging. ... Support Temperature sensor for AMD 11H ... And what is triggering the printout of a particular register? ...
    (Linux-Kernel)
  • Re: CURRENT freezes on Laitude D520
    ... really exists for the purposes of supporting components which are not sufficiently locked to allow the stack to run MPSAFE, rather than as a means of disabling direct dispatch and preemption, which speak to different types of problems. ... INVARIANTS, DDB, KDB, and BREAK_TO_DEBUGGER to debug deadlocks. ... In RELENG_6, PREEMPTION is in GENERIC and hence enabled by default, and it can be disabled by removing it from your kernel configuration. ... However, this is also just a debugging step to see if that quiesces the problem, and not a fix for the actual bug. ...
    (freebsd-current)
  • Debugging an asp.net application error specific to certain installations??
    ... SIMPLEST way to debug to an approximate but understandable level. ... send the PDB. ... I was thinking initiating such ideas are good though, for future debugging. ... "An unhandled exception was generated during the execution of the current ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Iteration in lisp
    ... FUNCTION CALLS, HAZARDOUS TO YOUR STACK SPACE, USE AT YOUR OWN RISK. ... - The concise code typical of Scheme is self-explanatory. ... debugging errant programs was a routine problem that could be ... How do Scheme programmers debug their code?? ...
    (comp.lang.lisp)