[15] RFR(M): 8244207: Simplify usage of Compile::print_method() when debugging with gdb and enable its use with rr

Christian Hagedorn christian.hagedorn at oracle.com
Thu May 7 12:09:23 UTC 2020


Hi

Please review the following debugging enhancement:
https://bugs.openjdk.java.net/browse/JDK-8244207
http://cr.openjdk.java.net/~chagedorn/8244207/webrev.00/

This enhancement simplifies the usage for printing the ideal graph for 
visualization with the Ideal Graph Visualizer when debugging with gdb 
and enables graph printing with rr [1].

Instead of calling Compile::current()->print_method(PHASE_X, y, z) from 
gdb, one can now just call igv_print() or igv_print(phase_name) with a 
custom phase name. There are multiple options depending on where the 
graph should be printed to (file or over network/locally to an opened 
Ideal Graph Visualizer). When choosing file, the output is always 
printed to a file named custom_debug.xml. I think the flexibility to 
choose another file name is not really required since it's only used 
while debugging. These new igv_print() methods can also be called from 
gdb without setting any flags required for the usual calls to 
Compile::current()->print_method(PHASE_X, y, z) to work.

The standard Compile::current()->print_method(PHASE_X, y, z) call does 
not work while debugging a program trace with rr (and is probably also 
problematic with related replay tools). The call gets stuck somewhere. 
rr allows to alter some data at a breakpoint but as soon as execution 
continues on the replayed trace, the modifications are undone (except 
for file writes). This enhancement also addresses this such that the new 
igv_print() methods can be used with rr. However, when printing to a 
file is chosen, igv_print() will overwrite custom_debug.xml again at the 
next execution stop. To avoid that I added additional rr-specific 
igv_append() and igv_append(phase_name) methods that simply append a 
graph to the existing custom_debug.xml file without setting up a file 
header again. This allows all printed graphs to be kept in one file 
which makes it easier to navigate through them.

Thank you!

Best regards,
Christian


[1] https://rr-project.org/


More information about the hotspot-compiler-dev mailing list