Despite its importance for many software engineering tasks, dynamic program analysis is only insufficiently supported on the Java platform. Existing Java Virtual Machines (JVMs) as well as Android's Dalvik Virtual Machine (DVM) lack dedicated mechanisms for expressing arbitrary dynamic program analysis tasks at a high abstraction level, for ensuring complete code coverage of the analysis, and for isolating analysis tasks from the observed program to prevent interference. For example, the JVM Tool Interface requires analysis tasks to be written in low-level native code, and some virtual machines (e.g., DVM) do not support it. As a consequence, dynamic program analysis tools are often implemented using low-level mechanisms, resulting in error-prone code that is difficult to maintain, and support only a particular virtual machine. Moreover, many analysis tools produce unsound profiles (due to interference of the analysis with the observed program) or incomplete profiles (due to limited code coverage).
We present a novel dynamic program analysis framework that offers high-level abstractions for comprehensive, multi-platform analysis for the JVM and DVM. Our framework ensures complete bytecode coverage and isolates the execution of the analysis code from the observed program. The domain-specific aspect language DiSL is used to specify the events of interest for an analysis. The events captured during program execution are transmitted to a server, where the user-defined analysis code processes the events. Different event-ordering semantics are supported, avoiding synchronization for analyses that do not require global event ordering across all threads. In addition to events specified by DiSL code, our framework also generates lifecycle events and inter-process communication events. The latter are particularly important for the analysis of embedded Android applications, as they typically involve multiple processes. Several state-of-the-ar