JuliaInterpreter.jl icon indicating copy to clipboard operation
JuliaInterpreter.jl copied to clipboard

Function breakpoints signature is a bit strange

Open davidanthoff opened this issue 5 years ago • 1 comments

It seems that the type signatures for function breakpoints work like this (I might be wrong): use the types to figure out which method would handle those particular types, and then set a breakpoint on that method. Now this breakpoint will even break if the same method is called with quite a different set of arguments. For example, say we have a function foo(a). It will capture calls with any type for a, so a function breakpoint with type signature String will now also break when this function is called with say an Int.

Wouldn't it be more natural if these type signature breakpoints worked essentially like dispatch, i.e. a function breakpoint on foo with a type signature of Type{String} would only break if foo is called with a String?

davidanthoff avatar Feb 12 '20 04:02 davidanthoff

Yes, right now it breaks if the signature in the breakpoint is <: the signature of the method https://github.com/JuliaDebug/JuliaInterpreter.jl/blob/f4316aeb338b7cc666ec6bc7351a428ca82194e5/src/breakpoints.jl#L90

A check could be added here https://github.com/JuliaDebug/JuliaInterpreter.jl/blob/f4316aeb338b7cc666ec6bc7351a428ca82194e5/src/breakpoints.jl#L169-L175 to only break if the types of the arguments are also <: the signature in the breakpoint.

KristofferC avatar Feb 12 '20 07:02 KristofferC