DyanamoRIO instrumentation for JVM

62 views
Skip to first unread message

Shaurya Patel

unread,
Jun 21, 2023, 1:43:14 PM6/21/23
to DynamoRIO Users
Hi Folks, 

I am trying to run an analysis for Java applications. The aim is very simple, I want to instrument all the memory loads of an application and log the value loaded to a register for that instruction. Also, I want to log the timestamp when the instruction is executed because I will eventually merge this trace with a pagefault trace that I obtain using perf.

I used PIN to do this for native applications and I'm exploring if I can do the same for Java applications using DynamoRIO. 

Is it possible to do what I am proposing using DynamoRIO and would I have to create my own tool for this?

Also how reliable and accurate would the timestamps be? Suppose a load instruction caused a pagefault, the timestamp that DynamoRIO provides should be before the timestamp of the pagefault, is that possible?

Thanks!


Derek Bruening

unread,
Jun 23, 2023, 9:55:33 PM6/23/23
to Shaurya Patel, DynamoRIO Users
The large drcachesim/drmemtrace framework only records addresses, but there is a sample tool that records values: memval_simple.c, on the smaller provided tool list at https://dynamorio.org/API_samples.html.  You could see how drmemtrace obtains timestamps and use something similar, or some other method.

Re: tracing Java: it *should* work as Java apps have been run in the past and the test suite covers jitted code and other behavior, but for full disclosure: jitted apps are complex to support and it is possible there could be stability issues on some large Java apps (there is at least one outstanding bug in the tracker).

Re: timestamps: not sure I understand what you mean as the traced timestamps are from a separate run than the perf run I assume.

--
You received this message because you are subscribed to the Google Groups "DynamoRIO Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dynamorio-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dynamorio-users/28898b78-e20e-42b9-aa1d-091b21d08baan%40googlegroups.com.

Edgar Neubauer

unread,
Jul 25, 2023, 3:13:54 PM7/25/23
to DynamoRIO Users
Does Dr.Memory work with java? Will it produce callstacks from jvm compiled code?

Derek Bruening

unread,
Jul 25, 2023, 4:18:18 PM7/25/23
to Edgar Neubauer, DynamoRIO Users
On Tue, Jul 25, 2023 at 3:13 PM 'Edgar Neubauer' via DynamoRIO Users <dynamor...@googlegroups.com> wrote:
Does Dr.Memory work with java? Will it produce callstacks from jvm compiled code?

It would operate on the heap allocations done by the JVM itself.  Its callstack walking heuristics may or may not get all the frames right across jitted and compiled code, it is hard to say.  Certainly very little testing if any has been done as that is not a typical use case.
 
Reply all
Reply to author
Forward
0 new messages