Why does DebugView not show debugging messages when Visual Studio does
Asked Answered
M

2

6

I am developing a Browser Helper Object running inside Internet Explorer. I am writing debugging messages with ATLTRACE("..."); These appear fine when Visual Studio is attached to the iexplore.exe process, but this is slow for a quick test. DebugView captures nothing from my BHO.

Why does DebugView not show BHO debug messages? Is it something to do with Internet Explorer running at low integrity level?

Mandell answered 14/3, 2009 at 14:39 Comment(0)
A
11

Assuming that you're running IE on Vista or later (which it sounds like since you're talking about integrity levels), you can set the integrity level of DebugView to a lower integrity so any application can send messages to it:

icacls dbgview.exe /setintegritylevel low

And if you don't like the idea of permanently setting dbgview to low integrity (it might make saving logs and whatnot a bit of a pain, as they will only go into the low-integrity store) you can run a particular instance of dbgview at low integrity using Sysinternals' psexec tool:

psexec -l dbgview

Finally, if all you're worried about is the amount of time that it takes to load up the VS debugger to attach to the process, you can use a command line debugger (like ntsd.exe or cdb.exe). Ntsd.exe comes with Windows, but a newer version comes with the "Debugging Tools for Windows" package, which also includes the very similar cdb.exe.

Alchemize answered 14/3, 2009 at 15:19 Comment(5)
This sounds odd, do you have any more details on why this would work? Tracing uses OutputDebugString, not messaging.Mangrum
My recollection is that OutputDebugString uses a shared memory section with a mutex and events to pass the data around. I assume (possibly incorrectly) that opening a shared section or signaling events from a low integrity process to a higher integrity process is blocked.Alchemize
Gave psexec a go - works great. Vaguely recollect similar issues in the past I'd forgotten how I solved. Running DbgView at low does the job, but rather annoying! Time-wise, its Visual Studio loading IE symbols that's taking the time. I could probably speed it up a bit.Mandell
If you don't need the symbols, you can disable automatic symbol loading, and then just load them lazily as you need them, if you need them.Lukelukens
If you use the icacls method and have DbgView.exe pinned to the Windows 7 taskbar, you'll get an annoying Security Warning every time you launch it. Another reason to favour the psexec method (or wish that DbgView was updated to handle capturing low-IL messages properly by itself).Calves
M
1

For your quick tests, is Visual Studio still running? If so, that might cause this problem.

Mangrum answered 14/3, 2009 at 15:36 Comment(2)
I follow your line of thinking - Visual Studio is running, but not debugging.Mandell
Just to confirm: just running Visual Studio DOES intercept the messages and stops them from being visible in DebugView. It is NOT enough to just not run a debug session in it. As a workaround, it seems that if you start DebugView before visual studio, it still shows all the messages.Oodles

© 2022 - 2024 — McMap. All rights reserved.