https://kotlinlang.org logo
#random
Title
# random
e

elect

02/11/2023, 10:07 AM
is there a way in Kotlin and Idea to programmatically have the execution stops (like a breakpoint) when in debug mode?
l

LeoColman

02/11/2023, 6:12 PM
If you click on the breakpoint I believe you can write a code condition for when to break it. Is it what you're looking for?
e

elect

02/12/2023, 4:57 AM
I know that, but I wonder about that logic directly in the test source
l

LeoColman

02/13/2023, 12:10 AM
You want to persist the breakpoint logic in the project itself? The good old
Copy code
foo()
bar()
debugDoNothing()
baz()
might be a good indicator to "place your breakpoint here", and you could add your code to it. As it's a test source, I don't think the extra branch will be a big performance issue
k

Klitos Kyriacou

02/13/2023, 12:03 PM
Do you mean like how you can do it by calling the C++ WinApi
DebugBreak()
or the .NET Framework's
System.Diagnostics.Debugger.Break()
? I don't think there's any such facility.
👍 1
3 Views