Some local variables hidden from debugger (Win2000 Kernel debugging) 
Author Message
 Some local variables hidden from debugger (Win2000 Kernel debugging)

Hello newsgroup,

I am debugging a WDM driver and I'd like to examine the local variables of a
function. Environment: Windows 2000 on target and host computer, VC++ 6.0,
Windows 2000 DDK, WinDbg 5.1.2250.3

Unfortunately, some interesting things (local pointer to IO_STACK_LOCATION)
cannot be viewed in the "Locals" window of Windbg. It seems that the
compiler keeps the IrpStack pointer in a CPU register and therefore no
symbol exists and the pointer's target cannot be displayed by the de{*filter*}.

Dumping the memory location and crawling through the structure is not what I
would like to do. Can I force the compiler to use physical memory for all
local variables? How do I do that? I tried the compiler option /Od (disable
all optimization) but that wasn't the point.

Thanks for your help

Achim Oetringhaus



Sat, 20 Dec 2003 20:19:48 GMT  
 Some local variables hidden from debugger (Win2000 Kernel debugging)
This is an optimized build (/Ox) in which case de{*filter*}s (windbg or VC)
cannot reliably show local variables. The compiler generates nice optimized
code, but the de{*filter*} has no reliable way of knowing exacly where every
local is for optimized builds. Sometimes the compiler just fails to emit the
local entirely (you'll get "foo not found"), or sometimes it will emit the
name but with incorrect info about where it is, so the value displayed will
be wrong.

You have to look at the asm and figure out what the compiler did (the /FAsc
compiler option will emit commented asm code you can compare to the disasm).
If you are writing a driver then I assume you are comfortable with asm.

Once you figure out where the varaible really is (e.g. ebx) then in VC you
can cast it to the right type (e..g. (CFoo*)ebx) but that might not work in
windbg (I never use it so can't say for sure).

Quote:
> I am debugging a WDM driver and I'd like to examine the local variables of
a
> function. Environment: Windows 2000 on target and host computer, VC++ 6.0,
> Windows 2000 DDK, WinDbg 5.1.2250.3

> Unfortunately, some interesting things (local pointer to
IO_STACK_LOCATION)
> cannot be viewed in the "Locals" window of Windbg. It seems that the
> compiler keeps the IrpStack pointer in a CPU register and therefore no
> symbol exists and the pointer's target cannot be displayed by the
de{*filter*}.

> Dumping the memory location and crawling through the structure is not what
I
> would like to do. Can I force the compiler to use physical memory for all
> local variables? How do I do that? I tried the compiler option /Od
(disable
> all optimization) but that wasn't the point.

> Thanks for your help

> Achim Oetringhaus




Sun, 21 Dec 2003 02:12:42 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. local static variables not able to be displayed by debugger under Windows XP

2. keep the Win2000's auto-hide-enabled taskbar permanently hidden

3. keep the Win2000's auto-hide-enabled taskbar permanently hidden

4. programmatic hide of Win2000 auto-hide-enabled taskbar

5. WIN2000 KERNEL BUG ALERT!!!

6. How to convert local time to gmt using a local variable time zone per process/thread

7. kernel symbol files for debugger

8. Can't uninstall kernel debugger

9. Can't uninstall kernel debugger

10. DVD player dosn't like Kernel Debugger

11. Kernel Debugger

12. static local variables vs global variables

 

 
Powered by phpBB® Forum Software