bytecode execution event
QwertyYtPL QwertyYtPL
qwertyytpl1612 at gmail.com
Mon May 15 15:19:03 UTC 2023
Awesome, thanks!
pon., 15 maj 2023 o 16:40 Volker Simonis <volker.simonis at gmail.com>
napisał(a):
> If you really want to see the execution of every single bytecode, you
> can run in interpreted mode (`-Xint`) and use the
> `-XX:+TraceBytecodes` command line option. There's also
> `-XX:StopInterpreterAt=<int>`, but that's really only useful if
> running in a native debugger like gdb. Both these options are only
> available in debug builds (both fast- and slowdebug).
>
> For what you plan to do it's probably better to write a Java bytecode
> agent which allows you too hook into arbitrary Java methods [1]. There
> exists a lot of information about bytecode instrumentation on the net,
> but some of the tools you're definitely want to look at are ASM [2],
> ByteBuddy [3] and Byteman [4].
>
> Regards,
> Volker
>
> [1]
> https://docs.oracle.com/javase/8/docs/api/java/lang/instrument/package-summary.html
> [2] https://asm.ow2.io/
> [3] https://bytebuddy.net/#/
> [4] https://byteman.jboss.org/
>
> On Mon, May 15, 2023 at 4:00 PM QwertyYtPL QwertyYtPL
> <qwertyytpl1612 at gmail.com> wrote:
> >
> > I wanted to modify OpenJDK's source code just for myself to add little
> event that will be called just before one bytecode will be called, in this
> event i want to be able to check what bytecode it is and like all
> attributes (i guess that i need Node or something). I want to do that to
> have control over java application ran, for example if I'm running some
> virus written in java I will be able to stop everything at some specific
> instruction that for example causes some file to download or command to
> execute. It will be a gate for creating some security system that for
> example asks the user if he wants a java program to download something or
> run something (on runtime). I think that I will just do this event that
> will call functions in my dll or something, so I won't be coping with the
> jdk build system. I can even do lua scripting for that, so my dll will be
> able to read lua script and let it handle events. I'm asking it here
> because firstly I have problems with finding a place for hooking an event
> and secondly I want to ask if it even makes sense.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/hotspot-runtime-dev/attachments/20230515/3ba1697d/attachment-0001.htm>
More information about the hotspot-runtime-dev
mailing list