Discussion:
Help with debugging a plugin DLL
(too old to reply)
Si
2007-06-26 08:20:06 UTC
Permalink
Hi,

I'm programming a plugin DLL, and I don't have the source code to the
host application.
Unfortunately, my plugin causes the host application to randomly
crash.

I am trying to find the problem with no success.
I am using try-catch in my code, and also SetUnhandledExceptionFilter,
but when the host application exists, it doesn't get to my code.

Apparently the "crash" is not in my code, but my code causesit.
When the host application exits, it doesn't show any of the Windows
error\crash messages, and no dump is created if I use "Dr Watson".

Any idea how can I find the problem ?
How can I get the stack or any other info ?

Thanks for any help.
David Ching
2007-06-26 09:54:52 UTC
Permalink
Post by Si
Hi,
I'm programming a plugin DLL, and I don't have the source code to the
host application.
Unfortunately, my plugin causes the host application to randomly
crash.
I am trying to find the problem with no success.
I am using try-catch in my code, and also SetUnhandledExceptionFilter,
but when the host application exists, it doesn't get to my code.
Apparently the "crash" is not in my code, but my code causesit.
When the host application exits, it doesn't show any of the Windows
error\crash messages, and no dump is created if I use "Dr Watson".
Any idea how can I find the problem ?
How can I get the stack or any other info ?
Thanks for any help.
Si, use the "Attach to Process" menu item in the IDE, to start debugging the
process which has loaded your plug-in DLL. When the process crashes, it
should then break in the debugger. If not, go into the Exceptions debug
window and make sure the relevant exception is set to break in the debugger,
and not to pass to parent.

I've debugged crashes in IE that were caused by my plug-in, and this method
works well.

-- David (Visual C++ MVP)
Si
2007-06-26 11:51:52 UTC
Permalink
Hi David,
Thanks for your answer.

Is there any way to do a similar thing without using Visual Studio, as
it happens only on a customer machine ?
Can I use WinDbg, or anything similar to cause an application to break
also in an "handled exception" ?
I prefer something which can be done in code, so I won't need
additional installations, but I will happily try anything.

10x for any help.
Oleg Starodumov
2007-06-26 19:28:37 UTC
Permalink
Post by Si
Is there any way to do a similar thing without using Visual Studio, as
it happens only on a customer machine ?
Can I use WinDbg, or anything similar to cause an application to break
also in an "handled exception" ?
I prefer something which can be done in code, so I won't need
additional installations, but I will happily try anything.
Since the application is exiting without any reports, it is usually unlikely
that an in-process handler will be able to catch it. The debugger should be
able to help, though.

Yes, you can use WinDbg. After attaching to the process, in situations like
yours (silent exit) it is also recommended to set a breakpoint at NtTerminateProcess
function (to catch the moment when the app is exiting). In WinDbg use this command:

bp ntdll!NtTerminateProcess
--
Oleg
[VC++ MVP http://www.debuginfo.com/]
Si
2007-07-01 18:07:19 UTC
Permalink
Hi Oleg,
Thanks for your answer.

I've managed to use WinDbg, and apparently to catch the error, but I
don't succeed in "sync" WinDbg with the PDB.

This is what I get in WinDbg:
====================
(b4.c40): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=00000001 ebx=7c80a017 ecx=0b6aff5c edx=7c90eb94 esi=00000000
edi=01853880
eip=01807ee2 esp=0b6aff78 ebp=0b6affb4 iopl=0 nv up ei pl nz
na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000
efl=00010202
<Unloaded_MyPlugin.dll>+0x7ee2:
01807ee2 ?? ???
====================

I can't "continue", so I guess this exception is not handled.
But WinDbg doesn't recognize my PDB, although I've used the "Symbol
File Path...".
I've checked MSDN for "SymInitialize" and "SymSetSearchPath", but I
couldn't understand why WinDbg doesn't find my PDB.

As far as I understand the problem is in offset 0x7ee2, is there any
way to get directly from the PDB in which method this offset ?

Thanks for your help,
Si.

Loading...