How to debug a dll using visual studio?

Leonardo 96 Reputation points
2022-08-15T04:16:48.84+00:00

How i could debug a dll using visual studio? I have the DLL source, pdb, etc.

I tried these options:

231131-image.png

It launches the exe but doesn't inject the DLL, by default this exe didn't load the DLL, im manually injecting it.

Isnt possible to visual studio attach the DLL? whats that option for then?

Developer technologies | Visual Studio | Debugging
Developer technologies | C++
Developer technologies | C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
0 comments No comments
{count} votes

Answer accepted by question author
  1. RLWA32 51,361 Reputation points
    2022-08-15T08:05:48.863+00:00

    The Visual Studio debugger can attach to a process.

    Once a DLL is loaded into the process being debugged the debugger should be able to debug the loaded DLL assuming that its source code is available. Otherwise, you would have to use the Disassembly window.

    Exactly how are you "manually injecting" your DLL into the test.exe process? Maybe the process exits too quickly. One thing you can try is to use some code in the DLL to give you time to act. For example, the DLL could use a call to MessageBox() after it has been "injected". At that time you could do what you need to do before you dismiss the modal dialog. Or put some kind of a delay in test.exe.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.