views:

46

answers:

1

Is there a way to put a breakpoint on any function in Visual Studio, sort of like bm kernel32!LoadLib* in WinDbg?

I know one way is to break at application start, find the required DLL load address, then add offset to required function you can get via Depends, and create a breakpoint on address. But that's really slow, and switching to WinDbg and back is also pretty annoying.

Maybe there is a better way?

+3  A: 

Go to "Debug / New breakpoint / Break at function..." and paste the function name.

For APIs, this can be tricky, as the name of the function as seen by the debugger is different from its real name.
Examples:

{,,kernel32.dll}_CreateProcessW@40
{,,user32.dll}_NtUserLockWindowUpdate@4

See this blog post to find the right name: Setting a Visual Studio breakpoint on a Win32 API function in user32.dll

Samuel_xL
API functions were exactly what I needed, thank you! I only wish there was an easier way to find the decorated name...
Madman