Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Debugging dyn. loaded DLLs

Posted on 1998-08-24
3
Medium Priority
?
200 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 800 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

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
I made this because I wanted to get e-mail with a attached csv file so I'd would be able to import user input into a MS Excel template, but I also wanted to register/save all inputs from each day in a file on the server. 1st - It creates a temp C…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
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.

688 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