RFR: 7439: Introduced IConstantPoolExtension for Constant Pools [v5]
Michael Südkamp
duke at openjdk.java.net
Mon Nov 22 20:18:11 UTC 2021
On Sun, 21 Nov 2021 21:41:34 GMT, Jean-Philippe Bempel <jpbempel at openjdk.org> wrote:
>>> My test is focusing on event Types that referencing constants.
>>
>> Yeah, that's more or less what I expected. Maybe I'm unable to find my constant of interest in the mass of other classes. Could you provide a breakpoint condition for the breakpoint condition shown below which would stop at a class "fr.jpbempel.HelloWorld"?
>>
>> 
>
> Hey, @docwarems
>
> I have created a custom event:
>
>
> package com.bempel.events;
>
> import jdk.jfr.Event;
> import jdk.jfr.Label;
> import jdk.jfr.Name;
>
> @Name("com.bempel.events.MyEvent")
> @Label("MyEvent")
> public class MyEvent extends Event {
> @Label("message")
> public String message;
> }
>
>
> I have used like this:
>
> MyEvent myEvent = new MyEvent();
> myEvent.message = "showVetList " + uuid;
> myEvent.commit();
>
>
> I have recording with this event in it:
>
> <img width="979" alt="Screenshot 2021-11-21 at 22 31 13" src="https://user-images.githubusercontent.com/4610701/142779645-585707c9-b345-4171-9a5a-d40c014d835c.png">
>
> You can look at constant pools :
>
> in `java.lang.Class`
> <img width="562" alt="Screenshot 2021-11-21 at 22 32 25" src="https://user-images.githubusercontent.com/4610701/142779684-e2e78175-1529-43d9-8dbd-a5c2550f57cb.png">
>
> but also in `jdk.Types.Symbol`:
> <img width="570" alt="Screenshot 2021-11-21 at 22 32 58" src="https://user-images.githubusercontent.com/4610701/142779819-83333f9a-3fde-48fd-ac11-38f4427054f9.png">
>
>
> in debugging ConstantPoolExtensionTest:
> <img width="1424" alt="Screenshot 2021-11-21 at 22 34 38" src="https://user-images.githubusercontent.com/4610701/142779795-38f03d70-06fb-4659-aa8c-045bac354bc4.png">
>
> But it's a little bit complex because:
> a class constant is not having directly the name of the class but reference another symbol constant for that
> see:
> https://github.com/openjdk/jmc/blob/master/core/org.openjdk.jmc.flightrecorder/src/main/java/org/openjdk/jmc/flightrecorder/internal/parser/v1/StructTypes.java#L277-L287
>
> That's why it may have more sense to look for the symbol constant instead of directly the class constant.
Hello @jpbempel, the breakpoint condition was the breakthrough - I just wasn't able to catch the desired constant before. Even with the simplest HelloWork console program I ended up with a JFR file where I wasn't able to step through all constants in a reasonable time and find my desired constant.
Next I should be able to take my deobfuscator remapping code and build a true extension. I'll come back then. Regarding the PR review, I wonder if you want to wait for my further work, or if you prefer to merge.
-------------
PR: https://git.openjdk.java.net/jmc/pull/333
More information about the jmc-dev
mailing list