Python API: control the prompt on breakpoint


I’m playing with the Python API, and I’m trying right now to set a breakpoint that I could intercept in Python before giving back the control to the user.
However if I leave the breakpoint without “Autocontinue”, it’ll show me the usual informations about the breakpoint, including the source context. Is it possible to control this on a given breakpoint?

I also couldn’t find how to control whether to continue or not from the python callback, I’m not sure if it is possible?

There isn’t currently a way for a breakpoint to tell the debugger whether it should be printed or not. A while back I added the ability to have a class of breakpoints that you can hide, and protect from deletion. You do this by making a “hidden” breakpoint name with --allow-list, --allow-delete & --allow-disable set to false. It would make perfect sense to also add --show-stop-info to this set, so that you could tell the system to hid these breakpoint hits altogether.

If you want a breakpoint callback to make a “per hit” decision about whether to print stop info, that would take some more work. If we didn’t worry about backwards compatibility (we do) then we could just return a mask with stop/don’t stop & print/don’t print. But it would be trickier to do that and maintain backwards compatibility.

We’d also need some rule for what to do when you stop but only for hidden breakpoints. I don’t want people in the situation where they have to guess why the debugger stopped.

1 Like