Skip to content

Commit 4f6937a

Browse files
committed
[GR-31304] Disable debugger stepping on asynchronous safepoint actions.
PullRequest: graalpython/2365
2 parents 66a1db5 + 41048ab commit 4f6937a

File tree

1 file changed

+8
-0
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime

1 file changed

+8
-0
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime/AsyncHandler.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
import com.oracle.truffle.api.TruffleLanguage;
7575
import com.oracle.truffle.api.TruffleLanguage.Env;
7676
import com.oracle.truffle.api.TruffleLogger;
77+
import com.oracle.truffle.api.debug.Debugger;
7778
import com.oracle.truffle.api.frame.VirtualFrame;
7879
import com.oracle.truffle.api.nodes.RootNode;
7980

@@ -120,6 +121,7 @@ protected boolean proceed() {
120121

121122
@Override
122123
public final void execute(PythonContext context) {
124+
Debugger debugger = null;
123125
do {
124126
Object callable = callable();
125127
if (callable != null) {
@@ -131,6 +133,10 @@ public final void execute(PythonContext context) {
131133
// Avoid pointless stack walks in random places
132134
PArguments.setException(args, PException.NO_EXCEPTION);
133135

136+
if (debugger == null) {
137+
debugger = Debugger.find(context.getEnv());
138+
}
139+
debugger.disableStepping();
134140
try {
135141
GenericInvokeNode.getUncached().execute(context.getAsyncHandler().callTarget, args);
136142
} catch (RuntimeException e) {
@@ -140,6 +146,8 @@ public final void execute(PythonContext context) {
140146
// Just print a Python-like stack trace; CPython does the same (see
141147
// 'weakrefobject.c: handle_callback')
142148
ExceptionUtils.printPythonLikeStackTrace(e);
149+
} finally {
150+
debugger.restoreStepping();
143151
}
144152
}
145153
} while (proceed());

0 commit comments

Comments
 (0)