Discussion:
windbg issues with Local variables
(too old to reply)
rtshiva
2008-02-16 00:12:00 UTC
Permalink
hi guys,
i've been using windbg for a while now and am still getting used to it
and its commands. Recently when debugging a driver , a WDM driver compiled
with WDK 6000 I got a strange issue of loosing context of local variables.
i.e when stepping through parameters passed to certain functions becomes
null and not all of the local variables are listed in the locals window. and
another strange thing I noted was that in one function the memory location
of some local variables showed by windbg's local window is same location
even though those variables are not even of the same type.
This is not an issue with the driver as it is working correctly and I
overcame the limitation through making temporary global variables that I
accessed using watch. is this known limitation or any of u came across this
issue ? I am using the latest version of windbg and this issue appeared only
after I started to use the latest version of windbg

rtshiva
Ivan Brugiolo [MSFT]
2008-02-16 02:25:16 UTC
Permalink
Local varialbes are a function of aggressiveness of the optimization
of the compiler, and they may be there or they may not be there.
The debugger relies on static information in the PDB, but, the information
is partially valid during execution. For example, a stack location
used for an __in parameter can be reused for a temporary value
if the compiler has inferred that the location can be reused.
This is even more true for x64 where registers are freely reused,
and, on IA64, the location of the locval variables require full
understanding of the disassembly of a function.
--
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Post by rtshiva
hi guys,
i've been using windbg for a while now and am still getting used to it
and its commands. Recently when debugging a driver , a WDM driver compiled
with WDK 6000 I got a strange issue of loosing context of local variables.
i.e when stepping through parameters passed to certain functions becomes
null and not all of the local variables are listed in the locals window.
and another strange thing I noted was that in one function the memory
location of some local variables showed by windbg's local window is same
location even though those variables are not even of the same type.
This is not an issue with the driver as it is working correctly and I
overcame the limitation through making temporary global variables that I
accessed using watch. is this known limitation or any of u came across
this issue ? I am using the latest version of windbg and this issue
appeared only after I started to use the latest version of windbg
rtshiva
rtshiva
2008-02-17 02:48:36 UTC
Permalink
Thanks for the reply Ivan, seems its time to improve windbg skills further
to negate this :)
Ivan Brugiolo [MSFT]
2008-02-18 00:12:31 UTC
Permalink
It's a problem that has to do with PDB, and lack of information
on per-instruction pointer location of `local variables`.
The PDB simply does not contain that information.
--
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Post by rtshiva
Thanks for the reply Ivan, seems its time to improve windbg skills further
to negate this :)
j***@gmail.com
2012-08-16 00:56:49 UTC
Permalink
This is happening to me also. I know the PDBs do contain the correct information as if i use visual studio, without the solution loaded, and just using visual studio like a windbg by attaching to the process and loading the PDB files from another location with the source files copied to that folder. It works fine.
I can 'step' without suddenly losing everything.
So why cant windbg do it?
This sounds like a bug.
Does anyone have any ideas what is going on here?

Loading...