Re: Single stepping bytecodes inside eclipse

2018-04-04 Thread Jochen Theodorou

On 04.04.2018 20:07, Ioi Lam wrote:

Hi,

I am trying to trace into the method handle linking code. I have a 
program like this:


     // HelloHM.java:8    mh.invokeExact("yo!");
     23:    aload_3;
     24:    ldc    #9; //    String "yo!";
     26:    invokevirtual    #10; //    Method 
java/lang/invoke/MethodHandle.invokeExact:"(Ljava/lang/String;)V";


I want to be able to set a break point at bytecode 26, do a single step, 
and then automatically land into the first bytecode of


java.lang.invoke.MethodHandleNatives.linkMethod

Well, I can't even figure out a way to display bytecodes inside eclipse, 
or single step a single bytecode.


single step bytecode isn't a feature I did ever hear of. But you can use 
the asm bytecode outline plugin for eclipse to see the bytecode and you 
can set a breakpoint in Java code, which then shows up in the bytecode 
as well



Also, I tried setting a breakpoint at MethodHandleNatives.linkMethodbut 
eclipse simply ignores that. (I can set normal break points in my test 
program's Java source code view).


at least in the past you could configure what trace elements are 
overstepped for the single step debugging.



So am I out of luck? Do I need to fall back to println() or jdb?


println will not give you single stepping for bytecode

bye Jochen
___
mlvm-dev mailing list
mlvm-dev@openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev


Single stepping bytecodes inside eclipse

2018-04-04 Thread Ioi Lam

Hi,

I am trying to trace into the method handle linking code. I have a 
program like this:


    // HelloHM.java:8    mh.invokeExact("yo!");
    23:    aload_3;
    24:    ldc    #9; //    String "yo!";
    26:    invokevirtual    #10; //    Method 
java/lang/invoke/MethodHandle.invokeExact:"(Ljava/lang/String;)V";


I want to be able to set a break point at bytecode 26, do a single step, 
and then automatically land into the first bytecode of


java.lang.invoke.MethodHandleNatives.linkMethod

Well, I can't even figure out a way to display bytecodes inside eclipse, 
or single step a single bytecode.


Also, I tried setting a breakpoint at MethodHandleNatives.linkMethodbut 
eclipse simply ignores that. (I can set normal break points in my test 
program's Java source code view).


So am I out of luck? Do I need to fall back to println() or jdb?

jdb is slightly better -- it doesn't allow single stepping bytecodes, or 
break at a specific bytecode. I can do this



main[1] stop at HelloMH:8
main[1] cont
Breakpoint hit: "thread=main", HelloMH.main(), line=8 bci=23
8    mh.invokeExact("yo!");

main[1] step
>
Step completed: "thread=main", 
jdk.internal.misc.SharedSecrets.setJavaLangInvokeAccess(), line=99 bci=1


main[1] where
  [1] jdk.internal.misc.SharedSecrets.setJavaLangInvokeAccess 
(SharedSecrets.java:99)
  [2] java.lang.invoke.MethodHandleImpl. 
(MethodHandleImpl.java:1,778)

  [3] java.lang.invoke.Invokers.checkCustomized (Invokers.java:571)
  [4] java.lang.invoke.LambdaForm$MH.1359044626.invokeExact_MT (null)
  [5] HelloMH.main (HelloMH.java:8)

But jdb's idea of "step" completely ignores the MH linking code inside 
MethodHandleNatives.linkMethod. So I have to resort to manually setting 
a break point at MethodHandleNatives.linkMethod.



Thanks
- Ioi


___
mlvm-dev mailing list
mlvm-dev@openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev