STR:
$ cat -n Foo.java
1 public class Foo {
2 public static void main(String[] args) {
3 var x = add(2, 3);
4 var y = 37;
5 var z = 42;
6 }
7
8 private static int add(int x, int y) {
9 return x + y;
10 }
11 }
12
Perform the following jdb commands:
stop at Foo:9
run Foo
trace method exit
cont
untrace
next
It's expected to stop at the start of `add`, then continue until its end and then step over back to line 3 in `main`.
That's how it works with OpenJDK 23:
$ jdb Foo
Initializing jdb ...
> stop at Foo:9
Deferring breakpoint Foo:9.
It will be set after the class is loaded.
> run Foo
run Foo
Set uncaught java.lang.Throwable
Set deferred uncaught java.lang.Throwable
>
VM Started: Set deferred breakpoint Foo:9
Breakpoint hit: "thread=main", Foo.add(), line=9 bci=0
9 return x + y;
main[1] trace method exit
main[1] cont
>
Method exited: return value = 5, "thread=main", Foo.add(), line=9 bci=3
9 return x + y;
main[1] untrace
main[1] next
>
Step completed: "thread=main", Foo.main(), line=3 bci=5
3 var x = add(2, 3);
OpenJDK 24 & 25 don't stop after `next` instruction.
$ jdb Foo
Initializing jdb ...
> stop at Foo:9
Deferring breakpoint Foo:9.
It will be set after the class is loaded.
> run Foo
run Foo
Set uncaught java.lang.Throwable
Set deferred uncaught java.lang.Throwable
>
VM Started: Set deferred breakpoint Foo:9
Breakpoint hit: "thread=main", Foo.add(), line=9 bci=0
9 return x + y;
main[1] trace method exit
main[1] cont
>
Method exited: return value = 5, "thread=main", Foo.add(), line=9 bci=3
9 return x + y;
main[1] untrace
main[1] next
>
The application exited
$ cat -n Foo.java
1 public class Foo {
2 public static void main(String[] args) {
3 var x = add(2, 3);
4 var y = 37;
5 var z = 42;
6 }
7
8 private static int add(int x, int y) {
9 return x + y;
10 }
11 }
12
Perform the following jdb commands:
stop at Foo:9
run Foo
trace method exit
cont
untrace
next
It's expected to stop at the start of `add`, then continue until its end and then step over back to line 3 in `main`.
That's how it works with OpenJDK 23:
$ jdb Foo
Initializing jdb ...
> stop at Foo:9
Deferring breakpoint Foo:9.
It will be set after the class is loaded.
> run Foo
run Foo
Set uncaught java.lang.Throwable
Set deferred uncaught java.lang.Throwable
>
VM Started: Set deferred breakpoint Foo:9
Breakpoint hit: "thread=main", Foo.add(), line=9 bci=0
9 return x + y;
main[1] trace method exit
main[1] cont
>
Method exited: return value = 5, "thread=main", Foo.add(), line=9 bci=3
9 return x + y;
main[1] untrace
main[1] next
>
Step completed: "thread=main", Foo.main(), line=3 bci=5
3 var x = add(2, 3);
OpenJDK 24 & 25 don't stop after `next` instruction.
$ jdb Foo
Initializing jdb ...
> stop at Foo:9
Deferring breakpoint Foo:9.
It will be set after the class is loaded.
> run Foo
run Foo
Set uncaught java.lang.Throwable
Set deferred uncaught java.lang.Throwable
>
VM Started: Set deferred breakpoint Foo:9
Breakpoint hit: "thread=main", Foo.add(), line=9 bci=0
9 return x + y;
main[1] trace method exit
main[1] cont
>
Method exited: return value = 5, "thread=main", Foo.add(), line=9 bci=3
9 return x + y;
main[1] untrace
main[1] next
>
The application exited
- caused by
-
JDK-8340698 JVMTI FRAME_POP event is sometimes missed if NotifyFramePop is called as a method is returning
-
- Resolved
-