Debugging DllMain()

Hi,
How can we debug a dllmain() function in a dll??

Thanks
Ashish

Hello,

If you have Softice, put an “_asm int 3” instruction
as a first statement in your Dllmain function. Make
sure to run i3here on softice command. This will take
you in softice window whenever the DllMain gets
called.

OR compile the DLL in debug mode. Load your DLL in
softice using Symbol loader and put breakpoint on
DllMain function.

Hope this helps.

-Prasad

— Ashish_Goyal wrote:
> Hi,
> How can we debug a dllmain() function in a dll??
>
> Thanks
> Ashish
>

=====
Prasad S. Dabak
Director of Engineering, Windows NT/2000 Division
Cybermedia Software Private Limited
http://www.cybermedia.co.in
Co-author of the book “Undocumented Windows NT”
ISBN 0764545698

__________________________________________________
Do You Yahoo!?
Get Yahoo! Mail – Free email you can access from anywhere!
http://mail.yahoo.com/

Or start your app in Windbg & set a breakpoint on the dllmain function
with the line:
bp mydll!DllMain

When the DLL gets loaded the symbol will be resolved to an address and a
breakpoint placed on the address.

(Defered breakpoints cannot be set via the source file in windbg yet)

Another way that is more work is to turn on break into the debugger on
module loads (sxe ld) and then go until you see your dll load. Then set
the breakpoint on the now loaded dll.

-----Original Message-----
From: Prasad Dabak [mailto:xxxxx@yahoo.com]
Sent: Friday, July 14, 2000 12:21 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Debugging DllMain()

Hello,

If you have Softice, put an “_asm int 3” instruction
as a first statement in your Dllmain function. Make
sure to run i3here on softice command. This will take
you in softice window whenever the DllMain gets
called.

OR compile the DLL in debug mode. Load your DLL in
softice using Symbol loader and put breakpoint on
DllMain function.

Hope this helps.

-Prasad

— Ashish_Goyal wrote:
> Hi,
> How can we debug a dllmain() function in a dll??
>
> Thanks
> Ashish
>

=====
Prasad S. Dabak
Director of Engineering, Windows NT/2000 Division
Cybermedia Software Private Limited
http://www.cybermedia.co.in
Co-author of the book “Undocumented Windows NT”
ISBN 0764545698

__________________________________________________
Do You Yahoo!?
Get Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/


You are currently subscribed to ntdev as: xxxxx@microsoft.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)

Thanks for the reply but I was wondering why debuggers do not use facilities
provided by OS such as LOAD_DLL_DEBUG_INFO event to break. Using this we can
but a conditional breakpoint by breaking only when the required dll is
loaded.

Thanks
Ashish

-----Original Message-----
From: Nathan Nesbit [mailto:xxxxx@Exchange.Microsoft.com]
Sent: Saturday, July 15, 2000 1:38 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Debugging DllMain()

Or start your app in Windbg & set a breakpoint on the dllmain function with
the line:
bp mydll!DllMain

When the DLL gets loaded the symbol will be resolved to an address and a
breakpoint placed on the address.

(Defered breakpoints cannot be set via the source file in windbg yet)

Another way that is more work is to turn on break into the debugger on
module loads (sxe ld) and then go until you see your dll load. Then set the
breakpoint on the now loaded dll.

-----Original Message-----
From: Prasad Dabak [mailto:xxxxx@yahoo.com mailto:xxxxx]
Sent: Friday, July 14, 2000 12:21 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Debugging DllMain()

Hello,

If you have Softice, put an “_asm int 3” instruction
as a first statement in your Dllmain function. Make
sure to run i3here on softice command. This will take
you in softice window whenever the DllMain gets
called.

OR compile the DLL in debug mode. Load your DLL in
softice using Symbol loader and put breakpoint on
DllMain function.

Hope this helps.

-Prasad

— Ashish_Goyal wrote:
> Hi,
> How can we debug a dllmain() function in a dll??
>
> Thanks
> Ashish
>

=====
Prasad S. Dabak
Director of Engineering, Windows NT/2000 Division
Cybermedia Software Private Limited
http://www.cybermedia.co.in http:
Co-author of the book “Undocumented Windows NT”
ISBN 0764545698

__________________________________________________
Do You Yahoo!?
Get Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/ http:</http:>


You are currently subscribed to ntdev as: xxxxx@microsoft.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)</http:></mailto:xxxxx>

Debugging DllMain()Write
__asm int 3;
there.
The debugger will stop on a breakpoint.
BTW - the good thing is to avoid doing anything complex in DllMain and write
an explicit initialization function instead.

Max

----- Original Message -----
From: Ashish_Goyal
To: NT Developers Interest List
Sent: Friday, July 14, 2000 10:45 PM
Subject: [ntdev] Debugging DllMain()

Hi,
How can we debug a dllmain() function in a dll??
Thanks
Ashish