How do I set a breakpoint on a function whose name contains spaces or other special characters?

Raymond Chen

If you use one of the command line debuggers based on theDebugger Engine,you can set a breakpoint on a function whose name contains spacesor other special characters by quoting the symbol name.The trick here is that you do not quote the entire string;you quote only the symbol name.

0:001> bu @!"CSimpleArray<wchar_t *>::CSimpleArray<wchar_t *>"

Note that the quotation marks do not go around the @!part.They go only around the symbol.(Otherwise, the debugger thinks you are setting a breakpointaction.)

Another trick for setting breakpoints is using tab autocompletionfor symbols. If you typebp contoso!*Widget* and then hit Tab repeatedly,you will cycle through all the matches.(It takes a few seconds to build the list of matches, so be patientthe first time you hit Tab.)

Personally, I use the x command to print out all thematches, and then cherry-pick the one I want.

0:001> x contoso!*Widget*
00af114c contoso!CreateWidget
009fe863 contoso!DestroyWidget
00a2e161 contoso!MakeWidgetReadOnly
00a93168 ...
0:001> bp 00a2e161     set breakpoint on MakeWidgetReadOnly