Solved

Debugging dyn. loaded DLLs

Posted on 1998-08-24
3
192 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
Comment Utility
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
Comment Utility
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
Comment Utility
Hello nietod,
thank you very much for your fast response. It was exactly, what I needed.
Grade A.
Regards
  Mirko
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
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 technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now