RFR: 8334164: The fix for JDK-8322811 should use _filename.is_set() rather than strcmp()
Kevin Walls
kevinw at openjdk.org
Mon Jun 17 08:56:13 UTC 2024
On Thu, 13 Jun 2024 16:55:15 GMT, Sonia Zaldana Calles <szaldana at openjdk.org> wrote:
> Hi all,
>
> This PR addresses [8334164](https://bugs.openjdk.org/browse/JDK-8334164).
>
> Testing:
> - [x] Verified specifying the literal `vm_memory_map_<pid>.txt` as the map name does not replace `<pid>`.
> - [x] Verified `<pid>` is still appropriately replaced if a file path is not specified.
>
> Thanks,
> Sonia
Yes is_set should be used to find out if a filename was given, and not strcmp. But if you provided "my_filename<pid>.txt" you might be happy that pid became the actual pid? But that expansion only happens if you gave that exact filename, so it seems like a mistake.
For users, a better pattern for optionally inserting the actual PID would be if it used %p like we do when -XX:OnError handling uses Arguments::copy_expand_pid().
There are a few dcmds that take names of files to create, so ideally all of these would support %p which lets you insert the PID.
I expect we should go ahead with this change now, and consider a further update to enable all dcmds that take filenames to replace %p.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/19706#issuecomment-2172727518
More information about the serviceability-dev
mailing list