windbg extension : dbgeng!ExOutput64 issue

I am trying to print the following from my old style windbg extension dll
(written on the lines of simple extension sample provided with windbg) to
analyze crash dumps from both 32 and 64 bit worlds. As recommended,
KDEXT_64BIT is enabled for my extension dll.

dprintf(“Value 1: %p Value 2: %p”, Addr1, Addr2);

Addr1 is UINT_PTR type whereas Addr2 is a pointer to my local struct.

This works fine on x86_64 host & target.

On 32 bit (host and target), it prints correct data for Value 1, but for
Value 2, it prints garbage (it looks like the value of &Addr1 instead of
printing Addr2). If I interchange Addr1 and Addr2 in the dprintf statement
above, it prints correct value for Addr2 and now garbage for Addr1.

I’ve investigated things like sign-extension, forced typecasting to a larger
datatype and others but couldn’t get dprintf to print my 32 bit pointers
correctly on 32 bit. I did try %x instead of %p for both Addr1 and Addr2
and got them to print correctly on 32bits, however, %x isn’t sufficient for
64bits.

Using Windbg to debug my extension dll, it seems that the dprintf defines to
dbgeng!ExOutput64 for both platforms (pretty normal, as this API should be
able to handle both 32 and 64 bit pointers.

I installed latest versions of the debugger to get new versions of
dbgeng.dll without luck. However, with the last attempt (6.7.0005.0), I
couldn’t even get symbols to dbgeng.dll.

0:002> .reload dbgeng.dll
SYMSRV:
c:\websymbols\dbgeng.pdb\3BFC2F48C89B444C9CA549DF151B5CD61\dbgeng.pdb not
found
SYMSRV:
http://msdl.microsoft.com/download/symbols/dbgeng.pdb/3BFC2F48C89B444C9CA549DF151B5CD61/dbgeng.pdbnot
found
DBGHELP: D:\Program Files\Debugging Tools for Windows\dbgeng.pdb - file not
found
DBGHELP: dbgeng.pdb - file not found
*** ERROR: Symbol file could not be found. Defaulted to export symbols for
D:\Program Files\Debugging Tools for Windows\dbgeng.dll -
DBGHELP: dbgeng - export symbols

Is there something I am missing out?

For WinDbg’s printf-like evaluator, %p always takes a 64-bit argument, even if you are running DbgEng on a 32-bit host. Change addr1/addr2 to be ULONG64 and it should work as expected.


Ken Johnson (Skywing)
Windows SDK MVP
http://www.nynaeve.net
“Venu Joshi” wrote in message news:xxxxx@windbg…
I am trying to print the following from my old style windbg extension dll (written on the lines of simple extension sample provided with windbg) to analyze crash dumps from both 32 and 64 bit worlds. As recommended, KDEXT_64BIT is enabled for my extension dll.

> dprintf(“Value 1: %p Value 2: %p”, Addr1, Addr2);

Addr1 is UINT_PTR type whereas Addr2 is a pointer to my local struct.

This works fine on x86_64 host & target.

On 32 bit (host and target), it prints correct data for Value 1, but for Value 2, it prints garbage (it looks like the value of &Addr1 instead of printing Addr2). If I interchange Addr1 and Addr2 in the dprintf statement above, it prints correct value for Addr2 and now garbage for Addr1.

I’ve investigated things like sign-extension, forced typecasting to a larger datatype and others but couldn’t get dprintf to print my 32 bit pointers correctly on 32 bit. I did try %x instead of %p for both Addr1 and Addr2 and got them to print correctly on 32bits, however, %x isn’t sufficient for 64bits.

Using Windbg to debug my extension dll, it seems that the dprintf defines to dbgeng!ExOutput64 for both platforms (pretty normal, as this API should be able to handle both 32 and 64 bit pointers.

I installed latest versions of the debugger to get new versions of dbgeng.dll without luck. However, with the last attempt (6.7.0005.0), I couldn’t even get symbols to dbgeng.dll.

0:002> .reload dbgeng.dll
SYMSRV: c:\websymbols\dbgeng.pdb\3BFC2F48C89B444C9CA549DF151B5CD61\dbgeng.pdb not found
SYMSRV: http://msdl.microsoft.com/download/symbols/dbgeng.pdb/3BFC2F48C89B444C9CA549DF151B5CD61/dbgeng.pdb not found
DBGHELP: D:\Program Files\Debugging Tools for Windows\dbgeng.pdb - file not found
DBGHELP: dbgeng.pdb - file not found
*** ERROR: Symbol file could not be found. Defaulted to export symbols for D:\Program Files\Debugging Tools for Windows\dbgeng.dll -
DBGHELP: dbgeng - export symbols

Is there something I am missing out?