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 the Debugger Engine, you can set a breakpoint on a function whose name contains spaces or 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 breakpoint action.)

Another trick for setting breakpoints is using tab autocompletion for symbols. If you type bp 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 patient the first time you hit Tab.)

Personally, I use the x command to print out all the matches, 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

0 comments

Discussion is closed.

Feedback usabilla icon