Re: Add Instrumentation to the LibreOffice JVM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Noel,

Great I'll try to do it...

I found the configuration file:
libreoffice/officecfg/registry/schema/org/openoffice/Office/Java.xcs
But I can't find the model to modify (ie: the xcu file).

And I think I found where the JVM is loaded:
/home/prrvchr/github/libreoffice/libreoffice/stoc/source/javaloader/javaloader.cxx
However I don't really understand what is done. I see that the configuration is read (ie: line 315) but I don't see where it is applied...

We also have to add a Java Jar archive in the folder:
program/classes
I suppose. Do you have a preference for the name of the archive and the name of the Java package?

Thank you for your help.

Pierre.

Le lun. 3 févr. 2025 à 06:55, Noel Grandin <noelgrandin@xxxxxxxxx> a écrit :
Sounds quite reasonable to add this to the core product behind an option. 

On Sat, 01 Feb 2025 at 21:18, Pierre Vacher <prrvchr@xxxxxxxxx> wrote:
Hi all,

I would like to add the Java Instrumentation API to the extensions running under LibreOffice and written in Java.

After some testing, I manage to load the Instrumentation agent at JVM startup, having taken care to add the necessary startup option (ie: -javaagent:/home/prrvchr/github/jdbcDriverOOo/source/UnoAgent/dist/UnoAgent.jar) and put this archive in the classpath (ie: Tools -> Options -> LibreOffice -> Advanced -> Java Options).

UnoAgent.jar is an archive containing only one class which itself contains only two methods and this gives access to code injection and the possibility of modifying the search path of the system bootloader. This currently allows me to be able to deploy an SPI service type like System.LoggerFinder,  and to be able to be the provider for the System.Logger interface for all running applications on the JVM.

If we want to make this feature accessible to any extension written in Java, it is necessary to make three modifications: - Add the UnoAgent.jar archive to the SDK. - Add an entry in the LibreOffice configuration (ie: xcu file) to enable or disable instrumentation. - Load the JVM with the parameters needed for instrumentation depending on the configuration.

Please let me know what you think about this.

Pierre


[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux