Message-ID: <2000649712.1011.1425071673559.JavaMail.email@example.com> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_1010_296425015.1425071673559" ------=_Part_1010_296425015.1425071673559 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
This page contains some debugging hints for Jikes RVM. It is ass= umed that you are familiar with debugging techniques. If you aren't, it is = advisable to read a book about the subject.
All debugging should be done with assertion-enabled builds if possible. = You can also try using ExtremeAssertion builds.
The Jikes RVM and MMTk provide several options to print out debugging in= formation.
If you're debugging a problem in the optimizing compiler, you can also p= rint out the IR.
You can also use the options to change the behaviour in various ways (e.= g. switch off certain optimizations) if you have a suspicion about the caus= es of the problem.
Jikes has an interactive debugger that you can invoke by sending SIGQUIT= to Jikes while it's running:
pkill -SIGQUIT JikesRVM
Several classes in the code base provide static boolean fields like DEBU= G or VERBOSE which can be set to get more debugging information.
You can write custom shutdown hooks to dump gathered information when th= e VM terminates. Note that shutdown hooks won't be run if the VM is termina= ted via a signal (see RVM-555)
Do not use the ExitMonitor from the Callbacks class because it's less re= liable.
The test coverage is poor at the moment. Nevertheless, if you're very lu= cky, one of the smaller test cases will fail. See Testing the RVM for details on how to run the tests and= define your own.
There are different tools for debugging Jikes RVM:
There is a limited amount of C code used to start Jikes RVM. The rvm scr=
ipt will start Jikes RVM using GDB (the GNU debugger) if the first argument=
-gdb. Break points can be set in the C code, variables, re=
gisters can be expected in the C code.
The dynamically created Java code doesn't provide GDB with the necessary= symbol information for debugging. As some of the Java code is created in t= he boot image, it is possible to find the location of some Java methods and= to break upon them. To build with debug symbols, you'll need to set the ap= propriate property as described in Building the RVM.
Details of how to manually walk the stack in GDB can be found here
rdb is a debugger that was developed specifically for Jikes RVM= . It allows you to inspect the bootimage. If you're running Mac OS, you can= also use it to debug a running Jikes RVM.
Other tools, such as valgrind, are occasionally useful in debugging or u= nderstanding the behaviour of JikesRVM. The rvm script facilitates us= ing these tools with the '-wrap' argument.
For example, cachegrind can be invoked by
The command and arguments immediately after the -wrap argument will be i= nserted into the script on the command line that invokes the boot image run= ner. One useful variant is
To debug problems in the optimizing compiler, use a configuration whose = bootimage is compiled with the baseline compiler and which contains the AOS= (prototype-opt, BaseAdaptive*). Faster configurations (such as development= ) have the drawback of a longer bootimage compilation time which won't be a= mortized unless the problem occurs late.
It is advisable to use -X:vm:errorsFatal=3Dtrue when debugging optimizin= g compiler problems. This will prevent the optimizing compiler from reverti= ng to the baseline compiler for certain kinds of errors.
It is strongly recommended to run with advice file generation (see Experimental Guidelines). T= he produced advice files can then be used to reproduce the bug. If this ste= p is successful, the advice files should be minimized to determine the set = of methods that cause the failures. This can be done automatically (e.g. vi= a delta debugging) or by hand.
You can also switch on paranoid IR verification in IR.java. Note that th= is is not well tested at the moment because we don't run any regression tes= ts with it. Use a BaseAdaptive* configuration if you switch this on (bootim= age builds with the optimizing compiler and paranoid IR fail at the time of= this writing).
To debug a deadlock, run the VM under a time limit and send SIGQUIT (to = force a thread dump) a few seconds before killing the VM. On Linux, you can= use the timelimit program (should be available in the repositories for Deb= ian-based distributions).
The garbage collectors that are included with the Jikes RVM are generall= y stable. Therefore, if you see a problem that does not occur during the co= llection itself, it is likely not a garbage collection problem. You can exc= lude problems related to garbage collection by building with other collecto= rs. For example, you can choose a collector that doesn't move objects (e.g.= MarkSweep) or a collector that doesn't require write barriers (e.g. Immix = instead of GenImmix).