[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
Mon May 11 08:21:48 UTC 2020
Thank you Vladimir and Tobias for reviewing it again!
Best regards,
Christian
On 11.05.20 08:04, Tobias Hartmann wrote:
> +1
>
> Best regards,
> Tobias
>
> On 08.05.20 20:33, Vladimir Kozlov wrote:
>> Good.
>>
>> Thanks,
>> Vladimir
>>
>> On 5/8/20 1:45 AM, Christian Hagedorn wrote:
>>> Thank you Vladimir and Tobias for your reviews!
>>>
>>> On 08.05.20 08:24, Tobias Hartmann wrote:
>>>> looks good to me too but please use (jio_)snprintf instead of unsafe sprintf.
>>>
>>> Thinking of which, we could probably directly use the phase_name parameter and call print_method()
>>> without allocating a char array and using jio_snprintf. However, it might be a good idea to change
>>> sprintf into jio_snprintf in Compile::print_method (where I got this code from). There it makes
>>> sense to use an additional char array to concatenate two strings.
>>>
>>> I included those changes together with the typo fix in a new webrev:
>>> http://cr.openjdk.java.net/~chagedorn/8244207/webrev.01/
>>>
>>> Best regards,
>>> Christian
>>>
>>>> On 07.05.20 20:38, Vladimir Kozlov wrote:
>>>>> Looks good.
>>>>>
>>>>> Thanks,
>>>>> Vladimir
>>>>>
>>>>> On 5/7/20 5:09 AM, Christian Hagedorn wrote:
>>>>>> 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