The -f
specification really limits the breakpoint search to the Compilation Unit defined by <file>
and so it ends up including all the template instantiations that that Compilation Unit contains, which if you use any std::
stuff is generally a lot, as you have discovered.
The debugger generally does know where a function was declared (it is part of the debug info) so we could add an option to treat -f as "file of declaration" not "comp unit name". Then you could say something like:
(lldb) break set -f foo.h -f foo.cpp --match-declaration-file --func-regex .*
That would be pretty straight forward to add. If you're so inclined, please file an enhancement request to this effect to http://bugreporter.apple.com.
If you follow the convention of writing your functions like:
void A::foo()
{
...
}
Then you can do a source regex on "^{". That was the primary reason for this coding convention, it made the beginnings of functions really easy to pick out.
If the template instantiations are mostly coming from std, you could find the .o file and do something like (this is on OS X):
$ nm <file-basename>.o -s __TEXT __text -j | c++filt | grep -v std
That will produce a list of the non-std functions in this .o file, and then you could add break set -n
to the beginning of each line and source that in.