[lldb-dev] Breakpoint matching with -n seems to have gotten too generous
Pavel Labath via lldb-dev
lldb-dev at lists.llvm.org
Thu Aug 29 23:28:10 PDT 2019
On 30/08/2019 02:33, Jim Ingham via lldb-dev wrote:
> If I have a program like:
>
> class A {
> public:
> int AMethod() { return 100; }
> };
>
> class AA {
> public:
> int AMethod() { return 200; }
> };
>
> int
> main()
> {
> A myA;
> AA myAA;
> myA.AMethod();
> myAA.AMethod();
> return 0;
> }
>
> Build and run it under lldb, and do:
>
> (lldb) b s -n A::AMethod
> Breakpoint 1: 2 locations.
> (lldb) break list
> Current breakpoints:
> 1: name = 'A::AMethod', locations = 2
> 1.1: where = many_names`A::AMethod() + 8 at many_names.cpp:3:19, address = many_names[0x0000000100000f78], unresolved, hit count = 0
> 1.2: where = many_names`AA::AMethod() + 8 at many_names.cpp:8:19, address = many_names[0x0000000100000f88], unresolved, hit count = 0
>
> I think that's wrong. The point of the fuzziness in -n is that you can leave out containing namespaces, or arguments, and we'll still match what you've given us. But IMO that should only expand the search into containing contexts. It is surprising to me that if I specify A::AMethod, I also match the one in the namespace AA. If you wanted to match .*A::AMethod, you could do that with a regular expression. But there's no easy way to not pick up extra breakpoints if you happen to have overlaps like this, so it seems like expanding -n to strstr type matches seems like a bad idea.
>
> I wondered if other folks thought this was desirable behavior.
I was surprised by this behavior too. I wouldn't have expected
AA::AMethod to match this.
pl
More information about the lldb-dev
mailing list