Solved

Debugging dyn. loaded DLLs

Posted on 1998-08-24
3
194 Views
Last Modified: 2013-11-18
Hi,

I have a problem using the MSVC 5.0:

I wrote an application that uses a statically linked DLL. This DLL itself can dynamically load so calld plugin-dlls.
No the problem: how can I debug such plugins? The debugger always says: Breakpoint cannot be set...

Regards
  Mirko
0
Comment
Question by:Mirko
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 200 total points
ID: 1171101
Use the in-line assembler to put an int3 at the start of the DLL's entrypoint procedure (DllMain()

Then the debugger will be entered when the DLL is loaded and you will be able to set break-points at that time.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1171102
For example,

BOOL WINAPI DllMain(HINSTANCE DLLHnd,                 // >> DLL module.                                //
               ULONG     Rsn,                    // Reason for calling function.                  //
               LPVOID    Rsv)                    // Reserved.                                     //
{
   switch (Rsn)
   {
   case DLL_PROCESS_ATTACH:
     _asm  int 3;
    break;
   case DLL_PROCESS_DETACH:
      break;
   case DLL_THREAD_ATTACH:
      break;
   case DLL_THREAD_DETACH:
      break;
   }
   return true;
}

0
 

Author Comment

by:Mirko
ID: 1171103
Hello nietod,
thank you very much for your fast response. It was exactly, what I needed.
Grade A.
Regards
  Mirko
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question