Bug 558493 - Java debug Step Over acts like Step Return when stepping over native method call of subclass
Summary: Java debug Step Over acts like Step Return when stepping over native method c...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 4.14   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Debug-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-12-19 19:36 EST by Paul Scott CLA
Modified: 2023-01-18 09:22 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Scott CLA 2019-12-19 19:36:35 EST
This is perhaps a somewhat unique situation. I am debugging a J2EE application running in Tomcat on a z/Architecture platform (IBM Java 8 JVM) from Eclipse running on Windows 10 (remote debug).

The Step Over function works correctly except when I'm stepping over a method call that is a native method of a superclass. In that case, it acts like a step return, rather than a step over! It exits the current method and breaks at the next line after the outer method call. The only way I can step over the line is to set a breakpoint on the next line.

If the line being stepped over invokes a non-native method of the superclass the debugger works correctly and just steps over that line. If I override the native method in the subclass with "return super.method(...)" then the debugger works correctly and just steps over the line. But I don't want to change the subclass to do that because it means an extra method call for every superclass method.

I really don't know if this problem occurs with all native methods of a superclass, or just my unique superclass / subclass. What's unique (maybe) here is that the subclass and superclass have the same name but exist in separate packages. This was necessary because the JNI DLL I wrote for the native methods must support both the superclass native methods and the subclass native methods, but that's another long, technical story.

In any case, Step Over used to work fine in Eclipse in this situation. I've been debugging the application on and off for literally years with no issues. I only noticed this problem after I upgraded from Eclipse Photon to Eclipse IDE 2018-12. The problem also still exists in Eclipse IDE 2019-12.
Comment 1 Sarika Sinha CLA 2019-12-19 22:42:24 EST
Can you try disabling the Preferences->Java->Debug
Show method result after a step operation

And check if this helps ?
Comment 2 Paul Scott CLA 2019-12-20 00:41:31 EST
That worked! Now Step Over does indeed step over lines that call a native method of the superclass.
Comment 3 Sarika Sinha CLA 2019-12-20 00:53:54 EST
@Till,
Did you expect this to happen?
Comment 4 Eclipse Genie CLA 2022-06-26 11:00:27 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 5 w.pasman CLA 2023-01-18 09:21:30 EST
I can confirm that this bug is still there. 
Today I was debugging a program using the bytedeco OpenCV library.
At some place I call image.size() where image is a Mat and Mat.size() is native call.

If I place the eclipse debugger breakpt on that line, it 
* breaks properly there
* When I try to step over that (F6) I am immediately returned to the calling place, as if I pressed F7 instead.

It's just as described by the OP. 
I don't insert a program here because my program is way too large and because that should be the job of the OP. Besides, the description of OP seems to the point and I assume this happens with any native call

This behaviour is disturbing, especially because it looks like either you pressed a wrong key, or that the call causes an exception.

Can the prio of this issue be raised please?
Comment 6 w.pasman CLA 2023-01-18 09:22:22 EST
BTW I reproduced this on Linux 20LTS with 
Eclipse Version: 2021-09 (4.21.0)
Build id: 20210910-1417