I am working with a Java instrumentation framework (DiSL) to profile some code. I am retrieving the values of local variables at various stages of execution, however some of them are only accessible as their memory locations, e.g. for a local var that is a char[]
, it returns an address like [C@7f9a81e8
. Is there a way to "dereference" that address, i.e. get the value of the variable that is stored there?
I was told that Java Reflection API could provide some necessary functionality, however I could not find relevant functions there, but I could have not looked well enough. My project is built with maven and JDK17. Will appreciate any advise. Thanks in advance.
Thanks all for the comments. I tried a few of the suggestions and in the end overwriting the toString()
method was the best solution.