Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function breakpoints signature is a bit strange #369

Open
davidanthoff opened this issue Feb 12, 2020 · 1 comment
Open

Function breakpoints signature is a bit strange #369

davidanthoff opened this issue Feb 12, 2020 · 1 comment

Comments

@davidanthoff
Copy link
Contributor

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?

@KristofferC
Copy link
Member

Yes, right now it breaks if the signature in the breakpoint is <: the signature of the method

return bp.sig <: meth.sig

A check could be added here

function shouldbreak(frame::Frame, pc::Int)
bps = frame.framecode.breakpoints
isassigned(bps, pc) || return false
bp = bps[pc]
bp.isactive || return false
return Base.invokelatest(bp.condition, frame)::Bool
end
to only break if the types of the arguments are also <: the signature in the breakpoint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants