tags:

views:

28

answers:

2

Got a big MFC C++ project. Our VS version is 2008. It loads a regular dll (for some optional functionality) and calls exported functions from it. When debug through the MFC app and get to the point where we call the exported function you can't step into the dll function. Is there a way to get debugging inside the dll functions. Even if I've got the dll project included in the C++ solution, it doesn't seem to "see" the dll code.

Edit: We've got a number of extension dlls and debugging into them works just fine. This is a straight dll, no mfc, /clr option set so we can call into some managed code. The class that consumes this dll, loads it, then uses GetProcAddress to find pointers to the exported functions. Here are examples.

typedef void (*FP_OnEditOptions) ();

to prototype the function. then

m_fpOnEditOptions = (FP_OnEditOptions) GetProcAddress(hInstance, "Direct_Edit_Options");

to get the proc pointer, then

static void OnEditOptions()
{(*m_fpOnEditOptions)();}

to call it.

When debugging, get to the call to it, hit F11, and it calls it, but doesn't step in. Yes, the dll has debug option, and when the module is loaded, the symbols are loaded from the appropriate pdb file.

Thx,

Andy

A: 

Debug + Windows + Modules. Locate the DLL in the list and right-click it. Symbol Load Information tells you where the debugger looked for the .pdb file. Make sure you get it there.

After update: it is very likely that with /clr enabled that you are actually running code that was compiled to IL and just-in-time compiled. Just like managed code. You'll need to switch the debugger to Mixed mode debugging. Project + Properties, Debugging, Debugger Type = Mixed.

Hans Passant
Hi, yes checked that and the symbols are being loaded. See edits for more info. Perhaps I haven't been specific enough. Thx for the info; I didn't know how to check that.
Andruski
I dunno, you indeed should have mentioned /clr before. Is this managed code you're stepping? Just set a breakpoint on the DLL function you want to debug.
Hans Passant
Also mention if the entrypoint of the program is managed.
Hans Passant
No, and no, I think. The exported function looks like so. extern "C" __declspec(dllexport) void Direct_Edit_Options() {...}The function isn't managed code (at least I don't think so), but calls some managed functions like so. FooTools::PaymentAPI::RunOptionsScreen();I've tried setting a breakpoint in the dll function, but it does not stop there, and as I've said, if I try and step into this function, it just runs it without stepping in. Thx for looking at this.
Andruski
The C++/CLI compiler is powerful, it can translate almost any native C++ code to IL. No idea how you'd get mixed-mode debugging enabled in such an environment. Try Project + Properties, Debugging, Debugger Type = Mixed. Or Native Only
Hans Passant
Wow. You da man. Setting it to mixed mode debugging worked. Thanks, that'll make the debugging process so so much easier. :)
Andruski
Okay, you're motoring. Close your thread by clicking the checkmark next to my post.
Hans Passant
A: 

Look under Tools->Options->Debugging->General

There are a couple of options which may help - I'm not sure which one exactly you'll need. The 2 obvious ones are:

  • Disable "Just My Code"
  • Disable "Step over properties and operators"

You might also try putting a breakpoint inside the function that's being jumped over. That should force the debugger to stop at that code.

Basiclife