Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Put breakpoint on named function

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?

like image 551
Coder Avatar asked Oct 19 '10 12:10

Coder


1 Answers

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

like image 163
KeatsPeeks Avatar answered Oct 07 '22 21:10

KeatsPeeks