Solved

Debugging dyn. loaded DLLs

Posted on 1998-08-24
3
196 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
Before we dive into the marketing strategies involved with creating an effective homepage, it’s crucial that EE members know what a homepage is. In essence, a homepage is the introductory, or default page, of a website that typically highlights the …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

751 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