RFR: 8334492: DiagnosticCommands (jcmd) should accept %p in output filenames and substitute PID [v5]

Sonia Zaldana Calles szaldana at openjdk.org
Mon Jul 22 20:06:33 UTC 2024


On Sun, 21 Jul 2024 10:08:38 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> Sonia, my bad if you already know this stuff but since it's fairly esoteric knowledge nowadays I'd like to help you out in advance: Thomas is proposing the usage of a X macro https://en.wikipedia.org/wiki/X_macro
>> 
>> These can be found throughout Hotspot, you can find an example definition and usage in `logTag.hpp` and `logTag.cpp`.
>
> @SoniaZaldana Note that this is very much optional.

Hi folks, thanks for the pointers! I wasn't familiar with X macros and after some time toying around with them, I'm sad to report that I am not a fan (yet!).

I implemented it and ended up breaking part of the tests. I quickly realized that debugging these is a bit harder for less experienced c++ developers (like myself). 

So, just wanted to note: 
- I cleaned up the indentation in this function as it was all wrong. 
- I didn't get rid of the repetition. Tried to but quickly realized we can't pull the DCmdArgument out of the if statements as they're different types. 

And note to self, to keep reviewing X macros because they did shorten the code a lot when I implemented them. Perhaps I'll give it another go in a different RFE.

Sorry it's not what either of you hoped for!

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/20198#discussion_r1687080108


More information about the serviceability-dev mailing list